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 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Implementation Notes for GNU CLISP</title><link rel="stylesheet" type="text/css" href="impnotes.css" /><link rev="made" href="mailto:clisp-list@lists.sourceforge.net" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><meta name="description" content="This document describes the GNU CLISP - an implementation of the ANSI CL standard. See for instructions on how to report bugs (both in the software and the documentaion). See for information on CLISP support." /><meta name="keywords" content="Lisp, Common Lisp, CLISP" /><meta name="date" content="'generated: 2017-10-27 14:57:00-04:00'" /><link rel="author" title="Authors" href="#authors" /><link rel="contents" title="Table of Contents" href="index.html" /><link rel="glossary" href="#glossary" /><link rel="help" href="#faq-help" title="How do I ask for help?" /><link rel="home" title="Home" href="http://clisp.org" /><link rel="index" href="idx.html" /></head><body><div class="book"><div class="titlepage"><div><div><h1 class="title"><a id="impnotes-top"></a>Implementation Notes for <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h1></div><div><h2 class="subtitle">These notes document <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version 2.49.60+</h2></div><div><h3 class="corpauthor"><span class="inlinemediaobject"><img src="clisp.png" /></span></h3></div><div><div class="authorgroup"><a id="authors"></a><div class="author"><h3 class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span></h3><span class="contrib">The original author and long-time maintainer.</span> </div><div class="author"><h3 class="author"><span class="firstname">Michael</span> <span class="surname">Stoll</span></h3><span class="contrib">The original author.</span> </div><div class="author"><h3 class="author"><span class="firstname">Sam</span> <span class="surname">Steingold</span></h3><span class="contrib">Co-maintainer since 1998.</span> </div><div class="othercredit"><h3 class="othercredit"><span class="othername">Others</span></h3><span class="contrib">See
<span class="emphasis"><em><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/COPYRIGHT"><code class="filename">COPYRIGHT</code></a></em></span>
for the list of other contributors and the license.
</span> </div></div></div><div><p class="copyright">Copyright © 1992-2010 Bruno Haible</p></div><div><p class="copyright">Copyright © 1998-2010 Sam Steingold</p></div><div><div class="legalnotice"><a id="legalese"></a><p class="legalnotice-title"><strong>Legal Status of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
Implementation Notes</strong></p><p>These notes are dually licensed under <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/fdl.html" target="_top">FDL</a> and <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>.
This means that you can redistribute this document under
either of these two licenses, at your choice.</p><p><strong>These notes are covered by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/fdl.html" target="_top">FDL</a>. </strong>Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License
(<a class="ulink" href="http://www.gnu.org/copyleft/fdl.html" target="_top">FDL</a>), either version 1.2 of the License, or (at your option) any
later version published by the <a class="ulink" href="http://www.fsf.org" target="_top">Free Software Foundation (FSF)</a>;
with no Invariant Sections,
with no Front-Cover Text, and
with no Back-Cover Texts.
A copy of the license is included in <a class="xref" href="#fdl" title="Appendix B. GNU Free Documentation License">Appendix B, <em>GNU Free Documentation License</em></a>.
</p><p><strong>These notes are covered by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>. </strong>This document documents free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
(<a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>), either version 2 of the License, or (at your option) any
later version published by the <a class="ulink" href="http://www.fsf.org" target="_top">Free Software Foundation (FSF)</a>.
A copy of the license is included in <a class="xref" href="#gpl" title="Appendix C. GNU General Public License">Appendix C, <em>GNU General Public License</em></a>.
</p></div></div><div><div class="revhistory"><table style="border-style:solid; width:100%;" summary="Revision History"><tr><th align="left" valign="top" colspan="3"><strong>CLISP Release History</strong></th></tr><tr><td align="left">Release <span class="revnumber">1</span></td><td align="left"><span class="revdate">April 1987 - July 1992</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The project was
started when both original authors, <span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span></span> and <span class="author"><span class="firstname">Michael</span> <span class="surname">Stoll</span></span>, were
students in Germany.</li><li class="listitem">The original version was for <a class="ulink" href="http://www.atari.org/" target="_top"><span class="platform">Atari</span></a> ST only,
written in 68000 assembly language and <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.0</span></td><td align="left"><span class="revdate">1992-10-09</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">the USENET newsgroup <a class="" href="https://groups.google.com/group/comp.os.linux">comp.os.linux</a>
announcement (<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> binaries only)</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.1</span></td><td align="left"><span class="revdate">1993-01-01</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The first portable
release, with source, released under <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>.</li><li class="listitem">Supported platforms: <a class="ulink" href="http://www.atari.org/" target="_top"><span class="platform">Atari</span></a> ST, <a class="ulink" href="http://www.amiga.org/" target="_top"><span class="platform">Amiga</span></a> 500-2000, <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a>
(emx, djgpp), <a class="ulink" href="http://www.os2.org/" target="_top"><span class="platform">OS/2</span></a> (emx), Unix (<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a>, Sun4, Sun386, HP9000/800).
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.1.1</span></td><td align="left"><span class="revdate">1993-01-11</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.1.2</span></td><td align="left"><span class="revdate">1993-02-01</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.1.3</span></td><td align="left"><span class="revdate">1993-02-03</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.2</span></td><td align="left"><span class="revdate">1993-02-21</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Add test suite.
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.2.1</span></td><td align="left"><span class="revdate">1993-03-04</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.2.2</span></td><td align="left"><span class="revdate">1993-03-19</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#ed" title="25.2.9. Function ED"><code class="varname">CUSTOM:*EDITOR*</code></a>
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.3</span></td><td align="left"><span class="revdate">1993-03-30</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_load-time-value.html" target="_top"><code class="function">LOAD-TIME-VALUE</code></a></li><li class="listitem"><a class="link" href="#default-dir" title="20.3.5. Function EXT:DEFAULT-DIRECTORY"><code class="function">EXT:DEFAULT-DIRECTORY</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.3.1</span></td><td align="left"><span class="revdate">1993-04-05</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.4</span></td><td align="left"><span class="revdate">1993-05-24</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a></li><li class="listitem"><a class="xref" href="#screen" title="32.1. Random Screen Access">Section 32.1, “Random Screen Access”</a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.5</span></td><td align="left"><span class="revdate">1993-06-29</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> function names.</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_print-unr_dable-object.html" target="_top"><code class="function">PRINT-UNREADABLE-OBJECT</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_symbol-macrolet.html" target="_top"><code class="function">SYMBOL-MACROLET</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.5.1</span></td><td align="left"><span class="revdate">1993-07-17</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">immutable objects</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.6</span></td><td align="left"><span class="revdate">1993-08-22</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a> package: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, <a class="link" href="#gen-flet"><code class="function">CLOS:GENERIC-FLET</code></a>, <a class="link" href="#gen-labels"><code class="function">CLOS:GENERIC-LABELS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-slots.html" target="_top"><code class="function">WITH-SLOTS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-accessors.html" target="_top"><code class="function">WITH-ACCESSORS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>, (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>),
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_class-of.html" target="_top"><code class="function">CLASS-OF</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a>, (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a>), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-boundp.html" target="_top"><code class="function">SLOT-BOUNDP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-makunbound.html" target="_top"><code class="function">SLOT-MAKUNBOUND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-exists-p.html" target="_top"><code class="function">SLOT-EXISTS-P</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_next-method-p.html" target="_top"><code class="function">NEXT-METHOD-P</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-_cable-method.html" target="_top"><code class="function">NO-APPLICABLE-METHOD</code></a>,
<a class="link" href="#no-prim"><code class="function">CLOS:NO-PRIMARY-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-next-method.html" target="_top"><code class="function">NO-NEXT-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_find-method.html" target="_top"><code class="function">FIND-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_com_able-methods.html" target="_top"><code class="function">COMPUTE-APPLICABLE-METHODS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_fun_ion-keywords.html" target="_top"><code class="function">FUNCTION-KEYWORDS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_slot-missing.html" target="_top"><code class="function">SLOT-MISSING</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_slot-unbound.html" target="_top"><code class="function">SLOT-UNBOUND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_describe-object.html" target="_top"><code class="function">DESCRIBE-OBJECT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.6.1</span></td><td align="left"><span class="revdate">1993-09-01</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.7</span></td><td align="left"><span class="revdate">1993-09-27</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">top-level forms</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_declaim.html" target="_top"><code class="function">DECLAIM</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.8</span></td><td align="left"><span class="revdate">1993-11-08</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a></li><li class="listitem">New module: STDWIN</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.9</span></td><td align="left"><span class="revdate">1994-01-08</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-condition.html" target="_top"><code class="function">DEFINE-CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_ignore-errors.html" target="_top"><code class="function">IGNORE-ERRORS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-case.html" target="_top"><code class="function">HANDLER-CASE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>, <a class="link" href="#with-restarts" title="Macro EXT:WITH-RESTARTS"><code class="function">EXT:WITH-RESTARTS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-simple-restart.html" target="_top"><code class="function">WITH-SIMPLE-RESTART</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-bind.html" target="_top"><code class="function">RESTART-BIND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-cond_ion-restarts.html" target="_top"><code class="function">WITH-CONDITION-RESTARTS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_serious-condition.html" target="_top"><code class="classname">SERIOUS-CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_program-error.html" target="_top"><code class="classname">PROGRAM-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_control-error.html" target="_top"><code class="classname">CONTROL-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_arithmetic-error.html" target="_top"><code class="classname">ARITHMETIC-ERROR</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_division-by-zero.html" target="_top"><code class="classname">DIVISION-BY-ZERO</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_int-overflow.html" target="_top"><code class="classname">FLOATING-POINT-OVERFLOW</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_nt-underflow.html" target="_top"><code class="classname">FLOATING-POINT-UNDERFLOW</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_cell-error.html" target="_top"><code class="classname">CELL-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_unbound-variable.html" target="_top"><code class="classname">UNBOUND-VARIABLE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_undefined-function.html" target="_top"><code class="classname">UNDEFINED-FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_type-error.html" target="_top"><code class="classname">TYPE-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_package-error.html" target="_top"><code class="classname">PACKAGE-ERROR</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_stream-error.html" target="_top"><code class="classname">STREAM-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_end-of-file.html" target="_top"><code class="classname">END-OF-FILE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_file-error.html" target="_top"><code class="classname">FILE-ERROR</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_storage-condition.html" target="_top"><code class="classname">STORAGE-CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_simple-condition.html" target="_top"><code class="classname">SIMPLE-CONDITION</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_simple-error.html" target="_top"><code class="classname">SIMPLE-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_simple-type-error.html" target="_top"><code class="classname">SIMPLE-TYPE-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_simple-warning.html" target="_top"><code class="classname">SIMPLE-WARNING</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-condition.html" target="_top"><code class="function">MAKE-CONDITION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compute-restarts.html" target="_top"><code class="function">COMPUTE-RESTARTS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_find-restart.html" target="_top"><code class="function">FIND-RESTART</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-restart.html" target="_top"><code class="function">INVOKE-RESTART</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-re_nteractively.html" target="_top"><code class="function">INVOKE-RESTART-INTERACTIVELY</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">ABORT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">MUFFLE-WARNING</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">STORE-VALUE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">USE-VALUE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-debugger.html" target="_top"><code class="function">INVOKE-DEBUGGER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_restart-name.html" target="_top"><code class="function">RESTART-NAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_arithmeti_or-operation.html" target="_top"><code class="function">ARITHMETIC-ERROR-OPERATION</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_arithmeti_or-operation.html" target="_top"><code class="function">ARITHMETIC-ERROR-OPERANDS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cell-error-name.html" target="_top"><code class="function">CELL-ERROR-NAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-DATUM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-EXPECTED-TYPE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_package-error-package.html" target="_top"><code class="function">PACKAGE-ERROR-PACKAGE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-error-stream.html" target="_top"><code class="function">STREAM-ERROR-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-error-pathname.html" target="_top"><code class="function">FILE-ERROR-PATHNAME</code></a>,
<code class="function">EXT:SIMPLE-CONDITION-FORMAT-STRING</code>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_simple-co_at-arguments.html" target="_top"><code class="function">SIMPLE-CONDITION-FORMAT-ARGUMENTS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stbreak-on-signalsst.html" target="_top"><code class="varname">*BREAK-ON-SIGNALS*</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebugger-hookst.html" target="_top"><code class="varname">*DEBUGGER-HOOK*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.10</span></td><td align="left"><span class="revdate">1994-06-22</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>, <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a>,
<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>, <a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a></li><li class="listitem"><a class="xref" href="#gstream" title="31.6. Generic streams">Section 31.6, “Generic streams”</a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.11</span></td><td align="left"><span class="revdate">1994-07-04</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_loop-finish.html" target="_top"><code class="function">LOOP-FINISH</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_map-into.html" target="_top"><code class="function">MAP-INTO</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-LONG-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.12</span></td><td align="left"><span class="revdate">1994-08-23</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_destructuring-bind.html" target="_top"><code class="function">DESTRUCTURING-BIND</code></a></li><li class="listitem"><a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.12.1</span></td><td align="left"><span class="revdate">1994-09-01</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.13</span></td><td align="left"><span class="revdate">1994-10-26</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_wild-pathname-p.html" target="_top"><code class="function">WILD-PATHNAME-P</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-match-p.html" target="_top"><code class="function">PATHNAME-MATCH-P</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_logical-pathname.html" target="_top"><code class="function">LOGICAL-PATHNAME</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_logical-p_translations.html" target="_top"><code class="function">LOGICAL-PATHNAME-TRANSLATIONS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate_cal-pathname.html" target="_top"><code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load-logi_translations.html" target="_top"><code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file-pathname.html" target="_top"><code class="function">COMPILE-FILE-PATHNAME</code></a>
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.13.1</span></td><td align="left"><span class="revdate">1995-01-01</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.14</span></td><td align="left"><span class="revdate">1995-04-04</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_row-major-aref.html" target="_top"><code class="function">ROW-MAJOR-AREF</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_delete-package.html" target="_top"><code class="function">DELETE-PACKAGE</code></a>,
<a class="link" href="#muffle-cerrors" title="Macro EXT:MUFFLE-CERRORS"><code class="function">EXT:MUFFLE-CERRORS</code></a>, <a href="impnotes.html#appease-cerrors" class="olink"><code class="function">EXT:APPEASE-CERRORS</code></a>, <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.15</span></td><td align="left"><span class="revdate">1995-04-25</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">New modules: <code class="filename">wildcard</code>,
<span class="module"><a class="filename" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><code class="filename">regexp</code></a></span></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_formatter.html" target="_top"><code class="function">FORMATTER</code></a>, <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_concatenated-stream.html" target="_top"><code class="classname">CONCATENATED-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_two-way-stream.html" target="_top"><code class="classname">TWO-WAY-STREAM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_echo-stream.html" target="_top"><code class="classname">ECHO-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_synonym-stream-symbol.html" target="_top"><code class="function">SYNONYM-STREAM-SYMBOL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_broadcast_ream-streams.html" target="_top"><code class="function">BROADCAST-STREAM-STREAMS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_concatena_ream-streams.html" target="_top"><code class="function">CONCATENATED-STREAM-STREAMS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_two-way-s_utput-stream.html" target="_top"><code class="function">TWO-WAY-STREAM-INPUT-STREAM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_two-way-s_utput-stream.html" target="_top"><code class="function">TWO-WAY-STREAM-OUTPUT-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_echo-stre_utput-stream.html" target="_top"><code class="function">ECHO-STREAM-INPUT-STREAM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_echo-stre_utput-stream.html" target="_top"><code class="function">ECHO-STREAM-OUTPUT-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_print-not-readable.html" target="_top"><code class="classname">PRINT-NOT-READABLE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_print-not_dable-object.html" target="_top"><code class="function">PRINT-NOT-READABLE-OBJECT</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.16</span></td><td align="left"><span class="revdate">1995-06-23</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_complement.html" target="_top"><code class="function">COMPLEMENT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-stan_rd-io-syntax.html" target="_top"><code class="function">WITH-STANDARD-IO-SYNTAX</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_dynamic-extent.html" target="_top"><code class="literal">DYNAMIC-EXTENT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_ignorecm_ignorable.html" target="_top"><code class="literal">IGNORABLE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantly.html" target="_top"><code class="function">CONSTANTLY</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-hash_ble-iterator.html" target="_top"><code class="function">WITH-HASH-TABLE-ITERATOR</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-rehash-size.html" target="_top"><code class="function">HASH-TABLE-REHASH-SIZE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-tabl_sh-threshold.html" target="_top"><code class="function">HASH-TABLE-REHASH-THRESHOLD</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-size.html" target="_top"><code class="function">HASH-TABLE-SIZE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.17</span></td><td align="left"><span class="revdate">1996-07-21</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a>, <a class="link" href="#sose-close"><code class="function">SOCKET:SOCKET-SERVER-CLOSE</code></a>, <a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-PORT</code></a>, <a class="link" href="#so-wait"><code class="function">SOCKET:SOCKET-WAIT</code></a>,
<a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a>, <a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a>, <a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-HOST</code></a>, <a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-PORT</code></a>,
<code class="function">SOCKET:SOCKET-SERVICE-PORT</code>, <a class="link" href="#sost-peer"><code class="function">SOCKET:SOCKET-STREAM-PEER</code></a>
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.18</span></td><td align="left"><span class="revdate">1997-05-03</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#deflang"><code class="function">I18N:DEFLANGUAGE</code></a>, <a class="link" href="#def-i-l"><code class="function">I18N:DEFINTERNATIONAL</code></a>, <a class="link" href="#defloc"><code class="function">I18N:DEFLOCALIZED</code></a></li><li class="listitem"><a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.19</span></td><td align="left"><span class="revdate">1997-08-07</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.cliki.net/CLX" target="_top"><span class="command"><strong>CLX</strong></span></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.20</span></td><td align="left"><span class="revdate">1997-09-25</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stread-evalst.html" target="_top"><code class="varname">*READ-EVAL*</code></a></li><li class="listitem"><a class="link" href="#time" title="25.2.8. Macro TIME"><code class="function">EXT:TIMES</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.20.1</span></td><td align="left"><span class="revdate">1997-12-06</span></td><td align="left">bruno</td></tr><tr><td align="left">Release <span class="revnumber">2.21</span></td><td align="left"><span class="revdate">1998-09-09</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">Removed module STDWIN.</li><li class="listitem"><a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a>, <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_oint-inexact.html" target="_top"><code class="classname">FLOATING-POINT-INEXACT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_id-operation.html" target="_top"><code class="classname">FLOATING-POINT-INVALID-OPERATION</code></a></li><li class="listitem"><a class="link" href="#probe-dir" title="20.3.1. Function EXT:PROBE-DIRECTORY"><code class="function">EXT:PROBE-DIRECTORY</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ensure-di_tories-exist.html" target="_top"><code class="function">ENSURE-DIRECTORIES-EXIST</code></a></li><li class="listitem"> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-right-marginst.html" target="_top"><code class="varname">*PRINT-RIGHT-MARGIN*</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-displacement.html" target="_top"><code class="function">ARRAY-DISPLACEMENT</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_copy-structure.html" target="_top"><code class="function">COPY-STRUCTURE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_special-operator-p.html" target="_top"><code class="function">SPECIAL-OPERATOR-P</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.22</span></td><td align="left"><span class="revdate">1999-01-08</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-char.html" target="_top"><code class="classname">BASE-CHAR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_extended-char.html" target="_top"><code class="classname">EXTENDED-CHAR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-string.html" target="_top"><code class="classname">BASE-STRING</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-base-string.html" target="_top"><code class="classname">SIMPLE-BASE-STRING</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-setf-expansion.html" target="_top"><code class="function">GET-SETF-EXPANSION</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-setf-expander.html" target="_top"><code class="function">DEFINE-SETF-EXPANDER</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_parse-error.html" target="_top"><code class="classname">PARSE-ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_reader-error.html" target="_top"><code class="classname">READER-ERROR</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_unbound-slot-instance.html" target="_top"><code class="function">UNBOUND-SLOT-INSTANCE</code></a></li><li class="listitem"><a class="link" href="#sost-local"><code class="function">SOCKET:SOCKET-STREAM-LOCAL</code></a>, <a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-HOST</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.23</span></td><td align="left"><span class="revdate">1999-07-22</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">New module:
<span class="module"><a class="filename" href="#postgresql" title="33.9. PostgreSQL Database Access"><code class="filename">postgresql</code></a></span></li><li class="listitem"><a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a>, <a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a>, <a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a>, <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a>,
<a href="impnotes.html#term-enc" class="olink"><code class="varname">CUSTOM:*TERMINAL-ENCODING*</code></a>, <a href="impnotes.html#misc-enc" class="olink"><code class="varname">CUSTOM:*MISC-ENCODING*</code></a> <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a>,
<code class="varname">AFFI:*FOREIGN-ENCODING*</code></li><li class="listitem"><a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-package-iterator.html" target="_top"><code class="function">WITH-PACKAGE-ITERATOR</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a></li><li class="listitem"><a class="xref" href="#weak-pointer" title="31.7.1. Weak Pointers">Section 31.7.1, “Weak Pointers”</a></li><li class="listitem"><a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER & EXT:READ-FLOAT"><code class="function">EXT:READ-INTEGER</code></a>, <a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER & EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-INTEGER</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_simple-co_at-arguments.html" target="_top"><code class="function">SIMPLE-CONDITION-FORMAT-CONTROL</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.24</span></td><td align="left"><span class="revdate">2000-03-06</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER & EXT:READ-FLOAT"><code class="function">EXT:READ-FLOAT</code></a>,
<a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER & EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-FLOAT</code></a></li><li class="listitem"><a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a>, <a class="link" href="#string-width" title="16.1.2. Function EXT:STRING-WIDTH"><code class="function">EXT:STRING-WIDTH</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-compilation-unit.html" target="_top"><code class="function">WITH-COMPILATION-UNIT</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.25</span></td><td align="left"><span class="revdate">2001-03-15</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a>,
<code class="function">EXT:CLHS</code></li><li class="listitem"><a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-FROM-BYTES</code></a>,
<a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-TO-BYTES</code></a></li><li class="listitem"><a class="link" href="#rbla"><code class="function">EXT:READ-BYTE-LOOKAHEAD</code></a>, <a class="link" href="#st-rbla"><code class="function">GRAY:STREAM-READ-BYTE-LOOKAHEAD</code></a>, <a class="link" href="#rbwhp"><code class="function">EXT:READ-BYTE-WILL-HANG-P</code></a>, <a class="link" href="#rbwhp"><code class="function">GRAY:STREAM-READ-BYTE-WILL-HANG-P</code></a>, <a class="link" href="#rbnh"><code class="function">EXT:READ-BYTE-NO-HANG</code></a>,
<a class="link" href="#rbnh"><code class="function">GRAY:STREAM-READ-BYTE-NO-HANG</code></a></li><li class="listitem"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> improvements (UNC pathnames, registry,
screen)</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.25.1</span></td><td align="left"><span class="revdate">2001-04-06</span></td><td align="left">sds</td></tr><tr><td align="left">Release <span class="revnumber">2.26</span></td><td align="left"><span class="revdate">2001-05-23</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">dropped CLtL1,
added <code class="constant">:LISP=CL</code> to <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-compiler-macro.html" target="_top"><code class="function">DEFINE-COMPILER-MACRO</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_upgraded-_ex-part-type.html" target="_top"><code class="function">UPGRADED-COMPLEX-PART-TYPE</code></a></li><li class="listitem"><a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a>, <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> accept <code class="constant">:WAIT</code></li><li class="listitem">compiler checks function call signatures
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.27</span></td><td align="left"><span class="revdate">2001-07-17</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a>)</code></li><li class="listitem"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/install.bat"><code class="filename">src/install.bat</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.28</span></td><td align="left"><span class="revdate">2002-03-03</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] Pretty-Printer</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-load-form.html" target="_top"><code class="function">MAKE-LOAD-FORM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-load_saving-slots.html" target="_top"><code class="function">MAKE-LOAD-FORM-SAVING-SLOTS</code></a></li><li class="listitem"><a class="xref" href="#weak-ht" title="31.7.9. Weak Hash Tables">Section 31.7.9, “Weak Hash Tables”</a></li><li class="listitem"><a class="link" href="#fcase" title="5.6. Macro EXT:FCASE"><code class="function">EXT:FCASE</code></a></li><li class="listitem"><a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.29</span></td><td align="left"><span class="revdate">2002-07-25</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Bug-fix/portability:
<a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> 3.1 etc</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.30</span></td><td align="left"><span class="revdate">2002-09-15</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Do not bundle
<a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>, <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">gettext</a>, <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a>, <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://libsigsegv.sourceforge.net/" target="_top">libsigsegv</a>.</li><li class="listitem"><a class="link" href="#charset-UCS-4"><code class="constant">CHARSET:UCS-4</code></a></li><li class="listitem"><a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a></li><li class="listitem"><a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a></li><li class="listitem"><a class="link" href="#stream-lock"><code class="function">POSIX:STREAM-LOCK</code></a>, <a class="link" href="#copy-file"><code class="function">POSIX:COPY-FILE</code></a>,
<a class="link" href="#dup-handle"><code class="function">POSIX:DUPLICATE-HANDLE</code></a></li><li class="listitem">New module: <span class="module"><a class="filename" href="#oracle" title="33.10. Oracle Interface"><code class="filename">oracle</code></a></span></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.31</span></td><td align="left"><span class="revdate">2003-09-01</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">New modules:
<span class="module"><a class="filename" href="#fastcgi" title="33.18. The FastCGI Interface"><code class="filename">fastcgi</code></a></span>, <span class="module"><a class="filename" href="#dir-key" title="33.8. Directory Access"><code class="filename">dirkey</code></a></span>, <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/bindings/win32/"><code class="filename">bindings/win32</code></a></span>,
<span class="module"><a class="filename" href="#syscalls" title="33.2. System Calls"><code class="filename">syscalls</code></a></span>, <span class="module"><a class="filename" href="#netica" title="33.14. Netica Interface"><code class="filename">netica</code></a></span></li><li class="listitem">Support modules on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</li><li class="listitem"><a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> 3.2</li><li class="listitem">New backquote implementation.</li><li class="listitem">Many [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] compliance fixes.</li><li class="listitem">More <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> functionality.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.32</span></td><td align="left"><span class="revdate">2003-12-29</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">support
<a class="ulink" href="http://www.unix.org/version2/whatsnew/lfs.html" target="_top"><span class="platform">LFS</span></a></li><li class="listitem">New modules: <span class="module"><a class="filename" href="#berkeley-db" title="33.7. Berkeley DB access"><code class="filename">berkeley-db</code></a></span>,
<span class="module"><a class="filename" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="filename">pcre</code></a></span></li></ul></div>
</td></tr><tr><td align="left">Release <span class="revnumber">2.33</span></td><td align="left"><span class="revdate">2004-03-17</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="link" href="#mod-expt" title="Function EXT:MOD-EXPT"><code class="function">EXT:MOD-EXPT</code></a>,
<a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>, <a class="link" href="#argv" title="25.3.5. Function EXT:ARGV"><code class="function">EXT:ARGV</code></a>, <a class="link" href="#st-position"><code class="function">GRAY:STREAM-POSITION</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a></li><li class="listitem">Portability: removed <a class="ulink" href="https://en.wikipedia.org/wiki/Acorn_Computers" target="_top"><span class="platform">Acorn</span></a> and <a class="ulink" href="http://www.amiga.org/" target="_top"><span class="platform">Amiga</span></a> support,
fixed UNIXes.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.33.1</span></td><td align="left"><span class="revdate">2004-05-22</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Bug-fixes, portability:
<a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> 3.4</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.33.2</span></td><td align="left"><span class="revdate">2004-06-02</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portability: RedHat Fedora
<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a>/x86</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.34</span></td><td align="left"><span class="revdate">2005-07-20</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem"><a class="xref" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Chapter 29, <em>Meta-Object Protocol</em></a></li><li class="listitem"><a class="xref" href="#weak" title="31.7. Weak Objects">Section 31.7, “Weak Objects”</a></li><li class="listitem"><a class="xref" href="#package-case" title="11.5. Package Case-Sensitivity">Section 11.5, “Package Case-Sensitivity”</a></li><li class="listitem"><a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a>,
<a href="impnotes.html#without-global-handlers" class="olink"><code class="function">EXT:WITHOUT-GLOBAL-HANDLERS</code></a></li><li class="listitem">Portability: removed <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a> and <a class="ulink" href="http://www.os2.org/" target="_top"><span class="platform">OS/2</span></a>
support.</li><li class="listitem">New modules: <span class="module"><a class="filename" href="#matlab" title="33.13. Matlab Interface"><code class="filename">matlab</code></a></span>, <span class="module"><a class="filename" href="#rawsock" title="33.17. Raw Socket Access"><code class="filename">rawsock</code></a></span>, <span class="module"><a class="filename" href="#zlib" title="33.16. Interface to zlib"><code class="filename">zlib</code></a></span>,
<span class="module"><a class="filename" href="#i18n-mod" title="33.3. Internationalization of User Programs"><code class="filename">i18n</code></a></span>, <span class="module"><a class="filename" href="#pari" title="33.12. Computer Algebra System PARI"><code class="filename">pari</code></a></span>.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.35</span></td><td align="left"><span class="revdate">2005-08-29</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#compiled-file-p" title="24.7. Function EXT:COMPILED-FILE-P [CLRFI-2]"><code class="function">EXT:COMPILED-FILE-P</code></a></li><li class="listitem"><a class="link" href="#char-invertcase" title="13.7.1. Function EXT:CHAR-INVERTCASE"><code class="function">EXT:CHAR-INVERTCASE</code></a>, <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:STRING-INVERTCASE</code></a>,
<a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:NSTRING-INVERTCASE</code></a></li><li class="listitem"><a class="link" href="#fcntl"><code class="function">POSIX:STREAM-OPTIONS</code></a></li><li class="listitem">Close all <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s before
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html"><code class="function">exec</code></a>.</li></ul></div>
</td></tr><tr><td align="left">Release <span class="revnumber">2.36</span></td><td align="left"><span class="revdate">2005-12-04</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a>, <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a>,
<a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a>, <a class="link" href="#base64"><code class="constant">BASE64</code></a>
</li><li class="listitem"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/demos/koch.lisp"><code class="filename">modules/clx/new-clx/demos/koch.lisp</code></a></li><li class="listitem"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spvw_sigterm.d"><code class="filename">src/spvw_sigterm.d</code></a></li></ul></div>
</td></tr><tr><td align="left">Release <span class="revnumber">2.37</span></td><td align="left"><span class="revdate">2006-01-02</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a> accepts
<code class="constant">:INTERFACE</code> and <code class="constant">:BACKLOG</code>.
</li><li class="listitem">Fixed <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a>)</code>.
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.38</span></td><td align="left"><span class="revdate">2006-01-24</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> creates standalone
executables.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.39</span></td><td align="left"><span class="revdate">2006-07-16</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Reliable stack
overflow detection and recovery.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.40</span></td><td align="left"><span class="revdate">2006-09-23</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">Keep doc string and <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> in the closure object.
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.41</span></td><td align="left"><span class="revdate">2006-10-13</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a></li><li class="listitem">New module: <span class="module"><a class="filename" href="#libsvm" title="33.11. LibSVM Interface"><code class="filename">libsvm</code></a></span></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.42</span></td><td align="left"><span class="revdate">2007-10-16</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="#defstruct-mop" title="8.2. The structure Meta-Object Protocol">Section 8.2, “The structure Meta-Object Protocol”</a></li><li class="listitem"><a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a></li><li class="listitem">Many additions to
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/demos/"><code class="filename">modules/clx/new-clx/demos/</code></a>
</li><li class="listitem">New modules: <span class="module"><a class="filename" href="#gtk" title="33.20. GTK Interface"><code class="filename">gtk2</code></a></span>, <span class="module"><a class="filename" href="#gdbm" title="33.6. GDBM - The GNU database manager"><code class="filename">gdbm</code></a></span></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.43</span></td><td align="left"><span class="revdate">2007-11-18</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> build process is now in compliance
with the GNU standards.</li><li class="listitem">Use <span class="command"><strong>gnulib-tool</strong></span> to sync
with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gnulib/" target="_top">Portability Library</a>.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.43.1</span></td><td align="left"><span class="revdate">2008-02-24</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portability: work around
<a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> <a class="ulink" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34300" target="_top">bug
34300</a> present in <a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> 4.2 and 4.3.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.44</span></td><td align="left"><span class="revdate">2008-02-02</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Do not bundle <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libffcall/" target="_top">libffcall</a>.
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.44.1</span></td><td align="left"><span class="revdate">2008-02-24</span></td><td align="left">bruno</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portability: work around
<a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> <a class="ulink" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34300" target="_top">bug
34300</a> present in <a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> 4.2 and 4.3.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.45</span></td><td align="left"><span class="revdate">2008-05-15</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Changed <a href="impnotes.html#bytecode" class="olink">bytecode</a> format</li><li class="listitem">Just-In-Time compilation (<span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span>)
via <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/lightning/" target="_top">lightning</a>.</li><li class="listitem"><a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> and <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> accept <code class="constant">:VERSION</code>.
</li><li class="listitem"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> commands accept arguments.</li><li class="listitem"><a class="xref" href="#stdio" title="33.2.14. Standard file input and output">Section 33.2.14, “Standard file input and output”</a>.</li><li class="listitem">Fixed cross-compilation.</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.46</span></td><td align="left"><span class="revdate">2008-07-02</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="constant">:WORD-SIZE=64</code> in
<a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> on 64-bit platforms.</li><li class="listitem"><a class="xref" href="#errno" title="33.2.15. Error handling">Section 33.2.15, “Error handling”</a>.</li><li class="listitem">Macro <code class="function">XLIB:WITH-OPEN-DISPLAY</code>.
</li><li class="listitem">Fixed the remaining bugs in
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> bindings in evaluated code on <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> platforms.
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.47</span></td><td align="left"><span class="revdate">2008-10-23</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">New module: <span class="module"><a class="filename" href="#dbus" title="33.19. Interface to D-Bus"><code class="filename">dbus</code></a></span></li><li class="listitem"><a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a></li><li class="listitem"><a class="link" href="#canonicalize" title="31.11.13. Function EXT:CANONICALIZE"><code class="function">EXT:CANONICALIZE</code></a></li><li class="listitem"><a class="link" href="#reopen" title="Variable CUSTOM:*REOPEN-OPEN-FILE*"><code class="varname">CUSTOM:*REOPEN-OPEN-FILE*</code></a></li><li class="listitem"><a class="link" href="#file-size"><code class="function">POSIX:FILE-SIZE</code></a></li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.48</span></td><td align="left"><span class="revdate">2009-07-28</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Thread support
(<span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span>), see <a class="xref" href="#mt" title="32.5. Multiple Threads of Execution">Section 32.5, “Multiple Threads of Execution”</a></li><li class="listitem"><a class="link" href="#wait"><code class="function">POSIX:WAIT</code></a>
</li><li class="listitem">
<a class="link" href="#trim-if" title="17.1.1. Function EXT:TRIM-IF"><code class="function">EXT:TRIM-IF</code></a>
</li><li class="listitem">
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/m4/clisp.m4"><code class="filename">src/m4/clisp.m4</code></a>
</li></ul></div></td></tr><tr><td align="left">Release <span class="revnumber">2.49</span></td><td align="left"><span class="revdate">2010-07-07</span></td><td align="left">sds</td></tr><tr><td align="left" colspan="3"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a href="clisp-link.html#opt-install" class="olink"><code class="varname">CUSTOM:*USER-LIB-DIRECTORY*</code></a>; <a class="link" href="#mod-dynload" title="32.2.5. Dynamic module loading">dynamic
modules</a> are now the default build option</li><li class="listitem"><code class="option"><a href="clisp.html#opt-norl" class="olink">-disable-readline</a></code></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss065.html" target="_top">COMPILER-DIAGNOSTICS:USE-HANDLER</a></li><li class="listitem">Updated <span class="module"><a class="filename" href="#pari" title="33.12. Computer Algebra System PARI"><code class="filename">pari</code></a></span></li></ul></div></td></tr></table></div></div><div><div class="abstract"><a id="clisp-abstract"></a><p class="title"><strong>Abstract</strong></p><p>This document describes the
<a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> - an implementation of the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</p><p>See <a href="clisp.html#bugs" class="olink">the section called “Bugs”</a> for instructions
on how to report bugs (both in the software and the documentaion).</p><p>See <a href="impnotes.html#faq-help" class="olink">Q: A.1.1.5</a> for
information on <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> support.</p></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="preface"><a href="#overview">Overview</a></span></dt><dt><span class="preface"><a href="#conventions">Conventions</a></span></dt><dt><span class="part"><a href="#clhs-chapters">I. Chapters or the Common Lisp HyperSpec</a></span></dt><dd><dl><dt><span class="chapter"><a href="#intro">1. Introduction chap-1</a></span></dt><dd><dl><dt><span class="section"><a href="#spec-symb">1.1. Special Symbols sec_1-4-1-3</a></span></dt><dt><span class="section"><a href="#error-terms">1.2. Error Terminology sec_1-4-2</a></span></dt><dt><span class="section"><a href="#cl-symb">1.3. Symbols in the Package <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> sec_1-9</a></span></dt></dl></dd><dt><span class="chapter"><a href="#syntax">2. Syntax chap-2</a></span></dt><dd><dl><dt><span class="section"><a href="#std-char">2.1. Standard Characters sec_2-1-3</a></span></dt><dt><span class="section"><a href="#reader-alg">2.2. Reader Algorithm sec_2-2</a></span></dt><dt><span class="section"><a href="#tokens">2.3. Symbols as Tokens sec_2-3-4</a></span></dt><dt><span class="section"><a href="#valid-patterns">2.4. Valid Patterns for Tokens sec_2-3-5</a></span></dt><dt><span class="section"><a href="#backquote">2.5. Backquote sec_2-4-6</a></span></dt><dt><span class="section"><a href="#sharpsign">2.6. Sharpsign sec_2-4-8</a></span></dt></dl></dd><dt><span class="chapter"><a href="#eval">3. Evaluation and Compilation chap-3</a></span></dt><dd><dl><dt><span class="section"><a href="#evaluation">3.1. Evaluation sec_3-1</a></span></dt><dt><span class="section"><a href="#compilation">3.2. Compilation sec_3-2</a></span></dt><dt><span class="section"><a href="#declarations">3.3. Declarations sec_3-3</a></span></dt><dt><span class="section"><a href="#lalist">3.4. Lambda Lists sec_3-4</a></span></dt></dl></dd><dt><span class="chapter"><a href="#types-classes">4. Types and Classes chap-4</a></span></dt><dd><dl><dt><span class="section"><a href="#types">4.1. Types sec_4-2</a></span></dt><dt><span class="section"><a href="#classes">4.2. Classes sec_4-3</a></span></dt><dt><span class="section"><a href="#clos-diff">4.3. Deviations from ANSI CL standard</a></span></dt><dt><span class="section"><a href="#metaclasses">4.4. Standard Metaclasses sec_4-3-1-1</a></span></dt><dt><span class="section"><a href="#def-class">4.5. Defining Classes sec_4-3-2</a></span></dt><dt><span class="section"><a href="#redef-class">4.6. Redefining Classes sec_4-3-6</a></span></dt></dl></dd><dt><span class="chapter"><a href="#data">5. Data and Control Flow chap-5</a></span></dt><dd><dl><dt><span class="section"><a href="#gen-ref">5.1. Generalized Reference sec_5-1</a></span></dt><dt><span class="section"><a href="#setf-expansion">5.2. Setf Expansions sec_5-1-1-2</a></span></dt><dt><span class="section"><a href="#extra-places">5.3. Kinds of Places sec_5-1-2</a></span></dt><dt><span class="section"><a href="#misc-data">5.4. Miscellaneous</a></span></dt><dt><span class="section"><a href="#defconstant">5.5. Macro <code class="function">DEFCONSTANT</code></a></span></dt><dt><span class="section"><a href="#fcase">5.6. Macro <code class="function">EXT:FCASE</code></a></span></dt><dt><span class="section"><a href="#xor">5.7. Function <code class="function">EXT:XOR</code></a></span></dt><dt><span class="section"><a href="#eq">5.8. Function <code class="function">EQ</code></a></span></dt><dt><span class="section"><a href="#func">5.9. Special Operator <code class="function">FUNCTION</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#iteration">6. Iteration chap-6</a></span></dt><dd><dl><dt><span class="section"><a href="#loop">6.1. The LOOP Facility sec_6-1</a></span></dt><dt><span class="section"><a href="#iter-misc">6.2. Miscellaneous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#objects">7. Objects chap-7</a></span></dt><dd><dl><dt><span class="section"><a href="#std-meth-combo">7.1. Standard Method Combination sec_7-6-6-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#structures">8. Structures chap-8</a></span></dt><dd><dl><dt><span class="section"><a href="#defstruct-options">8.1. The options for <code class="function">DEFSTRUCT</code></a></span></dt><dt><span class="section"><a href="#defstruct-mop">8.2. The structure Meta-Object Protocol</a></span></dt></dl></dd><dt><span class="chapter"><a href="#conditions">9. Conditions chap-9</a></span></dt><dd><dl><dt><span class="section"><a href="#cond-nl">9.1. Embedded Newlines in Condition Reports sec_9-1-3-1-3</a></span></dt><dt><span class="section"><a href="#cond-fname">9.2. Mentioning Containing Function in Condition Reports sec_9-1-3-1-5</a></span></dt><dt><span class="section"><a href="#restarts">9.3. Interfaces to Restarts sec_9-1-4-2-2</a></span></dt><dt><span class="section"><a href="#assertions">9.4. Assertions sec_9-1-5</a></span></dt></dl></dd><dt><span class="chapter"><a href="#symbols">10. Symbols chap-10</a></span></dt><dt><span class="chapter"><a href="#packages">11. Packages chap-11</a></span></dt><dd><dl><dt><span class="section"><a href="#pack-intro">11.1. Introduction to Packages sec_11-1-1</a></span></dt><dt><span class="section"><a href="#pack-lock">11.2. Constraints on the <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> Package for Conforming Programs - package locking sec_11-1-2-1-2</a></span></dt><dt><span class="section"><a href="#clupack">11.3. The <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong> Package sec_11-1-2-2</a></span></dt><dt><span class="section"><a href="#imppack">11.4. Implementation-Defined Packages sec_11-1-2-4</a></span></dt><dt><span class="section"><a href="#package-case">11.5. Package Case-Sensitivity</a></span></dt></dl></dd><dt><span class="chapter"><a href="#numbers">12. Numbers chap-12</a></span></dt><dd><dl><dt><span class="section"><a href="#num-types">12.1. Numeric Types</a></span></dt><dt><span class="section"><a href="#num-concepts">12.2. Number Concepts sec_12-1</a></span></dt></dl></dd><dt><span class="chapter"><a href="#characters">13. Characters chap-13</a></span></dt><dd><dl><dt><span class="section"><a href="#char-intro">13.1. Introduction to Characters sec_13-1</a></span></dt><dt><span class="section"><a href="#char-sets">13.2. Character sets</a></span></dt><dt><span class="section"><a href="#char-script">13.3. Character Scripts sec_13-1-2-1</a></span></dt><dt><span class="section"><a href="#char-attrib">13.4. Character Attributes sec_13-1-3</a></span></dt><dt><span class="section"><a href="#graph-char">13.5. Graphic Characters sec_13-1-4-1</a></span></dt><dt><span class="section"><a href="#alpha-char">13.6. Alphabetic Characters sec_13-1-4-2</a></span></dt><dt><span class="section"><a href="#char-case">13.7. Characters With Case sec_13-1-4-3</a></span></dt><dt><span class="section"><a href="#num-char">13.8. Numeric Characters sec_13-1-4-4</a></span></dt><dt><span class="section"><a href="#char-ord">13.9. Ordering of Characters sec_13-1-6</a></span></dt><dt><span class="section"><a href="#char-names">13.10. Character Names sec_13-1-7</a></span></dt><dt><span class="section"><a href="#clhs-newline">13.11. Treatment of Newline during Input and Output sec_13-1-8</a></span></dt><dt><span class="section"><a href="#char-int">13.12. Character Encodings sec_13-1-9</a></span></dt><dt><span class="section"><a href="#script-ext">13.13. Documentation of Implementation-Defined Scripts sec_13-1-10</a></span></dt><dt><span class="section"><a href="#char-platform-dep">13.14. Platform-Dependent Characters</a></span></dt><dt><span class="section"><a href="#char-bits">13.15. Obsolete Constants</a></span></dt></dl></dd><dt><span class="chapter"><a href="#conses">14. Conses chap-14</a></span></dt><dd><dl><dt><span class="section"><a href="#cons-list">14.1. Conses as Lists sec_14-1-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#arrays">15. Arrays chap-15</a></span></dt><dd><dl><dt><span class="section"><a href="#array-elts">15.1. Array Elements sec_15-1-1</a></span></dt></dl></dd><dt><span class="chapter"><a href="#strings">16. Strings chap-16</a></span></dt><dd><dl><dt><span class="section"><a href="#string-misc">16.1. Miscellaneous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#sequences">17. Sequences chap-17</a></span></dt><dd><dl><dt><span class="section"><a href="#seq-func-ext">17.1. Additional Functions</a></span></dt><dt><span class="section"><a href="#seq-macro-ext">17.2. Additional Macros</a></span></dt><dt><span class="section"><a href="#nreverse-nreconc">17.3. Functions <code class="function">NREVERSE</code> & <code class="function">NRECONC</code></a></span></dt><dt><span class="section"><a href="#rem-del">17.4. Functions <code class="function">REMOVE</code> & <code class="function">DELETE</code></a></span></dt><dt><span class="section"><a href="#sorting">17.5. Functions <code class="function">SORT</code> & <code class="function">STABLE-SORT</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#hash">18. Hash Tables chap-18</a></span></dt><dd><dl><dt><span class="section"><a href="#hash-mod-key">18.1. Modifying Hash Table Keys sec_18-1-2</a></span></dt><dt><span class="section"><a href="#make-hash">18.2. Function <code class="function">MAKE-HASH-TABLE</code></a></span></dt><dt><span class="section"><a href="#defhash">18.3. Macro <code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#ht-test">18.4. Function <code class="function">HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#dohash">18.5. Macro <code class="function">EXT:DOHASH</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#filenames">19. Filenames chap-19</a></span></dt><dd><dl><dt><span class="section"><a href="#path-components">19.1. Pathname Components sec_19-2-1</a></span></dt><dt><span class="section"><a href="#unspecific">19.2. :UNSPECIFIC as a Component Value sec_19-2-2-2-3</a></span></dt><dt><span class="section"><a href="#path-external-notation">19.3. External notation</a></span></dt><dt><span class="section"><a href="#log-path">19.4. Logical Pathnames sec_19-3</a></span></dt><dt><span class="section"><a href="#filename-misc">19.5. Miscellaneous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#files">20. Files chap-20</a></span></dt><dd><dl><dt><span class="section"><a href="#dir-is-not-file">20.1. Directory is <span class="strong"><strong>not</strong></span> a file</a></span></dt><dt><span class="section"><a href="#file-func">20.2. File functions</a></span></dt><dt><span class="section"><a href="#dir-func">20.3. Directory functions</a></span></dt></dl></dd><dt><span class="chapter"><a href="#streams">21. Streams chap-21</a></span></dt><dd><dl><dt><span class="section"><a href="#streams-interactive">21.1. Interactive Streams sec_21-1-1-1-3</a></span></dt><dt><span class="section"><a href="#terminal">21.2. Terminal interaction</a></span></dt><dt><span class="section"><a href="#bin-io">21.3. Binary Input and Output</a></span></dt><dt><span class="section"><a href="#bulk-io">21.4. Bulk Input and Output</a></span></dt><dt><span class="section"><a href="#non-block-io">21.5. Non-Blocking Input and Output</a></span></dt><dt><span class="section"><a href="#newline-convention">21.6. Newline Convention</a></span></dt><dt><span class="section"><a href="#stream-extfmt">21.7. Function <code class="function">STREAM-EXTERNAL-FORMAT</code></a></span></dt><dt><span class="section"><a href="#stream-eltype">21.8. Function <code class="function">STREAM-ELEMENT-TYPE</code></a></span></dt><dt><span class="section"><a href="#make-stream">21.9. Function <code class="function">EXT:MAKE-STREAM</code></a></span></dt><dt><span class="section"><a href="#file-pos">21.10. Function <code class="function">FILE-POSITION</code></a></span></dt><dt><span class="section"><a href="#elastic-newline">21.11. Function <code class="function">EXT:ELASTIC-NEWLINE</code></a></span></dt><dt><span class="section"><a href="#open">21.12. Function <code class="function">OPEN</code></a></span></dt><dt><span class="section"><a href="#clear-input">21.13. Function <code class="function">CLEAR-INPUT</code></a></span></dt><dt><span class="section"><a href="#close">21.14. Function <code class="function">CLOSE</code></a></span></dt><dt><span class="section"><a href="#open-stream-p">21.15. Function <code class="function">OPEN-STREAM-P</code></a></span></dt><dt><span class="section"><a href="#broadcast-stream">21.16. Class <code class="classname">BROADCAST-STREAM</code></a></span></dt><dt><span class="section"><a href="#stream-buffer">21.17. Functions <code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
and <code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
</a></span></dt><dt><span class="section"><a href="#stream-handles">21.18. Function <code class="function">EXT:STREAM-HANDLES</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#printer">22. Printer chap-22</a></span></dt><dd><dl><dt><span class="section"><a href="#multi-rep">22.1. Multiple Possible Textual Representations sec_22-1-1-1</a></span></dt><dt><span class="section"><a href="#write-float-decimal">22.2. Printing Floats sec_22-1-3-1-3</a></span></dt><dt><span class="section"><a href="#spacecharprint">22.3. Printing Characters sec_22-1-3-2</a></span></dt><dt><span class="section"><a href="#sym-pack-prefix">22.4. Package Prefixes for Symbols sec_22-1-3-3-1</a></span></dt><dt><span class="section"><a href="#print-vector">22.5. Printing Other Vectors sec_22-1-3-7</a></span></dt><dt><span class="section"><a href="#print-array">22.6. Printing Other Arrays sec_22-1-3-8</a></span></dt><dt><span class="section"><a href="#clpp">22.7. The Lisp Pretty Printer sec_22-2</a></span></dt><dt><span class="section"><a href="#print-formatted">22.8. Formatted Output sec_22-3</a></span></dt><dt><span class="section"><a href="#write">22.9. Functions <code class="function">WRITE</code> & <code class="function">WRITE-TO-STRING</code></a></span></dt><dt><span class="section"><a href="#print-unreadable-object">22.10. Macro <code class="function">PRINT-UNREADABLE-OBJECT</code></a></span></dt><dt><span class="section"><a href="#print-misc">22.11. Miscellaneous Issues</a></span></dt></dl></dd><dt><span class="chapter"><a href="#reader">23. Reader chap-23</a></span></dt><dd><dl><dt><span class="section"><a href="#rt-case">23.1. Effect of Readtable Case on the Lisp Reader sec_23-1-2</a></span></dt><dt><span class="section"><a href="#recursive-p">23.2. The <em class="replaceable"><code>recursive-p</code></em> argument sec_23-1-3-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#system">24. System Construction chap-24</a></span></dt><dd><dl><dt><span class="section"><a href="#compilefile">24.1. Function <code class="function">COMPILE-FILE</code></a></span></dt><dt><span class="section"><a href="#compile-file-path">24.2. Function <code class="function">COMPILE-FILE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#require">24.3. Function <code class="function">REQUIRE</code></a></span></dt><dt><span class="section"><a href="#loadfile">24.4. Function <code class="function">LOAD</code></a></span></dt><dt><span class="section"><a href="#features">24.5. Variable <code class="varname">*FEATURES*</code></a></span></dt><dt><span class="section"><a href="#featurep">24.6. Function <code class="function">EXT:FEATUREP</code> [CLRFI-1]</a></span></dt><dt><span class="section"><a href="#compiled-file-p">24.7. Function <code class="function">EXT:COMPILED-FILE-P</code> [CLRFI-2]</a></span></dt></dl></dd><dt><span class="chapter"><a href="#environment">25. Environment chap-25</a></span></dt><dd><dl><dt><span class="section"><a href="#repl">25.1. Top Level Loop sec_25-1-1</a></span></dt><dt><span class="section"><a href="#debugger">25.2. Debugging Utilities sec_25-1-2</a></span></dt><dt><span class="section"><a href="#environment-enq">25.3. Environment Inquiry sec_25-1-3</a></span></dt><dt><span class="section"><a href="#clock">25.4. Time sec_25-1-4</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">26. Glossary chap-26</a></span></dt><dt><span class="chapter"><a href="#appendix">27. Appendix chap-a</a></span></dt><dt><span class="chapter"><a href="#issues">28. X3J13 Issue Index [CLHS-ic]</a></span></dt></dl></dd><dt><span class="part"><a href="#ext-standard">II. Common Portable Extensions</a></span></dt><dd><dl><dt><span class="chapter"><a href="#mop-chap">29. Meta-Object Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-intro">29.1. Introduction</a></span></dt><dt><span class="section"><a href="#mop-overview">29.2. Overview</a></span></dt><dt><span class="section"><a href="#mop-classes">29.3. Classes</a></span></dt><dt><span class="section"><a href="#mop-sd">29.4. Slot Definitions</a></span></dt><dt><span class="section"><a href="#mop-gf">29.5. Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-meth">29.6. Methods</a></span></dt><dt><span class="section"><a href="#mop-accessors">29.7. Accessor Methods</a></span></dt><dt><span class="section"><a href="#mop-specializers">29.8. Specializers</a></span></dt><dt><span class="section"><a href="#mop-meth-comb">29.9. Method Combinations</a></span></dt><dt><span class="section"><a href="#mop-slot-access">29.10. Slot Access</a></span></dt><dt><span class="section"><a href="#mop-dep-maint">29.11. Dependent Maintenance</a></span></dt><dt><span class="section"><a href="#mop-clisp">29.12. Deviations from AMOP</a></span></dt></dl></dd><dt><span class="chapter"><a href="#gray">30. Gray streams</a></span></dt><dd><dl><dt><span class="section"><a href="#gray-overview">30.1. Overview</a></span></dt><dt><span class="section"><a href="#gray-classes">30.2. Defined classes</a></span></dt><dt><span class="section"><a href="#gray-gf-general">30.3. General generic functions</a></span></dt><dt><span class="section"><a href="#gray-gf-char-in">30.4. Generic functions for character input</a></span></dt><dt><span class="section"><a href="#gray-gf-char-out">30.5. Generic functions for character output</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-in">30.6. Generic functions for binary input</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-out">30.7. Generic functions for binary output</a></span></dt><dt><span class="section"><a href="#fill-stream">30.8. Class <code class="classname">EXT:FILL-STREAM</code></a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="#ext-clisp">III. Extensions Specific to <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="chapter"><a href="#ext-p-indep">31. Platform Independent Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="#custom-init-fini">31.1. Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination</a></span></dt><dt><span class="section"><a href="#image">31.2. Saving an Image</a></span></dt><dt><span class="section"><a href="#quit">31.3. Quitting <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#i18n">31.4. Internationalization of <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#encoding">31.5. Encodings</a></span></dt><dt><span class="section"><a href="#gstream">31.6. Generic streams</a></span></dt><dt><span class="section"><a href="#weak">31.7. Weak Objects</a></span></dt><dt><span class="section"><a href="#final">31.8. Finalization</a></span></dt><dt><span class="section"><a href="#prompt">31.9. The Prompt</a></span></dt><dt><span class="section"><a href="#ansi">31.10. Maximum ANSI CL compliance</a></span></dt><dt><span class="section"><a href="#macros3">31.11. Additional Fancy Macros and Functions</a></span></dt><dt><span class="section"><a href="#customize">31.12. Customizing <span class="command"><strong>CLISP</strong></span> behavior</a></span></dt><dt><span class="section"><a href="#code-walk">31.13. Code Walker</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ext-platform">32. Platform Specific Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="#screen">32.1. Random Screen Access</a></span></dt><dt><span class="section"><a href="#modules">32.2. External Modules</a></span></dt><dt><span class="section"><a href="#dffi">32.3. The Foreign Function Call Facility</a></span></dt><dt><span class="section"><a href="#socket">32.4. Socket Streams</a></span></dt><dt><span class="section"><a href="#mt">32.5. Multiple Threads of Execution</a></span></dt><dt><span class="section"><a href="#quickstart">32.6. Quickstarting delivery with <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#shell">32.7. Shell, Pipes and Printing</a></span></dt><dt><span class="section"><a href="#getenv">32.8. Operating System Environment</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ext-modules">33. Extensions Implemented as Modules</a></span></dt><dd><dl><dt><span class="section"><a href="#asdf">33.1. A System Definition Facility</a></span></dt><dt><span class="section"><a href="#syscalls">33.2. System Calls</a></span></dt><dt><span class="section"><a href="#i18n-mod">33.3. Internationalization of User Programs</a></span></dt><dt><span class="section"><a href="#regexp-mod">33.4. POSIX Regular Expressions</a></span></dt><dt><span class="section"><a href="#readline-mod">33.5. Advanced Readline and History Functionality</a></span></dt><dt><span class="section"><a href="#gdbm">33.6. GDBM - The GNU database manager</a></span></dt><dt><span class="section"><a href="#berkeley-db">33.7. Berkeley DB access</a></span></dt><dt><span class="section"><a href="#dir-key">33.8. Directory Access</a></span></dt><dt><span class="section"><a href="#postgresql">33.9. PostgreSQL Database Access</a></span></dt><dt><span class="section"><a href="#oracle">33.10. Oracle Interface</a></span></dt><dt><span class="section"><a href="#libsvm">33.11. LibSVM Interface</a></span></dt><dt><span class="section"><a href="#pari">33.12. Computer Algebra System PARI</a></span></dt><dt><span class="section"><a href="#matlab">33.13. Matlab Interface</a></span></dt><dt><span class="section"><a href="#netica">33.14. Netica Interface</a></span></dt><dt><span class="section"><a href="#pcre">33.15. Perl Compatible Regular Expressions</a></span></dt><dt><span class="section"><a href="#zlib">33.16. Interface to zlib</a></span></dt><dt><span class="section"><a href="#rawsock">33.17. Raw Socket Access</a></span></dt><dt><span class="section"><a href="#fastcgi">33.18. The FastCGI Interface</a></span></dt><dt><span class="section"><a href="#dbus">33.19. Interface to D-Bus</a></span></dt><dt><span class="section"><a href="#gtk">33.20. GTK Interface</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="#internals">IV. Internals of the <span class="command"><strong>CLISP</strong></span> Implementation</a></span></dt><dd><dl><dt><span class="chapter"><a href="#source-files">34. The source files of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#src-file-types">34.1. File Types</a></span></dt><dt><span class="section"><a href="#src-preprocessing">34.2. Source Pre-Processing</a></span></dt><dt><span class="section"><a href="#src-files">34.3. Files</a></span></dt></dl></dd><dt><span class="chapter"><a href="#gc">35. Overview of <span class="command"><strong>CLISP</strong></span>'s Garbage Collection</a></span></dt><dd><dl><dt><span class="section"><a href="#internals-intro">35.1. Introduction</a></span></dt><dt><span class="section"><a href="#lisp-obj-in-c">35.2. Lisp objects in <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#typecodes">35.3. Object Pointer Representations</a></span></dt><dt><span class="section"><a href="#memory-models">35.4. Memory Models</a></span></dt><dt><span class="section"><a href="#gc-safety">35.5. The burden of garbage-collection upon the rest of <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#foreign-pointers">35.6. Foreign Pointers</a></span></dt><dt><span class="section"><a href="#nextgc-factor">35.7. Forcing or inhibiting Garbage Collections</a></span></dt><dt><span class="section"><a href="#gc-mt">35.8. Garbage Collection and Multithreading</a></span></dt></dl></dd><dt><span class="chapter"><a href="#extend">36. Extending <span class="command"><strong>CLISP</strong></span> Core</a></span></dt><dd><dl><dt><span class="section"><a href="#add-fun">36.1. Adding a built-in function</a></span></dt><dt><span class="section"><a href="#add-var">36.2. Adding a built-in variable</a></span></dt><dt><span class="section"><a href="#recompile">36.3. Recompilation</a></span></dt></dl></dd><dt><span class="chapter"><a href="#bytecode">37. The <span class="command"><strong>CLISP</strong></span> bytecode specification</a></span></dt><dd><dl><dt><span class="section"><a href="#byte-intro">37.1. Introduction</a></span></dt><dt><span class="section"><a href="#vm">37.2. The virtual machine</a></span></dt><dt><span class="section"><a href="#comp-fun">37.3. The structure of compiled functions</a></span></dt><dt><span class="section"><a href="#instr-struct">37.4. The general structure of the instructions</a></span></dt><dt><span class="section"><a href="#instr-set">37.5. The instruction set</a></span></dt><dt><span class="section"><a href="#compiler-introspection">37.6. Examining compiled closures</a></span></dt><dt><span class="section"><a href="#bytecode-design">37.7. Bytecode Design</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="#appendices">V. Appendices</a></span></dt><dd><dl><dt><span class="appendix"><a href="#faq">A. Frequently Asked Questions (With Answers) about <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="appendix"><a href="#fdl">B. GNU Free Documentation License</a></span></dt><dt><span class="appendix"><a href="#gpl">C. GNU General Public License</a></span></dt><dd><dl><dt><span class="section"><a href="#gpl-1">C.1. Preamble</a></span></dt><dt><span class="section"><a href="#gpl-2">C.2. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dt><span class="section"><a href="#gpl-3">C.3. How to Apply These Terms to Your New Programs</a></span></dt></dl></dd></dl></dd><dt><span class="index"><a href="#idx">Index</a></span></dt><dt><span class="bibliography"><a href="#references">References</a></span></dt></dl></div><div class="list-of-figures"><p><strong>List of Figures</strong></p><dl><dt>29.1. <a href="#mop-mo-cl-inheritance-fig">Inheritance structure of metaobject classes</a></dt><dt>29.2. <a href="#mop-cl-Inheritance-fig">Inheritance structure of class metaobject classes</a></dt><dt>29.3. <a href="#mop-sd-inheritance-fig">Inheritance structure of slot definition metaobject classes</a></dt><dt>29.4. <a href="#mop-gf-inheritance-fig">Inheritance structure of generic function metaobject classes</a></dt><dt>29.5. <a href="#mop-meth-inheritance-fig">Inheritance structure of method metaobject classes</a></dt><dt>29.6. <a href="#mop-specializers-inheritance-fig">Inheritance structure of specializer metaobject classes</a></dt><dt>29.7. <a href="#mop-meth-comb-inheritance-fig">Inheritance structure of method combination metaobject classes</a></dt></dl></div><div class="list-of-tables"><p><strong>List of Tables</strong></p><dl><dt>1. <a href="#conventions-tab">Mark-up conventions</a></dt><dt>3.1. <a href="#eval-limits-table">Function call limits</a></dt><dt>12.1. <a href="#bool-op-table">Boolean operations</a></dt><dt>12.2. <a href="#fixnum-lim-table">Fixnum limits</a></dt><dt>13.1. <a href="#char-code-limit-table">Number of characters</a></dt><dt>13.2. <a href="#standard-char-table">Standard characters</a></dt><dt>13.3. <a href="#semi-standard-char-table">Semi-standard characters</a></dt><dt>13.4. <a href="#extra-named-chars-table">Additional Named Characters</a></dt><dt>13.5. <a href="#ctrl-char-table">Additional syntax for characters with code from <span class="keycode">#x00</span> to <span class="keycode">#x1F</span>:</a></dt><dt>13.6. <a href="#dos-win32-chars-table">Additional characters (<span class="platform">Win32</span> platform only.)</a></dt><dt>13.7. <a href="#unix-chars-table">Additional characters (<span class="strong"><strong>UNIX</strong></span> platform only.)</a></dt><dt>13.8. <a href="#char-bits-table">Character bit constants (obsolete)</a></dt><dt>15.1. <a href="#array-limit-table">Array limits</a></dt><dt>19.1. <a href="#min-filename-syntax-table">The minimum filename syntax that may be used portably</a></dt><dt>25.1. <a href="#debugger-main-deb-step">Commands common to the main loop, the debugger and the stepper</a></dt><dt>25.2. <a href="#debugger-deb-step">Commands common to the debugger and the stepper</a></dt><dt>25.3. <a href="#debugger-deb-step-1">Commands common to the debugger and the stepper</a></dt><dt>25.4. <a href="#debugger-eval-apply">Commands specific to <code class="function">EVAL</code>/<code class="function">APPLY</code></a></dt><dt>25.5. <a href="#debugger-deb">Commands specific to the debugger</a></dt><dt>25.6. <a href="#debugger-step">Commands specific to the stepper</a></dt><dt>25.7. <a href="#internal-time-units-table">Time granularity</a></dt><dt>29.1. <a href="#mop-inherit-struct">Direct Superclass Relationships Among The Specified Metaobject Classes</a></dt><dt>29.2. <a href="#class-mo-initargs">Initialization arguments and accessors for class metaobjects</a></dt><dt>29.3. <a href="#slotd-mo-initargs">Initialization arguments and accessors for slot definition metaobjects</a></dt><dt>29.4. <a href="#gf-mo-initargs">Initialization arguments and accessors for generic function metaobjects</a></dt><dt>29.5. <a href="#mop-meth-initargs">Initialization arguments and accessors for method metaobjects</a></dt><dt>29.6. <a href="#mop-sa-instance-struct-table">The correspondence between slot access function and underlying slot access generic function</a></dt><dt>35.1. <a href="#mem-models-comb-typecodes">Memory models with <span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a></dt><dt>35.2. <a href="#mem-models-comb-heapcodes">Memory models with <span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a></dt></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>25.1. <a href="#trace-call-id">Identifying Individual Calls in <code class="function">TRACE</code></a></dt><dt>30.1. <a href="#ex-fill-stream">Example of <code class="classname">EXT:FILL-STREAM</code> usage</a></dt><dt>32.1. <a href="#mod-set-ex-bindings">Create a module set with GNU libc bindings</a></dt><dt>32.2. <a href="#dffi-simple">Simple declarations and access</a></dt><dt>32.3. <a href="#dffi-extern-var">External <span class="command"><strong>C</strong></span> variable and some accesses</a></dt><dt>32.4. <a href="#dffi-extern-func1">Calling an external function</a></dt><dt>32.5. <a href="#dffi-extern-func2">Another example for calling an external function</a></dt><dt>32.6. <a href="#dffi-ex-macro">Accessing <span class="command"><strong>cpp</strong></span> macros</a></dt><dt>32.7. <a href="#ex-call-in">Calling Lisp from <span class="command"><strong>C</strong></span></a></dt><dt>32.8. <a href="#ex-call-in-dll">Calling Lisp from <span class="command"><strong>C</strong></span> dynamically</a></dt><dt>32.9. <a href="#dffi-gethostname">Variable size arguments: calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> from <span class="command"><strong>CLISP</strong></span></a></dt><dt>32.10. <a href="#dffi-dll-var">Accessing variables in shared libraries</a></dt><dt>32.11. <a href="#ex-dffi-validity">Controlling validity of resources</a></dt><dt>32.12. <a href="#ex-dffi-float">Floating point arrays</a></dt><dt>32.13. <a href="#socket-ex-server">Lisp read-eval-print loop server</a></dt><dt>32.14. <a href="#socket-ex-client">Lisp <span class="command"><strong>HTTP</strong></span> client</a></dt><dt>33.1. <a href="#ex-re-match"><code class="function">REGEXP:MATCH</code></a></dt><dt>33.2. <a href="#ex-re-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a></dt><dt>33.3. <a href="#re-count-shell-users">Count unix shell users</a></dt></dl></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a id="overview"></a>Overview</h1></div></div></div><p>These notes discuss the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implementation of <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> by <span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span></span>
and <span class="author"><span class="firstname">Michael</span> <span class="surname">Stoll</span></span>. The current maintainers are <span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span></span> and <span class="author"><span class="firstname">Sam</span> <span class="surname">Steingold</span></span>.</p><p>This implementation is mostly conforming to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]
available on-line as the [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] (but the printed <a class="ulink" href="http://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> document
remains the authoritative source of information). [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] supersedes
the earlier specifications <a class="xref" href="#CLtL1" title="Common Lisp: the Language (1st Edition)">[<abbr class="abbrev">CLtL1</abbr>]</a> and <a class="xref" href="#CLtL2" title="Common Lisp: the Language (2nd Edition)">[<abbr class="abbrev">CLtL2</abbr>]</a>.</p><p>The first part of these notes, <a class="xref" href="#clhs-chapters" title="Part I. Chapters or the Common Lisp HyperSpec">Part I, “Chapters or the Common Lisp HyperSpec”</a>,
is indexed in parallel to the [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] and documents how <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
implements the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</p><p>The second part, <a class="xref" href="#ext-standard" title="Part II. Common Portable Extensions">Part II, “Common Portable Extensions”</a>, documents the
common extensions to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], specifically <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> and <a class="link" href="#gray" title="Chapter 30. Gray streams"><strong class="package"><span class="quote">“<span class="quote">GRAY</span>”</span></strong></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.</p><p>The third part, <a class="xref" href="#ext-clisp" title="Part III. Extensions Specific to CLISP">Part III, “Extensions Specific to <span class="command"><strong>CLISP</strong></span>”</a>, documents the
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific extensions, e.g., <a class="xref" href="#socket" title="32.4. Socket Streams">Section 32.4, “Socket Streams”</a>.</p><p>The fourth part, <a class="xref" href="#internals" title="Part IV. Internals of the CLISP Implementation">Part IV, “Internals of the <span class="command"><strong>CLISP</strong></span> Implementation”</a>, is intended mostly
for developers as it documents the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internals, e.g., <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion,
adding new built-ins, and the <a href="impnotes.html#bytecode" class="olink">bytecode</a>s generated by the compiler
(i.e., what is printed by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>).</p></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a id="conventions"></a>Conventions</h1></div></div></div><p>The following is the mark-up notations used in this document:
</p><div class="table"><a id="conventions-tab"></a><p class="title"><strong>Table 1. Mark-up conventions</strong></p><div class="table-contents"><table class="table" summary="Mark-up conventions" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Object Kind</th><th align="center">Example</th></tr></thead><tbody><tr><td align="center">Function</td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a></td></tr><tr><td align="center">Variable</td><td align="center"><a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a></td></tr><tr><td align="center">Formal Argument</td><td align="center"><em class="replaceable"><code>x</code></em></td></tr><tr><td align="center">Keyword</td><td align="center"><code class="constant">:EOF</code></td></tr><tr><td align="center">Number</td><td align="center"><code class="literal">0</code></td></tr><tr><td align="center">Character</td><td align="center"><span class="keysym">#\Newline</span></td></tr><tr><td align="center">Class, type</td><td align="center"><a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instruction</td><td align="center"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-1.html"><code class="literal">~A</code></a></td></tr><tr><td align="center">Standard <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> keyword</td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a></td></tr><tr><td align="center">Declaration</td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_ftype.html" target="_top"><code class="literal">FTYPE</code></a></td></tr><tr><td align="center">Package</td><td align="center"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a></td></tr><tr><td align="center">Real file</td><td align="center"><a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a></td></tr><tr><td align="center">Abstract file</td><td align="center"><code class="filename">#P".c"</code></td></tr><tr><td align="center">Code (you are likely to type it)</td><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a> 1 2)</code></td></tr><tr><td align="center">Data (<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is likely to print it)</td><td align="center"><span class="data"><code class="literal">#(1 2 3)</code></span></td></tr><tr><td align="center">Program listing</td><td align="center"><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> cycle-length (n <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (len 1) (top 0))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_cond.html" target="_top"><code class="function">COND</code></a> ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> n 1) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> len top))
((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_evenpcm_oddp.html" target="_top"><code class="function">EVENP</code></a> n) (cycle-length (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ash.html" target="_top"><code class="function">ASH</code></a> n -1) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_1plcm_1-.html" target="_top"><code class="function">1+</code></a> len) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_maxcm_min.html" target="_top"><code class="function">MAX</code></a> top n)))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((next (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_1plcm_1-.html" target="_top"><code class="function">1+</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_st.html" target="_top"><code class="function">*</code></a> 3 n))))
(cycle-length next (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_1plcm_1-.html" target="_top"><code class="function">1+</code></a> len) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_maxcm_min.html" target="_top"><code class="function">MAX</code></a> top next))))))</pre></td></tr><tr><td align="center">Bytecode instruction</td><td align="center"><span class="byte"><code class="literal">(STOREV <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td></tr><tr><td align="center">First mention of an entity</td><td align="center"><strong class="first"><em class="firstterm">firstterm</em></strong></td></tr><tr><td align="center">External <a href="impnotes.html#modules" class="olink">module</a></td><td align="center"><span class="module"><a class="filename" href="#libsvm" title="33.11. LibSVM Interface"><code class="filename">libsvm</code></a></span>, <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/bindings/glibc/"><code class="filename">bindings/glibc</code></a></span></td></tr><tr><td align="center">Command line argument</td><td align="center"><code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code></td></tr><tr><td align="center">Interaction</td><td align="center"><pre class="screen">Computer output
<strong><code class="prompt">Prompt:</code></strong> <big><strong class="userinput"><code>user input</code></strong></big></pre>
</td></tr></tbody></table></div></div><p><br class="table-break" /></p></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="clhs-chapters"></a>Part I. Chapters or the [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>]</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#intro">1. Introduction chap-1</a></span></dt><dd><dl><dt><span class="section"><a href="#spec-symb">1.1. Special Symbols sec_1-4-1-3</a></span></dt><dt><span class="section"><a href="#error-terms">1.2. Error Terminology sec_1-4-2</a></span></dt><dt><span class="section"><a href="#cl-symb">1.3. Symbols in the Package <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> sec_1-9</a></span></dt></dl></dd><dt><span class="chapter"><a href="#syntax">2. Syntax chap-2</a></span></dt><dd><dl><dt><span class="section"><a href="#std-char">2.1. Standard Characters sec_2-1-3</a></span></dt><dt><span class="section"><a href="#reader-alg">2.2. Reader Algorithm sec_2-2</a></span></dt><dt><span class="section"><a href="#tokens">2.3. Symbols as Tokens sec_2-3-4</a></span></dt><dt><span class="section"><a href="#valid-patterns">2.4. Valid Patterns for Tokens sec_2-3-5</a></span></dt><dt><span class="section"><a href="#backquote">2.5. Backquote sec_2-4-6</a></span></dt><dt><span class="section"><a href="#sharpsign">2.6. Sharpsign sec_2-4-8</a></span></dt><dd><dl><dt><span class="section"><a href="#sharpsign-backslash">2.6.1. Sharpsign Backslash sec_2-4-8-1</a></span></dt><dt><span class="section"><a href="#sharpsign-less-than">2.6.2. Sharpsign Less-Than-Sign sec_2-4-8-20</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#eval">3. Evaluation and Compilation chap-3</a></span></dt><dd><dl><dt><span class="section"><a href="#evaluation">3.1. Evaluation sec_3-1</a></span></dt><dd><dl><dt><span class="section"><a href="#eval-environ">3.1.1. Introduction to Environments sec_3-1-1</a></span></dt><dt><span class="section"><a href="#sym-forms">3.1.2. Symbols as Forms sec_3-1-2-1-1</a></span></dt><dt><span class="section"><a href="#cons-forms">3.1.3. Conses as Forms sec_3-1-2-1-2</a></span></dt><dt><span class="section"><a href="#specforms">3.1.4. Special Forms sec_3-1-2-1-2-1</a></span></dt><dt><span class="section"><a href="#funforms">3.1.5. Function Forms sec_3-1-2-1-2-3</a></span></dt><dt><span class="section"><a href="#defun">3.1.6. Macros <code class="function">DEFUN</code> & <code class="function">DEFMACRO</code></a></span></dt></dl></dd><dt><span class="section"><a href="#compilation">3.2. Compilation sec_3-2</a></span></dt><dd><dl><dt><span class="section"><a href="#compiler-terms">3.2.1. Compiler Terminology sec_3-2-1</a></span></dt><dt><span class="section"><a href="#compilation-semantics">3.2.2. Compilation Semantics sec_3-2-2</a></span></dt><dt><span class="section"><a href="#similarity">3.2.3. Definition of Similarity sec_3-2-4-2-2</a></span></dt><dt><span class="section"><a href="#compile-errors">3.2.4. Exceptional Situations in the Compiler sec_3-2-5</a></span></dt></dl></dd><dt><span class="section"><a href="#declarations">3.3. Declarations sec_3-3</a></span></dt><dd><dl><dt><span class="section"><a href="#decl-min">3.3.1. Minimal Declaration Processing Requirements sec_3-3-1</a></span></dt><dt><span class="section"><a href="#spec-decl">3.3.2. Declaration <code class="literal">SPECIAL</code></a></span></dt><dt><span class="section"><a href="#constant-notinline">3.3.3. Declaration <code class="literal">EXT:CONSTANT-NOTINLINE</code></a></span></dt><dt><span class="section"><a href="#constantp">3.3.4. Function <code class="function">CONSTANTP</code></a></span></dt><dt><span class="section"><a href="#safety-decl">3.3.5. Declaration <code class="literal">SAFETY</code></a></span></dt><dt><span class="section"><a href="#compile-decl">3.3.6. Declaration <code class="code">(COMPILE)</code></a></span></dt><dt><span class="section"><a href="#space-decl">3.3.7. Declaration <code class="literal">SPACE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#lalist">3.4. Lambda Lists sec_3-4</a></span></dt><dd><dl><dt><span class="section"><a href="#boa-lalist">3.4.1. Boa Lambda Lists sec_3-4-6</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#types-classes">4. Types and Classes chap-4</a></span></dt><dd><dl><dt><span class="section"><a href="#types">4.1. Types sec_4-2</a></span></dt><dd><dl><dt><span class="section"><a href="#type-spec">4.1.1. Type Specifiers sec_4-2-3</a></span></dt></dl></dd><dt><span class="section"><a href="#classes">4.2. Classes sec_4-3</a></span></dt><dt><span class="section"><a href="#clos-diff">4.3. Deviations from ANSI CL standard</a></span></dt><dt><span class="section"><a href="#metaclasses">4.4. Standard Metaclasses sec_4-3-1-1</a></span></dt><dt><span class="section"><a href="#def-class">4.5. Defining Classes sec_4-3-2</a></span></dt><dt><span class="section"><a href="#redef-class">4.6. Redefining Classes sec_4-3-6</a></span></dt></dl></dd><dt><span class="chapter"><a href="#data">5. Data and Control Flow chap-5</a></span></dt><dd><dl><dt><span class="section"><a href="#gen-ref">5.1. Generalized Reference sec_5-1</a></span></dt><dt><span class="section"><a href="#setf-expansion">5.2. Setf Expansions sec_5-1-1-2</a></span></dt><dt><span class="section"><a href="#extra-places">5.3. Kinds of Places sec_5-1-2</a></span></dt><dt><span class="section"><a href="#misc-data">5.4. Miscellaneous</a></span></dt><dt><span class="section"><a href="#defconstant">5.5. Macro <code class="function">DEFCONSTANT</code></a></span></dt><dd><dl><dt><span class="section"><a href="#defconstant-similar">5.5.1. Variable <code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></span></dt></dl></dd><dt><span class="section"><a href="#fcase">5.6. Macro <code class="function">EXT:FCASE</code></a></span></dt><dt><span class="section"><a href="#xor">5.7. Function <code class="function">EXT:XOR</code></a></span></dt><dt><span class="section"><a href="#eq">5.8. Function <code class="function">EQ</code></a></span></dt><dt><span class="section"><a href="#func">5.9. Special Operator <code class="function">FUNCTION</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#iteration">6. Iteration chap-6</a></span></dt><dd><dl><dt><span class="section"><a href="#loop">6.1. The LOOP Facility sec_6-1</a></span></dt><dd><dl><dt><span class="section"><a href="#loop-termination">6.1.1. Mixing Termination Test Clauses sec_6-1-4</a></span></dt><dt><span class="section"><a href="#loop-inter-var-finally">6.1.2. Iteration variables in the loop epilogue</a></span></dt><dt><span class="section"><a href="#loop-ansi">6.1.3. Backward Compatibility</a></span></dt></dl></dd><dt><span class="section"><a href="#iter-misc">6.2. Miscellaneous</a></span></dt></dl></dd><dt><span class="chapter"><a href="#objects">7. Objects chap-7</a></span></dt><dd><dl><dt><span class="section"><a href="#std-meth-combo">7.1. Standard Method Combination sec_7-6-6-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#structures">8. Structures chap-8</a></span></dt><dd><dl><dt><span class="section"><a href="#defstruct-options">8.1. The options for <code class="function">DEFSTRUCT</code></a></span></dt><dd><dl><dt><span class="section"><a href="#defstruct-print-function">8.1.1. The <code class="constant">:PRINT-FUNCTION</code> option</a></span></dt><dt><span class="section"><a href="#defstruct-inherit">8.1.2. The <code class="constant">:INHERIT</code> option</a></span></dt></dl></dd><dt><span class="section"><a href="#defstruct-mop">8.2. The structure Meta-Object Protocol</a></span></dt></dl></dd><dt><span class="chapter"><a href="#conditions">9. Conditions chap-9</a></span></dt><dd><dl><dt><span class="section"><a href="#cond-nl">9.1. Embedded Newlines in Condition Reports sec_9-1-3-1-3</a></span></dt><dt><span class="section"><a href="#cond-fname">9.2. Mentioning Containing Function in Condition Reports sec_9-1-3-1-5</a></span></dt><dt><span class="section"><a href="#restarts">9.3. Interfaces to Restarts sec_9-1-4-2-2</a></span></dt><dt><span class="section"><a href="#assertions">9.4. Assertions sec_9-1-5</a></span></dt></dl></dd><dt><span class="chapter"><a href="#symbols">10. Symbols chap-10</a></span></dt><dt><span class="chapter"><a href="#packages">11. Packages chap-11</a></span></dt><dd><dl><dt><span class="section"><a href="#pack-intro">11.1. Introduction to Packages sec_11-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#make-pack">11.1.1. Function <code class="function">MAKE-PACKAGE</code></a></span></dt><dt><span class="section"><a href="#defpack">11.1.2. Macro <code class="function">DEFPACKAGE</code></a></span></dt><dt><span class="section"><a href="#re-export">11.1.3. Function <code class="function">EXT:RE-EXPORT</code></a></span></dt><dt><span class="section"><a href="#pack-inverted">11.1.4. Function <code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a></span></dt><dt><span class="section"><a href="#pack-sensitive">11.1.5. Function <code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a></span></dt></dl></dd><dt><span class="section"><a href="#pack-lock">11.2. Constraints on the <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> Package for Conforming Programs - package locking sec_11-1-2-1-2</a></span></dt><dt><span class="section"><a href="#clupack">11.3. The <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong> Package sec_11-1-2-2</a></span></dt><dt><span class="section"><a href="#imppack">11.4. Implementation-Defined Packages sec_11-1-2-4</a></span></dt><dt><span class="section"><a href="#package-case">11.5. Package Case-Sensitivity</a></span></dt><dd><dl><dt><span class="section"><a href="#cs-clu">11.5.1. User Package for the Case-sensitive World</a></span></dt><dt><span class="section"><a href="#cs-pack-name">11.5.2. Package Names</a></span></dt><dt><span class="section"><a href="#cs-gensym-kwd">11.5.3. Gensyms and Keywords</a></span></dt><dt><span class="section"><a href="#case-sensitive-migration">11.5.4. Migration Tips</a></span></dt><dt><span class="section"><a href="#case-sensitive-startup">11.5.5. Using case-sensitive packages by default</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#numbers">12. Numbers chap-12</a></span></dt><dd><dl><dt><span class="section"><a href="#num-types">12.1. Numeric Types</a></span></dt><dt><span class="section"><a href="#num-concepts">12.2. Number Concepts sec_12-1</a></span></dt><dd><dl><dt><span class="section"><a href="#num-ops">12.2.1. Numeric Operations sec_12-1-1</a></span></dt><dt><span class="section"><a href="#num-const">12.2.2. Implementation-Dependent Numeric Constants sec_12-1-2</a></span></dt><dt><span class="section"><a href="#float-subst">12.2.3. Rule of Float Substitutability sec_12-1-3-3</a></span></dt><dt><span class="section"><a href="#float-comp">12.2.4. Floating-point Computations sec_12-1-4</a></span></dt><dt><span class="section"><a href="#complex-comp">12.2.5. Complex Computations sec_12-1-5</a></span></dt><dt><span class="section"><a href="#complex-rational">12.2.6. Rule of Canonical Representation for Complex Rationals sec_12-1-5-3</a></span></dt><dt><span class="section"><a href="#random-state">12.2.7. Random-State Operations sec_12-1-7</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#characters">13. Characters chap-13</a></span></dt><dd><dl><dt><span class="section"><a href="#char-intro">13.1. Introduction to Characters sec_13-1</a></span></dt><dd><dl><dt><span class="section"><a href="#char-code">13.1.1. Function <code class="function">CHAR-CODE</code></a></span></dt><dt><span class="section"><a href="#base-char">13.1.2. Type <code class="classname">BASE-CHAR</code></a></span></dt><dt><span class="section"><a href="#char-width">13.1.3. Function <code class="function">EXT:CHAR-WIDTH</code></a></span></dt></dl></dd><dt><span class="section"><a href="#char-sets">13.2. Character sets</a></span></dt><dt><span class="section"><a href="#char-script">13.3. Character Scripts sec_13-1-2-1</a></span></dt><dt><span class="section"><a href="#char-attrib">13.4. Character Attributes sec_13-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#input-char">13.4.1. Input Characters</a></span></dt></dl></dd><dt><span class="section"><a href="#graph-char">13.5. Graphic Characters sec_13-1-4-1</a></span></dt><dt><span class="section"><a href="#alpha-char">13.6. Alphabetic Characters sec_13-1-4-2</a></span></dt><dt><span class="section"><a href="#char-case">13.7. Characters With Case sec_13-1-4-3</a></span></dt><dd><dl><dt><span class="section"><a href="#char-invertcase">13.7.1. Function <code class="function">EXT:CHAR-INVERTCASE</code></a></span></dt><dt><span class="section"><a href="#char-ext">13.7.2. Case of Implementation-Defined Characters sec_13-1-4-3-4</a></span></dt></dl></dd><dt><span class="section"><a href="#num-char">13.8. Numeric Characters sec_13-1-4-4</a></span></dt><dt><span class="section"><a href="#char-ord">13.9. Ordering of Characters sec_13-1-6</a></span></dt><dt><span class="section"><a href="#char-names">13.10. Character Names sec_13-1-7</a></span></dt><dt><span class="section"><a href="#clhs-newline">13.11. Treatment of Newline during Input and Output sec_13-1-8</a></span></dt><dt><span class="section"><a href="#char-int">13.12. Character Encodings sec_13-1-9</a></span></dt><dt><span class="section"><a href="#script-ext">13.13. Documentation of Implementation-Defined Scripts sec_13-1-10</a></span></dt><dt><span class="section"><a href="#char-platform-dep">13.14. Platform-Dependent Characters</a></span></dt><dt><span class="section"><a href="#char-bits">13.15. Obsolete Constants</a></span></dt></dl></dd><dt><span class="chapter"><a href="#conses">14. Conses chap-14</a></span></dt><dd><dl><dt><span class="section"><a href="#cons-list">14.1. Conses as Lists sec_14-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#map-func">14.1.1. Mapping Functions</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#arrays">15. Arrays chap-15</a></span></dt><dd><dl><dt><span class="section"><a href="#array-elts">15.1. Array Elements sec_15-1-1</a></span></dt></dl></dd><dt><span class="chapter"><a href="#strings">16. Strings chap-16</a></span></dt><dd><dl><dt><span class="section"><a href="#string-misc">16.1. Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#string-comp">16.1.1. String Comparison</a></span></dt><dt><span class="section"><a href="#string-width">16.1.2. Function <code class="function">EXT:STRING-WIDTH</code></a></span></dt><dt><span class="section"><a href="#string-invertcase">16.1.3. Functions <code class="function">EXT:STRING-INVERTCASE</code> and <code class="function">EXT:NSTRING-INVERTCASE</code></a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#sequences">17. Sequences chap-17</a></span></dt><dd><dl><dt><span class="section"><a href="#seq-func-ext">17.1. Additional Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#trim-if">17.1.1. Function <code class="function">EXT:TRIM-IF</code></a></span></dt></dl></dd><dt><span class="section"><a href="#seq-macro-ext">17.2. Additional Macros</a></span></dt><dd><dl><dt><span class="section"><a href="#doseq">17.2.1. Macro <code class="function">EXT:DOSEQ</code></a></span></dt></dl></dd><dt><span class="section"><a href="#nreverse-nreconc">17.3. Functions <code class="function">NREVERSE</code> & <code class="function">NRECONC</code></a></span></dt><dt><span class="section"><a href="#rem-del">17.4. Functions <code class="function">REMOVE</code> & <code class="function">DELETE</code></a></span></dt><dt><span class="section"><a href="#sorting">17.5. Functions <code class="function">SORT</code> & <code class="function">STABLE-SORT</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#hash">18. Hash Tables chap-18</a></span></dt><dd><dl><dt><span class="section"><a href="#hash-mod-key">18.1. Modifying Hash Table Keys sec_18-1-2</a></span></dt><dt><span class="section"><a href="#make-hash">18.2. Function <code class="function">MAKE-HASH-TABLE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#hashtable-gc-rehash">18.2.1. Interaction between <code class="classname">HASH-TABLE</code>s and garbage-collection</a></span></dt></dl></dd><dt><span class="section"><a href="#defhash">18.3. Macro <code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#ht-test">18.4. Function <code class="function">HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#dohash">18.5. Macro <code class="function">EXT:DOHASH</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#filenames">19. Filenames chap-19</a></span></dt><dd><dl><dt><span class="section"><a href="#path-components">19.1. Pathname Components sec_19-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#path-dir-canon">19.1.1. Directory canonicalization</a></span></dt><dt><span class="section"><a href="#path-platform-specific">19.1.2. Platform-specific issues</a></span></dt></dl></dd><dt><span class="section"><a href="#unspecific">19.2. :UNSPECIFIC as a Component Value sec_19-2-2-2-3</a></span></dt><dt><span class="section"><a href="#path-external-notation">19.3. External notation</a></span></dt><dt><span class="section"><a href="#log-path">19.4. Logical Pathnames sec_19-3</a></span></dt><dt><span class="section"><a href="#filename-misc">19.5. Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#translate-pathname">19.5.1. Function <code class="function">TRANSLATE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#translate-logpath">19.5.2. Function <code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#parsename">19.5.3. Function <code class="function">PARSE-NAMESTRING</code></a></span></dt><dt><span class="section"><a href="#pathmerge">19.5.4. Function <code class="function">MERGE-PATHNAMES</code></a></span></dt><dt><span class="section"><a href="#load-lpt">19.5.5. Function <code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a></span></dt><dt><span class="section"><a href="#absolute-pathname">19.5.6. Function <code class="function">EXT:ABSOLUTE-PATHNAME</code></a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#files">20. Files chap-20</a></span></dt><dd><dl><dt><span class="section"><a href="#dir-is-not-file">20.1. Directory is <span class="strong"><strong>not</strong></span> a file</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-path">20.1.1. Function <code class="function">EXT:PROBE-PATHNAME</code></a></span></dt></dl></dd><dt><span class="section"><a href="#file-func">20.2. File functions</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-file">20.2.1. Function <code class="function">PROBE-FILE</code></a></span></dt><dt><span class="section"><a href="#file-author">20.2.2. Function <code class="function">FILE-AUTHOR</code></a></span></dt><dt><span class="section"><a href="#del-file">20.2.3. Function <code class="function">DELETE-FILE</code></a></span></dt><dt><span class="section"><a href="#rename-file">20.2.4. Function <code class="function">RENAME-FILE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#dir-func">20.3. Directory functions</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-dir">20.3.1. Function <code class="function">EXT:PROBE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#directory">20.3.2. Function <code class="function">DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#dir">20.3.3. Function <code class="function">EXT:DIR</code></a></span></dt><dt><span class="section"><a href="#cd">20.3.4. Function <code class="function">EXT:CD</code></a></span></dt><dt><span class="section"><a href="#default-dir">20.3.5. Function <code class="function">EXT:DEFAULT-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#make-dir">20.3.6. Function <code class="function">EXT:MAKE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#delete-dir">20.3.7. Function <code class="function">EXT:DELETE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#rename-dir">20.3.8. Function <code class="function">EXT:RENAME-DIRECTORY</code></a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#streams">21. Streams chap-21</a></span></dt><dd><dl><dt><span class="section"><a href="#streams-interactive">21.1. Interactive Streams sec_21-1-1-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#stream-stdio-init">21.1.1. Initialization of Standard Streams</a></span></dt></dl></dd><dt><span class="section"><a href="#terminal">21.2. Terminal interaction</a></span></dt><dd><dl><dt><span class="section"><a href="#readline">21.2.1. Command line editing with GNU readline</a></span></dt><dt><span class="section"><a href="#with-kbd">21.2.2. Macro <code class="function">EXT:WITH-KEYBOARD</code></a></span></dt></dl></dd><dt><span class="section"><a href="#bin-io">21.3. Binary Input and Output</a></span></dt><dd><dl><dt><span class="section"><a href="#bin-input">21.3.1. Binary input, <code class="function">READ-BYTE</code>, <code class="function">EXT:READ-INTEGER</code> & <code class="function">EXT:READ-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bin-output">21.3.2. Binary output, <code class="function">WRITE-BYTE</code>, <code class="function">EXT:WRITE-INTEGER</code> & <code class="function">EXT:WRITE-FLOAT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#bulk-io">21.4. Bulk Input and Output</a></span></dt><dd><dl><dt><span class="section"><a href="#read-seq">21.4.1. Bulk Input</a></span></dt><dt><span class="section"><a href="#write-seq">21.4.2. Bulk Output</a></span></dt><dt><span class="section"><a href="#bulk-io-rationale">21.4.3. Rationale</a></span></dt></dl></dd><dt><span class="section"><a href="#non-block-io">21.5. Non-Blocking Input and Output</a></span></dt><dt><span class="section"><a href="#newline-convention">21.6. Newline Convention</a></span></dt><dd><dl><dt><span class="section"><a href="#nl-question">21.6.1. Should programs output a newline before or after each line of output?</a></span></dt><dt><span class="section"><a href="#nl-trad-analysis">21.6.2. Analysis</a></span></dt><dt><span class="section"><a href="#nl-conclusion">21.6.3. Conclusion</a></span></dt><dt><span class="section"><a href="#nl-solution">21.6.4. Solution</a></span></dt><dt><span class="section"><a href="#nl-elnl-analysis">21.6.5. Elastic Newline Analysis</a></span></dt></dl></dd><dt><span class="section"><a href="#stream-extfmt">21.7. Function <code class="function">STREAM-EXTERNAL-FORMAT</code></a></span></dt><dt><span class="section"><a href="#stream-eltype">21.8. Function <code class="function">STREAM-ELEMENT-TYPE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#bin-stdio">21.8.1. Binary input from <code class="varname">*STANDARD-INPUT*</code></a></span></dt></dl></dd><dt><span class="section"><a href="#make-stream">21.9. Function <code class="function">EXT:MAKE-STREAM</code></a></span></dt><dt><span class="section"><a href="#file-pos">21.10. Function <code class="function">FILE-POSITION</code></a></span></dt><dt><span class="section"><a href="#elastic-newline">21.11. Function <code class="function">EXT:ELASTIC-NEWLINE</code></a></span></dt><dt><span class="section"><a href="#open">21.12. Function <code class="function">OPEN</code></a></span></dt><dt><span class="section"><a href="#clear-input">21.13. Function <code class="function">CLEAR-INPUT</code></a></span></dt><dt><span class="section"><a href="#close">21.14. Function <code class="function">CLOSE</code></a></span></dt><dt><span class="section"><a href="#open-stream-p">21.15. Function <code class="function">OPEN-STREAM-P</code></a></span></dt><dt><span class="section"><a href="#broadcast-stream">21.16. Class <code class="classname">BROADCAST-STREAM</code></a></span></dt><dt><span class="section"><a href="#stream-buffer">21.17. Functions <code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
and <code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
</a></span></dt><dt><span class="section"><a href="#stream-handles">21.18. Function <code class="function">EXT:STREAM-HANDLES</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#printer">22. Printer chap-22</a></span></dt><dd><dl><dt><span class="section"><a href="#multi-rep">22.1. Multiple Possible Textual Representations sec_22-1-1-1</a></span></dt><dt><span class="section"><a href="#write-float-decimal">22.2. Printing Floats sec_22-1-3-1-3</a></span></dt><dt><span class="section"><a href="#spacecharprint">22.3. Printing Characters sec_22-1-3-2</a></span></dt><dt><span class="section"><a href="#sym-pack-prefix">22.4. Package Prefixes for Symbols sec_22-1-3-3-1</a></span></dt><dt><span class="section"><a href="#print-vector">22.5. Printing Other Vectors sec_22-1-3-7</a></span></dt><dt><span class="section"><a href="#print-array">22.6. Printing Other Arrays sec_22-1-3-8</a></span></dt><dd><dl><dt><span class="section"><a href="#pathprint">22.6.1. Printing Pathnames sec_22-1-3-11</a></span></dt></dl></dd><dt><span class="section"><a href="#clpp">22.7. The Lisp Pretty Printer sec_22-2</a></span></dt><dd><dl><dt><span class="section"><a href="#pp-dispatch">22.7.1. Pretty Print Dispatch Table sec_22-2-1-4</a></span></dt></dl></dd><dt><span class="section"><a href="#print-formatted">22.8. Formatted Output sec_22-3</a></span></dt><dt><span class="section"><a href="#write">22.9. Functions <code class="function">WRITE</code> & <code class="function">WRITE-TO-STRING</code></a></span></dt><dt><span class="section"><a href="#print-unreadable-object">22.10. Macro <code class="function">PRINT-UNREADABLE-OBJECT</code></a></span></dt><dt><span class="section"><a href="#print-misc">22.11. Miscellaneous Issues</a></span></dt></dl></dd><dt><span class="chapter"><a href="#reader">23. Reader chap-23</a></span></dt><dd><dl><dt><span class="section"><a href="#rt-case">23.1. Effect of Readtable Case on the Lisp Reader sec_23-1-2</a></span></dt><dt><span class="section"><a href="#recursive-p">23.2. The <em class="replaceable"><code>recursive-p</code></em> argument sec_23-1-3-2</a></span></dt></dl></dd><dt><span class="chapter"><a href="#system">24. System Construction chap-24</a></span></dt><dd><dl><dt><span class="section"><a href="#compilefile">24.1. Function <code class="function">COMPILE-FILE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#compile-file-output">24.1.1. Output files</a></span></dt><dt><span class="section"><a href="#compile-file-return">24.1.2. Return values</a></span></dt></dl></dd><dt><span class="section"><a href="#compile-file-path">24.2. Function <code class="function">COMPILE-FILE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#require">24.3. Function <code class="function">REQUIRE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#require-return">24.3.1. Return value</a></span></dt><dt><span class="section"><a href="#require-search">24.3.2. Additional <code class="function">LOAD</code> locations</a></span></dt><dt><span class="section"><a href="#module-providers">24.3.3. User variable <code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></span></dt><dt><span class="section"><a href="#lib-files">24.3.4. Interaction with <code class="function">COMPILE-FILE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#loadfile">24.4. Function <code class="function">LOAD</code></a></span></dt><dt><span class="section"><a href="#features">24.5. Variable <code class="varname">*FEATURES*</code></a></span></dt><dt><span class="section"><a href="#featurep">24.6. Function <code class="function">EXT:FEATUREP</code> [CLRFI-1]</a></span></dt><dt><span class="section"><a href="#compiled-file-p">24.7. Function <code class="function">EXT:COMPILED-FILE-P</code> [CLRFI-2]</a></span></dt></dl></dd><dt><span class="chapter"><a href="#environment">25. Environment chap-25</a></span></dt><dd><dl><dt><span class="section"><a href="#repl">25.1. Top Level Loop sec_25-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#user-commands">25.1.1. User-defined Commands</a></span></dt></dl></dd><dt><span class="section"><a href="#debugger">25.2. Debugging Utilities sec_25-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#disassemble">25.2.1. Function <code class="function">DISASSEMBLE</code></a></span></dt><dt><span class="section"><a href="#uncompile">25.2.2. Function <code class="function">EXT:UNCOMPILE</code></a></span></dt><dt><span class="section"><a href="#show-stack">25.2.3. Function <code class="function">EXT:SHOW-STACK</code></a></span></dt><dt><span class="section"><a href="#documentation">25.2.4. Function <code class="function">DOCUMENTATION</code></a></span></dt><dt><span class="section"><a href="#describe">25.2.5. Function <code class="function">DESCRIBE</code></a></span></dt><dt><span class="section"><a href="#trace">25.2.6. Macro <code class="function">TRACE</code></a></span></dt><dt><span class="section"><a href="#inspect">25.2.7. Function <code class="function">INSPECT</code></a></span></dt><dt><span class="section"><a href="#time">25.2.8. Macro <code class="function">TIME</code></a></span></dt><dt><span class="section"><a href="#ed">25.2.9. Function <code class="function">ED</code></a></span></dt><dt><span class="section"><a href="#apropos">25.2.10. Functions <code class="function">APROPOS</code> & <code class="function">APROPOS-LIST</code></a></span></dt><dt><span class="section"><a href="#dribble">25.2.11. Function <code class="function">DRIBBLE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#environment-enq">25.3. Environment Inquiry sec_25-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#room">25.3.1. Function <code class="function">ROOM</code></a></span></dt><dt><span class="section"><a href="#gc-sect">25.3.2. Function <code class="function">EXT:GC</code>
</a></span></dt><dt><span class="section"><a href="#machine">25.3.3. Machine</a></span></dt><dt><span class="section"><a href="#version">25.3.4. Function <code class="function">LISP-IMPLEMENTATION-VERSION</code></a></span></dt><dt><span class="section"><a href="#argv">25.3.5. Function <code class="function">EXT:ARGV</code></a></span></dt></dl></dd><dt><span class="section"><a href="#clock">25.4. Time sec_25-1-4</a></span></dt></dl></dd><dt><span class="chapter"><a href="#glossary">26. Glossary chap-26</a></span></dt><dt><span class="chapter"><a href="#appendix">27. Appendix chap-a</a></span></dt><dt><span class="chapter"><a href="#issues">28. X3J13 Issue Index [CLHS-ic]</a></span></dt></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="intro"></a>Chapter 1. Introduction
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-1.html">[chap-1]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#spec-symb">1.1. Special Symbols sec_1-4-1-3</a></span></dt><dt><span class="section"><a href="#error-terms">1.2. Error Terminology sec_1-4-2</a></span></dt><dt><span class="section"><a href="#cl-symb">1.3. Symbols in the Package <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> sec_1-9</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spec-symb"></a>1.1. Special Symbols
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-4-1-3.html">[sec_1-4-1-3]</a></h2></div></div></div><p>The <strong class="first"><em class="firstterm">final delimiter
<a id="fin-delim" class="indexterm"></a></em></strong>
of an interactive stream:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a></span></dt><dd>type <span class="keycap"><strong>Control</strong></span>+<span class="keysym">D</span>
at the beginning of a line</dd><dt><span class="term"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a></span></dt><dd>type <span class="keycap"><strong>Control</strong></span>+<span class="keysym">Z</span>,
followed by <span class="keycap"><strong>Enter</strong></span></dd></dl></div><p>
This final delimiter is never actually seen by programs; no need to
test for <span class="keysym">#\^D</span> or <span class="keysym">#\^Z</span> - use
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char-no-hang.html" target="_top"><code class="function">READ-CHAR-NO-HANG</code></a> to check for <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>.</p><p>A newline character can be entered by the user by pressing the
<span class="keycap"><strong>Enter</strong></span> key.</p><p>See also <a class="xref" href="#clear-input" title="21.13. Function CLEAR-INPUT">Section 21.13, “Function <code class="function">CLEAR-INPUT</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="error-terms"></a>1.2. Error Terminology
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-4-2.html">[sec_1-4-2]</a></h2></div></div></div><p>Safety settings are ignored by the interpreted code;
therefore where the standard uses the phrase <span class="quote">“<span class="quote">should signal an
error</span>”</span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
See <a class="xref" href="#safety-decl" title="3.3.5. Declaration SAFETY">Section 3.3.5, “Declaration <code class="literal">SAFETY</code>”</a> for the safety of compiled code.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cl-symb"></a>1.3. Symbols in the Package <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-9.html">[sec_1-9]</a></h2></div></div></div><p>All 978 symbols in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> package specified by the
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] are implemented.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="syntax"></a>Chapter 2. Syntax <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-2.html">[chap-2]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#std-char">2.1. Standard Characters sec_2-1-3</a></span></dt><dt><span class="section"><a href="#reader-alg">2.2. Reader Algorithm sec_2-2</a></span></dt><dt><span class="section"><a href="#tokens">2.3. Symbols as Tokens sec_2-3-4</a></span></dt><dt><span class="section"><a href="#valid-patterns">2.4. Valid Patterns for Tokens sec_2-3-5</a></span></dt><dt><span class="section"><a href="#backquote">2.5. Backquote sec_2-4-6</a></span></dt><dt><span class="section"><a href="#sharpsign">2.6. Sharpsign sec_2-4-8</a></span></dt><dd><dl><dt><span class="section"><a href="#sharpsign-backslash">2.6.1. Sharpsign Backslash sec_2-4-8-1</a></span></dt><dt><span class="section"><a href="#sharpsign-less-than">2.6.2. Sharpsign Less-Than-Sign sec_2-4-8-20</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std-char"></a>2.1. Standard Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-1-3.html">[sec_2-1-3]</a></h2></div></div></div><p>The standard characters are <span class="keysym">#\Newline</span> and the
<a class="link" href="#graph-char" title="13.5. Graphic Characters sec_13-1-4-1">graphic characters</a>
with a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> between 32 and 126 (inclusive).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="reader-alg"></a>2.2. Reader Algorithm
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-2.html">[sec_2-2]</a></h2></div></div></div><p>The requirement of step 4 that a <span class="quote">“<span class="quote"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_r.html#reader_macro_function">reader
macro function</a> may return zero values or one value</span>”</span>
<span class="strong"><strong>is</strong></span> enforced. You can use the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> to control the
number of values returned.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="tokens"></a>2.3. Symbols as Tokens
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-3-4.html">[sec_2-3-4]</a></h2></div></div></div><p>A <strong class="first"><em class="firstterm">reserved token
<a id="res-token" class="indexterm"></a></em></strong>,
i.e., a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#token">token</a> that has
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#potential_number">potential number</a> syntax but cannot be
interpreted as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>, is interpreted as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> when being
read.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="valid-patterns"></a>2.4. Valid Patterns for Tokens
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-3-5.html">[sec_2-3-5]</a></h2></div></div></div><p>When a token with package markers is read, then no checking is
done whether the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-package.html" target="_top"><code class="function">SYMBOL-PACKAGE</code></a> part and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> part do
not have number syntax. (What would the purpose of this check be?)
So we consider tokens like <span class="token">USER::</span> or <span class="token">:1</span> or
<span class="token">LISP::4711</span> or <span class="token">21:3</span> as symbols.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="backquote"></a>2.5. Backquote
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-6.html">[sec_2-4-6]</a></h2></div></div></div><p>The backquote read macro also works when nested. Example:
<a id="bq-nested"></a></p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> ``(,#'(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () ',a) ,#'(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () ',b)))
≡ (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> `(list #'(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () ',a) #'(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () ',b)))
≡ (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> (list 'list (list 'function (list 'lambda nil (list 'quote a)))
(list 'function (list 'lambda nil (list 'quote b)))))
</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sharpsign"></a>2.6. Sharpsign
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8.html">[sec_2-4-8]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#sharpsign-backslash">2.6.1. Sharpsign Backslash sec_2-4-8-1</a></span></dt><dt><span class="section"><a href="#sharpsign-less-than">2.6.2. Sharpsign Less-Than-Sign sec_2-4-8-20</a></span></dt></dl></div><p>Reader macros are also defined for the following:
</p><div class="variablelist"><a id="extra-read-macro-table"></a><p class="title"><strong>Additional reader macros</strong></p><dl class="variablelist"><dt><span class="term"><span class="data"><code class="literal">#,</code></span></span></dt><dd>load-time evaluation, kept despite the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]
issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss315.html" target="_top">SHARP-COMMA-CONFUSION:REMOVE</a>.</dd><dt><span class="term"><span class="data"><code class="literal">#Y</code></span></span></dt><dd>compiled <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> objects and <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>'s <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s
</dd><dt><span class="term"><span class="data"><code class="literal">#""</code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>: <code class="filename">#"test.lisp"</code>
is the value of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname.html" target="_top"><code class="function">PATHNAME</code></a> "test.lisp")</code></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sharpsign-backslash"></a>2.6.1. Sharpsign Backslash
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-1.html">[sec_2-4-8-1]</a></h3></div></div></div><p><span class="keysym">#\Code</span> allows input of characters of arbitrary code:
e.g., <span class="keysym">#\Code231</span> reads as the character
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> 231)</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sharpsign-less-than"></a>2.6.2. Sharpsign Less-Than-Sign
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">[sec_2-4-8-20]</a></h3></div></div></div><p>This is the list of objects whose external representation cannot
be meaningfully read in:</p><div class="variablelist"><a id="unreadable-objects"></a><p class="title"><strong>Unreadable objects</strong></p><dl class="variablelist"><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a><em class="replaceable"><code>type</code></em> ...></code></span></span></dt><dd>all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>s lacking a keyword
constructor</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>ARRAY <em class="replaceable"><code>type</code></em>
<em class="replaceable"><code>dimensions</code></em>></code></span></span></dt><dd>all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>s except <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s, if
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-arrayst.html" target="_top"><code class="varname">*PRINT-ARRAY*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>SYSTEM-FUNCTION <em class="replaceable"><code>name</code></em>></code></span></span></dt><dd>built-in function written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>ADD-ON-SYSTEM-FUNCTION
<em class="replaceable"><code>name</code></em>></code></span></span></dt><dd><a href="impnotes.html#modules" class="olink">module</a> function written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>SPECIAL-OPERATOR
<em class="replaceable"><code>name</code></em>></code></span></span></dt><dd>special operator handler</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>COMPILED-FUNCTION
<em class="replaceable"><code>name</code></em>></code></span></span></dt><dd>compiled function, if <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>FUNCTION <em class="replaceable"><code>name</code></em> ...></code></span></span></dt><dd>interpreted function, , if <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>FRAME-POINTER #x...></code></span></span></dt><dd>pointer to a stack frame</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>DISABLED POINTER></code></span></span></dt><dd>frame pointer which has become invalid on exit from the
corresponding <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>...STREAM...></code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>PACKAGE <em class="replaceable"><code>name</code></em>></code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>HASH-TABLE #x...></code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>, if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-arrayst.html" target="_top"><code class="varname">*PRINT-ARRAY*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>READTABLE #x...></code></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_readtable.html" target="_top"><code class="classname">READTABLE</code></a></dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>SYMBOL-MACRO <em class="replaceable"><code>form</code></em>></code></span></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> handler</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>MACRO <em class="replaceable"><code>function</code></em>></code></span></span></dt><dd>macro expander (defined by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a> and friends)
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a><a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>
#x...></code></span></span></dt><dd>foreign pointer (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span>)
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a><a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>
#x...></code></span></span></dt><dd>foreign address
(<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span>)</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a><a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>name</code></em>
#x...></code></span></span></dt><dd>foreign variable (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span>)
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> <em class="replaceable"><code>name</code></em>
#x...></code></span></span></dt><dd>foreign function (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span>)
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>UNBOUND></code></span></span></dt><dd><span class="quote">“<span class="quote">value</span>”</span> of an unbound symbol, an unsupplied
optional or keyword argument</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>SPECIAL REFERENCE></code></span></span></dt><dd>environment marker for variables declared <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a>
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>DOT></code></span></span></dt><dd>internal <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> result for <span class="quote">“<span class="quote">.</span>”</span>
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>END OF FILE></code></span></span></dt><dd>internal <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> result, when the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>READ-LABEL ...></code></span></span></dt><dd>intermediate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> result for <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-16.html"><span class="data"><code class="literal">#n#</code></span></a>
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>ADDRESS #x...></code></span></span></dt><dd>machine address, should not occur
</dd><dt><span class="term"><span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>SYSTEM-POINTER #x...></code></span></span></dt><dd>should not occur</dd></dl></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="eval"></a>Chapter 3. Evaluation and Compilation
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-3.html">[chap-3]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#evaluation">3.1. Evaluation sec_3-1</a></span></dt><dd><dl><dt><span class="section"><a href="#eval-environ">3.1.1. Introduction to Environments sec_3-1-1</a></span></dt><dt><span class="section"><a href="#sym-forms">3.1.2. Symbols as Forms sec_3-1-2-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#def-sym-mac">3.1.2.1. Macro <code class="function">DEFINE-SYMBOL-MACRO</code></a></span></dt><dt><span class="section"><a href="#dyn-var">3.1.2.2. Dynamic Variables sec_3-1-2-1-1-2</a></span></dt></dl></dd><dt><span class="section"><a href="#cons-forms">3.1.3. Conses as Forms sec_3-1-2-1-2</a></span></dt><dt><span class="section"><a href="#specforms">3.1.4. Special Forms sec_3-1-2-1-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#eval-when">3.1.4.1. Special operator <code class="function">EVAL-WHEN</code></a></span></dt><dt><span class="section"><a href="#speop-the">3.1.4.2. Special operator <code class="function">THE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#funforms">3.1.5. Function Forms sec_3-1-2-1-2-3</a></span></dt><dd><dl><dt><span class="section"><a href="#sym-fun">3.1.5.1. Function <code class="function">SYMBOL-FUNCTION</code></a></span></dt></dl></dd><dt><span class="section"><a href="#defun">3.1.6. Macros <code class="function">DEFUN</code> & <code class="function">DEFMACRO</code></a></span></dt></dl></dd><dt><span class="section"><a href="#compilation">3.2. Compilation sec_3-2</a></span></dt><dd><dl><dt><span class="section"><a href="#compiler-terms">3.2.1. Compiler Terminology sec_3-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#compile-jit">3.2.1.1. Just-In-Time Native Compilation</a></span></dt></dl></dd><dt><span class="section"><a href="#compilation-semantics">3.2.2. Compilation Semantics sec_3-2-2</a></span></dt><dd><dl><dt><span class="section"><a href="#compiler-macros">3.2.2.1. Compiler Macros sec_3-2-2-1</a></span></dt><dt><span class="section"><a href="#minimal-compilation">3.2.2.2. Minimal Compilation sec_3-2-2-2</a></span></dt><dt><span class="section"><a href="#semantic-constraints">3.2.2.3. Semantic Constraints sec_3-2-2-3</a></span></dt></dl></dd><dt><span class="section"><a href="#similarity">3.2.3. Definition of Similarity sec_3-2-4-2-2</a></span></dt><dt><span class="section"><a href="#compile-errors">3.2.4. Exceptional Situations in the Compiler sec_3-2-5</a></span></dt></dl></dd><dt><span class="section"><a href="#declarations">3.3. Declarations sec_3-3</a></span></dt><dd><dl><dt><span class="section"><a href="#decl-min">3.3.1. Minimal Declaration Processing Requirements sec_3-3-1</a></span></dt><dt><span class="section"><a href="#spec-decl">3.3.2. Declaration <code class="literal">SPECIAL</code></a></span></dt><dt><span class="section"><a href="#constant-notinline">3.3.3. Declaration <code class="literal">EXT:CONSTANT-NOTINLINE</code></a></span></dt><dt><span class="section"><a href="#constantp">3.3.4. Function <code class="function">CONSTANTP</code></a></span></dt><dt><span class="section"><a href="#safety-decl">3.3.5. Declaration <code class="literal">SAFETY</code></a></span></dt><dt><span class="section"><a href="#compile-decl">3.3.6. Declaration <code class="code">(COMPILE)</code></a></span></dt><dt><span class="section"><a href="#space-decl">3.3.7. Declaration <code class="literal">SPACE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#lalist">3.4. Lambda Lists sec_3-4</a></span></dt><dd><dl><dt><span class="section"><a href="#boa-lalist">3.4.1. Boa Lambda Lists sec_3-4-6</a></span></dt></dl></dd></dl></div><p>All the functions built by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> and the like are
atoms. There are built-in functions written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, compiled
functions (both of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_compiled-function.html" target="_top"><code class="classname">COMPILED-FUNCTION</code></a>) and interpreted
functions (of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>).</p><div class="table"><a id="eval-limits-table"></a><p class="title"><strong>Table 3.1. Function call limits</strong></p><div class="table-contents"><table class="table" summary="Function call limits" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_call-a_uments-limit.html" target="_top"><code class="constant">CALL-ARGUMENTS-LIMIT</code></a></td><td align="center">2<sup>12</sup>=4096</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_multip_values-limit.html" target="_top"><code class="constant">MULTIPLE-VALUES-LIMIT</code></a></td><td align="center">2<sup>7</sup>=128</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_lambda_meters-limit.html" target="_top"><code class="constant">LAMBDA-PARAMETERS-LIMIT</code></a></td><td align="center">2<sup>12</sup>=4096</td></tr></tbody></table></div></div><br class="table-break" /><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="evaluation"></a>3.1. Evaluation
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1.html">[sec_3-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#eval-environ">3.1.1. Introduction to Environments sec_3-1-1</a></span></dt><dt><span class="section"><a href="#sym-forms">3.1.2. Symbols as Forms sec_3-1-2-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#def-sym-mac">3.1.2.1. Macro <code class="function">DEFINE-SYMBOL-MACRO</code></a></span></dt><dt><span class="section"><a href="#dyn-var">3.1.2.2. Dynamic Variables sec_3-1-2-1-1-2</a></span></dt></dl></dd><dt><span class="section"><a href="#cons-forms">3.1.3. Conses as Forms sec_3-1-2-1-2</a></span></dt><dt><span class="section"><a href="#specforms">3.1.4. Special Forms sec_3-1-2-1-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#eval-when">3.1.4.1. Special operator <code class="function">EVAL-WHEN</code></a></span></dt><dt><span class="section"><a href="#speop-the">3.1.4.2. Special operator <code class="function">THE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#funforms">3.1.5. Function Forms sec_3-1-2-1-2-3</a></span></dt><dd><dl><dt><span class="section"><a href="#sym-fun">3.1.5.1. Function <code class="function">SYMBOL-FUNCTION</code></a></span></dt></dl></dd><dt><span class="section"><a href="#defun">3.1.6. Macros <code class="function">DEFUN</code> & <code class="function">DEFMACRO</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="eval-environ"></a>3.1.1. Introduction to Environments
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1.html">[sec_3-1-1]</a></h3></div></div></div><p><a id="the-env"></a><strong>Macro <a class="link" href="#the-env" title="Macro EXT:THE-ENVIRONMENT"><code class="function">EXT:THE-ENVIRONMENT</code></a>. </strong>As in Scheme, the macro <code class="code">(<a class="link" href="#the-env" title="Macro EXT:THE-ENVIRONMENT"><code class="function">EXT:THE-ENVIRONMENT</code></a>)</code>
returns the current <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. This works only in interpreted code and
is not compilable!</p><p><a id="eval-env"></a><strong>Function <code class="code">(EXT:EVAL-ENV
<em class="replaceable"><code>form</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code>. </strong>evaluates a form in a given <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>, just as if the
form had been a part of the program that the <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em> came from.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sym-forms"></a>3.1.2. Symbols as Forms
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1.html">[sec_3-1-2-1-1]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#def-sym-mac">3.1.2.1. Macro <code class="function">DEFINE-SYMBOL-MACRO</code></a></span></dt><dt><span class="section"><a href="#dyn-var">3.1.2.2. Dynamic Variables sec_3-1-2-1-1-2</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="def-sym-mac"></a>3.1.2.1. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html" target="_top"><code class="function">DEFINE-SYMBOL-MACRO</code></a></h4></div></div></div><p>The macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html" target="_top"><code class="function">DEFINE-SYMBOL-MACRO</code></a> establishes <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>s with
global scope (as opposed to <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>s defined with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_symbol-macrolet.html" target="_top"><code class="function">SYMBOL-MACROLET</code></a>, which have local scope).</p><p>The function
<strong class="first"><em class="firstterm"><a class="link" href="#symbol-mex"><code class="function">EXT:SYMBOL-MACRO-EXPAND</code></a><a id="symbol-mex" class="indexterm"></a></em></strong>
tests for a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>: If <em class="replaceable"><code>symbol</code></em> is defined as a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>
in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-1.html">global environment</a>, <code class="code">(<a class="link" href="#symbol-mex"><code class="function">EXT:SYMBOL-MACRO-EXPAND</code></a> <em class="replaceable"><code>symbol</code></em>)</code> returns two
values, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> and the expansion; otherwise it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p><a class="link" href="#symbol-mex"><code class="function">EXT:SYMBOL-MACRO-EXPAND</code></a> is a special case of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_macroexpa_acroexpand-1.html" target="_top"><code class="function">MACROEXPAND-1</code></a>. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_macroexpa_acroexpand-1.html" target="_top"><code class="function">MACROEXPAND-1</code></a>
can also test whether a symbol is defined as a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> in <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>s
other than the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-1.html">global environment</a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dyn-var"></a>3.1.2.2. Dynamic Variables
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">[sec_3-1-2-1-1-2]</a></h4></div></div></div><p><span class="quote">“<span class="quote">Undefined variables</span>”</span>, i.e. <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1.html">variable</a>s which are
referenced outside any lexical binding for a variable of the same name
and which are not declared <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a>, are treated like <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a>s
in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-1.html">global environment</a>. The compiler <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> when it
encounters an undefined variable.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cons-forms"></a>3.1.3. Conses as Forms
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2.html">[sec_3-1-2-1-2]</a></h3></div></div></div><p>Lists of the form <code class="code">((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <em class="replaceable"><code>symbol</code></em>) ...)</code> are also
treated as function forms. This makes the syntax
<code class="code">(<em class="replaceable"><code>function-name</code></em> <em class="replaceable"><code>arguments</code></em> ...)</code> consistent with the syntax
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> #'<em class="replaceable"><code>function-name</code></em> <em class="replaceable"><code>arguments</code></em> ...)</code>.
It implements the item 7 of the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss174.html" target="_top">FUNCTION-NAME:LARGE</a> and the
definition of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_form">function form</a>s,
and is consistent with the use of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a>s elsewhere in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="specforms"></a>3.1.4. Special Forms
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2-1.html">[sec_3-1-2-1-2-1]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#eval-when">3.1.4.1. Special operator <code class="function">EVAL-WHEN</code></a></span></dt><dt><span class="section"><a href="#speop-the">3.1.4.2. Special operator <code class="function">THE</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="eval-when"></a>3.1.4.1. Special operator <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a></h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> also accepts the situations <code class="code">(NOT EVAL)</code>
and <code class="code">(NOT COMPILE)</code>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The situations <code class="constant">EVAL</code>,
<code class="constant">LOAD</code> and <code class="constant">COMPILE</code> are
deprecated by the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], and they are <span class="strong"><strong>not</strong></span> equivalent to the new
standard situations <code class="constant">:EXECUTE</code>,
<code class="constant">:LOAD-TOPLEVEL</code>
and <code class="constant">:COMPILE-TOPLEVEL</code> in that they ignore the
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-3-1.html">top-level form</a> versus non-<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-3-1.html">top-level form</a> distinction.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="speop-the"></a>3.1.4.2. Special operator <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_the.html" target="_top"><code class="function">THE</code></a></h4></div></div></div><p>The special form <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_the.html" target="_top"><code class="function">THE</code></a> <em class="replaceable"><code>value-type</code></em> <em class="replaceable"><code>form</code></em>)</code> is
similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_check-type.html" target="_top"><code class="function">CHECK-TYPE</code></a> but does a type check only in interpreted
code (no type check is done in compiled code - but see the <a class="link" href="#ethe" title="31.11.1. Macro EXT:ETHE"><code class="function">EXT:ETHE</code></a>
macro) and does not allow interactive error correction by the user.
</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="funforms"></a>3.1.5. Function Forms
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2-3.html">[sec_3-1-2-1-2-3]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#sym-fun">3.1.5.1. Function <code class="function">SYMBOL-FUNCTION</code></a></span></dt></dl></div><p><strong>Constant <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_lambda_ist-keywords.html" target="_top"><code class="constant">LAMBDA-LIST-KEYWORDS</code></a>. </strong><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&AUX</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&WHOLE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&ENVIRONMENT</code></a>)</code></p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="sym-fun"></a>3.1.5.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a></h4></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a> <em class="replaceable"><code>symbol</code></em>) <em class="replaceable"><code>object</code></em>)</code>
requires <em class="replaceable"><code>object</code></em> to be either a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a>
return value, or a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>. The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> is thereby
immediately converted to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defun"></a>3.1.6. Macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> & <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a> are allowed in non-toplevel positions. As
an example, consider the old (<a class="xref" href="#CLtL1" title="Common Lisp: the Language (1st Edition)">[<abbr class="abbrev">CLtL1</abbr>]</a>) definition of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_gensym.html" target="_top"><code class="function">GENSYM</code></a>:</p><pre class="programlisting">
(let ((gensym-prefix "G")
(gensym-count 1))
(defun gensym (&optional (x nil s))
(when s
(cond ((stringp x) (setq gensym-prefix x))
((integerp x)
(if (minusp x)
(error "~S: index ~S is negative" 'gensym x)
(setq gensym-count x)))
(t (error "~S: argument ~S of wrong type" 'gensym x))))
(prog1
(make-symbol
(concatenate 'string
gensym-prefix
(write-to-string gensym-count :base 10 :radix nil)))
(incf gensym-count))))
</pre><p>See also <a class="xref" href="#minimal-compilation" title="3.2.2.2. Minimal Compilation sec_3-2-2-2">Section 3.2.2.2, “Minimal Compilation sec_3-2-2-2”</a>.</p><p><a id="arglist"></a><strong>Function <a class="link" href="#arglist" title="Function EXT:ARGLIST"><code class="function">EXT:ARGLIST</code></a>. </strong>Function <code class="code">(<a class="link" href="#arglist" title="Function EXT:ARGLIST"><code class="function">EXT:ARGLIST</code></a> <em class="replaceable"><code>name</code></em>)</code> returns the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of
the function or macro that <em class="replaceable"><code>name</code></em> names and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>name</code></em> is
not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_fboundp.html" target="_top"><code class="function">FBOUNDP</code></a>. It also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when the macro <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is not
available due to the compiler optimization settings
(see <a class="xref" href="#space-decl" title="3.3.7. Declaration SPACE">Section 3.3.7, “Declaration <code class="literal">SPACE</code>”</a>).</p><p><a id="suppress-check-redef"></a><strong>Variable <a class="link" href="#suppress-check-redef" title="Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*"><code class="varname">CUSTOM:*SUPPRESS-CHECK-REDEFINITION*</code></a>. </strong>When <strong class="first"><em class="firstterm"><a class="link" href="#suppress-check-redef" title="Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*"><code class="varname">CUSTOM:*SUPPRESS-CHECK-REDEFINITION*</code></a></em></strong> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> issues a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> when a function (macro, variable, class,
etc) is redefined in a different file than its original definition.
It is <span class="strong"><strong>not</strong></span> a good idea to set this variable to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.
</p><p><a id="defun-accept-spelalist"></a><strong>Variable <a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a>. </strong>When <strong class="first"><em class="firstterm"><a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a></em></strong> is
non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> accepts <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a>s, converting type-parameter
associations to type <a class="link" href="#declarations" title="3.3. Declarations sec_3-3">declarations</a>:
</p><pre class="programlisting">(defun f ((x list) (y integer)) ...)</pre><p>
is equivalent to
</p><pre class="programlisting">(defun f (x y) (declare (type list x) (type integer y)) ...)</pre><p>
This extension is disabled by <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code> and by setting <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>,
but can be re-enabled by setting <a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a> explicitly.
</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compilation"></a>3.2. Compilation
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2.html">[sec_3-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#compiler-terms">3.2.1. Compiler Terminology sec_3-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#compile-jit">3.2.1.1. Just-In-Time Native Compilation</a></span></dt></dl></dd><dt><span class="section"><a href="#compilation-semantics">3.2.2. Compilation Semantics sec_3-2-2</a></span></dt><dd><dl><dt><span class="section"><a href="#compiler-macros">3.2.2.1. Compiler Macros sec_3-2-2-1</a></span></dt><dt><span class="section"><a href="#minimal-compilation">3.2.2.2. Minimal Compilation sec_3-2-2-2</a></span></dt><dt><span class="section"><a href="#semantic-constraints">3.2.2.3. Semantic Constraints sec_3-2-2-3</a></span></dt></dl></dd><dt><span class="section"><a href="#similarity">3.2.3. Definition of Similarity sec_3-2-4-2-2</a></span></dt><dt><span class="section"><a href="#compile-errors">3.2.4. Exceptional Situations in the Compiler sec_3-2-5</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compiler-terms"></a>3.2.1. Compiler Terminology
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-1.html">[sec_3-2-1]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#compile-jit">3.2.1.1. Just-In-Time Native Compilation</a></span></dt></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> compiles to platform-independent <a href="impnotes.html#bytecode" class="olink">bytecode</a>.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compile-jit"></a>3.2.1.1. Just-In-Time Native Compilation</h4></div><div><h5 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span>
<a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/lightning/" target="_top">lightning</a></span></span></h5></div></div></div><p>The code compiled to <a href="impnotes.html#bytecode" class="olink">bytecode</a>s with optimization levels
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">>=</code></a> 0 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPACE</code></a>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function"><=</code></a> 1 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPEED</code></a>))</pre><p>
(by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a>, <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a>, or <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a>) will be
<span class="emphasis"><em>just-in-time</em></span> (i.e., on the first execution)
compiled to native code using <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/lightning/" target="_top">lightning</a>.
</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compilation-semantics"></a>3.2.2. Compilation Semantics
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-2.html">[sec_3-2-2]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#compiler-macros">3.2.2.1. Compiler Macros sec_3-2-2-1</a></span></dt><dt><span class="section"><a href="#minimal-compilation">3.2.2.2. Minimal Compilation sec_3-2-2-2</a></span></dt><dt><span class="section"><a href="#semantic-constraints">3.2.2.3. Semantic Constraints sec_3-2-2-3</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compiler-macros"></a>3.2.2.1. Compiler Macros
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-2-1.html">[sec_3-2-2-1]</a></h4></div></div></div><p>Compiler macros are expanded in the compiled code only, and
ignored by the interpreter.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="minimal-compilation"></a>3.2.2.2. Minimal Compilation
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-2-2.html">[sec_3-2-2-2]</a></h4></div></div></div><p>When a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> form is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>uated, the macros used there are
expanded, so they must be already defined, and their (re)definition
does <span class="strong"><strong>not</strong></span> affect functions which are already defined.</p><p>This means that even the interpreted code is <span class="emphasis"><em>minimally
compiled</em></span> in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="semantic-constraints"></a>3.2.2.3. Semantic Constraints
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-2-3.html">[sec_3-2-2-3]</a></h4></div></div></div><p>Non-conforming code that does not follow the rule
</p><div class="blockquote"><blockquote class="blockquote"><p><span class="quote">“<span class="quote">Special proclamations for dynamic variables must
be made in the compilation environment.</span>”</span></p></blockquote></div><p>
can produce quite unexpected results, e.g., observable differences
between <span class="emphasis"><em>compiled</em></span> and <span class="emphasis"><em>interpreted</em></span>
programs:</p><pre class="programlisting">
(defun adder-c (value) (declare <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a>) (lambda (x) (+ x value)))
⇒ <code class="computeroutput">ADDER-C</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">compiled function; <em class="replaceable"><code>value</code></em> is lexical</span></em>
(defun adder-i (value) (lambda (x) (+ x value)))
⇒ <code class="computeroutput">ADDER-I</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">interpreted function; <em class="replaceable"><code>value</code></em> is lexical</span></em>
(defparameter add-c-10 (adder-c 10))
⇒ <code class="computeroutput">ADD-C-10</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">compiled function</span></em>
(defparameter add-i-10 (adder-i 10))
⇒ <code class="computeroutput">ADD-I-10</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">interpreted function</span></em>
(funcall add-c-10 32)
⇒ <code class="computeroutput">42</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">as expected</span></em>
(funcall add-i-10 32)
⇒ <code class="computeroutput">42</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">as expected</span></em>
(defvar value 12)
⇒ <code class="computeroutput">VALUE</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">affects <code class="function">ADDER-I</code> and <code class="function">ADD-I-10</code> but <span class="strong"><strong>not</strong></span> <code class="function">ADDER-C</code> and <code class="function">ADD-C-10</code></span></em>
(funcall add-c-10 32)
⇒ <code class="computeroutput">42</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">as before</span></em>
(funcall add-i-10 32)
⇒ <code class="computeroutput">44</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation"><em class="replaceable"><code>value</code></em> is now dynamic!</span></em>
</pre><p><a id="semantic-constraints-non-conf"></a><strong>Non-conformance. </strong>The code shown above has a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> proclamation (by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>)
for the variable <em class="replaceable"><code>value</code></em> in the execution environment
(before the last two <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>s)
but not in the compilation environment: at the moment
the <code class="function">ADDER-I</code> function is defined,
<em class="replaceable"><code>value</code></em> is not known to be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> variable.
Therefore the code is not conforming.</p><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="semantic-constraints-rationale"></a>Rationale</h5></div></div></div><p>The function <code class="function">ADD-C-10</code> was compiled <span class="strong"><strong>before</strong></span>
<em class="replaceable"><code>value</code></em> was declared <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a>, so the symbol <em class="replaceable"><code>value</code></em> was
eliminated from its code and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> declaration did
not affect the return value (i.e., <code class="code">(funcall
add-c-10 32)</code> always returned <span class="returnvalue">42</span>).</p><p>On the opposite, function <code class="function">ADDER-I</code> was <span class="strong"><strong>not</strong></span>
compiled, so <code class="function">ADD-I-10</code>
was <span class="emphasis"><em>interpreted</em></span>.
Whenever <code class="function">ADD-I-10</code> is executed, its definition is
interpreted all over again. Before <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>, <em class="replaceable"><code>value</code></em> is evaluated as
a lexical (because it is <span class="strong"><strong>not</strong></span> declared <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> yet), but after
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>, we see a globally <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> symbol <em class="replaceable"><code>value</code></em> which
can have only a global <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-value.html" target="_top"><code class="function">SYMBOL-VALUE</code></a> (not a local binding), and thus
we are compelled to evaluate it to <span class="returnvalue">12</span>.</p><p>This behavior was implemented intentionally to ease interactive
development, because <span class="emphasis"><em>usually</em></span>
the <code class="function">ADDER-I</code> above would be followed by a
(forgotten) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>.</p><p>When a user compiles a program, the compiler is allowed to
remember the information whether a variable was <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> or not,
because that allows the compiler to generate more efficient code,
but in interpreted code, when the user changes the state of a variable,
he does <span class="strong"><strong>not</strong></span> want to re-evaluate all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a>s that use the variable.</p><p>[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] gives the implementation freedom regarding
interpreted evaluation, how much it wants to remember / cache, and how
much it wants to re-evaluate according the current <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1.html">environment</a>,
if it has changed. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implements <span class="emphasis"><em>ad-hoc
look-up</em></span> for variables (but <span class="strong"><strong>not</strong></span> for macros, see
<a class="xref" href="#minimal-compilation" title="3.2.2.2. Minimal Compilation sec_3-2-2-2">Section 3.2.2.2, “Minimal Compilation sec_3-2-2-2”</a>).</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="similarity"></a>3.2.3. Definition of Similarity
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-4-2-2.html">[sec_3-2-4-2-2]</a></h3></div></div></div><p>Hash tables are <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-4-1.html">externalizable object</a>s.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-errors"></a>3.2.4. Exceptional Situations in the Compiler
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-2-5.html">[sec_3-2-5]</a></h3></div></div></div><p>Both <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> may <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> the <a class="link" href="#compile-errors" title="3.2.4. Exceptional Situations in the Compiler sec_3-2-5"><code class="classname">EXT:SOURCE-PROGRAM-ERROR</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> which derives from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_program-error.html" target="_top"><code class="classname">PROGRAM-ERROR</code></a> and which contains
additional slots with accessors </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#compile-errors" title="3.2.4. Exceptional Situations in the Compiler sec_3-2-5"><code class="function">EXT:SOURCE-PROGRAM-ERROR-FORM</code></a></span></dt><dd>Returns the whole form in which the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> was
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed</dd><dt><span class="term"><a class="link" href="#compile-errors" title="3.2.4. Exceptional Situations in the Compiler sec_3-2-5"><code class="function">EXT:SOURCE-PROGRAM-ERROR-DETAIL</code></a></span></dt><dd>Returns the specific (usually small) part of the
above which triggered the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a></dd></dl></div><p><a id="key-optional"></a><strong>Mixing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>. </strong>It is a bad design to have both <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> in the
same <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>, especially if the number of optional arguments is even:
the users will often forget to supply optional arguments when supplying
keys, e.g., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-from-string.html" target="_top"><code class="function">READ-FROM-STRING</code></a> <em class="replaceable"><code>string</code></em> <code class="constant">:START</code> 5)</code>
instead of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-from-string.html" target="_top"><code class="function">READ-FROM-STRING</code></a> <em class="replaceable"><code>string</code></em> t nil <code class="constant">:START</code> 5)</code>.
This is why the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> compiler issues a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> in such cases:
</p><pre class="programlisting">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> foo (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> b) (cons a b))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> 'foo)
WARNING: in FOO : Mixing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> in lambda list (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> B) is bad design
FOO ;
1 ;
NIL
</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="declarations"></a>3.3. Declarations
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-3.html">[sec_3-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#decl-min">3.3.1. Minimal Declaration Processing Requirements sec_3-3-1</a></span></dt><dt><span class="section"><a href="#spec-decl">3.3.2. Declaration <code class="literal">SPECIAL</code></a></span></dt><dt><span class="section"><a href="#constant-notinline">3.3.3. Declaration <code class="literal">EXT:CONSTANT-NOTINLINE</code></a></span></dt><dt><span class="section"><a href="#constantp">3.3.4. Function <code class="function">CONSTANTP</code></a></span></dt><dt><span class="section"><a href="#safety-decl">3.3.5. Declaration <code class="literal">SAFETY</code></a></span></dt><dt><span class="section"><a href="#compile-decl">3.3.6. Declaration <code class="code">(COMPILE)</code></a></span></dt><dt><span class="section"><a href="#space-decl">3.3.7. Declaration <code class="literal">SPACE</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="decl-min"></a>3.3.1. Minimal Declaration Processing Requirements
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-3-1.html">[sec_3-3-1]</a></h3></div></div></div><p>The type declarations <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_type.html" target="_top"><code class="literal">TYPE</code></a> <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>variable</code></em> ...)</code>
and <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_ftype.html" target="_top"><code class="literal">FTYPE</code></a> <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>function</code></em> ...)</code>
are ignored by both the interpreter and the compiler.
Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_check-type.html" target="_top"><code class="function">CHECK-TYPE</code></a> to force type checks.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="spec-decl"></a>3.3.2. Declaration <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a></h3></div></div></div><p><a id="notspec-decl"></a><strong>Declaration <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a>. </strong>Declarations <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> <em class="replaceable"><code>variable</code></em>))</code>
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> are undone by the <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> '(<a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a>
<em class="replaceable"><code>variable</code></em>))</code> declaration. This declaration can be used only in
global <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_declaim.html" target="_top"><code class="function">DECLAIM</code></a> forms, <span class="strong"><strong>not</strong></span> in local <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sym_declare.html" target="_top"><code class="function">DECLARE</code></a> forms.
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>You cannot expect miracles: functions compiled <span class="strong"><strong>before</strong></span>
the <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a> proclamation was issued will still be treating <em class="replaceable"><code>variable</code></em> as
special even after the <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a> proclamation. See also
<a class="xref" href="#semantic-constraints" title="3.2.2.3. Semantic Constraints sec_3-2-2-3">Section 3.2.2.3, “Semantic Constraints sec_3-2-2-3”</a>.</p></div><p><a id="spe-var-p"></a><strong>Function <a class="link" href="#spe-var-p" title="Function EXT:SPECIAL-VARIABLE-P"><code class="function">EXT:SPECIAL-VARIABLE-P</code></a>. </strong>You can use the function <code class="code">(<a class="link" href="#spe-var-p" title="Function EXT:SPECIAL-VARIABLE-P"><code class="function">EXT:SPECIAL-VARIABLE-P</code></a> <em class="replaceable"><code>symbol</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code> to check whether the <em class="replaceable"><code>symbol</code></em> is a
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a>. <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or omitted means use the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-1.html">global environment</a>.
You can also obtain the current <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> using the macro
<a class="link" href="#the-env" title="Macro EXT:THE-ENVIRONMENT"><code class="function">EXT:THE-ENVIRONMENT</code></a> (interpreted code only).
This function will always return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for global special
variables and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a>s.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="constant-notinline"></a>3.3.3. Declaration <a class="link" href="#constant-notinline" title="3.3.3. Declaration EXT:CONSTANT-NOTINLINE"><code class="literal">EXT:CONSTANT-NOTINLINE</code></a></h3></div></div></div><p>Constants defined by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> but proclaimed <a class="link" href="#constant-notinline" title="3.3.3. Declaration EXT:CONSTANT-NOTINLINE"><code class="literal">EXT:CONSTANT-NOTINLINE</code></a>
will not be inlined by the compiler. This is useful for variables
which remain constant within an a single Lisp process but may vary
between processes and machines (such as endianness or word size) thus
they should be written to <code class="filename">#P".fas"</code>s as symbols, not values.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="constantp"></a>3.3.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a></h3></div></div></div><p>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a> fully complies with [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
Additionally, some non-trivial forms are identified as constants, e.g.,
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pl.html" target="_top"><code class="function">+</code></a> 1 2 3))</code> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Since <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> initial value forms are not
evaluated at compile time, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a> will not report <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> of their
name within the same <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compilation_unit">compilation unit</a> for the null <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.
This is consistent and matches questionable code using the pattern
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_if.html" target="_top"><code class="function">IF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_constantp.html" target="_top"><code class="function">CONSTANTP</code></a> <em class="replaceable"><code>form</code></em>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> <em class="replaceable"><code>form</code></em>))</code>.
Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> if you need recognition and the value during
compile-time. See also <a class="xref" href="#compile-time-value" title="31.11.5. Macro EXT:COMPILE-TIME-VALUE">Section 31.11.5, “Macro <code class="function">EXT:COMPILE-TIME-VALUE</code>”</a>.
</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="safety-decl"></a>3.3.5. Declaration <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SAFETY</code></a></h3></div></div></div><p>Declaration <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">OPTIMIZE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SAFETY</code></a> 3))</code>
results in <span class="quote">“<span class="quote">safe</span>”</span> compiled code: function calls are never
eliminated. This guarantees the semantics described in
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-5.html">[sec_3-5]</a>.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-decl"></a>3.3.6. Declaration <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a></h3></div></div></div><p>The declaration <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a> has the effect that the current
form is compiled prior to execution. Examples:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_locally.html" target="_top"><code class="function">LOCALLY</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sym_declare.html" target="_top"><code class="function">DECLARE</code></a> (compile)) <em class="replaceable"><code>form</code></em>)</pre><p>
executes the compiled version of <em class="replaceable"><code>form</code></em>.</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((x 0))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">FLET</code></a> ((inc () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sym_declare.html" target="_top"><code class="function">DECLARE</code></a> (compile)) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_incfcm_decf.html" target="_top"><code class="function">INCF</code></a> x))
(dec () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_incfcm_decf.html" target="_top"><code class="function">DECF</code></a> x)))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> #'inc #'dec)))</pre><p>
returns two functions. The first is compiled and increments <em class="replaceable"><code>x</code></em>, the
second is interpreted (slower) and decrements the same <em class="replaceable"><code>x</code></em>.</p><p>This declaration can also be used to name the resulting compiled closure:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (x) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sym_declare.html" target="_top"><code class="function">DECLARE</code></a> (compile ident)) x)
⇒ <code class="computeroutput"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html"><span class="data"><code class="literal">#<</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_compiled-function.html" target="_top"><code class="classname">COMPILED-FUNCTION</code></a> IDENT></code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcm_ststcm_ststst.html" target="_top"><code class="varname">*</code></a>)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">source is not preserved</span></em>
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
⇒ <code class="computeroutput">IDENT</code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_fboundp.html" target="_top"><code class="function">FBOUNDP</code></a> 'ident)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">sic!</span></em>
</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The declaration <a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a> is ignored by the following
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_s.html#special_operator">special operator</a>s:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">LABELS</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">FLET</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">MACROLET</code></a></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="space-decl"></a>3.3.7. Declaration <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPACE</code></a></h3></div></div></div><p>The declaration determines what metadata is recorded in the
function object:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPACE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">>=</code></a> 2</span></dt><dd>documentation string is discarded
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_optimize.html" target="_top"><code class="literal">SPACE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">>=</code></a> 3</span></dt><dd>the original <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is also discarded (most
information is still available, see <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a>, but the names of
the positional arguments are not).</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lalist"></a>3.4. Lambda Lists
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4.html">[sec_3-4]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#boa-lalist">3.4.1. Boa Lambda Lists sec_3-4-6</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="boa-lalist"></a>3.4.1. Boa Lambda Lists
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-6.html">[sec_3-4-6]</a></h3></div></div></div><p>The initial value of an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&AUX</code></a> variable in a boa <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is
the value of the corresponding slot's initial form.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="types-classes"></a>Chapter 4. Types and Classes
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-4.html">[chap-4]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#types">4.1. Types sec_4-2</a></span></dt><dd><dl><dt><span class="section"><a href="#type-spec">4.1.1. Type Specifiers sec_4-2-3</a></span></dt></dl></dd><dt><span class="section"><a href="#classes">4.2. Classes sec_4-3</a></span></dt><dt><span class="section"><a href="#clos-diff">4.3. Deviations from ANSI CL standard</a></span></dt><dt><span class="section"><a href="#metaclasses">4.4. Standard Metaclasses sec_4-3-1-1</a></span></dt><dt><span class="section"><a href="#def-class">4.5. Defining Classes sec_4-3-2</a></span></dt><dt><span class="section"><a href="#redef-class">4.6. Redefining Classes sec_4-3-6</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="types"></a>4.1. Types <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-2.html">[sec_4-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#type-spec">4.1.1. Type Specifiers sec_4-2-3</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="type-spec"></a>4.1.1. Type Specifiers
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-2-3.html">[sec_4-2-3]</a></h3></div></div></div><p>The general form of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> <em class="replaceable"><code>type-of-real-part</code></em>
<em class="replaceable"><code>type-of-imaginary-part</code></em>)</code></span>.
The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> <em class="replaceable"><code>type</code></em>)</code></span>
is equivalent to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> <em class="replaceable"><code>type</code></em>
<em class="replaceable"><code>type</code></em>)</code></span>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_deftype.html" target="_top"><code class="function">DEFTYPE</code></a> <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>s are subject to destructuring (nested <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>s
are allowed, as in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a>) and may contain a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&WHOLE</code></a> marker,
but not an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&ENVIRONMENT</code></a> marker.</p><p><strong>Function <code class="code">(<code class="function">EXT:TYPE-EXPAND</code>
<em class="replaceable"><code>type</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>once-p</code></em>)</code>. </strong>If <em class="replaceable"><code>type</code></em> is a user-defined <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> this will expand it
recursively until it is no longer a user-defined type
(unless <em class="replaceable"><code>once-p</code></em> is supplied and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).
Two values are returned - the expansion and an indicator (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
of whether the original <em class="replaceable"><code>type</code></em> was a user-defined <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a>.
</p><div class="itemizedlist"><p class="title"><strong>The possible results of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-of.html" target="_top"><code class="function">TYPE-OF</code></a></strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bit.html" target="_top"><code class="classname">BIT</code></a>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> 0
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-POSITIVE-FIXNUM</code></a>)</code></span>,
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-NEGATIVE-FIXNUM</code></a> (0))</code></span>,
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
(<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-POSITIVE-FIXNUM</code></a>))</code></span>,
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> *
(<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-NEGATIVE-FIXNUM</code></a>))</code></span></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-char.html" target="_top"><code class="classname">BASE-CHAR</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_standard-char.html" target="_top"><code class="classname">STANDARD-CHAR</code></a></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> <em class="replaceable"><code>element-type</code></em>
<em class="replaceable"><code>dimensions</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-array.html" target="_top"><code class="classname">SIMPLE-ARRAY</code></a>
<em class="replaceable"><code>element-type</code></em> <em class="replaceable"><code>dimensions</code></em>)</code></span></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>
<em class="replaceable"><code>size</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>
<em class="replaceable"><code>size</code></em>)</code></span></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
<em class="replaceable"><code>size</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>
<em class="replaceable"><code>size</code></em>)</code></span></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-string.html" target="_top"><code class="classname">BASE-STRING</code></a>
<em class="replaceable"><code>size</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-base-string.html" target="_top"><code class="classname">SIMPLE-BASE-STRING</code></a>
<em class="replaceable"><code>size</code></em>)</code></span></li><li class="listitem"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_bit-vector.html" target="_top"><code class="classname">BIT-VECTOR</code></a>
<em class="replaceable"><code>size</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-bit-vector.html" target="_top"><code class="classname">SIMPLE-BIT-VECTOR</code></a>
<em class="replaceable"><code>size</code></em>)</code></span></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_compiled-function.html" target="_top"><code class="classname">COMPILED-FUNCTION</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_concatenated-stream.html" target="_top"><code class="classname">CONCATENATED-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_two-way-stream.html" target="_top"><code class="classname">TWO-WAY-STREAM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_echo-stream.html" target="_top"><code class="classname">ECHO-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_readtable.html" target="_top"><code class="classname">READTABLE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_random-state.html" target="_top"><code class="classname">RANDOM-STATE</code></a>, <a class="link" href="#byte-type" title="12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2"><span class="type">BYTE</span></a></li><li class="listitem"><code class="classname">SPECIAL-OPERATOR</code>,
<code class="classname">LOAD-TIME-EVAL</code>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>,
<code class="classname">GLOBAL-SYMBOL-MACRO</code>, <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>,
<a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>, <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>, <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>,
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a></li><li class="listitem"><a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>, <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a>, <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a>,
<a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a>, <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a>, <a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a>,
<a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a>, <a class="link" href="#weak-alist" title="31.7.8. Weak Association Lists"><code class="classname">EXT:WEAK-ALIST</code></a>,
<a class="link" href="#reader" title="Chapter 23. Reader chap-23"><code class="classname">READ-LABEL</code></a>,
<a class="link" href="#reader" title="Chapter 23. Reader chap-23"><code class="classname">FRAME-POINTER</code></a>,
<code class="classname">SYSTEM-INTERNAL</code></li><li class="listitem"><code class="classname">ADDRESS</code> (should not
occur)</li><li class="listitem">any other <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> (structure types or <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
classes)</li><li class="listitem">a class object (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> classes without a
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a>)</li></ul></div><p><a id="fixnum-char-ansi"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a> is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#character_designator">character
designator</a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], although <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> provides an
obvious venue to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a> a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.
When <a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s via <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a>.
When <a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s cannot be
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>d to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="classes"></a>4.2. Classes
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3.html">[sec_4-3]</a></h2></div></div></div><p>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> symbols are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>ed from the package <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a>.
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> uses (as in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a>) <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a> and <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>s the
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] standard exported symbols (the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extensions, e.g.,
those described in <a class="xref" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Chapter 29, <em>Meta-Object Protocol</em></a>, are <span class="strong"><strong>not</strong></span> <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>ed).
Since <a class="link" href="#make-pack" title="11.1.1. Function MAKE-PACKAGE">the default <code class="constant">:USE</code> argument</a>
to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a> is <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>, the standard <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> symbols are normally
visible in all user-defined packages.
If you do not want them (for example, if you want to use the
<a class="ulink" href="https://ftp.gnu.org/pub/gnu/clisp/packages/pcl.sept92f.clisp.tar.gz" target="_top">PCL</a>
implementation of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> instead of the native one), do the following:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "CL-NO-CLOS" (:use "CL"))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-EXTERNAL-SYMBOLS</code></a> (<em class="replaceable"><code>symbol</code></em> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_shadow.html" target="_top"><code class="function">SHADOW</code></a> <em class="replaceable"><code>symbol</code></em> "CL-NO-CLOS"))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-SYMBOLS</code></a> (<em class="replaceable"><code>symbol</code></em> "CL-NO-CLOS")
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a> <em class="replaceable"><code>symbol</code></em> "CL-NO-CLOS"))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "CL-NO-CLOS")
(<a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> "pcl")<strong> ; </strong><em class="lineannotation"><span class="lineannotation">or whatever</span></em>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "MY-USER" (:use "CL-NO-CLOS"))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "MY-USER")
;; your code which uses PCL goes here
</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clos-diff"></a>4.3. Deviations from [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]</h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> supports the option <code class="constant">:METACLASS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a>.
This option is necessary in order to define a subclass of a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a>-defined structure type using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> instead of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a>.</p><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is called with arguments, the rule that
the ordered set of applicable methods must be the same as for the
original arguments is enforced by the implementation only in
interpreted code.</p><p><strong class="first"><em class="firstterm"><a class="link" href="#gen-flet"><code class="function">CLOS:GENERIC-FLET</code></a><a id="gen-flet" class="indexterm"></a></em></strong> and
<strong class="first"><em class="firstterm"><a class="link" href="#gen-labels"><code class="function">CLOS:GENERIC-LABELS</code></a><a id="gen-labels" class="indexterm"></a></em></strong>
are implemented as macros, not as special operators (as permitted by
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2-2.html">[sec_3-1-2-1-2-2]</a>).
They are not imported into the packages <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> because
of the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss181.html" target="_top">GENERIC-FLET-POORLY-DESIGNED:DELETE</a>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a> is only called on objects of type
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>.
It is not called on other objects, like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>s, due to the performance concerns.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="metaclasses"></a>4.4. Standard Metaclasses
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-1-1.html">[sec_4-3-1-1]</a></h2></div></div></div><p>Among those classes listed in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-7.html#classtypecorrespondence" target="_top">Figure
4-8</a>, only the following are instances of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_ratio.html" target="_top"><code class="classname">RATIO</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_bit-vector.html" target="_top"><code class="classname">BIT-VECTOR</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_random-state.html" target="_top"><code class="classname">RANDOM-STATE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_readtable.html" target="_top"><code class="classname">READTABLE</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_concatenated-stream.html" target="_top"><code class="classname">CONCATENATED-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_echo-stream.html" target="_top"><code class="classname">ECHO-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_two-way-stream.html" target="_top"><code class="classname">TWO-WAY-STREAM</code></a>
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="def-class"></a>4.5. Defining Classes
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-2.html">[sec_4-3-2]</a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> supports the <code class="constant">:METACLASS</code> option. Possible values are
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> (the default), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> (which creates
structure classes, like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> does), and user-defined
meta-classes (see <a class="xref" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS">Section 29.3.6.7, “Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code>”</a>).</p><p>It is <span class="strong"><strong>not</strong></span> required that the superclasses of a class are
defined before the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form for the class is evaluated.
Use <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> generic functions <a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a> to check whether the
class has been finalized and thus its instances can be created,
and <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> to force class finalization.</p><p>See also <a class="xref" href="#mop-cl-defclass" title="29.3.1. Macro DEFCLASS">Section 29.3.1, “Macro <code class="function">DEFCLASS</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="redef-class"></a>4.6. Redefining Classes
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-6.html">[sec_4-3-6]</a></h2></div></div></div><p>Trivial changes, e.g., those that can occur when doubly loading
the same code, do not require updating the instances.
These are the changes that do not modify the set of local slots
accessible in instances, e.g., changes to slot options <code class="constant">:INITFORM</code>,
<code class="constant">:DOCUMENTATION</code>, and changes to class options
<code class="constant">:DEFAULT-INITARGS</code>, <code class="constant">:DOCUMENTATION</code>.</p><p>The instances are updated when they are first accessed, <span class="strong"><strong>not</strong></span> at
the time when the class is redefined or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_mak_ces-obsolete.html" target="_top"><code class="function">MAKE-INSTANCES-OBSOLETE</code></a> is
called. When the class has been redefined several times since the
instance was last accessed, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> is
still called just once.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="data"></a>Chapter 5. Data and Control Flow
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-5.html">[chap-5]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#gen-ref">5.1. Generalized Reference sec_5-1</a></span></dt><dt><span class="section"><a href="#setf-expansion">5.2. Setf Expansions sec_5-1-1-2</a></span></dt><dt><span class="section"><a href="#extra-places">5.3. Kinds of Places sec_5-1-2</a></span></dt><dt><span class="section"><a href="#misc-data">5.4. Miscellaneous</a></span></dt><dt><span class="section"><a href="#defconstant">5.5. Macro <code class="function">DEFCONSTANT</code></a></span></dt><dd><dl><dt><span class="section"><a href="#defconstant-similar">5.5.1. Variable <code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></span></dt></dl></dd><dt><span class="section"><a href="#fcase">5.6. Macro <code class="function">EXT:FCASE</code></a></span></dt><dt><span class="section"><a href="#xor">5.7. Function <code class="function">EXT:XOR</code></a></span></dt><dt><span class="section"><a href="#eq">5.8. Function <code class="function">EQ</code></a></span></dt><dt><span class="section"><a href="#func">5.9. Special Operator <code class="function">FUNCTION</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gen-ref"></a>5.1. Generalized Reference
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_5-1.html">[sec_5-1]</a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> markers in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defsetf.html" target="_top"><code class="function">DEFSETF</code></a> <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>s are supported, but the
corresponding keywords must appear literally in the program text.</p><p>An attempt to modify read-only data <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
Program text and quoted constants loaded from files are considered
read-only data. This check is only performed for strings, not for
conses, other kinds of arrays, and user-defined data types.</p><p>See also <a class="xref" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*">Section 31.11.2, “Macros <code class="function">EXT:LETF</code> & <code class="function">EXT:LETF*</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="setf-expansion"></a>5.2. Setf Expansions
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_5-1-1-2.html">[sec_5-1-1-2]</a></h2></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-setf-expansion.html" target="_top"><code class="function">GET-SETF-EXPANSION</code></a> <em class="replaceable"><code>form</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code>,
<code class="code">(EXT:GET-SETF-METHOD <em class="replaceable"><code>form</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code>, and
<code class="code">(EXT:GET-SETF-METHOD-MULTIPLE-VALUE <em class="replaceable"><code>form</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code> receive as optional argument <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em> the environment
necessary for macro expansions. In <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-setf-expander.html" target="_top"><code class="function">DEFINE-SETF-EXPANDER</code></a>
and <code class="function">EXT:DEFINE-SETF-METHOD</code> <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>s, one can
specify <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&ENVIRONMENT</code></a> and a variable, which will be bound to the
environment. This environment should be passed to all calls of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-setf-expansion.html" target="_top"><code class="function">GET-SETF-EXPANSION</code></a>, <code class="function">EXT:GET-SETF-METHOD</code> and
<code class="function">EXT:GET-SETF-METHOD-MULTIPLE-VALUE</code>. If this is
done, even local macros will be interpreted as places correctly.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="extra-places"></a>5.3. Kinds of Places
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_5-1-2.html">[sec_5-1-2]</a></h2></div></div></div><p>Additional <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> #'<em class="replaceable"><code>symbol</code></em> ...)
<em class="replaceable"><code>object</code></em>)</code> and
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> '<em class="replaceable"><code>symbol</code></em> ...) <em class="replaceable"><code>object</code></em>)</code>
are equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<em class="replaceable"><code>symbol</code></em> ...) <em class="replaceable"><code>object</code></em>)</code>.
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_progn.html" target="_top"><code class="function">PROGN</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_progn.html" target="_top"><code class="function">PROGN</code></a> <em class="replaceable"><code>form</code></em> ... <em class="replaceable"><code>place</code></em>)
<em class="replaceable"><code>object</code></em>)</code></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_locally.html" target="_top"><code class="function">LOCALLY</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_locally.html" target="_top"><code class="function">LOCALLY</code></a> <em class="replaceable"><code>declaration</code></em> ...
<em class="replaceable"><code>form</code></em> ... <em class="replaceable"><code>place</code></em>) <em class="replaceable"><code>object</code></em>)</code>
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_if.html" target="_top"><code class="function">IF</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_if.html" target="_top"><code class="function">IF</code></a> <em class="replaceable"><code>condition</code></em>
<em class="replaceable"><code>place<sub>1</sub></code></em>
<em class="replaceable"><code>place<sub>2</sub></code></em>)
<em class="replaceable"><code>object</code></em>)</code></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_set-dispa_ro-character.html" target="_top"><code class="function">GET-DISPATCH-MACRO-CHARACTER</code></a></span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_set-dispa_ro-character.html" target="_top"><code class="function">GET-DISPATCH-MACRO-CHARACTER</code></a> ...)
...)</code> calls <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_set-dispa_ro-character.html" target="_top"><code class="function">SET-DISPATCH-MACRO-CHARACTER</code></a>.
</dd><dt><span class="term"><a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>:</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>) <em class="replaceable"><code>digits</code></em>)</code> sets the
default mantissa length of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s to <em class="replaceable"><code>digits</code></em> bits.
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_values-list.html" target="_top"><code class="function">VALUES-LIST</code></a></span></dt><dd><p class="simpara"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_values-list.html" target="_top"><code class="function">VALUES-LIST</code></a> <em class="replaceable"><code>list</code></em>) <em class="replaceable"><code>form</code></em>)</code>
is equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_values-list.html" target="_top"><code class="function">VALUES-LIST</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <em class="replaceable"><code>list</code></em>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-list.html" target="_top"><code class="function">MULTIPLE-VALUE-LIST</code></a> <em class="replaceable"><code>form</code></em>)))</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Note that this <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> is restricted: it can only be
used in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>, <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*"><code class="function">EXT:LETF</code></a>, <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*"><code class="function">EXT:LETF*</code></a>, not in other positions.
</p></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="misc-data"></a>5.4. Miscellaneous</h2></div></div></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="fle"></a>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a></h3></div></div></div><p>The <em class="replaceable"><code>name</code></em> of a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> is a <span class="emphasis"><em>string</em></span>
(the name of the underlying <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function), not a lisp <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a>.
</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="des-bind"></a>Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_destructuring-bind.html" target="_top"><code class="function">DESTRUCTURING-BIND</code></a></h3></div></div></div><p>This macro does not perform full error checking.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="macro-special"></a>Macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_prog1cm_prog2.html" target="_top"><code class="function">PROG1</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_prog1cm_prog2.html" target="_top"><code class="function">PROG2</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_and.html" target="_top"><code class="function">AND</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_psetq.html" target="_top"><code class="function">PSETQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">WHEN</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">UNLESS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_cond.html" target="_top"><code class="function">COND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_casecm_ccasecm_ecase.html" target="_top"><code class="function">CASE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-list.html" target="_top"><code class="function">MULTIPLE-VALUE-LIST</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-setq.html" target="_top"><code class="function">MULTIPLE-VALUE-SETQ</code></a></h3></div></div></div><p>These macros are implemented as special operators
(as permitted by <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-2-2.html">[sec_3-1-2-1-2-2]</a>)
and, as such, are rather efficient.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="defconstant"></a>5.5. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#defconstant-similar">5.5.1. Variable <code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></span></dt></dl></div><p>The initial value is <span class="strong"><strong>not</strong></span> evaluated at compile time,
just like with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFPARAMETER</code></a>.
Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> if you need the value at compile time.</p><p><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a>s may not be bound dynamically or lexically.</p><p>See also <a class="xref" href="#constant-notinline" title="3.3.3. Declaration EXT:CONSTANT-NOTINLINE">Section 3.3.3, “Declaration <code class="literal">EXT:CONSTANT-NOTINLINE</code>”</a>.</p><p>If you need to undo the effects of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> form,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> (to turn the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a> into a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a>),
and then <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_proclaim.html" target="_top"><code class="function">PROCLAIM</code></a> it <a class="link" href="#notspec-decl" title="Declaration EXT:NOTSPECIAL"><code class="literal">EXT:NOTSPECIAL</code></a> (to turn the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a> into a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-1.html">lexical variable</a>).
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you follow the usual variable naming convention
(<code class="varname">*FOO*</code> for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFPARAMETER</code></a>,
<code class="constant">+BAR+</code> for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a>, <code class="varname">ZOT</code>
for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a>), you will save yourself a lot of trouble.
See also <a class="xref" href="#faq-scope" title="A.4.14.">Q: A.4.14</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defconstant-similar"></a>5.5.1. Variable <a class="link" href="#defconstant-similar" title="5.5.1. Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*"><code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></h3></div></div></div><p>If the variable being defined by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> is already bound to
a value which is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> to the new value, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> is issued.
If, however, the new value is <strong class="first"><em class="firstterm">visually similar
<a id="visually-similar" class="indexterm"></a></em></strong>
(prints to the same string, as is commonly the case when re-loading files)
to the old one, the warning can be suppressed by setting
<a class="link" href="#defconstant-similar" title="5.5.1. Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*"><code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a> to a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> value.</p><p>The initial value of <a class="link" href="#defconstant-similar" title="5.5.1. Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*"><code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fcase"></a>5.6. Macro <a class="link" href="#fcase" title="5.6. Macro EXT:FCASE"><code class="function">EXT:FCASE</code></a></h2></div></div></div><p>This macro allows specifying the test for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_casecm_ccasecm_ecase.html" target="_top"><code class="function">CASE</code></a>, e.g.,
</p><pre class="programlisting">
(fcase string= (subseq foo 0 (position #\Space foo))
("first" 1)
(("second" "two") 2)
(("true" "yes") t)
(otherwise nil))
</pre><p>
is the same as
</p><pre class="programlisting">
(let ((var (subseq foo 0 (position #\Space foo))))
(cond ((string= var "first") 1)
((or (string= var "second") (string= var "two")) 2)
((or (string= var "true") (string= var "yes")) t)
(t nil)))
</pre><p>
If you use a built-in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> test (see <a class="xref" href="#ht-test" title="18.4. Function HASH-TABLE-TEST">Section 18.4, “Function <code class="function">HASH-TABLE-TEST</code>”</a>)
as the test (e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> above, but not a test
defined using <a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a>), the compiler will be able to optimize the
<a class="link" href="#fcase" title="5.6. Macro EXT:FCASE"><code class="function">EXT:FCASE</code></a> form better than the corresponding <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_cond.html" target="_top"><code class="function">COND</code></a> form.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="xor"></a>5.7. Function <code class="function">EXT:XOR</code></h2></div></div></div><p>This function checks that exactly one of its arguments is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
and, if this is the case, returns its value and index in the argument
list as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>, otherwise returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="eq"></a>5.8. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> compares <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> does.
No unnecessary copies are made of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>s.
Nevertheless, one should use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> as it is more portable across <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>
implementations.</p><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<em class="replaceable"><code>x</code></em> <em class="replaceable"><code>y</code></em>)) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>x</code></em>))</code> always
returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for any Lisp object <em class="replaceable"><code>y</code></em>.
See also <a class="xref" href="#dffi-eq" title="Equality of foreign values">Equality of foreign values</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="func"></a>5.9. Special Operator <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a></h2></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a> <em class="replaceable"><code>symbol</code></em>)</code> returns the local function
definition established by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">FLET</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">LABELS</code></a>, if it exists, otherwise
the global function definition.</p><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_special-operator-p.html" target="_top"><code class="function">SPECIAL-OPERATOR-P</code></a> <em class="replaceable"><code>symbol</code></em>)</code> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>. If it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, then <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a>
<em class="replaceable"><code>symbol</code></em>)</code> returns the (useless) special operator handler.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="iteration"></a>Chapter 6. Iteration
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-6.html">[chap-6]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#loop">6.1. The LOOP Facility sec_6-1</a></span></dt><dd><dl><dt><span class="section"><a href="#loop-termination">6.1.1. Mixing Termination Test Clauses sec_6-1-4</a></span></dt><dt><span class="section"><a href="#loop-inter-var-finally">6.1.2. Iteration variables in the loop epilogue</a></span></dt><dt><span class="section"><a href="#loop-ansi">6.1.3. Backward Compatibility</a></span></dt></dl></dd><dt><span class="section"><a href="#iter-misc">6.2. Miscellaneous</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="loop"></a>6.1. The LOOP Facility
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1.html">[sec_6-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#loop-termination">6.1.1. Mixing Termination Test Clauses sec_6-1-4</a></span></dt><dt><span class="section"><a href="#loop-inter-var-finally">6.1.2. Iteration variables in the loop epilogue</a></span></dt><dt><span class="section"><a href="#loop-ansi">6.1.3. Backward Compatibility</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="loop-termination"></a>6.1.1. Mixing Termination Test Clauses
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1-4.html">[sec_6-1-4]</a></h3></div></div></div><p>Mixing termination test clauses with different default return
values is not allowed because it is not specifed whether
</p><pre class="programlisting">
(loop repeat 1 thereis nil never nil)
</pre><p> should return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> (the default return value
from <code class="literal">NEVER</code>) of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (the default return value from
<code class="literal">THEREIS</code>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="loop-inter-var-finally"></a>6.1.2. Iteration variables in the loop epilogue</h3></div></div></div><p>The standard is unambiguous in that the iteration variables do
still exist in the
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1-7-2.html"><code class="literal">FINALLY</code></a>
clause, but <span class="strong"><strong>not</strong></span> as to what values these variables might have.
Therefore the code which relies on the values of such variables, e.g.,
</p><pre class="programlisting">(loop for x on y finally (return x))</pre><p>
is inherently non-portable across <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations,
and should be avoided.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="loop-ansi"></a>6.1.3. Backward Compatibility</h3></div></div></div><p>There have been some tightening in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> syntax between
<a class="xref" href="#CLtL2" title="Common Lisp: the Language (2nd Edition)">[<abbr class="abbrev">CLtL2</abbr>]</a> and [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], e.g., the following form is legal in the
former but not the latter:</p><pre class="programlisting">
(loop initially for i from 1 to 5 do (print i) finally return i)
</pre><p>
When <strong class="first"><em class="firstterm"><a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a></em></strong> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, such forms are still
accepted in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> but elicit a warning at macro-expansion time.
When <a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="iter-misc"></a>6.2. Miscellaneous</h2></div></div></div><p>The macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_dolist.html" target="_top"><code class="function">DOLIST</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_dotimes.html" target="_top"><code class="function">DOTIMES</code></a> establish a single binding for
the iteration variable and assign it on each iteration.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="objects"></a>Chapter 7. Objects <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html">[chap-7]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#std-meth-combo">7.1. Standard Method Combination sec_7-6-6-2</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="std-meth-combo"></a>7.1. Standard Method Combination
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-6-6-2.html">[sec_7-6-6-2]</a></h2></div></div></div><p>Generic function
<strong class="first"><em class="firstterm"><a class="link" href="#no-prim"><code class="function">CLOS:NO-PRIMARY-METHOD</code></a><a id="no-prim" class="indexterm"></a></em></strong>
(similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-_cable-method.html" target="_top"><code class="function">NO-APPLICABLE-METHOD</code></a>) is called when there is an
applicable method but no applicable <span class="emphasis"><em>primary</em></span>
method.</p><p>The default methods for <a class="link" href="#no-prim"><code class="function">CLOS:NO-PRIMARY-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-_cable-method.html" target="_top"><code class="function">NO-APPLICABLE-METHOD</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-next-method.html" target="_top"><code class="function">NO-NEXT-METHOD</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> of type
<strong class="first"><em class="firstterm"><a class="link" href="#meth-call-err"><code class="classname">CLOS:METHOD-CALL-ERROR</code></a>
<a id="meth-call-err" class="indexterm"></a></em></strong>.
You can find out more information about the error using functions
<code class="function">CLOS:METHOD-CALL-ERROR-GENERIC-FUNCTION</code>,
<code class="function">CLOS:METHOD-CALL-ERROR-ARGUMENT-LIST</code>, and
(only for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_no-next-method.html" target="_top"><code class="function">NO-NEXT-METHOD</code></a>)
<code class="function">CLOS:METHOD-CALL-ERROR-METHOD</code>.
Moreover, when the generic function has only one <span class="emphasis"><em>dispatching
argument</em></span>, (i.e., such an argument that not all the
corresponding parameter specializers are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>), an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> of type
<strong class="first"><em class="firstterm"><a class="link" href="#meth-call-type-err"><code class="classname">CLOS:METHOD-CALL-TYPE-ERROR</code></a>
<a id="meth-call-type-err" class="indexterm"></a></em></strong>
is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed, additionally making <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-DATUM</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-EXPECTED-TYPE</code></a> available.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="structures"></a>Chapter 8. Structures
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-8.html">[chap-8]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#defstruct-options">8.1. The options for <code class="function">DEFSTRUCT</code></a></span></dt><dd><dl><dt><span class="section"><a href="#defstruct-print-function">8.1.1. The <code class="constant">:PRINT-FUNCTION</code> option</a></span></dt><dt><span class="section"><a href="#defstruct-inherit">8.1.2. The <code class="constant">:INHERIT</code> option</a></span></dt></dl></dd><dt><span class="section"><a href="#defstruct-mop">8.2. The structure Meta-Object Protocol</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="defstruct-options"></a>8.1. The options for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#defstruct-print-function">8.1.1. The <code class="constant">:PRINT-FUNCTION</code> option</a></span></dt><dt><span class="section"><a href="#defstruct-inherit">8.1.2. The <code class="constant">:INHERIT</code> option</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defstruct-print-function"></a>8.1.1. The <code class="constant">:PRINT-FUNCTION</code> option</h3></div></div></div><p>The <code class="constant">:PRINT-FUNCTION</code> option should contain a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (object stream depth) (declare (ignore depth)) ...)</code>
This <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> names a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> whose task is to output the
external representation of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> <em class="replaceable"><code>object</code></em> onto the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> <em class="replaceable"><code>stream</code></em>. This may be done by outputting text onto the
stream using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-char.html" target="_top"><code class="function">WRITE-CHAR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-str_m_write-line.html" target="_top"><code class="function">WRITE-STRING</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRIN1</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINC</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PPRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> and the like.
The following rules must be obeyed:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-escapest.html" target="_top"><code class="varname">*PRINT-ESCAPE*</code></a> must be
respected.</li><li class="listitem">The treatment of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-prettyst.html" target="_top"><code class="varname">*PRINT-PRETTY*</code></a> is up to you.
</li><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> need not be
respected. This is managed by the system. (But the print-circle
mechanism handles only those objects that are direct or indirect
components of the structure.)</li><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LEVEL*</code></a> is respected by
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRIN1</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINC</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PPRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instructions
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-1.html"><code class="literal">~A</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-2.html"><code class="literal">~S</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-3.html"><code class="literal">~W</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instructions
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-1.html"><code class="literal">~R</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-2.html"><code class="literal">~D</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-3.html"><code class="literal">~B</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-4.html"><code class="literal">~O</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-5.html"><code class="literal">~X</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-1.html"><code class="literal">~F</code></a>,
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-3.html"><code class="literal">~G</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-4.html"><code class="literal">~$</code></a> with not-numerical arguments.
Therefore the print-level mechanism works automatically if only these
functions are used for outputting objects and if they are not called
on objects with nesting level > 1. (The print-level mechanism does
not recognize how many parentheses you have output. It only counts how
many times it was called recursively.)</li><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LENGTH*</code></a> must be respected,
especially if you are outputting an arbitrary number of components.
</li><li class="listitem">The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> must be
respected. Remember that the values of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-escapest.html" target="_top"><code class="varname">*PRINT-ESCAPE*</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LEVEL*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LENGTH*</code></a> are ignored if
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true. The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is
respected by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_print-unr_dable-object.html" target="_top"><code class="function">PRINT-UNREADABLE-OBJECT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRIN1</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINC</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PPRINT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instructions <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-1.html"><code class="literal">~A</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-2.html"><code class="literal">~S</code></a>,
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-3.html"><code class="literal">~W</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instructions <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-1.html"><code class="literal">~R</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-2.html"><code class="literal">~D</code></a>,
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-3.html"><code class="literal">~B</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-4.html"><code class="literal">~O</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-5.html"><code class="literal">~X</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-1.html"><code class="literal">~F</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a>,
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-3.html"><code class="literal">~G</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-4.html"><code class="literal">~$</code></a> with not-numerical arguments. Therefore
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> will be respected automatically if only these
functions are used for printing objects.</li><li class="listitem">You need not worry about the values of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-b_rint-radixst.html" target="_top"><code class="varname">*PRINT-BASE*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-b_rint-radixst.html" target="_top"><code class="varname">*PRINT-RADIX*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-casest.html" target="_top"><code class="varname">*PRINT-CASE*</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-gensymst.html" target="_top"><code class="varname">*PRINT-GENSYM*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-arrayst.html" target="_top"><code class="varname">*PRINT-ARRAY*</code></a>, <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a>,
<a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a>, <a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a>.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defstruct-inherit"></a>8.1.2. The <code class="constant">:INHERIT</code> option</h3></div></div></div><p>The <code class="constant">:INHERIT</code> option is exactly like <code class="constant">:INCLUDE</code> except that it
does not create new accessors for the inherited slots (this is a
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension).</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="defstruct-mop"></a>8.2. The structure <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a></h2></div></div></div><p>The following functions accept a structure <em class="replaceable"><code>name</code></em> as the only argument.
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> was given the <code class="constant">:TYPE</code> option (i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> did
<span class="strong"><strong>not</strong></span> define a new type), then <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> <em class="replaceable"><code>name</code></em>)</code>
fails (and the regular <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> is not applicable), but these
functions still work.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">EXT:STRUCTURE-SLOTS</code></span></dt><dd>Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.
</dd><dt><span class="term"><code class="function">EXT:STRUCTURE-DIRECT-SLOTS</code></span></dt><dd>Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.
</dd><dt><span class="term"><code class="function">EXT:STRUCTURE-KEYWORD-CONSTRUCTOR</code></span></dt><dd>Return the name (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>) of the keyword
constructor function for the structure, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the structure has
no keyword constructor.</dd><dt><span class="term"><code class="function">EXT:STRUCTURE-BOA-CONSTRUCTORS</code></span></dt><dd>Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of names (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s)
of BOA constructors for the structure.</dd><dt><span class="term"><code class="function">EXT:STRUCTURE-COPIER</code></span></dt><dd>Return the name (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>) of the copier for the
structure.</dd><dt><span class="term"><code class="function">EXT:STRUCTURE-PREDICATE</code></span></dt><dd>Return the name (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>) of the predicate for
the structure.</dd></dl></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="conditions"></a>Chapter 9. Conditions
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-9.html">[chap-9]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#cond-nl">9.1. Embedded Newlines in Condition Reports sec_9-1-3-1-3</a></span></dt><dt><span class="section"><a href="#cond-fname">9.2. Mentioning Containing Function in Condition Reports sec_9-1-3-1-5</a></span></dt><dt><span class="section"><a href="#restarts">9.3. Interfaces to Restarts sec_9-1-4-2-2</a></span></dt><dt><span class="section"><a href="#assertions">9.4. Assertions sec_9-1-5</a></span></dt></dl></div><p>When an error occurred, you are in a break loop. You can evaluate
forms as usual. The <a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a> command (or help key if there is one) lists
the available <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> commands.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cond-nl"></a>9.1. Embedded Newlines in Condition Reports
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_9-1-3-1-3.html">[sec_9-1-3-1-3]</a></h2></div></div></div><p>The error message prefix for the first line is <span class="quote">“<span class="quote">*** - </span>”</span>.
All subsequent lines are indented by 6 characters.
Long lines are broken on <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-1-4-7.html">whitespace</a>
(see <a class="xref" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM">Section 30.8, “Class <code class="classname">EXT:FILL-STREAM</code>”</a>).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cond-fname"></a>9.2. Mentioning Containing Function in
Condition Reports <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_9-1-3-1-5.html">[sec_9-1-3-1-5]</a></h2></div></div></div><p>Contrary to the recommendation of the standard, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> usually
does print the name of the containing function to simplify debugging
in batch mode, see <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="restarts"></a>9.3. Interfaces to Restarts
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_9-1-4-2-2.html">[sec_9-1-4-2-2]</a></h2></div></div></div><p><a id="restart-case"></a><strong>Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>. </strong>In <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> <em class="replaceable"><code>form</code></em> {<em class="replaceable"><code>restart-clause</code></em>}*)</code>,
the argument list can also be specified after the keyword/value pairs
instead of before them, i.e., each <em class="replaceable"><code>restart-clause</code></em> can be either
<code class="code">(<code class="varname">restart-name</code> <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>
{<em class="replaceable"><code>keyword-value-pair</code></em>}* {<em class="replaceable"><code>form</code></em>}*)</code>
or <code class="code">(<em class="replaceable"><code>restart-name</code></em>
{<em class="replaceable"><code>keyword-value-pair</code></em>}* <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>.
</p><p><a id="with-restarts"></a><strong>Macro <a class="link" href="#with-restarts" title="Macro EXT:WITH-RESTARTS"><code class="function">EXT:WITH-RESTARTS</code></a>. </strong>The macro <a class="link" href="#with-restarts" title="Macro EXT:WITH-RESTARTS"><code class="function">EXT:WITH-RESTARTS</code></a> is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>, except that the
forms are specified after the restart clauses instead of before them,
and the restarts created are not implicitly associated with any <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a>.
<code class="code">(<a class="link" href="#with-restarts" title="Macro EXT:WITH-RESTARTS"><code class="function">EXT:WITH-RESTARTS</code></a> ({<em class="replaceable"><code>restart-clause</code></em>}*) {<em class="replaceable"><code>form</code></em>}*)</code> is
therefore equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_progn.html" target="_top"><code class="function">PROGN</code></a> {<em class="replaceable"><code>form</code></em>}*)
{<em class="replaceable"><code>restart-clause</code></em>}*)</code>.</p><p><a id="compute-restarts"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compute-restarts.html" target="_top"><code class="function">COMPUTE-RESTARTS</code></a>. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compute-restarts.html" target="_top"><code class="function">COMPUTE-RESTARTS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_find-restart.html" target="_top"><code class="function">FIND-RESTART</code></a> behave as specified in
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]: If the optional <em class="replaceable"><code>condition</code></em> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s associated with that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a>
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s associated with no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> at all are considered.
Therefore the effect of associating a restart to a condition is not to
activate it, but to hide it from other conditions.
This makes the syntax-dependent implicit association performed by
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> nearly obsolete.</p><p><a id="muffle-cerrors"></a><strong>Macro <a class="link" href="#muffle-cerrors" title="Macro EXT:MUFFLE-CERRORS"><code class="function">EXT:MUFFLE-CERRORS</code></a>. </strong>The macro <code class="code">(<a class="link" href="#muffle-cerrors" title="Macro EXT:MUFFLE-CERRORS"><code class="function">EXT:MUFFLE-CERRORS</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>
executes the <em class="replaceable"><code>form</code></em>s; when a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> occurs whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>
can be invoked non-interactively (this includes all <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s signaled
by the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cerror.html" target="_top"><code class="function">CERROR</code></a>), no message is printed, instead, the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a> is invoked.</p><p><a id="appease-cerrors"></a><strong>Macro <a href="impnotes.html#appease-cerrors" class="olink"><code class="function">EXT:APPEASE-CERRORS</code></a>. </strong>The macro <code class="code">(<a href="impnotes.html#appease-cerrors" class="olink"><code class="function">EXT:APPEASE-CERRORS</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>
executes the <em class="replaceable"><code>form</code></em>s; when a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> occurs whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>
can be invoked non-interactively (this includes all <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
by the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cerror.html" target="_top"><code class="function">CERROR</code></a>), it is reported as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>, and the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">CONTINUE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a> is invoked.</p><p><a id="abort-on-error"></a><strong>Macro <a href="impnotes.html#abort-on-error" class="olink"><code class="function">EXT:ABORT-ON-ERROR</code></a>. </strong>The macro <code class="code">(<a href="impnotes.html#abort-on-error" class="olink"><code class="function">EXT:ABORT-ON-ERROR</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>
executes the <em class="replaceable"><code>form</code></em>s; when an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> occurs, or when a <span class="keycap"><strong>Control</strong></span>+<span class="keysym">C</span>
interrupt occurs, the error message is printed and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/res_abort.html" target="_top"><code class="function">ABORT</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a> is invoked.</p><p><a id="exit-on-error"></a><strong>Macro <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a>. </strong>The macro <code class="code">(<a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a> {<em class="replaceable"><code>form</code></em>}*)</code>
executes the <em class="replaceable"><code>form</code></em>s; when an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> occurs, or when a <span class="keycap"><strong>Control</strong></span>+<span class="keysym">C</span>
interrupt occurs, the error message is printed and <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> terminates
with an error status.</p><p><a id="err-pr-bt"></a><strong>Variable <a href="impnotes.html#err-pr-bt" class="olink"><code class="varname">CUSTOM:*REPORT-ERROR-PRINT-BACKTRACE*</code></a>. </strong>When this variable is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> the error message printed by
<a href="impnotes.html#abort-on-error" class="olink"><code class="function">EXT:ABORT-ON-ERROR</code></a> and <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a> includes the <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> (stack).
</p><p><a id="global-handler"></a><strong>Function <a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a>. </strong>The function <code class="code">(<a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a> <em class="replaceable"><code>condition</code></em> handler)</code>
establishes a global handler for the <em class="replaceable"><code>condition</code></em>.
The <em class="replaceable"><code>handler</code></em> should be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>able (a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>).
If it returns, the next applicable handler is invoked, so if you do
<span class="strong"><strong>not</strong></span> want to land in the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a>, it should <span class="strong"><strong>not</strong></span> return.
E.g., the option <code class="option"><a href="clisp.html#opt-on-error" class="olink">-on-error</a></code> <code class="option">abort</code> and the macro
<a href="impnotes.html#abort-on-error" class="olink"><code class="function">EXT:ABORT-ON-ERROR</code></a> are implemented by installing the following handler:
</p><pre class="programlisting">(defun sys::abortonerror (condition)
(sys::report-error condition)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-restart.html" target="_top"><code class="function">INVOKE-RESTART</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_find-restart.html" target="_top"><code class="function">FIND-RESTART</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">ABORT</code></a> condition)))</pre><p>
When <em class="replaceable"><code>handler</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the handler
for <em class="replaceable"><code>condition</code></em> is removed and returned.
When <em class="replaceable"><code>condition</code></em> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, all global handlers are removed and returned
as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>, which can then be passed to <a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a> as the
first argument and the handlers re-established.</p><p><a id="without-global-handlers"></a><strong>Macro <a href="impnotes.html#without-global-handlers" class="olink"><code class="function">EXT:WITHOUT-GLOBAL-HANDLERS</code></a>. </strong>The macro <code class="code">(<a href="impnotes.html#without-global-handlers" class="olink"><code class="function">EXT:WITHOUT-GLOBAL-HANDLERS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a>
<em class="replaceable"><code>body</code></em>)</code> removes all global handlers by <code class="code">(<a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code>, executes <em class="replaceable"><code>body</code></em> (where unhandled conditions now
invoke the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a>), and then restores the handlers.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="assertions"></a>9.4. Assertions
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_9-1-5.html">[sec_9-1-5]</a></h2></div></div></div><p>The prompt for replacement values (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/res_store-value.html" target="_top"><code class="function">STORE-VALUE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/res_use-value.html" target="_top"><code class="function">USE-VALUE</code></a> et al) is terminated with <a class="link" href="#prompt-finish"><code class="varname">CUSTOM:*PROMPT-FINISH*</code></a> to indicate that
the value entered is treated as usual for the Lisp <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>, i.e., it is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>uated.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="symbols"></a>Chapter 10. Symbols <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-10.html">[chap-10]</a></h2></div></div></div><p>No notes.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="packages"></a>Chapter 11. Packages
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-11.html">[chap-11]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#pack-intro">11.1. Introduction to Packages sec_11-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#make-pack">11.1.1. Function <code class="function">MAKE-PACKAGE</code></a></span></dt><dt><span class="section"><a href="#defpack">11.1.2. Macro <code class="function">DEFPACKAGE</code></a></span></dt><dt><span class="section"><a href="#re-export">11.1.3. Function <code class="function">EXT:RE-EXPORT</code></a></span></dt><dt><span class="section"><a href="#pack-inverted">11.1.4. Function <code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a></span></dt><dt><span class="section"><a href="#pack-sensitive">11.1.5. Function <code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a></span></dt></dl></dd><dt><span class="section"><a href="#pack-lock">11.2. Constraints on the <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong> Package for Conforming Programs - package locking sec_11-1-2-1-2</a></span></dt><dt><span class="section"><a href="#clupack">11.3. The <strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong> Package sec_11-1-2-2</a></span></dt><dt><span class="section"><a href="#imppack">11.4. Implementation-Defined Packages sec_11-1-2-4</a></span></dt><dt><span class="section"><a href="#package-case">11.5. Package Case-Sensitivity</a></span></dt><dd><dl><dt><span class="section"><a href="#cs-clu">11.5.1. User Package for the Case-sensitive World</a></span></dt><dt><span class="section"><a href="#cs-pack-name">11.5.2. Package Names</a></span></dt><dt><span class="section"><a href="#cs-gensym-kwd">11.5.3. Gensyms and Keywords</a></span></dt><dt><span class="section"><a href="#case-sensitive-migration">11.5.4. Migration Tips</a></span></dt><dt><span class="section"><a href="#case-sensitive-startup">11.5.5. Using case-sensitive packages by default</a></span></dt></dl></dd></dl></div><div class="variablelist"><p class="title"><strong>The [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] packages present in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><dl class="variablelist"><dt><span class="term"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a></span></dt><dd>with the nicknames <strong class="package"><span class="quote">“<span class="quote">CL</span>”</span></strong>
and <strong class="package"><span class="quote">“<span class="quote">LISP</span>”</span></strong></dd><dt><span class="term"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a></span></dt><dd>with the nicknames <strong class="package"><span class="quote">“<span class="quote">CL-USER</span>”</span></strong>
and <strong class="package"><span class="quote">“<span class="quote">USER</span>”</span></strong></dd><dt><span class="term"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-3.html"><strong class="package"><span class="quote">“<span class="quote">KEYWORD</span>”</span></strong></a></span></dt><dd>with no nicknames
</dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pack-intro"></a>11.1. Introduction to Packages
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-1.html">[sec_11-1-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#make-pack">11.1.1. Function <code class="function">MAKE-PACKAGE</code></a></span></dt><dt><span class="section"><a href="#defpack">11.1.2. Macro <code class="function">DEFPACKAGE</code></a></span></dt><dt><span class="section"><a href="#re-export">11.1.3. Function <code class="function">EXT:RE-EXPORT</code></a></span></dt><dt><span class="section"><a href="#pack-inverted">11.1.4. Function <code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a></span></dt><dt><span class="section"><a href="#pack-sensitive">11.1.5. Function <code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="make-pack"></a>11.1.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a></h3></div></div></div><p>The default value of the <code class="constant">:USE</code> argument is
<span class="data"><code class="literal">(<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>)</code></span>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a> accepts additional keyword arguments
<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> and <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a> (but <span class="strong"><strong>not</strong></span> <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a>!)
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="defpack"></a>11.1.2. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> accepts additional options <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a>, and <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a>.</p><p>When the package being defined already exists, it is modified as
follows (and in this order):</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a></span></dt><dd>adjusted with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#pack-sensitive" title="11.1.5. Function EXT:PACKAGE-CASE-SENSITIVE-P"><code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a>)</code>
(with a warning)</dd><dt><span class="term"><a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a></span></dt><dd>adjusted with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#pack-inverted" title="11.1.4. Function EXT:PACKAGE-CASE-INVERTED-P"><code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a>)</code>
(with a warning)</dd><dt><span class="term"><a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a></span></dt><dd><p>if <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> is being used, it is un-used and
<a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a> is used instead; also, <a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a> is used instead of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>
throughout the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> form, e.g.,</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "FOO"
(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
(<code class="constant">:USE</code> "COMMON-LISP" "EXT"))
</pre><p>is equivalent to</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "FOO"
(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
(<code class="constant">:USE</code> "CS-COMMON-LISP" "EXT"))
</pre><p class="simpara"><code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code> reverts the
effects of <code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>.</p></dd><dt><span class="term"><code class="constant">:NICKNAMES</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_rename-package.html" target="_top"><code class="function">RENAME-PACKAGE</code></a>
</dd><dt><span class="term"><code class="constant">:DOCUMENTATION</code></span></dt><dd>reset to the new value with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a>)</code></dd><dt><span class="term"><code class="constant">:SHADOW</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_shadow.html" target="_top"><code class="function">SHADOW</code></a>
</dd><dt><span class="term"><code class="constant">:SHADOWING-IMPORT-FROM</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_shadowing-import.html" target="_top"><code class="function">SHADOWING-IMPORT</code></a>
</dd><dt><span class="term"><code class="constant">:USE</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_unuse-package.html" target="_top"><code class="function">UNUSE-PACKAGE</code></a>
</dd><dt><span class="term"><code class="constant">:IMPORT-FROM</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_import.html" target="_top"><code class="function">IMPORT</code></a>
</dd><dt><span class="term"><code class="constant">:INTERN</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a> (but <span class="strong"><strong>not</strong></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_unintern.html" target="_top"><code class="function">UNINTERN</code></a>)
</dd><dt><span class="term"><code class="constant">:EXPORT</code></span></dt><dd>adjusted with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a> (but <span class="strong"><strong>not</strong></span>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_unexport.html" target="_top"><code class="function">UNEXPORT</code></a>)</dd><dt><span class="term"><code class="constant">:SIZE</code></span></dt><dd>ignored</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="re-export"></a>11.1.3. Function <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a></h3></div></div></div><p>The function <code class="code">(<a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a> <em class="replaceable"><code>FROM-PACK</code></em>
<em class="replaceable"><code>TO-PACK</code></em>)</code> re-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>s all external
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s from <em class="replaceable"><code>FROM-PACK</code></em> also from
<em class="replaceable"><code>TO-PACK</code></em>, provided it already uses
<em class="replaceable"><code>FROM-PACK</code></em>; and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> otherwise.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pack-inverted"></a>11.1.4. Function <a class="link" href="#pack-inverted" title="11.1.4. Function EXT:PACKAGE-CASE-INVERTED-P"><code class="function">EXT:PACKAGE-CASE-INVERTED-P</code></a></h3></div></div></div><p>Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if the argument is a
<a class="link" href="#pack-case-inverted">case-inverted package</a>.
This function is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able, although it is probably not a good idea
to change the case-inverted status of an existing package.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pack-sensitive"></a>11.1.5. Function <a class="link" href="#pack-sensitive" title="11.1.5. Function EXT:PACKAGE-CASE-SENSITIVE-P"><code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code></a></h3></div></div></div><p>Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if the argument is a <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>.
This function is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able, although it is probably not a good idea
to change the case-sensitive status of an existing package.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pack-lock"></a>11.2. Constraints on the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> Package
for Conforming Programs - package locking
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1-2.html">[sec_11-1-2-1-2]</a></h2></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Locking discussed in this section has nothing to do with
<a class="link" href="#mutex-lock"><code class="function">MT:MUTEX-LOCK</code></a>.</p></div><p><strong>Function <strong class="first"><em class="firstterm"><a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="function">EXT:PACKAGE-LOCK</code></a>
<a id="pack-lock-f" class="indexterm"></a></em></strong>. </strong>Packages can be <span class="quote">“<span class="quote">locked</span>”</span>.
When a package is locked, attempts to change its symbol table or
redefine its symbols (as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFPARAMETER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_deftype.html" target="_top"><code class="function">DEFTYPE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_declaration.html" target="_top"><code class="literal">DECLARATION</code></a>)
result in a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> (continuing overrides locking for this operation).
When <a class="link" href="#suppress-check-redef" title="Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*"><code class="varname">CUSTOM:*SUPPRESS-CHECK-REDEFINITION*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> (<span class="strong"><strong>not</strong></span> a good idea!), the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>
is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed for redefine operations.
Function <code class="code">(<a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="function">EXT:PACKAGE-LOCK</code></a> <em class="replaceable"><code>package</code></em>)</code>
returns the generalized boolean indicating whether the <em class="replaceable"><code>package</code></em> is locked.
A package (or a list thereof) can be locked using <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
(<a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="function">EXT:PACKAGE-LOCK</code></a> <em class="replaceable"><code>package-or-list</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>.
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> locks its system packages (specified in the variable
<a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a>).</p><p><strong>Macro <a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a>. </strong>If you want to evaluate some forms with certain packages unlocked,
you can use
<strong class="first"><em class="firstterm"><a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a>
<a id="without-pack-lock" class="indexterm"></a></em></strong>:
</p><pre class="programlisting">
(<a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a> (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a> <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a>)
(defun restart () ...))
</pre><p>
or
</p><pre class="programlisting">
(<a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a> (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>) (trace read-line))
</pre><p>
<code class="code">(<a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a> () ...)</code>
temporarily unlocks all packages in <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a>.</p><p><strong>Variable <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a>. </strong>This variable specifies the default packages to be locked by <a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a>
and unlocked by <a class="link" href="#without-pack-lock"><code class="function">EXT:WITHOUT-PACKAGE-LOCK</code></a> as a list of package names.
You may add names to this list, e.g., a module will add its package,
but you should <span class="strong"><strong>not</strong></span> remove <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internal packages from this list.
</p><p><strong>Discussion - see also
<a class="ulink" href="https://groups.google.com/forum/#!msg/comp.lang.lisp/L1xRYHBY2Gs/qjVNn9pEeNgJ" target="_top">the USENET posting</a> by
<span class="author"><span class="firstname">Steven M.</span> <span class="surname">Haflich</span></span>. </strong>This should prevent you from accidentally hosing yourself with
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> instance ...)
</pre><p>
and allow enforcing modularity.
Note that you will also get the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when you try to
assign (with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_psetq.html" target="_top"><code class="function">PSETQ</code></a>, etc.) a value to an internal special
variable living in a locked package and not accessible in your current
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a>, but only in the interpreted code and during compilation.
There is no check for package locks in compiled code because of the
performance considerations.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clupack"></a>11.3. The
<strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong> Package
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html">[sec_11-1-2-2]</a></h2></div></div></div><p>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package uses the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> and <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a> packages.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="imppack"></a>11.4. Implementation-Defined Packages
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-4.html">[sec_11-1-2-4]</a></h2></div></div></div><p>The following additional packages exist:</p><div class="variablelist"><p class="title"><strong>Implementation-Defined Packages</strong></p><dl class="variablelist"><dt><span class="term"><a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>s all <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>-specific symbols, including some
<a class="link" href="#clos-diff" title="4.3. Deviations from ANSI CL standard">additional symbols</a>.
</dd><dt><a id="sys-pac"></a><span class="term"><a class="link" href="#sys-pac"><strong class="package"><span class="quote">“<span class="quote">SYSTEM</span>”</span></strong></a></span></dt><dd>has the nickname <strong class="package"><span class="quote">“<span class="quote">SYS</span>”</span></strong>,
and has no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>ed symbols. It defines many system internals.
</dd><dt><a id="ext-pac"></a><span class="term"><a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a></span></dt><dd>
is the umbrella package for all extensions: it imports and <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>s
all the external symbols in all <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extensions, so a simple
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> "EXT")</code> is enough to
make all the extensions available in the current package.
This package uses packages (in addition to <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a>):
<a class="link" href="#syscalls" title="33.2. System Calls"><strong class="package"><span class="quote">“<span class="quote">POSIX</span>”</span></strong></a>, <a class="link" href="#socket" title="32.4. Socket Streams"><strong class="package"><span class="quote">“<span class="quote">SOCKET</span>”</span></strong></a>, <a class="link" href="#gstream" title="31.6. Generic streams"><strong class="package"><span class="quote">“<span class="quote">GSTREAM</span>”</span></strong></a>, <a class="link" href="#gray" title="Chapter 30. Gray streams"><strong class="package"><span class="quote">“<span class="quote">GRAY</span>”</span></strong></a>,
<a class="link" href="#i18n" title="31.4. Internationalization of CLISP"><strong class="package"><span class="quote">“<span class="quote">I18N</span>”</span></strong></a>, <a class="link" href="#customize" title="31.12. Customizing CLISP behavior"><strong class="package"><span class="quote">“<span class="quote">CUSTOM</span>”</span></strong></a>.</dd><dt><span class="term"><a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a></span></dt><dd>defines and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>s some character sets, for use with
<a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a> and as <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> argument.
</dd><dt><span class="term"><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a></span></dt><dd>implements the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility">foreign function
interface</a>. Some platforms only.
</dd><dt><span class="term"><a class="link" href="#screen" title="32.1. Random Screen Access"><strong class="package"><span class="quote">“<span class="quote">SCREEN</span>”</span></strong></a></span></dt><dd>defines an API for <a class="link" href="#screen" title="32.1. Random Screen Access">random screen
access</a>. Some platforms only.
</dd><dt><span class="term"><a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a><br /></span><span class="term"><a href="impnotes.html#cs-clu" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP-USER</span>”</span></strong></a></span></dt><dd><a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> versions of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a>.
See <a class="xref" href="#package-case" title="11.5. Package Case-Sensitivity">Section 11.5, “Package Case-Sensitivity”</a>.</dd></dl></div><p>All pre-existing packages except <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> belong to the
implementation, in the sense that the programs that do not follow
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1-2.html">[sec_11-1-2-1-2]</a>
(<span class="quote">“<span class="quote">Constraints on the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">‘<span class="quote">COMMON-LISP</span>’</span></strong></a> Package for Conforming Programs</span>”</span>)
cause undefined behavior.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="package-case"></a>11.5. Package Case-Sensitivity</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#cs-clu">11.5.1. User Package for the Case-sensitive World</a></span></dt><dt><span class="section"><a href="#cs-pack-name">11.5.2. Package Names</a></span></dt><dt><span class="section"><a href="#cs-gensym-kwd">11.5.3. Gensyms and Keywords</a></span></dt><dt><span class="section"><a href="#case-sensitive-migration">11.5.4. Migration Tips</a></span></dt><dt><span class="section"><a href="#case-sensitive-startup">11.5.5. Using case-sensitive packages by default</a></span></dt></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> supports programs written with case sensitive symbols. For
example, with case sensitive symbols, the symbols <code class="literal">cdr</code>
(the function equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_rest.html" target="_top"><code class="function">REST</code></a>) and the symbol <code class="literal">CDR</code>
(a user-defined type denoting a Call Data Record) are different and unrelated.
</p><p>There are some incompatibilities between programs assuming case
sensitive symbols and programs assuming the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] case insensitive symbols.
For example, <code class="code">(eq 'KB 'Kb)</code> evaluates to false in a case
sensitive world and to true in a case insensitive world. However, unlike some
commercial <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> allows both kinds of programs to
coexist in the same process and interoperate with each other. Example:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">OLD.lisp</code></span></dt><dd><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "OLD")
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> FOO () ...)
</pre></dd><dt><span class="term"><code class="filename">modern.lisp</code></span></dt><dd><pre class="programlisting">
(in-package "NEW")
(defun bar () (old:foo))
(symbol-name 'bar) ; ⇒ <code class="computeroutput">"bar"</code>
</pre></dd></dl></div><p>This is achieved through specification of the symbol case policy at
the package level. A <strong class="first"><em class="firstterm">modern package
<a id="pack-modern" class="indexterm"></a></em></strong>
is one that is declared to be both case-sensitive and case-inverted and
which use the symbols from the <a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a> package.</p><p>A <strong class="first"><em class="firstterm">case-sensitive package
<a id="pack-case-sensitive" class="indexterm"></a></em></strong>
is one whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> declaration (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a>
creation form) has the option <code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>.
In a case-sensitive package, the reader does <span class="strong"><strong>not</strong></span> uppercase the
symbol name before calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a>. Similarly, the printer, when
printing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> part of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> (i.e. the part after
the package markers), behaves as if the readtable's case were set
to <code class="constant">:PRESERVE</code>.
See also <a class="xref" href="#pack-sensitive" title="11.1.5. Function EXT:PACKAGE-CASE-SENSITIVE-P">Section 11.1.5, “Function <code class="function">EXT:PACKAGE-CASE-SENSITIVE-P</code>”</a>.</p><p>A <strong class="first"><em class="firstterm">case-inverted package
<a id="pack-case-inverted" class="indexterm"></a>
</em></strong> is one whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> declaration (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a>
creation form) has the option <code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-INVERTED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>.
In the context of a case-inverted package, symbol names are
case-inverted: upper case characters are mapped to lower case, lower
case characters are mapped to upper case, and other characters are left
untouched. Every symbol thus conceptually has two symbol names: an
old-world symbol name and a modern-world symbol name, which is the
case-inverted old-world name. The first symbol name is returned by the
function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a>, the modern one by the
function <code class="function">cs-cl:symbol-name</code>. The internal
functions for creating or looking up symbols in a package, which
traditionally took a string argument, now conceptually take two string
arguments: old-style-string and inverted-string. Actually, a function
like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a> takes the old-style-string as argument and computes the
inverted-string from it; whereas the
function <code class="function">cs-cl:intern</code> takes the inverted-string as
argument and computes the old-style-string from it.
See also <a class="xref" href="#pack-inverted" title="11.1.4. Function EXT:PACKAGE-CASE-INVERTED-P">Section 11.1.4, “Function <code class="function">EXT:PACKAGE-CASE-INVERTED-P</code>”</a>.</p><p>For a few built-in functions, a variant for the case-inverted
world is defined in the <a href="impnotes.html#package-case" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP</span>”</span></strong></a> package, which has the nickname
<strong class="package"><span class="quote">“<span class="quote">CS-CL</span>”</span></strong>:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">cs-cl:symbol-name</code></span></dt><dd>returns the case-inverted symbol name.
</dd><dt><span class="term"><code class="function">cs-cl:intern</code><br /></span><span class="term"><code class="function">cs-cl:find-symbol</code></span></dt><dd>work consistently with
<code class="function">cs-cl:symbol-name</code>.</dd><dt><span class="term"><code class="function">cs-cl:shadow</code><br /></span><span class="term"><code class="function">cs-cl:find-all-symbols</code><br /></span><span class="term"><code class="function">cs-cl:string=</code><br /></span><span class="term"><code class="function">cs-cl:string/=</code><br /></span><span class="term"><code class="function">cs-cl:string<</code><br /></span><span class="term"><code class="function">cs-cl:string></code><br /></span><span class="term"><code class="function">cs-cl:string<=</code><br /></span><span class="term"><code class="function">cs-cl:string>=</code><br /></span><span class="term"><code class="function">cs-cl:string-trim</code><br /></span><span class="term"><code class="function">cs-cl:string-left-trim</code><br /></span><span class="term"><code class="function">cs-cl:string-right-trim</code></span></dt><dd>convert a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and therefore
exist in a variant that uses <code class="function">cs-cl:symbol-name</code>
instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a>.</dd><dt><span class="term"><code class="function">cs-cl:make-package</code></span></dt><dd>creates a case-inverted <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>.
</dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cs-clu"></a>11.5.1. User Package for the Case-sensitive World</h3></div></div></div><p>A package <a href="impnotes.html#cs-clu" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP-USER</span>”</span></strong></a> is provided for the user to modify and work in.
It plays the same role as <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a>, but for the case-sensitive
world.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cs-pack-name"></a>11.5.2. Package Names</h3></div></div></div><p>The handling of package names is unchanged. Package names are
still usually uppercase. The package names are also subject to
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_readtable-case.html" target="_top"><code class="function">READTABLE-CASE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_streadtablest.html" target="_top"><code class="varname">*READTABLE*</code></a>)</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cs-gensym-kwd"></a>11.5.3. Gensyms and Keywords</h3></div></div></div><p>Note that gensyms and keywords are still treated traditionally:
even in a case-sensitive package,</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> '#:FooBar '#:foobar)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> ':KeyWord ':keyword)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code></pre><p>
We believe this has a limited negative impact for the moment,
but can be changed some time in the future.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="case-sensitive-migration"></a>11.5.4. Migration Tips</h3></div></div></div><p>The following practices will pose no problems when migrating to a
modern case-sensitive world:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Using [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] symbols in lowercase.</li><li class="listitem">Macros that create symbols by suffixing or prefixing
given symbols.</li><li class="listitem">Comparing symbol names as in
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> <em class="replaceable"><code>x</code></em>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> <em class="replaceable"><code>y</code></em>))</code>.
</li></ul></div><p>The following practices will not work in a case-sensitive world or
can give problems:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Accessing the same symbol in both upper- and
lowercase from the same source file.</li><li class="listitem">Macros that create symbols in other packages than the
original symbols.</li><li class="listitem">Comparing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> return values with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>.
</li><li class="listitem">Comparing <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> x)</code> with
<code class="code">(cs-cl:symbol-name y)</code>.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="case-sensitive-startup"></a>11.5.5. Using case-sensitive packages by default</h3></div></div></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> supports a command-line option <code class="option"><a href="clisp.html#opt-modern" class="olink">-modern</a></code> that
sets the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a> initially to the <a href="impnotes.html#cs-clu" class="olink"><strong class="package"><span class="quote">“<span class="quote">CS-COMMON-LISP-USER</span>”</span></strong></a> package, and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-casest.html" target="_top"><code class="varname">*PRINT-CASE*</code></a> to <code class="constant">:DOWNCASE</code>.</p><p>For packages to be located in the <span class="quote">“<span class="quote">modern</span>”</span>
(case-sensitive) world, you need to augment their <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a>
declaration by adding the option <code class="code">(<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:MODERN</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>,
see <a class="xref" href="#defpack" title="11.1.2. Macro DEFPACKAGE">Section 11.1.2, “Macro <code class="function">DEFPACKAGE</code>”</a>.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="numbers"></a>Chapter 12. Numbers <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-12.html">[chap-12]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#num-types">12.1. Numeric Types</a></span></dt><dt><span class="section"><a href="#num-concepts">12.2. Number Concepts sec_12-1</a></span></dt><dd><dl><dt><span class="section"><a href="#num-ops">12.2.1. Numeric Operations sec_12-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#int-func-ext">12.2.1.1. Additional Integer Functions</a></span></dt><dt><span class="section"><a href="#float-decode">12.2.1.2. Function <code class="function">DECODE-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bool-ops">12.2.1.3. Boolean Operations convar_boole-_cm_boole-xor</a></span></dt><dt><span class="section"><a href="#byte-type">12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2</a></span></dt><dt><span class="section"><a href="#float-notes">12.2.1.5. Floating Point Arithmetics</a></span></dt></dl></dd><dt><span class="section"><a href="#num-const">12.2.2. Implementation-Dependent Numeric Constants sec_12-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#fixnum-lim">12.2.2.1. Fixnum Limits</a></span></dt><dt><span class="section"><a href="#bignum-lim">12.2.2.2. Bignum Limits</a></span></dt><dt><span class="section"><a href="#float-lim">12.2.2.3. Float Limits</a></span></dt></dl></dd><dt><span class="section"><a href="#float-subst">12.2.3. Rule of Float Substitutability sec_12-1-3-3</a></span></dt><dt><span class="section"><a href="#float-comp">12.2.4. Floating-point Computations sec_12-1-4</a></span></dt><dd><dl><dt><span class="section"><a href="#flocont">12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4</a></span></dt><dt><span class="section"><a href="#floratcont">12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1</a></span></dt></dl></dd><dt><span class="section"><a href="#complex-comp">12.2.5. Complex Computations sec_12-1-5</a></span></dt><dt><span class="section"><a href="#complex-rational">12.2.6. Rule of Canonical Representation for Complex Rationals sec_12-1-5-3</a></span></dt><dt><span class="section"><a href="#random-state">12.2.7. Random-State Operations sec_12-1-7</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="num-types"></a>12.1. Numeric Types</h2></div></div></div><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a> is the disjoint union of the types
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> (<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#exhaustive_partition">exhaustive
partition</a>)</p><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> is the disjoint union of the types
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>.</p><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> is the disjoint union of the types
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_ratio.html" target="_top"><code class="classname">RATIO</code></a>.</p><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> is the disjoint union of the types
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>.</p><p>The type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a> is the disjoint union of the types
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="num-concepts"></a>12.2. Number Concepts
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1.html">[sec_12-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#num-ops">12.2.1. Numeric Operations sec_12-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#int-func-ext">12.2.1.1. Additional Integer Functions</a></span></dt><dt><span class="section"><a href="#float-decode">12.2.1.2. Function <code class="function">DECODE-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bool-ops">12.2.1.3. Boolean Operations convar_boole-_cm_boole-xor</a></span></dt><dt><span class="section"><a href="#byte-type">12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2</a></span></dt><dt><span class="section"><a href="#float-notes">12.2.1.5. Floating Point Arithmetics</a></span></dt></dl></dd><dt><span class="section"><a href="#num-const">12.2.2. Implementation-Dependent Numeric Constants sec_12-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#fixnum-lim">12.2.2.1. Fixnum Limits</a></span></dt><dt><span class="section"><a href="#bignum-lim">12.2.2.2. Bignum Limits</a></span></dt><dt><span class="section"><a href="#float-lim">12.2.2.3. Float Limits</a></span></dt></dl></dd><dt><span class="section"><a href="#float-subst">12.2.3. Rule of Float Substitutability sec_12-1-3-3</a></span></dt><dt><span class="section"><a href="#float-comp">12.2.4. Floating-point Computations sec_12-1-4</a></span></dt><dd><dl><dt><span class="section"><a href="#flocont">12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4</a></span></dt><dt><span class="section"><a href="#floratcont">12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1</a></span></dt></dl></dd><dt><span class="section"><a href="#complex-comp">12.2.5. Complex Computations sec_12-1-5</a></span></dt><dt><span class="section"><a href="#complex-rational">12.2.6. Rule of Canonical Representation for Complex Rationals sec_12-1-5-3</a></span></dt><dt><span class="section"><a href="#random-state">12.2.7. Random-State Operations sec_12-1-7</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="num-ops"></a>12.2.1. Numeric Operations
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-1.html">[sec_12-1-1]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#int-func-ext">12.2.1.1. Additional Integer Functions</a></span></dt><dt><span class="section"><a href="#float-decode">12.2.1.2. Function <code class="function">DECODE-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bool-ops">12.2.1.3. Boolean Operations convar_boole-_cm_boole-xor</a></span></dt><dt><span class="section"><a href="#byte-type">12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2</a></span></dt><dt><span class="section"><a href="#float-notes">12.2.1.5. Floating Point Arithmetics</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="int-func-ext"></a>12.2.1.1. Additional Integer Functions</h4></div></div></div><p><a id="factorial"></a><strong>Function <code class="function">EXT:!</code> </strong><code class="code">(<code class="function">EXT:!</code> <em class="replaceable"><code>n</code></em>)</code> returns the
factorial of <em class="replaceable"><code>n</code></em>, <em class="replaceable"><code>n</code></em> being a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.</p><p><a id="exquo"></a><strong>Function <code class="function">EXT:EXQUO</code>. </strong><code class="code">(<code class="function">EXT:EXQUO</code> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>y</code></em>)</code> returns
the integer quotient <code class="varname">x/y</code> of two integers
<em class="replaceable"><code>x</code></em>,<em class="replaceable"><code>y</code></em>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when the quotient is not
integer. (This is more efficient than <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sl.html" target="_top"><code class="function">/</code></a>.)</p><p><a id="xgcd"></a><strong>Function <code class="function">EXT:XGCD</code>. </strong><code class="code">(<code class="function">EXT:XGCD</code> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>)</code>
returns the values <em class="replaceable"><code>l</code></em>, <em class="replaceable"><code>k<sub>1</sub></code></em>, ..., <em class="replaceable"><code>k<sub>n</sub></code></em>, where <em class="replaceable"><code>l</code></em> is the
greatest common divisor of the integers <em class="replaceable"><code>x<sub>1</sub></code></em>, ..., <em class="replaceable"><code>x<sub>n</sub></code></em>, and
<em class="replaceable"><code>k<sub>1</sub></code></em>, ..., <em class="replaceable"><code>k<sub>n</sub></code></em> are the integer coefficients such that
</p><pre class="programlisting">
<em class="replaceable"><code>l</code></em> = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_gcd.html" target="_top"><code class="function">GCD</code></a> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>)
= (+ (* <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>1</sub></code></em>) ... (* <em class="replaceable"><code>k<sub>n</sub></code></em> <em class="replaceable"><code>x<sub>n</sub></code></em>))
</pre><p><a id="mod-expt"></a><strong>Function <a class="link" href="#mod-expt" title="Function EXT:MOD-EXPT"><code class="function">EXT:MOD-EXPT</code></a>. </strong><code class="code">(<a class="link" href="#mod-expt" title="Function EXT:MOD-EXPT"><code class="function">EXT:MOD-EXPT</code></a> <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>l</code></em> <em class="replaceable"><code>m</code></em>)</code>
is equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_modcm_rem.html" target="_top"><code class="function">MOD</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_expcm_expt.html" target="_top"><code class="function">EXPT</code></a> <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>l</code></em>) <em class="replaceable"><code>m</code></em>)</code>
except it is more efficient for very large arguments.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="float-decode"></a>12.2.1.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">DECODE-FLOAT</code></a></h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">FLOAT-RADIX</code></a> always returns <span class="returnvalue">2</span>.</p><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">FLOAT-DIGITS</code></a> <em class="replaceable"><code>number</code></em> <em class="replaceable"><code>digits</code></em>)</code> coerces
<em class="replaceable"><code>number</code></em> (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a>) to a floating point number with at least
<em class="replaceable"><code>digits</code></em> mantissa digits. The following always evaluates to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">>=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">FLOAT-DIGITS</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-fl_decode-float.html" target="_top"><code class="function">FLOAT-DIGITS</code></a> <em class="replaceable"><code>number</code></em> <em class="replaceable"><code>digits</code></em>)) <em class="replaceable"><code>digits</code></em>)
</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="bool-ops"></a>12.2.1.3. Boolean Operations
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html">[convar_boole-_cm_boole-xor]</a></h4></div></div></div><div class="table"><a id="bool-op-table"></a><p class="title"><strong>Table 12.1. Boolean operations</strong></p><div class="table-contents"><table class="table" summary="Boolean operations" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="left">constant</th><th align="left">value</th></tr></thead><tbody><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-CLR</code></a></td><td align="left">0</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-SET</code></a></td><td align="left">15</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-1</code></a></td><td align="left">10</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-2</code></a></td><td align="left">12</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-C1</code></a></td><td align="left">5</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-C2</code></a></td><td align="left">3</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-AND</code></a></td><td align="left">8</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-IOR</code></a></td><td align="left">14</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-XOR</code></a></td><td align="left">6</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-EQV</code></a></td><td align="left">9</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-NAND</code></a></td><td align="left">7</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-NOR</code></a></td><td align="left">1</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-ANDC1</code></a></td><td align="left">4</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-ANDC2</code></a></td><td align="left">2</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-ORC1</code></a></td><td align="left">13</td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_boole-_cm_boole-xor.html" target="_top"><code class="constant">BOOLE-ORC2</code></a></td><td align="left">11</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="byte-type"></a>12.2.1.4. Byte Operations on Integers
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-1-3-2.html">[sec_12-1-1-3-2]</a></h4></div></div></div><p>Byte specifiers are objects of built-in type <a class="link" href="#byte-type" title="12.2.1.4. Byte Operations on Integers sec_12-1-1-3-2"><span class="type">BYTE</span></a>,
not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="float-notes"></a>12.2.1.5. Floating Point Arithmetics</h4></div></div></div><p><a id="expt"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_expcm_expt.html" target="_top"><code class="function">EXPT</code></a>. </strong><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_expcm_expt.html" target="_top"><code class="function">EXPT</code></a> <em class="replaceable"><code>base</code></em> <em class="replaceable"><code>exponent</code></em>)</code>
is not very precise if <em class="replaceable"><code>exponent</code></em> has a large
absolute value.</p><p><a id="log"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_log.html" target="_top"><code class="function">LOG</code></a>. </strong><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_log.html" target="_top"><code class="function">LOG</code></a> <em class="replaceable"><code>number</code></em> <em class="replaceable"><code>base</code></em>)</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if
<code class="literal"><em class="replaceable"><code>base</code></em> = 1</code>.</p><p><a id="pi"></a><strong>Constant <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>. </strong>The value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> with the precision given
by <code class="code">(<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>)</code>. When this precision is changed, the value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a> is
automatically recomputed. Therefore <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a> is <span class="strong"><strong>not</strong></span> a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a>.
</p><p><a id="ucpt"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_upgraded-_ex-part-type.html" target="_top"><code class="function">UPGRADED-COMPLEX-PART-TYPE</code></a>. </strong>When the argument is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_r.html#recognizable_subtype">recognizable subtype</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_upgraded-_ex-part-type.html" target="_top"><code class="function">UPGRADED-COMPLEX-PART-TYPE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>, otherwise it
returns its argument (even though a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> number in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can
always have <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_realpartcm_imagpart.html" target="_top"><code class="function">REALPART</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_realpartcm_imagpart.html" target="_top"><code class="function">IMAGPART</code></a> of any type) because it allows
the most precise type inference.</p><p><a id="default-float-format"></a><strong>Variable <a class="link" href="#default-float-format" title="Variable CUSTOM:*DEFAULT-FLOAT-FORMAT*"><code class="varname">CUSTOM:*DEFAULT-FLOAT-FORMAT*</code></a>. </strong>When rational numbers are to be converted to floats (due to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_float.html" target="_top"><code class="function">FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sqrtcm_isqrt.html" target="_top"><code class="function">SQRT</code></a> or a transcendental function), the result
type is given by the variable <a class="link" href="#default-float-format" title="Variable CUSTOM:*DEFAULT-FLOAT-FORMAT*"><code class="varname">CUSTOM:*DEFAULT-FLOAT-FORMAT*</code></a>.
See also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stread-de_oat-formatst.html" target="_top"><code class="varname">*READ-DEFAULT-FLOAT-FORMAT*</code></a>.</p><p><a id="no-underflow"></a><strong>Macro <a class="link" href="#no-underflow" title="Macro EXT:WITHOUT-FLOATING-POINT-UNDERFLOW"><code class="function">EXT:WITHOUT-FLOATING-POINT-UNDERFLOW</code></a>. </strong>The macro <code class="code">(<a class="link" href="#no-underflow" title="Macro EXT:WITHOUT-FLOATING-POINT-UNDERFLOW"><code class="function">EXT:WITHOUT-FLOATING-POINT-UNDERFLOW</code></a> {<em class="replaceable"><code>form</code></em>}*)</code> executes the
<em class="replaceable"><code>form</code></em>s, with errors of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_nt-underflow.html" target="_top"><code class="classname">FLOATING-POINT-UNDERFLOW</code></a> inhibited.
Floating point operations will silently return zero instead of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ing an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_nt-underflow.html" target="_top"><code class="classname">FLOATING-POINT-UNDERFLOW</code></a>.
</p><p><a id="float-invalid-op"></a><strong>Condition <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_id-operation.html" target="_top"><code class="classname">FLOATING-POINT-INVALID-OPERATION</code></a>. </strong>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> is never <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p><p><a id="float-inexact"></a><strong>Condition <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_floati_oint-inexact.html" target="_top"><code class="classname">FLOATING-POINT-INEXACT</code></a>. </strong>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> is never <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="num-const"></a>12.2.2. Implementation-Dependent Numeric Constants
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-2.html">[sec_12-1-2]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#fixnum-lim">12.2.2.1. Fixnum Limits</a></span></dt><dt><span class="section"><a href="#bignum-lim">12.2.2.2. Bignum Limits</a></span></dt><dt><span class="section"><a href="#float-lim">12.2.2.3. Float Limits</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="fixnum-lim"></a>12.2.2.1. Fixnum Limits</h4></div></div></div><div class="table"><a id="fixnum-lim-table"></a><p class="title"><strong>Table 12.2. Fixnum limits</strong></p><div class="table-contents"><table class="table" summary="Fixnum limits" border="1"><colgroup><col align="center" class="vars" /><col align="center" class="b32" /><col align="center" class="b64" /></colgroup><thead><tr><th align="center">CPU type</th><th align="center">32-bit CPU</th><th align="center">64-bit CPU</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-POSITIVE-FIXNUM</code></a></td><td align="center">2<sup>24</sup>-1 = 16777215</td><td align="center">2<sup>48</sup>-1 = 281474976710655</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-NEGATIVE-FIXNUM</code></a></td><td align="center">-2<sup>24</sup> = -16777216</td><td align="center">-2<sup>48</sup> = -281474976710656</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="bignum-lim"></a>12.2.2.2. Bignum Limits</h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>s are limited in size. Their maximum size is
<code class="literal">32*(2<sup>16</sup>-2)=2097088</code> bits.
The largest representable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a> is therefore
<code class="literal">2<sup>2097088</sup>-1</code>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="float-lim"></a>12.2.2.3. Float Limits</h4></div></div></div><p>Together with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>, the other <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> constants
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-LONG-FLOAT</code></a></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_short-_tive-epsilon.html" target="_top"><code class="constant">LONG-FLOAT-EPSILON</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT</code></a></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_short-_tive-epsilon.html" target="_top"><code class="constant">LONG-FLOAT-NEGATIVE-EPSILON</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-LONG-FLOAT</code></a></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">MOST-NEGATIVE-LONG-FLOAT</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">LEAST-POSITIVE-NORMALIZED-LONG-FLOAT</code></a></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">MOST-POSITIVE-LONG-FLOAT</code></a></td></tr></table><p>
are recomputed whenever <code class="code">(<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>)</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>ed.
They are <span class="strong"><strong>not</strong></span> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a>s.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="long-float-wider-than-bignum"></a>Warning</h3><p>Since the exponent of a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> is a <a class="link" href="#floating-types-table">signed 32-bits
integer</a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">MOST-POSITIVE-LONG-FLOAT</code></a> is about
<code class="literal">2<sup>2<sup>31</sup></sup></code>,
which is <span class="emphasis"><em>much</em></span> larger that the largest
representable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>, which is <a class="link" href="#bignum-lim" title="12.2.2.2. Bignum Limits">less than</a>
<code class="literal">2<sup>2<sup>21</sup></sup></code>.
This, obviously, means that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_floorcm_f_undcm_fround.html" target="_top"><code class="function">ROUND</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_floorcm_f_undcm_fround.html" target="_top"><code class="function">TRUNCATE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_floorcm_f_undcm_fround.html" target="_top"><code class="function">FLOOR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_floorcm_f_undcm_fround.html" target="_top"><code class="function">CEILING</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> on large <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s.
Less obviously, this means that <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> "<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a>"
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_d-long-float.html" target="_top"><code class="constant">MOST-POSITIVE-LONG-FLOAT</code></a>)</code> also fails.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="float-subst"></a>12.2.3. Rule of Float Substitutability
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-3-3.html">[sec_12-1-3-3]</a></h3></div></div></div><p>When a mathematical function may return an exact (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a>) or
inexact (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>) result, it always returns the exact result.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="float-comp"></a>12.2.4. Floating-point Computations
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4.html">[sec_12-1-4]</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#flocont">12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4</a></span></dt><dt><span class="section"><a href="#floratcont">12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1</a></span></dt></dl></div><p>There are four floating point types: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>:
</p><div class="informaltable"><a id="floating-types-table"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col /><col /></colgroup><thead><tr><th align="center">type</th><th align="center">sign</th><th align="center">mantissa</th><th align="center">exponent</th><th align="center">comment</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a></td><td align="center">1 bit</td><td align="center">16+1 bits</td><td align="center">8 bits</td><td align="center">immediate</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a></td><td align="center">1 bit</td><td align="center">23+1 bits</td><td align="center">8 bits</td><td align="center"><a class="ulink" href="http://grouper.ieee.org/groups/754/" target="_top">IEEE 754</a></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a></td><td align="center">1 bit</td><td align="center">52+1 bits</td><td align="center">11 bits</td><td align="center"><a class="ulink" href="http://grouper.ieee.org/groups/754/" target="_top">IEEE 754</a></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a></td><td align="center">1 bit</td><td align="center">>=64 bits</td><td align="center">32 bits</td><td align="center">variable
length</td></tr></tbody></table></div><p>The single and double float formats are those of the <a class="ulink" href="http://grouper.ieee.org/groups/754/" target="_top">IEEE 754</a>
<span class="quote">“<span class="quote">Standard for Binary Floating-Point Arithmetic</span>”</span>,
except that <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does not support features like
<code class="literal">±0</code>, <code class="literal">±inf</code>,
<code class="literal">NaN</code>, gradual underflow, etc.
<a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> does not make use of these features, so, to reduce portability
problems, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> by design returns the same floating point results on
all platforms (<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has a floating-point emulation built in for
platforms that do not support <a class="ulink" href="http://grouper.ieee.org/groups/754/" target="_top">IEEE 754</a>). Note that
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">When you got a <code class="literal">NaN</code>
in your program, your program is broken, so you will spend time
determining where the <code class="literal">NaN</code> came from.
It is better to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> in this case.</li><li class="listitem">When you got unnormalized floats in your program,
your results will have a greatly reduced accuracy anyway.
Since <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has the means to cope with this - <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s of
<a class="link" href="#lfd" title="Arbitrary Precision Floats">variable precision</a> - it does not
need unnormalized floats.</li></ul></div><p>
This is why <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> does not contain the
<code class="constant">:IEEE-FLOATING-POINT</code> keyword.</p><p><a id="lfd"></a><strong>Arbitrary Precision Floats. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s have variable mantissa length, which is a
multiple of 16 (or 32, depending on the word size of the processor).
The default length used when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> is given by the
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> <code class="code">(<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>)</code>. It can be set by <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>) <em class="replaceable"><code>n</code></em>)</code>,
where <em class="replaceable"><code>n</code></em> is a positive <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>. E.g., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#lfd" title="Arbitrary Precision Floats"><code class="function">EXT:LONG-FLOAT-DIGITS</code></a>)
3322)</code> sets the default precision of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s to about
1000 decimal digits.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="flocont"></a>12.2.4.1. Rule of Float Precision Contagion
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4-4.html">[sec_12-1-4-4]</a></h4></div></div></div><p>The floating point contagion is controlled by the variable
<a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a>. When it is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, contagion is done as per the
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a> →
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Rationale:</span></dt><dd>See it pragmatically: save what you can and let
others worry about the rest.</dd><dt><span class="term">Brief:</span></dt><dd><a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> knows the number's <span class="emphasis"><em>precision</em></span>,
not <span class="emphasis"><em>accuracy</em></span>, so preserving the precision can be
accomplished reliably, while anything relating to the accuracy is
just a speculation - only the user (programmer) knows what it is in
each case.</dd><dt><span class="term">Detailed:</span></dt><dd>A computer float is an approximation of a real number.
One can think of it as a random variable with the mean equal to
itself and standard deviation equal to half the last significant digit.
E.g., <code class="literal">1.5</code> is actually <code class="literal">1.5±0.05</code>.
Consider adding <code class="literal">1.5</code> and <code class="literal">1.75</code>.
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requires that <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pl.html" target="_top"><code class="function">+</code></a> 1.5 1.75)</code>
return <span class="returnvalue">3.25</span>, while traditional <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
would return <span class="returnvalue">3.3</span>.
The implied random variables are: <code class="literal">3.25±0.005</code>
and <code class="literal">3.3±0.05</code>.
Note that the traditional <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> way <span class="strong"><strong>does</strong></span>
lie about the mean: the mean <span class="strong"><strong>is</strong></span> <code class="literal">3.25</code> and
nothing else, while the standard way
<span class="strong"><strong>could</strong></span> be lying about the deviation
(accuracy): if the implied accuracy of <code class="literal">1.5</code> (i.e., 0.05)
is its actual accuracy, then the accuracy of the result cannot be
smaller that that. Therefore, since <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> has no way of knowing the
actual accuracy, [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] (and all the other standard engineering
programming languages, like <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, <a class="dict" href="http://foldoc.org/Fortran"><span class="command"><strong>Fortran</strong></span></a>
etc) decided that keeping the accuracy correct is the business of the
programmer, while the language should preserve what it can - the precision.
</dd><dt><span class="term">Experience:</span></dt><dd>Rounding errors accumulate, and if a computation
is conducted with insufficient precision, an outright incorrect
result can be returned.
(E.g., <code class="code">E(x<sup>2</sup>) -
E(x)<sup>2</sup></code> can be negative!)
The user should not mix floats of different precision (that's what
<a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a> is for), but one should not be penalized for this too
harshly.</dd></dl></div><p>When <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the traditional <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> method is used,
namely the result of an arithmetic operation whose arguments are of
different float types is rounded to the float format of the shortest
(least precise) of the arguments: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> →
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>
→ <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a> (in contrast to
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4-4.html">[sec_12-1-4-4]</a>!)</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Rationale:</span></dt><dd>See it mathematically. Add intervals:
<code class="code">{1.0 ± 1e-8} + {1.0 ± 1e-16} = {2.0 ±
1e-8}</code>. So, if we add <code class="literal">1.0s0</code> and
<code class="literal">1.0d0</code>, we should get <code class="literal">2.0s0</code>.
</dd><dt><span class="term">Brief:</span></dt><dd>Do not suggest high accuracy of a result by giving
it a precision that is greater than its accuracy.
</dd><dt><span class="term">Example:</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_-.html" target="_top"><code class="function">-</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pl.html" target="_top"><code class="function">+</code></a> 1.7 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>)</code>
should not return <span class="returnvalue">1.700000726342836417234L0</span>,
it should return <span class="returnvalue">1.7f0</span> (or
<span class="returnvalue">1.700001f0</span> if there were rounding errors).
</dd><dt><span class="term">Experience:</span></dt><dd>If in a computation using thousands of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s,
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a> (like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>) happens to be used, the long precision
should not propagate throughout all the intermediate values.
Otherwise, the long result would look precise, but its accuracy is
only that of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>; furthermore much computation time
would be lost by calculating with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s when only
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s would be needed.</dd></dl></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="warn-fpc"></a>Variable <a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a></h5></div></div></div><p>If the variable <a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> is emitted for
every coercion involving different floating-point types.
As explained above, float precision contagion is not a good idea.
You can avoid the contagion by doing all your computations with the
same floating-point type (and using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_float.html" target="_top"><code class="function">FLOAT</code></a> to convert all constants,
e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_pi.html" target="_top"><code class="constant">PI</code></a>, to your preferred type).</p><p>This variable helps you eliminate all occurrences of float
precision contagion: set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> to have <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> on float precision contagion; set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> to have
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> on float precision contagion, so that you
can look at the stack <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="floratcont"></a>12.2.4.2. Rule of Float and Rational Contagion
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4-1.html">[sec_12-1-4-1]</a></h4></div></div></div><p>The contagion between floating point and rational numbers is controlled
by the variable <a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a>. When it is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, contagion is done as per
the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> → <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>.</p><p>When <a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the traditional <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> method is used,
namely if the result is mathematically an exact rational number, this
rational number is returned (in contrast to
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-4-1.html">[sec_12-1-4-1]</a>!)</p><p><a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a> has an effect only in those few cases when the mathematical
result is exact although one of the arguments is a floating-point number,
such as <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_st.html" target="_top"><code class="function">*</code></a> 0 1.618)</code>, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sl.html" target="_top"><code class="function">/</code></a> 0 1.618)</code>,
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_asincm_acoscm_atan.html" target="_top"><code class="function">ATAN</code></a> 0 1.0)</code>, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_expcm_expt.html" target="_top"><code class="function">EXPT</code></a> 2.0 0)</code>,
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_phase.html" target="_top"><code class="function">PHASE</code></a> 2.718)</code>.</p><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="warn-fprc"></a>Variable <a class="link" href="#warn-fprc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-RATIONAL-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-RATIONAL-CONTAGION*</code></a></h5></div></div></div><p>If the variable <a class="link" href="#warn-fprc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-RATIONAL-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-RATIONAL-CONTAGION*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> is emitted for
every avoidable coercion from a rational number to a floating-point number.
You can avoid such coercions by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_float.html" target="_top"><code class="function">FLOAT</code></a> to convert the particular
rational numbers to your preferred floating-point type.</p><p>This variable helps you eliminate all occurrences of avoidable
coercions to a floating-point number when a rational number result
would be possible: set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> to have <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>
in such situations; set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> to have <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> in such situations, so that you can look at the stack
<a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="phasecont"></a>Variable <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a></h5></div></div></div><p>A similar variable, <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a>, controls the return
value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_phase.html" target="_top"><code class="function">PHASE</code></a> when the argument is an exact nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a>.
Namely, if <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it returns a floating-point zero;
if <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it returns an exact zero. Example:
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_phase.html" target="_top"><code class="function">PHASE</code></a> 2/3)</code></p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="complex-comp"></a>12.2.5. Complex Computations
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-5.html">[sec_12-1-5]</a></h3></div></div></div><p>Complex numbers can have a real part and an imaginary part of
different types. For example, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sqrtcm_isqrt.html" target="_top"><code class="function">SQRT</code></a> -9.0)</code> evaluates to
the number <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(0 3.0)</code></span>,
which has a real part of exactly <code class="literal">0</code>,
not only <span class="data"><code class="literal">0.0</code></span>
(which would mean <span class="quote">“<span class="quote">approximately 0</span>”</span>).</p><p>The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> for this is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>)</code></span>, and <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>
<code class="varname">type-of-real-part</code>
<code class="varname">type-of-imaginary-part</code>)</code></span> in general.</p><p>The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>
<em class="replaceable"><code>type</code></em>)</code></span> is equivalent to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a>
<em class="replaceable"><code>type</code></em> <em class="replaceable"><code>type</code></em>)</code></span>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="complex-rational"></a>12.2.6. Rule of Canonical Representation
for Complex Rationals <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-5-3.html">[sec_12-1-5-3]</a></h3></div></div></div><p>Complex numbers can have a real part and an imaginary part of
different types. If the imaginary part is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> to <code class="literal">0</code>,
the number is automatically converted to a real number.</p><p>This has the advantage that
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((x (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sqrtcm_isqrt.html" target="_top"><code class="function">SQRT</code></a> -9.0))) (* x x))</code> - instead of
evaluating to <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(-9.0 0.0)</code></span>,
with <em class="replaceable"><code>x</code></em> = <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(0.0 3.0)</code></span> -
evaluates to <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(-9.0 0)</code></span> =
<span class="data"><code class="literal">-9.0</code></span>,
with <em class="replaceable"><code>x</code></em> = <span class="data"><code class="literal"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-11.html"><span class="data"><code class="literal">#C</code></span></a>(0 3.0)</code></span>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="random-state"></a>12.2.7. Random-State Operations
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_12-1-7.html">[sec_12-1-7]</a></h3></div></div></div><p>To ease reproducibility, the variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a> is
initialized to the same value on each invocation, so that
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code> <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> 1s0)'</pre><p>
will always print the same number.</p><p>If you want a new random state on each invocation, you can arrange
for that by using <a href="impnotes.html#init-func" class="olink">init function</a>: </p><pre class="screen">
<strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code> <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> "foo" :init-function (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-random-state.html" target="_top"><code class="function">MAKE-RANDOM-STATE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))))'
<strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code> <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> foo.mem <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> 1s0)'</pre><p>
or by placing <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-random-state.html" target="_top"><code class="function">MAKE-RANDOM-STATE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code> into your <a href="clisp.html#opt-norc" class="olink">RC file</a>.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="characters"></a>Chapter 13. Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-13.html">[chap-13]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#char-intro">13.1. Introduction to Characters sec_13-1</a></span></dt><dd><dl><dt><span class="section"><a href="#char-code">13.1.1. Function <code class="function">CHAR-CODE</code></a></span></dt><dt><span class="section"><a href="#base-char">13.1.2. Type <code class="classname">BASE-CHAR</code></a></span></dt><dt><span class="section"><a href="#char-width">13.1.3. Function <code class="function">EXT:CHAR-WIDTH</code></a></span></dt></dl></dd><dt><span class="section"><a href="#char-sets">13.2. Character sets</a></span></dt><dt><span class="section"><a href="#char-script">13.3. Character Scripts sec_13-1-2-1</a></span></dt><dt><span class="section"><a href="#char-attrib">13.4. Character Attributes sec_13-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#input-char">13.4.1. Input Characters</a></span></dt></dl></dd><dt><span class="section"><a href="#graph-char">13.5. Graphic Characters sec_13-1-4-1</a></span></dt><dt><span class="section"><a href="#alpha-char">13.6. Alphabetic Characters sec_13-1-4-2</a></span></dt><dt><span class="section"><a href="#char-case">13.7. Characters With Case sec_13-1-4-3</a></span></dt><dd><dl><dt><span class="section"><a href="#char-invertcase">13.7.1. Function <code class="function">EXT:CHAR-INVERTCASE</code></a></span></dt><dt><span class="section"><a href="#char-ext">13.7.2. Case of Implementation-Defined Characters sec_13-1-4-3-4</a></span></dt></dl></dd><dt><span class="section"><a href="#num-char">13.8. Numeric Characters sec_13-1-4-4</a></span></dt><dt><span class="section"><a href="#char-ord">13.9. Ordering of Characters sec_13-1-6</a></span></dt><dt><span class="section"><a href="#char-names">13.10. Character Names sec_13-1-7</a></span></dt><dt><span class="section"><a href="#clhs-newline">13.11. Treatment of Newline during Input and Output sec_13-1-8</a></span></dt><dt><span class="section"><a href="#char-int">13.12. Character Encodings sec_13-1-9</a></span></dt><dt><span class="section"><a href="#script-ext">13.13. Documentation of Implementation-Defined Scripts sec_13-1-10</a></span></dt><dt><span class="section"><a href="#char-platform-dep">13.14. Platform-Dependent Characters</a></span></dt><dt><span class="section"><a href="#char-bits">13.15. Obsolete Constants</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-intro"></a>13.1. Introduction to Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1.html">[sec_13-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#char-code">13.1.1. Function <code class="function">CHAR-CODE</code></a></span></dt><dt><span class="section"><a href="#base-char">13.1.2. Type <code class="classname">BASE-CHAR</code></a></span></dt><dt><span class="section"><a href="#char-width">13.1.3. Function <code class="function">EXT:CHAR-WIDTH</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="char-code"></a>13.1.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-code.html" target="_top"><code class="function">CHAR-CODE</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-code.html" target="_top"><code class="function">CHAR-CODE</code></a> takes values from <code class="literal">0</code> (inclusive) to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_char-code-limit.html" target="_top"><code class="constant">CHAR-CODE-LIMIT</code></a> (exclusive), i.e., the implementation
supports exactly <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_char-code-limit.html" target="_top"><code class="constant">CHAR-CODE-LIMIT</code></a> characters.</p><div class="table"><a id="char-code-limit-table"></a><p class="title"><strong>Table 13.1. Number of characters</strong></p><div class="table-contents"><table class="table" summary="Number of characters" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">binaries built</th><th align="center"><span class="strong"><strong>without</strong></span> <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> support</th><th align="center"><span class="strong"><strong>with</strong></span> <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> support</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_char-code-limit.html" target="_top"><code class="constant">CHAR-CODE-LIMIT</code></a></td><td align="center">2<sup>8</sup> = 256</td><td align="center">17 * 2<sup>16</sup> = 1114112</td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="base-char"></a>13.1.2. Type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-char.html" target="_top"><code class="classname">BASE-CHAR</code></a></h3></div></div></div><p>The types <code class="classname">EXT:STRING-CHAR</code> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_base-char.html" target="_top"><code class="classname">BASE-CHAR</code></a> are equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.
<code class="classname">EXT:STRING-CHAR</code> used to be available as
<code class="classname">STRING-CHAR</code> prior to removal from [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] by
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss026.html" target="_top">CHARACTER-PROPOSAL:2</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="char-width"></a>13.1.3. Function <a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a> <em class="replaceable"><code>char</code></em>)</code> returns the number of screen
columns occupied by <em class="replaceable"><code>char</code></em>. The value is </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">0</span></dt><dd>for non-spacing
characters (such as control characters and many combining
characters);</dd><dt><span class="term">2</span></dt><dd>for double-width East
Asian characters;</dd><dt><span class="term">1</span></dt><dd>for all other
characters.</dd></dl></div><p>
See also function <a class="link" href="#string-width" title="16.1.2. Function EXT:STRING-WIDTH"><code class="function">EXT:STRING-WIDTH</code></a>.
</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-sets"></a>13.2. Character sets</h2></div></div></div><p>The characters are ordered according to a superset of the
<a class="link" href="#charset-ASCII">ASCII character set</a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span> compile-time flag <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd>More precisely, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses the 21-bit <a class="ulink" href="http://www.unicode.org" target="_top">Unicode</a> <a class="ulink" href="http://www.unicode.org/unicode/reports/tr28/" target="_top">3.2</a>
character set (ISO 10646, also known as UCS-4).
</dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> compile-time flag <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd><p>More precisely, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses the ISO Latin-1 (ISO
8859-1) character set:
</p><div class="informaltable"><a id="latin-1-table"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr><th align="center"> </th><th align="center">#x0</th><th align="center">#x1</th><th align="center">#x2</th><th align="center">#x3</th><th align="center">#x4</th><th align="center">#x5</th><th align="center">#x6</th><th align="center">#x7</th><th align="center">#x8</th><th align="center">#x9</th><th align="center">#xA</th><th align="center">#xB</th><th align="center">#xC</th><th align="center">#xD</th><th align="center">#xE</th><th align="center">#xF</th></tr></thead><tbody><tr><td align="center">#x00</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td></tr><tr><td align="center">#x10</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td><td align="center">**</td></tr><tr><td align="center">#x20</td><td align="center"> </td><td align="center">!</td><td align="center">"</td><td align="center">#</td><td align="center">$</td><td align="center">%</td><td align="center">&</td><td align="center">'</td><td align="center">(</td><td align="center">)</td><td align="center">*</td><td align="center">+</td><td align="center">,</td><td align="center">-</td><td align="center">.</td><td align="center">/</td></tr><tr><td align="center">#x30</td><td align="center">0</td><td align="center">1</td><td align="center">2</td><td align="center">3</td><td align="center">4</td><td align="center">5</td><td align="center">6</td><td align="center">7</td><td align="center">8</td><td align="center">9</td><td align="center">:</td><td align="center">;</td><td align="center"><</td><td align="center">=</td><td align="center">></td><td align="center">?</td></tr><tr><td align="center">#x40</td><td align="center">@</td><td align="center">A</td><td align="center">B</td><td align="center">C</td><td align="center">D</td><td align="center">E</td><td align="center">F</td><td align="center">G</td><td align="center">H</td><td align="center">I</td><td align="center">J</td><td align="center">K</td><td align="center">L</td><td align="center">M</td><td align="center">N</td><td align="center">O</td></tr><tr><td align="center">#x50</td><td align="center">P</td><td align="center">Q</td><td align="center">R</td><td align="center">S</td><td align="center">T</td><td align="center">U</td><td align="center">V</td><td align="center">W</td><td align="center">X</td><td align="center">Y</td><td align="center">Z</td><td align="center">[</td><td align="center">\</td><td align="center">]</td><td align="center">^</td><td align="center">_</td></tr><tr><td align="center">#x60</td><td align="center">`</td><td align="center">a</td><td align="center">b</td><td align="center">c</td><td align="center">d</td><td align="center">e</td><td align="center">f</td><td align="center">g</td><td align="center">h</td><td align="center">i</td><td align="center">j</td><td align="center">k</td><td align="center">l</td><td align="center">m</td><td align="center">n</td><td align="center">o</td></tr><tr><td align="center">#x70</td><td align="center">p</td><td align="center">q</td><td align="center">r</td><td align="center">s</td><td align="center">t</td><td align="center">u</td><td align="center">v</td><td align="center">w</td><td align="center">x</td><td align="center">y</td><td align="center">z</td><td align="center">{</td><td align="center">|</td><td align="center">}</td><td align="center">~</td><td align="center"> </td></tr><tr><td align="center">#x80</td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">
</td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr><tr><td align="center">#x90</td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center">
</td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr><tr><td align="center">#xA0</td><td align="center"> </td><td align="center">¡</td><td align="center">¢</td><td align="center">£</td><td align="center">¤</td><td align="center">¥</td><td align="center">¦</td><td align="center">§</td><td align="center">¨</td><td align="center">©</td><td align="center">ª</td><td align="center">«</td><td align="center">¬</td><td align="center"></td><td align="center">®</td><td align="center">¯</td></tr><tr><td align="center">#xB0</td><td align="center">°</td><td align="center">±</td><td align="center">²</td><td align="center">³</td><td align="center">´</td><td align="center">µ</td><td align="center">¶</td><td align="center">·</td><td align="center">¸</td><td align="center">¹</td><td align="center">º</td><td align="center">»</td><td align="center">¼</td><td align="center">½</td><td align="center">¾</td><td align="center">¿</td></tr><tr><td align="center">#xC0</td><td align="center">À</td><td align="center">Á</td><td align="center">Â</td><td align="center">Ã</td><td align="center">Ä</td><td align="center">Å</td><td align="center">Æ</td><td align="center">Ç</td><td align="center">È</td><td align="center">É</td><td align="center">Ê</td><td align="center">Ë</td><td align="center">Ì</td><td align="center">Í</td><td align="center">Î</td><td align="center">Ï</td></tr><tr><td align="center">#xD0</td><td align="center">Ð</td><td align="center">Ñ</td><td align="center">Ò</td><td align="center">Ó</td><td align="center">Ô</td><td align="center">Õ</td><td align="center">Ö</td><td align="center">×</td><td align="center">Ø</td><td align="center">Ù</td><td align="center">Ú</td><td align="center">Û</td><td align="center">Ü</td><td align="center">Ý</td><td align="center">Þ</td><td align="center">ß</td></tr><tr><td align="center">#xE0</td><td align="center">à</td><td align="center">á</td><td align="center">â</td><td align="center">ã</td><td align="center">ä</td><td align="center">å</td><td align="center">æ</td><td align="center">ç</td><td align="center">è</td><td align="center">é</td><td align="center">ê</td><td align="center">ë</td><td align="center">ì</td><td align="center">í</td><td align="center">î</td><td align="center">ï</td></tr><tr><td align="center">#xF0</td><td align="center">ð</td><td align="center">ñ</td><td align="center">ò</td><td align="center">ó</td><td align="center">ô</td><td align="center">õ</td><td align="center">ö</td><td align="center">÷</td><td align="center">ø</td><td align="center">ù</td><td align="center">ú</td><td align="center">û</td><td align="center">ü</td><td align="center">ý</td><td align="center">þ</td><td align="center">ÿ</td></tr></tbody></table></div><p>
Here ** are control characters, not graphic
characters. (The characters left blank here cannot be represented in
this character set).
</p></dd></dl></div><div class="table"><a id="standard-char-table"></a><p class="title"><strong>Table 13.2. Standard characters</strong></p><div class="table-contents"><table class="table" summary="Standard characters" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">character</th><th align="center">code</th></tr></thead><tbody><tr><td align="center"><span class="keysym">#\Space</span></td><td align="center"><span class="keycode">#x20</span></td></tr><tr><td align="center"><span class="keysym">#\Newline</span></td><td align="center"><span class="keycode">#x0A</span></td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="semi-standard-char-table"></a><p class="title"><strong>Table 13.3. Semi-standard characters</strong></p><div class="table-contents"><table class="table" summary="Semi-standard characters" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">character</th><th align="center">code</th></tr></thead><tbody><tr><td align="center"><span class="keysym">#\Backspace</span></td><td align="center"><span class="keycode">#x08</span></td></tr><tr><td align="center"><span class="keysym">#\Tab</span></td><td align="center"><span class="keycode">#x09</span></td></tr><tr><td align="center"><span class="keysym">#\Linefeed</span></td><td align="center"><span class="keycode">#x0A</span></td></tr><tr><td align="center"><span class="keysym">#\Page</span></td><td align="center"><span class="keycode">#x0C</span></td></tr><tr><td align="center"><span class="keysym">#\Return</span></td><td align="center"><span class="keycode">#x0D</span></td></tr></tbody></table></div></div><br class="table-break" /><p><span class="keysym">#\Newline</span> is the <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>.</p><div class="table"><a id="extra-named-chars-table"></a><p class="title"><strong>Table 13.4. Additional Named Characters</strong></p><div class="table-contents"><table class="table" summary="Additional Named Characters" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">character</th><th align="center">code</th></tr></thead><tbody><tr><td align="center"><span class="keysym">#\Null</span></td><td align="center"><span class="keycode">#x00</span></td></tr><tr><td align="center"><span class="keysym">#\Bell</span></td><td align="center"><span class="keycode">#x07</span></td></tr><tr><td align="center"><span class="keysym">#\Escape</span></td><td align="center"><span class="keycode">#x1B</span></td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="ctrl-char-table"></a><p class="title"><strong>Table 13.5. Additional syntax for characters with code from
<span class="keycode">#x00</span> to <span class="keycode">#x1F</span>:</strong></p><div class="table-contents"><table class="table" summary="Additional syntax for characters with code from #x00 to #x1F:" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">character</th><th align="center">code</th></tr></thead><tbody><tr><td align="center"><span class="keysym">#\^@</span></td><td align="center"><span class="keycode">#x00</span></td></tr><tr><td align="center"><span class="keysym">#\^A</span> … <span class="keysym">#\^Z</span></td><td align="center"><span class="keycode">#x01</span> …
<span class="keycode">#x1A</span></td></tr><tr><td align="center"><span class="keysym">#\^[</span></td><td align="center"><span class="keycode">#x1B</span></td></tr><tr><td align="center"><span class="keysym">#\^\</span></td><td align="center"><span class="keycode">#x1C</span></td></tr><tr><td align="center"><span class="keysym">#\^]</span></td><td align="center"><span class="keycode">#x1D</span></td></tr><tr><td align="center"><span class="keysym">#\^^</span></td><td align="center"><span class="keycode">#x1E</span></td></tr><tr><td align="center"><span class="keysym">#\^_</span></td><td align="center"><span class="keycode">#x1F</span></td></tr></tbody></table></div></div><br class="table-break" /><p>See also <a class="xref" href="#sharpsign-backslash" title="2.6.1. Sharpsign Backslash sec_2-4-8-1">Section 2.6.1, “Sharpsign Backslash sec_2-4-8-1”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-script"></a>13.3. Character Scripts
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-2-1.html">[sec_13-1-2-1]</a></h2></div></div></div><p>The only defined character script is the type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
itself.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-attrib"></a>13.4. Character Attributes
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-3.html">[sec_13-1-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#input-char">13.4.1. Input Characters</a></span></dt></dl></div><p>Characters have no implementation-defined or <a class="xref" href="#CLtL1" title="Common Lisp: the Language (1st Edition)">[<abbr class="abbrev">CLtL1</abbr>]</a> font and bit
attributes. All characters are simple characters.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="input-char"></a>13.4.1. Input Characters</h3></div></div></div><p>For backward compatibility, there is a class <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>
representing either a character with font and bits, or a keystroke.
The following functions work with objects of types <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
and <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>.
Note that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> are equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> on objects of type
<a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">EXT:CHAR-FONT-LIMIT</code> = 16</span></dt><dd>The system uses only font 0.
</dd><dt><span class="term"><code class="constant">EXT:CHAR-BITS-LIMIT</code> = 16</span></dt><dd><p>Character bits:
</p><div class="informaltable"><a id="bit-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">key</th><th align="center">value</th></tr></thead><tbody><tr><td align="center"><code class="constant">:CONTROL</code></td><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-CONTROL-BIT</code></a></td></tr><tr><td align="center"><code class="constant">:META</code></td><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-META-BIT</code></a></td></tr><tr><td align="center"><code class="constant">:SUPER</code></td><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-SUPER-BIT</code></a></td></tr><tr><td align="center"><code class="constant">:HYPER</code></td><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-HYPER-BIT</code></a></td></tr></tbody></table></div></dd><dt><span class="term"><code class="code">(<code class="function">EXT:CHAR-FONT</code>
<em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns the font of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>.
</dd><dt><span class="term"><code class="code">(<code class="function">EXT:CHAR-BITS</code>
<em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns the bits of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>.
</dd><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-CHAR</code>
<em class="replaceable"><code>char</code></em> [<em class="replaceable"><code>bits</code></em>
[<em class="replaceable"><code>font</code></em>]])</code></span></dt><dd>returns a new <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if such a
character cannot be created.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:CHAR-BIT</code>
<em class="replaceable"><code>object</code></em> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if the named bit is set in <em class="replaceable"><code>object</code></em>,
else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:SET-CHAR-BIT</code>
<em class="replaceable"><code>object</code></em> <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>new-value</code></em>)</code></span></dt><dd>returns a new <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> with the named bit set or
unset, depending on the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> <em class="replaceable"><code>new-value</code></em>.
</dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> is <span class="strong"><strong>not</strong></span> a subtype of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd>The system itself uses this <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> type only to
mention special keys and <span class="keycap"><strong>Control</strong></span>/<span class="keycap"><strong>Alternate</strong></span>/<span class="keycap"><strong>Shift</strong></span> key status on return from
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a>)</code>.</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="graph-char"></a>13.5. Graphic Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-1.html">[sec_13-1-4-1]</a></h2></div></div></div><p>The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_g.html#graphic">graphic</a> characters are those <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters which are
defined by the <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> standard, excluding the ranges
<span class="keycode">U0000</span> … <span class="keycode">U001F</span> and
<span class="keycode">U007F</span> … <span class="keycode">U009F</span>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="alpha-char"></a>13.6. Alphabetic Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-2.html">[sec_13-1-4-2]</a></h2></div></div></div><p>The alphabetic characters are those <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters which are
defined as letters by the <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> standard, e.g., the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters
</p><div class="literallayout"><p><code class="literal"> ABCDEFGHIJKLMNOPQRSTUVWXYZ<br />
abcdefghijklmnopqrstuvwxyz</code></p></div><p>
and the international alphabetic characters from the character set:
</p><div class="literallayout"><p><code class="literal"> ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜßáíóúñѪºãõØøÀÃÕ</code></p></div><p>
etc.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-case"></a>13.7. Characters With Case
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-3.html">[sec_13-1-4-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#char-invertcase">13.7.1. Function <code class="function">EXT:CHAR-INVERTCASE</code></a></span></dt><dt><span class="section"><a href="#char-ext">13.7.2. Case of Implementation-Defined Characters sec_13-1-4-3-4</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="char-invertcase"></a>13.7.1. Function <a class="link" href="#char-invertcase" title="13.7.1. Function EXT:CHAR-INVERTCASE"><code class="function">EXT:CHAR-INVERTCASE</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#char-invertcase" title="13.7.1. Function EXT:CHAR-INVERTCASE"><code class="function">EXT:CHAR-INVERTCASE</code></a> <em class="replaceable"><code>char</code></em>)</code> returns the corresponding
character in the other case for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_charcm_schar.html" target="_top"><code class="function">CHAR</code></a>, i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-upca_har-downcase.html" target="_top"><code class="function">CHAR-UPCASE</code></a> for a
lowercase character and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-upca_har-downcase.html" target="_top"><code class="function">CHAR-DOWNCASE</code></a> for an uppercase character; for
a character that does not have a case attribute, the argument is returned.
See also <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:STRING-INVERTCASE</code></a> and <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:NSTRING-INVERTCASE</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="char-ext"></a>13.7.2. Case of Implementation-Defined Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-3-4.html">[sec_13-1-4-3-4]</a></h3></div></div></div><p>The characters with case are those <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters <em class="replaceable"><code>c</code></em>, for
which the upper case mapping <em class="replaceable"><code>uc</code></em> and the lower case mapping <em class="replaceable"><code>lc</code></em>
have the following properties:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><em class="replaceable"><code>uc</code></em> and <em class="replaceable"><code>lc</code></em> are different</li><li class="listitem"><em class="replaceable"><code>c</code></em> is one of <em class="replaceable"><code>uc</code></em> and <em class="replaceable"><code>lc</code></em></li><li class="listitem">the upper case mapping of <em class="replaceable"><code>uc</code></em> and of <em class="replaceable"><code>lc</code></em>
is <em class="replaceable"><code>uc</code></em></li><li class="listitem">the lower case mapping of <em class="replaceable"><code>uc</code></em> and of <em class="replaceable"><code>lc</code></em>
is <em class="replaceable"><code>lc</code></em></li></ul></div><p>The titlecase property of <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters has no equivalent in
<a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="num-char"></a>13.8. Numeric Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-4-4.html">[sec_13-1-4-4]</a></h2></div></div></div><p>The numeric characters are those <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> characters which are
defined as digits by the <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> standard.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-ord"></a>13.9. Ordering of Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-6.html">[sec_13-1-6]</a></h2></div></div></div><p>The characters are ordered according to their <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> code.</p><p>The functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-EQUAL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-NOT-EQUAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-LESSP</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-GREATERP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-NOT-GREATERP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR-NOT-LESSP</code></a> ignore bits and
font attributes of their arguments.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-names"></a>13.10. Character Names
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-7.html">[sec_13-1-7]</a></h2></div></div></div><p>Character names of non-<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters are the names defined by
<a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a>, with spaces replaced by underscores, and converted to upper case.
There are two exceptions, though:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="keysym">#\U0001F514</span></span></dt><dd> has the name <code class="literal">UNICODE_BELL</code>,
because the name <code class="literal">BELL</code> is already taken by the
<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> control character with code 7 (the audible bell character).
</dd><dt><span class="term"><span class="keysym">#\U0001F5CF</span></span></dt><dd>has the name <code class="literal">UNICODE_PAGE</code>,
because the name <code class="literal">PAGE</code> is already taken by the
<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> control character with code 12 (the form feed or page
separator character).</dd></dl></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clhs-newline"></a>13.11. Treatment of Newline during Input and Output
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-8.html">[sec_13-1-8]</a></h2></div></div></div><p>Newlines are written according to the stream's <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>, see the
function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a> and the description of <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s,
in particular, <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>s.
The default behavior is as follows:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>When writing to a file, <span class="keysym">#\Newline</span> is converted to
<span class="keycode">CR</span>/<span class="keycode">LF</span>. (This is the usual convention on <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a>.)
For example, <span class="keysym">#\Return</span>+<span class="keysym">#\Newline</span> is written as <span class="keycode">CR</span>/<span class="keycode">CR</span>/<span class="keycode">LF</span>.
</dd></dl></div><p>When reading from a file, <span class="keycode">CR</span>/<span class="keycode">LF</span> is converted to <span class="keysym">#\Newline</span>
(the usual convention on <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a>), and <span class="keycode">CR</span> not followed by <span class="keycode">LF</span> is
converted to <span class="keysym">#\Newline</span> as well (the usual conversion on MacOS, also used
by some programs on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>).
If you do not want this, i.e., if you really want to distinguish
<span class="keycode">LF</span>, <span class="keycode">CR</span> and <span class="keycode">CR</span>/<span class="keycode">LF</span>, you have to resort to
binary input (function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>).</p><p><strong>Justification. </strong><a class="ulink" href="http://www.unicode.org/reports/tr13/tr13-9.html" target="_top">Unicode
Newline Guidelines</a> say: <span class="quote">“<span class="quote">Even if you know which
characters represents NLF on your particular platform, on input and in
interpretation, treat CR, LF, CRLF, and NEL the same. Only on output do
you need to distinguish between them.</span>”</span></p><p><strong>Rationale. </strong>In <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, <span class="keysym">#\Newline</span> is identical to <span class="keysym">#\Linefeed</span>
(which is specifically permitted by the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] in
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-7.html">[sec_13-1-7]</a> <span class="quote">“<span class="quote">Character Names</span>”</span>).
Consider a file containing exactly this string:
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_concatenate.html" target="_top"><code class="function">CONCATENATE</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/any_string.html" target="_top"><code class="literal">STRING</code></a> "foo" (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> <span class="keysym">#\Linefeed</span>)
"bar" (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> <span class="keysym">#\Return</span>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> <span class="keysym">#\Linefeed</span>))</code>
Suppose we open it with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a> "foo" <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>)</code>.
What should <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> return?
Right now, it returns <span class="returnvalue">"foo"</span>
(the second <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> returns <span class="returnvalue">"bar"</span>
and reaches <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>).
If our i/o were <span class="quote">“<span class="quote">faithful</span>”</span>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> would have
returned the string <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_concatenate.html" target="_top"><code class="function">CONCATENATE</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/any_string.html" target="_top"><code class="literal">STRING</code></a> "foo" (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a>
<span class="keysym">#\Linefeed</span>) "bar")</code>, i.e., a string with an embedded <span class="keysym">#\Newline</span>
between <span class="returnvalue">"foo"</span>
and <span class="returnvalue">"bar"</span> (because a single <span class="keysym">#\Linefeed</span> is not a
<span class="keysym">#\Newline</span> in the specified <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a>, it will not make <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> return,
but it <span class="strong"><strong>is</strong></span> a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <span class="keysym">#\Newline</span>!) Even though the specification for
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> does not explicitly forbids newlines inside the returned
string, such behavior would be quite surprising, to say the least.
Moreover, this line (with an embedded <span class="keysym">#\Newline</span>) would be written as two
lines (when writing to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> of <code class="constant">:DOS</code>), because
the embedded <span class="keysym">#\Newline</span> would be written as <span class="keycode">CR</span>+<span class="keycode">LF</span>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-int"></a>13.12. Character Encodings
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-9.html">[sec_13-1-9]</a></h2></div></div></div><p>The integer returned by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-int.html" target="_top"><code class="function">CHAR-INT</code></a> is the same as the character's
code (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-code.html" target="_top"><code class="function">CHAR-CODE</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="script-ext"></a>13.13. Documentation of Implementation-Defined Scripts
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_13-1-10.html">[sec_13-1-10]</a></h2></div></div></div><p>See <a class="xref" href="#encoding" title="31.5. Encodings">Section 31.5, “Encodings”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-platform-dep"></a>13.14. Platform-Dependent Characters</h2></div></div></div><p>The characters that are not <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_g.html#graphic">graphic</a> chars and the space character
have names:</p><div class="table"><a id="dos-win32-chars-table"></a><p class="title"><strong>Table 13.6. Additional characters (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>)</strong></p><div class="table-contents"><table class="table" summary="Additional characters (Win32 platform only.)" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">code</th><th align="center">char</th></tr></thead><tbody><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x00)</code></td><td align="center"><span class="keysym">#\Null</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x07)</code></td><td align="center"><span class="keysym">#\Bell</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x08)</code></td><td align="center"><span class="keysym">#\Backspace</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x09)</code></td><td align="center"><span class="keysym">#\Tab</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0A)</code></td><td align="center"><span class="keysym">#\Newline</span></td><td align="center"><span class="keysym">#\Linefeed</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0B)</code></td><td align="center"><span class="keysym">#\Code11</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0C)</code></td><td align="center"><span class="keysym">#\Page</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0D)</code></td><td align="center"><span class="keysym">#\Return</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1A)</code></td><td align="center"><span class="keysym">#\Code26</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1B)</code></td><td align="center"><span class="keysym">#\Escape</span></td><td align="center"><span class="keysym">#\Esc</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x20)</code></td><td align="center"><span class="keysym">#\Space</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x7F)</code></td><td align="center"><span class="keysym">#\Rubout</span></td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="unix-chars-table"></a><p class="title"><strong>Table 13.7. Additional characters (<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span>)</strong></p><div class="table-contents"><table class="table" summary="Additional characters (UNIX platform only.)" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">code</th><th align="center">char</th></tr></thead><tbody><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x00)</code></td><td align="center"><span class="keysym">#\Null</span></td><td align="center"><span class="keysym">#\Nul</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x01)</code></td><td align="center"><span class="keysym">#\Soh</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x02)</code></td><td align="center"><span class="keysym">#\Stx</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x03)</code></td><td align="center"><span class="keysym">#\Etx</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x04)</code></td><td align="center"><span class="keysym">#\Eot</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x05)</code></td><td align="center"><span class="keysym">#\Enq</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x06)</code></td><td align="center"><span class="keysym">#\Ack</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x07)</code></td><td align="center"><span class="keysym">#\Bell</span></td><td align="center"><span class="keysym">#\Bel</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x08)</code></td><td align="center"><span class="keysym">#\Backspace</span></td><td align="center"><span class="keysym">#\Bs</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x09)</code></td><td align="center"><span class="keysym">#\Tab</span></td><td align="center"><span class="keysym">#\Ht</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0A)</code></td><td align="center"><span class="keysym">#\Newline</span></td><td align="center"><span class="keysym">#\Nl</span></td><td align="center"><span class="keysym">#\Linefeed</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0B)</code></td><td align="center"><span class="keysym">#\Vt</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0C)</code></td><td align="center"><span class="keysym">#\Page</span></td><td align="center"><span class="keysym">#\Np</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0D)</code></td><td align="center"><span class="keysym">#\Return</span></td><td align="center"><span class="keysym">#\Cr</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0E)</code></td><td align="center"><span class="keysym">#\So</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x0F)</code></td><td align="center"><span class="keysym">#\Si</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x10)</code></td><td align="center"><span class="keysym">#\Dle</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x11)</code></td><td align="center"><span class="keysym">#\Dc1</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x12)</code></td><td align="center"><span class="keysym">#\Dc2</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x13)</code></td><td align="center"><span class="keysym">#\Dc3</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x14)</code></td><td align="center"><span class="keysym">#\Dc4</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x15)</code></td><td align="center"><span class="keysym">#\Nak</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x16)</code></td><td align="center"><span class="keysym">#\Syn</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x17)</code></td><td align="center"><span class="keysym">#\Etb</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x18)</code></td><td align="center"><span class="keysym">#\Can</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x19)</code></td><td align="center"><span class="keysym">#\Em</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1A)</code></td><td align="center"><span class="keysym">#\Sub</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1B)</code></td><td align="center"><span class="keysym">#\Escape</span></td><td align="center"><span class="keysym">#\Esc</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1C)</code></td><td align="center"><span class="keysym">#\Fs</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1D)</code></td><td align="center"><span class="keysym">#\Gs</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1E)</code></td><td align="center"><span class="keysym">#\Rs</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x1F)</code></td><td align="center"><span class="keysym">#\Us</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x20)</code></td><td align="center"><span class="keysym">#\Space</span></td><td align="center"><span class="keysym">#\Sp</span></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> #x7F)</code></td><td align="center"><span class="keysym">#\Rubout</span></td><td align="center"><span class="keysym">#\Delete</span></td><td align="center"><span class="keysym">#\Del</span></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="char-bits"></a>13.15. Obsolete Constants</h2></div></div></div><div class="table"><a id="char-bits-table"></a><p class="title"><strong>Table 13.8. Character bit constants (obsolete)</strong></p><div class="table-contents"><table class="table" summary="Character bit constants (obsolete)" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">constant</th><th align="center">value</th></tr></thead><tbody><tr><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-CONTROL-BIT</code></a></td><td align="center">1</td></tr><tr><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-META-BIT</code></a></td><td align="center">2</td></tr><tr><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-SUPER-BIT</code></a></td><td align="center">4</td></tr><tr><td align="center"><a class="link" href="#char-bits" title="13.15. Obsolete Constants"><code class="constant">EXT:CHAR-HYPER-BIT</code></a></td><td align="center">8</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="conses"></a>Chapter 14. Conses <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-14.html">[chap-14]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#cons-list">14.1. Conses as Lists sec_14-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#map-func">14.1.1. Mapping Functions</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="cons-list"></a>14.1. Conses as Lists
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_14-1-2.html">[sec_14-1-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#map-func">14.1.1. Mapping Functions</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="map-func"></a>14.1.1. Mapping Functions</h3></div></div></div><p><a id="mapcap"></a><strong>Function <a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPCAP</code></a>. </strong>The function <a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPCAP</code></a> is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPCAN</code></a>, except that it
concatenates the resulting lists with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_append.html" target="_top"><code class="function">APPEND</code></a> instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a>:
</p><pre class="programlisting">(<a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPCAP</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>) ≡
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_append.html" target="_top"><code class="function">APPEND</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPCAR</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>))</pre><p>
(Actually a bit more efficient that this would have been.)</p><p><a id="maplap"></a><strong>Function <a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPLAP</code></a>. </strong>The function <a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPLAP</code></a> is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPCON</code></a>, except that it
concatenates the resulting lists with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_append.html" target="_top"><code class="function">APPEND</code></a> instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a>:
</p><pre class="programlisting">(<a class="link" href="#mapcap" title="Function EXT:MAPCAP"><code class="function">EXT:MAPLAP</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>) ≡
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_append.html" target="_top"><code class="function">APPEND</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPLIST</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>))</pre><p>
(Actually a bit more efficient that this would have been.)</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="arrays"></a>Chapter 15. Arrays <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-15.html">[chap-15]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#array-elts">15.1. Array Elements sec_15-1-1</a></span></dt></dl></div><p><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a>. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a> can return specialized arrays for the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-element-type.html" target="_top"><code class="function">ARRAY-ELEMENT-TYPE</code></a>s
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 2)</code></span>,
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 4)</code></span>,
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 16)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 32)</code></span>, and, of course, the required
specializations <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_nil.html" target="_top"><code class="classname">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bit.html" target="_top"><code class="classname">BIT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</p><p><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_adjust-array.html" target="_top"><code class="function">ADJUST-ARRAY</code></a> for displaced arrays. </strong>An array to which another array is displaced should not be shrunk
(using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_adjust-array.html" target="_top"><code class="function">ADJUST-ARRAY</code></a>) in such a way that the other array points into
void space. This cannot be checked at the time <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_adjust-array.html" target="_top"><code class="function">ADJUST-ARRAY</code></a> is
called!</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="array-elts"></a>15.1. Array Elements
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_15-1-1.html">[sec_15-1-1]</a></h2></div></div></div><div class="table"><a id="array-limit-table"></a><p class="title"><strong>Table 15.1. Array limits</strong></p><div class="table-contents"><table class="table" summary="Array limits" border="1"><colgroup><col align="center" class="vars" /><col align="center" class="b32" /><col align="center" class="b64" /></colgroup><thead><tr><th align="center">CPU type</th><th align="center">32-bit CPU</th><th align="center">64-bit CPU</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_array-rank-limit.html" target="_top"><code class="constant">ARRAY-RANK-LIMIT</code></a></td><td colspan="2" align="center">2<sup>12</sup> = 4096</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_array-_ension-limit.html" target="_top"><code class="constant">ARRAY-DIMENSION-LIMIT</code></a></td><td align="center">2<sup>24</sup>-1 = 16777215</td><td align="center">2<sup>32</sup>-1 = 4294967295</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_array-_l-size-limit.html" target="_top"><code class="constant">ARRAY-TOTAL-SIZE-LIMIT</code></a></td><td align="center">2<sup>24</sup>-1 = 16777215</td><td align="center">2<sup>32</sup>-1 = 4294967295</td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="strings"></a>Chapter 16. Strings <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-16.html">[chap-16]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#string-misc">16.1. Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#string-comp">16.1.1. String Comparison</a></span></dt><dt><span class="section"><a href="#string-width">16.1.2. Function <code class="function">EXT:STRING-WIDTH</code></a></span></dt><dt><span class="section"><a href="#string-invertcase">16.1.3. Functions <code class="function">EXT:STRING-INVERTCASE</code> and <code class="function">EXT:NSTRING-INVERTCASE</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="string-misc"></a>16.1. Miscellaneous</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#string-comp">16.1.1. String Comparison</a></span></dt><dt><span class="section"><a href="#string-width">16.1.2. Function <code class="function">EXT:STRING-WIDTH</code></a></span></dt><dt><span class="section"><a href="#string-invertcase">16.1.3. Functions <code class="function">EXT:STRING-INVERTCASE</code> and <code class="function">EXT:NSTRING-INVERTCASE</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="string-comp"></a>16.1.1. String Comparison</h3></div></div></div><p>String comparison (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING<</code></a> and friends) is based on the
function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_chareqcm__ar-not-lessp.html" target="_top"><code class="function">CHAR<=</code></a> (see <a class="xref" href="#char-ord" title="13.9. Ordering of Characters sec_13-1-6">Section 13.9, “Ordering of Characters sec_13-1-6”</a>).
Therefore diphthongs do <span class="strong"><strong>not</strong></span> obey the usual national rules. Example:
<code class="literal">o < oe < z < ö</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="string-width"></a>16.1.2. Function <a class="link" href="#string-width" title="16.1.2. Function EXT:STRING-WIDTH"><code class="function">EXT:STRING-WIDTH</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#string-width" title="16.1.2. Function EXT:STRING-WIDTH"><code class="function">EXT:STRING-WIDTH</code></a> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>start</code></em>
<em class="replaceable"><code>end</code></em>)</code> returns the number of screen columns occupied by
<em class="replaceable"><code>string</code></em>. This is computed as the sum of all <a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a>s of all
of the <em class="replaceable"><code>string</code></em>'s characters:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reduce.html" target="_top"><code class="function">REDUCE</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pl.html" target="_top"><code class="function">+</code></a> <em class="replaceable"><code>string</code></em> <code class="constant">:KEY</code> #'<a class="link" href="#char-width" title="13.1.3. Function EXT:CHAR-WIDTH"><code class="function">EXT:CHAR-WIDTH</code></a>)
</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="string-invertcase"></a>16.1.3. Functions <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:STRING-INVERTCASE</code></a>
and <a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:NSTRING-INVERTCASE</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:STRING-INVERTCASE</code></a> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>end</code></em>)</code>
and <code class="code">(<a class="link" href="#string-invertcase" title="16.1.3. Functions EXT:STRING-INVERTCASE and EXT:NSTRING-INVERTCASE"><code class="function">EXT:NSTRING-INVERTCASE</code></a> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>end</code></em>)</code>
are similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string-up_g-capitalize.html" target="_top"><code class="function">STRING-UPCASE</code></a> et al: they use <a class="link" href="#char-invertcase" title="13.7.1. Function EXT:CHAR-INVERTCASE"><code class="function">EXT:CHAR-INVERTCASE</code></a> to
invert the case of each characters in the argument string region.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="sequences"></a>Chapter 17. Sequences
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-17.html">[chap-17]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#seq-func-ext">17.1. Additional Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#trim-if">17.1.1. Function <code class="function">EXT:TRIM-IF</code></a></span></dt></dl></dd><dt><span class="section"><a href="#seq-macro-ext">17.2. Additional Macros</a></span></dt><dd><dl><dt><span class="section"><a href="#doseq">17.2.1. Macro <code class="function">EXT:DOSEQ</code></a></span></dt></dl></dd><dt><span class="section"><a href="#nreverse-nreconc">17.3. Functions <code class="function">NREVERSE</code> & <code class="function">NRECONC</code></a></span></dt><dt><span class="section"><a href="#rem-del">17.4. Functions <code class="function">REMOVE</code> & <code class="function">DELETE</code></a></span></dt><dt><span class="section"><a href="#sorting">17.5. Functions <code class="function">SORT</code> & <code class="function">STABLE-SORT</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="seq-func-ext"></a>17.1. Additional Functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#trim-if">17.1.1. Function <code class="function">EXT:TRIM-IF</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="trim-if"></a>17.1.1. Function <code class="function">EXT:TRIM-IF</code></h3></div></div></div><p>Function <code class="code">(<code class="function">EXT:TRIM-IF</code> <em class="replaceable"><code>predicate</code></em>
<em class="replaceable"><code>sequence</code></em>)</code> returns the portion of <em class="replaceable"><code>sequence</code></em> without the
leading and trailing elements which match <em class="replaceable"><code>predicate</code></em>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="seq-macro-ext"></a>17.2. Additional Macros</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#doseq">17.2.1. Macro <code class="function">EXT:DOSEQ</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="doseq"></a>17.2.1. Macro <a class="link" href="#doseq" title="17.2.1. Macro EXT:DOSEQ"><code class="function">EXT:DOSEQ</code></a></h3></div></div></div><p>For iteration through a sequence, a macro <a class="link" href="#doseq" title="17.2.1. Macro EXT:DOSEQ"><code class="function">EXT:DOSEQ</code></a>,
similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_dolist.html" target="_top"><code class="function">DOLIST</code></a>, may be used instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_map.html" target="_top"><code class="function">MAP</code></a>:</p><pre class="programlisting">
(<a class="link" href="#doseq" title="17.2.1. Macro EXT:DOSEQ"><code class="function">EXT:DOSEQ</code></a> (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>sequence-form</code></em> [<em class="replaceable"><code>result-form</code></em>])
{<em class="replaceable"><code>declaration</code></em>}*
{<em class="replaceable"><code>tag</code></em>|<em class="replaceable"><code>form</code></em>}*)
</pre><p><a class="link" href="#doseq" title="17.2.1. Macro EXT:DOSEQ"><code class="function">EXT:DOSEQ</code></a> forms are <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#iteration_form">iteration form</a>s.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="nreverse-nreconc"></a>17.3. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a> & <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_revappendcm_nreconc.html" target="_top"><code class="function">NRECONC</code></a></h2></div></div></div><p><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a>. </strong>The result of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a> is always <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to the argument.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a> on a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> swaps pairs of elements.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_reversecm_nreverse.html" target="_top"><code class="function">NREVERSE</code></a> on a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> swaps the first and the last
element and reverses the list chaining between them.</p><p><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_revappendcm_nreconc.html" target="_top"><code class="function">NRECONC</code></a>. </strong>The result of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_revappendcm_nreconc.html" target="_top"><code class="function">NRECONC</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to the first argument unless it is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case the result is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to the second argument.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="rem-del"></a>17.4. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE</code></a> & <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE-IF</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE-IF-NOT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_remove-du_e-duplicates.html" target="_top"><code class="function">REMOVE-DUPLICATES</code></a> return
their argument unchanged, if no element has to be removed.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE-IF</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE-IF-NOT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_remove-du_e-duplicates.html" target="_top"><code class="function">DELETE-DUPLICATES</code></a>
destructively modify their argument: If the argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>,
the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> parts are modified. If the argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> with
fill pointer, the fill pointer is lowered and the remaining elements are
compacted below the new fill pointer.</p><p><a id="count-ansi"></a><strong>Variable <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a>. </strong>Contrary to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss283.html" target="_top">RANGE-OF-COUNT-KEYWORD:NIL-OR-INTEGER</a>,
negative <code class="constant">:COUNT</code> keyword arguments are not allowed unless you set
<a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a> to a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> value, in which case <span class="quote">“<span class="quote">using a
negative integer value is functionally equivalent to using a value of
zero</span>”</span>, as per the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sorting"></a>17.5. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a> & <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">STABLE-SORT</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">STABLE-SORT</code></a> accept two additional keyword arguments
<code class="constant">:START</code> and <code class="constant">:END</code>:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>predicate</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:KEY</code> <code class="constant">:START</code> <code class="constant">:END</code>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">STABLE-SORT</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>predicate</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:KEY</code> <code class="constant">:START</code> <code class="constant">:END</code>)
</pre><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">STABLE-SORT</code></a> are identical.
They implement the mergesort algorithm.
Worst case complexity: <code class="varname">O(n*log(n))</code> comparisons,
where <em class="replaceable"><code>n</code></em> is the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> of the subsequence bounded
by the <code class="constant">:START</code> and <code class="constant">:END</code> arguments.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="hash"></a>Chapter 18. Hash Tables <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-18.html">[chap-18]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#hash-mod-key">18.1. Modifying Hash Table Keys sec_18-1-2</a></span></dt><dt><span class="section"><a href="#make-hash">18.2. Function <code class="function">MAKE-HASH-TABLE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#hashtable-gc-rehash">18.2.1. Interaction between <code class="classname">HASH-TABLE</code>s and garbage-collection</a></span></dt></dl></dd><dt><span class="section"><a href="#defhash">18.3. Macro <code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#ht-test">18.4. Function <code class="function">HASH-TABLE-TEST</code></a></span></dt><dt><span class="section"><a href="#dohash">18.5. Macro <code class="function">EXT:DOHASH</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="hash-mod-key"></a>18.1. Modifying Hash Table Keys
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_18-1-2.html">[sec_18-1-2]</a></h2></div></div></div><p>If you <span class="quote">“<span class="quote">visibly modify</span>”</span> a key, consequences are
<span class="emphasis"><em>unpredictable</em></span>:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<em class="replaceable"><code>hash-table</code></em> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a> :test '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a>)))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> <em class="replaceable"><code>hash-table</code></em> <em class="replaceable"><code>hash-table</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> <em class="replaceable"><code>hash-table</code></em> <em class="replaceable"><code>hash-table</code></em>))
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code> ;
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code></pre><p>
because <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a>)</code> modifies <em class="replaceable"><code>hash-table</code></em>, the very next
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> does <span class="strong"><strong>not</strong></span> find it in itself.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="make-hash"></a>18.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#hashtable-gc-rehash">18.2.1. Interaction between <code class="classname">HASH-TABLE</code>s and garbage-collection</a></span></dt></dl></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a> accepts two additional keyword arguments
<code class="constant">:INITIAL-CONTENTS</code> and <code class="constant">:WEAK</code>:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :TEST :INITIAL-CONTENTS :SIZE
:REHASH-SIZE :REHASH-THRESHOLD
:WARN-IF-NEEDS-REHASH-AFTER-GC :WEAK)
</pre><p>The <code class="constant">:TEST</code> argument can be, other than one of the symbols <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a>, one of the symbols <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> and
<a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>. Both of these tests use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> as the comparison
function; they differ in their performance characteristics.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a></span></dt><dd>This uses the fastest possible hash function.
Its drawback is that its hash codes become invalid at every <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion
(except if all keys are <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s),
thus requiring a reorganization of the hash table at the first
access after each <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion. Especially when generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is used,
which leads to frequent small <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions, large hash table with this test
can lead to scalability problems.</dd><dt><span class="term"><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a></span></dt><dd>This uses a slower hash function that has the
property that its hash codes for instances of the classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>,
<a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> (subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>) and
<a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STRUCTURE-STABLEHASH</code></a> (subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>) are
stable across GCs.
This test can thus avoid the scalability problems if all keys,
other than <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s, are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> or
<a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STRUCTURE-STABLEHASH</code></a> instances.</dd></dl></div><p>
One can recommend to use <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> for short-lived hash tables.
For tables with a longer lifespan which can be big or accessed
frequently, it is recommended to use <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>, and to modify the
objects that are used as its keys to become instances of
<a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> or <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STRUCTURE-STABLEHASH</code></a>.
</p><p>When the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> or the function <code class="literal">#'eq</code> is
used as a <code class="constant">:TEST</code> argument, the value of the variable
<strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*EQ-HASHFUNCTION*</code>
<a id="eq-hashfunction" class="indexterm"></a></em></strong> is used instead.
This value must be one of <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a>, <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>.</p><p>Similarly, the <code class="constant">:TEST</code> argument can also be one
of the symbols <code class="constant">EXT:FASTHASH-EQL</code>,
<code class="constant">EXT:STABLEHASH-EQL</code>,
<code class="constant">EXT:FASTHASH-EQUAL</code>,
<code class="constant">EXT:STABLEHASH-EQUAL</code>.
The same remarks apply as for <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> and <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>.
When the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> or the function <code class="literal">#'eql</code> is used
as a <code class="constant">:TEST</code> argument, the value of the variable
<strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*EQL-HASHFUNCTION*</code>
<a id="eql-hashfunction" class="indexterm"></a></em></strong> is used
instead; this value must be one of <code class="constant">EXT:FASTHASH-EQL</code>,
<code class="constant">EXT:STABLEHASH-EQL</code>.
Similarly, when the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> or the function <code class="literal">#'equal</code>
is used as a <code class="constant">:TEST</code> argument, the value of the variable
<strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*EQUAL-HASHFUNCTION*</code>
<a id="equal-hashfunction" class="indexterm"></a></em></strong> is used
instead; this value must be one of <code class="constant">EXT:FASTHASH-EQUAL</code>,
<code class="constant">EXT:STABLEHASH-EQUAL</code>.</p><p>The <code class="constant">:WARN-IF-NEEDS-REHASH-AFTER-GC</code> argument,
if true, causes a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> to be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed when an object is stored
into the table which will force table reorganizations at the first
access of the table after each <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.
This keyword argument can be used to check whether <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>
should be preferred over <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> for a particular table.
Use <code class="function">HASH-TABLE-WARN-IF-NEEDS-REHASH-AFTER-GC</code>
to check and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> this parameter after the table has been created.</p><p>The <code class="constant">:INITIAL-CONTENTS</code> argument is an
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> that is used to initialize the new hash table.</p><p>The <code class="constant">:REHASH-THRESHOLD</code> argument is ignored.</p><p>The <code class="constant">:WEAK</code> argument can take the following values:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (default)</td></tr><tr><td><code class="constant">:KEY</code></td></tr><tr><td><code class="constant">:VALUE</code></td></tr><tr><td><code class="constant">:KEY-AND-VALUE</code></td></tr><tr><td><code class="constant">:KEY-OR-VALUE</code></td></tr></table><p>
and specifies whether the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> is <span class="emphasis"><em>weak</em></span>:
if the key, value, either or both are not accessible for the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion
purposes, i.e., if they are only accessible via weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s
and <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>s, it is <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed and removed from the weak
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>.</p><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able predicate <code class="function">EXT:HASH-TABLE-WEAK-P</code>
checks whether the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> is weak.</p><p>Note that the only test that makes sense for weak hash tables are
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> and its variants <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a> and <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a>.</p><p>Just like all other <a class="link" href="#weak" title="31.7. Weak Objects">weak objects</a>, weak
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s cannot be printed readably.</p><p>See also <a class="xref" href="#weak-ht" title="31.7.9. Weak Hash Tables">Section 31.7.9, “Weak Hash Tables”</a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="hashtable-gc-rehash"></a>18.2.1. Interaction between <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s and <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion</h3></div></div></div><p>When a hash table contains keys to be compared by identity - such
as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>s in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s with the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>;
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es in tables which test with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>;
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s in tables which test with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a>;
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> instances in tables which
test with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a>;
- the hash code will in general depend on the object's address in
memory. Therefore it will in general be invalidated after a <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion,
and the hash table's internal structure must be recomputed at the next
table access.</p><p>While <code class="constant">:WARN-IF-NEEDS-REHASH-AFTER-GC</code> can help
checking the efficiency of a particular <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>, the variable
<strong class="first"><em class="firstterm"><a class="link" href="#hashtable-gc-rehash-warn"><code class="varname">CUSTOM:*WARN-ON-HASHTABLE-NEEDING-REHASH-AFTER-GC*</code></a>
<a id="hashtable-gc-rehash-warn" class="indexterm"></a></em></strong>
achieves the same effect for all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s in the system at once:
when <a class="link" href="#hashtable-gc-rehash-warn"><code class="varname">CUSTOM:*WARN-ON-HASHTABLE-NEEDING-REHASH-AFTER-GC*</code></a> is true and a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> needs to be rehashed after a <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion, a warning is
issued that shows the inefficient <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>.</p><p>What can be done to avoid the inefficiencies detected by these warnings?
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">In many cases you can solve the problem
by using the <code class="function">STABLEHASH</code> variant of the hash
test.</li><li class="listitem">In other cases, namely <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> or
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> instances, you can solve the problem by making
the key object classes inherit from <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> or
<a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STRUCTURE-STABLEHASH</code></a>, respectively.</li><li class="listitem">In the remaining cases, you should store a hash key
inside the object, of which you can guarantee uniqueness through
your application (for example the ID of an object in a database, or
the serial number of an object), and use this key as hash key
instead of the original object.</li></ol></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="defhash"></a>18.3. Macro <a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a></h2></div></div></div><p>You can define a new hash table test using the macro
<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a>: <code class="code">(<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a> test-name <em class="replaceable"><code>test-function</code></em> <em class="replaceable"><code>hash-function</code></em>)</code>, after
which <em class="replaceable"><code>name</code></em> can be passed as the <code class="constant">:TEST</code> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a>.
E.g.: </p><pre class="programlisting">(<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a> string <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a>)
⇒ <code class="computeroutput">STRING</code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-hash-table.html" target="_top"><code class="function">MAKE-HASH-TABLE</code></a> :test 'string)
⇒ <code class="computeroutput">#S(HASH-TABLE :TEST (#<SYSTEM-FUNCTION STRING=> . #<SYSTEM-FUNCTION SXHASH>))</code></pre><p>
(which is not too useful because it is equivalent to an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> but less efficient).</p><p>The fundamental requirement is that the <em class="replaceable"><code>test-function</code></em> and <em class="replaceable"><code>hash-function</code></em> are
consistent: </p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>test-function</code></em> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>y</code></em>) ⇒
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>hash-function</code></em> <em class="replaceable"><code>x</code></em>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>hash-function</code></em> <em class="replaceable"><code>y</code></em>))</pre><p>
This means that the following definition: </p><pre class="programlisting">
(<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a> number <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a>)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">broken!</span></em></pre><p>
is <span class="strong"><strong>not</strong></span> correct because </p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> 1 1d0)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">same object!</span></em>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a> 1) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a> 1d0))
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">different buckets!</span></em></pre><p>
The correct way is, e.g.: </p><pre class="programlisting">
(<a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a> number <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (x) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html" target="_top"><code class="function">SXHASH</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a> x '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>))))</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Note that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>ing to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a> does <span class="strong"><strong>not</strong></span> cons up
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> objects while <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>ing to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> does.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ht-test"></a>18.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a></h2></div></div></div><p>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a> returns either one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:FASTHASH-EQ</code></a></td><td><code class="constant">EXT:FASTHASH-EQUAL</code></td></tr><tr><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="constant">EXT:STABLEHASH-EQ</code></a></td><td><code class="constant">EXT:STABLEHASH-EQUAL</code></td></tr><tr><td><code class="constant">EXT:FASTHASH-EQL</code></td><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a></td></tr><tr><td><code class="constant">EXT:STABLEHASH-EQL</code></td><td> </td></tr></table><p>
(but <span class="strong"><strong>not</strong></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> nor <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> anymore), or, for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s
created with a user-defined <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a> (see macro <a class="link" href="#defhash" title="18.3. Macro EXT:DEFINE-HASH-TABLE-TEST"><code class="function">EXT:DEFINE-HASH-TABLE-TEST</code></a>),
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> cell <span class="returnvalue">(<em class="replaceable"><code>test-function</code></em> . <em class="replaceable"><code>hash-function</code></em>)</span>.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dohash"></a>18.5. Macro <a class="link" href="#dohash" title="18.5. Macro EXT:DOHASH"><code class="function">EXT:DOHASH</code></a></h2></div></div></div><p>For iteration through a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>, a macro <a class="link" href="#dohash" title="18.5. Macro EXT:DOHASH"><code class="function">EXT:DOHASH</code></a>,
similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_dolist.html" target="_top"><code class="function">DOLIST</code></a>, can be used instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_maphash.html" target="_top"><code class="function">MAPHASH</code></a>:</p><pre class="programlisting">
(<a class="link" href="#dohash" title="18.5. Macro EXT:DOHASH"><code class="function">EXT:DOHASH</code></a> (<em class="replaceable"><code>key-var</code></em> <em class="replaceable"><code>value-var</code></em> <em class="replaceable"><code>hash-table-form</code></em> [<em class="replaceable"><code>resultform</code></em>])
{<em class="replaceable"><code>declaration</code></em>}*
{<em class="replaceable"><code>tag</code></em>|<em class="replaceable"><code>form</code></em>}*)
</pre><p><a class="link" href="#dohash" title="18.5. Macro EXT:DOHASH"><code class="function">EXT:DOHASH</code></a> forms are <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#iteration_form">iteration form</a>s.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="filenames"></a>Chapter 19. Filenames
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-19.html">[chap-19]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#path-components">19.1. Pathname Components sec_19-2-1</a></span></dt><dd><dl><dt><span class="section"><a href="#path-dir-canon">19.1.1. Directory canonicalization</a></span></dt><dt><span class="section"><a href="#path-platform-specific">19.1.2. Platform-specific issues</a></span></dt></dl></dd><dt><span class="section"><a href="#unspecific">19.2. :UNSPECIFIC as a Component Value sec_19-2-2-2-3</a></span></dt><dt><span class="section"><a href="#path-external-notation">19.3. External notation</a></span></dt><dt><span class="section"><a href="#log-path">19.4. Logical Pathnames sec_19-3</a></span></dt><dt><span class="section"><a href="#filename-misc">19.5. Miscellaneous</a></span></dt><dd><dl><dt><span class="section"><a href="#translate-pathname">19.5.1. Function <code class="function">TRANSLATE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#translate-logpath">19.5.2. Function <code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#parsename">19.5.3. Function <code class="function">PARSE-NAMESTRING</code></a></span></dt><dt><span class="section"><a href="#pathmerge">19.5.4. Function <code class="function">MERGE-PATHNAMES</code></a></span></dt><dt><span class="section"><a href="#load-lpt">19.5.5. Function <code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a></span></dt><dt><span class="section"><a href="#absolute-pathname">19.5.6. Function <code class="function">EXT:ABSOLUTE-PATHNAME</code></a></span></dt></dl></dd></dl></div><p>For most operations, pathnames denoting files and pathnames
denoting directories cannot be used interchangeably.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd>For example, <code class="filename">#P"foo/bar"</code> denotes
the file <code class="filename">#P"bar"</code> in the directory <code class="filename">#P"foo"</code>,
while <code class="filename">#P"foo/bar/"</code> denotes the subdirectory
<code class="filename">#P"bar"</code> of the directory <code class="filename">#P"foo"</code>.
</dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>For example, <code class="filename">#P"foo\\bar"</code>
denotes the file <code class="filename">#P"bar"</code> in the directory <code class="filename">#P"foo"</code>,
while <code class="filename">#P"foo\\bar\\"</code> denotes the subdirectory
<code class="filename">#P"bar"</code> of the directory <code class="filename">#P"foo"</code>.
</dd><dt><a id="device-prefix"></a><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> platforms only.</span></span></span></dt><dd>User variable <strong class="first"><em class="firstterm"><a class="link" href="#device-prefix"><code class="varname">CUSTOM:*DEVICE-PREFIX*</code></a></em></strong>
controls translation between <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> pathnames
(e.g., <code class="filename">#P"/cygdrive/c/gnu/clisp/"</code>) and native
<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> pathnames (e.g., <code class="filename">#P"C:\\gnu\\clisp\\"</code>)
When it is set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, no translations occur and the <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> port
will not understand the native paths and the native <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> port will
not understand the <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> paths.
When its value is a string, it is used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> to
translate into the appropriate platform-specific representation,
so that on <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a>, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> "c:/gnu/clisp/")</code>
returns <code class="filename">#P"/cygdrive/c/gnu/clisp/"</code>,
while on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> "/cygdrive/c/gnu/clisp/")</code>
returns <code class="filename">#P"C:/gnu/clisp/"</code>.
The initial value is <code class="literal">"cygdrive"</code>, you should edit
<a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> to change it.</dd></dl></div><p>This is especially important for the
<a class="link" href="#dir" title="20.3.3. Function EXT:DIR">directory-handling functions</a>.</p><div class="table"><a id="min-filename-syntax-table"></a><p class="title"><strong>Table 19.1. The minimum filename syntax that may be used portably</strong></p><div class="table-contents"><table class="table" summary="The minimum filename syntax that may be used portably" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="left">pathname</th><th align="left">meaning</th></tr></thead><tbody><tr><td align="left"><code class="filename">"xxx"</code></td><td align="left">for a file with name <em class="replaceable"><code>xxx</code></em></td></tr><tr><td align="left"><code class="filename">"xxx.yy"</code></td><td align="left">for a file with name <em class="replaceable"><code>xxx</code></em> and type
<em class="replaceable"><code>yy</code></em></td></tr><tr><td align="left"><code class="filename">".yy"</code></td><td align="left">for a pathname with type <em class="replaceable"><code>yy</code></em> and no
name or with name <em class="replaceable"><code>.yy</code></em> and no type,
depending on the value of <a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a>.</td></tr></tbody></table></div></div><br class="table-break" /><p>Hereby <em class="replaceable"><code>xxx</code></em> denotes 1 to 8 characters,
and <em class="replaceable"><code>yy</code></em> denotes 1 to 3 characters, each of
which being either an alphanumeric character or the underscore
<span class="keysym">#\_</span>. Other properties of pathname syntax vary between
operating systems.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="path-components"></a>19.1. Pathname Components
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_19-2-1.html">[sec_19-2-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#path-dir-canon">19.1.1. Directory canonicalization</a></span></dt><dt><span class="section"><a href="#path-platform-specific">19.1.2. Platform-specific issues</a></span></dt></dl></div><p>When a pathname is to be fully specified (no wildcards), that
means that no <code class="constant">:WILD</code>, <code class="constant">:WILD-INFERIORS</code> is allowed, no wildcard
characters are allowed in the strings, and <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> may not
be allowed either.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="path-dir-canon"></a>19.1.1. Directory canonicalization</h3></div></div></div><p>As permitted by the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a> specification, the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>
directory component is canonicalized when the pathname is constructed:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><code class="filename">""</code> and
<code class="filename">"."</code> are removed</li><li class="listitem"><code class="filename">".."</code>,
<code class="filename">"*"</code>, and <code class="filename">"**"</code> are converted
to <code class="constant">:UP</code>, <code class="constant">:WILD</code> and <code class="constant">:WILD-INFERIORS</code>,
respectively</li><li class="listitem">patterns <code class="filename">foo/../</code> are
collapsed</li></ol></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="path-platform-specific"></a>19.1.2. Platform-specific issues</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><div class="variablelist"><p class="title"><strong>Pathname components</strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>host</code></em></span></dt><dd>always <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><em class="replaceable"><code>device</code></em></span></dt><dd>always <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><code class="code"><em class="replaceable"><code>directory</code></em> = (<em class="replaceable"><code>startpoint</code></em>
. <em class="replaceable"><code>subdirs</code></em>)</code></span></dt><dd><div class="informaltable"><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">element</th><th align="center">values</th><th align="center">meaning</th></tr></thead><tbody><tr><td align="center"><em class="replaceable"><code>startpoint</code></em></td><td align="center"><code class="constant">:RELATIVE</code> | <code class="constant">:ABSOLUTE</code></td><td align="center"> </td></tr><tr><td align="center"><em class="replaceable"><code>subdirs</code></em></td><td align="center"><span class="data"><code class="literal">()</code></span> | <span class="data"><code class="literal">(<em class="replaceable"><code>subdir</code></em>
. <em class="replaceable"><code>subdirs</code></em>)</code></span></td><td align="center"> </td></tr><tr><td align="center"><em class="replaceable"><code>subdir</code></em></td><td align="center"><code class="constant">:WILD-INFERIORS</code></td><td align="center"><code class="filename">**</code> or
<code class="filename">...</code>, all subdirectories</td></tr><tr><td align="center"><em class="replaceable"><code>subdir</code></em></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>,
may contain wildcard characters <code class="filename">"?"</code> and
<code class="filename">"*"</code> (may also be specified as <code class="constant">:WILD</code>)</td><td align="center"> </td></tr></tbody></table></div></dd><dt><span class="term"><em class="replaceable"><code>name</code></em><br /></span><span class="term"><em class="replaceable"><code>type</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>, may contain wildcard characters <code class="filename">"?"</code> and
<code class="filename">"*"</code> (may also be specified as <code class="constant">:WILD</code>)
</dd><dt><span class="term"><em class="replaceable"><code>version</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <code class="constant">:WILD</code> or <code class="constant">:NEWEST</code>
(after merging the defaults)</dd></dl></div><p>A <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> filename is <a class="link" href="#name-type-split" title="Name/type namestring split">split into name and type</a>.</p><div class="informaltable"><a id="unix-filename-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center">External notation:</td><td align="center">
<code class="filename">"server:sub1.typ/sub2.typ/name.typ"</code></td></tr><tr><td align="center">using defaults:</td><td align="center">
<code class="filename"> "sub1.typ/sub2.typ/name.typ"</code></td></tr><tr><td align="center">or</td><td align="center">
<code class="filename"> "name.typ"</code></td></tr><tr><td align="center">or</td><td align="center">
<code class="filename"> "sub1.typ/**/sub3.typ/x*.lisp"</code></td></tr><tr><td align="center">or similar.</td><td align="center"> </td></tr></tbody></table></div></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><div class="variablelist"><p class="title"><strong>Pathname components</strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>host</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>, wildcard characters may
occur but do not act as wildcards</dd><dt><span class="term"><em class="replaceable"><code>device</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <code class="constant">:WILD</code> or <code class="filename">A</code>|...|<code class="filename">Z</code>
</dd><dt><span class="term"><code class="code"><em class="replaceable"><code>directory</code></em> = (<em class="replaceable"><code>startpoint</code></em>
. <em class="replaceable"><code>subdirs</code></em>)</code></span></dt><dd><div class="informaltable"><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">element</th><th align="center">values</th><th align="center">meaning</th></tr></thead><tbody><tr><td align="center"><em class="replaceable"><code>startpoint</code></em></td><td align="center"><code class="constant">:RELATIVE</code> | <code class="constant">:ABSOLUTE</code></td><td align="center"> </td></tr><tr><td align="center"><em class="replaceable"><code>subdirs</code></em></td><td align="center"><span class="data"><code class="literal">()</code></span> | <span class="data"><code class="literal">(<em class="replaceable"><code>subdir</code></em>
. <em class="replaceable"><code>subdirs</code></em>)</code></span></td><td align="center"> </td></tr><tr><td align="center"><em class="replaceable"><code>subdir</code></em></td><td align="center"><code class="constant">:WILD-INFERIORS</code></td><td align="center"><code class="filename">**</code> or
<code class="filename">...</code>, all subdirectories</td></tr><tr><td align="center"><em class="replaceable"><code>subdir</code></em></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>,
may contain wildcard characters <code class="filename">"?"</code> and
<code class="filename">"*"</code> (may also be specified as <code class="constant">:WILD</code>)</td><td align="center"> </td></tr></tbody></table></div></dd><dt><span class="term"><em class="replaceable"><code>name</code></em><br /></span><span class="term"><em class="replaceable"><code>type</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>, may contain wildcard characters <code class="filename">"?"</code> and
<code class="filename">"*"</code> (may also be specified as <code class="constant">:WILD</code>)
</dd><dt><span class="term"><em class="replaceable"><code>version</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <code class="constant">:WILD</code> or <code class="constant">:NEWEST</code>
(after merging the defaults)</dd></dl></div><p>If <em class="replaceable"><code>host</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <em class="replaceable"><code>device</code></em> must be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p>A <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> filename is <a class="link" href="#name-type-split" title="Name/type namestring split">split into name and type</a>.</p><div class="informaltable"><a id="win32-filename-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center">External notation:</td><td align="center"><code class="filename">"A:\sub1.typ\sub2.typ\name.typ"</code></td></tr><tr><td align="center">using defaults:</td><td align="center"><code class="filename"> "\sub1.typ\sub2.typ\name.typ"</code></td></tr><tr><td align="center">or</td><td align="center"><code class="filename"> "name.typ"</code></td></tr><tr><td align="center">or</td><td align="center"><code class="filename">"*:\sub1.typ\**\sub3.typ\x*.lisp"</code></td></tr><tr><td align="center">or similar.</td><td align="center"> </td></tr></tbody></table></div><p>Instead of <code class="filename">"\"</code> one may use <code class="filename">"/"</code>, as usual for DOS
calls.</p><p>If <em class="replaceable"><code>host</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the <em class="replaceable"><code>directory</code></em>'s <em class="replaceable"><code>startpoint</code></em>
is not <code class="constant">:ABSOLUTE</code>, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a>
<em class="replaceable"><code>pathname</code></em>))</code> will not be the same as <em class="replaceable"><code>pathname</code></em>.</p></dd></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd>The wildcard characters: <code class="filename">"*"</code> matches any
sequence of characters, <code class="filename">"?"</code> matches any one character.
</dd></dl></div><p><a id="name-type-split"></a><strong>Name/type namestring split. </strong></p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><p>A filename is split into name and type according to the
following rule: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">if there is no <code class="filename">"."</code> in the filename, then the
<em class="replaceable"><code>name</code></em> is everything, <em class="replaceable"><code>type</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>;</li><li class="listitem">if there is a <code class="filename">"."</code>, then <em class="replaceable"><code>name</code></em> is the part
before and <em class="replaceable"><code>type</code></em> the part after the last dot.</li><li class="listitem"><p>if the only <code class="filename">"."</code> is the first character, then
the behavior depends on the value of the user variable
<strong class="first"><em class="firstterm"><a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a></em></strong>
which can be either
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:TYPE</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>name</code></em>, everything after the <code class="filename">"."</code>
is the <em class="replaceable"><code>type</code></em>; or</dd><dt><span class="term"><code class="constant">:NAME</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>type</code></em>, everything is the
<em class="replaceable"><code>name</code></em></dd></dl></div><p>
</p></li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Due to this name/type splitting rule, there are pathnames
that cannot result from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a>.
To get a pathname whose type contains a dot or whose name contains a
dot and whose type is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a> must be used. Example:
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a> <code class="constant">:NAME</code> "foo.bar")</code>.</p></div></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="unspecific"></a>19.2. :UNSPECIFIC as a Component Value
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_19-2-2-2-3.html">[sec_19-2-2-2-3]</a></h2></div></div></div><p>The symbol <code class="constant">:UNSPECIFIC</code> is not permitted as a
pathname component for any slot of any pathname.
It is also illegal to pass it as an argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a>,
although it <span class="strong"><strong>is</strong></span> a legal argument (treated as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_user-homedir-pathname.html" target="_top"><code class="function">USER-HOMEDIR-PATHNAME</code></a>.</p><p>The only use for <code class="constant">:UNSPECIFIC</code> is that it is
returned by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-_name-version.html" target="_top"><code class="function">PATHNAME-DEVICE</code></a> for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a>s, as required by
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_19-3-2-1.html">[sec_19-3-2-1]</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="path-external-notation"></a>19.3. External notation</h2></div></div></div><p>External notation of pathnames (cf. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a>), of course without spaces, [,],{,}:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><div class="informaltable"><a id="unix-path-external-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center">[ <code class="filename">"/"</code> ]</td><td align="center"><code class="filename">"/"</code> denotes absolute pathnames</td></tr><tr><td align="center">{ <em class="replaceable"><code>name</code></em> <code class="filename">"/"</code> }</td><td align="center">each <em class="replaceable"><code>name</code></em> is a subdirectory</td></tr><tr><td align="center">[ <em class="replaceable"><code>name</code></em> [<code class="filename">"."</code> <em class="replaceable"><code>type</code></em>] ]</td><td align="center">filename with type (extension)</td></tr></tbody></table></div><p>Name and type may be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s of any <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a>
(consisting of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#printing">printing</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, except <code class="filename">"/"</code>).</p></dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><div class="informaltable"><a id="win32-path-external-table"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><tbody><tr><td align="center">[ [<em class="replaceable"><code>drivespec</code></em>] : ]</td><td align="center">a letter <code class="filename">"*"</code>|<code class="filename">a</code>|...|<code class="filename">z</code>|<code class="filename">A</code>|...|<code class="filename">Z</code></td></tr><tr><td align="center">{ <em class="replaceable"><code>name</code></em> [. <em class="replaceable"><code>type</code></em>] \ }</td><td align="center">each <em class="replaceable"><code>name</code></em> is a subdirectory, <code class="filename">"\"</code> may be
replaced by <code class="filename">"/"</code></td></tr><tr><td align="center">[ <em class="replaceable"><code>name</code></em> [. <em class="replaceable"><code>type</code></em>] ]</td><td align="center">filename with type (extension)</td></tr></tbody></table></div><p>Name and type may be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s of any <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a>
(consisting of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#printing">printing</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, except <code class="filename">"/"</code>,
<code class="filename">"\"</code>, <code class="filename">":"</code>).</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="log-path"></a>19.4. Logical Pathnames
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_19-3.html">[sec_19-3]</a></h2></div></div></div><p>No notes.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="filename-misc"></a>19.5. Miscellaneous</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#translate-pathname">19.5.1. Function <code class="function">TRANSLATE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#translate-logpath">19.5.2. Function <code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#parsename">19.5.3. Function <code class="function">PARSE-NAMESTRING</code></a></span></dt><dt><span class="section"><a href="#pathmerge">19.5.4. Function <code class="function">MERGE-PATHNAMES</code></a></span></dt><dt><span class="section"><a href="#load-lpt">19.5.5. Function <code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a></span></dt><dt><span class="section"><a href="#absolute-pathname">19.5.6. Function <code class="function">EXT:ABSOLUTE-PATHNAME</code></a></span></dt></dl></div><p><a id="path-des"></a><strong>Pathname Designators. </strong>When <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> is also treated as a
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#pathname_designator">pathname designator</a>,
namely its <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_symbol-name.html" target="_top"><code class="function">SYMBOL-NAME</code></a> is converted to the
operating system's preferred pathname case.</p><p><a id="path-match"></a><strong>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-match-p.html" target="_top"><code class="function">PATHNAME-MATCH-P</code></a>. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-match-p.html" target="_top"><code class="function">PATHNAME-MATCH-P</code></a> does not interpret missing components as
wild.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="translate-pathname"></a>19.5.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a> accepts three additional keyword arguments:
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a> <em class="replaceable"><code>source</code></em>
<em class="replaceable"><code>from-wildname</code></em>
<em class="replaceable"><code>to-wildname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:ALL</code>
<code class="constant">:MERGE</code> <code class="constant">:ABSOLUTE</code>)</code></p><p>If <code class="constant">:ALL</code> is specified and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a list of all resulting
pathnames, corresponding to all matches of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname-match-p.html" target="_top"><code class="function">PATHNAME-MATCH-P</code></a>
<em class="replaceable"><code>source</code></em> <em class="replaceable"><code>from-wildname</code></em>)</code>, is
returned.</p><p>If <code class="constant">:MERGE</code> is specified and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, unspecified pieces of
<em class="replaceable"><code>to-pathname</code></em> are not replaced by
corresponding pieces of <em class="replaceable"><code>source</code></em>.</p><p>If <code class="constant">:ABSOLUTE</code> is specified and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the returned
pathnames are converted to absolute by merging in the current process'
directory, therefore rendering pathnames suitable for the OS and
external programs. So, to pass a pathname to an external program, you
do <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a> <em class="replaceable"><code>pathname</code></em>
#P"" #P"" <code class="constant">:ABSOLUTE</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code> or <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a>
(<a class="link" href="#absolute-pathname" title="19.5.6. Function EXT:ABSOLUTE-PATHNAME"><code class="function">EXT:ABSOLUTE-PATHNAME</code></a> <em class="replaceable"><code>pathname</code></em>))</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="translate-logpath"></a>19.5.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate_cal-pathname.html" target="_top"><code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate_cal-pathname.html" target="_top"><code class="function">TRANSLATE-LOGICAL-PATHNAME</code></a> accepts an additional keyword
argument <code class="constant">:ABSOLUTE</code>, similar to <a class="xref" href="#translate-pathname" title="19.5.1. Function TRANSLATE-PATHNAME">Section 19.5.1, “Function <code class="function">TRANSLATE-PATHNAME</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="parsename"></a>19.5.3. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a></h3></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>host</code></em> <em class="replaceable"><code>defaults</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>end</code></em>
<em class="replaceable"><code>junk-allowed</code></em>)</code>
returns a logical pathname only if <em class="replaceable"><code>host</code></em> is a
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_l.html#logical_host">logical host</a>
or <em class="replaceable"><code>host</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <em class="replaceable"><code>defaults</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a>.
To construct a logical pathname from a string, the function
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_logical-pathname.html" target="_top"><code class="function">LOGICAL-PATHNAME</code></a> can be used.</p><p>The [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] behavior of recognizing logical pathnames when
the <em class="replaceable"><code>string</code></em> begins with some alphanumeric characters followed by a
colon (<span class="keysym">#\:</span>) can be very confusing
(cf. <code class="filename">"c:/autoexec.bat"</code>,
<code class="filename">"home:.clisprc"</code> and
<code class="filename">"prep:/pub/gnu"</code>)
and therefore is disabled by default.
To enable the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] behavior, you should set <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> to non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
Note that this also disables treating <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s as <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>s.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pathmerge"></a>19.5.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a></h3></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> <em class="replaceable"><code>pathname</code></em>
[<em class="replaceable"><code>default-pathname</code></em>])</code> returns a
logical pathname only if
<em class="replaceable"><code>default-pathname</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_logical-pathname.html" target="_top"><code class="classname">LOGICAL-PATHNAME</code></a>.
To construct a logical pathname from a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, the function
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_logical-pathname.html" target="_top"><code class="function">LOGICAL-PATHNAME</code></a> can be used.</p><p>When both <em class="replaceable"><code>pathname</code></em> and <em class="replaceable"><code>default-pathname</code></em>
are relative pathnames, the behavior depends on <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a>: when it is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, then <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> retains its traditional behavior:
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> #P"x/" #P"y/")</code>
evaluates to <code class="filename">#P"x/"</code></p><p><strong>Rationale. </strong><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> is used to specify default components for
pathnames, so there is some analogy between
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> a b)</code> and
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> a b)</code>. Obviously, putting in the
same default a second time should do the same as putting it in once:
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> a b b)</code> is the same as <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> a b)</code>, so
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> a b) b)</code>
should be the same as <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> a b)</code>.
</p><p>(This question actually does matter because in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> there is no
distinction between <span class="quote">“<span class="quote">pathnames with defaults merged-in</span>”</span> and
<span class="quote">“<span class="quote">pathnames with defaults not yet applied</span>”</span>.)</p><p>Now, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> #P"x/" #P"y/")
#P"y/")</code> and <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> #P"x/" #P"y/")</code> are
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equal.html" target="_top"><code class="function">EQUAL</code></a> in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> (when <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>), but not in
implementations that strictly follow the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
In fact, the above <span class="emphasis"><em>twice-default = once-default</em></span>
rule holds for all pathnames in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p><p>Conversely, when <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the normal [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]
behavior is exhibited: <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> #P"x/" #P"y/")</code>
evaluates to <code class="filename">#P"y/x/"</code>.</p><p><strong>Rationale. </strong><span class="quote">“<span class="quote">merge</span>”</span> is <span class="emphasis"><em>merge</em></span> and
not <span class="emphasis"><em>or</em></span>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="load-lpt"></a>19.5.5. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load-logi_translations.html" target="_top"><code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a></h3></div></div></div><p>When the <em class="replaceable"><code>host</code></em> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load-logi_translations.html" target="_top"><code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a>
is not a defined logical host yet, we proceed as follows:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">If both <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s
<code class="envar">LOGICAL_HOST_<em class="replaceable"><code>host</code></em>_FROM</code> and
<code class="envar">LOGICAL_HOST_<em class="replaceable"><code>host</code></em>_TO</code> exist, then their values
define the map of the <em class="replaceable"><code>host</code></em>.</li><li class="listitem">If the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>
<code class="envar">LOGICAL_HOST_<em class="replaceable"><code>host</code></em></code> exists, its value is read from,
and the result is passed to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_logical-p_translations.html" target="_top"><code class="function">LOGICAL-PATHNAME-TRANSLATIONS</code></a>)</code>.</li><li class="listitem">Variable <a href="impnotes.html#load-lpt" class="olink"><code class="varname">CUSTOM:*LOAD-LOGICAL-PATHNAME-TRANSLATIONS-DATABASE*</code></a> is consulted.
Its value should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of files and/or directories,
which are searched for in the <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>, just like for <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a>.
When the element is a file, it is repeatedly <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> from,
<a class="ulink" href="http://www.franz.com/support/documentation/6.0/doc/pathnames.htm#load-logical-pathname-translations-2" target="_top">Allegro CL-style</a>,
odd objects being host names and even object being their
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_logical-p_translations.html" target="_top"><code class="function">LOGICAL-PATHNAME-TRANSLATIONS</code></a>.
When the element is a directory, a file, named <code class="filename"><em class="replaceable"><code>host</code></em></code>
or <code class="filename"><em class="replaceable"><code>host</code></em>.host</code>, in that directory, is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a>
from once, <a class="ulink" href="http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#logical-pathnames" target="_top">CMUCL-style</a>,
the object read being the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_logical-p_translations.html" target="_top"><code class="function">LOGICAL-PATHNAME-TRANSLATIONS</code></a> of the
<em class="replaceable"><code>host</code></em>.</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="absolute-pathname"></a>19.5.6. Function <a class="link" href="#absolute-pathname" title="19.5.6. Function EXT:ABSOLUTE-PATHNAME"><code class="function">EXT:ABSOLUTE-PATHNAME</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#absolute-pathname" title="19.5.6. Function EXT:ABSOLUTE-PATHNAME"><code class="function">EXT:ABSOLUTE-PATHNAME</code></a> <em class="replaceable"><code>pathname</code></em>)</code> converts the <em class="replaceable"><code>pathname</code></em>
to a physical pathname, then - if its directory component is not
absolute - converts it to an absolute pathname, by merging in the
current process' directory. This is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a>, except that it
does not verify that a file named by the <em class="replaceable"><code>pathname</code></em> exists, not even that
its directory exists. It does no filesystem accesses, except to
determine the current directory. This function is useful when you want
to save a pathname over time, or pass a pathname to an external
program.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="files"></a>Chapter 20. Files <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-20.html">[chap-20]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#dir-is-not-file">20.1. Directory is <span class="strong"><strong>not</strong></span> a file</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-path">20.1.1. Function <code class="function">EXT:PROBE-PATHNAME</code></a></span></dt></dl></dd><dt><span class="section"><a href="#file-func">20.2. File functions</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-file">20.2.1. Function <code class="function">PROBE-FILE</code></a></span></dt><dt><span class="section"><a href="#file-author">20.2.2. Function <code class="function">FILE-AUTHOR</code></a></span></dt><dt><span class="section"><a href="#del-file">20.2.3. Function <code class="function">DELETE-FILE</code></a></span></dt><dt><span class="section"><a href="#rename-file">20.2.4. Function <code class="function">RENAME-FILE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#dir-func">20.3. Directory functions</a></span></dt><dd><dl><dt><span class="section"><a href="#probe-dir">20.3.1. Function <code class="function">EXT:PROBE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#directory">20.3.2. Function <code class="function">DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#dir">20.3.3. Function <code class="function">EXT:DIR</code></a></span></dt><dt><span class="section"><a href="#cd">20.3.4. Function <code class="function">EXT:CD</code></a></span></dt><dt><span class="section"><a href="#default-dir">20.3.5. Function <code class="function">EXT:DEFAULT-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#make-dir">20.3.6. Function <code class="function">EXT:MAKE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#delete-dir">20.3.7. Function <code class="function">EXT:DELETE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#rename-dir">20.3.8. Function <code class="function">EXT:RENAME-DIRECTORY</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dir-is-not-file"></a>20.1. Directory is <span class="strong"><strong>not</strong></span> a file</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#probe-path">20.1.1. Function <code class="function">EXT:PROBE-PATHNAME</code></a></span></dt></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has traditionally taken the view that a directory is a
separate object and <span class="strong"><strong>not</strong></span> a special kind of file, so whenever the
standard says that a function operates on <span class="emphasis"><em>files</em></span>
without specifically mentioning that it also works on
<span class="emphasis"><em>directories</em></span>, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when passed a
directory.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> provides separate directory functions, such as
<a class="link" href="#delete-dir" title="20.3.7. Function EXT:DELETE-DIRECTORY"><code class="function">EXT:DELETE-DIRECTORY</code></a>, <a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a> et al.</p><p>You can use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> or <a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> to figure out whether a
given namestring refers to a file or a directory.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="probe-path"></a>20.1.1. Function <a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a></h3></div></div></div><p>Function <code class="code">(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> (<code class="constant">:ERROR</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code>
figures out whether the argument refers to an existing directory or an
existing regular file, and returns 4 values
if the filesystem object exists: </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a></li><li class="listitem"><a class="link" href="#absolute-pathname" title="19.5.6. Function EXT:ABSOLUTE-PATHNAME"><code class="function">EXT:ABSOLUTE-PATHNAME</code></a></li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-write-date.html" target="_top"><code class="function">FILE-WRITE-DATE</code></a></li><li class="listitem"><a class="link" href="#file-size"><code class="function">POSIX:FILE-SIZE</code></a></li></ol></div><p> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if it does not exist.
E.g., if you have a file <em class="replaceable"><code>file</code></em>, a directory <em class="replaceable"><code>directory</code></em>,
a symbolic link <code class="filename">link-file</code> pointing to <em class="replaceable"><code>file</code></em>
and a symbolic link <code class="filename">link-dir</code> pointing to <em class="replaceable"><code>directory</code></em>,
then</p><pre class="programlisting">
(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"filename")
⇒ <code class="computeroutput">#P"/.../filename"</code>
⇒ <code class="computeroutput">#P"/.../filename"</code>
⇒ <code class="computeroutput">3427467015</code>
⇒ <code class="computeroutput">3171976</code>
(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"filename/")
⇒ <code class="computeroutput">#P"/.../filename"</code>
⇒ <code class="computeroutput">#P"/.../filename"</code>
⇒ <code class="computeroutput">3427467015</code>
⇒ <code class="computeroutput">3171976</code>
(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"directory")
⇒ <code class="computeroutput">#P"/.../directory/"</code>
⇒ <code class="computeroutput">#P"/.../directory/"</code>
⇒ <code class="computeroutput">3426940352</code>
⇒ <code class="computeroutput">1024</code>
(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"directory/")
⇒ <code class="computeroutput">#P"/.../directory/"</code>
⇒ <code class="computeroutput">#P"/.../directory/"</code>
⇒ <code class="computeroutput">3426940352</code>
⇒ <code class="computeroutput">1024</code>
(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"link-file")
⇒ <code class="computeroutput">#P"/.../filename"</code>
⇒ <code class="computeroutput">#P"/.../link-file"</code>
⇒ <code class="computeroutput">3427467015</code>
⇒ <code class="computeroutput">3171976</code>
(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"link-file/")
⇒ <code class="computeroutput">#P"/.../filename"</code>
⇒ <code class="computeroutput">#P"/.../link-file"</code>
⇒ <code class="computeroutput">3427467015</code>
⇒ <code class="computeroutput">3171976</code>
(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"link-dir")
⇒ <code class="computeroutput">#P"/.../directory/"</code>
⇒ <code class="computeroutput">#P"/.../link-dir/"</code>
⇒ <code class="computeroutput">3426940352</code>
⇒ <code class="computeroutput">1024</code>
(<a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> #P"link-dir/")
⇒ <code class="computeroutput">#P"/.../directory/"</code>
⇒ <code class="computeroutput">#P"/.../link-dir/"</code>
⇒ <code class="computeroutput">3426940352</code>
⇒ <code class="computeroutput">1024</code>
</pre><p>This function may also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if, e.g., its argument resides
under a tree for which you do not have sufficient access privileges;
unless <code class="constant">:ERROR</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is returned instead.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="file-func"></a>20.2. File functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#probe-file">20.2.1. Function <code class="function">PROBE-FILE</code></a></span></dt><dt><span class="section"><a href="#file-author">20.2.2. Function <code class="function">FILE-AUTHOR</code></a></span></dt><dt><span class="section"><a href="#del-file">20.2.3. Function <code class="function">DELETE-FILE</code></a></span></dt><dt><span class="section"><a href="#rename-file">20.2.4. Function <code class="function">RENAME-FILE</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="probe-file"></a>20.2.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_probe-file.html" target="_top"><code class="function">PROBE-FILE</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_probe-file.html" target="_top"><code class="function">PROBE-FILE</code></a> cannot be used to check whether a directory exists.
Use functions <a class="link" href="#probe-dir" title="20.3.1. Function EXT:PROBE-DIRECTORY"><code class="function">EXT:PROBE-DIRECTORY</code></a>, <a class="link" href="#probe-path" title="20.1.1. Function EXT:PROBE-PATHNAME"><code class="function">EXT:PROBE-PATHNAME</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> for this.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="file-author"></a>20.2.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-author.html" target="_top"><code class="function">FILE-AUTHOR</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-author.html" target="_top"><code class="function">FILE-AUTHOR</code></a> always returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, because the operating systems
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is ported to do not store a file's author in the file system.
Some operating systems, such as <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, have the notion of a file's
<span class="emphasis"><em>owner</em></span>, and some other <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations return
the user name of the file owner. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does not do this, because
<span class="emphasis"><em>owner</em></span> and <span class="emphasis"><em>author</em></span> are not the
same; in particular, authorship is preserved by copying, while
ownership is not.</p><p>Use <a class="link" href="#file-owner"><code class="function">OS:FILE-OWNER</code></a>
to find the owner of the file. See also
<a class="link" href="#file-properties"><code class="function">OS:FILE-PROPERTIES</code></a>
(<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="del-file"></a>20.2.3. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_delete-file.html" target="_top"><code class="function">DELETE-FILE</code></a></h3></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_delete-file.html" target="_top"><code class="function">DELETE-FILE</code></a> <em class="replaceable"><code>pathname</code></em>)</code> deletes the pathname
<em class="replaceable"><code>pathname</code></em>, not its <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a>, and returns the absolute pathname it
actually removed or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <em class="replaceable"><code>pathname</code></em> did not exist.
When <em class="replaceable"><code>pathname</code></em> points to a file which is currently open in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>,
an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
To remove a directory, use <a class="link" href="#delete-dir" title="20.3.7. Function EXT:DELETE-DIRECTORY"><code class="function">EXT:DELETE-DIRECTORY</code></a> instead.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rename-file"></a>20.2.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_rename-file.html" target="_top"><code class="function">RENAME-FILE</code></a></h3></div></div></div><p>This functions accepts and extra keyword argument <code class="constant">:IF-EXISTS</code>.
When it is <code class="constant">:ERROR</code> (the default), an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the destination
pathname names an existing file, otherwise (e.g., if it is <code class="constant">:OVERWRITE</code>)
the destination file atomically overwritten.</p><p>When <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, only the standard two arguments are accepted,
and and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed when the destination pathname names an existing file.</p><p>This function cannot operate on directories,
use <a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a> to rename a directory.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dir-func"></a>20.3. Directory functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#probe-dir">20.3.1. Function <code class="function">EXT:PROBE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#directory">20.3.2. Function <code class="function">DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#dir">20.3.3. Function <code class="function">EXT:DIR</code></a></span></dt><dt><span class="section"><a href="#cd">20.3.4. Function <code class="function">EXT:CD</code></a></span></dt><dt><span class="section"><a href="#default-dir">20.3.5. Function <code class="function">EXT:DEFAULT-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#make-dir">20.3.6. Function <code class="function">EXT:MAKE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#delete-dir">20.3.7. Function <code class="function">EXT:DELETE-DIRECTORY</code></a></span></dt><dt><span class="section"><a href="#rename-dir">20.3.8. Function <code class="function">EXT:RENAME-DIRECTORY</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="probe-dir"></a>20.3.1. Function <a class="link" href="#probe-dir" title="20.3.1. Function EXT:PROBE-DIRECTORY"><code class="function">EXT:PROBE-DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#probe-dir" title="20.3.1. Function EXT:PROBE-DIRECTORY"><code class="function">EXT:PROBE-DIRECTORY</code></a> <em class="replaceable"><code>pathname</code></em>)</code> tests whether <em class="replaceable"><code>pathname</code></em> exists
and is a directory.
It will, unlike <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_probe-file.html" target="_top"><code class="function">PROBE-FILE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a>, not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>
if the parent directory of <em class="replaceable"><code>pathname</code></em> does not exist.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="directory"></a>20.3.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:FULL :CIRCLE <code class="constant">:IF-DOES-NOT-EXIST</code>)</code> can run in two modes:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If <em class="replaceable"><code>pathname</code></em> contains no name or type component, a
list of all matching directories is produced.
E.g., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "/etc/*/")</code> lists
all subdirectories in the directory
<code class="filename">#P"/etc/"</code>.</li><li class="listitem">Otherwise a list of all matching files is returned.
E.g., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "/etc/*")</code> lists all
regular files in the directory <code class="filename">#P"/etc/"</code>.
</li></ul></div><p>
If you want <span class="strong"><strong>all</strong></span> the files <span class="strong"><strong>and</strong></span> subdirectories in the current directory,
you should use <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "*/") (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "*"))</code>.
If you want all the files and subdirectories in all the subdirectories
under the current directory (similar to the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html"><span class="command"><strong>ls
<code class="option">-R</code></strong></span></a> <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> command), use
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "**/") (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> "**/*"))</code>.</p><div class="variablelist"><p class="title"><strong>Keyword arguments accepted by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="constant">:FULL</code></span></dt><dd>If this argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, additional
information is returned: for each matching file you get a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of
at least four elements <span class="returnvalue">(<em class="replaceable"><code>file-pathname</code></em>
<em class="replaceable"><code>file-truename</code></em>
<em class="replaceable"><code>file-write-date-as-decoded-time</code></em>
<em class="replaceable"><code>file-length</code></em>)</span>.
</dd><dt><span class="term"><code class="constant">:CIRCLE</code></span></dt><dd>If this argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> avoids
endless loops that may result from symbolic links.
</dd><dt><span class="term"><code class="constant">:IF-DOES-NOT-EXIST</code></span></dt><dd><p>This argument controls the treatment of links
pointing to non-existent files and can take the following values:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:DISCARD</code> (default)</span></dt><dd>discard the bad directory entries
</dd><dt><span class="term"><code class="constant">:ERROR</code></span></dt><dd>an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed on bad directory entries
(this corresponds to the default behavior of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> in <a class="ulink" href="http://www.cons.org/cmucl/" target="_top"><span class="command"><strong>CMU CL</strong></span></a>)
</dd><dt><span class="term"><code class="constant">:KEEP</code></span></dt><dd>keep bad directory entries in the returned list
(this roughly corresponds to the <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a>
... <code class="constant">:TRUNAMEP</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code> call in <a class="ulink" href="http://www.cons.org/cmucl/" target="_top"><span class="command"><strong>CMU CL</strong></span></a>)
</dd><dt><span class="term"><code class="constant">:IGNORE</code></span></dt><dd>Similar to <code class="constant">:DISCARD</code>, but also do
<span class="strong"><strong>not</strong></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when a directory is unaccessible (contrary
to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specification).</dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dir"></a>20.3.3. Function <code class="function">EXT:DIR</code></h3></div></div></div><p><code class="code">(<code class="function">EXT:DIR</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>pathname</code></em>)</code> is like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a>, but displays the pathnames
instead of returning them. <code class="code">(EXT:DIR)</code>
shows the contents of the current directory.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cd"></a>20.3.4. Function <a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a> <em class="replaceable"><code>pathname</code></em>)</code> sets the current working directory,
<code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a>)</code> returns it.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a> [<em class="replaceable"><code>pathname</code></em>])</code>
manages the current directory.</dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a> [<em class="replaceable"><code>pathname</code></em>])</code>
manages the current device and the current directory.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="default-dir"></a>20.3.5. Function <a class="link" href="#default-dir" title="20.3.5. Function EXT:DEFAULT-DIRECTORY"><code class="function">EXT:DEFAULT-DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#default-dir" title="20.3.5. Function EXT:DEFAULT-DIRECTORY"><code class="function">EXT:DEFAULT-DIRECTORY</code></a>)</code> is equivalent to <code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a>)</code>.
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#default-dir" title="20.3.5. Function EXT:DEFAULT-DIRECTORY"><code class="function">EXT:DEFAULT-DIRECTORY</code></a>) <em class="replaceable"><code>pathname</code></em>)</code> is equivalent to
<code class="code">(<a class="link" href="#cd" title="20.3.4. Function EXT:CD"><code class="function">EXT:CD</code></a> <em class="replaceable"><code>pathname</code></em>)</code>, except for the return value.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="make-dir"></a>20.3.6. Function <code class="function">EXT:MAKE-DIRECTORY</code></h3></div></div></div><p><code class="code">(<code class="function">EXT:MAKE-DIRECTORY</code> <em class="replaceable"><code>directory</code></em>)</code>
creates a new subdirectory.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="delete-dir"></a>20.3.7. Function <a class="link" href="#delete-dir" title="20.3.7. Function EXT:DELETE-DIRECTORY"><code class="function">EXT:DELETE-DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#delete-dir" title="20.3.7. Function EXT:DELETE-DIRECTORY"><code class="function">EXT:DELETE-DIRECTORY</code></a> <em class="replaceable"><code>directory</code></em>)</code>
removes an (empty) subdirectory.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rename-dir"></a>20.3.8. Function <a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#rename-dir" title="20.3.8. Function EXT:RENAME-DIRECTORY"><code class="function">EXT:RENAME-DIRECTORY</code></a> <em class="replaceable"><code>old-directory</code></em>
<em class="replaceable"><code>new-directory</code></em>)</code> renames a
subdirectory to a new name.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="streams"></a>Chapter 21. Streams <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-21.html">[chap-21]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#streams-interactive">21.1. Interactive Streams sec_21-1-1-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#stream-stdio-init">21.1.1. Initialization of Standard Streams</a></span></dt></dl></dd><dt><span class="section"><a href="#terminal">21.2. Terminal interaction</a></span></dt><dd><dl><dt><span class="section"><a href="#readline">21.2.1. Command line editing with GNU readline</a></span></dt><dt><span class="section"><a href="#with-kbd">21.2.2. Macro <code class="function">EXT:WITH-KEYBOARD</code></a></span></dt></dl></dd><dt><span class="section"><a href="#bin-io">21.3. Binary Input and Output</a></span></dt><dd><dl><dt><span class="section"><a href="#bin-input">21.3.1. Binary input, <code class="function">READ-BYTE</code>, <code class="function">EXT:READ-INTEGER</code> & <code class="function">EXT:READ-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bin-output">21.3.2. Binary output, <code class="function">WRITE-BYTE</code>, <code class="function">EXT:WRITE-INTEGER</code> & <code class="function">EXT:WRITE-FLOAT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#bulk-io">21.4. Bulk Input and Output</a></span></dt><dd><dl><dt><span class="section"><a href="#read-seq">21.4.1. Bulk Input</a></span></dt><dt><span class="section"><a href="#write-seq">21.4.2. Bulk Output</a></span></dt><dt><span class="section"><a href="#bulk-io-rationale">21.4.3. Rationale</a></span></dt></dl></dd><dt><span class="section"><a href="#non-block-io">21.5. Non-Blocking Input and Output</a></span></dt><dt><span class="section"><a href="#newline-convention">21.6. Newline Convention</a></span></dt><dd><dl><dt><span class="section"><a href="#nl-question">21.6.1. Should programs output a newline before or after each line of output?</a></span></dt><dt><span class="section"><a href="#nl-trad-analysis">21.6.2. Analysis</a></span></dt><dt><span class="section"><a href="#nl-conclusion">21.6.3. Conclusion</a></span></dt><dt><span class="section"><a href="#nl-solution">21.6.4. Solution</a></span></dt><dt><span class="section"><a href="#nl-elnl-analysis">21.6.5. Elastic Newline Analysis</a></span></dt></dl></dd><dt><span class="section"><a href="#stream-extfmt">21.7. Function <code class="function">STREAM-EXTERNAL-FORMAT</code></a></span></dt><dt><span class="section"><a href="#stream-eltype">21.8. Function <code class="function">STREAM-ELEMENT-TYPE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#bin-stdio">21.8.1. Binary input from <code class="varname">*STANDARD-INPUT*</code></a></span></dt></dl></dd><dt><span class="section"><a href="#make-stream">21.9. Function <code class="function">EXT:MAKE-STREAM</code></a></span></dt><dt><span class="section"><a href="#file-pos">21.10. Function <code class="function">FILE-POSITION</code></a></span></dt><dt><span class="section"><a href="#elastic-newline">21.11. Function <code class="function">EXT:ELASTIC-NEWLINE</code></a></span></dt><dt><span class="section"><a href="#open">21.12. Function <code class="function">OPEN</code></a></span></dt><dt><span class="section"><a href="#clear-input">21.13. Function <code class="function">CLEAR-INPUT</code></a></span></dt><dt><span class="section"><a href="#close">21.14. Function <code class="function">CLOSE</code></a></span></dt><dt><span class="section"><a href="#open-stream-p">21.15. Function <code class="function">OPEN-STREAM-P</code></a></span></dt><dt><span class="section"><a href="#broadcast-stream">21.16. Class <code class="classname">BROADCAST-STREAM</code></a></span></dt><dt><span class="section"><a href="#stream-buffer">21.17. Functions <code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
and <code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
</a></span></dt><dt><span class="section"><a href="#stream-handles">21.18. Function <code class="function">EXT:STREAM-HANDLES</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="streams-interactive"></a>21.1. Interactive Streams
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_21-1-1-1-3.html">[sec_21-1-1-1-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#stream-stdio-init">21.1.1. Initialization of Standard Streams</a></span></dt></dl></div><p>Interactive streams are those whose next input might depend on a
prompt one might output.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="stream-stdio-init"></a>21.1.1. Initialization of Standard Streams</h3></div></div></div><p>When run interactively, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> creates a single <span class="quote">“<span class="quote">terminal</span>”</span>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and binds <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> to it.
All other standard streams (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*TRACE-OUTPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*QUERY-IO*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*DEBUG-IO*</code></a>)
are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>s pointing to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>.
This has the benefit of avoiding unwanted blank lines from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a>,
see <a class="xref" href="#newline-convention" title="21.6. Newline Convention">Section 21.6, “Newline Convention”</a>.</p><p>However, there may be situations, especially in <a href="clisp.html#batch-mode" class="olink">batch mode</a>,
when one wants to use a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>-style i/o where <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> point to different OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> so that they can be
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07">redirected</a>
to files in the command line and examined separately.
Often <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can detect such situations (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html"><code class="varname">stderr</code></a> not being
the terminal) and handle them just as expected.
However, there may be cases when one needs to do something like:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a> (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <code class="constant">:INPUT</code>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <code class="constant">:OUTPUT</code> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <code class="constant">:ERROR</code> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))
</pre><p> in the <a href="clisp.html#opt-exec-file" class="olink">script</a> or <a href="impnotes.html#init-func" class="olink">init function</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="terminal"></a>21.2. Terminal interaction</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#readline">21.2.1. Command line editing with GNU readline</a></span></dt><dt><span class="section"><a href="#with-kbd">21.2.2. Macro <code class="function">EXT:WITH-KEYBOARD</code></a></span></dt></dl></div><p>See also <a class="xref" href="#screen" title="32.1. Random Screen Access">Section 32.1, “Random Screen Access”</a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="readline"></a>21.2.1. Command line editing with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a></h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> linked against the
<a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> library.</span></span></h4></div></div></div><p>Input through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> uses the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> library.
Arrow keys can be used to move within the input history.
The <span class="keycode">TAB</span> key completes the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> name or
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a> that is being typed.
See <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/rluserman.html" target="_top">readline user
manual</a> for general details and
<a href="clisp.html#completion" class="olink"><span class="keycode">TAB</span> key</a> for <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific
extensions.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> library is <span class="strong"><strong>not</strong></span> used (even when
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is linked against it) if the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a> do not both
refer to the same terminal.
This is determined by the function <code class="function">stdio_same_tty_p</code>
in file <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/stream.d"><code class="filename">src/stream.d</code></a>.
In some exotic cases, e.g., when running under <a class="ulink" href="http://sources.redhat.com/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a> in
an <span class="command"><strong>rxvt</strong></span> window under <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a>, this may be
determined incorrectly.</p></div><p>See also <a class="xref" href="#readline-mod" title="33.5. Advanced Readline and History Functionality">Section 33.5, “Advanced Readline and History Functionality”</a>.</p><p><a id="readline-config"></a><strong>Linking against <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a>. </strong>For <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to use <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> it has to be detected by
the <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> process.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>If you run it as
</p><pre class="screen"><strong><code class="prompt">$</code></strong> ./configure --with-readline</pre><p>
it will fail if it cannot find a valid modern <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a>
installation.</p></li><li class="listitem">If you use the option
<code class="option">--without-readline</code>, it will not even try to
find <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a>.</li><li class="listitem">The default behavior
(<code class="option">--with-readline=default</code>) is to use <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> if
it is found and link <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> without it otherwise.
</li></ul></div><p>
You can find out whether <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> has been detected by running
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html"><span class="command"><strong>grep</strong></span></a> HAVE_READLINE config.h</pre><p>
in your build directory.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="with-kbd"></a>21.2.2. Macro <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a></h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> is not the only stream that
communicates directly with the user: During execution of the body of a
<code class="code">(<a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a> . <em class="replaceable"><code>body</code></em>)</code> form,
<strong class="first"><em class="firstterm"><a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a></em></strong> is the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that reads the
keystrokes from the keyboard.
It returns every keystroke in detail as an <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> with the
following slots (see <a class="xref" href="#input-char" title="13.4.1. Input Characters">Section 13.4.1, “Input Characters”</a> for accessing them):
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>char</code></em></span></dt><dd><p class="simpara">the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> for standard keys
(accessed with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_character.html" target="_top"><code class="function">CHARACTER</code></a>)</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>For non-standard keys <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_character.html" target="_top"><code class="function">CHARACTER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>, use <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:CHAR-KEY</code></a>:
</p><pre class="programlisting">
(<a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for <em class="replaceable"><code>char</code></em> = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a>)
:for <em class="replaceable"><code>key</code></em> = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> (<a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:CHAR-KEY</code></a> <em class="replaceable"><code>char</code></em>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_character.html" target="_top"><code class="function">CHARACTER</code></a> <em class="replaceable"><code>char</code></em>))
:do (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a> <em class="replaceable"><code>char</code></em> <em class="replaceable"><code>key</code></em>))
:when (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> <em class="replaceable"><code>key</code></em> #\Space) :return (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a> <em class="replaceable"><code>char</code></em> <em class="replaceable"><code>key</code></em>)))
</pre></div></dd><dt><span class="term"><em class="replaceable"><code>key</code></em></span></dt><dd><p>the key name, for non-standard keys
(accessed with <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:CHAR-KEY</code></a>):
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><div class="informaltable"><a id="unix-kbd-keys"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">key</th><th align="center">value</th></tr></thead><tbody><tr><td align="center"><span class="keycode">F1</span>..<span class="keycode">F12</span></td><td align="center"><code class="constant">:F1</code>..<code class="constant">:F12</code>
</td></tr><tr><td align="center"><span class="keycode">Insert</span></td><td align="center"><code class="constant">:INSERT</code></td></tr><tr><td align="center"><span class="keycode">Delete</span></td><td align="center"><code class="constant">:DELETE</code></td></tr><tr><td align="center"><span class="keycode">Home</span></td><td align="center"><code class="constant">:HOME</code></td></tr><tr><td align="center"><span class="keycode">End</span></td><td align="center"><code class="constant">:END</code></td></tr><tr><td align="center"><span class="keycode">Center</span></td><td align="center"><code class="constant">:CENTER</code></td></tr><tr><td align="center"><span class="keycode">PgUp</span></td><td align="center"><code class="constant">:PGUP</code></td></tr><tr><td align="center"><span class="keycode">PgDn</span></td><td align="center"><code class="constant">:PGDN</code></td></tr><tr><td align="center">Arrow keys</td><td align="center"><code class="constant">:LEFT</code> <code class="constant">:RIGHT</code>
<code class="constant">:UP</code> <code class="constant">:DOWN</code></td></tr></tbody></table></div></dd></dl></div></dd><dt><span class="term"><em class="replaceable"><code>bits</code></em></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:HYPER</code></span></dt><dd>(<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>) if a non-standard key.
These keys are:
<span class="emphasis"><em>[<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>]:</em></span>
Function keys, cursor keypads, numeric keypad.
</dd><dt><span class="term"><code class="constant">:SUPER</code></span></dt><dd>(<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>) if pressed together with <span class="keycap"><strong>Shift</strong></span>
key(s) and if the keystroke would have been different without
<span class="keycap"><strong>Shift</strong></span>.</dd><dt><span class="term"><code class="constant">:CONTROL</code></span></dt><dd>if pressed together with the <span class="keycap"><strong>Control</strong></span> key.
</dd><dt><span class="term"><code class="constant">:META</code></span></dt><dd>(<span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span>) if pressed together with the
<span class="keycap"><strong>Alternate</strong></span> key.</dd></dl></div></dd><dt><span class="term"><em class="replaceable"><code>font</code></em></span></dt><dd>Always <code class="literal">0</code>.</dd></dl></div><p>
This keyboard input is not echoed on the screen. During execution of a
<code class="code">(<a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a> . <em class="replaceable"><code>body</code></em>)</code> form, no input from
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> or any synonymous stream should be requested.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Since <a class="link" href="#input-char" title="13.4.1. Input Characters"><code class="classname">SYS::INPUT-CHARACTER</code></a> is <span class="strong"><strong>not</strong></span> a subtype of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> on <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a> is illegal.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bin-io"></a>21.3. Binary Input and Output</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#bin-input">21.3.1. Binary input, <code class="function">READ-BYTE</code>, <code class="function">EXT:READ-INTEGER</code> & <code class="function">EXT:READ-FLOAT</code></a></span></dt><dt><span class="section"><a href="#bin-output">21.3.2. Binary output, <code class="function">WRITE-BYTE</code>, <code class="function">EXT:WRITE-INTEGER</code> & <code class="function">EXT:WRITE-FLOAT</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bin-input"></a>21.3.1. Binary input, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>,
<a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER & EXT:READ-FLOAT"><code class="function">EXT:READ-INTEGER</code></a> & <a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER & EXT:READ-FLOAT"><code class="function">EXT:READ-FLOAT</code></a></h3></div></div></div><p>The function <code class="code">(<a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER & EXT:READ-FLOAT"><code class="function">EXT:READ-INTEGER</code></a> <em class="replaceable"><code>stream</code></em>
<em class="replaceable"><code>element-type</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a> <em class="replaceable"><code>eof-error-p</code></em> <em class="replaceable"><code>eof-value</code></em>)</code>
reads a multi-byte <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> from <em class="replaceable"><code>stream</code></em>, which should be a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>.
<em class="replaceable"><code>element-type</code></em> should be <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_equivalent">type equivalent</a> to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>,
where <em class="replaceable"><code>n</code></em> is a multiple of 8.</p><p><code class="code">(<a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER & EXT:READ-FLOAT"><code class="function">EXT:READ-INTEGER</code></a> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em>)</code> is like
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> <em class="replaceable"><code>stream</code></em>)</code> if <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> were set to <em class="replaceable"><code>element-type</code></em>,
except that <em class="replaceable"><code>stream</code></em>'s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a> will increase by
<sup><em class="replaceable"><code>n</code></em></sup>/<sub>8</sub>
instead of 1.</p><p>Together with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)</code>, this
function permits mixed character/binary input from a stream.</p><p>The function <code class="code">(<a class="link" href="#bin-input" title="21.3.1. Binary input, READ-BYTE, EXT:READ-INTEGER & EXT:READ-FLOAT"><code class="function">EXT:READ-FLOAT</code></a> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a> <em class="replaceable"><code>eof-error-p</code></em> <em class="replaceable"><code>eof-value</code></em>)</code> reads a
floating-point number in <a class="ulink" href="http://grouper.ieee.org/groups/754/" target="_top">IEEE 754</a> binary representation from
<em class="replaceable"><code>stream</code></em>, which should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>. <em class="replaceable"><code>element-type</code></em> should be
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_equivalent">type equivalent</a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>.</p><p><a id="endianness"></a><strong>Endianness. </strong><strong class="first"><em class="firstterm"><a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a>
<a id="endianness-i" class="indexterm"></a></em></strong>
can be <code class="constant">:LITTLE</code> or <code class="constant">:BIG</code>.
The default is <code class="constant">:LITTLE</code>, which corresponds
to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> behavior in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bin-output"></a>21.3.2. Binary output, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-byte.html" target="_top"><code class="function">WRITE-BYTE</code></a>,
<a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER & EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-INTEGER</code></a> & <a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER & EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-FLOAT</code></a></h3></div></div></div><p>The function <code class="code">(<a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER & EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-INTEGER</code></a> <em class="replaceable"><code>integer</code></em> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a>)</code> writes a multi-byte <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> to
<em class="replaceable"><code>stream</code></em>, which should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>. <em class="replaceable"><code>element-type</code></em> should be
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_equivalent">type equivalent</a> to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>, where <em class="replaceable"><code>n</code></em> is a multiple of 8.</p><p><code class="code">(<a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER & EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-INTEGER</code></a> <em class="replaceable"><code>integer</code></em> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em>)</code> is
like <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-byte.html" target="_top"><code class="function">WRITE-BYTE</code></a> <em class="replaceable"><code>integer</code></em> <em class="replaceable"><code>stream</code></em>)</code> if <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> were set to <em class="replaceable"><code>element-type</code></em>, except that <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a> will increase by
<sup><em class="replaceable"><code>n</code></em></sup>/<sub>8</sub>
instead of 1.</p><p>Together with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)</code>, this
function permits mixed character/binary output to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>.</p><p>The function <code class="code">(<a class="link" href="#bin-output" title="21.3.2. Binary output, WRITE-BYTE, EXT:WRITE-INTEGER & EXT:WRITE-FLOAT"><code class="function">EXT:WRITE-FLOAT</code></a> <em class="replaceable"><code>float</code></em>
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>element-type</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#endianness" title="Endianness"><em class="replaceable"><code>ENDIANNESS</code></em></a>)</code> writes a
floating-point number in <a class="ulink" href="http://grouper.ieee.org/groups/754/" target="_top">IEEE 754</a> binary representation to
<em class="replaceable"><code>stream</code></em>, which should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>. <em class="replaceable"><code>element-type</code></em> should be
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_equivalent">type equivalent</a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bulk-io"></a>21.4. Bulk Input and Output</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#read-seq">21.4.1. Bulk Input</a></span></dt><dt><span class="section"><a href="#write-seq">21.4.2. Bulk Output</a></span></dt><dt><span class="section"><a href="#bulk-io-rationale">21.4.3. Rationale</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="read-seq"></a>21.4.1. Bulk Input</h3></div></div></div><p>In addition to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-sequence.html" target="_top"><code class="function">READ-SEQUENCE</code></a>, the following two functions are provided:
</p><div class="variablelist"><dl class="variablelist"><dt><a id="rd-by-seq"></a><span class="term"><a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>
performs multiple <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> operations:</span></dt><dd><p class="simpara"><code class="code">(<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a> <em class="replaceable"><code>sequence</code></em>
<em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code> :NO-HANG :INTERACTIVE)</code>
fills the subsequence of <em class="replaceable"><code>sequence</code></em> specified by <code class="constant">:START</code> and <code class="constant">:END</code>
with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s consecutively read from <em class="replaceable"><code>stream</code></em>. It returns the
index of the first element of <em class="replaceable"><code>sequence</code></em> that was not updated (=
<em class="replaceable"><code>end</code></em> or < <em class="replaceable"><code>end</code></em> if the <em class="replaceable"><code>stream</code></em> reached its end).
When <em class="replaceable"><code>no-hang</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it does not block: it treats input
unavailability as <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>. When <em class="replaceable"><code>no-hang</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <em class="replaceable"><code>interactive</code></em> is
non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it can block for reading the first byte but does not block
for any further bytes.</p><p class="simpara">This function is especially efficient if <em class="replaceable"><code>sequence</code></em> is a
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> and <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>.
</p></dd><dt><a id="rd-ch-seq"></a><span class="term"><a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>
performs multiple <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> operations:</span></dt><dd><p class="simpara"><code class="code">(<a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:START</code> <code class="constant">:END</code>)</code> fills the subsequence of <em class="replaceable"><code>sequence</code></em>
specified by <code class="constant">:START</code> and <code class="constant">:END</code> with characters consecutively read
from <em class="replaceable"><code>stream</code></em>. It returns the index of the first element of
<em class="replaceable"><code>sequence</code></em> that was not updated (= <em class="replaceable"><code>end</code></em> or < <em class="replaceable"><code>end</code></em> if the
<em class="replaceable"><code>stream</code></em> reached its end).</p><p class="simpara">This function is especially efficient if <em class="replaceable"><code>sequence</code></em> is a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a>.
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="write-seq"></a>21.4.2. Bulk Output</h3></div></div></div><p>In addition to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-sequence.html" target="_top"><code class="function">WRITE-SEQUENCE</code></a>, the following two functions are provided:
</p><div class="variablelist"><dl class="variablelist"><dt><a id="wr-by-seq"></a><span class="term"><a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a>
performs multiple <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-byte.html" target="_top"><code class="function">WRITE-BYTE</code></a> operations:</span></dt><dd><p class="simpara"><code class="code">(<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code> :NO-HANG :INTERACTIVE)</code> outputs
the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s of the subsequence of <em class="replaceable"><code>sequence</code></em> specified by
<code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em>.
When <em class="replaceable"><code>no-hang</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, does not block.
When <em class="replaceable"><code>no-hang</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <em class="replaceable"><code>interactive</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it can
block for writing the first byte but does not block for any further
bytes. Returns two values: <em class="replaceable"><code>sequence</code></em> and the index of the first
byte that was not output.</p><p class="simpara">This function is especially efficient if <em class="replaceable"><code>sequence</code></em> is a
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> and <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>.</p></dd><dt><a id="wr-ch-seq"></a><span class="term"><a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a>
performs multiple <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-char.html" target="_top"><code class="function">WRITE-CHAR</code></a> operations:</span></dt><dd><p class="simpara"><code class="code">(<a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a> <em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:START</code> <code class="constant">:END</code>)</code> outputs the characters of the subsequence of
<em class="replaceable"><code>sequence</code></em> specified by <code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em>.
Returns the <em class="replaceable"><code>sequence</code></em> argument.</p><p class="simpara">This function is especially efficient if <em class="replaceable"><code>sequence</code></em> is a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bulk-io-rationale"></a>21.4.3. Rationale</h3></div></div></div><p>The rationale for <a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>, <a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>, <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a> and
<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> is that some <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s support both character and binary
i/o, and when you read into a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a> that can hold both (e.g.,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>) you cannot determine which kind of
input to use. In such situation <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-sequence.html" target="_top"><code class="function">READ-SEQUENCE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-sequence.html" target="_top"><code class="function">WRITE-SEQUENCE</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>, while <a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>, <a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>, <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a> and
<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> work just fine.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="non-block-io"></a>21.5. Non-Blocking Input and Output</h2></div></div></div><p>In addition to the standard functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char-no-hang.html" target="_top"><code class="function">READ-CHAR-NO-HANG</code></a>, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> provides the following functionality
facilitating non-blocking input and output, both binary and
character.</p><div class="variablelist"><dl class="variablelist"><dt><a id="rcwhp"></a><span class="term"><code class="code">(<a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara"><a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> queries the stream's input status.
It returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_peek-char.html" target="_top"><code class="function">PEEK-CHAR</code></a> with a
<em class="replaceable"><code>peek-type</code></em> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> will return immediately.
Otherwise it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>. (In the latter case the standard
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> function would return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.)</p><p class="simpara">Note the difference with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_not.html" target="_top"><code class="function">NOT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a>
<em class="replaceable"><code>stream</code></em>))</code>: When the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> returns
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, whereas <a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p class="simpara">Note also that <a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> is not a good way to test for <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>:
If <a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, this does not mean that the <em class="replaceable"><code>stream</code></em> will
deliver more characters. It only means that it is not known at this
moment whether the <em class="replaceable"><code>stream</code></em> is already at <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>, or will deliver
more characters.</p></dd><dt><a id="rbla"></a><span class="term"><code class="code">(<a class="link" href="#rbla"><code class="function">EXT:READ-BYTE-LOOKAHEAD</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>To be called only if <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> would return immediately with an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> result.
Returns <code class="constant">:EOF</code> if the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is already known to be reached.
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>'s value is not available immediately, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
instead of waiting.</dd><dt><a id="rbwhp"></a><span class="term"><code class="code">(<a class="link" href="#rbwhp"><code class="function">EXT:READ-BYTE-WILL-HANG-P</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>To be called only if <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> will return immediately.
Otherwise it returns true.</dd><dt><a id="rbnh"></a><span class="term"><code class="code">(<a class="link" href="#rbnh"><code class="function">EXT:READ-BYTE-NO-HANG</code></a> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>eof-error-p</code></em> <em class="replaceable"><code>eof-value</code></em>)</code></span></dt><dd>To be called only if <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
Returns an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or does <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> handling, like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>,
if that would return immediately.
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>'s value is not available immediately, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
instead of waiting.</dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="listen-byte"></a><code class="function">LISTEN</code> on binary streams</h3><p>The [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specification for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> mentions <span class="quote">“<span class="quote">character
availability</span>”</span> as the criterion that determines the return value.
Since a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> is <span class="emphasis"><em>never</em></span> available on a
binary <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (i.e., a stream with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> being a
subtype of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for such streams.
(You can use <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> to check binary streams).
Any other behavior would be hard to make consistent: consider a bivalent
stream, i.e., a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that can be operated upon by both
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>.
What should <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> return on such a stream if what is actually available
on the stream at the moment is only a part of a multi-byte character?
Right now one can use first <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> to check if anything at all is
available and then use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a> to make sure that a full <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
is actually there.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="newline-convention"></a>21.6. Newline Convention</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#nl-question">21.6.1. Should programs output a newline before or after each line of output?</a></span></dt><dt><span class="section"><a href="#nl-trad-analysis">21.6.2. Analysis</a></span></dt><dt><span class="section"><a href="#nl-conclusion">21.6.3. Conclusion</a></span></dt><dt><span class="section"><a href="#nl-solution">21.6.4. Solution</a></span></dt><dt><span class="section"><a href="#nl-elnl-analysis">21.6.5. Elastic Newline Analysis</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-question"></a>21.6.1. Should programs output a newline before
or after each line of output?</h3></div></div></div><p>The answer is complicated. There is an antagonism between
the <span class="quote">“<span class="quote">old Lisp way</span>”</span> of outputting a newline before the
line's contents (exemplified by the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PPRINT</code></a>) and
the <span class="quote">“<span class="quote">Unix way</span>”</span> of outputting a newline after the line's
contents. Which one is <span class="quote">“<span class="quote">right</span>”</span>?</p><p>A newline convention is, by definition, a consistent way to use
the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">TERPRI</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> functions or - in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> notation -
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-1-2.html"><code class="literal">~%</code></a> and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-1-3.html"><code class="literal">~&</code></a> directives in such a way that the
resulting output is properly subdivided into lines.</p><p>Three newline conventions are conceivable:</p><div class="orderedlist"><ol class="orderedlist" type="A"><li class="listitem">Print a newline before the line, and nothing after it.
As a format string: <span class="format"><span class="quote">“<span class="quote">~%First line.~%Second line.</span>”</span></span>
</li><li class="listitem">Print a newline if needed before the line,
and a newline always after it. As a format string:
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.~%</span>”</span></span>
</li><li class="listitem">Print nothing before the line, and a newline always
after it. As a format string:
<span class="format"><span class="quote">“<span class="quote">First line.~%Second line.~%</span>”</span></span>
</li></ol></div><p>The most important criterion is interoperability. Two newline
conventions are interoperable if, when parts of a program use one of the
convention and other parts of the program use the other conventions,
lines are still properly separated. It is easily seen that <span class="strong"><strong>A</strong></span> and
<span class="strong"><strong>B</strong></span> are interoperable, <span class="strong"><strong>B</strong></span> and <span class="strong"><strong>C</strong></span> are interoperable as well,
but <span class="strong"><strong>A</strong></span> and <span class="strong"><strong>C</strong></span> are not interoperable: When an output with
convention <span class="strong"><strong>A</strong></span> is followed by output in convention <span class="strong"><strong>C</strong></span>, two lines
are appended without a line separator. This should not happen.</p><p>Therefore, in what follows, we consider five kinds of programs:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: using convention <span class="strong"><strong>A</strong></span> exclusively,
</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: mixing conventions <span class="strong"><strong>A</strong></span> and <span class="strong"><strong>B</strong></span>,
</li><li class="listitem"><span class="strong"><strong>B</strong></span>: using convention <span class="strong"><strong>B</strong></span> exclusively,
</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: mixing conventions <span class="strong"><strong>B</strong></span> and <span class="strong"><strong>C</strong></span>,
</li><li class="listitem"><span class="strong"><strong>C</strong></span>: using convention <span class="strong"><strong>C</strong></span> exclusively.
</li></ul></div><p>Which of these five kinds of programs operation is satisfactory?
Let us consider different criteria:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Do extra blank lines occur during normal operation?
</li><li class="listitem">What happens if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> prints a newline when
it is not needed, i.e. when it cannot tell for sure whether the
current column is 0? (This situation happens, for example, when
logging to a file: After the user has entered a line interactively,
the column on screen is 0, but since the input has not been echoed in
the log file, the column in the log file is usually not 0, and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> <span class="strong"><strong>must</strong></span> output a newline. Then a blank
line is visible on the screen.)</li><li class="listitem">What happens if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> omits a newline when it
would be needed?
(This is more rare, but can happen, for example, when standard output
and standard error are different streams but are joined outside the
Lisp implementation, at the OS level.
Such as in <span class="command"><strong>lisp | cat</strong></span>.)</li><li class="listitem"><p>Is it possible to reliably output a blank line
before or after a paragraph of text? I.e. what happens with
</p><div class="orderedlist"><ol class="orderedlist" type="A"><li class="listitem"><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<span class="format"><span class="quote">“<span class="quote">~%~%First line.~%Second line.</span>”</span></span>
</li><li class="listitem">
<span class="format"><span class="quote">“<span class="quote">~%First line.~%Second line.~%</span>”</span></span>
</li></ol></div></li><li class="listitem"><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<span class="format"><span class="quote">“<span class="quote">~&~%First line.~%Second line.~%</span>”</span></span>
</li><li class="listitem">
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.~%~%</span>”</span></span>
</li></ol></div></li><li class="listitem"><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<span class="format"><span class="quote">“<span class="quote">~%First line.~%Second line.~%</span>”</span></span>
</li><li class="listitem">
<span class="format"><span class="quote">“<span class="quote">First line.~%Second line.~%~%</span>”</span></span>
</li></ol></div></li></ol></div></li><li class="listitem">Is it possible to optimize away blank lines?
I.e. is it possible to avoid a blank line even though another piece
of code uses one of A1 ... C2, without risking that adjacent lines be
unseparated?</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-trad-analysis"></a>21.6.2. Analysis</h3></div></div></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: An extra blank line each time one
switches from convention <span class="strong"><strong>B</strong></span> to <span class="strong"><strong>A</strong></span>.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No extra blank lines.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Blank lines can occur when
convention <span class="strong"><strong>B</strong></span> is used.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: Blank lines can occur.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: Blank lines can occur when
convention <span class="strong"><strong>B</strong></span> is used.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No extra blank lines.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Lines can be unseparated when one
switches from convention <span class="strong"><strong>A</strong></span> to <span class="strong"><strong>B</strong></span>.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No problem.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: The blank line is omitted when using
A2 before switching to <span class="strong"><strong>B</strong></span>.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No problem.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: Yes, using
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.</span>”</span></span>
eats a previous blank line.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Not really: Using
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.</span>”</span></span>
may eat a previous blank line or a following blank line, but you
cannot know in advance which one.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: Yes, using
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.</span>”</span></span>
eats a following blank line.</li><li class="listitem"><span class="strong"><strong>BC</strong></span>: Impossible.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: Impossible.
To optimize blank lines in case <span class="strong"><strong>C</strong></span> would require the opposite of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a>, namely a conditional newline that is annullated if the
<span class="emphasis"><em>next</em></span> output on the stream will be a
newline. (<a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>, see below.)</li></ul></div></li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-conclusion"></a>21.6.3. Conclusion</h3></div></div></div><p>Each approach has its advantages and disadvantages.</p><p>When used globally (i.e. no interoperability requirements),
<span class="strong"><strong>A</strong></span>, <span class="strong"><strong>B</strong></span>, <span class="strong"><strong>C</strong></span> can be compared as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span> and <span class="strong"><strong>C</strong></span> are equally perfect if eating
blank lines is not a requirement.</li><li class="listitem">If eating blank lines is desirable, <span class="strong"><strong>A</strong></span> is perfect.
</li><li class="listitem"><span class="strong"><strong>B</strong></span> is not so good, because it is suboptimal in case 2.
</li></ul></div><p>For <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built-ins, however, the interoperability requirement
with both <span class="strong"><strong>A</strong></span> and <span class="strong"><strong>C</strong></span> is a major requirement. Therefore we have
to choose <span class="strong"><strong>B</strong></span>, and accept the drawbacks:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>AB</strong></span>: An extra blank line each time one
switches from convention <span class="strong"><strong>B</strong></span> to <span class="strong"><strong>A</strong></span>.</li><li class="listitem"><span class="strong"><strong>B</strong></span>: When logging to a file, blank lines can
occur.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: When joining two output streams into
one, lines can be unseparated.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Blank lines after a paragraph can be
eaten by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</li><li class="listitem"><span class="strong"><strong>AB</strong></span>: Optimizing blank lines is not really
possible.</li></ul></div><p>
And to minimize the drawbacks, we recommend the user programs to use
approach <span class="strong"><strong>B</strong></span> or <span class="strong"><strong>C</strong></span>, but not <span class="strong"><strong>A</strong></span>.</p><p>Another drawback of <span class="strong"><strong>B</strong></span> is, however, that in interactive sessions
the cursor is nearly always positioned at the beginning of a line,
pointing the user's focus to the wrong point and taking away a screen
line.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-solution"></a>21.6.4. Solution</h3></div></div></div><p>To solve this, we introduce the concept of an <strong class="first"><em class="firstterm">elastic
newline</em></strong>, output by the function <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>.
This is the converse of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a>: It waits for the next character
and outputs a newline when the next character is not a newline; then
the next character is processed normally.
As a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> directive, we write it <a class="link" href="#format-dot"><code class="literal">~.</code></a>.
<a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a> followed by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> leads to exactly one newline
always.</p><p>Elastic newline leads to a slightly different newline convention:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>B'</strong></span>:
Print a newline if needed before the line, and a newline if needed after it.
As a format string:
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.~.</span>”</span></span>
</li></ul></div><p>The five programs being considered are now:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: using convention <span class="strong"><strong>A</strong></span> exclusively,
</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: mixing conventions <span class="strong"><strong>A</strong></span> and <span class="strong"><strong>B'</strong></span>,
</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: using convention <span class="strong"><strong>B'</strong></span> exclusively,
</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: mixing conventions <span class="strong"><strong>B'</strong></span> and <span class="strong"><strong>C</strong></span>,
</li><li class="listitem"><span class="strong"><strong>C</strong></span>: using convention <span class="strong"><strong>C</strong></span> exclusively,
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="nl-elnl-analysis"></a>21.6.5. Elastic Newline Analysis</h3></div></div></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No extra blank lines.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No extra blank lines.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: Blank lines can occur when
convention <span class="strong"><strong>B'</strong></span> is used.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: Blank lines can occur.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: Blank lines can occur when
convention <span class="strong"><strong>B'</strong></span> is used.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No extra blank lines.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: Lines can be unseparated when one
switches from convention <span class="strong"><strong>A</strong></span> to <span class="strong"><strong>B'</strong></span>.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: Lines can be unseparated when one
switches from one stream to another without performing a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a>. This is a general problem with buffered streams;
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> contains a workaround that is limited to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a>.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No problem.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: The blank line is omitted when
using A2 before switching to <span class="strong"><strong>B'</strong></span> or when using B2 before switching
to <span class="strong"><strong>A</strong></span>.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: No problem.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: No problem.</li></ul></div></li><li class="listitem"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>A</strong></span>: Yes, using
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.</span>”</span></span>
eats a previous blank line.</li><li class="listitem"><span class="strong"><strong>AB'</strong></span>: Not really: Using
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.</span>”</span></span>
may eat a previous blank line or a following blank line, but you
cannot know in advance which one.</li><li class="listitem"><span class="strong"><strong>B'</strong></span>: Yes, using
<span class="format"><span class="quote">“<span class="quote">~&First line.~%Second line.</span>”</span></span>
eats a following blank line.</li><li class="listitem"><span class="strong"><strong>B'C</strong></span>: Impossible.</li><li class="listitem"><span class="strong"><strong>C</strong></span>: Yes, using
<span class="format"><span class="quote">“<span class="quote">First line.~%Second line.~.</span>”</span></span>
eats a following blank line.</li></ul></div></li></ol></div><p>Now criterium 1 is satisfied perfectly. We therefore choose
<span class="strong"><strong>B'</strong></span>, not <span class="strong"><strong>B</strong></span>, for use inside <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, and programs can use
either <span class="strong"><strong>A</strong></span> or <span class="strong"><strong>C</strong></span> without problems during normal operation.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stream-extfmt"></a>21.7. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able: <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-external-format.html" target="_top"><code class="function">STREAM-EXTERNAL-FORMAT</code></a> <em class="replaceable"><code>stream</code></em> [<em class="replaceable"><code>direction</code></em>]) <em class="replaceable"><code>encoding</code></em>)</code>,
<em class="replaceable"><code>direction</code></em> can be <code class="constant">:INPUT</code>, <code class="constant">:OUTPUT</code>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
If no <em class="replaceable"><code>direction</code></em> is given, the operation is nonrecursive.</p><p>This will <span class="strong"><strong>not</strong></span> work on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> et al, use <a href="impnotes.html#term-enc" class="olink"><code class="varname">CUSTOM:*TERMINAL-ENCODING*</code></a>
instead.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stream-eltype"></a>21.8. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#bin-stdio">21.8.1. Binary input from <code class="varname">*STANDARD-INPUT*</code></a></span></dt></dl></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able. The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s created by the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>, <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-INPUT-STREAM</code></a>
<a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-OUTPUT-STREAM</code></a>, <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-IO-STREAM</code></a>, <a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a>, <a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a>
can be modified, if the old and the new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>s are either
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">both equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>; or</li><li class="listitem">both equivalent to <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>, with the
same <em class="replaceable"><code>n</code></em>.</li></ul></div><p>Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> and <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)</code> are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>s, see
<a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="stream-eltype-stdio"></a>Warning</h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> expects to be able to
do <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> i/o on standard streams like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*QUERY-IO*</code></a> et al, thus it is a <span class="strong"><strong>very</strong></span> bad idea
to change their <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> even when you can. Use
<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> instead, see <a class="xref" href="#bin-stdio" title="21.8.1. Binary input from *STANDARD-INPUT*">Section 21.8.1, “Binary input from <code class="varname">*STANDARD-INPUT*</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bin-stdio"></a>21.8.1. Binary input from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a></h3></div></div></div><p>Note that you cannot change <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> for some
built-in streams, such as <a class="link" href="#terminal" title="21.2. Terminal interaction">terminal streams</a>,
which is normally the value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>.
Since <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a> normally is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a> pointing
to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>, you cannot use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a> on it.</p><p>Since <a class="ulink" href="https://en.wikipedia.org/wiki/Common_Gateway_Interface" target="_top">CGI</a>
(Common Gateway Interface) provides the form data for
<span class="command"><strong>METHOD="POST"</strong></span> on the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>,
and the server will <span class="strong"><strong>not</strong></span> send you an <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> on the end of the data,
you will need to use
<code class="code">(<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> <code class="envar">"CONTENT_LENGTH"</code>)</code>
to determine how much data you should read from <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>.
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will detect that <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a> is not a terminal and create a regular
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a> which can be passed to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)</code>.
To test this functionality interactively,
you will need to open the standard input in the binary mode:
</p><pre class="programlisting">
(let ((buf (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-integer.html" target="_top"><code class="function">PARSE-INTEGER</code></a> (<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> "CONTENT_LENGTH"))
:element-type '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (in (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <code class="constant">:INPUT</code> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-sequence.html" target="_top"><code class="function">READ-SEQUENCE</code></a> buf in))
buf)
</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="make-stream"></a>21.9. Function <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a></h2></div></div></div><p>Function <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> creates a Lisp stream out of an OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>:
<code class="code">(<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> <em class="replaceable"><code>object</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:DIRECTION</code>
<a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></p><p><em class="replaceable"><code>object</code></em> designates an OS handle (a <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>),
and should be one of the following: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">number</span></dt><dd>denotes the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> of this value
</dd><dt><span class="term"><code class="constant">:INPUT</code></span></dt><dd>denotes <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
process standard input, that is, the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> corresponding to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>
(0 on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)</dd><dt><span class="term"><code class="constant">:OUTPUT</code></span></dt><dd>denotes <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
process standard output, that is, the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> corresponding to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a>
(1 on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)</dd><dt><span class="term"><code class="constant">:ERROR</code></span></dt><dd>denotes <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
process error output, that is, the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> corresponding to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html"><code class="varname">stderr</code></a>
(2 on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a></span></dt><dd>denotes the handle of this stream, which should be
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a> or a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a></dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="make-stream-warn-buffering"></a>Beware of buffering!</h3><p>When there are several Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s backed by the same OS
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>, the behavior may be highly confusing when some of the
Lisp streams are <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>. Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a> for <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s,
and <a class="link" href="#bulk-io" title="21.4. Bulk Input and Output">bulk input</a> for <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.</p></div><p>The handle is duplicated (with <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html"><code class="function">dup</code></a>),
so it is safe to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> returned by <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="file-pos"></a>21.10. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a> works on any <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>When a <span class="keysym">#\Newline</span> is output to (respectively input from)
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>, its file position is increased by 2 since <span class="keysym">#\Newline</span> is
encoded as <span class="keycode">CR</span>/<span class="keycode">LF</span> in the file.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="elastic-newline"></a>21.11. Function <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a></h2></div></div></div><p>The function <code class="code">(<a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a> [<em class="replaceable"><code>stream</code></em>])</code> is like
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> but the other way around: It outputs a conditional newline
on <em class="replaceable"><code>stream</code></em>, which is canceled if the <span class="emphasis"><em>next</em></span>
output on <em class="replaceable"><code>stream</code></em> happens to be a newline. More precisely, it
causes a newline to be output right before the next character is
written on <em class="replaceable"><code>stream</code></em>, if this character is not a newline.
The newline is also output if the next operation on the stream is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FINISH-OUTPUT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.</p><p>The functionality of <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a> is also available through
the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> directive <a class="link" href="#format-dot"><code class="literal">~.</code></a>.</p><p>A technique for avoiding unnecessary blank lines in output is to
begin each chunk of output with a call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> and to terminate it
with a call to <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>.</p><p>See also <a class="xref" href="#newline-convention" title="21.6. Newline Convention">Section 21.6, “Newline Convention”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="open"></a>21.12. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a> accepts an additional keyword <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>.</p><div class="variablelist"><p class="title"><strong>The acceptable values for the arguments to the
<a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> functions</strong></p><dl class="variablelist"><dt><a id="eltype"></a><span class="term"><a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a></span></dt><dd><p class="simpara">types equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>, <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> <em class="replaceable"><code>n</code></em>)</code></span>; if the stream is to be
un<a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>, <em class="replaceable"><code>n</code></em> must be a multiple of 8.</p><p class="simpara">If <em class="replaceable"><code>n</code></em> is not a multiple of 8, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will use the
specified number of bits for i/o, and write the file length
(as a number of <em class="replaceable"><code>n</code></em>-bit bytes) in the preamble.</p><p class="simpara">This is done to ensure the input/output consistency:
suppose you open a file with <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> of <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 3)</code></span> and write 7 bytes
(i.e., 21 bit) there.
The underlying OS can do input/output only in whole 8-bit bytes.
Thus the OS will report the size of the file as 3 (8-bit) bytes.
Without the preamble <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will have no way to know how many
3-bit bytes to read from this file - 6, 7 or 8.</p><p class="simpara">See also <a class="xref" href="#stream-eltype" title="21.8. Function STREAM-ELEMENT-TYPE">Section 21.8, “Function <code class="function">STREAM-ELEMENT-TYPE</code>”</a>.</p></dd><dt><a id="extfmt"></a><span class="term"><a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a></span></dt><dd><p class="simpara"><a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s, (constant) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s in the
<a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a> package, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s (denoting <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a>-based encodings),
the symbol <code class="constant">:DEFAULT</code>, and the <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> keywords
<code class="constant">:UNIX</code>, <code class="constant">:MAC</code>, <code class="constant">:DOS</code>. The default encoding is <a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a>.
This argument determines how the lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> data is
converted to/from the 8-bit bytes that the underlying OS uses.</p><p class="simpara">See also <a class="xref" href="#stream-extfmt" title="21.7. Function STREAM-EXTERNAL-FORMAT">Section 21.7, “Function <code class="function">STREAM-EXTERNAL-FORMAT</code>”</a>.</p></dd><dt><a id="buffered"></a><span class="term"><a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a></span></dt><dd><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, or <code class="constant">:DEFAULT</code>.
Have <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> manage an internal buffer for input or output (in
addition to the buffering that might be used by the underlying OS).
Buffering is a known general technique to significantly speed up i/o.
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">for functions that create <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s and
<a class="link" href="#pipe" title="32.7.2. Pipes">pipes</a>, <code class="constant">:DEFAULT</code> is equivalent to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> on the input side and to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on the output side; if you are
transmitting a lot of data then using buffering
will significantly speed up your i/o;</li><li class="listitem">for functions that <a class="link" href="#open" title="21.12. Function OPEN">open</a>
files, <code class="constant">:DEFAULT</code> means that buffered file streams will be returned
for regular files and (on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>) block-devices, and unbuffered file
streams for special files.</li></ul></div><p>
Note that some files, notably those on the <code class="filename">/proc</code>
filesystem (on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems), are actually, despite their innocuous
appearance, special files, so you might need to supply an explicit
<a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> argument for them. Actually, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> detects that
the file is a <code class="filename">/proc</code> file, so that one is covered,
but there are probably more strange beasts out there!
</p></dd></dl></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="reopen"></a>Variable <a class="link" href="#reopen" title="Variable CUSTOM:*REOPEN-OPEN-FILE*"><code class="varname">CUSTOM:*REOPEN-OPEN-FILE*</code></a></h3></div></div></div><p>When an already opened file is opened again, and <span class="strong"><strong>not</strong></span> both the
existing and the new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s are read-only (i.e., <code class="constant">:DIRECTION</code> is
<code class="constant">:INPUT</code> or <code class="constant">:INPUT-IMMUTABLE</code>), the streams can
mess up each other and produce unexpected results.
The user variable <strong class="first"><em class="firstterm"><a class="link" href="#reopen" title="Variable CUSTOM:*REOPEN-OPEN-FILE*"><code class="varname">CUSTOM:*REOPEN-OPEN-FILE*</code></a></em></strong> controls how <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
handles the situation and can take 4 values: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>
do nothing: do not even check that there are other <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s
pointing to the same file</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_warn.html" target="_top"><code class="function">WARN</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> and proceed</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>
the <span class="emphasis"><em>other</em></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s and proceed
(this could be dangerous and is not generally recommended)
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> (default)</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>
a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clear-input"></a>21.13. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_clear-input.html" target="_top"><code class="function">CLEAR-INPUT</code></a></h2></div></div></div><p>Calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_clear-input.html" target="_top"><code class="function">CLEAR-INPUT</code></a> on a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> removes the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> state,
thus making it available for further input.</p><p>This allows reading from a file as it is being appended to,
as if with <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/tail.html"><span class="command"><strong>tail -f</strong></span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="close"></a>21.14. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a></h2></div></div></div><p>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, see
<a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a>.</p><p>When the <code class="constant">:ABORT</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> will not
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> even when the underlying OS call fails.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-outpu_tream-string.html" target="_top"><code class="function">GET-OUTPUT-STREAM-STRING</code></a> returns the same value after
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> as it would before it.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> on an already closed <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> does nothing and returns
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</p><p>If you do not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> your <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> explicitly, it will be
closed at <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion time automatically
(with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> <em class="replaceable"><code>stream</code></em> <code class="constant">:ABORT</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>).
This is <span class="strong"><strong>not</strong></span> recommended though because <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is not deterministic.
Please use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> etc.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="open-stream-p"></a>21.15. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a></h2></div></div></div><p>Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, see
<a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="broadcast-stream"></a>21.16. Class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">INPUT-STREAM-P</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_interactive-stream-p.html" target="_top"><code class="function">INTERACTIVE-STREAM-P</code></a> return false for
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_broadcast-stream.html" target="_top"><code class="classname">BROADCAST-STREAM</code></a>s.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stream-buffer"></a>21.17. Functions
<strong class="first"><em class="firstterm"><code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
<a id="stream-buffer-i" class="indexterm"></a></em></strong> and
<strong class="first"><em class="firstterm"><code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
<a id="stream-buffer-o" class="indexterm"></a></em></strong>
</h2></div></div></div><p><strong><code class="code">(EXT:MAKE-BUFFERED-OUTPUT-STREAM
<em class="replaceable"><code>function</code></em>)</code>. </strong>Returns a buffered <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>.
<em class="replaceable"><code>function</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> expecting one argument, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-char.html" target="_top"><code class="function">WRITE-CHAR</code></a> collects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s in a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, until a
newline character is written or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FINISH-OUTPUT</code></a> is called.
Then <em class="replaceable"><code>function</code></em> is called with a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a> as argument,
that contains the characters collected so far.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">CLEAR-OUTPUT</code></a> discards the characters collected so far.</p><p><strong><code class="code">(EXT:MAKE-BUFFERED-INPUT-STREAM <em class="replaceable"><code>function</code></em>
<em class="replaceable"><code>mode</code></em>)</code>. </strong>Returns a buffered <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>.
<em class="replaceable"><code>function</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of 0 arguments that returns
either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (stands for <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>) or up to three values
<em class="replaceable"><code>string</code></em>, <em class="replaceable"><code>start</code></em>, <em class="replaceable"><code>end</code></em>.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> returns the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s of the current <em class="replaceable"><code>string</code></em> one
after another, as delimited by <em class="replaceable"><code>start</code></em> and <em class="replaceable"><code>end</code></em>, which default to
<code class="literal">0</code> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, respectively.
When the <em class="replaceable"><code>string</code></em> is consumed, <em class="replaceable"><code>function</code></em> is called again.
The <em class="replaceable"><code>string</code></em> returned by <em class="replaceable"><code>function</code></em> should not be changed by the user.
<em class="replaceable"><code>function</code></em> should copy the <em class="replaceable"><code>string</code></em> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_copy-seq.html" target="_top"><code class="function">COPY-SEQ</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_subseq.html" target="_top"><code class="function">SUBSEQ</code></a> before
returning if the original <em class="replaceable"><code>string</code></em> is to be modified.
<em class="replaceable"><code>mode</code></em> determines the behavior of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a>
when the current <em class="replaceable"><code>string</code></em> buffer is empty:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>the stream acts like a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>,
i.e. <em class="replaceable"><code>function</code></em> is called</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></span></dt><dd>the stream acts like an interactive stream without
<code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code>, i.e. one can assume that further characters will always
arrive, without calling <em class="replaceable"><code>function</code></em></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a></span></dt><dd>this <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> tells, upon call, if further
non-empty <em class="replaceable"><code>string</code></em>s are to be expected.</dd></dl></div><p>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_clear-input.html" target="_top"><code class="function">CLEAR-INPUT</code></a> discards the rest of the current <em class="replaceable"><code>string</code></em>,
so <em class="replaceable"><code>function</code></em> will be called upon the next <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> operation.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="stream-handles"></a>21.18. Function
<code class="function">EXT:STREAM-HANDLES</code></h2></div></div></div><p>The function <code class="code">(EXT:STREAM-HANDLES <em class="replaceable"><code>stream</code></em>)</code> returns
two values:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">The OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> for the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> side of the
<em class="replaceable"><code>stream</code></em>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the <em class="replaceable"><code>stream</code></em> is an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a>-only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
or if there is no <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> associated with it.</li><li class="listitem">The OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> for the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> side of the
<em class="replaceable"><code>stream</code></em>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the <em class="replaceable"><code>stream</code></em> is an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a>-only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
or if there is no <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> associated with it.</li></ol></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>It is dangerous to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s returned by
this function. This may lead to <code class="constant">EBADF</code>
OS <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s and, eventually, segmentation faults. Always use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>
on the original Lisp <em class="replaceable"><code>stream</code></em>s instead.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="printer"></a>Chapter 22. Printer <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-22.html">[chap-22]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#multi-rep">22.1. Multiple Possible Textual Representations sec_22-1-1-1</a></span></dt><dt><span class="section"><a href="#write-float-decimal">22.2. Printing Floats sec_22-1-3-1-3</a></span></dt><dt><span class="section"><a href="#spacecharprint">22.3. Printing Characters sec_22-1-3-2</a></span></dt><dt><span class="section"><a href="#sym-pack-prefix">22.4. Package Prefixes for Symbols sec_22-1-3-3-1</a></span></dt><dt><span class="section"><a href="#print-vector">22.5. Printing Other Vectors sec_22-1-3-7</a></span></dt><dt><span class="section"><a href="#print-array">22.6. Printing Other Arrays sec_22-1-3-8</a></span></dt><dd><dl><dt><span class="section"><a href="#pathprint">22.6.1. Printing Pathnames sec_22-1-3-11</a></span></dt></dl></dd><dt><span class="section"><a href="#clpp">22.7. The Lisp Pretty Printer sec_22-2</a></span></dt><dd><dl><dt><span class="section"><a href="#pp-dispatch">22.7.1. Pretty Print Dispatch Table sec_22-2-1-4</a></span></dt></dl></dd><dt><span class="section"><a href="#print-formatted">22.8. Formatted Output sec_22-3</a></span></dt><dt><span class="section"><a href="#write">22.9. Functions <code class="function">WRITE</code> & <code class="function">WRITE-TO-STRING</code></a></span></dt><dt><span class="section"><a href="#print-unreadable-object">22.10. Macro <code class="function">PRINT-UNREADABLE-OBJECT</code></a></span></dt><dt><span class="section"><a href="#print-misc">22.11. Miscellaneous Issues</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="multi-rep"></a>22.1. Multiple Possible Textual Representations
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-1-1.html">[sec_22-1-1-1]</a></h2></div></div></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pr-closure"></a>Variable <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a></h3></div></div></div><p>An additional variable <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> controls whether compiled and
interpreted functions (closures) are output in detailed form.
If <a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a readable syntax is used for closures:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">interpreted closures</span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-13.html"><span class="data"><code class="literal">#S</code></span></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> ...)</dd><dt><span class="term">compiled closures</span></dt><dd><span class="data"><code class="literal">#Y(...)</code></span> (this is what you
would see if you open a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <code class="filename">#P".fas"</code> in a text editor)</dd></dl></div><p>This feature is turned off by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-stan_rd-io-syntax.html" target="_top"><code class="function">WITH-STANDARD-IO-SYNTAX</code></a> because
it is easy to get wrong (see below) and non-portable.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Closures often refer to value cells or other entities from the
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. The correct operation of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> may depend on the access
to the same value cells as some other, related <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s.
If you want to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> back <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s so that their semantics
is preserved, you have to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> <span class="strong"><strong>all</strong></span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s that share
some structure in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> <span class="emphasis"><em>together</em></span>, and you have to
either bind <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-stan_rd-io-syntax.html" target="_top"><code class="function">WITH-STANDARD-IO-SYNTAX</code></a>:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> my-pop my-push)
`(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((storage ()))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_pop.html" target="_top"><code class="function">POP</code></a> storage))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (x) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_push.html" target="_top"><code class="function">PUSH</code></a> x storage)))))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((pair (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-from-string.html" target="_top"><code class="function">READ-FROM-STRING</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-stan_rd-io-syntax.html" target="_top"><code class="function">WITH-STANDARD-IO-SYNTAX</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">PRIN1-TO-STRING</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a> my-pop my-push)))))))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> my-pop-1 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a> pair)
my-push-1 (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> pair)))
</pre><p>
Note that <code class="function">my-pop</code> and <code class="function">my-push</code>
share environment between themselves but <span class="strong"><strong>not</strong></span> with
<code class="function">my-pop-1</code> and <code class="function">my-push-1</code> which
can be easily seen if you do </p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a> my-pop my-push my-pop-1 my-push-1)))
</pre><p> but which is not at all obvious from the usual
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html"><span class="data"><code class="literal">#<</code></span></a> output.</p></div><p><a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a> is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pr-rpars"></a>Variable <a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a></h3></div></div></div><p>An additional variable <a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a> controls
the output of the right (closing) parentheses.
If <a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, closing parentheses which do not fit onto
the same line as the the corresponding opening parenthesis are output
just below their corresponding opening parenthesis, in the same column.
</p><p><a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a> is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pr-indent"></a>Variable <a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a></h3></div></div></div><p>An additional variable <a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a> controls the indentation of
lists that span more than one line.
It specifies by how many characters items within the list will be
indented relative to the beginning of the list.</p><p><a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a> is initially set to <code class="literal">1</code>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="ppr-first-newline"></a>Variable <a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a></h3></div></div></div><p>An additional variable <a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a> controls
pretty-printing of multi-line objects.
When <a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
and the current line already has some characters on it,
and the next object will be printed on several lines,
and it does not start with a <span class="keysym">#\Newline</span>,
then a <span class="keysym">#\Newline</span> is printed before the object.
E.g., when you type <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> "return value: ~S~%" <em class="replaceable"><code>v</code></em>)</code>
you want want to see a terse one-line output when <em class="replaceable"><code>v</code></em> is something
short (like <code class="literal">0</code> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>), but you probably want to see
something nice, like </p><pre class="screen">
return value:
(long list which does not fit
on one line)</pre><p>
instead of </p><pre class="screen">
return value: (long list which does not fit
on one line)</pre><p> when it does not.</p><p><a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a> has no effect if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-prettyst.html" target="_top"><code class="varname">*PRINT-PRETTY*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p><a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a> is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="write-float-decimal"></a>22.2. Printing Floats
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-1-3.html">[sec_22-1-3-1-3]</a></h2></div></div></div><p>In the absence of <a class="link" href="#write-float-decimal" title="22.2. Printing Floats sec_22-1-3-1-3"><code class="function">SYS::WRITE-FLOAT-DECIMAL</code></a>, floating point numbers
are output in radix 2. This function is defined in <a class="link" href="#floatprint-lisp"><code class="filename">floatprint.lisp</code></a>
and is not available if you run <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> without a <a href="impnotes.html#image" class="olink">memory image</a> (which
you should never do anyway!)</p><p>If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stread-de_oat-formatst.html" target="_top"><code class="varname">*READ-DEFAULT-FLOAT-FORMAT*</code></a>
has no influence on the way <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>s are printed.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spacecharprint"></a>22.3. Printing Characters
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-2.html">[sec_22-1-3-2]</a></h2></div></div></div><p>Characters are printed as specified in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] using
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-1.html"><span class="data"><code class="literal">#\</code></span></a>, with one exception: when <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#printer_escaping">printer escaping</a> is in effect,
the space character is printed as
<span class="quote">“<span class="quote"><code class="computeroutput">#\Space</code></span>”</span> when the
variable <a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
When <a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, it is printed as
<span class="quote">“<span class="quote"><code class="computeroutput">#\ </code></span>”</span>; this is how
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specifies it.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="sym-pack-prefix"></a>22.4. Package Prefixes for Symbols
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-3-1.html">[sec_22-1-3-3-1]</a></h2></div></div></div><p><a id="pr-sym-pack-prefix"></a><strong>Variable <a class="link" href="#pr-sym-pack-prefix" title="Variable CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*"><code class="function">CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*</code></a>. </strong>When <a class="link" href="#pr-sym-pack-prefix" title="Variable CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*"><code class="function">CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the package
prefix is not the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_package-name.html" target="_top"><code class="function">PACKAGE-NAME</code></a> but the shortest (nick)name as
returned by <a class="link" href="#package-shortest-name"><code class="function">EXT:PACKAGE-SHORTEST-NAME</code></a>. This variable is ignored when
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-vector"></a>22.5. Printing Other Vectors
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-7.html">[sec_22-1-3-7]</a></h2></div></div></div><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true, other vectors are written as
follows: if the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-element-type.html" target="_top"><code class="function">ARRAY-ELEMENT-TYPE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>, the syntax
<code class="computeroutput">#(<em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>)</code> is used.
Otherwise, the syntax <code class="computeroutput">#A(<em class="replaceable"><code>element-type</code></em>
<em class="replaceable"><code>dimensions</code></em> <em class="replaceable"><code>contents</code></em>)</code> is used.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-array"></a>22.6. Printing Other Arrays
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-8.html">[sec_22-1-3-8]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#pathprint">22.6.1. Printing Pathnames sec_22-1-3-11</a></span></dt></dl></div><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true, other arrays are written as
follows: if the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-element-type.html" target="_top"><code class="function">ARRAY-ELEMENT-TYPE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>, the syntax
<code class="computeroutput"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-12.html"><span class="data"><code class="literal">#<em class="replaceable"><code>rank</code></em>A</code></span></a> <em class="replaceable"><code>contents</code></em></code> is used.
Otherwise, the syntax <code class="computeroutput">#A(<em class="replaceable"><code>element-type</code></em> <em class="replaceable"><code>dimensions</code></em>
<em class="replaceable"><code>contents</code></em>)</code> is used.</p><p>As explicitly permitted by this section, specialized <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bit.html" target="_top"><code class="classname">BIT</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>s are printed with the innermost lists generated
by the printing algorithm being instead printed using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_bit-vector.html" target="_top"><code class="classname">BIT-VECTOR</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> syntax, respectively.</p><p><a id="pr-empty-arr-ansi"></a><strong>Variable <a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a>. </strong>Empty <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>s, i.e., arrays with no elements and zero
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_array-total-size.html" target="_top"><code class="function">ARRAY-TOTAL-SIZE</code></a> (because one of its dimensions is zero) are printed
with the readable syntax <code class="computeroutput">#A(<em class="replaceable"><code>element-type</code></em> <em class="replaceable"><code>dimensions</code></em>
<em class="replaceable"><code>contents</code></em>)</code>, unless the variable <a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a> is
non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case the arrays are printed using the
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]-prescribed syntax <code class="computeroutput"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-12.html"><span class="data"><code class="literal">#<em class="replaceable"><code>rank</code></em>A</code></span></a> <em class="replaceable"><code>contents</code></em></code>
which often loses the dimension information.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pathprint"></a>22.6.1. Printing Pathnames
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-1-3-11.html">[sec_22-1-3-11]</a></h3></div></div></div><p>Pathnames are printed as follows: If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-escapest.html" target="_top"><code class="varname">*PRINT-ESCAPE*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
only the namestring is printed; otherwise it is printed with the
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-14.html"><span class="data"><code class="literal">#P</code></span></a> syntax, as per the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issue <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss276.html" target="_top">PRINT-READABLY-BEHAVIOR:CLARIFY</a>.
But, if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true, we are in trouble as <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-14.html"><span class="data"><code class="literal">#P</code></span></a> is
ambiguous (which is verboten when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> is true), while
being mandated by the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
Therefore, in this case, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s behavior is determined by the value
of <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a>: when it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, we print pathnames like this:
<code class="computeroutput"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-18.html"><span class="data"><code class="literal">#-</code></span></a>CLISP <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-14.html"><span class="data"><code class="literal">#P</code></span></a>"..."
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-17.html"><span class="data"><code class="literal">#+</code></span></a>CLISP <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-13.html"><span class="data"><code class="literal">#S</code></span></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a> ...)</code>.
Otherwise, when the variable <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-14.html"><span class="data"><code class="literal">#P</code></span></a> notation is used as per <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_1-5-1-4-1.html">[sec_1-5-1-4-1]</a>
<span class="quote">“<span class="quote">Resolution of Apparent Conflicts in Exceptional Situations</span>”</span>.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-13.html"><span class="data"><code class="literal">#S</code></span></a> notation for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>s is used
extensively in the [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] (see examples for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathname.html" target="_top"><code class="function">PATHNAME</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_pathnamep.html" target="_top"><code class="function">PATHNAMEP</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> et al), but was decided against, see
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss260.html" target="_top">PATHNAME-PRINT-READ:SHARPSIGN-P</a>.</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>When both <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a> and <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a> are
non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the namestring will be parsed to a dissimilar object
(with the current value of <a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a>), an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> of type
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_print-not-readable.html" target="_top"><code class="classname">PRINT-NOT-READABLE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clpp"></a>22.7. The Lisp Pretty Printer
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-2.html">[sec_22-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#pp-dispatch">22.7.1. Pretty Print Dispatch Table sec_22-2-1-4</a></span></dt></dl></div><p>The Lisp Pretty Printer implementation is <span class="strong"><strong>not</strong></span> perfect yet.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_pprint-logical-block.html" target="_top"><code class="function">PPRINT-LOGICAL-BLOCK</code></a> does not respect <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-linesst.html" target="_top"><code class="varname">*PRINT-LINES*</code></a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pp-dispatch"></a>22.7.1. Pretty Print Dispatch Table
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-2-1-4.html">[sec_22-2-1-4]</a></h3></div></div></div><p>A <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#pprint_dispatch_table">pprint dispatch table</a> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a>
of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-p_t-dispatchst.html" target="_top"><code class="varname">*PRINT-PPRINT-DISPATCH*</code></a> and an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> which maps
types into priorities and print functions.
Their use is strongly discouraged because of the performance issues:
when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-p_t-dispatchst.html" target="_top"><code class="varname">*PRINT-PPRINT-DISPATCH*</code></a> is non-trivial and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-prettyst.html" target="_top"><code class="varname">*PRINT-PRETTY*</code></a>
is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, printing of every object requires a lookup in the table,
which entails many calls to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_typep.html" target="_top"><code class="function">TYPEP</code></a> (which cannot be made fast
enough).</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-formatted"></a>22.8. Formatted Output
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3.html">[sec_22-3]</a></h2></div><div><h3 class="subtitle">Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a></h3></div></div></div><p>The additional <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instruction
<strong class="first"><em class="firstterm"><code class="literal">~!</code><a id="format-bang" class="indexterm"></a></em></strong>
is similar to <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-5-4.html"><code class="literal">~/</code></a>, but avoids putting a function name into a
string, thus it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> in the current <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a>, so, even if the
function is not interned in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package, you might not need
to specify the package explicitly.
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <em class="replaceable"><code>stream</code></em> "~arguments!" <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>object</code></em>)</code> is
equivalent to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>object</code></em>
<em class="replaceable"><code>colon-modifier-p</code></em>
<em class="replaceable"><code>atsign-modifier-p</code></em> <em class="replaceable"><code>arguments</code></em>)</code>.</p><p>The additional <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> instruction
<strong class="first"><em class="firstterm"><code class="literal">~.</code><a id="format-dot" class="indexterm"></a></em></strong>
is a kind of opposite to <code class="code">~&</code>: It outputs a conditional
newline, by calling the function <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>.
<code class="code">~<em class="replaceable"><code>n</code></em>.</code> outputs <em class="replaceable"><code>n-1</code></em> newlines
followed by an <a class="link" href="#elastic-newline" title="21.11. Function EXT:ELASTIC-NEWLINE"><code class="function">EXT:ELASTIC-NEWLINE</code></a>. <code class="code">~0.</code> does nothing.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-1.html"><code class="literal">~R</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-2-1.html"><code class="literal">~:R</code></a> can output only
integers in the range <code class="code">|<em class="replaceable"><code>n</code></em>| <
<em class="replaceable"><code>10<sup>66</sup></code></em></code>.
The output is in English, according to the American conventions, and
these conventions are identical to the British conventions only in the
range <code class="code">|<em class="replaceable"><code>n</code></em>| <
<em class="replaceable"><code>10<sup>9</sup></code></em></code>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-1-1.html"><code class="literal">~:@C</code></a> does not output the character itself, only the
instruction how to type the character.</p><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-3.html"><code class="literal">~G</code></a>, the value of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stread-de_oat-formatst.html" target="_top"><code class="varname">*READ-DEFAULT-FLOAT-FORMAT*</code></a> does not matter if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-readablyst.html" target="_top"><code class="varname">*PRINT-READABLY*</code></a>
is true.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-6-1.html"><code class="literal">~T</code></a> can determine the current column of any
built-in stream.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="write"></a>22.9. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a> & <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">WRITE-TO-STRING</code></a></h2></div></div></div><p>The functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">WRITE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">WRITE-TO-STRING</code></a> have an additional
keyword argument <code class="constant">:CLOSURE</code> which is used to bind
<a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-unreadable-object"></a>22.10. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_print-unr_dable-object.html" target="_top"><code class="function">PRINT-UNREADABLE-OBJECT</code></a></h2></div></div></div><p><a id="pr-unreadable-ansi"></a><strong>Variable <a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a>. </strong>The macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_print-unr_dable-object.html" target="_top"><code class="function">PRINT-UNREADABLE-OBJECT</code></a>, when invoked without body forms,
suppresses the trailing space if only the type is to be printed, and
suppresses the leading space if only the identity is to be printed. This
behaviour can be turned off set setting the variable <a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a>
to a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> value: in this case, a trailing or leading space are output,
as prescribed by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="print-misc"></a>22.11. Miscellaneous Issues</h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-casest.html" target="_top"><code class="varname">*PRINT-CASE*</code></a> controls the output not only of symbols, but also
of characters and some <span class="data"><code class="literal"><a href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-20.html">#<</a>unreadable></code></span> objects.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-prettyst.html" target="_top"><code class="varname">*PRINT-PRETTY*</code></a> is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> but set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>
in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>. This makes screen output prettier.
</dd></dl></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-arrayst.html" target="_top"><code class="varname">*PRINT-ARRAY*</code></a> is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="reader"></a>Chapter 23. Reader <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-23.html">[chap-23]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#rt-case">23.1. Effect of Readtable Case on the Lisp Reader sec_23-1-2</a></span></dt><dt><span class="section"><a href="#recursive-p">23.2. The <em class="replaceable"><code>recursive-p</code></em> argument sec_23-1-3-2</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="rt-case"></a>23.1. Effect of Readtable Case on the Lisp Reader
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_23-1-2.html">[sec_23-1-2]</a></h2></div></div></div><p>When the value of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_readtable-case.html" target="_top"><code class="function">READTABLE-CASE</code></a>
<em class="replaceable"><code>readtable</code></em>)</code> is
<code class="constant">:INVERT</code>, it applies to the package name and the
symbol name of a symbol separately (not to the entire token at once).
An alternative to the use of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_readtable-case.html" target="_top"><code class="function">READTABLE-CASE</code></a> is the use of the
<a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> option of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="recursive-p"></a>23.2. The <em class="replaceable"><code>recursive-p</code></em> argument
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_23-1-3-2.html">[sec_23-1-3-2]</a></h2></div></div></div><p>When non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>recursive-p</code></em> argument is passed to a top-level <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a>
call, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="system"></a>Chapter 24. System Construction
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-24.html">[chap-24]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#compilefile">24.1. Function <code class="function">COMPILE-FILE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#compile-file-output">24.1.1. Output files</a></span></dt><dt><span class="section"><a href="#compile-file-return">24.1.2. Return values</a></span></dt></dl></dd><dt><span class="section"><a href="#compile-file-path">24.2. Function <code class="function">COMPILE-FILE-PATHNAME</code></a></span></dt><dt><span class="section"><a href="#require">24.3. Function <code class="function">REQUIRE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#require-return">24.3.1. Return value</a></span></dt><dt><span class="section"><a href="#require-search">24.3.2. Additional <code class="function">LOAD</code> locations</a></span></dt><dt><span class="section"><a href="#module-providers">24.3.3. User variable <code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></span></dt><dt><span class="section"><a href="#lib-files">24.3.4. Interaction with <code class="function">COMPILE-FILE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#loadfile">24.4. Function <code class="function">LOAD</code></a></span></dt><dt><span class="section"><a href="#features">24.5. Variable <code class="varname">*FEATURES*</code></a></span></dt><dt><span class="section"><a href="#featurep">24.6. Function <code class="function">EXT:FEATUREP</code> [CLRFI-1]</a></span></dt><dt><span class="section"><a href="#compiled-file-p">24.7. Function <code class="function">EXT:COMPILED-FILE-P</code> [CLRFI-2]</a></span></dt></dl></div><p>The compiler can be called not only by the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a>,
<a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>, but also by the declaration
<a class="link" href="#compile-decl" title="3.3.6. Declaration (COMPILE)"><code class="code">(COMPILE)</code></a>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compilefile"></a>24.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#compile-file-output">24.1.1. Output files</a></span></dt><dt><span class="section"><a href="#compile-file-return">24.1.2. Return values</a></span></dt></dl></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> compiles a file to a platform-independent
<a href="impnotes.html#bytecode" class="olink">bytecode</a>:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> <em class="replaceable"><code>filename</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:OUTPUT-FILE</code> :LISTING <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a>
((<code class="constant">:WARNINGS</code> <a class="link" href="#compile-warn"><code class="varname">CUSTOM:*COMPILE-WARNINGS*</code></a>) <a class="link" href="#compile-warn"><code class="varname">CUSTOM:*COMPILE-WARNINGS*</code></a>)
((<code class="constant">:VERBOSE</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-VERBOSE*</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-VERBOSE*</code></a>)
((<code class="constant">:PRINT</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-PRINT*</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-PRINT*</code></a>))
</pre><div class="variablelist"><a id="compile-file-arguments"></a><p class="title"><strong>Options for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a></strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>filename</code></em></span></dt><dd>the file to be compiled, should be a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>.
</dd><dt><span class="term"><code class="constant">:OUTPUT-FILE</code></span></dt><dd>should be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a> or an
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>. The default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</dd><dt><span class="term"><code class="constant">:LISTING</code></span></dt><dd>should be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a> or an
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>. The default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a></span></dt><dd>the <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a> of the <em class="replaceable"><code>filename</code></em>.
</dd><dt><span class="term"><code class="constant">:WARNINGS</code></span></dt><dd>specifies whether warnings should also appear on the
screen.</dd><dt><span class="term"><code class="constant">:VERBOSE</code></span></dt><dd>specifies whether error messages should also appear
on the screen.</dd><dt><span class="term"><code class="constant">:PRINT</code></span></dt><dd>specifies whether an indication which forms are
being compiled should appear on the screen.
</dd></dl></div><p>The variables <strong class="first"><em class="firstterm"><a class="link" href="#compile-warn"><code class="varname">CUSTOM:*COMPILE-WARNINGS*</code></a>
<a id="compile-warn" class="indexterm"></a></em></strong>
(initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-VERBOSE*</code></a> (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>,
affected by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stcompile_le-verbosest.html" target="_top"><code class="varname">*COMPILE-PRINT*</code></a> (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
affected by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code>) provide defaults for the <code class="constant">:WARNINGS</code>, <code class="constant">:VERBOSE</code>,
<code class="constant">:PRINT</code> keyword arguments, respectively, and are bound by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a>
to the values of the arguments, i.e., these arguments are recursive.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-file-output"></a>24.1.1. Output files</h3></div></div></div><p>For each input file (default file type: <code class="filename">#P".lisp"</code>)
the following files are generated:
</p><div class="informaltable"><a id="compile-file-new-files-table"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col align="left" /></colgroup><thead><tr><th align="center">File</th><th align="center">When</th><th align="center">Default file type</th><th align="left">Contents</th></tr></thead><tbody><tr><td align="center">output file</td><td align="center">only if <code class="constant">:OUTPUT-FILE</code> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><code class="filename">#P".fas"</code></td><td align="left">can be loaded using the <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> function</td></tr><tr><td align="center">auxiliary output file</td><td align="center">only if <code class="constant">:OUTPUT-FILE</code> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a></td><td align="left">used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> when compiling a <a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> form referring
to the input file</td></tr><tr><td align="center">listing file</td><td align="center">only if <code class="constant">:LISTING</code> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><code class="filename">#P".lis"</code></td><td align="left">disassembly of the output file</td></tr><tr><td align="center"><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> output file</td><td align="center">only if <code class="constant">:OUTPUT-FILE</code> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><code class="filename">#P".c"</code></td><td align="left"><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>; this file is created only if the source contains
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms</td></tr></tbody></table></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="c-file-overwrite"></a>Warning</h3><p>If you have two files in the same
directory - <code class="filename">#P"foo.lisp"</code> and <code class="filename">#P"foo.c"</code>, and you
compile the first file with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, the second file will be
<span class="emphasis"><em>clobbered</em></span> if you have any <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms in
the first one!</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-file-return"></a>24.1.2. Return values</h3></div></div></div><p>As per [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> returns 3 values:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">output-truename</span></dt><dd>the truename of the output <code class="filename">#P".fas"</code>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
if the file could not be created, in which case the compilation is
considered to have failed</dd><dt><span class="term">warnings-p</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if no conditions of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>
were detected during compilation, and the number of such conditions otherwise
</dd><dt><span class="term">failure-p</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if no conditions of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>
(other than <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a>) were detected during compilation,
and the number of such conditions otherwise
</dd></dl></div><p>
Since <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> tends to be relatively garrulous with warnings
(see, e.g., <a class="xref" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4">Section 12.2.4.1, “Rule of Float Precision Contagion sec_12-1-4-4”</a>), the non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> tertiary return value
(called <em class="replaceable"><code>failure-p</code></em> by the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>])
does <span class="strong"><strong>not</strong></span> indicate a failure of compilation.
The correct way to check whether <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> has failed is the
<span class="emphasis"><em>primary</em></span> return value.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compile-file-path"></a>24.2. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file-pathname.html" target="_top"><code class="function">COMPILE-FILE-PATHNAME</code></a></h2></div></div></div><p>The default for the <code class="constant">:OUTPUT-FILE</code> argument is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, which means <code class="filename">#P".fas"</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="require"></a>24.3. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#require-return">24.3.1. Return value</a></span></dt><dt><span class="section"><a href="#require-search">24.3.2. Additional <code class="function">LOAD</code> locations</a></span></dt><dt><span class="section"><a href="#module-providers">24.3.3. User variable <code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></span></dt><dt><span class="section"><a href="#lib-files">24.3.4. Interaction with <code class="function">COMPILE-FILE</code></a></span></dt></dl></div><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> receives as the optional argument either
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>s: files to be <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a>ed
if the required module is not already present.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="require-return"></a>24.3.1. Return value</h3></div></div></div><p>When the module is already present, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is returned;
otherwise returns the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a> which was loaded to satisfy the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a>ment
(or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> thereof iff the second argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="require-search"></a>24.3.2. Additional <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> locations</h3></div></div></div><p>In addition to (and <span class="strong"><strong>before</strong></span>) <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> tries to
find the file to <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> in the following locations:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> configure flag <code class="option"><a href="impnotes.html#mod-dynload" class="olink">--without-dynamic-modules</a></code>.</span></span></p><p class="simpara">The system-wide external modules directory
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> "dynmod/" <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>)</code>.</p></li><li class="listitem"><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> configure flag <code class="option"><a href="impnotes.html#mod-dynload" class="olink">--without-dynamic-modules</a></code>.</span></span></p><p class="simpara">The user external modules directory <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a>
"dynmod/" <a href="clisp-link.html#opt-install" class="olink"><code class="varname">CUSTOM:*USER-LIB-DIRECTORY*</code></a>)</code>
(when <a href="clisp-link.html#opt-install" class="olink"><code class="varname">CUSTOM:*USER-LIB-DIRECTORY*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).</p></li><li class="listitem">When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> was called while <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a>ing, the
directory with the file being loaded (i.e., <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-pathname.html" target="_top"><code class="function">MAKE-PATHNAME</code></a>
:name <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> :type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> :defaults <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pa_d-truenamest.html" target="_top"><code class="varname">*LOAD-TRUENAME*</code></a>)</code>).
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="module-providers"></a>24.3.3. User variable <a class="link" href="#module-providers" title="24.3.3. User variable CUSTOM::*MODULE-PROVIDER-FUNCTIONS*"><code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></h3></div></div></div><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> is called without the second (pathname) argument,
the elements of the <a class="link" href="#module-providers" title="24.3.3. User variable CUSTOM::*MODULE-PROVIDER-FUNCTIONS*"><code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> are called one by one
on the first (module name) argument until one of them returns non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
If all of them return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> is called as described
<a class="link" href="#require-search" title="24.3.2. Additional LOAD locations">above</a>.</p><p>Initially the lisp is empty; <code class="code">(require "<span class="module"><a class="filename" href="#asdf" title="33.1. A System Definition Facility"><code class="filename">asdf</code></a></span>")</code>
modifies it (<span class="plat-dep">Platform Dependent: <span class="plat-dep">if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was configured with the
option <code class="option">--with-module=asdf</code></span></span>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="lib-files"></a>24.3.4. Interaction with <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a></h3></div></div></div><p>At compile time, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> <code class="filename">#P"foo"</code>)</code>
forms are treated specially: <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a> is searched for
<code class="filename">#P"foo.lisp"</code> <span class="strong"><strong>and</strong></span> <code class="filename">#P"foo.lib"</code>.
If the latest such file is a <code class="filename">#P".lisp"</code>, it is compiled;
otherwise the <a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a> is loaded.
If neither is found, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> <code class="filename">#P"foo"</code>)</code> is called.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="module-user-file-name-conflict"></a>Warning</h3><p>It is a <span class="strong"><strong>very</strong></span> bad
idea to name your files the same way as <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> modules
(whether <a class="link" href="#included-modules" title="32.2.9. Modules included in the source distribution">system-supplied</a>
or <a href="clisp-link.html#opt-install" class="olink">user-installed</a>)
because then <a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> will use different files at compile
and execution times.</p></div><p>The <a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a> is a <span class="quote">“<span class="quote">header</span>”</span> file which contains the
constant, variable, inline and macro definitions necessary for
compilation of the files that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> this file, but not the function
definitions and calls that are not necessary for that.
Thus it is <span class="strong"><strong>not</strong></span> necessary to either enclose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a> forms in
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> or to load the required files in the makefiles: if you have
two files, <code class="filename">#P"foo.lisp"</code> and <code class="filename">#P"bar.lisp"</code>, and the
latter requires the former, you can write in your <code class="filename">Makefile</code>:
</p><pre class="programlisting">
all: foo.fas bar.fas
foo.fas: foo.lisp
clisp <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> foo
bar.fas: bar.lisp foo.fas
clisp <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> bar
</pre><p>
instead of the more cumbersome (and slower, since <a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a>s are
usually smaller and load faster that <code class="filename">#P".fas"</code>s):
</p><pre class="programlisting">
bar.fas: bar.lisp foo.fas
<span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> foo <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> bar
</pre><p>
Thus, you do not need to <code class="code">(<a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> <code class="filename">#P"foo"</code>)</code> in order
to <code class="code">(<a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> <code class="filename">#P"bar.lisp"</code>)</code>.
If memory is tight, and if <code class="filename">#P"foo.lisp"</code> contains only a few inline
functions, macros, constants or variables, this is a space and time
saver. If <code class="filename">#P"foo.lisp"</code> does a lot of initializations or side effects
when being loaded, this is important as well.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="loadfile"></a>24.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a></h2></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> accepts four additional keyword arguments <code class="constant">:ECHO</code>,
<code class="constant">:COMPILING</code>, <code class="constant">:EXTRA-FILE-TYPES</code>, and <code class="constant">:OBSOLETE-ACTION</code>.</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> <em class="replaceable"><code>filename</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> ((<code class="constant">:VERBOSE</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-VERBOSE*</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-VERBOSE*</code></a>)
((<code class="constant">:PRINT</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-PRINT*</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-PRINT*</code></a>)
((<code class="constant">:ECHO</code> <a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a>) <a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a>) <code class="constant">:IF-DOES-NOT-EXIST</code>
((<code class="constant">:COMPILING</code> <a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a>) <a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a>) <code class="constant">:EXTRA-FILE-TYPES</code>
((<code class="constant">:OBSOLETE-ACTION</code> <a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a>) <a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a>)
(ignore-pathname-defaults nil))
</pre><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:VERBOSE</code></span></dt><dd>causes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> to emit a short message that a file is
being loaded. The default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-VERBOSE*</code></a>, which is initially
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, but can be changed by the <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code> option.
</dd><dt><span class="term"><code class="constant">:PRINT</code></span></dt><dd>causes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> to print the value of each form. The
default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-PRINT*</code></a>, which is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, but can be
changed by the <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code> option.</dd><dt><span class="term"><code class="constant">:ECHO</code></span></dt><dd>causes the input from the file to be echoed to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> (normally to the screen). Should there be an
error in the file, you can see at one glance where it is.
The default is <strong class="first"><em class="firstterm"><a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a>
<a id="load-echo" class="indexterm"></a></em></strong>,
which is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, but can be changed by the <code class="option"><a href="clisp.html#opt-verbose" class="olink">-v</a></code> option.
</dd><dt><span class="term"><code class="constant">:COMPILING</code></span></dt><dd>causes each form read to be compiled on the fly.
The compiled code is executed at once and - in contrast to
<a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> - not written to a file.
The default is <strong class="first"><em class="firstterm"><a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a>
<a id="load-comp" class="indexterm"></a></em></strong>,
which is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, but can be changed by the <code class="option"><a href="clisp.html#opt-load-comp" class="olink">-C</a></code> option.
</dd><dt><span class="term"><code class="constant">:EXTRA-FILE-TYPES</code></span></dt><dd><p class="simpara">Specifies the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of additional file types
considered for loading, in addition to <strong class="first"><em class="firstterm"><a class="link" href="#source-types"><code class="varname">CUSTOM:*SOURCE-FILE-TYPES*</code></a>
<a id="source-types" class="indexterm"></a></em></strong>
(which is initially <span class="data"><code class="literal">("lisp" "lsp" "cl")</code></span>)
and <strong class="first"><em class="firstterm"><a class="link" href="#compiled-types"><code class="varname">CUSTOM:*COMPILED-FILE-TYPES*</code></a>
<a id="compiled-types" class="indexterm"></a></em></strong>
(which is initially <span class="data"><code class="literal">("fas")</code></span>).
</p><p class="simpara">When <em class="replaceable"><code>filename</code></em> does not specify a unique file
(e.g., <em class="replaceable"><code>filename</code></em> is <code class="filename">#P"foo"</code> and both <code class="filename">#P"foo.lisp"</code>
and <code class="filename">#P"foo.fas"</code> are found in the
<a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>), then the <span class="emphasis"><em>newest</em></span> file is loaded.
</p></dd><dt><span class="term"><code class="constant">:OBSOLETE-ACTION</code></span></dt><dd><p>Specifies the action to take when loading a
<code class="filename">#P".fas"</code> with a different <a href="impnotes.html#bytecode" class="olink">bytecode</a> version from the one
supported by this <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version. The possible actions are
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:DELETE</code></span></dt><dd>delete the <code class="filename">#P".fas"</code> and proceed as with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
</dd><dt><span class="term"><code class="constant">:ERROR</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>
</dd><dt><span class="term"><code class="constant">:COMPILE</code></span></dt><dd>recompile the source file (if found in <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>)
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> the result</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (default)</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_warn.html" target="_top"><code class="function">WARN</code></a> and <a class="link" href="#load-paths" title="Variable CUSTOM:*LOAD-PATHS*">look
for another matching file</a>
</dd></dl></div><p>
If no file can be loaded and <code class="constant">:IF-DOES-NOT-EXIST</code> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
The default is <strong class="first"><em class="firstterm"><a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a>
<a id="load-obs" class="indexterm"></a></em></strong>,
which is initially <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></dd><dt><span class="term"><code class="constant">:IGNORE-PATHNAME-DEFAULTS</code></span></dt><dd>Do not merge <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdefault_e-defaultsst.html" target="_top"><code class="varname">*DEFAULT-PATHNAME-DEFAULTS*</code></a> to the
argument using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> (as required by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]) and rely
on <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a> instead.</dd></dl></div><p>The variables <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-VERBOSE*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pr_ad-verbosest.html" target="_top"><code class="varname">*LOAD-PRINT*</code></a>,
<a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a>, <a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a>, and <a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a> are bound by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> when it
receives a corresponding keyword argument (<code class="constant">:VERBOSE</code>, <code class="constant">:PRINT</code>,
<code class="constant">:OBSOLETE-ACTION</code>, <code class="constant">:COMPILING</code>, and <code class="constant">:ECHO</code>), i.e., these arguments
are recursive, just like the arguments <code class="constant">:WARNINGS</code>, <code class="constant">:VERBOSE</code>, and
<code class="constant">:PRINT</code> for <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a>.</p><p>When evaluation of a read form <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>, three <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s are
available:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">SKIP</code></span></dt><dd>Skip this form and read the next one.
</dd><dt><span class="term"><code class="literal">RETRY</code></span></dt><dd>Try to evaluate this form again.
</dd><dt><span class="term"><code class="literal">STOP</code></span></dt><dd>Stop loading the file.
</dd></dl></div><p>On success, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> returns the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_truename.html" target="_top"><code class="function">TRUENAME</code></a> of the file which it loaded,
or the <em class="replaceable"><code>filename</code></em> argument if it is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> but not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>.
</p><p><a id="load-paths"></a><strong>Variable <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a>. </strong>The variable <a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a> contains a list of directories where the
files are looked for - in addition to the specified or current
directory - by <a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a>, <a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a>, <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load-logi_translations.html" target="_top"><code class="function">LOAD-LOGICAL-PATHNAME-TRANSLATIONS</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="features"></a>24.5. Variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stfeaturesst.html" target="_top"><code class="varname">*FEATURES*</code></a></h2></div></div></div><p>The variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stfeaturesst.html" target="_top"><code class="varname">*FEATURES*</code></a> initially contains the following symbols
</p><div class="variablelist"><a id="features-table"></a><p class="title"><strong>Default <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stfeaturesst.html" target="_top"><code class="varname">*FEATURES*</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="constant">:CLISP</code></span></dt><dd>the name of this implementation
</dd><dt><span class="term"><code class="constant">:ANSI-CL</code></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#purports_to_conform">purports to
conform</a> to [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]</dd><dt><span class="term"><code class="constant">:COMMON-LISP</code></span></dt><dd>required by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]</dd><dt><span class="term"><code class="constant">:INTERPRETER</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> is implemented</dd><dt><span class="term"><code class="constant">:COMPILER</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> and <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> are implemented
</dd><dt><span class="term"><code class="constant">:SOCKETS</code></span></dt><dd>see <a class="xref" href="#socket" title="32.4. Socket Streams">Section 32.4, “Socket Streams”</a>
</dd><dt><span class="term"><code class="constant">:MT</code></span></dt><dd>see <a class="xref" href="#mt" title="32.5. Multiple Threads of Execution">Section 32.5, “Multiple Threads of Execution”</a>
</dd><dt><span class="term"><code class="constant">:GENERIC-STREAMS</code></span></dt><dd>see <a class="xref" href="#gstream" title="31.6. Generic streams">Section 31.6, “Generic streams”</a>
</dd><dt><span class="term"><code class="constant">:LOGICAL-PATHNAMES</code></span></dt><dd><a class="link" href="#log-path" title="19.4. Logical Pathnames sec_19-3">Logical Pathnames</a>
are implemented</dd><dt><span class="term"><code class="constant">:FFI</code></span></dt><dd>if a foreign function interface
(see <a class="xref" href="#dffi" title="32.3. The Foreign Function Call Facility">Section 32.3, “The Foreign Function Call Facility”</a>) is supported
(<span class="plat-dep">Platform Dependent: <span class="plat-dep">Many <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>
platforms only</span></span>)</dd><dt><span class="term"><code class="constant">:GETTEXT</code></span></dt><dd>if internationalization (see <a class="xref" href="#i18n" title="31.4. Internationalization of CLISP">Section 31.4, “Internationalization of <span class="command"><strong>CLISP</strong></span>”</a>)
using the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">gettext</a> package is supported
(<span class="plat-dep">Platform Dependent: <span class="plat-dep">most <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platforms
only</span></span>)</dd><dt><span class="term"><code class="constant">:UNICODE</code></span></dt><dd>if <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> (ISO 10646) characters are supported
(see <a class="xref" href="#encoding" title="31.5. Encodings">Section 31.5, “Encodings”</a>)</dd><dt><span class="term"><code class="constant">:LOOP</code></span></dt><dd><span class="quote">“<span class="quote">extended</span>”</span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> form is implemented
</dd><dt><span class="term"><code class="constant">:CLOS</code></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> is implemented</dd><dt><span class="term"><code class="constant">:MOP</code></span></dt><dd><a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> is implemented</dd><dt><span class="term"><code class="constant">:WORD-SIZE=64</code></span></dt><dd>if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was built for a 64-bit CPU. This could
be useful on platforms with 64-bit CPUs which have a 32-bit mode
emulation (e.g., <span class="platform">i386</span> is
emulated on <span class="platform">x86_64</span>
and <span class="platform">ia64</span>) so that the user can
decide which ABI library to load dynamically using <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.
</dd><dt><span class="term"><code class="constant">:WIN32</code></span></dt><dd>if <em class="replaceable"><code>hardware</code></em> = PC (clone) and <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>
(Windows 95/98/Me/NT/2000/XP)</dd><dt><span class="term"><code class="constant">:PC386</code></span></dt><dd>if <em class="replaceable"><code>hardware</code></em> = PC (clone). It can be used as an
indicator for the mainstream hardware characteristics (such as the
existence of a graphics card with a non-graphics text mode,
or the presence of a keyboard with arrows and
<span class="keysym">Insert</span>/<span class="keysym">Delete</span> keys,
or an ISA/VLB/PCI bus) or software characteristics (such as the
<span class="keycap"><strong>Control</strong></span>+<span class="keycap"><strong>Alternate</strong></span>+<span class="keysym">Delete</span> keyboard
combination).</dd><dt><span class="term"><code class="constant">:UNIX</code></span></dt><dd>if <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> (in this case the <em class="replaceable"><code>hardware</code></em> is irrelevant!)
</dd><dt><span class="term"><code class="constant">:BEOS</code></span></dt><dd>if <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="https://www.haiku-os.org/" target="_top"><span class="platform">BeOS</span></a> (in that case <code class="constant">:UNIX</code> is also present)
</dd><dt><span class="term"><code class="constant">:CYGWIN</code></span></dt><dd>if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is using the <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> compatibility
layer on top of <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> (in that case <code class="constant">:UNIX</code> is also present)
</dd><dt><span class="term"><code class="constant">:MACOS</code></span></dt><dd>if <em class="replaceable"><code>operating system</code></em> = <a class="ulink" href="http://www.apple.com/macosx/" target="_top"><span class="platform">Mac OS X</span></a> (in that case <code class="constant">:UNIX</code> is also present)
</dd></dl></div><p>Each <a href="impnotes.html#modules" class="olink">module</a> should add the appropriate keyword, e.g.,
<a class="link" href="#syscalls" title="33.2. System Calls"><code class="constant">:SYSCALLS</code></a>,
<a class="link" href="#dir-key" title="33.8. Directory Access"><code class="constant">:DIRKEY</code></a>,
<a class="link" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><code class="constant">:REGEXP</code></a>,
<a class="link" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="constant">:PCRE</code></a>, etc.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="featurep"></a>24.6. Function <code class="function">EXT:FEATUREP</code>
<a class="ulink" href="http://clrfi.alu.org/clrfi/clrfi-1-featurep" target="_top">[CLRFI-1]</a></h2></div></div></div><p><code class="code">(EXT:FEATUREP <em class="replaceable"><code>form</code></em>)</code> provides run-time access to
the read-time conditionals <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-17.html"><span class="data"><code class="literal">#+</code></span></a> and <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-18.html"><span class="data"><code class="literal">#-</code></span></a>.
<em class="replaceable"><code>form</code></em> is a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_24-1-2-1.html">feature exression</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compiled-file-p"></a>24.7. Function <a class="link" href="#compiled-file-p" title="24.7. Function EXT:COMPILED-FILE-P [CLRFI-2]"><code class="function">EXT:COMPILED-FILE-P</code></a>
<a class="ulink" href="http://clrfi.alu.org/clrfi/clrfi-2-compiled-file-p" target="_top">[CLRFI-2]</a></h2></div></div></div><p><code class="code">(<a class="link" href="#compiled-file-p" title="24.7. Function EXT:COMPILED-FILE-P [CLRFI-2]"><code class="function">EXT:COMPILED-FILE-P</code></a> <em class="replaceable"><code>filename</code></em>)</code> returns non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
when the file <em class="replaceable"><code>filename</code></em> exists, is readable, and appears to be a
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-compiled <code class="filename">#P".fas"</code> file compatible with the currently used
<a href="impnotes.html#bytecode" class="olink">bytecode</a> format.</p><p>System definition facilities (such as <a class="ulink" href="http://common-lisp.net/project/asdf/" target="_top"><code class="function">asdf</code></a> or <a class="ulink" href="http://www.cliki.net/mk-defsystem" target="_top"><code class="function">defsystem</code></a>) can
use it to determine whether the file needs to be recompiled.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="environment"></a>Chapter 25. Environment
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-25.html">[chap-25]</a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#repl">25.1. Top Level Loop sec_25-1-1</a></span></dt><dd><dl><dt><span class="section"><a href="#user-commands">25.1.1. User-defined Commands</a></span></dt></dl></dd><dt><span class="section"><a href="#debugger">25.2. Debugging Utilities sec_25-1-2</a></span></dt><dd><dl><dt><span class="section"><a href="#disassemble">25.2.1. Function <code class="function">DISASSEMBLE</code></a></span></dt><dt><span class="section"><a href="#uncompile">25.2.2. Function <code class="function">EXT:UNCOMPILE</code></a></span></dt><dt><span class="section"><a href="#show-stack">25.2.3. Function <code class="function">EXT:SHOW-STACK</code></a></span></dt><dt><span class="section"><a href="#documentation">25.2.4. Function <code class="function">DOCUMENTATION</code></a></span></dt><dt><span class="section"><a href="#describe">25.2.5. Function <code class="function">DESCRIBE</code></a></span></dt><dt><span class="section"><a href="#trace">25.2.6. Macro <code class="function">TRACE</code></a></span></dt><dt><span class="section"><a href="#inspect">25.2.7. Function <code class="function">INSPECT</code></a></span></dt><dt><span class="section"><a href="#time">25.2.8. Macro <code class="function">TIME</code></a></span></dt><dt><span class="section"><a href="#ed">25.2.9. Function <code class="function">ED</code></a></span></dt><dt><span class="section"><a href="#apropos">25.2.10. Functions <code class="function">APROPOS</code> & <code class="function">APROPOS-LIST</code></a></span></dt><dt><span class="section"><a href="#dribble">25.2.11. Function <code class="function">DRIBBLE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#dribble-script">25.2.11.1. Scripting and <code class="function">DRIBBLE</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#environment-enq">25.3. Environment Inquiry sec_25-1-3</a></span></dt><dd><dl><dt><span class="section"><a href="#room">25.3.1. Function <code class="function">ROOM</code></a></span></dt><dt><span class="section"><a href="#gc-sect">25.3.2. Function <code class="function">EXT:GC</code>
</a></span></dt><dt><span class="section"><a href="#machine">25.3.3. Machine</a></span></dt><dt><span class="section"><a href="#version">25.3.4. Function <code class="function">LISP-IMPLEMENTATION-VERSION</code></a></span></dt><dt><span class="section"><a href="#argv">25.3.5. Function <code class="function">EXT:ARGV</code></a></span></dt></dl></dd><dt><span class="section"><a href="#clock">25.4. Time sec_25-1-4</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="repl"></a>25.1. Top Level Loop
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">[sec_25-1-1]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#user-commands">25.1.1. User-defined Commands</a></span></dt></dl></div><p>The debugger may be invoked through the functions
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_invoke-debugger.html" target="_top"><code class="function">INVOKE-DEBUGGER</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_break.html" target="_top"><code class="function">BREAK</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cerror.html" target="_top"><code class="function">CERROR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_warn.html" target="_top"><code class="function">WARN</code></a>.
The stepper is invoked through the macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a>.
Debugger and stepper execute subordinate <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>
(called <strong class="first"><em class="firstterm">break loops</em></strong>)
which are similar to the main <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> except for the
<a class="link" href="#prompt" title="31.9. The Prompt">prompt</a> and the set of available commands.
Commands must be typed literally, in any case,
without surrounding quotes or <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-1-4-7.html">whitespace</a>.
Each command has a keyword abbreviation,
indicated in the second column.</p><div class="table"><a id="debugger-main-deb-step"></a><p class="title"><strong>Table 25.1. Commands common to the main loop, the debugger and the stepper</strong></p><div class="table-contents"><table class="table" summary="Commands common to the main loop, the debugger and the stepper" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a></td><td align="center"><span class="command"><strong>:h</strong></span></td><td align="center">print a list of available commands</td></tr><tr><td align="center"><span class="command"><strong>LocalSymbols</strong></span></td><td align="center"><span class="command"><strong>:ls</strong></span></td><td align="center">print the list of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a>ed in a given <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="debugger-deb-step"></a><p class="title"><strong>Table 25.2. Commands common to the debugger and the stepper</strong></p><div class="table-contents"><table class="table" summary="Commands common to the debugger and the stepper" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Abort</strong></span></td><td align="center"><span class="command"><strong>:a</strong></span></td><td align="center">abort to the next most recent <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a></td></tr><tr><td align="center"><span class="command"><strong>Unwind</strong></span></td><td align="center"><span class="command"><strong>:uw</strong></span></td><td align="center">abort to the next most recent <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a></td></tr><tr><td align="center"><span class="command"><strong>Quit</strong></span></td><td align="center"><span class="command"><strong>:q</strong></span></td><td align="center">quit to the top <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a></td></tr></tbody></table></div></div><br class="table-break" /><p>The stack is organized into frames and other stack elements.
Usually every invocation of an interpreted function and every
evaluation of an interpreted form corresponds to one stack frame.
Special forms such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a>
produce special kinds of stack frames.</p><p><a id="cur-frame"></a>In a break loop there is a
<strong class="first"><em class="firstterm"><a class="link" href="#cur-frame">current stack frame</a></em></strong>, which is initially the most recent
stack frame but can be moved using the debugger
commands <span class="command"><strong>Up</strong></span> and <span class="command"><strong>Down</strong></span>.</p><p>Evaluation of forms in a break loop occurs in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> of the
<a class="link" href="#cur-frame">current stack frame</a> and <span class="emphasis"><em>at the same time</em></span> in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-2.html">dynamic environment</a>
of the debugger's caller. This means that to inspect or modify a
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-1.html">lexical variable</a> all you have to do is to move the <a class="link" href="#cur-frame">current stack frame</a> to be just
below the frame that corresponds to the form or the function call that
binds that variable.</p><p><a id="stack-mode"></a><strong>Stack Printing Mode. </strong>There is a current <strong class="first"><em class="firstterm">stack mode</em></strong> which defines
in how much detail the stack is shown by the stack-related debugger
commands (<a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> et al):</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">All the stack elements are considered.
This mode works fine for debugging compiled functions.</li><li class="listitem">All the frames are considered.</li><li class="listitem">Only lexical frames (frames that correspond to special
forms that modify the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>) are considered.</li><li class="listitem">Only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> frames are considered.
Every evaluation of a form in the interpreter corresponds to an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> frame. This is the default.</li><li class="listitem">Only <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> frames are considered.
Every invocation of an interpreted function corresponds to one
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> frame.</li></ol></div><div class="table"><a id="debugger-deb-step-1"></a><p class="title"><strong>Table 25.3. Commands common to the debugger and the stepper</strong></p><div class="table-contents"><table class="table" summary="Commands common to the debugger and the stepper" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Error</strong></span></td><td align="center"><span class="command"><strong>:e</strong></span></td><td align="center">print the last error object.</td></tr><tr><td align="center"><span class="command"><strong>Inspect</strong></span></td><td align="center"><span class="command"><strong>:i</strong></span></td><td align="center"><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="function">INSPECT</code></a> the last error object.</td></tr><tr><td align="center"><span class="command"><strong>Where</strong></span></td><td align="center"><span class="command"><strong>:w</strong></span></td><td align="center">show the <a class="link" href="#cur-frame">current stack frame</a>.</td></tr><tr><td align="center"><span class="command"><strong>Up</strong></span></td><td align="center"><span class="command"><strong>:u</strong></span></td><td align="center">go up one frame, i.e., to the caller if in mode-5</td></tr><tr><td align="center"><span class="command"><strong>Down</strong></span></td><td align="center"><span class="command"><strong>:d</strong></span></td><td align="center">do down one frame, i.e., to the callee if in mode-5</td></tr><tr><td align="center"><span class="command"><strong>Top</strong></span></td><td align="center"><span class="command"><strong>:t</strong></span></td><td align="center">go to top frame, i.e., to the top-level form if in mode-4
</td></tr><tr><td align="center"><span class="command"><strong>Bottom</strong></span></td><td align="center"><span class="command"><strong>:b</strong></span></td><td align="center">go to bottom (most recent) frame, i.e., most probably to the
form or function that caused the debugger to be entered.</td></tr><tr><td align="center"><span class="command"><strong>Mode</strong></span> <a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a></td><td align="center"><span class="command"><strong>:m</strong></span> <a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a></td><td align="center">set the current stack printing mode</td></tr><tr><td align="center"><a id="frame-limit"></a><span class="command"><strong>Frame-limit</strong></span> <em class="replaceable"><code>l</code></em></td><td align="center"><span class="command"><strong>:fl</strong></span></td><td align="center">set the <a class="link" href="#frame-limit"><em class="replaceable"><code>frame-limit</code></em></a>: this many frames will be printed
by <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> at most.</td></tr><tr><td align="center"><a id="backtrace"></a><a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> [<a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a> [<em class="replaceable"><code>l</code></em>]]</td><td align="center"><span class="command"><strong>:bt</strong></span> [<a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a> [<em class="replaceable"><code>l</code></em>]]</td><td align="center">list the stack in the given <a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a>, bottom frame first,
top frame last; at most <em class="replaceable"><code>l</code></em> frames are printed;
calls <a class="link" href="#show-stack" title="25.2.3. Function EXT:SHOW-STACK"><code class="function">EXT:SHOW-STACK</code></a>.</td></tr></tbody></table></div></div><br class="table-break" /><p>If the <a class="link" href="#cur-frame">current stack frame</a> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> frame, the
following commands are available as well:</p><div class="table"><a id="debugger-eval-apply"></a><p class="title"><strong>Table 25.4. Commands specific to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a></strong></p><div class="table-contents"><table class="table" summary="Commands specific to EVAL/APPLY" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Break+</strong></span></td><td align="center"><span class="command"><strong>:br+</strong></span></td><td align="center">set a breakpoint in the current frame. When the corresponding
form or function will be left, the debugger will be entered again, with
the variable <a class="link" href="#trace-val"><code class="varname">EXT:*TRACE-VALUES*</code></a> containing a list of its values.</td></tr><tr><td align="center"><span class="command"><strong>Break-</strong></span></td><td align="center"><span class="command"><strong>:br-</strong></span></td><td align="center">remove a breakpoint from the current frame.</td></tr><tr><td align="center"><span class="command"><strong>Redo</strong></span></td><td align="center"><span class="command"><strong>:rd</strong></span></td><td align="center">re-evaluate the corresponding form or function call. This
command can be used to restart parts of a computation without
aborting it entirely.</td></tr><tr><td align="center"><span class="command"><strong>Return</strong></span> <em class="replaceable"><code>value</code></em></td><td align="center"><span class="command"><strong>:rt</strong></span> <em class="replaceable"><code>value</code></em></td><td align="center">leave the current frame, returning the given value.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="debugger-deb"></a><p class="title"><strong>Table 25.5. Commands specific to the debugger</strong></p><div class="table-contents"><table class="table" summary="Commands specific to the debugger" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Continue</strong></span></td><td align="center"><span class="command"><strong>:c</strong></span></td><td align="center">continue evaluation of the program.</td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="debugger-step"></a><p class="title"><strong>Table 25.6. Commands specific to the stepper</strong></p><div class="table-contents"><table class="table" summary="Commands specific to the stepper" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">command</th><th align="center">abbreviation</th><th align="center">operation</th></tr></thead><tbody><tr><td align="center"><span class="command"><strong>Step</strong></span></td><td align="center"><span class="command"><strong>:s</strong></span></td><td align="center">step into a form: evaluate this form in single step mode
</td></tr><tr><td align="center"><span class="command"><strong>Next</strong></span></td><td align="center"><span class="command"><strong>:n</strong></span></td><td align="center">step over a form: evaluate this form at once
</td></tr><tr><td align="center"><span class="command"><strong>Over</strong></span></td><td align="center"><span class="command"><strong>:o</strong></span></td><td align="center">step over this level: evaluate at once up to the next return
</td></tr><tr><td align="center"><span class="command"><strong>Continue</strong></span></td><td align="center"><span class="command"><strong>:c</strong></span></td><td align="center">switch off single step mode, continue evaluation
</td></tr></tbody></table></div></div><br class="table-break" /><p>The stepper is usually used like this: If some form returns a
strange value or results in an error, call <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a>
<em class="replaceable"><code>form</code></em>)</code> and navigate using the
commands <span class="command"><strong>Step</strong></span> and <span class="command"><strong>Next</strong></span> until you
reach the form you regard as responsible. If you are too fast (execute
<span class="command"><strong>Next</strong></span> once and get the error), there is no way back;
you have to restart the entire stepper session. If you are too slow
(stepped into a function or a form which certainly is OK), a couple of
<span class="command"><strong>Next</strong></span> commands or one <span class="command"><strong>Over</strong></span> command
will help.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="user-commands"></a>25.1.1. User-defined Commands</h3></div></div></div><p>You can set <strong class="first"><em class="firstterm"><a class="link" href="#user-commands" title="25.1.1. User-defined Commands"><code class="varname">CUSTOM:*USER-COMMANDS*</code></a></em></strong> to a list of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s, each returning a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>
of <strong class="first"><em class="firstterm">bindings</em></strong>, i.e., either a
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></span></dt><dd>the help string printed by <a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a> in addition to the
standard <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> help</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> <span class="data"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>)</code></span></span></dt><dd>the actual binding: when the user types the string,
the function is called on the remainder of the string, i.e., the part
of the string after the command.</dd></dl></div><p> E.g.,
</p><pre class="programlisting">
(setq <a class="link" href="#user-commands" title="25.1.1. User-defined Commands"><code class="varname">CUSTOM:*USER-COMMANDS*</code></a>
(list (lambda () (list (format nil "~2%User-defined commands:")))
(lambda ()
(flet ((panic (argline)
(format t "don't panic~@[ because of ~A~], ~D~%"
(and (plusp (length argline)) argline)
(random 42))))
(list (format nil "~%panic :p hit the panic button!")
(cons "panic" #'panic)
(cons ":p" #'panic))))
(lambda ()
(let ((curses #("ouch" "yuk" "bletch")))
(flet ((swear (argline)
(format t "~A: ~A!~%" argline
(aref curses (random (length curses))))))
(list (format nil "~%swear :e curse")
(cons "swear" #'swear)
(cons ":e" #'swear)))))))
</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="debugger"></a>25.2. Debugging Utilities
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-2.html">[sec_25-1-2]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#disassemble">25.2.1. Function <code class="function">DISASSEMBLE</code></a></span></dt><dt><span class="section"><a href="#uncompile">25.2.2. Function <code class="function">EXT:UNCOMPILE</code></a></span></dt><dt><span class="section"><a href="#show-stack">25.2.3. Function <code class="function">EXT:SHOW-STACK</code></a></span></dt><dt><span class="section"><a href="#documentation">25.2.4. Function <code class="function">DOCUMENTATION</code></a></span></dt><dt><span class="section"><a href="#describe">25.2.5. Function <code class="function">DESCRIBE</code></a></span></dt><dt><span class="section"><a href="#trace">25.2.6. Macro <code class="function">TRACE</code></a></span></dt><dt><span class="section"><a href="#inspect">25.2.7. Function <code class="function">INSPECT</code></a></span></dt><dt><span class="section"><a href="#time">25.2.8. Macro <code class="function">TIME</code></a></span></dt><dt><span class="section"><a href="#ed">25.2.9. Function <code class="function">ED</code></a></span></dt><dt><span class="section"><a href="#apropos">25.2.10. Functions <code class="function">APROPOS</code> & <code class="function">APROPOS-LIST</code></a></span></dt><dt><span class="section"><a href="#dribble">25.2.11. Function <code class="function">DRIBBLE</code></a></span></dt><dd><dl><dt><span class="section"><a href="#dribble-script">25.2.11.1. Scripting and <code class="function">DRIBBLE</code></a></span></dt></dl></dd></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>25.1. <a href="#trace-call-id">Identifying Individual Calls in <code class="function">TRACE</code></a></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="disassemble"></a>25.2.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> can disassemble to machine code,
provided that <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://sources.redhat.com/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a> is present. In that case the argument may be a
<code class="classname">EXT:SYSTEM-FUNCTION</code>, a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>, a
special operator handler, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> denoting one of these, an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> (address), or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="uncompile"></a>25.2.2. Function <a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a></h3></div></div></div><p>The function <a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a> does the converse of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a>: <code class="code">(<a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a> <em class="replaceable"><code>function</code></em>)</code> reverts a compiled
<em class="replaceable"><code>function</code></em> (name), that has been entered or loaded in the same session
and then compiled, back to its interpreted form.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="show-stack"></a>25.2.3. Function <a class="link" href="#show-stack" title="25.2.3. Function EXT:SHOW-STACK"><code class="function">EXT:SHOW-STACK</code></a></h3></div></div></div><p>The function <a class="link" href="#show-stack" title="25.2.3. Function EXT:SHOW-STACK"><code class="function">EXT:SHOW-STACK</code></a> is called by the <a class="link" href="#backtrace"><span class="command"><strong>backtrace</strong></span></a> command.</p><p>It prints to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> and accepts 3 optional
arguments:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><a class="link" href="#stack-mode" title="Stack Printing Mode"><em class="replaceable"><code>stack-mode</code></em></a></li><li class="listitem"><a class="link" href="#frame-limit"><em class="replaceable"><code>frame-limit</code></em></a></li><li class="listitem"><em class="replaceable"><code>start-frame</code></em></li></ol></div><p>It can used to find out what all the threads are up to:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :with out = <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> :for <em class="replaceable"><code>thread</code></em> :in (<a class="link" href="#list-threads"><code class="function">MT:LIST-THREADS</code></a>) :do
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> out "===~A===~;" <em class="replaceable"><code>thread</code></em>)
(<a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> <em class="replaceable"><code>thread</code></em> :function
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> () (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> out)) (<a class="link" href="#show-stack" title="25.2.3. Function EXT:SHOW-STACK"><code class="function">EXT:SHOW-STACK</code></a> 1 3)))))
</pre><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="documentation"></a>25.2.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></h3></div></div></div><p>No on-line documentation is available for the system functions
(yet), but see <a class="xref" href="#describe" title="25.2.5. Function DESCRIBE">Section 25.2.5, “Function <code class="function">DESCRIBE</code>”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="describe"></a>25.2.5. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a></h3></div></div></div><p>When <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="varname">CUSTOM:*BROWSER*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, and <a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a> returns a valid URL,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a> on a standard <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> symbol will point your web browser to the
appropriate [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] page.</p><p>Also, when <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="varname">CUSTOM:*BROWSER*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, and <a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a> returns a
valid URL, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a> on symbols and packages documented in these
implementation notes will point your web browser to the appropriate
page.</p><p>To do this, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a> will retrieve the appropriate tables from
<a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a> and <a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a> on the first relevant invocation.
These operations are logged to <a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a>.</p><p><a id="clhs-root"></a><strong>Function <a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a>. </strong>Function <a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a> is defined in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>. By default it
looks at <code class="code">(<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> "CLHSROOT")</code> and <a class="link" href="#clhs-root" title="Function CUSTOM:CLHS-ROOT"><code class="varname">CUSTOM:*CLHS-ROOT-DEFAULT*</code></a>,
but you may redefine it in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> or <a href="clisp.html#opt-norc" class="olink">RC file</a>.
The return value should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> terminated with a <code class="filename">"/"</code>,
e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/" target="_top">http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/</a> or <code class="filename">/usr/doc/HyperSpec/</code>.
If the return value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the feature is completely disabled.
<a class="link" href="#clhs-root" title="Function CUSTOM:CLHS-ROOT"><code class="varname">CUSTOM:*CLHS-ROOT-DEFAULT*</code></a> is initialized in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> based on
the <code class="option">--hyperspec</code> passed to the top-level <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a>
script when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was built.</p><p><a id="impnotes-root"></a><strong>Function <a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a>. </strong>Function <a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a> is defined in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>. By default it
looks at <code class="code">(<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> "IMPNOTES")</code> and <a class="link" href="#impnotes-root" title="Function CUSTOM:IMPNOTES-ROOT"><code class="varname">CUSTOM:*IMPNOTES-ROOT-DEFAULT*</code></a>,
but you may redefine it in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> or <a href="clisp.html#opt-norc" class="olink">RC file</a>.
The return value should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> terminated with a <code class="filename">"/"</code>,
e.g., <a class="ulink" href="http://clisp.org/impnotes/" target="_top">http://clisp.org/impnotes/</a>, or the path to
the monolithic page, e.g., <a class="ulink" href="http://clisp.org/impnotes.html" target="_top">http://clisp.org/impnotes.html</a>
or <code class="filename">/usr/doc/clisp/impnotes.html</code>.
If the return value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the feature is completely disabled.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="trace"></a>25.2.6. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a></h3></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>25.1. <a href="#trace-call-id">Identifying Individual Calls in <code class="function">TRACE</code></a></dt></dl></div><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a> <em class="replaceable"><code>function-name</code></em> ...)</code> makes the
functions <em class="replaceable"><code>function-name</code></em>, ... traced. Each <em class="replaceable"><code>function-name</code></em> should be either
a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> <code class="code">(<em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:SUPPRESS-IF</code> <code class="constant">:MAX-DEPTH</code>
<code class="constant">:STEP-IF</code> <code class="constant">:BINDINGS</code>
<code class="constant">:PRE</code> <code class="constant">:POST</code>
<code class="constant">:PRE-BREAK-IF</code> <code class="constant">:POST-BREAK-IF</code>
<code class="constant">:PRE-PRINT</code> <code class="constant">:POST-PRINT</code>
<code class="constant">:PRINT</code>)</code>, where</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:SUPPRESS-IF</code> <em class="replaceable"><code>form</code></em></span></dt><dd>no trace output as long as <em class="replaceable"><code>form</code></em> is true
</dd><dt><span class="term"><code class="constant">:MAX-DEPTH</code> <em class="replaceable"><code>form</code></em></span></dt><dd>no trace output as long as <code class="code">(>
*trace-level* <em class="replaceable"><code>form</code></em>)</code>. This is useful for tracing functions that
are use by the tracer itself, such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>, or otherwise when
tracing would lead to an infinite recursion.
</dd><dt><span class="term"><code class="constant">:STEP-IF</code> <em class="replaceable"><code>form</code></em></span></dt><dd>invokes the stepper as soon as <em class="replaceable"><code>form</code></em> is true
</dd><dt><span class="term"><code class="constant">:BINDINGS</code>
((<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>form</code></em>)...)</span></dt><dd>binds <em class="replaceable"><code>variable</code></em>s to the result of evaluation of
<em class="replaceable"><code>form</code></em>s around evaluation of all of the following forms
</dd><dt><span class="term"><code class="constant">:PRE</code> <em class="replaceable"><code>form</code></em></span></dt><dd>evaluates <em class="replaceable"><code>form</code></em> before calling the function
</dd><dt><span class="term"><code class="constant">:POST</code> <em class="replaceable"><code>form</code></em></span></dt><dd>evaluates <em class="replaceable"><code>form</code></em> after return from the function
</dd><dt><span class="term"><code class="constant">:PRE-BREAK-IF</code> <em class="replaceable"><code>form</code></em></span></dt><dd>goes into the break loop before calling the
function if <em class="replaceable"><code>form</code></em> is true</dd><dt><span class="term"><code class="constant">:POST-BREAK-IF</code> <em class="replaceable"><code>form</code></em></span></dt><dd>goes into the break loop after return from the
function if <em class="replaceable"><code>form</code></em> is true</dd><dt><span class="term"><code class="constant">:PRE-PRINT</code> <em class="replaceable"><code>form</code></em></span></dt><dd>prints the values of <em class="replaceable"><code>form</code></em> before calling the
function</dd><dt><span class="term"><code class="constant">:POST-PRINT</code> <em class="replaceable"><code>form</code></em></span></dt><dd>prints the values of <em class="replaceable"><code>form</code></em> after return from the
function</dd><dt><span class="term"><code class="constant">:PRINT</code> <em class="replaceable"><code>form</code></em></span></dt><dd>prints the values of <em class="replaceable"><code>form</code></em> both before calling
and after return from the function</dd></dl></div><p>In all these forms you can access the following variables:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="varname">EXT:*TRACE-FUNCTION*</code></span></dt><dd>the traced function itself
</dd><dt><span class="term"><code class="varname">EXT:*TRACE-ARGS*</code></span></dt><dd>the arguments to the function
</dd><dt><span class="term"><code class="varname">EXT:*TRACE-FORM*</code></span></dt><dd>the function/macro call as form
</dd><dt><a id="trace-val"></a><span class="term"><a class="link" href="#trace-val"><code class="varname">EXT:*TRACE-VALUES*</code></a></span></dt><dd>after return from the function: the list of return
values from the function call</dd></dl></div><p>
and you can leave the function call with specified values by using
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a>.</p><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">UNTRACE</code></a> are also applicable to functions
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <em class="replaceable"><code>symbol</code></em>)</code> and to macros, but not to
locally defined functions and macros.</p><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="trace-out"></a>Trace output</h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a> prints this line before evaluating the form:
<code class="computeroutput"><em class="replaceable"><code>trace level</code></em>. Trace: <em class="replaceable"><code>form</code></em></code>
and after evaluating the form it prints:
<code class="computeroutput"><em class="replaceable"><code>trace level</code></em>. Trace: <em class="replaceable"><code>function-name</code></em> ==> <em class="replaceable"><code>result</code></em></code>
where <span class="quote">“<span class="quote">trace level</span>”</span> is the total nesting level.
</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="trace-indent"></a>Variable <a class="link" href="#trace-indent" title="Variable CUSTOM:*TRACE-INDENT*"><code class="varname">CUSTOM:*TRACE-INDENT*</code></a></h4></div></div></div><p>If you want the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a> level to be indicated by the indentation
in addition to the printed numbers, set <a class="link" href="#trace-indent" title="Variable CUSTOM:*TRACE-INDENT*"><code class="varname">CUSTOM:*TRACE-INDENT*</code></a> to non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
Initially it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> since many nested traced calls will easily
exhaust the available line length.</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="trace-eg"></a>Examples</h4></div></div></div><div class="example"><a id="trace-call-id"></a><p class="title"><strong>Example 25.1. Identifying Individual Calls in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_tracecm_untrace.html" target="_top"><code class="function">TRACE</code></a></strong></p><div class="example-contents"><p>Suppose the trace level above is not enough for you to identify
individual calls. You can give each call a unique id and print it:
</p><pre class="programlisting">
(defun f0 (x)
(cond ((zerop x) 1)
((zerop (random 2)) (* x (f0 (1- x))))
(t (* x (f1 (1- x))))))
⇒ <code class="computeroutput">F0</code>
(defun f1 (x)
(cond ((zerop x) 1)
((zerop (random 2)) (* x (f0 (1- x))))
(t (* x (f1 (1- x))))))
⇒ <code class="computeroutput">F1</code>
(defvar *f0-call-count* 0)
⇒ <code class="computeroutput">*F0-CALL-COUNT*</code>
(defvar *id0*)
⇒ <code class="computeroutput">*ID0*</code>
(defvar *cc0*)
⇒ <code class="computeroutput">*CC0*</code>
(defvar *f1-call-count* 0)
⇒ <code class="computeroutput">*F1-CALL-COUNT*</code>
(defvar *id1*)
⇒ <code class="computeroutput">*ID1*</code>
(defvar *cc1*)
⇒ <code class="computeroutput">*CC1*</code>
(trace (f0 :bindings ((*cc0* (incf *f0-call-count*))
(*id0* (gensym "F0-")))
:pre-print (list 'enter *id0* *cc0*)
:post-print (list 'exit *id0* *cc0*))
(f1 :bindings ((*cc1* (incf *f1-call-count*))
(*id1* (gensym "F1-")))
:pre-print (list 'enter *id1* *cc1*)
:post-print (list 'exit *id1* *cc1*)))
;; Tracing function F0.
;; Tracing function F1.
⇒ <code class="computeroutput">(F0 F1)</code>
(f0 10)
1. Trace: (F0 '10)
(ENTER #:F0-2926 1)
2. Trace: (F1 '9)
(ENTER #:F1-2927 1)
3. Trace: (F0 '8)
(ENTER #:F0-2928 2)
4. Trace: (F1 '7)
(ENTER #:F1-2929 2)
5. Trace: (F1 '6)
(ENTER #:F1-2930 3)
6. Trace: (F1 '5)
(ENTER #:F1-2931 4)
7. Trace: (F1 '4)
(ENTER #:F1-2932 5)
8. Trace: (F0 '3)
(ENTER #:F0-2933 3)
9. Trace: (F1 '2)
(ENTER #:F1-2934 6)
10. Trace: (F0 '1)
(ENTER #:F0-2935 4)
11. Trace: (F1 '0)
(ENTER #:F1-2936 7)
(EXIT #:F1-2936 7)
11. Trace: F1 ==> 1
(EXIT #:F0-2935 4)
10. Trace: F0 ==> 1
(EXIT #:F1-2934 6)
9. Trace: F1 ==> 2
(EXIT #:F0-2933 3)
8. Trace: F0 ==> 6
(EXIT #:F1-2932 5)
7. Trace: F1 ==> 24
(EXIT #:F1-2931 4)
6. Trace: F1 ==> 120
(EXIT #:F1-2930 3)
5. Trace: F1 ==> 720
(EXIT #:F1-2929 2)
4. Trace: F1 ==> 5040
(EXIT #:F0-2928 2)
3. Trace: F0 ==> 40320
(EXIT #:F1-2927 1)
2. Trace: F1 ==> 362880
(EXIT #:F0-2926 1)
1. Trace: F0 ==> 3628800
⇒ <code class="computeroutput">3628800</code>
*f0-call-count*
⇒ <code class="computeroutput">4</code>
*f1-call-count*
⇒ <code class="computeroutput">7</code></pre></div></div><br class="example-break" /></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="inspect"></a>25.2.7. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a></h3></div></div></div><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> accepts a keyword argument
<code class="constant">:FRONTEND</code>, which specifies the way <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will
interact with the user, and defaults
to <code class="varname">CUSTOM:*INSPECT-FRONTEND*</code>.
</p><div class="variablelist"><p class="title"><strong>Available <code class="constant">:FRONTEND</code>s for
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="constant">:TTY</code></span></dt><dd>The interaction is conducted via the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>
stream. Please use the <a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a> command to get the list of all
available commands.</dd><dt><span class="term"><code class="constant">:HTTP</code></span></dt><dd><p class="simpara">A window in your Web browser (specified by the
<a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">:BROWSER</code></a> keyword argument) is opened and it is controlled by
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> via a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>, using the <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> protocol.
You should be able to use all the standard browser features.</p><p class="simpara">Since <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is not multitasking at this time, you will not
be able to do anything else during an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> session. Please click on
the <strong class="userinput"><code>quit</code></strong> link to terminate the session.</p><p class="simpara">Please be aware though, that once you terminate an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a>
session, all links in all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> windows in your browser will become
obsolete and using them in a new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> session will result in
unpredictable behavior.</p></dd></dl></div><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> also accepts a keyword argument <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">:BROWSER</code></a>,
which specifies the browser used by the <code class="constant">:HTTP</code>
front-end and defaults to <code class="varname">CUSTOM:*INSPECT-BROWSER*</code>.</p><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_inspect.html" target="_top"><code class="function">INSPECT</code></a> binds some
<a class="link" href="#clpp" title="22.7. The Lisp Pretty Printer sec_22-2">pretty-printer</a> variables:
</p><div class="informaltable"><a id="inspect-vars"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="left">Variable</th><th align="left">Bound to</th></tr></thead><tbody><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LENGTH*</code></a></td><td align="left"><code class="varname">CUSTOM:*INSPECT-PRINT-LENGTH*</code></td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-l_int-lengthst.html" target="_top"><code class="varname">*PRINT-LEVEL*</code></a></td><td align="left"><code class="varname">CUSTOM:*INSPECT-PRINT-LEVEL*</code></td></tr><tr><td align="left"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-linesst.html" target="_top"><code class="varname">*PRINT-LINES*</code></a></td><td align="left"><code class="varname">CUSTOM:*INSPECT-PRINT-LINES*</code></td></tr></tbody></table></div><p>User variable
<strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*INSPECT-LENGTH*</code>
<a id="inspect-length" class="indexterm"></a></em></strong>
specifies the number of sequence elements or slots printed in detail
when a sequence or a structure or a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> object is inspected.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="time"></a>25.2.8. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_time.html" target="_top"><code class="function">TIME</code></a></h3></div></div></div><p>The timing data printed by the macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_time.html" target="_top"><code class="function">TIME</code></a> includes:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">the real time (<span class="quote">“<span class="quote">wall</span>”</span> time,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-internal-real-time.html" target="_top"><code class="function">GET-INTERNAL-REAL-TIME</code></a>),</li><li class="listitem">the run time (processor time for this process,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-internal-run-time.html" target="_top"><code class="function">GET-INTERNAL-RUN-TIME</code></a>),</li><li class="listitem">the number of bytes allocated, and</li><li class="listitem">the number of <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions performed, if any.
</li></ul></div><p>The macro <strong class="first"><em class="firstterm"><a class="link" href="#time" title="25.2.8. Macro TIME"><code class="function">EXT:TIMES</code></a>
<a id="times" class="indexterm"></a></em></strong> (mnemonic:
<span class="quote">“<span class="quote"><span class="emphasis"><em>TIME</em></span> and <span class="emphasis"><em>S</em></span>pace</span>”</span>)
is like the macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_time.html" target="_top"><code class="function">TIME</code></a>: <code class="code">(<a class="link" href="#time" title="25.2.8. Macro TIME"><code class="function">EXT:TIMES</code></a> <em class="replaceable"><code>form</code></em>)</code> evaluates the
<em class="replaceable"><code>form</code></em>, and, as a side effect, outputs detailed information about the
memory allocations caused by this evaluation. It also prints
everything printed by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_time.html" target="_top"><code class="function">TIME</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ed"></a>25.2.9. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ed.html" target="_top"><code class="function">ED</code></a></h3></div></div></div><p>The function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ed.html" target="_top"><code class="function">ED</code></a> calls the external editor specified by the value of
<code class="code">(<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> "EDITOR")</code> or, failing that, the value of the variable
<strong class="first"><em class="firstterm"><a class="link" href="#ed" title="25.2.9. Function ED"><code class="varname">CUSTOM:*EDITOR*</code></a><a id="editor" class="indexterm"></a></em></strong>
(set in <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>).
If the argument is a function name which was defined in the current
session (not loaded from a file), the program text to be edited is a
pretty-printed version (without comments) of the text which was used to
define the function.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="apropos"></a>25.2.10. Functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> & <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS-LIST</code></a></h3></div></div></div><p>The search performed by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS-LIST</code></a> is
case-insensitive.</p><p><strong>Variable <a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-DO-MORE*</code></a>. </strong>You can make <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> print more information about the symbols it
found by setting <a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-DO-MORE*</code></a> to a list containing some of
<code class="constant">:FUNCTION</code>, <code class="constant">:VARIABLE</code>, <code class="constant">:TYPE</code>, and <code class="constant">:CLASS</code>
or just set it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> to get all of the values.</p><p><strong>Variable <a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>. </strong>You can make <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS-LIST</code></a> be more flexible in
their search by setting <a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of one
argument, a pattern (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>), returning a new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of one
argument, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> name (also a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>),
which returns non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> when the symbol name matches the pattern
for the purposes of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a>.
When <a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_search.html" target="_top"><code class="function">SEARCH</code></a> is used.
Some <a href="impnotes.html#modules" class="olink">module</a>s come with functions which can be used for
<a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>, e.g., <a class="link" href="#re-matcher"><code class="function">REGEXP:REGEXP-MATCHER</code></a>,
<a class="link" href="#fnmatch-matcher" title="(POSIX:FNMATCH-MATCHER pattern)"><code class="function">POSIX:FNMATCH-MATCHER</code></a>,
<a class="link" href="#pcre-matcher"><code class="function">PCRE:PCRE-MATCHER</code></a>.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dribble"></a>25.2.11. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#dribble-script">25.2.11.1. Scripting and <code class="function">DRIBBLE</code></a></span></dt></dl></div><p>If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> is called with an argument, and dribbling is already
enabled, a warning is printed, and the new dribbling request is
ignored.</p><p>Dribbling is implemented via a kind (but <span class="strong"><strong>not</strong></span> a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_r.html#recognizable_subtype">recognizable subtype</a>)
of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_two-way-stream.html" target="_top"><code class="classname">TWO-WAY-STREAM</code></a>, named <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>.
If you have a <em class="replaceable"><code>source</code></em> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> <em class="replaceable"><code>x</code></em> and you want all transactions
(input and output) on <em class="replaceable"><code>x</code></em> to be copied to the <em class="replaceable"><code>target</code></em> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> <em class="replaceable"><code>y</code></em>,
you can do <a id="dribble-example"></a></p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> *loggable* <em class="replaceable"><code>x</code></em>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <em class="replaceable"><code>x</code></em> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-synonym-stream.html" target="_top"><code class="function">MAKE-SYNONYM-STREAM</code></a> '*loggable*))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> toggle-logging (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> s)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a> (source target) (dribble-toggle *loggable* s)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">WHEN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_streamp.html" target="_top"><code class="function">STREAMP</code></a> source) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> *loggable* source))
target))
(toggle-logging <em class="replaceable"><code>y</code></em>)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">start logging</span></em>
...
(toggle-logging)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">finish logging</span></em>
...
(toggle-logging <em class="replaceable"><code>y</code></em>)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">restart logging</span></em>
...
(toggle-logging)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">finish logging</span></em>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> <em class="replaceable"><code>y</code></em>)
</pre><div class="variablelist"><dl class="variablelist"><dt><a id="drist"></a><span class="term"><code class="code">
(<code class="function">EXT:DRIBBLE-STREAM</code> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, returns two values:
the <em class="replaceable"><code>source</code></em> and the <em class="replaceable"><code>target</code></em> streams. Otherwise returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd><dt><a id="drist-p"></a><span class="term"><code class="code">
(<code class="function">EXT:DRIBBLE-STREAM-P</code> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, otherwise
returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><a id="drist-so"></a><span class="term"><code class="code">
(<code class="function">EXT:DRIBBLE-STREAM-SOURCE</code> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, returns its
<em class="replaceable"><code>source</code></em> stream, otherwise signals a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_type-error.html" target="_top"><code class="classname">TYPE-ERROR</code></a>.
</dd><dt><a id="drist-ta"></a><span class="term"><code class="code">
(<code class="function">EXT:DRIBBLE-STREAM-TARGET</code> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, returns its
<em class="replaceable"><code>target</code></em> stream, otherwise signals a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_type-error.html" target="_top"><code class="classname">TYPE-ERROR</code></a>.
</dd><dt><a id="mk-drist"></a><span class="term"><code class="code">
(<code class="function">EXT:MAKE-DRIBBLE-STREAM</code>
<em class="replaceable"><code>source</code></em> <em class="replaceable"><code>target</code></em>)</code></span></dt><dd>Create a new <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>.
</dd><dt><a id="dri-toggle"></a><span class="term"><code class="code">
(<code class="function">EXT:DRIBBLE-TOGGLE</code> <em class="replaceable"><code>stream</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>pathname</code></em>)</code></span></dt><dd>When <em class="replaceable"><code>stream</code></em> is a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a> and <em class="replaceable"><code>pathname</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
writes a dribble termination note to the <em class="replaceable"><code>stream</code></em>'s <em class="replaceable"><code>target</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and returns <em class="replaceable"><code>stream</code></em>'s <em class="replaceable"><code>source</code></em> and <em class="replaceable"><code>target</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s;
when <em class="replaceable"><code>stream</code></em> is not a <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a> and <em class="replaceable"><code>pathname</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
creates a new <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a>, dribbling from <em class="replaceable"><code>stream</code></em> to <em class="replaceable"><code>pathname</code></em>,
writes a dribble initialization note to <em class="replaceable"><code>pathname</code></em>,
and return the <a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="classname">EXT:DRIBBLE-STREAM</code></a> (the second value is the <em class="replaceable"><code>target</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>);
otherwise <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_warn.html" target="_top"><code class="function">WARN</code></a> that no appropriate action may be taken.
<em class="replaceable"><code>pathname</code></em> may be an open <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> or a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>.
See <a class="link" href="#dribble-example">above</a> for the sample usage.
See also <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/dribble.lisp"><code class="filename">src/dribble.lisp</code></a> in
the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> source tree.
</dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dribble-script"></a>25.2.11.1. Scripting and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a></h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> works by operating on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>,
thus is does <span class="strong"><strong>not</strong></span> work when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> acts as a script interpreter
(see <a class="xref" href="#quickstart-unix" title="32.6.2. Scripting with CLISP">Section 32.6.2, “Scripting with <span class="command"><strong>CLISP</strong></span>”</a>).</p><p>Traditionally, <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations set <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_synonym-stream.html" target="_top"><code class="classname">SYNONYM-STREAM</code></a>
pointing to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>, and <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is no exception.
Thus changing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> to a dribble stream affects all
standard i/o.</p><p>On the other hand, when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> acts as a script interpreter, it
adheres to the <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html"><<code class="filename">stdio.h</code>></a> <a class="link" href="#script-exec" title="Script execution">conventions</a>,
thus <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>, and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> are normal <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>s,
and thus are <span class="strong"><strong>not</strong></span> affected by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> - and
thus <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> ... <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code> - <span class="strong"><strong>is</strong></span> still affected).
The [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] explicitly permits this behavior by stating
</p><div class="blockquote"><blockquote class="blockquote"><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> is intended primarily for interactive
debugging; its effect cannot be relied upon when used in a program.
</p></blockquote></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="environment-enq"></a>25.3. Environment Inquiry
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-3.html">[sec_25-1-3]</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#room">25.3.1. Function <code class="function">ROOM</code></a></span></dt><dt><span class="section"><a href="#gc-sect">25.3.2. Function <code class="function">EXT:GC</code>
</a></span></dt><dt><span class="section"><a href="#machine">25.3.3. Machine</a></span></dt><dt><span class="section"><a href="#version">25.3.4. Function <code class="function">LISP-IMPLEMENTATION-VERSION</code></a></span></dt><dt><span class="section"><a href="#argv">25.3.5. Function <code class="function">EXT:ARGV</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="room"></a>25.3.1. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a></h3></div></div></div><p>The function <strong class="first"><em class="firstterm"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a>
<a id="room-func" class="indexterm"></a></em></strong>
returns five values:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">space occupied by Lisp objects (in
bytes)</li><li class="listitem">space available for allocating Lisp objects until
the next <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is triggered (in bytes)</li><li class="listitem">space permanently allocated (in
bytes)</li><li class="listitem">the number of times <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion was done in this
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> session</li><li class="listitem">the cumulative space freed by all the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions in
this <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> session (in bytes)</li><li class="listitem">the total time (in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_intern_s-per-second.html" target="_top"><code class="constant">INTERNAL-TIME-UNITS-PER-SECOND</code></a>)
spent collecting garbage</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-sect"></a>25.3.2. Function <strong class="first"><em class="firstterm"><code class="function">EXT:GC</code>
<a id="gc-func" class="indexterm"></a></em></strong></h3></div></div></div><p>This function starts a global <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion and returns the same values
as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a>.</p><p>When the optional parameter is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> also invalidates
just-in-time compiled objects.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="machine"></a>25.3.3. Machine</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd>The functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_short-sit_ng-site-name.html" target="_top"><code class="function">SHORT-SITE-NAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_short-sit_ng-site-name.html" target="_top"><code class="function">LONG-SITE-NAME</code></a>
should be defined in a site-specific <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> file.
The default implementations try to read the value of the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>
<code class="envar">ORGANIZATION</code>, and, failing that,
call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html"><code class="function">uname</code></a>.
</dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>The functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_short-sit_ng-site-name.html" target="_top"><code class="function">SHORT-SITE-NAME</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_short-sit_ng-site-name.html" target="_top"><code class="function">LONG-SITE-NAME</code></a>
should be defined in a site-specific <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> file.
The default implementations try to read the registry.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="version"></a>25.3.4. Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_lisp-impl_tion-version.html" target="_top"><code class="function">LISP-IMPLEMENTATION-VERSION</code></a></h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_lisp-impl_tion-version.html" target="_top"><code class="function">LISP-IMPLEMENTATION-VERSION</code></a> returns
the numeric version (like <code class="literal">3.14</code>), and
the release date (like <code class="literal">"1999-07-21"</code>).
When running on the same machine on which <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was built, it appends
the binary build and <a href="impnotes.html#image" class="olink">memory image</a> dump date in <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-2.html">universal time</a>
(like <code class="literal">3141592654</code>).
When running on a different machine, it appends the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_machine-instance.html" target="_top"><code class="function">MACHINE-INSTANCE</code></a>
of the machine on which it was built.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="argv"></a>25.3.5. Function <a class="link" href="#argv" title="25.3.5. Function EXT:ARGV"><code class="function">EXT:ARGV</code></a></h3></div></div></div><p>This function will return a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> command line arguments passed to the runtime, including
those already processed by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
Use <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> instead of this function to get the arguments for your program.
</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="clock"></a>25.4. Time <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4.html">[sec_25-1-4]</a></h2></div></div></div><div class="variablelist"><a id="default-tz"></a><p class="title"><strong>Default Time Zone</strong></p><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">No platform supports this currently</span></span></span></dt><dd>The variable <strong class="first"><em class="firstterm"><a class="link" href="#default-tz" title="Default Time Zone"><code class="varname">CUSTOM:*DEFAULT-TIME-ZONE*</code></a></em></strong>
contains the default time zone used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_encode-universal-time.html" target="_top"><code class="function">ENCODE-UNIVERSAL-TIME</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_decode-universal-time.html" target="_top"><code class="function">DECODE-UNIVERSAL-TIME</code></a>. It is initially set to -1
(which means 1 hour east of Greenwich, i.e., Mid European Time).
</dd></dl></div><p>The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#time_zone">time zone</a> in a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-1.html">decoded time</a> does not necessarily have be an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>, but (as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a> number)
it should be a multiple of <span class="data"><code class="literal">1/3600</code></span>.</p><div class="table"><a id="internal-time-units-table"></a><p class="title"><strong>Table 25.7. Time granularity</strong></p><div class="table-contents"><table class="table" summary="Time granularity" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">platform</th><th align="center"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a></th><th align="center"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a></th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_intern_s-per-second.html" target="_top"><code class="constant">INTERNAL-TIME-UNITS-PER-SECOND</code></a></td><td align="center">1,000,000</td><td align="center">10,000,000</td></tr></tbody></table></div></div><br class="table-break" /><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-internal-run-time.html" target="_top"><code class="function">GET-INTERNAL-RUN-TIME</code></a> returns the amount of run time
consumed by the current <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> process since its startup.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="glossary"></a>Chapter 26. Glossary
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-26.html">[chap-26]</a></h2></div></div></div><p>No notes.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="appendix"></a>Chapter 27. Appendix
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-a.html">[chap-a]</a></h2></div></div></div><p>No notes.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="issues"></a>Chapter 28. X3J13 Issue Index
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/Issues-Categorized.html" target="_top">[CLHS-ic]</a></h2></div></div></div><p>This is the list of [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] issues and their current status in
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, i.e., whether <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> supports code that makes use of the
functionality specified by the vote.</p><div class="variablelist"><a id="issues-list"></a><p class="title"><strong>X3J13 Issues</strong></p><dl class="variablelist"><dt><a id="iss001"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss001.html" target="_top">&ENVIRONMENT-BINDING-ORDER:FIRST</a></span></dt><dd>yes</dd><dt><a id="iss002"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss002.html" target="_top">ACCESS-ERROR-NAME</a></span></dt><dd>yes</dd><dt><a id="iss003"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss003.html" target="_top">ADJUST-ARRAY-DISPLACEMENT</a></span></dt><dd>yes</dd><dt><a id="iss004"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss004.html" target="_top">ADJUST-ARRAY-FILL-POINTER</a></span></dt><dd>yes</dd><dt><a id="iss005"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss005.html" target="_top">ADJUST-ARRAY-NOT-ADJUSTABLE:IMPLICIT-COPY</a></span></dt><dd>yes</dd><dt><a id="iss006"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss006.html" target="_top">ALLOCATE-INSTANCE:ADD</a></span></dt><dd>yes</dd><dt><a id="iss007"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss007.html" target="_top">ALLOW-LOCAL-INLINE:INLINE-NOTINLINE</a></span></dt><dd>yes</dd><dt><a id="iss008"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss008.html" target="_top">ALLOW-OTHER-KEYS-NIL:PERMIT</a></span></dt><dd>yes</dd><dt><a id="iss009"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss009.html" target="_top">AREF-1D</a></span></dt><dd>yes</dd><dt><a id="iss010"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss010.html" target="_top">ARGUMENT-MISMATCH-ERROR-AGAIN:CONSISTENT</a></span></dt><dd>yes</dd><dt><a id="iss011"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss011.html" target="_top">ARGUMENT-MISMATCH-ERROR-MOON:FIX</a></span></dt><dd>yes</dd><dt><a id="iss012"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss012.html" target="_top">ARGUMENT-MISMATCH-ERROR:MORE-CLARIFICATIONS</a></span></dt><dd>yes, except for argument list checking in
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> in compiled code (items 11,12)
</dd><dt><a id="iss013"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss013.html" target="_top">ARGUMENTS-UNDERSPECIFIED:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss014"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss014.html" target="_top">ARRAY-DIMENSION-LIMIT-IMPLICATIONS:ALL-FIXNUM</a></span></dt><dd>yes</dd><dt><a id="iss015"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss015.html" target="_top">ARRAY-TYPE-ELEMENT-TYPE-SEMANTICS:UNIFY-UPGRADING</a></span></dt><dd>yes</dd><dt><a id="iss016"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss016.html" target="_top">ASSERT-ERROR-TYPE:ERROR</a></span></dt><dd>yes</dd><dt><a id="iss017"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss017.html" target="_top">ASSOC-RASSOC-IF-KEY</a></span></dt><dd>yes</dd><dt><a id="iss018"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss018.html" target="_top">ASSOC-RASSOC-IF-KEY:YES</a></span></dt><dd>yes</dd><dt><a id="iss019"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss019.html" target="_top">BOA-AUX-INITIALIZATION:ERROR-ON-READ</a></span></dt><dd>yes</dd><dt><a id="iss020"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss020.html" target="_top">BREAK-ON-WARNINGS-OBSOLETE:REMOVE</a></span></dt><dd>yes</dd><dt><a id="iss021"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss021.html" target="_top">BROADCAST-STREAM-RETURN-VALUES:CLARIFY-MINIMALLY</a></span></dt><dd>yes</dd><dt><a id="iss022"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss022.html" target="_top">BUTLAST-NEGATIVE:SHOULD-SIGNAL</a></span></dt><dd>yes</dd><dt><a id="iss023"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss023.html" target="_top">CHANGE-CLASS-INITARGS:PERMIT</a></span></dt><dd>yes</dd><dt><a id="iss024"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss024.html" target="_top">CHAR-NAME-CASE:X3J13-MAR-91</a></span></dt><dd>yes</dd><dt><a id="iss025"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss025.html" target="_top">CHARACTER-LOOSE-ENDS:FIX</a></span></dt><dd>yes</dd><dt><a id="iss026"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss026.html" target="_top">CHARACTER-PROPOSAL:2</a></span></dt><dd>yes</dd><dt><a id="iss027"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss027.html" target="_top">CHARACTER-PROPOSAL:2-1-1</a></span></dt><dd>yes</dd><dt><a id="iss028"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss028.html" target="_top">CHARACTER-PROPOSAL:2-1-2</a></span></dt><dd>yes</dd><dt><a id="iss029"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss029.html" target="_top">CHARACTER-PROPOSAL:2-2-1</a></span></dt><dd>yes</dd><dt><a id="iss030"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss030.html" target="_top">CHARACTER-PROPOSAL:2-3-1</a></span></dt><dd>yes</dd><dt><a id="iss031"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss031.html" target="_top">CHARACTER-PROPOSAL:2-3-2</a></span></dt><dd>yes</dd><dt><a id="iss032"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss032.html" target="_top">CHARACTER-PROPOSAL:2-3-3</a></span></dt><dd>yes</dd><dt><a id="iss033"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss033.html" target="_top">CHARACTER-PROPOSAL:2-3-4</a></span></dt><dd>yes</dd><dt><a id="iss034"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss034.html" target="_top">CHARACTER-PROPOSAL:2-3-5</a></span></dt><dd>yes</dd><dt><a id="iss035"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss035.html" target="_top">CHARACTER-PROPOSAL:2-3-6</a></span></dt><dd>yes</dd><dt><a id="iss036"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss036.html" target="_top">CHARACTER-PROPOSAL:2-4-1</a></span></dt><dd>yes</dd><dt><a id="iss037"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss037.html" target="_top">CHARACTER-PROPOSAL:2-4-2</a></span></dt><dd>yes</dd><dt><a id="iss038"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss038.html" target="_top">CHARACTER-PROPOSAL:2-4-3</a></span></dt><dd>yes</dd><dt><a id="iss039"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss039.html" target="_top">CHARACTER-PROPOSAL:2-5-2</a></span></dt><dd>yes</dd><dt><a id="iss040"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss040.html" target="_top">CHARACTER-PROPOSAL:2-5-6</a></span></dt><dd>yes</dd><dt><a id="iss041"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss041.html" target="_top">CHARACTER-PROPOSAL:2-5-7</a></span></dt><dd>yes</dd><dt><a id="iss042"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss042.html" target="_top">CHARACTER-PROPOSAL:2-6-1</a></span></dt><dd>yes</dd><dt><a id="iss043"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss043.html" target="_top">CHARACTER-PROPOSAL:2-6-2</a></span></dt><dd>yes</dd><dt><a id="iss044"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss044.html" target="_top">CHARACTER-PROPOSAL:2-6-3</a></span></dt><dd>yes</dd><dt><a id="iss045"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss045.html" target="_top">CHARACTER-PROPOSAL:2-6-5</a></span></dt><dd>yes</dd><dt><a id="iss046"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss046.html" target="_top">CHARACTER-VS-CHAR:LESS-INCONSISTENT-SHORT</a></span></dt><dd>yes</dd><dt><a id="iss047"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss047.html" target="_top">CLASS-OBJECT-SPECIALIZER:AFFIRM</a></span></dt><dd>yes</dd><dt><a id="iss048"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss048.html" target="_top">CLOS-CONDITIONS-AGAIN:ALLOW-SUBSET</a></span></dt><dd>yes</dd><dt><a id="iss049"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss049.html" target="_top">CLOS-CONDITIONS:INTEGRATE</a></span></dt><dd>yes</dd><dt><a id="iss050"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss050.html" target="_top">CLOS-ERROR-CHECKING-ORDER:NO-APPLICABLE-METHOD-FIRST</a></span></dt><dd>yes</dd><dt><a id="iss051"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss051.html" target="_top">CLOS-MACRO-COMPILATION:MINIMAL</a></span></dt><dd>yes</dd><dt><a id="iss052"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss052.html" target="_top">CLOSE-CONSTRUCTED-STREAM:ARGUMENT-STREAM-ONLY</a></span></dt><dd>yes</dd><dt><a id="iss053"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss053.html" target="_top">CLOSED-STREAM-OPERATIONS:ALLOW-INQUIRY</a></span></dt><dd>yes</dd><dt><a id="iss054"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss054.html" target="_top">COERCING-SETF-NAME-TO-FUNCTION:ALL-FUNCTION-NAMES</a></span></dt><dd>yes</dd><dt><a id="iss055"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss055.html" target="_top">COLON-NUMBER</a></span></dt><dd>yes</dd><dt><a id="iss056"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss056.html" target="_top">COMMON-FEATURES:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss057"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss057.html" target="_top">COMMON-TYPE:REMOVE</a></span></dt><dd>yes</dd><dt><a id="iss058"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss058.html" target="_top">COMPILE-ARGUMENT-PROBLEMS-AGAIN:FIX</a></span></dt><dd>yes</dd><dt><a id="iss059"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss059.html" target="_top">COMPILE-FILE-HANDLING-OF-TOP-LEVEL-FORMS:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss060"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss060.html" target="_top">COMPILE-FILE-OUTPUT-FILE-DEFAULTS:INPUT-FILE</a></span></dt><dd>yes</dd><dt><a id="iss061"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss061.html" target="_top">COMPILE-FILE-PACKAGE</a></span></dt><dd>yes</dd><dt><a id="iss062"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss062.html" target="_top">COMPILE-FILE-PATHNAME-ARGUMENTS:MAKE-CONSISTENT</a></span></dt><dd>yes</dd><dt><a id="iss063"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss063.html" target="_top">COMPILE-FILE-SYMBOL-HANDLING:NEW-REQUIRE-CONSISTENCY</a></span></dt><dd>yes</dd><dt><a id="iss064"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss064.html" target="_top">COMPILED-FUNCTION-REQUIREMENTS:TIGHTEN</a></span></dt><dd>yes</dd><dt><a id="iss065"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss065.html" target="_top">COMPILER-DIAGNOSTICS:USE-HANDLER</a></span></dt><dd>yes</dd><dt><a id="iss066"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss066.html" target="_top">COMPILER-LET-CONFUSION:ELIMINATE</a></span></dt><dd>yes</dd><dt><a id="iss067"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss067.html" target="_top">COMPILER-VERBOSITY:LIKE-LOAD</a></span></dt><dd>yes</dd><dt><a id="iss068"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss068.html" target="_top">COMPILER-WARNING-STREAM</a></span></dt><dd>yes</dd><dt><a id="iss069"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss069.html" target="_top">COMPLEX-ATAN-BRANCH-CUT:TWEAK</a></span></dt><dd>yes</dd><dt><a id="iss070"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss070.html" target="_top">COMPLEX-ATANH-BOGUS-FORMULA:TWEAK-MORE</a></span></dt><dd>yes</dd><dt><a id="iss071"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss071.html" target="_top">COMPLEX-RATIONAL-RESULT:EXTEND</a></span></dt><dd>yes</dd><dt><a id="iss072"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss072.html" target="_top">COMPUTE-APPLICABLE-METHODS:GENERIC</a></span></dt><dd>yes</dd><dt><a id="iss073"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss073.html" target="_top">CONCATENATE-SEQUENCE:SIGNAL-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss074"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss074.html" target="_top">CONDITION-ACCESSORS-SETFABLE:NO</a></span></dt><dd>yes</dd><dt><a id="iss075"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss075.html" target="_top">CONDITION-RESTARTS:BUGGY</a></span></dt><dd>yes</dd><dt><a id="iss076"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss076.html" target="_top">CONDITION-RESTARTS:PERMIT-ASSOCIATION</a></span></dt><dd>yes</dd><dt><a id="iss077"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss077.html" target="_top">CONDITION-SLOTS:HIDDEN</a></span></dt><dd>yes</dd><dt><a id="iss078"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss078.html" target="_top">CONS-TYPE-SPECIFIER:ADD</a></span></dt><dd>yes</dd><dt><a id="iss079"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss079.html" target="_top">CONSTANT-CIRCULAR-COMPILATION:YES</a></span></dt><dd>yes</dd><dt><a id="iss080"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss080.html" target="_top">CONSTANT-COLLAPSING:GENERALIZE</a></span></dt><dd>yes</dd><dt><a id="iss081"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss081.html" target="_top">CONSTANT-COMPILABLE-TYPES:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss082"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss082.html" target="_top">CONSTANT-FUNCTION-COMPILATION:NO</a></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can dump compiled functions defined in the
global <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. Interpreted functions can <span class="strong"><strong>not</strong></span> be dumped;
this should not be a problem, because an
<span class="emphasis"><em>interpreted</em></span> function in a
<span class="emphasis"><em>compiled</em></span> file usually indicate a programmer
error (often an extra <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_quote.html" target="_top"><code class="function">QUOTE</code></a>).</dd><dt><a id="iss083"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss083.html" target="_top">CONSTANT-MODIFICATION:DISALLOW</a></span></dt><dd>yes</dd><dt><a id="iss084"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss084.html" target="_top">CONSTANTP-DEFINITION:INTENTIONAL</a></span></dt><dd>yes</dd><dt><a id="iss085"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss085.html" target="_top">CONSTANTP-ENVIRONMENT:ADD-ARG</a></span></dt><dd>yes</dd><dt><a id="iss086"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss086.html" target="_top">CONTAGION-ON-NUMERICAL-COMPARISONS:TRANSITIVE</a></span></dt><dd>yes</dd><dt><a id="iss087"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss087.html" target="_top">COPY-SYMBOL-COPY-PLIST:COPY-LIST</a></span></dt><dd>yes</dd><dt><a id="iss088"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss088.html" target="_top">COPY-SYMBOL-PRINT-NAME:EQUAL</a></span></dt><dd>yes</dd><dt><a id="iss089"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss089.html" target="_top">DATA-IO:ADD-SUPPORT</a></span></dt><dd>yes</dd><dt><a id="iss090"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss090.html" target="_top">DATA-TYPES-HIERARCHY-UNDERSPECIFIED</a></span></dt><dd>yes</dd><dt><a id="iss091"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss091.html" target="_top">DEBUGGER-HOOK-VS-BREAK:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss092"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss092.html" target="_top">DECLARATION-SCOPE:NO-HOISTING</a></span></dt><dd>yes</dd><dt><a id="iss093"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss093.html" target="_top">DECLARE-ARRAY-TYPE-ELEMENT-REFERENCES:RESTRICTIVE</a></span></dt><dd>yes</dd><dt><a id="iss094"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss094.html" target="_top">DECLARE-FUNCTION-AMBIGUITY:DELETE-FTYPE-ABBREVIATION</a></span></dt><dd>yes</dd><dt><a id="iss095"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss095.html" target="_top">DECLARE-MACROS:FLUSH</a></span></dt><dd>yes</dd><dt><a id="iss096"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss096.html" target="_top">DECLARE-TYPE-FREE:LEXICAL</a></span></dt><dd>yes</dd><dt><a id="iss097"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss097.html" target="_top">DECLS-AND-DOC</a></span></dt><dd>there is no writeup, but all affected
operators are fully implemented as specified
</dd><dt><a id="iss098"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss098.html" target="_top">DECODE-UNIVERSAL-TIME-DAYLIGHT:LIKE-ENCODE</a></span></dt><dd>yes</dd><dt><a id="iss099"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss099.html" target="_top">DEFCONSTANT-SPECIAL:NO</a></span></dt><dd>yes</dd><dt><a id="iss100"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss100.html" target="_top">DEFGENERIC-DECLARE:ALLOW-MULTIPLE</a></span></dt><dd>yes</dd><dt><a id="iss101"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss101.html" target="_top">DEFINE-COMPILER-MACRO:X3J13-NOV89</a></span></dt><dd>yes</dd><dt><a id="iss102"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss102.html" target="_top">DEFINE-CONDITION-SYNTAX:INCOMPATIBLY-MORE-LIKE-DEFCLASS+EMPHASIZE-READ-ONLY</a></span></dt><dd>yes</dd><dt><a id="iss103"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss103.html" target="_top">DEFINE-METHOD-COMBINATION-BEHAVIOR:CLARIFY</a></span></dt><dd>no</dd><dt><a id="iss104"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss104.html" target="_top">DEFINING-MACROS-NON-TOP-LEVEL:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss105"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss105.html" target="_top">DEFMACRO-BLOCK-SCOPE:EXCLUDES-BINDINGS</a></span></dt><dd>yes</dd><dt><a id="iss106"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss106.html" target="_top">DEFMACRO-LAMBDA-LIST:TIGHTEN-DESCRIPTION</a></span></dt><dd>yes</dd><dt><a id="iss107"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss107.html" target="_top">DEFMETHOD-DECLARATION-SCOPE:CORRESPONDS-TO-BINDINGS</a></span></dt><dd>yes</dd><dt><a id="iss108"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss108.html" target="_top">DEFPACKAGE:ADDITION</a></span></dt><dd>yes</dd><dt><a id="iss109"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss109.html" target="_top">DEFSTRUCT-CONSTRUCTOR-KEY-MIXTURE:ALLOW-KEY</a></span></dt><dd>yes</dd><dt><a id="iss110"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss110.html" target="_top">DEFSTRUCT-CONSTRUCTOR-OPTIONS:EXPLICIT</a></span></dt><dd>yes</dd><dt><a id="iss111"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss111.html" target="_top">DEFSTRUCT-CONSTRUCTOR-SLOT-VARIABLES:NOT-BOUND</a></span></dt><dd>yes</dd><dt><a id="iss112"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss112.html" target="_top">DEFSTRUCT-COPIER-ARGUMENT-TYPE:RESTRICT</a></span></dt><dd>yes</dd><dt><a id="iss113"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss113.html" target="_top">DEFSTRUCT-COPIER:ARGUMENT-TYPE</a></span></dt><dd>yes</dd><dt><a id="iss114"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss114.html" target="_top">DEFSTRUCT-DEFAULT-VALUE-EVALUATION:IFF-NEEDED</a></span></dt><dd>yes</dd><dt><a id="iss115"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss115.html" target="_top">DEFSTRUCT-INCLUDE-DEFTYPE:EXPLICITLY-UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss116"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss116.html" target="_top">DEFSTRUCT-PRINT-FUNCTION-AGAIN:X3J13-MAR-93</a></span></dt><dd>yes</dd><dt><a id="iss117"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss117.html" target="_top">DEFSTRUCT-PRINT-FUNCTION-INHERITANCE:YES</a></span></dt><dd>yes</dd><dt><a id="iss118"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss118.html" target="_top">DEFSTRUCT-REDEFINITION:ERROR</a></span></dt><dd>yes</dd><dt><a id="iss119"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss119.html" target="_top">DEFSTRUCT-SLOTS-CONSTRAINTS-NAME:DUPLICATES-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss120"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss120.html" target="_top">DEFSTRUCT-SLOTS-CONSTRAINTS-NUMBER</a></span></dt><dd>yes</dd><dt><a id="iss121"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss121.html" target="_top">DEFTYPE-DESTRUCTURING:YES</a></span></dt><dd>yes</dd><dt><a id="iss122"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss122.html" target="_top">DEFTYPE-KEY:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss123"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss123.html" target="_top">DEFVAR-DOCUMENTATION:UNEVALUATED</a></span></dt><dd>yes</dd><dt><a id="iss124"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss124.html" target="_top">DEFVAR-INIT-TIME:NOT-DELAYED</a></span></dt><dd>yes</dd><dt><a id="iss125"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss125.html" target="_top">DEFVAR-INITIALIZATION:CONSERVATIVE</a></span></dt><dd>yes</dd><dt><a id="iss126"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss126.html" target="_top">DEPRECATION-POSITION:LIMITED</a></span></dt><dd>yes</dd><dt><a id="iss127"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss127.html" target="_top">DESCRIBE-INTERACTIVE:NO</a></span></dt><dd>yes</dd><dt><a id="iss128"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss128.html" target="_top">DESCRIBE-UNDERSPECIFIED:DESCRIBE-OBJECT</a></span></dt><dd>yes</dd><dt><a id="iss129"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss129.html" target="_top">DESTRUCTIVE-OPERATIONS:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss130"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss130.html" target="_top">DESTRUCTURING-BIND:NEW-MACRO</a></span></dt><dd>yes</dd><dt><a id="iss131"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss131.html" target="_top">DISASSEMBLE-SIDE-EFFECT:DO-NOT-INSTALL</a></span></dt><dd>yes</dd><dt><a id="iss132"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss132.html" target="_top">DISPLACED-ARRAY-PREDICATE:ADD</a></span></dt><dd>yes</dd><dt><a id="iss133"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss133.html" target="_top">DO-SYMBOLS-BLOCK-SCOPE:ENTIRE-FORM</a></span></dt><dd>yes</dd><dt><a id="iss134"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss134.html" target="_top">DO-SYMBOLS-DUPLICATES</a></span></dt><dd>yes</dd><dt><a id="iss135"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss135.html" target="_top">DOCUMENTATION-FUNCTION-BUGS:FIX</a></span></dt><dd>yes</dd><dt><a id="iss136"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss136.html" target="_top">DOCUMENTATION-FUNCTION-TANGLED:REQUIRE-ARGUMENT</a></span></dt><dd>yes</dd><dt><a id="iss137"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss137.html" target="_top">DOTIMES-IGNORE:X3J13-MAR91</a></span></dt><dd>yes</dd><dt><a id="iss138"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss138.html" target="_top">DOTTED-LIST-ARGUMENTS:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss139"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss139.html" target="_top">DOTTED-MACRO-FORMS:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss140"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss140.html" target="_top">DRIBBLE-TECHNIQUE</a></span></dt><dd>yes</dd><dt><a id="iss141"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss141.html" target="_top">DYNAMIC-EXTENT-FUNCTION:EXTEND</a></span></dt><dd>yes</dd><dt><a id="iss142"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss142.html" target="_top">DYNAMIC-EXTENT:NEW-DECLARATION</a></span></dt><dd>yes</dd><dt><a id="iss143"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss143.html" target="_top">EQUAL-STRUCTURE:MAYBE-STATUS-QUO</a></span></dt><dd>yes</dd><dt><a id="iss144"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss144.html" target="_top">ERROR-TERMINOLOGY-WARNING:MIGHT</a></span></dt><dd>yes</dd><dt><a id="iss145"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss145.html" target="_top">EVAL-OTHER:SELF-EVALUATE</a></span></dt><dd>yes</dd><dt><a id="iss146"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss146.html" target="_top">EVAL-TOP-LEVEL:LOAD-LIKE-COMPILE-FILE</a></span></dt><dd>yes</dd><dt><a id="iss147"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss147.html" target="_top">EVAL-WHEN-NON-TOP-LEVEL:GENERALIZE-EVAL-NEW-KEYWORDS</a></span></dt><dd>yes</dd><dt><a id="iss148"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss148.html" target="_top">EVAL-WHEN-OBSOLETE-KEYWORDS:X3J13-MAR-1993</a></span></dt><dd>no</dd><dt><a id="iss149"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss149.html" target="_top">EVALHOOK-STEP-CONFUSION:FIX</a></span></dt><dd>yes</dd><dt><a id="iss150"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss150.html" target="_top">EVALHOOK-STEP-CONFUSION:X3J13-NOV-89</a></span></dt><dd>yes</dd><dt><a id="iss151"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss151.html" target="_top">EXIT-EXTENT-AND-CONDITION-SYSTEM:LIKE-DYNAMIC-BINDINGS</a></span></dt><dd>yes</dd><dt><a id="iss152"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss152.html" target="_top">EXIT-EXTENT:MINIMAL</a></span></dt><dd>yes, actually implement MEDIUM
</dd><dt><a id="iss153"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss153.html" target="_top">EXPT-RATIO:P.211</a></span></dt><dd>yes</dd><dt><a id="iss154"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss154.html" target="_top">EXTENSIONS-POSITION:DOCUMENTATION</a></span></dt><dd>yes</dd><dt><a id="iss155"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss155.html" target="_top">EXTERNAL-FORMAT-FOR-EVERY-FILE-CONNECTION:MINIMUM</a></span></dt><dd>yes</dd><dt><a id="iss156"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss156.html" target="_top">EXTRA-RETURN-VALUES:NO</a></span></dt><dd>yes</dd><dt><a id="iss157"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss157.html" target="_top">FILE-OPEN-ERROR:SIGNAL-FILE-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss158"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss158.html" target="_top">FIXNUM-NON-PORTABLE:TIGHTEN-DEFINITION</a></span></dt><dd>yes</dd><dt><a id="iss159"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss159.html" target="_top">FLET-DECLARATIONS</a></span></dt><dd>yes</dd><dt><a id="iss160"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss160.html" target="_top">FLET-DECLARATIONS:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss161"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss161.html" target="_top">FLET-IMPLICIT-BLOCK:YES</a></span></dt><dd>yes</dd><dt><a id="iss162"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss162.html" target="_top">FLOAT-UNDERFLOW:ADD-VARIABLES</a></span></dt><dd>yes</dd><dt><a id="iss163"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss163.html" target="_top">FLOATING-POINT-CONDITION-NAMES:X3J13-NOV-89</a></span></dt><dd>yes</dd><dt><a id="iss164"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss164.html" target="_top">FORMAT-ATSIGN-COLON</a></span></dt><dd>yes</dd><dt><a id="iss165"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss165.html" target="_top">FORMAT-COLON-UPARROW-SCOPE</a></span></dt><dd>yes</dd><dt><a id="iss166"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss166.html" target="_top">FORMAT-COMMA-INTERVAL</a></span></dt><dd>yes</dd><dt><a id="iss167"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss167.html" target="_top">FORMAT-E-EXPONENT-SIGN:FORCE-SIGN</a></span></dt><dd>yes</dd><dt><a id="iss168"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss168.html" target="_top">FORMAT-OP-C</a></span></dt><dd>yes</dd><dt><a id="iss169"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss169.html" target="_top">FORMAT-PRETTY-PRINT:YES</a></span></dt><dd>yes, except that <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-1.html"><code class="literal">~F</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-2.html"><code class="literal">~E</code></a>,
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-3.html"><code class="literal">~G</code></a>, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-3-4.html"><code class="literal">~$</code></a> also bind <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-b_rint-radixst.html" target="_top"><code class="varname">*PRINT-BASE*</code></a> to 10 and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-b_rint-radixst.html" target="_top"><code class="varname">*PRINT-RADIX*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><a id="iss170"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss170.html" target="_top">FORMAT-STRING-ARGUMENTS:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss171"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss171.html" target="_top">FUNCTION-CALL-EVALUATION-ORDER:MORE-UNSPECIFIED</a></span></dt><dd>yes</dd><dt><a id="iss172"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss172.html" target="_top">FUNCTION-COMPOSITION:JAN89-X3J13</a></span></dt><dd>yes</dd><dt><a id="iss173"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss173.html" target="_top">FUNCTION-DEFINITION:JAN89-X3J13</a></span></dt><dd>yes</dd><dt><a id="iss174"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss174.html" target="_top">FUNCTION-NAME:LARGE</a></span></dt><dd>yes</dd><dt><a id="iss175"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss175.html" target="_top">FUNCTION-TYPE</a></span></dt><dd>yes</dd><dt><a id="iss176"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss176.html" target="_top">FUNCTION-TYPE-ARGUMENT-TYPE-SEMANTICS:RESTRICTIVE</a></span></dt><dd>yes</dd><dt><a id="iss177"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss177.html" target="_top">FUNCTION-TYPE-KEY-NAME:SPECIFY-KEYWORD</a></span></dt><dd>yes</dd><dt><a id="iss178"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss178.html" target="_top">FUNCTION-TYPE-REST-LIST-ELEMENT:USE-ACTUAL-ARGUMENT-TYPE</a></span></dt><dd>yes</dd><dt><a id="iss179"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss179.html" target="_top">FUNCTION-TYPE:X3J13-MARCH-88</a></span></dt><dd>yes</dd><dt><a id="iss180"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss180.html" target="_top">GENERALIZE-PRETTY-PRINTER:UNIFY</a></span></dt><dd>no</dd><dt><a id="iss181"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss181.html" target="_top">GENERIC-FLET-POORLY-DESIGNED:DELETE</a></span></dt><dd>yes</dd><dt><a id="iss182"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss182.html" target="_top">GENSYM-NAME-STICKINESS:LIKE-TEFLON</a></span></dt><dd>yes</dd><dt><a id="iss183"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss183.html" target="_top">GENTEMP-BAD-IDEA:DEPRECATE</a></span></dt><dd>yes</dd><dt><a id="iss184"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss184.html" target="_top">GET-MACRO-CHARACTER-READTABLE:NIL-STANDARD</a></span></dt><dd>yes</dd><dt><a id="iss185"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss185.html" target="_top">GET-SETF-METHOD-ENVIRONMENT:ADD-ARG</a></span></dt><dd>yes</dd><dt><a id="iss186"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss186.html" target="_top">HASH-TABLE-ACCESS:X3J13-MAR-89</a></span></dt><dd>yes</dd><dt><a id="iss187"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss187.html" target="_top">HASH-TABLE-KEY-MODIFICATION:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss188"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss188.html" target="_top">HASH-TABLE-PACKAGE-GENERATORS:ADD-WITH-WRAPPER</a></span></dt><dd>yes</dd><dt><a id="iss189"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss189.html" target="_top">HASH-TABLE-REHASH-SIZE-INTEGER</a></span></dt><dd>yes</dd><dt><a id="iss190"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss190.html" target="_top">HASH-TABLE-SIZE:INTENDED-ENTRIES</a></span></dt><dd>yes</dd><dt><a id="iss191"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss191.html" target="_top">HASH-TABLE-TESTS:ADD-EQUALP</a></span></dt><dd>yes</dd><dt><a id="iss192"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss192.html" target="_top">IEEE-ATAN-BRANCH-CUT:SPLIT</a></span></dt><dd>yes</dd><dt><a id="iss193"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss193.html" target="_top">IGNORE-USE-TERMINOLOGY:VALUE-ONLY</a></span></dt><dd>yes</dd><dt><a id="iss194"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss194.html" target="_top">IMPORT-SETF-SYMBOL-PACKAGE</a></span></dt><dd>yes</dd><dt><a id="iss195"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss195.html" target="_top">IN-PACKAGE-FUNCTIONALITY:MAR89-X3J13</a></span></dt><dd>yes</dd><dt><a id="iss196"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss196.html" target="_top">IN-SYNTAX:MINIMAL</a></span></dt><dd>yes</dd><dt><a id="iss197"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss197.html" target="_top">INITIALIZATION-FUNCTION-KEYWORD-CHECKING</a></span></dt><dd>yes</dd><dt><a id="iss198"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss198.html" target="_top">ISO-COMPATIBILITY:ADD-SUBSTRATE</a></span></dt><dd>yes</dd><dt><a id="iss199"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss199.html" target="_top">JUN90-TRIVIAL-ISSUES:11</a></span></dt><dd>yes</dd><dt><a id="iss200"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss200.html" target="_top">JUN90-TRIVIAL-ISSUES:14</a></span></dt><dd>yes</dd><dt><a id="iss201"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss201.html" target="_top">JUN90-TRIVIAL-ISSUES:24</a></span></dt><dd>yes</dd><dt><a id="iss202"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss202.html" target="_top">JUN90-TRIVIAL-ISSUES:25</a></span></dt><dd>yes</dd><dt><a id="iss203"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss203.html" target="_top">JUN90-TRIVIAL-ISSUES:27</a></span></dt><dd>yes for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_the.html" target="_top"><code class="function">THE</code></a>, no for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> (spec not clear)
</dd><dt><a id="iss204"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss204.html" target="_top">JUN90-TRIVIAL-ISSUES:3</a></span></dt><dd>yes</dd><dt><a id="iss205"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss205.html" target="_top">JUN90-TRIVIAL-ISSUES:4</a></span></dt><dd>yes</dd><dt><a id="iss206"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss206.html" target="_top">JUN90-TRIVIAL-ISSUES:5</a></span></dt><dd>yes</dd><dt><a id="iss207"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss207.html" target="_top">JUN90-TRIVIAL-ISSUES:9</a></span></dt><dd>yes</dd><dt><a id="iss208"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss208.html" target="_top">KEYWORD-ARGUMENT-NAME-PACKAGE:ANY</a></span></dt><dd>yes</dd><dt><a id="iss209"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss209.html" target="_top">LAST-N</a></span></dt><dd>yes</dd><dt><a id="iss210"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss210.html" target="_top">LCM-NO-ARGUMENTS:1</a></span></dt><dd>yes</dd><dt><a id="iss211"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss211.html" target="_top">LEXICAL-CONSTRUCT-GLOBAL-DEFINITION:UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss212"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss212.html" target="_top">LISP-PACKAGE-NAME:COMMON-LISP</a></span></dt><dd>yes</dd><dt><a id="iss213"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss213.html" target="_top">LISP-SYMBOL-REDEFINITION-AGAIN:MORE-FIXES</a></span></dt><dd>yes</dd><dt><a id="iss214"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss214.html" target="_top">LISP-SYMBOL-REDEFINITION:MAR89-X3J13</a></span></dt><dd>yes</dd><dt><a id="iss215"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss215.html" target="_top">LOAD-OBJECTS:MAKE-LOAD-FORM</a></span></dt><dd>yes</dd><dt><a id="iss216"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss216.html" target="_top">LOAD-TIME-EVAL:R**2-NEW-SPECIAL-FORM</a></span></dt><dd>obsolete</dd><dt><a id="iss217"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss217.html" target="_top">LOAD-TIME-EVAL:R**3-NEW-SPECIAL-FORM</a></span></dt><dd>yes</dd><dt><a id="iss218"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss218.html" target="_top">LOAD-TRUENAME:NEW-PATHNAME-VARIABLES</a></span></dt><dd>yes</dd><dt><a id="iss219"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss219.html" target="_top">LOCALLY-TOP-LEVEL:SPECIAL-FORM</a></span></dt><dd>yes</dd><dt><a id="iss220"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss220.html" target="_top">LOOP-AND-DISCREPANCY:NO-REITERATION</a></span></dt><dd>yes</dd><dt><a id="iss221"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss221.html" target="_top">LOOP-FOR-AS-ON-TYPO:FIX-TYPO</a></span></dt><dd>yes</dd><dt><a id="iss222"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss222.html" target="_top">LOOP-INITFORM-ENVIRONMENT:PARTIAL-INTERLEAVING-VAGUE</a></span></dt><dd>no</dd><dt><a id="iss223"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss223.html" target="_top">LOOP-MISCELLANEOUS-REPAIRS:FIX</a></span></dt><dd>yes</dd><dt><a id="iss224"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss224.html" target="_top">LOOP-NAMED-BLOCK-NIL:OVERRIDE</a></span></dt><dd>yes</dd><dt><a id="iss225"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss225.html" target="_top">LOOP-PRESENT-SYMBOLS-TYPO:FLUSH-WRONG-WORDS</a></span></dt><dd>yes</dd><dt><a id="iss226"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss226.html" target="_top">LOOP-SYNTAX-OVERHAUL:REPAIR</a></span></dt><dd>yes</dd><dt><a id="iss227"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss227.html" target="_top">MACRO-AS-FUNCTION:DISALLOW</a></span></dt><dd>yes</dd><dt><a id="iss228"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss228.html" target="_top">MACRO-DECLARATIONS:MAKE-EXPLICIT</a></span></dt><dd>yes</dd><dt><a id="iss229"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss229.html" target="_top">MACRO-ENVIRONMENT-EXTENT:DYNAMIC</a></span></dt><dd>yes</dd><dt><a id="iss230"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss230.html" target="_top">MACRO-FUNCTION-ENVIRONMENT</a></span></dt><dd>obsolete</dd><dt><a id="iss231"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss231.html" target="_top">MACRO-FUNCTION-ENVIRONMENT:YES</a></span></dt><dd>yes</dd><dt><a id="iss232"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss232.html" target="_top">MACRO-SUBFORMS-TOP-LEVEL-P:ADD-CONSTRAINTS</a></span></dt><dd>no</dd><dt><a id="iss233"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss233.html" target="_top">MACROEXPAND-HOOK-DEFAULT:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss234"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss234.html" target="_top">MACROEXPAND-HOOK-INITIAL-VALUE:IMPLEMENTATION-DEPENDENT</a></span></dt><dd>yes</dd><dt><a id="iss235"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss235.html" target="_top">MACROEXPAND-RETURN-VALUE:TRUE</a></span></dt><dd>yes</dd><dt><a id="iss236"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss236.html" target="_top">MAKE-LOAD-FORM-CONFUSION:REWRITE</a></span></dt><dd>yes</dd><dt><a id="iss237"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss237.html" target="_top">MAKE-LOAD-FORM-SAVING-SLOTS:NO-INITFORMS</a></span></dt><dd>yes</dd><dt><a id="iss238"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss238.html" target="_top">MAKE-PACKAGE-USE-DEFAULT:IMPLEMENTATION-DEPENDENT</a></span></dt><dd>yes</dd><dt><a id="iss239"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss239.html" target="_top">MAP-INTO:ADD-FUNCTION</a></span></dt><dd>yes</dd><dt><a id="iss240"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss240.html" target="_top">MAPPING-DESTRUCTIVE-INTERACTION:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss241"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss241.html" target="_top">METACLASS-OF-SYSTEM-CLASS:UNSPECIFIED</a></span></dt><dd>yes</dd><dt><a id="iss242"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss242.html" target="_top">METHOD-COMBINATION-ARGUMENTS:CLARIFY</a></span></dt><dd>no</dd><dt><a id="iss243"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss243.html" target="_top">METHOD-INITFORM:FORBID-CALL-NEXT-METHOD</a></span></dt><dd>no</dd><dt><a id="iss244"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss244.html" target="_top">MUFFLE-WARNING-CONDITION-ARGUMENT</a></span></dt><dd>yes</dd><dt><a id="iss245"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss245.html" target="_top">MULTIPLE-VALUE-SETQ-ORDER:LIKE-SETF-OF-VALUES</a></span></dt><dd>yes</dd><dt><a id="iss246"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss246.html" target="_top">MULTIPLE-VALUES-LIMIT-ON-VARIABLES:UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss247"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss247.html" target="_top">NINTERSECTION-DESTRUCTION</a></span></dt><dd>yes</dd><dt><a id="iss248"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss248.html" target="_top">NINTERSECTION-DESTRUCTION:REVERT</a></span></dt><dd>yes</dd><dt><a id="iss249"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss249.html" target="_top">NOT-AND-NULL-RETURN-VALUE:X3J13-MAR-93</a></span></dt><dd>yes</dd><dt><a id="iss250"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss250.html" target="_top">NTH-VALUE:ADD</a></span></dt><dd>yes</dd><dt><a id="iss251"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss251.html" target="_top">OPTIMIZE-DEBUG-INFO:NEW-QUALITY</a></span></dt><dd>yes</dd><dt><a id="iss252"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss252.html" target="_top">PACKAGE-CLUTTER:REDUCE</a></span></dt><dd>yes</dd><dt><a id="iss253"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss253.html" target="_top">PACKAGE-DELETION:NEW-FUNCTION</a></span></dt><dd>yes</dd><dt><a id="iss254"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss254.html" target="_top">PACKAGE-FUNCTION-CONSISTENCY:MORE-PERMISSIVE</a></span></dt><dd>yes</dd><dt><a id="iss255"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss255.html" target="_top">PARSE-ERROR-STREAM:SPLIT-TYPES</a></span></dt><dd>yes</dd><dt><a id="iss256"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss256.html" target="_top">PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT</a></span></dt><dd>yes</dd><dt><a id="iss257"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss257.html" target="_top">PATHNAME-COMPONENT-VALUE:SPECIFY</a></span></dt><dd>no</dd><dt><a id="iss258"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss258.html" target="_top">PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES</a></span></dt><dd>yes when <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
</dd><dt><a id="iss259"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss259.html" target="_top">PATHNAME-LOGICAL:ADD</a></span></dt><dd>yes</dd><dt><a id="iss260"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss260.html" target="_top">PATHNAME-PRINT-READ:SHARPSIGN-P</a></span></dt><dd>yes</dd><dt><a id="iss261"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss261.html" target="_top">PATHNAME-STREAM</a></span></dt><dd>yes</dd><dt><a id="iss262"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss262.html" target="_top">PATHNAME-STREAM:FILES-OR-SYNONYM</a></span></dt><dd>yes</dd><dt><a id="iss263"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss263.html" target="_top">PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION</a></span></dt><dd>yes</dd><dt><a id="iss264"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss264.html" target="_top">PATHNAME-SYMBOL</a></span></dt><dd>yes when <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
</dd><dt><a id="iss265"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss265.html" target="_top">PATHNAME-SYNTAX-ERROR-TIME:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss266"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss266.html" target="_top">PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN</a></span></dt><dd>yes</dd><dt><a id="iss267"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss267.html" target="_top">PATHNAME-WILD:NEW-FUNCTIONS</a></span></dt><dd>yes</dd><dt><a id="iss268"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss268.html" target="_top">PEEK-CHAR-READ-CHAR-ECHO:FIRST-READ-CHAR</a></span></dt><dd>yes</dd><dt><a id="iss269"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss269.html" target="_top">PLIST-DUPLICATES:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss270"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss270.html" target="_top">PRETTY-PRINT-INTERFACE</a></span></dt><dd>yes</dd><dt><a id="iss271"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss271.html" target="_top">PRINC-READABLY:X3J13-DEC-91</a></span></dt><dd>yes</dd><dt><a id="iss272"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss272.html" target="_top">PRINT-CASE-BEHAVIOR:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss273"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss273.html" target="_top">PRINT-CASE-PRINT-ESCAPE-INTERACTION:VERTICAL-BAR-RULE-NO-UPCASE</a></span></dt><dd>yes</dd><dt><a id="iss274"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss274.html" target="_top">PRINT-CIRCLE-SHARED:RESPECT-PRINT-CIRCLE</a></span></dt><dd>yes</dd><dt><a id="iss275"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss275.html" target="_top">PRINT-CIRCLE-STRUCTURE:USER-FUNCTIONS-WORK</a></span></dt><dd>yes</dd><dt><a id="iss276"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss276.html" target="_top">PRINT-READABLY-BEHAVIOR:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss277"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss277.html" target="_top">PRINTER-WHITESPACE:JUST-ONE-SPACE</a></span></dt><dd>yes</dd><dt><a id="iss278"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss278.html" target="_top">PROCLAIM-ETC-IN-COMPILE-FILE:NEW-MACRO</a></span></dt><dd>yes</dd><dt><a id="iss279"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss279.html" target="_top">PUSH-EVALUATION-ORDER:FIRST-ITEM</a></span></dt><dd>yes</dd><dt><a id="iss280"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss280.html" target="_top">PUSH-EVALUATION-ORDER:ITEM-FIRST</a></span></dt><dd>yes</dd><dt><a id="iss281"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss281.html" target="_top">PUSHNEW-STORE-REQUIRED:UNSPECIFIED</a></span></dt><dd>yes</dd><dt><a id="iss282"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss282.html" target="_top">QUOTE-SEMANTICS:NO-COPYING</a></span></dt><dd>yes</dd><dt><a id="iss283"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss283.html" target="_top">RANGE-OF-COUNT-KEYWORD:NIL-OR-INTEGER</a></span></dt><dd>yes, when <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>;
otherwise negative <code class="constant">:COUNT</code> values are not allowed.
</dd><dt><a id="iss284"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss284.html" target="_top">RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL</a></span></dt><dd>yes</dd><dt><a id="iss285"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss285.html" target="_top">READ-AND-WRITE-BYTES:NEW-FUNCTIONS</a></span></dt><dd>yes</dd><dt><a id="iss286"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss286.html" target="_top">READ-CASE-SENSITIVITY:READTABLE-KEYWORDS</a></span></dt><dd>yes</dd><dt><a id="iss287"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss287.html" target="_top">READ-MODIFY-WRITE-EVALUATION-ORDER:DELAYED-ACCESS-STORES</a></span></dt><dd>no</dd><dt><a id="iss288"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss288.html" target="_top">READ-SUPPRESS-CONFUSING:GENERALIZE</a></span></dt><dd>yes, except that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-delimited-list.html" target="_top"><code class="function">READ-DELIMITED-LIST</code></a> still
constructs a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a></dd><dt><a id="iss289"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss289.html" target="_top">READER-ERROR:NEW-TYPE</a></span></dt><dd>yes</dd><dt><a id="iss290"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss290.html" target="_top">REAL-NUMBER-TYPE:X3J13-MAR-89</a></span></dt><dd>yes</dd><dt><a id="iss291"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss291.html" target="_top">RECURSIVE-DEFTYPE:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss292"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss292.html" target="_top">REDUCE-ARGUMENT-EXTRACTION</a></span></dt><dd>yes</dd><dt><a id="iss293"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss293.html" target="_top">REMF-DESTRUCTION-UNSPECIFIED:X3J13-MAR-89</a></span></dt><dd>yes</dd><dt><a id="iss294"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss294.html" target="_top">REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91</a></span></dt><dd>yes</dd><dt><a id="iss295"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss295.html" target="_top">REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT</a></span></dt><dd>yes</dd><dt><a id="iss296"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss296.html" target="_top">REQUIRE-PATHNAME-DEFAULTS:ELIMINATE</a></span></dt><dd>superseded by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss294.html" target="_top">REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91</a></dd><dt><a id="iss297"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss297.html" target="_top">REST-LIST-ALLOCATION:MAY-SHARE</a></span></dt><dd>yes</dd><dt><a id="iss298"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss298.html" target="_top">RESULT-LISTS-SHARED:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss299"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss299.html" target="_top">RETURN-VALUES-UNSPECIFIED:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss300"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss300.html" target="_top">ROOM-DEFAULT-ARGUMENT:NEW-VALUE</a></span></dt><dd>yes</dd><dt><a id="iss301"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss301.html" target="_top">SELF-MODIFYING-CODE:FORBID</a></span></dt><dd>yes</dd><dt><a id="iss302"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss302.html" target="_top">SEQUENCE-TYPE-LENGTH:MUST-MATCH</a></span></dt><dd>yes</dd><dt><a id="iss303"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss303.html" target="_top">SETF-APPLY-EXPANSION:IGNORE-EXPANDER</a></span></dt><dd>yes</dd><dt><a id="iss304"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss304.html" target="_top">SETF-FIND-CLASS:ALLOW-NIL</a></span></dt><dd>yes</dd><dt><a id="iss305"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss305.html" target="_top">SETF-FUNCTIONS-AGAIN:MINIMAL-CHANGES</a></span></dt><dd>yes</dd><dt><a id="iss306"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss306.html" target="_top">SETF-GET-DEFAULT:EVALUATED-BUT-IGNORED</a></span></dt><dd>yes</dd><dt><a id="iss307"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss307.html" target="_top">SETF-MACRO-EXPANSION:LAST</a></span></dt><dd>yes</dd><dt><a id="iss308"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss308.html" target="_top">SETF-METHOD-VS-SETF-METHOD:RENAME-OLD-TERMS</a></span></dt><dd>yes</dd><dt><a id="iss309"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss309.html" target="_top">SETF-MULTIPLE-STORE-VARIABLES:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss310"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss310.html" target="_top">SETF-OF-APPLY:ONLY-AREF-AND-FRIENDS</a></span></dt><dd>yes</dd><dt><a id="iss311"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss311.html" target="_top">SETF-OF-VALUES:ADD</a></span></dt><dd>yes</dd><dt><a id="iss312"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss312.html" target="_top">SETF-SUB-METHODS:DELAYED-ACCESS-STORES</a></span></dt><dd>yes</dd><dt><a id="iss313"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss313.html" target="_top">SHADOW-ALREADY-PRESENT</a></span></dt><dd>yes</dd><dt><a id="iss314"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss314.html" target="_top">SHADOW-ALREADY-PRESENT:WORKS</a></span></dt><dd>yes</dd><dt><a id="iss315"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss315.html" target="_top">SHARP-COMMA-CONFUSION:REMOVE</a></span></dt><dd>no</dd><dt><a id="iss316"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss316.html" target="_top">SHARP-O-FOOBAR:CONSEQUENCES-UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss317"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss317.html" target="_top">SHARP-STAR-DELIMITER:NORMAL-DELIMITER</a></span></dt><dd>yes</dd><dt><a id="iss318"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss318.html" target="_top">SHARPSIGN-PLUS-MINUS-PACKAGE:KEYWORD</a></span></dt><dd>yes</dd><dt><a id="iss319"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss319.html" target="_top">SLOT-MISSING-VALUES:SPECIFY</a></span></dt><dd>yes</dd><dt><a id="iss320"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss320.html" target="_top">SLOT-VALUE-METACLASSES:LESS-MINIMAL</a></span></dt><dd>yes</dd><dt><a id="iss321"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss321.html" target="_top">SPECIAL-FORM-P-MISNOMER:RENAME</a></span></dt><dd>yes</dd><dt><a id="iss322"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss322.html" target="_top">SPECIAL-TYPE-SHADOWING:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss323"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss323.html" target="_top">STANDARD-INPUT-INITIAL-BINDING:DEFINED-CONTRACTS</a></span></dt><dd>yes</dd><dt><a id="iss324"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss324.html" target="_top">STANDARD-REPERTOIRE-GRATUITOUS:RENAME</a></span></dt><dd>yes</dd><dt><a id="iss325"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss325.html" target="_top">STEP-ENVIRONMENT:CURRENT</a></span></dt><dd>yes</dd><dt><a id="iss326"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss326.html" target="_top">STEP-MINIMAL:PERMIT-PROGN</a></span></dt><dd>yes</dd><dt><a id="iss327"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss327.html" target="_top">STREAM-ACCESS:ADD-TYPES-ACCESSORS</a></span></dt><dd>yes</dd><dt><a id="iss328"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss328.html" target="_top">STREAM-CAPABILITIES:INTERACTIVE-STREAM-P</a></span></dt><dd>yes</dd><dt><a id="iss329"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss329.html" target="_top">STRING-COERCION:MAKE-CONSISTENT</a></span></dt><dd>yes</dd><dt><a id="iss330"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss330.html" target="_top">STRING-OUTPUT-STREAM-BASHING:UNDEFINED</a></span></dt><dd>yes</dd><dt><a id="iss331"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss331.html" target="_top">STRUCTURE-READ-PRINT-SYNTAX:KEYWORDS</a></span></dt><dd>yes</dd><dt><a id="iss332"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss332.html" target="_top">SUBSEQ-OUT-OF-BOUNDS</a></span></dt><dd>yes</dd><dt><a id="iss333"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss333.html" target="_top">SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss334"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss334.html" target="_top">SUBSETTING-POSITION:NONE</a></span></dt><dd>yes</dd><dt><a id="iss335"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss335.html" target="_top">SUBTYPEP-ENVIRONMENT:ADD-ARG</a></span></dt><dd>yes</dd><dt><a id="iss336"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss336.html" target="_top">SUBTYPEP-TOO-VAGUE:CLARIFY-MORE</a></span></dt><dd>yes</dd><dt><a id="iss337"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss337.html" target="_top">SXHASH-DEFINITION:SIMILAR-FOR-SXHASH</a></span></dt><dd>yes</dd><dt><a id="iss338"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss338.html" target="_top">SYMBOL-MACROLET-DECLARE:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss339"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss339.html" target="_top">SYMBOL-MACROLET-SEMANTICS:SPECIAL-FORM</a></span></dt><dd>yes</dd><dt><a id="iss340"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss340.html" target="_top">SYMBOL-MACROLET-TYPE-DECLARATION:NO</a></span></dt><dd>yes</dd><dt><a id="iss341"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss341.html" target="_top">SYMBOL-MACROS-AND-PROCLAIMED-SPECIALS:SIGNALS-AN-ERROR</a></span></dt><dd>yes</dd><dt><a id="iss342"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss342.html" target="_top">SYMBOL-PRINT-ESCAPE-BEHAVIOR:CLARIFY</a></span></dt><dd>yes</dd><dt><a id="iss343"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss343.html" target="_top">SYNTACTIC-ENVIRONMENT-ACCESS:RETRACTED-MAR91</a></span></dt><dd>yes</dd><dt><a id="iss344"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss344.html" target="_top">TAGBODY-TAG-EXPANSION:NO</a></span></dt><dd>yes</dd><dt><a id="iss345"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss345.html" target="_top">TAILP-NIL:T</a></span></dt><dd>yes</dd><dt><a id="iss346"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss346.html" target="_top">TEST-NOT-IF-NOT:FLUSH-ALL</a></span></dt><dd>yes, but no warning</dd><dt><a id="iss347"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss347.html" target="_top">THE-AMBIGUITY:FOR-DECLARATION</a></span></dt><dd>yes</dd><dt><a id="iss348"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss348.html" target="_top">THE-VALUES:RETURN-NUMBER-RECEIVED</a></span></dt><dd>yes</dd><dt><a id="iss349"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss349.html" target="_top">TIME-ZONE-NON-INTEGER:ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss350"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss350.html" target="_top">TYPE-DECLARATION-ABBREVIATION:ALLOW-ALL</a></span></dt><dd>no</dd><dt><a id="iss351"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss351.html" target="_top">TYPE-OF-AND-PREDEFINED-CLASSES:TYPE-OF-HANDLES-FLOATS</a></span></dt><dd>yes</dd><dt><a id="iss352"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss352.html" target="_top">TYPE-OF-AND-PREDEFINED-CLASSES:UNIFY-AND-EXTEND</a></span></dt><dd>yes</dd><dt><a id="iss353"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss353.html" target="_top">TYPE-OF-UNDERCONSTRAINED:ADD-CONSTRAINTS</a></span></dt><dd>yes</dd><dt><a id="iss354"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss354.html" target="_top">TYPE-SPECIFIER-ABBREVIATION:X3J13-JUN90-GUESS</a></span></dt><dd>yes</dd><dt><a id="iss355"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss355.html" target="_top">UNDEFINED-VARIABLES-AND-FUNCTIONS:COMPROMISE</a></span></dt><dd>yes</dd><dt><a id="iss356"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss356.html" target="_top">UNINITIALIZED-ELEMENTS:CONSEQUENCES-UNDEFINED</a></span></dt><dd>yes, could add error checking
</dd><dt><a id="iss357"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss357.html" target="_top">UNREAD-CHAR-AFTER-PEEK-CHAR:DONT-ALLOW</a></span></dt><dd>yes</dd><dt><a id="iss358"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss358.html" target="_top">UNSOLICITED-MESSAGES:NOT-TO-SYSTEM-USER-STREAMS</a></span></dt><dd>yes</dd><dt><a id="iss359"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss359.html" target="_top">VARIABLE-LIST-ASYMMETRY:SYMMETRIZE</a></span></dt><dd>yes</dd><dt><a id="iss360"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss360.html" target="_top">WITH-ADDED-METHODS:DELETE</a></span></dt><dd>yes</dd><dt><a id="iss361"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss361.html" target="_top">WITH-COMPILATION-UNIT:NEW-MACRO</a></span></dt><dd>yes</dd><dt><a id="iss362"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss362.html" target="_top">WITH-OPEN-FILE-DOES-NOT-EXIST:STREAM-IS-NIL</a></span></dt><dd>yes</dd><dt><a id="iss363"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss363.html" target="_top">WITH-OPEN-FILE-SETQ:EXPLICITLY-VAGUE</a></span></dt><dd>yes</dd><dt><a id="iss364"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss364.html" target="_top">WITH-OPEN-FILE-STREAM-EXTENT:DYNAMIC-EXTENT</a></span></dt><dd>yes</dd><dt><a id="iss365"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss365.html" target="_top">WITH-OUTPUT-TO-STRING-APPEND-STYLE:VECTOR-PUSH-EXTEND</a></span></dt><dd>yes</dd><dt><a id="iss366"></a><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss366.html" target="_top">WITH-STANDARD-IO-SYNTAX-READTABLE:X3J13-MAR-91</a></span></dt><dd>yes</dd></dl></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="ext-standard"></a>Part II. Common Portable Extensions</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#mop-chap">29. Meta-Object Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-intro">29.1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-intro-notation">29.1.1. Notation</a></span></dt><dt><span class="section"><a href="#mop-package">29.1.2. Package</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-overview">29.2. Overview</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-metaobjects">29.2.1. Metaobjects</a></span></dt><dt><span class="section"><a href="#mop-mo-cl-inheritance">29.2.2. Inheritance Structure of Metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-ui-macro">29.2.3. Processing of the User Interface Macros</a></span></dt><dt><span class="section"><a href="#mop-ov-mo-init">29.2.4. Metaobject Initialization Protocol</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-classes">29.3. Classes</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-cl-defclass">29.3.1. Macro <code class="function">DEFCLASS</code></a></span></dt><dt><span class="section"><a href="#mop-cl-Inheritance">29.3.2. Inheritance Structure of class metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-cl-readers">29.3.3. Introspection: Readers for class metaobjects</a></span></dt><dt><span class="section"><a href="#mop-cl-finalization">29.3.4. Class Finalization Protocol</a></span></dt><dt><span class="section"><a href="#mop-cl-init">29.3.5. Class Initialization</a></span></dt><dt><span class="section"><a href="#mop-cl-customize">29.3.6. Customization</a></span></dt><dt><span class="section"><a href="#mop-cl-dep">29.3.7. Updating Dependencies</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-sd">29.4. Slot Definitions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sd-inheritance">29.4.1. Inheritance Structure of slot definition metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-sd-readers">29.4.2. Introspection: Readers for slot definition metaobjects</a></span></dt><dt><span class="section"><a href="#mop-sd-init">29.4.3. Initialization of slot definition metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-gf">29.5. Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-gf-inheritance">29.5.1. Inheritance Structure of generic function metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-gf-readers">29.5.2. Introspection: Readers for generic function metaobjects</a></span></dt><dt><span class="section"><a href="#mop-gf-init">29.5.3. Initialization of Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-gf-customize">29.5.4. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth">29.6. Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-inheritance">29.6.1. Inheritance Structure of method metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers">29.6.2. Introspection: Readers for method metaobjects</a></span></dt><dt><span class="section"><a href="#mop-meth-init">29.6.3. Initialization of Methods</a></span></dt><dt><span class="section"><a href="#mop-meth-customize">29.6.4. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-accessors">29.7. Accessor Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-acc-readers">29.7.1. Introspection</a></span></dt><dt><span class="section"><a href="#mop-acc-customize">29.7.2. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-specializers">29.8. Specializers</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-specializers-inheritance">29.8.1. Inheritance Structure of Specializer Metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-spec-readers">29.8.2. Introspection</a></span></dt><dt><span class="section"><a href="#mop-spec-init">29.8.3. Initialization</a></span></dt><dt><span class="section"><a href="#mop-spec-dep">29.8.4. Updating Dependencies</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-comb">29.9. Method Combinations</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-comb-inheritance">29.9.1. Inheritance Structure of method combination metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-comb-customize">29.9.2. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-slot-access">29.10. Slot Access</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sa-instance-struct">29.10.1. Instance Structure Protocol</a></span></dt><dt><span class="section"><a href="#mop-sa-funcallable">29.10.2. Funcallable Instances</a></span></dt><dt><span class="section"><a href="#mop-sa-customize">29.10.3. Customization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-dep-maint">29.11. Dependent Maintenance</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-dep-maint-protocol">29.11.1. Protocol</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-clisp">29.12. Deviations from AMOP</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-clisp-warn">29.12.1. Warning <code class="classname">CLOS:CLOS-WARNING</code></a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#gray">30. Gray streams</a></span></dt><dd><dl><dt><span class="section"><a href="#gray-overview">30.1. Overview</a></span></dt><dt><span class="section"><a href="#gray-classes">30.2. Defined classes</a></span></dt><dt><span class="section"><a href="#gray-gf-general">30.3. General generic functions</a></span></dt><dt><span class="section"><a href="#gray-gf-char-in">30.4. Generic functions for character input</a></span></dt><dt><span class="section"><a href="#gray-gf-char-out">30.5. Generic functions for character output</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-in">30.6. Generic functions for binary input</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-out">30.7. Generic functions for binary output</a></span></dt><dt><span class="section"><a href="#fill-stream">30.8. Class <code class="classname">EXT:FILL-STREAM</code></a></span></dt></dl></dd></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="mop-chap"></a>Chapter 29. Meta-Object Protocol</h2></div><div><h3 class="subtitle"><em>Adapted from chapters 5 and 6 of [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>]</em></h3></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#mop-intro">29.1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-intro-notation">29.1.1. Notation</a></span></dt><dt><span class="section"><a href="#mop-package">29.1.2. Package</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-overview">29.2. Overview</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-metaobjects">29.2.1. Metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-mo-classes">29.2.1.1. Classes</a></span></dt><dt><span class="section"><a href="#mop-mo-slot-defs">29.2.1.2. Slot Definitions</a></span></dt><dt><span class="section"><a href="#mop-mo-gen-funs">29.2.1.3. Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-mo-methods">29.2.1.4. Methods</a></span></dt><dt><span class="section"><a href="#mop-mo-spec">29.2.1.5. Specializers</a></span></dt><dt><span class="section"><a href="#mop-mo-meth-combs">29.2.1.6. Method Combinations</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-mo-cl-inheritance">29.2.2. Inheritance Structure of Metaobject Classes</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-ov-impl-and-user-spec">29.2.2.1. Implementation and User Specialization</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-ui-macro">29.2.3. Processing of the User Interface Macros</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-compile-ui-macro">29.2.3.1. Compile-file Processing of the User Interface Macros</a></span></dt><dt><span class="section"><a href="#mop-ov-ui-others">29.2.3.2. Compile-file Processing of Specific User Interface Macros</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-ov-mo-init">29.2.4. Metaobject Initialization Protocol</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-classes">29.3. Classes</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-cl-defclass">29.3.1. Macro <code class="function">DEFCLASS</code></a></span></dt><dt><span class="section"><a href="#mop-cl-Inheritance">29.3.2. Inheritance Structure of class metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-cl-readers">29.3.3. Introspection: Readers for class metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#class-name">29.3.3.1. Generic Function <code class="function">CLASS-NAME</code></a></span></dt><dt><span class="section"><a href="#class-direct-superclasses">29.3.3.2. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-direct-slots">29.3.3.3. Generic Function <code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-direct-default-initargs">29.3.3.4. Generic Function <code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#cpl">29.3.3.5. Generic Function <code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#class-direct-subclasses">29.3.3.6. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-slots">29.3.3.7. Generic Function <code class="function">CLOS:CLASS-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-default-initargs">29.3.3.8. Generic Function <code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#class-finalized-p">29.3.3.9. Generic Function <code class="function">CLOS:CLASS-FINALIZED-P</code></a></span></dt><dt><span class="section"><a href="#class-prototype">29.3.3.10. Generic Function <code class="function">CLOS:CLASS-PROTOTYPE</code></a></span></dt><dt><span class="section"><a href="#mop-cl-readers-methods">29.3.3.11. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-finalization">29.3.4. Class Finalization Protocol</a></span></dt><dt><span class="section"><a href="#mop-cl-init">29.3.5. Class Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-cl-init-mo">29.3.5.1. Initialization of class metaobjects</a></span></dt><dt><span class="section"><a href="#mop-cl-reinit-mo">29.3.5.2. Reinitialization of class metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-customize">29.3.6. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#setf-class-name">29.3.6.1. Generic Function <code class="code">(SETF CLASS-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-class">29.3.6.2. Generic Function <code class="function">CLOS:ENSURE-CLASS</code></a></span></dt><dt><span class="section"><a href="#ensure-class-UC">29.3.6.3. Generic Function <code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#finalize-inheritance">29.3.6.4. Generic Function <code class="function">CLOS:FINALIZE-INHERITANCE</code></a></span></dt><dt><span class="section"><a href="#mop-make-instance">29.3.6.5. Generic Function <code class="function">MAKE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#alloc-instance">29.3.6.6. Generic Function <code class="function">ALLOCATE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#validate-superclass">29.3.6.7. Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code></a></span></dt><dt><span class="section"><a href="#compute-dsd-initargs">29.3.6.8. Generic Function <code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#dsd-class">29.3.6.9. Generic Function <code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-cpl">29.3.6.10. Generic Function <code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#compute-slots">29.3.6.11. Generic Function <code class="function">CLOS:COMPUTE-SLOTS</code></a></span></dt><dt><span class="section"><a href="#compute-esd">29.3.6.12. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a></span></dt><dt><span class="section"><a href="#compute-esd-initargs">29.3.6.13. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#esd-class">29.3.6.14. Generic Function <code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-default-initargs">29.3.6.15. Generic Function <code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-dep">29.3.7. Updating Dependencies</a></span></dt><dd><dl><dt><span class="section"><a href="#add-direct-subclass">29.3.7.1. Generic Function <code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a></span></dt><dt><span class="section"><a href="#remove-direct-subclass">29.3.7.2. Generic Function <code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-sd">29.4. Slot Definitions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sd-inheritance">29.4.1. Inheritance Structure of slot definition metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-sd-readers">29.4.2. Introspection: Readers for slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sd-readers-GFs">29.4.2.1. Generic Functions</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-methods">29.4.2.2. Methods</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-dsd">29.4.2.3. Readers for direct slot definition metaobjects</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-esd">29.4.2.4. Readers for effective slot definition metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-sd-init">29.4.3. Initialization of slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-mo-methods">29.4.3.1. Methods</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-gf">29.5. Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-gf-inheritance">29.5.1. Inheritance Structure of generic function metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-gf-readers">29.5.2. Introspection: Readers for generic function metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#gf-name">29.5.2.1. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></span></dt><dt><span class="section"><a href="#gf-methods">29.5.2.2. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a></span></dt><dt><span class="section"><a href="#gf-lambda-list">29.5.2.3. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#gf-argument-precedence-order">29.5.2.4. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></span></dt><dt><span class="section"><a href="#gf-declarations">29.5.2.5. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></span></dt><dt><span class="section"><a href="#gf-method-class">29.5.2.6. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#gf-method-combination">29.5.2.7. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></span></dt><dt><span class="section"><a href="#gf-name-methods">29.5.2.8. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-gf-init">29.5.3. Initialization of Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-gf-init-defgeneric">29.5.3.1. Macro <code class="function">DEFGENERIC</code></a></span></dt><dt><span class="section"><a href="#mop-gf-invocation">29.5.3.2. Generic Function Invocation Protocol</a></span></dt><dt><span class="section"><a href="#mop-gf-init-mo">29.5.3.3. Initialization of generic function metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-gf-customize">29.5.4. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#setf-gf-name">29.5.4.1. Generic Function <code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-gf">29.5.4.2. Generic Function <code class="function">ENSURE-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#ensure-gf-UC">29.5.4.3. Generic Function <code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#mop-add-method">29.5.4.4. Generic Function <code class="function">ADD-METHOD</code></a></span></dt><dt><span class="section"><a href="#mop-remove-method">29.5.4.5. Generic Function <code class="function">REMOVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods">29.5.4.6. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods-UC">29.5.4.7. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method">29.5.4.8. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method-as-function">29.5.4.9. Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#make-method-lambda">29.5.4.10. Generic Function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a></span></dt><dt><span class="section"><a href="#compute-discriminating-function">29.5.4.11. Generic Function <code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-meth">29.6. Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-inheritance">29.6.1. Inheritance Structure of method metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers">29.6.2. Introspection: Readers for method metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#method-specializers">29.6.2.1. Generic Function <code class="function">CLOS:METHOD-SPECIALIZERS</code></a></span></dt><dt><span class="section"><a href="#method-qualifiers">29.6.2.2. Generic Function <code class="function">METHOD-QUALIFIERS</code></a></span></dt><dt><span class="section"><a href="#method-lambda-list">29.6.2.3. Generic Function <code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#method-gf">29.6.2.4. Generic Function <code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#method-function">29.6.2.5. Generic Function <code class="function">CLOS:METHOD-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers-methods">29.6.2.6. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-init">29.6.3. Initialization of Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-defmethod">29.6.3.1. Macro <code class="function">DEFMETHOD</code></a></span></dt><dt><span class="section"><a href="#mop-meth-init-mo">29.6.3.2. Initialization of method metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-customize">29.6.4. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#extract-lambda-list">29.6.4.1. Function <code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#extract-specializer-names">29.6.4.2. Function <code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-accessors">29.7. Accessor Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-acc-readers">29.7.1. Introspection</a></span></dt><dd><dl><dt><span class="section"><a href="#accessor-method-slotdef">29.7.1.1. Generic Function <code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-acc-customize">29.7.2. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#reader-method-class">29.7.2.1. Generic Function <code class="function">CLOS:READER-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#writer-method-class">29.7.2.2. Generic Function <code class="function">CLOS:WRITER-METHOD-CLASS</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-specializers">29.8. Specializers</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-specializers-inheritance">29.8.1. Inheritance Structure of Specializer Metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-spec-readers">29.8.2. Introspection</a></span></dt><dd><dl><dt><span class="section"><a href="#eql-specializer-object">29.8.2.1. Function <code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-spec-init">29.8.3. Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#intern-eql-specializer">29.8.3.1. Function <code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-spec-dep">29.8.4. Updating Dependencies</a></span></dt><dd><dl><dt><span class="section"><a href="#specializer-direct-methods">29.8.4.1. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a></span></dt><dt><span class="section"><a href="#specializer-direct-gfs">29.8.4.2. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a></span></dt><dt><span class="section"><a href="#add-direct-method">29.8.4.3. Generic Function <code class="function">CLOS:ADD-DIRECT-METHOD</code></a></span></dt><dt><span class="section"><a href="#remove-direct-method">29.8.4.4. Generic Function <code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-meth-comb">29.9. Method Combinations</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-comb-inheritance">29.9.1. Inheritance Structure of method combination metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-comb-customize">29.9.2. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#find-method-combination">29.9.2.1. Generic Function <code class="function">CLOS:FIND-METHOD-COMBINATION</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-slot-access">29.10. Slot Access</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sa-instance-struct">29.10.1. Instance Structure Protocol</a></span></dt><dt><span class="section"><a href="#mop-sa-funcallable">29.10.2. Funcallable Instances</a></span></dt><dt><span class="section"><a href="#mop-sa-customize">29.10.3. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#standard-instance-access">29.10.3.1. Function <code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#funcallable-standard-instance-access">29.10.3.2. Function <code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#set-fif">29.10.3.3. Function <code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#slot-value-UC">29.10.3.4. Generic Function <code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#setf-slot-value-UC">29.10.3.5. Generic Function <code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a></span></dt><dt><span class="section"><a href="#slot-boundp-UC">29.10.3.6. Generic Function <code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#slot-makunbound-UC">29.10.3.7. Generic Function <code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-dep-maint">29.11. Dependent Maintenance</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-dep-maint-protocol">29.11.1. Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="#update-dependent">29.11.1.1. Generic Function <code class="function">CLOS:UPDATE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#add-dependent">29.11.1.2. Generic Function <code class="function">CLOS:ADD-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#remove-dependent">29.11.1.3. Generic Function <code class="function">CLOS:REMOVE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#map-dependents">29.11.1.4. Generic Function <code class="function">CLOS:MAP-DEPENDENTS</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-clisp">29.12. Deviations from AMOP</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-clisp-warn">29.12.1. Warning <code class="classname">CLOS:CLOS-WARNING</code></a></span></dt><dd><dl><dt><span class="section"><a href="#mop-clisp-gf-already-called-warning">29.12.1.1. Warning <code class="classname">CLOS:GF-ALREADY-CALLED-WARNING</code></a></span></dt><dt><span class="section"><a href="#mop-clisp-gf-replacing-method-warning">29.12.1.2. Warning <code class="classname">CLOS:GF-REPLACING-METHOD-WARNING</code></a></span></dt><dt><span class="section"><a href="#class-obsolescence-warning">29.12.1.3. Warning <code class="classname">CLOS:CLASS-OBSOLESCENCE-WARNING</code></a></span></dt></dl></dd></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-intro"></a>29.1. Introduction</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-intro-notation">29.1.1. Notation</a></span></dt><dt><span class="section"><a href="#mop-package">29.1.2. Package</a></span></dt></dl></div><p>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> specification ([<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] Chanpter 7) describes the
standard Programmer Interface for the <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> Object System (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>). This
document extends that specification by defining a metaobject protocol
for <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> - that is, a description of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> itself as an extensible
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> program. In this description, the fundamental elements of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
programs (classes, slot definitions, generic functions, methods,
specializers and method combinations) are represented by first-class
objects. The behavior of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> is provided by these objects, or, more
precisely, by methods specialized to the classes of these objects.
</p><p>Because these objects represent pieces of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> programs, and
because their behavior provides the behavior of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> language
itself, they are considered meta-level objects or metaobjects. The
protocol followed by the metaobjects to provide the behavior of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
is called the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> <span class="quote">“<span class="quote">Metaobject Protocol</span>”</span> (MOP).</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-intro-notation"></a>29.1.1. Notation</h3></div></div></div><p>The description of functions follows the same form as used in the
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> specification. The description of generic functions is similar
to that in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> specification, but some minor changes have been
made in the way methods are presented.</p><p>The following is an example of the format for the syntax
description of a generic function:
</p><pre class="programlisting">
(<code class="function">gf1</code> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>y</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>v</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>k</code></em>)
</pre><p>This description indicates that <code class="function">gf1</code> is a
generic function with two required parameters, <em class="replaceable"><code>x</code></em> and <em class="replaceable"><code>y</code></em>, an
optional parameter <em class="replaceable"><code>v</code></em> and a keyword parameter <em class="replaceable"><code>k</code></em>.</p><p>The description of a generic function includes a description of
its behavior. This provides the general behavior, or protocol of the
generic function. All methods defined on the generic function, both
portable and specified, must have behavior consistent with this
description.</p><p>Every generic function described here is an instance of the class
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> and uses the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-6-6-2.html" target="_top"><code class="function">STANDARD</code></a> method
combination.</p><p>The description of a generic function also includes descriptions
of the specified methods for that generic function. In the description
of these methods, a <strong class="first"><em class="firstterm">method signature</em></strong> is used to
describe the parameters and parameter specializers of each method. The
following is an example of the format for a method signature:
</p><pre class="programlisting">
<span class="method"><code class="literal">(<code class="function">gf1</code> (<em class="replaceable"><code>x</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) <em class="replaceable"><code>y</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>v</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>k</code></em>)</code></span>
</pre><p>This signature indicates that this primary method on the generic
function <code class="function">gf1</code> has two required parameters, named
<em class="replaceable"><code>x</code></em> and <em class="replaceable"><code>y</code></em>. In addition, there is an optional parameter <em class="replaceable"><code>v</code></em> and
a keyword parameter <em class="replaceable"><code>k</code></em>. This signature also indicates that the
method's parameter specializers are the classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>.
</p><p>The description of each method includes a description of the
behavior particular to that method.</p><p>An abbreviated syntax is used when referring to a method defined
elsewhere in the document. This abbreviated syntax includes the name of
the generic function, the qualifiers, and the parameter specializers. A
reference to the method with the signature shown above is written as:
<span class="method"><code class="literal"><code class="function">gf1</code> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span>.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-package"></a>29.1.2. Package</h3></div></div></div><p>The package exporting the <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> symbols is unspecified.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The symbols specified by the <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> are
exported from the package <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a> and <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>ed from the package
<a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>.</p></div><p>The package exporting the <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> symbols is different in other
implementations: In <a class="ulink" href="http://sbcl.sourceforge.net/" target="_top"><span class="command"><strong>SBCL</strong></span></a> it is the package
<strong class="package"><span class="quote">“<span class="quote">SB-MOP</span>”</span></strong>;
in <a class="ulink" href="http://openmcl.clozure.com/" target="_top"><span class="command"><strong>OpenMCL</strong></span></a> it is the package
<strong class="package"><span class="quote">“<span class="quote">OPENMCL-MOP</span>”</span></strong>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-overview"></a>29.2. Overview</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-metaobjects">29.2.1. Metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-mo-classes">29.2.1.1. Classes</a></span></dt><dt><span class="section"><a href="#mop-mo-slot-defs">29.2.1.2. Slot Definitions</a></span></dt><dt><span class="section"><a href="#mop-mo-gen-funs">29.2.1.3. Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-mo-methods">29.2.1.4. Methods</a></span></dt><dt><span class="section"><a href="#mop-mo-spec">29.2.1.5. Specializers</a></span></dt><dt><span class="section"><a href="#mop-mo-meth-combs">29.2.1.6. Method Combinations</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-mo-cl-inheritance">29.2.2. Inheritance Structure of Metaobject Classes</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-ov-impl-and-user-spec">29.2.2.1. Implementation and User Specialization</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-portable-restrictions">29.2.2.1.1. Restrictions on Portable Programs</a></span></dt><dt><span class="section"><a href="#mop-impl-restrictions">29.2.2.1.2. Restrictions on Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-ui-macro">29.2.3. Processing of the User Interface Macros</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-compile-ui-macro">29.2.3.1. Compile-file Processing of the User Interface Macros</a></span></dt><dt><span class="section"><a href="#mop-ov-ui-others">29.2.3.2. Compile-file Processing of Specific User Interface Macros</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-ov-mo-init">29.2.4. Metaobject Initialization Protocol</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-metaobjects"></a>29.2.1. Metaobjects</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-mo-classes">29.2.1.1. Classes</a></span></dt><dt><span class="section"><a href="#mop-mo-slot-defs">29.2.1.2. Slot Definitions</a></span></dt><dt><span class="section"><a href="#mop-mo-gen-funs">29.2.1.3. Generic Functions</a></span></dt><dt><span class="section"><a href="#mop-mo-methods">29.2.1.4. Methods</a></span></dt><dt><span class="section"><a href="#mop-mo-spec">29.2.1.5. Specializers</a></span></dt><dt><span class="section"><a href="#mop-mo-meth-combs">29.2.1.6. Method Combinations</a></span></dt></dl></div><p>For each kind of program element there is a corresponding
<strong class="first"><em class="firstterm">basic metaobject class
<a id="mop-ba-mo-cl" class="indexterm"></a></em></strong>.
These are the classes: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>, <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a>.
A <strong class="first"><em class="firstterm">metaobject class<a id="mo-cl" class="indexterm"></a></em></strong>
is a subclass of exactly one of these classes.
The results are undefined if an attempt is made to define a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>
that is a subclass of more than one basic metaobject class.
A <strong class="first"><em class="firstterm">metaobject<a id="mop-mo" class="indexterm"></a></em></strong> is an instance of a metaobject class.</p><p>Each metaobject represents one program element. Associated with
each metaobject is the information required to serve its role. This
includes information that might be provided directly in a user interface
macro such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>. It also includes information
computed indirectly from other metaobjects such as that computed from
class inheritance or the full set of methods associated with a generic
function.</p><p>Much of the information associated with a metaobject is in the
form of connections to other metaobjects. This interconnection means
that the role of a metaobject is always based on that of other
metaobjects. As an introduction to this interconnected structure, this
section presents a partial enumeration of the kinds of information
associated with each kind of metaobject. More detailed information is
presented later.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-classes"></a>29.2.1.1. Classes</h4></div></div></div><p>A <strong class="first"><em class="firstterm">class metaobject
<a id="mop-class-mo" class="indexterm"></a></em></strong>
determines the structure and the default behavior of its instances.
The following information is associated with <a class="link" href="#mop-class-mo">class metaobject</a>s:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The name, if there is one, is available as an object.
</li><li class="listitem">The direct subclasses, direct superclasses and class
precedence list are available as lists of <a class="link" href="#mop-class-mo">class metaobject</a>s.</li><li class="listitem">The slots defined directly in the class are available
as a list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. The slots which are accessible in instances of
the class are available as a list of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</li><li class="listitem">The methods which use the class as a specializer, and
the generic functions associated with those methods are available as
lists of method and <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s respectively.</li><li class="listitem">The documentation is available as a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>See also <a class="xref" href="#mop-classes" title="29.3. Classes">Section 29.3, “Classes”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-slot-defs"></a>29.2.1.2. Slot Definitions</h4></div></div></div><p>A <strong class="first"><em class="firstterm">slot definition metaobject
<a id="mop-slot-def-mo" class="indexterm"></a></em></strong>
contains information about the definition of a slot.
There are two kinds of <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="first"><em class="firstterm">direct<a id="mop-dsd-mo" class="indexterm"></a></em></strong> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a></span></dt><dd>Used to represent the direct definition of a slot in
a class. This corresponds roughly to the slot specifiers found in
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> forms.</dd><dt><span class="term"><strong class="first"><em class="firstterm">effective<a id="mop-esd-mo" class="indexterm"></a></em></strong> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a></span></dt><dd>Used to represent information, including inherited
information, about a slot which is accessible in instances of a
particular class.</dd></dl></div><p>Associated with each <a class="link" href="#mop-class-mo">class metaobject</a> is a list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s representing the
slots defined directly in the class.
Also associated with each <a class="link" href="#mop-class-mo">class metaobject</a> is a list of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s representing the
set of slots accessible in instances of that class.</p><p>The following information is associated with both direct and
effective slot definitions metaobjects:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The name, allocation, and type are available as forms
that could appear in a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</li><li class="listitem">The initialization form, if there is one, is
available as a form that could appear in a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form. The
initialization form together with its <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> is available
as a function of no arguments which, when called, returns the result
of evaluating the initialization form in its <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. This
is called the <strong class="first"><em class="firstterm">initfunction</em></strong> of the slot.
</li><li class="listitem">The slot filling initialization arguments are
available as a list of symbols.</li><li class="listitem">The documentation is available as a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>Certain other information is only associated with <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.
This information applies only to the direct definition of the slot in
the class (it is not inherited).
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The function names of those generic
functions for which there are automatically generated reader and
writer methods. This information is available as lists of function
names. Any accessors specified in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form are broken down
into their equivalent readers and writers in the direct slot
definition.</li></ul></div><p>Information, including inherited information, which applies to the
definition of a slot in a particular class in which it is accessible is
associated only with <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">For certain slots, the location of the
slot in instances of the class is available.
</li></ul></div><p>See also <a class="xref" href="#mop-sd" title="29.4. Slot Definitions">Section 29.4, “Slot Definitions”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-gen-funs"></a>29.2.1.3. Generic Functions</h4></div></div></div><p>A <strong class="first"><em class="firstterm">generic function metaobject
<a id="mop-gen-fun-mo" class="indexterm"></a></em></strong>
contains information about a generic function over and above the
information associated with each of the generic function's methods.
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The name is available as a function name.
</li><li class="listitem">The methods associated with the generic function are
available as a list of <a class="link" href="#mop-method-mo">method metaobject</a>s.</li><li class="listitem">The default class for this generic function's <a class="link" href="#mop-method-mo">method metaobject</a>s
is available as a <a class="link" href="#mop-class-mo">class metaobject</a>.</li><li class="listitem">The <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is available as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.
</li><li class="listitem">The method combination is available as a <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>.
</li><li class="listitem">The argument precedence order is available as a
permutation of those symbols from the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> which name the
required arguments of the generic function.</li><li class="listitem"><p class="simpara">The <span class="quote">“<span class="quote">declarations</span>”</span> are available as a
list of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>s.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>There is a slight misnomer in the naming of functions and
options in this document: Where the term <span class="quote">“<span class="quote">declaration</span>”</span> is
used, actually a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a> is meant.
</p></div></li><li class="listitem">The documentation is available as a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>See also <a class="xref" href="#mop-gf" title="29.5. Generic Functions">Section 29.5, “Generic Functions”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-methods"></a>29.2.1.4. Methods</h4></div></div></div><p>A <strong class="first"><em class="firstterm">method metaobject
<a id="mop-method-mo" class="indexterm"></a></em></strong>
contains information about a specific <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>.
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The qualifiers are available as a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of of non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> atoms.</li><li class="listitem">The <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is available as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.
</li><li class="listitem">The specializers are available as a list of
specializer metaobjects.</li><li class="listitem">The function is available as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>. This
function can be applied to arguments and a list of next methods using
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>.</li><li class="listitem">When the method is associated with a generic
function, that <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> is available. A method can be associated with
at most one generic function at a time.</li><li class="listitem">The documentation is available as a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>See also <a class="xref" href="#mop-meth" title="29.6. Methods">Section 29.6, “Methods”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-spec"></a>29.2.1.5. Specializers</h4></div></div></div><p>A <strong class="first"><em class="firstterm">specializer metaobject
<a id="spec-mo" class="indexterm"></a></em></strong>
represents the specializers of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>.
<a class="link" href="#mop-class-mo">class metaobject</a>s are themselves specializer metaobjects. A special
kind of specializer metaobject is used for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers.</p><p>See also <a class="xref" href="#mop-specializers" title="29.8. Specializers">Section 29.8, “Specializers”</a></p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-mo-meth-combs"></a>29.2.1.6. Method Combinations</h4></div></div></div><p>A <strong class="first"><em class="firstterm">method combination metaobject
<a id="mop-meth-comp-mo" class="indexterm"></a></em></strong>
represents the information about the method combination being used by a
generic function.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This document does not specify the structure of <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>s.
</p></div><p>See also <a class="xref" href="#mop-meth-comb" title="29.9. Method Combinations">Section 29.9, “Method Combinations”</a></p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-mo-cl-inheritance"></a>29.2.2. Inheritance Structure of Metaobject Classes</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-ov-impl-and-user-spec">29.2.2.1. Implementation and User Specialization</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-portable-restrictions">29.2.2.1.1. Restrictions on Portable Programs</a></span></dt><dt><span class="section"><a href="#mop-impl-restrictions">29.2.2.1.2. Restrictions on Implementations</a></span></dt></dl></dd></dl></div><div class="figure"><a id="mop-mo-cl-inheritance-fig"></a><p class="title"><strong>Figure 29.1. Inheritance structure of metaobject classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-all.png" width="100%" alt="Inheritance structure of metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /><p>The inheritance structure of the specified metaobject classes is
shown in <a class="xref" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes">Table 29.1, “Direct Superclass Relationships Among The Specified Metaobject Classes”</a>. The class of every class
shown is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> except for the classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>,
which are instances of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>, and the classes
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>, which are
instances of the class <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>.
</p><div class="table"><a id="mop-inherit-struct"></a><p class="title"><strong>Table 29.1. Direct Superclass Relationships
Among The Specified Metaobject Classes</strong></p><div class="table-contents"><table class="table" summary="Direct Superclass Relationships Among The Specified Metaobject Classes" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th align="center">Metaobject Class</th><th align="center">Abstract</th><th align="center">Subclassable</th><th align="center">Direct Superclasses</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-READER-METHOD</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a>)</td></tr><tr><td align="center"><a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="classname">CLOS:STANDARD-WRITER-METHOD</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EFFECTIVE-SLOT-DEFINITION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EFFECTIVE-SLOT-DEFINITION</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a></td><td align="center">no</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a></td><td align="center">yes</td><td align="center">no</td><td align="center">(<a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a></td><td align="center">no</td><td align="center">no</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</td></tr><tr><td align="center"><a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a></td><td align="center">no</td><td align="center">no</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</td></tr><tr><td align="center"><a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a></td><td align="center">no</td><td align="center">yes</td><td align="center">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</td></tr></tbody></table></div></div><p><br class="table-break" />
</p><p>Each class with a <span class="quote">“<span class="quote">yes</span>”</span> in the <span class="quote">“<span class="quote">Abstract</span>”</span>
column is an <span class="emphasis"><em>abstract class</em></span> and is not intended to
be instantiated. The results are undefined if an attempt is made to
make an instance of one of these classes with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.</p><p>Each class with a <span class="quote">“<span class="quote">yes</span>”</span> in
the <span class="quote">“<span class="quote">Subclassable</span>”</span> column can be used as direct superclass
for portable programs. It is not meaningful to subclass a class that
has a <span class="quote">“<span class="quote">no</span>”</span> in this column.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> is also subclassable: It
is possible to create subclasses of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> that do not inherit
from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span> and some other implementations</h3><p>The class <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>'s class
precedence list contains <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> before <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>, not
after <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>.
This is the most transparent way to realize the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement
(see the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-2-2.html">4.2.2
<span class="quote">“<span class="quote">Type Relationships</span>”</span></a>)
that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>'s class precedence list contains
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> before <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>.</p></div><p>The classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>, <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>, <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>, <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-READER-METHOD</code></a>,
<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="classname">CLOS:STANDARD-WRITER-METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> are called
<strong class="first"><em class="firstterm">standard metaobject
<a id="std-mo" class="indexterm"></a></em></strong> classes.
For each kind of metaobject, this is the class the user interface
macros presented in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> use by default. These are also the
classes on which user specializations are normally based.</p><p>The classes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>, <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> and
<a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> are special-purpose <a class="link" href="#mop-class-mo">class metaobject</a> classes.
Built-in classes are instances of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>.
The class <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> provides a special kind of
instances described in <a class="xref" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances">Section 29.10.2, “Funcallable Instances”</a>.
When the definition of a class references another class which has not
yet been defined, an instance of <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is used as
a stand-in until the class is actually defined.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="forward-referenced-class-clisp"></a>Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></h3><p>The class <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is implemented in a way
that fixes several flaws in the [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] specification.</p><p>It is not a subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> and <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a>, just a
subclass of <a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a>, because forward references to classes are
not classes and cannot be used as specializers of methods. An [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>]
compatibility mode is provided, however, if you set the variable
<strong class="first"><em class="firstterm"><code class="varname">CUSTOM:*FORWARD-REFERENCED-CLASS-MISDESIGN*</code>
<a id="frc-bad" class="indexterm"></a></em></strong> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.
In this mode, <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is formally a subclass of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> and <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a>, but the behaviour of
<a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> instances is the same.</p><p>The [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] says that the first argument of <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> can
be a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>.
But from the description of <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>, it is clear that it can
only be a class returned by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>, and [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>
cannot return a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>.</p><p>The [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] says that <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> creates a
<a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> for not-yet-defined class symbols among the
direct-superclasses list. But this leads to many
<a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> with the same name (since they cannot be
stored and retrieved through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>), and since <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a>
preserves the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>-ness, after the class is defined, we have many
class objects with the same name.</p><p>In the direct-superclasses list of non-finalized classes,
<a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> instances can occur, denoting classes that
have not yet been defined. When or after such a class gets defined,
the <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> instance is replaced with the real
class. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses simple object replacement, not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a>, in
this process.</p></div><p>The class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a> is the <span class="emphasis"><em>default direct
superclass</em></span> of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>. When an instance
of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> is created, and no direct superclasses are
explicitly specified, it defaults to the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>. In
this way, any behavior associated with the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>
will be inherited, directly or indirectly, by all instances of the class
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>. A subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> may have a different
class as its default direct superclass, but that class must be a
subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>.</p><p>The same is true for <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> and
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>.</p><p>The class <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> captures only the most basic behavior of
method specializers, and is not itself intended to be instantiated. The
class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> is a direct subclass of <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> reflecting the
property that classes by themselves can be used as method specializers.
The class <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a> is used for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-ov-impl-and-user-spec"></a>29.2.2.1. Implementation and User Specialization</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-portable-restrictions">29.2.2.1.1. Restrictions on Portable Programs</a></span></dt><dt><span class="section"><a href="#mop-impl-restrictions">29.2.2.1.2. Restrictions on Implementations</a></span></dt></dl></div><p>The purpose of the Metaobject Protocol is to provide users with a
powerful mechanism for extending and customizing the basic behavior of
the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>. As an object-oriented description of the basic <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
behavior, the Metaobject Protocol makes it possible to create these
extensions by defining specialized subclasses of existing metaobject
classes.</p><p>The Metaobject Protocol provides this capability without
interfering with the implementor's ability to develop high-performance
implementations. This balance between user extensibility and
implementor freedom is mediated by placing explicit restrictions on
each. Some of these restrictions are general---they apply to the entire
class graph and the applicability of all methods. These are presented
in this section.</p><p>The following additional terminology is used to present these
restrictions:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Metaobjects are divided into three categories. Those
defined in this document are called <strong class="first"><em class="firstterm">specified
<a id="mo-specified" class="indexterm"></a></em></strong>;
those defined by an implementation but not mentioned in this document
are called <strong class="first"><em class="firstterm">implementation-specific
<a id="mo-impl" class="indexterm"></a></em></strong>;
and those defined by a portable program are called <strong class="first"><em class="firstterm">portable
<a id="mo-portable" class="indexterm"></a></em></strong>.
</li><li class="listitem">A class <em class="replaceable"><code>i</code></em> is <strong class="first"><em class="firstterm">interposed
<a id="class-interposed" class="indexterm"></a>
</em></strong> between two other classes <em class="replaceable"><code>k<sub>1</sub></code></em> and <em class="replaceable"><code>k<sub>2</sub></code></em> if and only
if there is some path, following direct superclasses, from the class
<em class="replaceable"><code>k<sub>1</sub></code></em> to the class <em class="replaceable"><code>k<sub>2</sub></code></em> which includes <em class="replaceable"><code>i</code></em>.</li><li class="listitem">A method is <strong class="first"><em class="firstterm">specialized
<a id="method-specialized" class="indexterm"></a></em></strong>
to a class if and only if that class is in the list of specializers
associated with the method; and the method is in the list of methods
associated with some generic function.</li><li class="listitem">In a given implementation, a specified method is said
to have been <strong class="first"><em class="firstterm">promoted
<a id="method-promoted" class="indexterm"></a></em></strong>
if and only if the specializers of the method, <em class="replaceable"><code>x<sub>1</sub></code></em> ... <em class="replaceable"><code>x<sub>n</sub></code></em>, are
defined in this specification as the classes <em class="replaceable"><code>k<sub>1</sub></code></em> ... <em class="replaceable"><code>k<sub>n</sub></code></em>, but in
the implementation, one or more of the specializers
<em class="replaceable"><code>x<sub>l</sub></code></em>, is a superclass of the class
given in the specification <em class="replaceable"><code>k<sub>l</sub></code></em>.
</li><li class="listitem"><p>For a given generic function and set of arguments, a
method <em class="replaceable"><code>k<sub>2</sub></code></em> <strong class="first"><em class="firstterm">extends
<a id="method-extends" class="indexterm"></a></em></strong>
a method <em class="replaceable"><code>k<sub>1</sub></code></em> if and only if:
</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem"><em class="replaceable"><code>k<sub>1</sub></code></em> and
<em class="replaceable"><code>k<sub>2</sub></code></em> are both associated with the given generic function
</li><li class="listitem"><em class="replaceable"><code>k<sub>1</sub></code></em> and <em class="replaceable"><code>k<sub>2</sub></code></em> are both applicable to the given
arguments,</li><li class="listitem">the specializers and qualifiers of the methods are
such that when the generic function is called, <em class="replaceable"><code>k<sub>2</sub></code></em> is executed
before <em class="replaceable"><code>k<sub>1</sub></code></em>,</li><li class="listitem"><em class="replaceable"><code>k<sub>1</sub></code></em> will be executed if and only if
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is invoked from within the body of <em class="replaceable"><code>k<sub>2</sub></code></em> and
</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is invoked from within the body
of <em class="replaceable"><code>k<sub>2</sub></code></em>, thereby causing <em class="replaceable"><code>k<sub>1</sub></code></em> to be executed.
</li></ol></div></li><li class="listitem"><p>For a given generic function and set of arguments, a
method <em class="replaceable"><code>k<sub>2</sub></code></em> <strong class="first"><em class="firstterm">overrides
<a id="method-overrides" class="indexterm"></a></em></strong>
a method <em class="replaceable"><code>k<sub>1</sub></code></em> if and only if conditions <span class="emphasis"><em>i</em></span>
through <span class="emphasis"><em>iv</em></span> above hold and,
instead of <span class="emphasis"><em>v</em></span>,
</p><div class="orderedlist"><ol class="orderedlist" start="6" type="i"><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is not invoked from within the
body of <em class="replaceable"><code>k<sub>2</sub></code></em>, thereby preventing <em class="replaceable"><code>k<sub>1</sub></code></em> from being executed.
</li></ol></div></li></ul></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-portable-restrictions"></a>29.2.2.1.1. Restrictions on Portable Programs</h5></div></div></div><p>Portable programs are allowed to define subclasses of specified
classes, and are permitted to define methods on specified generic
functions, with the following restrictions: </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not redefine any specified
classes, generic functions, methods or method combinations. Any method
defined by a portable program on a specified generic function must have
at least one specializer that is neither a specified class nor an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer whose associated value is an instance of a specified
class.</li><li class="listitem">Portable programs may define methods that extend
specified methods unless the description of the specified method
explicitly prohibits this. Unless there is a specific statement to the
contrary, these extending methods must return whatever value was
returned by the call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a>.</li><li class="listitem"><p class="simpara">Portable programs may define methods that override
specified methods only when the description of the specified method
explicitly allows this. Typically, when a method is allowed to be
overridden, a small number of related methods will need to be overridden
as well.</p><p class="simpara">An example of this is the specified methods on the generic
functions <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>, <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> and <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>.
Overriding a specified method on one of these generic functions requires
that the corresponding method on the other two generic functions be
overridden as well.</p></li><li class="listitem"><p class="simpara">Portable methods on specified generic functions
specialized to portable metaobject classes must be defined before any
instances of those classes (or any subclasses) are created, either
directly or indirectly by a call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. Methods can be
defined after instances are created by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a> however.
Portable metaobject classes cannot be redefined.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The purpose of this last restriction is to permit
implementations to provide performance optimizations by analyzing, at
the time the first instance of a metaobject class is initialized, what
portable methods will be applicable to it. This can make it possible to
optimize calls to those specified generic functions which would have no
applicable portable methods.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="mop-mo-redef-clisp-warn"></a>Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>When a metaobject class is redefined,
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> issues a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> that the redefinition has no effect.
To avoid this warning, place all metaobject class definitions in a
separate file, compile it in a <span class="emphasis"><em>separate</em></span> session
(because <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is evaluated at <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a> too;
see <a class="xref" href="#mop-ov-ui-others" title="29.2.3.2. Compile-file Processing of Specific User Interface Macros">Section 29.2.3.2, “Compile-file Processing of Specific User Interface Macros”</a>),
and then <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> it only <span class="emphasis"><em>once</em></span> per session.
</p></div></li></ul></div><p>
</p><p>The results are undefined if any of
these restrictions are violated.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The specification technology used in this document needs
further development. The concepts of object-oriented protocols and
subclass specialization are intuitively familiar to programmers of
object-oriented systems; the protocols presented here fit quite
naturally into this framework. Nonetheless, in preparing this document,
we have found it difficult to give specification-quality descriptions of
the protocols in a way that makes it clear what extensions users can and
cannot write. Object-oriented protocol specification is inherently
about specifying leeway, and this seems difficult using current
technology.</p></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-impl-restrictions"></a>29.2.2.1.2. Restrictions on Implementations</h5></div></div></div><p>Implementations are allowed latitude to modify the structure of
specified classes and methods. This includes: the interposition of
implementation-specific classes; the promotion of specified methods; and
the consolidation of two or more specified methods into a single method
specialized to interposed classes.</p><p>Any such modifications are permitted only so long as for any
portable class <em class="replaceable"><code>k</code></em> that is a subclass of one or more specified classes
<em class="replaceable"><code>k<sub>1</sub></code></em> ... <em class="replaceable"><code>k<sub>n</sub></code></em>, the following conditions are met:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">In the actual class precedence list of <em class="replaceable"><code>k</code></em>, the
classes <em class="replaceable"><code>k<sub>1</sub></code></em> ... <em class="replaceable"><code>k<sub>n</sub></code></em> must appear in the same order as they would
have if no implementation-specific modifications had been made.
</li><li class="listitem">The method applicability of any specified generic
function must be the same in terms of behavior as it would have been
had no implementation-specific changes been made. This includes
specified generic functions that have had portable methods added. In
this context, the expression <span class="quote">“<span class="quote">the same in terms of
behavior</span>”</span> means that methods with the same behavior as those
specified are applicable, and in the same order.</li><li class="listitem">No portable class <em class="replaceable"><code>k</code></em> may inherit, by virtue of
being a direct or indirect subclass of a specified class, any slot for
which the name is a symbol accessible in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package or
exported by any package defined in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</li><li class="listitem">Implementations are free to define
implementation-specific before- and after-methods on specified generic
functions. Implementations are also free to define
implementation-specific around-methods with extending behavior.
</li></ul></div></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-ui-macro"></a>29.2.3. Processing of the User Interface Macros</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-compile-ui-macro">29.2.3.1. Compile-file Processing of the User Interface Macros</a></span></dt><dt><span class="section"><a href="#mop-ov-ui-others">29.2.3.2. Compile-file Processing of Specific User Interface Macros</a></span></dt></dl></div><p>A list in which the first element is one of the symbols
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss181.html" target="_top"><code class="function">CLOS:GENERIC-FUNCTION</code></a>, <a class="link" href="#gen-flet"><code class="function">CLOS:GENERIC-FLET</code></a> or <a class="link" href="#gen-labels"><code class="function">CLOS:GENERIC-LABELS</code></a>, and which has proper
syntax for that macro is called a <strong class="first"><em class="firstterm">user interface macro
form</em></strong>. This document provides an extended specification of
the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> macros.</p><p>The user interface macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
can be used not only to define metaobjects that are instances of the
corresponding standard metaobject class, but also to define metaobjects
that are instances of appropriate portable metaobject classes. To make
it possible for portable metaobject classes to properly process the
information appearing in the macro form, this document provides a
limited specification of the processing of these macro forms.</p><p>User interface macro forms can be <span class="emphasis"><em>evaluated</em></span>
or <span class="emphasis"><em>compiled</em></span> and later <span class="emphasis"><em>executed</em></span>.
The effect of evaluating or executing a user interface macro form is
specified in terms of calls to specified functions and generic functions
which provide the actual behavior of the macro. The arguments received
by these functions and generic functions are derived in a specified way
from the macro form.</p><p>Converting a user interface macro form into the arguments to the
appropriate functions and generic functions has two major aspects: the
conversion of the macro argument syntax into a form more suitable for
later processing, and the processing of macro arguments which are forms
to be evaluated (including method bodies).</p><p>In the syntax of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro, the <em class="replaceable"><code>initform</code></em>
and <em class="replaceable"><code>default-initarg-initial-value-form</code></em>
arguments are forms which will be evaluated one or more times after the
macro form is evaluated or executed. Special processing must be done on
these arguments to ensure that the lexical scope of the forms is
captured properly. This is done by building a function of zero
arguments which, when called, returns the result of evaluating the form
in the proper <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.</p><p>In the syntax of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macro
the <em class="replaceable"><code>forms</code></em> argument is a list of forms that
comprise the body of the method definition. This list of forms must be
processed specially to capture the lexical scope of the macro form. In
addition, the lexical functions available only in the body of methods
must be introduced. To allow this and any other special processing
(such as slot access optimization), a specializable protocol is used for
processing the body of methods.
This is discussed in <a class="xref" href="#mop-meth-init-defmethod-body" title="29.6.3.1.1. Processing Method Bodies">Section 29.6.3.1.1, “Processing Method Bodies”</a>.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-compile-ui-macro"></a>29.2.3.1. Compile-file Processing of the User Interface Macros</h4></div></div></div><p>It is a common practice for <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> compilers, while processing a file
or set of files, to maintain information about the definitions that have
been compiled so far. Among other things, this makes it possible to
ensure that a global macro definition (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a> form) which appears in
a file will affect uses of the macro later in that file.
This information about the state of the compilation is called the
<strong class="first"><em class="firstterm"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> environment</em></strong>.</p><p>When compiling files containing <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> definitions, it is useful
to maintain certain additional information in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> environment.
This can make it possible to issue various kinds of warnings (e.g.,
<a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> congruence) and to do various performance optimizations that
would not otherwise be possible.</p><p>At this time, there is such significant variance in the way
existing <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations handle <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> environments that it
would be premature to specify this mechanism. Consequently, this
document specifies only the behavior of evaluating or executing user
interface macro forms. What functions and generic functions are called
during <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> processing of a user interface macro form is not
specified. Implementations are free to define and document their own
behavior. Users may need to check implementation-specific behavior
before attempting to compile certain portable programs.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-ov-ui-others"></a>29.2.3.2. Compile-file Processing of Specific User Interface Macros</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a></span></dt><dd><p class="simpara"><a class="xref" href="#mop-cl-defclass" title="29.3.1. Macro DEFCLASS">Section 29.3.1, “Macro <code class="function">DEFCLASS</code>”</a></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> evaluates <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> forms also at
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a>.</p></div></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a></span></dt><dd><p class="simpara"><a class="xref" href="#mop-meth-init-defmethod" title="29.6.3.1. Macro DEFMETHOD">Section 29.6.3.1, “Macro <code class="function">DEFMETHOD</code>”</a></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does <span class="strong"><strong>not</strong></span> evaluate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
forms at <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a> except as necessary for signature checking.
</p></div></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a></span></dt><dd><p class="simpara"><a class="xref" href="#mop-gf-init-defgeneric" title="29.5.3.1. Macro DEFGENERIC">Section 29.5.3.1, “Macro <code class="function">DEFGENERIC</code>”</a></p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does <span class="strong"><strong>not</strong></span> evaluate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>
forms at <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a> except as necessary for signature checking.
</p></div></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-ov-mo-init"></a>29.2.4. Metaobject Initialization Protocol</h3></div></div></div><p>Like other objects, metaobjects can be created by calling
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The initialization arguments passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
are used to initialize the metaobject in the usual way. The set of
legal initialization arguments, and their interpretation, depends on the
kind of metaobject being created. Implementations and portable programs
are free to extend the set of legal initialization arguments. Detailed
information about the initialization of each kind of metaobject are
provided in the appropriate sections:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="#mop-cl-init-mo" title="29.3.5.1. Initialization of class metaobjects">Section 29.3.5.1, “Initialization of class metaobjects”</a></li><li class="listitem"><a class="xref" href="#mop-cl-reinit-mo" title="29.3.5.2. Reinitialization of class metaobjects">Section 29.3.5.2, “Reinitialization of class metaobjects”</a></li><li class="listitem"><a class="xref" href="#mop-gf-init-mo" title="29.5.3.3. Initialization of generic function metaobjects">Section 29.5.3.3, “Initialization of generic function metaobjects”</a></li><li class="listitem"><a class="xref" href="#mop-cl-finalization" title="29.3.4. Class Finalization Protocol">Section 29.3.4, “Class Finalization Protocol”</a></li><li class="listitem"><a class="xref" href="#mop-sa-instance-struct" title="29.10.1. Instance Structure Protocol">Section 29.10.1, “Instance Structure Protocol”</a></li><li class="listitem"><a class="xref" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances">Section 29.10.2, “Funcallable Instances”</a></li><li class="listitem"><a class="xref" href="#mop-gf-invocation" title="29.5.3.2. Generic Function Invocation Protocol">Section 29.5.3.2, “Generic Function Invocation Protocol”</a></li><li class="listitem"><a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a></li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-classes"></a>29.3. Classes</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-cl-defclass">29.3.1. Macro <code class="function">DEFCLASS</code></a></span></dt><dt><span class="section"><a href="#mop-cl-Inheritance">29.3.2. Inheritance Structure of class metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-cl-readers">29.3.3. Introspection: Readers for class metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#class-name">29.3.3.1. Generic Function <code class="function">CLASS-NAME</code></a></span></dt><dt><span class="section"><a href="#class-direct-superclasses">29.3.3.2. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-direct-slots">29.3.3.3. Generic Function <code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-direct-default-initargs">29.3.3.4. Generic Function <code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#cpl">29.3.3.5. Generic Function <code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#class-direct-subclasses">29.3.3.6. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-slots">29.3.3.7. Generic Function <code class="function">CLOS:CLASS-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-default-initargs">29.3.3.8. Generic Function <code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#class-finalized-p">29.3.3.9. Generic Function <code class="function">CLOS:CLASS-FINALIZED-P</code></a></span></dt><dt><span class="section"><a href="#class-prototype">29.3.3.10. Generic Function <code class="function">CLOS:CLASS-PROTOTYPE</code></a></span></dt><dt><span class="section"><a href="#mop-cl-readers-methods">29.3.3.11. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-finalization">29.3.4. Class Finalization Protocol</a></span></dt><dt><span class="section"><a href="#mop-cl-init">29.3.5. Class Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-cl-init-mo">29.3.5.1. Initialization of class metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#class-mo-init-methods">29.3.5.1.1. Methods</a></span></dt><dt><span class="section"><a href="#mop-cl-init-anon">29.3.5.1.2. Initialization of Anonymous Classes</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-reinit-mo">29.3.5.2. Reinitialization of class metaobjects</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-customize">29.3.6. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#setf-class-name">29.3.6.1. Generic Function <code class="code">(SETF CLASS-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-class">29.3.6.2. Generic Function <code class="function">CLOS:ENSURE-CLASS</code></a></span></dt><dt><span class="section"><a href="#ensure-class-UC">29.3.6.3. Generic Function <code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#finalize-inheritance">29.3.6.4. Generic Function <code class="function">CLOS:FINALIZE-INHERITANCE</code></a></span></dt><dt><span class="section"><a href="#mop-make-instance">29.3.6.5. Generic Function <code class="function">MAKE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#alloc-instance">29.3.6.6. Generic Function <code class="function">ALLOCATE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#validate-superclass">29.3.6.7. Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code></a></span></dt><dt><span class="section"><a href="#compute-dsd-initargs">29.3.6.8. Generic Function <code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#dsd-class">29.3.6.9. Generic Function <code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-cpl">29.3.6.10. Generic Function <code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#compute-slots">29.3.6.11. Generic Function <code class="function">CLOS:COMPUTE-SLOTS</code></a></span></dt><dt><span class="section"><a href="#compute-esd">29.3.6.12. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a></span></dt><dt><span class="section"><a href="#compute-esd-initargs">29.3.6.13. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#esd-class">29.3.6.14. Generic Function <code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-default-initargs">29.3.6.15. Generic Function <code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-dep">29.3.7. Updating Dependencies</a></span></dt><dd><dl><dt><span class="section"><a href="#add-direct-subclass">29.3.7.1. Generic Function <code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a></span></dt><dt><span class="section"><a href="#remove-direct-subclass">29.3.7.2. Generic Function <code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-defclass"></a>29.3.1. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a></h3></div></div></div><p>The evaluation or execution of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form results in a call
to the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> function. The arguments received by <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>
are derived from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form in a defined way. The exact
macro-expansion of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form is not defined, only the
relationship between the arguments to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro and the
arguments received by the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> function. Examples of typical
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> forms and sample expansions are shown in the following two
examples:
</p><div class="informalexample"><a id="mop-cl-defclass-ex-1"></a><p>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form with
standard slot and class options and an expansion of it that would
result in the proper call to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><pre class="programlisting">
(defclass plane (moving-object graphics-object)
((altitude :initform 0 :accessor plane-altitude)
(speed))
(:default-initargs :engine *jet*))
(ensure-class 'plane
':direct-superclasses '(moving-object graphics-object)
':direct-slots (list (list ':name 'altitude
':initform '0
':initfunction #'(lambda () 0)
':readers '(plane-altitude)
':writers '((setf plane-altitude)))
(list ':name 'speed))
':direct-default-initargs (list (list ':engine
'*jet*
#'(lambda () *jet*))))
</pre></div><p>
</p><div class="informalexample"><a id="mop-cl-defclass-ex-2"></a><p>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form
with non-standard class and slot options, and an expansion of it which
results in the proper call to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>. Note that the order of
the slot options has not affected the order of the properties in the
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>, but has affected the order of the elements
in the lists which are the values of those properties.</p><pre class="programlisting">
(defclass sst (plane)
((mach mag-step 2
locator sst-mach
locator mach-location
:reader mach-speed
:reader mach))
(:metaclass faster-class)
(another-option foo bar))
(ensure-class 'sst
':direct-superclasses '(plane)
':direct-slots (list (list ':name 'mach
':readers '(mach-speed mach)
'mag-step '2
'locator '(sst-mach mach-location)))
':metaclass 'faster-class
'another-option '(foo bar))
</pre></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>name</code></em> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>
becomes the value of the first argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>. This is
the only positional argument accepted by <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>; all other
arguments are keyword arguments.</li><li class="listitem">The <code class="constant">:DIRECT-SUPERCLASSES</code> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>
becomes the value of the <code class="constant">:DIRECT-SUPERCLASSES</code> keyword argument to
<a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</li><li class="listitem"><p class="simpara">The <code class="constant">:DIRECT-SLOTS</code> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> becomes
the value of the <code class="constant">:DIRECT-SLOTS</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.
Special processing of this value is done to regularize the form of
each slot specification and to properly capture the lexical scope of
the initialization forms. This is done by converting each slot
specification to a property list called a
<strong class="first"><em class="firstterm">canonicalized slot specification</em></strong>.
The resulting list of <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s is the value
of the <code class="constant">:DIRECT-SLOTS</code> keyword argument.</p><p><a id="mop-canonicalized-slot-spec"></a>Canonicalized slot
specifications are later used as the keyword arguments to a generic
function which will, in turn, pass them to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> for use as
a set of initialization arguments. Each <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> is
formed from the corresponding slot specification as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">The name of the slot is the value of the <code class="constant">:NAME</code>
property. This property appears in every
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.</li><li class="listitem">When the <code class="constant">:INITFORM</code> slot option is present in
the slot specification, then both the <code class="constant">:INITFORM</code> and
<code class="constant">:INITFUNCTION</code> properties are present in the <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.
The value of the <code class="constant">:INITFORM</code> property is the
initialization form. The value of the <code class="constant">:INITFUNCTION</code> property is
a function of zero arguments which, when called, returns the result
of evaluating the initialization form in its proper <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.
</li><li class="listitem">If the <code class="constant">:INITFORM</code> slot option is not present in
the slot specification, then either the <code class="constant">:INITFUNCTION</code> property
will not appear, or its value will be false. In such cases, the
value of the <code class="constant">:INITFORM</code> property, or whether it appears, is
unspecified.</li><li class="listitem">The value of the <code class="constant">:INITARGS</code> property is a list
of the values of each <code class="constant">:INITARG</code> slot option. If there are no
<code class="constant">:INITARG</code> slot options, then either the <code class="constant">:INITARGS</code> property
will not appear or its value will be the empty list.
</li><li class="listitem">The value of the <code class="constant">:READERS</code> property is a list of
the values of each <code class="constant">:READER</code> and <code class="constant">:ACCESSOR</code> slot option. If
there are no <code class="constant">:READER</code> or <code class="constant">:ACCESSOR</code> slot options, then either
the <code class="constant">:READERS</code> property will not appear or its value will be the
empty list.</li><li class="listitem">The value of the <code class="constant">:WRITERS</code> property is a list of
the values specified by each <code class="constant">:WRITER</code> and <code class="constant">:ACCESSOR</code> slot
option. The value specified by a <code class="constant">:WRITER</code> slot option is just
the value of the slot option. The value specified by an
<code class="constant">:ACCESSOR</code> slot option is a two element list: the first element
is the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>, the second element is the value of the slot
option. If there are no <code class="constant">:WRITER</code> or <code class="constant">:ACCESSOR</code> slot options,
then either the <code class="constant">:WRITERS</code> property will not appear or its value
will be the empty list.</li><li class="listitem">The value of the <code class="constant">:DOCUMENTATION</code> property is the
value of the <code class="constant">:DOCUMENTATION</code> slot option. If there is no
<code class="constant">:DOCUMENTATION</code> slot option, then either the <code class="constant">:DOCUMENTATION</code>
property will not appear or its value will be false.
</li><li class="listitem">All other slot options appear as the values of
properties with the same name as the slot option. Note that this
includes not only the remaining standard slot options
(<code class="constant">:ALLOCATION</code> and <code class="constant">:TYPE</code>), but also any other options and
values appearing in the slot specification. If one of these slot
options appears more than once, the value of the property will be a
list of the specified values.</li><li class="listitem">An implementation is free to add additional
properties to the <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> provided these
are not symbols accessible in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package, or exported by
any package defined in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</li></ul></div></li><li class="listitem"><p class="simpara">The <code class="constant">:DEFAULT-INITARGS</code> class
option, if it is present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form, becomes the value of
the <code class="constant">:DIRECT-DEFAULT-INITARGS</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.
Special processing of this value is done to properly capture the
lexical scope of the default value forms. This is done by converting
each default initarg in the class option into a
<strong class="first"><em class="firstterm">canonicalized default initialization argument</em></strong>.
The resulting list of <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>s is the value of
the <code class="constant">:DIRECT-DEFAULT-INITARGS</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.
</p><p class="simpara"><a id="mop-canonicalized-default-initarg"></a>A canonicalized default
initarg is a list of three elements. The first element is the name;
the second is the actual form itself; and the third is a function of
zero arguments which, when called, returns the result of evaluating
the default value form in its proper <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If a <code class="constant">:DEFAULT-INITARGS</code>
class option is not present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form,
<code class="constant">:DIRECT-DEFAULT-INITARGS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is passed to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><p>This is needed to
fulfill the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement (see <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>) that
the resulting <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> object reflects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div></li><li class="listitem"><p class="simpara">The <code class="constant">:METACLASS</code> class
option, if it is present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form, becomes the value of
the <code class="constant">:METACLASS</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If a <code class="constant">:METACLASS</code>
class option is not present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form,
<code class="constant">:METACLASS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> is passed to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><p>This is needed to
fulfill the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement (see <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>) that
the resulting <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> object reflects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div></li><li class="listitem"><p class="simpara">The <code class="constant">:DOCUMENTATION</code> class
option, if it is present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form, becomes the value of
the <code class="constant">:DOCUMENTATION</code> keyword argument to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If a <code class="constant">:DOCUMENTATION</code>
class option is not present in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form,
<code class="constant">:DIRECT-DEFAULT-INITARGS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is passed to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><p>This is needed to
fulfill the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement (see <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>) that
the resulting <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> object reflects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div></li><li class="listitem"><p class="simpara">Any other class options become the value of keyword
arguments with the same name. The value of the keyword argument is
the tail of the class option. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if any class
option appears more than once in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The default initargs of the
<code class="constant">:METACLASS</code> are added at the end of the list
of arguments to pass to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.</p><p>This is needed to
fulfill the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] requirement (see <a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>) that
the resulting <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> object reflects the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div></li></ul></div><p>In the call to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>, every element of its arguments
appears in the same left-to-right order as the corresponding element of
the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form, except that the order of the properties of
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s is unspecified. The values of
properties in <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s do follow this ordering
requirement. Other ordering relationships in the keyword arguments to
<a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> are unspecified.</p><p>The result of the call to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> is returned as the result
of evaluating or executing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> form.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-Inheritance"></a>29.3.2. Inheritance Structure of <a class="link" href="#mop-class-mo">class metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-cl-Inheritance-fig"></a><p class="title"><strong>Figure 29.2. Inheritance structure of <a class="link" href="#mop-class-mo">class metaobject</a> classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-class.png" width="100%" alt="Inheritance structure of class metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-readers"></a>29.3.3. Introspection: Readers for <a class="link" href="#mop-class-mo">class metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#class-name">29.3.3.1. Generic Function <code class="function">CLASS-NAME</code></a></span></dt><dt><span class="section"><a href="#class-direct-superclasses">29.3.3.2. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-direct-slots">29.3.3.3. Generic Function <code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-direct-default-initargs">29.3.3.4. Generic Function <code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#cpl">29.3.3.5. Generic Function <code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#class-direct-subclasses">29.3.3.6. Generic Function <code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></span></dt><dt><span class="section"><a href="#class-slots">29.3.3.7. Generic Function <code class="function">CLOS:CLASS-SLOTS</code></a></span></dt><dt><span class="section"><a href="#class-default-initargs">29.3.3.8. Generic Function <code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></span></dt><dt><span class="section"><a href="#class-finalized-p">29.3.3.9. Generic Function <code class="function">CLOS:CLASS-FINALIZED-P</code></a></span></dt><dt><span class="section"><a href="#class-prototype">29.3.3.10. Generic Function <code class="function">CLOS:CLASS-PROTOTYPE</code></a></span></dt><dt><span class="section"><a href="#mop-cl-readers-methods">29.3.3.11. Methods</a></span></dt></dl></div><p>In this and the following sections, the <span class="quote">“<span class="quote">reader</span>”</span>
generic functions which simply return information associated with a
particular kind of metaobject are presented together. General
information is presented first, followed by a description of the purpose
of each, and ending with the specified methods for these generic
functions.</p><p>The reader generic functions which simply return information
associated with <a class="link" href="#mop-class-mo">class metaobject</a>s are presented together in this section.</p><p>Each of the reader generic functions for <a class="link" href="#mop-class-mo">class metaobject</a>s has the same
syntax, accepting one required argument called <em class="replaceable"><code>class</code></em>, which must be
a <a class="link" href="#mop-class-mo">class metaobject</a>; otherwise, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if
the <a class="link" href="#mop-class-mo">class metaobject</a> has not been initialized.</p><p>These
generic functions can be called by the user or the implementation.</p><p>For any of these generic functions which returns a list, such lists
will not be mutated by the implementation. The results are undefined if a
portable program allows such a list to be mutated.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-name"></a>29.3.3.1. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns the name of <em class="replaceable"><code>class</code></em>. This value can be any Lisp object,
but is usually a symbol, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the class has no name. This is the
defaulted value of the <code class="constant">:NAME</code> initialization argument that was
associated with the class during initialization or reinitialization.
(Also see <a class="link" href="#setf-class-name" title="29.3.6.1. Generic Function (SETF CLASS-NAME)"><code class="code">(SETF CLASS-NAME)</code></a>.)
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-direct-superclasses"></a>29.3.3.2. Generic Function <a class="link" href="#class-direct-superclasses" title="29.3.3.2. Generic Function CLOS:CLASS-DIRECT-SUPERCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-direct-superclasses" title="29.3.3.2. Generic Function CLOS:CLASS-DIRECT-SUPERCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a list of the direct superclasses of <em class="replaceable"><code>class</code></em>. The
elements of this list are <a class="link" href="#mop-class-mo">class metaobject</a>s. The empty list is returned if
<em class="replaceable"><code>class</code></em> has no direct superclasses. This is the defaulted value of
the <code class="constant">:DIRECT-SUPERCLASSES</code> initialization argument that was associated
with the class during initialization or reinitialization.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>For a class that has not yet been finalized,
the returned list may contain <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> instances as
placeholder for classes that were not yet defined when finalization of
the class was last attempted.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-direct-slots"></a>29.3.3.3. Generic Function <a class="link" href="#class-direct-slots" title="29.3.3.3. Generic Function CLOS:CLASS-DIRECT-SLOTS"><code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-direct-slots" title="29.3.3.3. Generic Function CLOS:CLASS-DIRECT-SLOTS"><code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a set of the direct slots of <em class="replaceable"><code>class</code></em>. The elements of
this set are <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. If the class has no direct slots, the empty set
is returned. This is the defaulted value of the <code class="constant">:DIRECT-SLOTS</code>
initialization argument that was associated with the class during
initialization and reinitialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-direct-default-initargs"></a>29.3.3.4. Generic Function <a class="link" href="#class-direct-default-initargs" title="29.3.3.4. Generic Function CLOS:CLASS-DIRECT-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-direct-default-initargs" title="29.3.3.4. Generic Function CLOS:CLASS-DIRECT-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a list of the direct default initialization arguments for
<em class="replaceable"><code>class</code></em>. Each element of this list is a <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>.
The empty list is returned if <em class="replaceable"><code>class</code></em> has no
direct default initialization arguments. This is the defaulted value of
the <code class="constant">:DIRECT-DEFAULT-INITARGS</code> initialization argument that was
associated with the class during initialization or reinitialization.
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="cpl"></a>29.3.3.5. Generic Function <a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns the class precedence list of <em class="replaceable"><code>class</code></em>.
The elements of this list are <a class="link" href="#mop-class-mo">class metaobject</a>s.</p><p>During class finalization <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls
<a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a> to compute the class precedence list of the class. That
value is associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and is returned by <a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a>.</p><p>This generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> has not been finalized.
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-direct-subclasses"></a>29.3.3.6. Generic Function <a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a set of the direct subclasses of <em class="replaceable"><code>class</code></em>. The elements
of this set are <a class="link" href="#mop-class-mo">class metaobject</a>s that all mention this class among their direct
superclasses. The empty set is returned if <em class="replaceable"><code>class</code></em> has no direct
subclasses. This value is maintained by the generic functions
<a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a> and <a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The set of direct subclasses of a class is
internally managed as a <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a>. Therefore the existence of
the <a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a> function does not prevent otherwise
unreferenced classes from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-slots"></a>29.3.3.7. Generic Function <a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a possibly empty set of the slots accessible in instances
of <em class="replaceable"><code>class</code></em>. The elements of this set are <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</p><p>During class finalization <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls
<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> to compute the slots of the class. That value is
associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and is returned by <a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a>.</p><p>This generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> has not been finalized.
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-default-initargs"></a>29.3.3.8. Generic Function <a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a list of the default initialization arguments for <em class="replaceable"><code>class</code></em>.
Each element of this list is a <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>.
The empty list is returned if <em class="replaceable"><code>class</code></em> has no
default initialization arguments.</p><p>During finalization <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls
<a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a> to compute the default initialization
arguments for the class. That value is associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and
is returned by <a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a>.</p><p>This generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> has not been
finalized.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-finalized-p"></a>29.3.3.9. Generic Function <a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns true if <em class="replaceable"><code>class</code></em> has been finalized. Returns false
otherwise. Also returns false if the <em class="replaceable"><code>class</code></em> has not been initialized.
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-prototype"></a>29.3.3.10. Generic Function <a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> <em class="replaceable"><code>class</code></em>)</code></h5></div></div></div><p>Returns a prototype instance of <em class="replaceable"><code>class</code></em>. Whether the instance
is initialized is not specified. The results are undefined if a
portable program modifies the binding of any slot of a prototype instance.
</p><p>This generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> has not been finalized.
</p><div class="informalexample"><a id="class-prototype-ex"></a><p>This allows non-<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#cons">cons</a>ing[3]
access to slots with allocation <code class="constant">:CLASS</code>:</p><pre class="programlisting">
(defclass counter ()
((count :allocation :class :initform 0 :reader how-many)))
(defmethod initialize-instance :after ((obj counter) &rest args)
(incf (slot-value obj 'count)))
(defclass counted-object (counter) ((name :initarg :name)))
</pre><p>
Now one can find out how many <code class="classname">COUNTED-OBJECT</code>s
have been created by using
<code class="code">(HOW-MANY (<a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> 'COUNTER)))</code>:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> 'counted-object :name 'foo)
⇒ <code class="computeroutput">#<COUNTED-OBJECT #x203028C9></code>
(HOW-MANY (<a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> 'counter)))
⇒ <code class="computeroutput">1</code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> 'counted-object :name 'bar)
⇒ <code class="computeroutput">#<COUNTED-OBJECT #x20306CB1></code>
(HOW-MANY (<a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> 'counter)))
⇒ <code class="computeroutput">2</code>
</pre></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-cl-readers-methods"></a>29.3.3.11. Methods</h4></div></div></div><p>The specified methods for the <a class="link" href="#mop-class-mo">class metaobject</a> reader generic
functions are presented below.</p><p>Each entry in the table indicates a method on one of the reader
generic functions, specialized to a specified class.
The number in each entry is a reference to the full description of the method.
The full descriptions appear after the table.
</p><div class="informaltable"><a id="mop-cl-readers-methods-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th align="center">Generic Function</th><th align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>, <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a></th><th align="center"><a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a></th><th align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a></th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-8">8</a></td></tr><tr><td align="center"><a class="link" href="#class-direct-superclasses" title="29.3.3.2. Generic Function CLOS:CLASS-DIRECT-SUPERCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td><td align="center"><a class="xref" href="#CRM-7">7</a></td></tr><tr><td align="center"><a class="link" href="#class-direct-slots" title="29.3.3.3. Generic Function CLOS:CLASS-DIRECT-SLOTS"><code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td></tr><tr><td align="center"><a class="link" href="#class-direct-default-initargs" title="29.3.3.4. Generic Function CLOS:CLASS-DIRECT-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></td><td align="center"><a class="xref" href="#CRM-1">1</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td></tr><tr><td align="center"><a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a></td><td align="center"><a class="xref" href="#CRM-2">2</a></td><td align="center"><a class="xref" href="#CRM-3">3</a></td><td align="center"><a class="xref" href="#CRM-7">7</a></td></tr><tr><td align="center"><a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a></td><td align="center"><a class="xref" href="#CRM-9">9</a></td><td align="center"><a class="xref" href="#CRM-9">9</a></td><td align="center"><a class="xref" href="#CRM-7">7</a></td></tr><tr><td align="center"><a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a></td><td align="center"><a class="xref" href="#CRM-2">2</a></td><td align="center"><a class="xref" href="#CRM-3">3</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td></tr><tr><td align="center"><a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a></td><td align="center"><a class="xref" href="#CRM-2">2</a></td><td align="center"><a class="xref" href="#CRM-3">3</a></td><td align="center"><a class="xref" href="#CRM-4">4</a></td></tr><tr><td align="center"><a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a></td><td align="center"><a class="xref" href="#CRM-2">2</a></td><td align="center"><a class="xref" href="#CRM-6">6</a></td><td align="center"><a class="xref" href="#CRM-5">5</a></td></tr><tr><td align="center"><a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a></td><td align="center"><a class="xref" href="#CRM-10">10</a></td><td align="center"><a class="xref" href="#CRM-10">10</a></td><td align="center"><a class="xref" href="#CRM-10">10</a></td></tr></tbody></table></div><div class="orderedlist"><p class="title"><strong>Class Reader Methods</strong></p><ol class="orderedlist" type="1"><li class="listitem"><a id="CRM-1"></a>This method returns the value which was
associated with the <a class="link" href="#mop-class-mo">class metaobject</a> during initialization or
reinitialization.</li><li class="listitem"><a id="CRM-2"></a>This method returns the value associated
with the <a class="link" href="#mop-class-mo">class metaobject</a> by <span class="method"><code class="literal"><a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>)</code></span> or
<span class="method"><code class="literal"><a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span></li><li class="listitem"><a id="CRM-3"></a>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</li><li class="listitem"><a id="CRM-4"></a>This method returns the empty list.
</li><li class="listitem"><a id="CRM-5"></a>This method returns true.</li><li class="listitem"><a id="CRM-6"></a>This method returns false.</li><li class="listitem"><a id="CRM-7"></a>This method returns a value derived from
the information in <a class="xref" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes">Table 29.1, “Direct Superclass Relationships Among The Specified Metaobject Classes”</a>, except that
implementation-specific modifications are permitted as described in
<a class="xref" href="#mop-ov-impl-and-user-spec" title="29.2.2.1. Implementation and User Specialization">Section 29.2.2.1, “Implementation and User Specialization”</a>.</li><li class="listitem"><a id="CRM-8"></a>This method returns the name of the
built-in class.</li><li class="listitem"><a id="CRM-9"></a>This method returns a value which is
maintained by <span class="method"><code class="literal"><a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span> and <span class="method"><code class="literal"><a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span>.
This method can be overridden only if those methods are overridden as
well.</li><li class="listitem"><a id="CRM-10"></a>No behavior is specified for this
method beyond that which is specified for the generic function.</li></ol></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-finalization"></a>29.3.4. Class Finalization Protocol</h3></div></div></div><p>Class <strong class="first"><em class="firstterm">finalization
<a id="class-finalization" class="indexterm"></a>
</em></strong> is the process of computing the information a class
inherits from its superclasses and preparing to actually allocate
instances of the class.
The class finalization process includes computing the class's class
precedence list, the full set of slots accessible in instances of the
class and the full set of default initialization arguments for the class.
These values are associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and can be accessed by
calling the appropriate reader.
In addition, the class finalization process makes decisions about how
instances of the class will be implemented.</p><p>To support forward-referenced superclasses, and to account for the
fact that not all classes are actually instantiated, class finalization
is not done as part of the initialization of the <a class="link" href="#mop-class-mo">class metaobject</a>. Instead,
finalization is done as a separate protocol, invoked by calling the
generic function <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>. The exact point at which
<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> is called depends on the class of the <a class="link" href="#mop-class-mo">class metaobject</a>; for
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> it is called sometime after all the classes
superclasses are defined, but no later than when the first instance of
the class is allocated (by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>).</p><p>The first step of class finalization is computing the class
precedence list. Doing this first allows subsequent steps to access the
class precedence list. This step is performed by calling the generic
function <a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a>. The value returned from this call is associated
with the <a class="link" href="#mop-class-mo">class metaobject</a> and can be accessed by calling the <a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a> generic
function.</p><p>The second step is computing the full set of slots that will be
accessible in instances of the class. This step is performed by calling
the generic function <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>. The result of this call is a list
of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. This value is associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and can
be accessed by calling the <a class="link" href="#class-slots" title="29.3.3.7. Generic Function CLOS:CLASS-SLOTS"><code class="function">CLOS:CLASS-SLOTS</code></a> generic function.</p><p>The behavior of <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> is itself layered, consisting of
calls to <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> and <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a>.</p><p>The final step of class finalization is computing the full set of
initialization arguments for the class. This is done by calling the
generic function <a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a>. The value returned by this
generic function is associated with the <a class="link" href="#mop-class-mo">class metaobject</a> and can be
accessed by calling <a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a>.</p><p>If the class was previously finalized, <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> may
call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_mak_ces-obsolete.html" target="_top"><code class="function">MAKE-INSTANCES-OBSOLETE</code></a>. The circumstances under which this
happens are described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
<a class="xref" href="#redef-class" title="4.6. Redefining Classes sec_4-3-6">Section 4.6, “Redefining Classes sec_4-3-6”</a>.</p><p>Forward-referenced classes, which provide a temporary definition
for a class which has been referenced but not yet defined, can never be
finalized. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> is called on a
forward-referenced class.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-init"></a>29.3.5. Class Initialization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-cl-init-mo">29.3.5.1. Initialization of class metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#class-mo-init-methods">29.3.5.1.1. Methods</a></span></dt><dt><span class="section"><a href="#mop-cl-init-anon">29.3.5.1.2. Initialization of Anonymous Classes</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-cl-reinit-mo">29.3.5.2. Reinitialization of class metaobjects</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-cl-init-mo"></a>29.3.5.1. Initialization of <a class="link" href="#mop-class-mo">class metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#class-mo-init-methods">29.3.5.1.1. Methods</a></span></dt><dt><span class="section"><a href="#mop-cl-init-anon">29.3.5.1.2. Initialization of Anonymous Classes</a></span></dt></dl></div><p>A <a class="link" href="#mop-class-mo">class metaobject</a> can be created by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.
The initialization arguments establish the definition of the class.
A <a class="link" href="#mop-class-mo">class metaobject</a> can be redefined by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
Some classes of <a class="link" href="#mop-class-mo">class metaobject</a> do not support redefinition;
in these cases, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p>Initialization of a <a class="link" href="#mop-class-mo">class metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
and allowing it to call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>. Reinitialization of a
<a class="link" href="#mop-class-mo">class metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
Portable programs must <span class="strong"><strong>not</strong></span></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> directly to
initialize a <a class="link" href="#mop-class-mo">class metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> directly to
initialize or reinitialize a <a class="link" href="#mop-class-mo">class metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> to change the class of any
<a class="link" href="#mop-class-mo">class metaobject</a> or to turn a non-class object into a
<a class="link" href="#mop-class-mo">class metaobject</a>.</li></ul></div><p>Since metaobject classes may not be redefined,
no behavior is specified for the result of calls to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> on <a class="link" href="#mop-class-mo">class metaobject</a>s.
Since the class of <a class="link" href="#mop-class-mo">class metaobject</a>s may not be changed,
no behavior is specified for the result of calls to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_ferent-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</code></a> on <a class="link" href="#mop-class-mo">class metaobject</a>s.</p><p>During initialization or reinitialization, each initialization
argument is checked for errors and then associated with the <a class="link" href="#mop-class-mo">class metaobject</a>.
The value can then be accessed by calling the appropriate accessor as
shown in <a class="xref" href="#class-mo-initargs" title="Table 29.2. Initialization arguments and accessors for class metaobjects">Table 29.2, “Initialization arguments and accessors for class metaobjects”</a>.</p><p>This section begins with a description of the error checking and
processing of each initialization argument. This is followed by a table
showing the generic functions that can be used to access the stored
initialization arguments. Initialization behavior specific to the
different specified <a class="link" href="#mop-class-mo">class metaobject</a> classes comes next. The section ends with a
set of restrictions on portable methods affecting <a class="link" href="#mop-class-mo">class metaobject</a> initialization
and reinitialization.</p><p>In these descriptions, the phrase <span class="quote">“<span class="quote">this argument defaults to
<em class="replaceable"><code>value</code></em></span>”</span> means that when that initialization argument is not
supplied, initialization or reinitialization is performed as if
<em class="replaceable"><code>value</code></em> had been supplied. For some initialization arguments this
could be done by the use of default initialization arguments, but
whether it is done this way is not specified. Implementations are free
to define default initialization arguments for specified <a class="link" href="#mop-class-mo">class metaobject</a> classes.
Portable programs are free to define default initialization arguments
for portable subclasses of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>.</p><p>Unless there is a specific note to the
contrary, then during reinitialization, if an initialization argument
is not supplied, the previously stored value is left unchanged.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara">The <code class="constant">:DIRECT-DEFAULT-INITARGS</code> argument is a list
of <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>s.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>, or if any
element of the list is not a <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>.</p><p class="simpara">If the <a class="link" href="#mop-class-mo">class metaobject</a> is being initialized, this argument
defaults to the empty list.</p></li><li class="listitem"><p class="simpara"> The <code class="constant">:DIRECT-SLOTS</code> argument is a list of
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a> or if any
element of the list is not a <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.</p><p>After error checking, this value is converted to a
list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s before it is associated with the <a class="link" href="#mop-class-mo">class metaobject</a>. Conversion
of each <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> to a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> is a two-step process.
First, the generic function <a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> is called with the <a class="link" href="#mop-class-mo">class metaobject</a> and
the <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> to determine the class of the new
<a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>; this permits both the <a class="link" href="#mop-class-mo">class metaobject</a> and the
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> to control the resulting <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> class.
Second, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> is applied to the direct <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> class and the
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.
This conversion could be implemented as shown in the
following code:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> convert-to-direct-slot-definition (class canonicalized-slot)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> #'<a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a>
class canonicalized-slot)
canonicalized-slot))
</pre><p class="simpara">If the <a class="link" href="#mop-class-mo">class metaobject</a> is being initialized, this argument defaults to
the empty list.</p><p class="simpara">Once the <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s have been created, the specified reader and
writer methods are created. The generic functions
<a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a> and <a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a> are called to
determine the classes of the <a class="link" href="#mop-method-mo">method metaobject</a>s created.</p></li><li class="listitem"><p class="simpara"> The <code class="constant">:DIRECT-SUPERCLASSES</code> argument is a list of
<a class="link" href="#mop-class-mo">class metaobject</a>s. Classes which do not support multiple inheritance
signal an error if the list contains more than one element.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a> or if
<a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> applied to <em class="replaceable"><code>class</code></em> and any element of this
list returns false.</p><p class="simpara">When the <a class="link" href="#mop-class-mo">class metaobject</a> is being initialized, and this argument is
either not supplied or is the empty list, this argument defaults as
follows: if the class is an instance of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> or one of
its subclasses the default value is a list of the class
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>; if the class is an instance of
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> or one of its subclasses the default
value is a list of the class
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If the class is an instance of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> or one of its subclasses the default value is a
list of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a></p></div><p class="simpara">After any defaulting of the value, the generic function
<a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a> is called once for each element of the list.
</p><p class="simpara">When the <a class="link" href="#mop-class-mo">class metaobject</a> is being reinitialized and this
argument is supplied, the generic function <a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>
is called once for each <a class="link" href="#mop-class-mo">class metaobject</a> in the previously stored value but not
in the new value; the generic function <a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a> is
called once for each <a class="link" href="#mop-class-mo">class metaobject</a> in the new value but not in the
previously stored value.</p></li><li class="listitem">The <code class="constant">:DOCUMENTATION</code> argument is
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if it is not. This argument default
to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> during initialization.</li><li class="listitem"><p class="simpara">The <code class="constant">:NAME</code> argument is an object.</p><p class="simpara">If the class is being initialized, this argument defaults to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p></li></ul></div><p>After the processing and defaulting of initialization arguments
described above, the value of each initialization argument is associated
with the <a class="link" href="#mop-class-mo">class metaobject</a>. These values can then be accessed by calling
the corresponding generic function. The correspondences are as follows:
</p><div class="table"><a id="class-mo-initargs"></a><p class="title"><strong>Table 29.2. Initialization arguments and
accessors for <a class="link" href="#mop-class-mo">class metaobject</a>s</strong></p><div class="table-contents"><table class="table" summary="Initialization arguments and accessors for class metaobjects" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Initialization Argument</th><th align="center">Generic Function</th></tr></thead><tbody><tr><td align="center"><code class="constant">:DIRECT-DEFAULT-INITARGS</code></td><td align="center"><a class="link" href="#class-direct-default-initargs" title="29.3.3.4. Generic Function CLOS:CLASS-DIRECT-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DIRECT-DEFAULT-INITARGS</code></a></td></tr><tr><td align="center"><code class="constant">:DIRECT-SLOTS</code></td><td align="center"><a class="link" href="#class-direct-slots" title="29.3.3.3. Generic Function CLOS:CLASS-DIRECT-SLOTS"><code class="function">CLOS:CLASS-DIRECT-SLOTS</code></a></td></tr><tr><td align="center"><code class="constant">:DIRECT-SUPERCLASSES</code></td><td align="center"><a class="link" href="#class-direct-superclasses" title="29.3.3.2. Generic Function CLOS:CLASS-DIRECT-SUPERCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUPERCLASSES</code></a></td></tr><tr><td align="center"><code class="constant">:DOCUMENTATION</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></td></tr><tr><td align="center"><code class="constant">:NAME</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a></td></tr></tbody></table></div></div><p><br class="table-break" /></p><p>Instances of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> support multiple
inheritance and reinitialization. Instances of the class
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> support multiple inheritance and
reinitialization. For <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>es, all of the
initialization arguments default to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>Instances of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> do
not support multiple inheritance and reinitialization.
</p></div><p>Since built-in classes cannot be created or reinitialized by the
user, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>
are called to initialize or reinitialize a derived instance of the class
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="class-mo-init-methods"></a>29.3.5.1.1. Methods</h5></div></div></div><p>It is not specified which methods provide the initialization and
reinitialization behavior described above. Instead, the information
needed to allow portable programs to specialize this behavior is
presented as a set of restrictions on the methods a portable program can
define. The model is that portable initialization methods have access
to the <a class="link" href="#mop-class-mo">class metaobject</a> when either all or none of the specified initialization
has taken effect.</p><p>These restrictions govern the methods that a portable program can
define on the generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>.
These restrictions apply only to methods on these generic functions for
which the first specializer is a subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>.
Other portable methods on these generic functions are not affected by
these restrictions.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not define methods on
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>.</li><li class="listitem"><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Portable programs must not define primary methods.
</li><li class="listitem">Portable programs may define around-methods, but
these must be extending, not overriding methods.</li><li class="listitem">Portable before-methods must assume that when they
are run, none of the initialization behavior described above has been
completed.</li><li class="listitem">Portable after-methods must assume that when they
are run, all of the initialization behavior described above has been
completed.</li></ul></div></li></ul></div><p>The results are undefined if any of
these restrictions are violated.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-cl-init-anon"></a>29.3.5.1.2. Initialization of Anonymous Classes</h5></div></div></div><p><a class="link" href="#mop-class-mo">class metaobject</a>s created with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> are usually <strong class="first"><em class="firstterm">anonymous
<a id="class-anonymous" class="indexterm"></a>
</em></strong>; that is, they have no <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a>.
An anonymous <a class="link" href="#mop-class-mo">class metaobject</a> can be given a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a> using
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>)</code> and
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_class-name.html" target="_top"><code class="function">CLASS-NAME</code></a>)</code>.</p><p>When a <a class="link" href="#mop-class-mo">class metaobject</a> is created with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>, it is initialized
in the usual way. The initialization arguments passed to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> are use to establish the definition of the class. Each
initialization argument is checked for errors and associated with the
<a class="link" href="#mop-class-mo">class metaobject</a>. The initialization arguments correspond roughly to the
arguments accepted by the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro, and more closely to the
arguments accepted by the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> function.</p><p>Some <a class="link" href="#mop-class-mo">class metaobject</a> classes allow their instances to be
redefined. When permissible, this is done by calling
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>. This is discussed in the
<a class="link" href="#mop-cl-reinit-mo" title="29.3.5.2. Reinitialization of class metaobjects">next section</a>.</p><p>An example of creating an anonymous class directly using
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> follows:</p><pre class="programlisting">
(flet ((zero () 0)
(propellor () *propellor*))
(make-instance 'standard-class
:name '(my-class foo)
:direct-superclasses (list (find-class 'plane)
another-anonymous-class)
:direct-slots `((:name x
:initform 0
:initfunction ,#'zero
:initargs (:x)
:readers (position-x)
:writers ((setf position-x)))
(:name y
:initform 0
:initfunction ,#'zero
:initargs (:y)
:readers (position-y)
:writers ((setf position-y))))
:direct-default-initargs `((:engine *propellor* ,#'propellor))))
</pre></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-cl-reinit-mo"></a>29.3.5.2. Reinitialization of <a class="link" href="#mop-class-mo">class metaobject</a>s</h4></div></div></div><p>Some <a class="link" href="#mop-class-mo">class metaobject</a> classes allow their instances to be reinitialized.
This is done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>. The initialization
arguments have the same interpretation as in class initialization.</p><p>If the <a class="link" href="#mop-class-mo">class metaobject</a> was finalized before the call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>,
<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> will be called again once all the initialization
arguments have been processed and associated with the <a class="link" href="#mop-class-mo">class metaobject</a>.
In addition, once finalization is complete, any dependents of the
<a class="link" href="#mop-class-mo">class metaobject</a> will be updated by calling <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-customize"></a>29.3.6. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#setf-class-name">29.3.6.1. Generic Function <code class="code">(SETF CLASS-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-class">29.3.6.2. Generic Function <code class="function">CLOS:ENSURE-CLASS</code></a></span></dt><dt><span class="section"><a href="#ensure-class-UC">29.3.6.3. Generic Function <code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#finalize-inheritance">29.3.6.4. Generic Function <code class="function">CLOS:FINALIZE-INHERITANCE</code></a></span></dt><dt><span class="section"><a href="#mop-make-instance">29.3.6.5. Generic Function <code class="function">MAKE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#alloc-instance">29.3.6.6. Generic Function <code class="function">ALLOCATE-INSTANCE</code></a></span></dt><dt><span class="section"><a href="#validate-superclass">29.3.6.7. Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code></a></span></dt><dt><span class="section"><a href="#compute-dsd-initargs">29.3.6.8. Generic Function <code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#dsd-class">29.3.6.9. Generic Function <code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-cpl">29.3.6.10. Generic Function <code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a></span></dt><dt><span class="section"><a href="#compute-slots">29.3.6.11. Generic Function <code class="function">CLOS:COMPUTE-SLOTS</code></a></span></dt><dt><span class="section"><a href="#compute-esd">29.3.6.12. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a></span></dt><dt><span class="section"><a href="#compute-esd-initargs">29.3.6.13. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a></span></dt><dt><span class="section"><a href="#esd-class">29.3.6.14. Generic Function <code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a></span></dt><dt><span class="section"><a href="#compute-default-initargs">29.3.6.15. Generic Function <code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="setf-class-name"></a>29.3.6.1. Generic Function <a class="link" href="#setf-class-name" title="29.3.6.1. Generic Function (SETF CLASS-NAME)"><code class="code">(SETF CLASS-NAME)</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#setf-class-name" title="29.3.6.1. Generic Function (SETF CLASS-NAME)"><code class="code">(SETF CLASS-NAME)</code></a> <em class="replaceable"><code>new-name</code></em>
<em class="replaceable"><code>class</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>new-name</code></em></span></dt><dd>any Lisp object.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>new-name</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function changes the name of <em class="replaceable"><code>class</code></em> to <em class="replaceable"><code>new-name</code></em>.
This value is usually a symbol, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the class has no name.</p><p class="simpara">This function works by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> with
<em class="replaceable"><code>class</code></em> as its first argument, the symbol <code class="constant">:NAME</code> as its second
argument and <em class="replaceable"><code>new-name</code></em> as its third argument.
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="ensure-class"></a>29.3.6.2. Generic Function <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd>a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>.</dd><dt><span class="term">keyword arguments</span></dt><dd>Some of the keyword arguments accepted by this
function are actually processed by <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>,
others are processed during initialization of the <a class="link" href="#mop-class-mo">class metaobject</a>
(as described in <a class="xref" href="#mop-cl-init-mo" title="29.3.5.1. Initialization of class metaobjects">Section 29.3.5.1, “Initialization of class metaobjects”</a>).
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to define or redefine a
class with the specified name, and can be called by the user or the
implementation. It is the functional equivalent of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, and
is called by the expansion of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro.</p><p class="simpara">The behavior of this function is actually implemented by the
generic function <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>. When <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a> is called,
it immediately calls <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> and returns that result as its
own.</p><p>The first argument to <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> is computed as
follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If <em class="replaceable"><code>name</code></em> names a class (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a> returns a
class when called with <em class="replaceable"><code>name</code></em>) use that class.</li><li class="listitem">Otherwise use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>
The second argument is <em class="replaceable"><code>name</code></em>. The remaining arguments are the
complete set of keyword arguments received by the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>
function.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="ensure-class-UC"></a>29.3.6.3. Generic Function <a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:DIRECT-DEFAULT-INITARGS</code> <code class="constant">:DIRECT-SLOTS</code> <code class="constant">:DIRECT-SUPERCLASSES</code>
<code class="constant">:NAME</code> <code class="constant">:METACLASS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd>a class name.</dd><dt><span class="term"><code class="constant">:METACLASS</code></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> class or a <a class="link" href="#mop-class-mo">class metaobject</a> class name. If this
argument is not supplied, it defaults to the class named
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>. If a class name is supplied, it is interpreted
as the class with that name. If a class name is supplied, but
there is no such class, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</dd><dt><span class="term"><code class="constant">:DIRECT-SUPERCLASSES</code></span></dt><dd>a list of which each element is a <a class="link" href="#mop-class-mo">class metaobject</a> or a
class name. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument is not a
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>.</dd><dt><span class="term">additional keyword arguments</span></dt><dd>See <a class="xref" href="#mop-cl-init-mo" title="29.3.5.1. Initialization of class metaobjects">Section 29.3.5.1, “Initialization of class metaobjects”</a>
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to define or modify
the definition of a named class. It is called by the <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>
function. It can also be called directly.</p><p>The first step performed by this generic function is to
compute the set of initialization arguments which will be used to
create or reinitialize the named class. The initialization arguments
are computed from the full set of keyword arguments received by this
generic function as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <code class="constant">:METACLASS</code> argument is not included in the
initialization arguments.</li><li class="listitem"><p>If the <code class="constant">:DIRECT-SUPERCLASSES</code> argument was received
by this generic function, it is converted into a list of <a class="link" href="#mop-class-mo">class metaobject</a>s.
This conversion does not affect the structure of the supplied
<code class="constant">:DIRECT-SUPERCLASSES</code> argument. For each element in the
<code class="constant">:DIRECT-SUPERCLASSES</code> argument:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">If the element is a <a class="link" href="#mop-class-mo">class metaobject</a>, that
<a class="link" href="#mop-class-mo">class metaobject</a> is used.</li><li class="listitem">If the element names a class, that <a class="link" href="#mop-class-mo">class metaobject</a> is
used.</li><li class="listitem"><p class="simpara">Otherwise an instance of the class
<a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is created and used.
The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a> of the newly created forward referenced
<a class="link" href="#mop-class-mo">class metaobject</a> is set to the element.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>A new <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>
instance is only created when one for the given class name
does not yet exist; otherwise the existing one is reused.
See <a class="xref" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP">Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></a>.</p></div></li></ul></div></li><li class="listitem">All other keyword arguments are included directly
in the initialization arguments.</li></ul></div><p class="simpara">If the <em class="replaceable"><code>class</code></em> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a new <a class="link" href="#mop-class-mo">class metaobject</a> is created
by calling the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> generic function with the value of the
<code class="constant">:METACLASS</code> argument as its first argument, and the previously
computed initialization arguments. The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_name">proper name</a> of the
newly created <a class="link" href="#mop-class-mo">class metaobject</a> is set to <em class="replaceable"><code>name</code></em>. The newly created <a class="link" href="#mop-class-mo">class metaobject</a> is
returned.</p><p class="simpara">If the <em class="replaceable"><code>class</code></em> argument is a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> is called to change its class to the value specified
by the <code class="constant">:METACLASS</code> argument. The <a class="link" href="#mop-class-mo">class metaobject</a> is then reinitialized with
the previously initialization arguments. (This is a documented
violation of the general constraint that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> may not be
used with <a class="link" href="#mop-class-mo">class metaobject</a>s.)</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>
The <em class="replaceable"><code>class</code></em> argument cannot be a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>. See
<a class="xref" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP">Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></a>.</p></div><p class="simpara">If the class of the <em class="replaceable"><code>class</code></em> argument is not the same as the
class specified by the <code class="constant">:METACLASS</code> argument, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Otherwise, the <a class="link" href="#mop-class-mo">class metaobject</a> <em class="replaceable"><code>class</code></em> is redefined by calling the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> generic function with <em class="replaceable"><code>class</code></em> and the
initialization arguments. The <em class="replaceable"><code>class</code></em> argument is then
returned.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:METACLASS</code>
<code class="constant">:DIRECT-SUPERCLASSES</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
function in the case where the <em class="replaceable"><code>class</code></em> argument is a class.</p><p class="simpara">This method can be overridden.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>) <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:METACLASS</code>
<code class="constant">:DIRECT-SUPERCLASSES</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
function in the case where the <em class="replaceable"><code>class</code></em> argument is a forward
referenced class.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>This method does not exist.
See <a class="xref" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP">Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></a>.
Use the method specialized on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a> instead.</p></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-class-UC" title="29.3.6.3. Generic Function CLOS:ENSURE-CLASS-USING-CLASS"><code class="function">CLOS:ENSURE-CLASS-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a>) <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:METACLASS</code>
<code class="constant">:DIRECT-SUPERCLASSES</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd>This method implements the behavior of the generic
function in the case where the <em class="replaceable"><code>class</code></em> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="finalize-inheritance"></a>29.3.6.4. Generic Function <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
<em class="replaceable"><code>class</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to finalize a <a class="link" href="#mop-class-mo">class metaobject</a>.
This is described in <a class="xref" href="#mop-cl-finalization" title="29.3.4. Class Finalization Protocol">Section 29.3.4, “Class Finalization Protocol”</a>
</p><p class="simpara">After <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> returns, the <a class="link" href="#mop-class-mo">class metaobject</a> is
finalized and the result of calling <a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a> on the <a class="link" href="#mop-class-mo">class metaobject</a>
will be true.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>))</code></span></span></dt><dd>No behavior is specified for these
methods beyond that which is specified for their respective generic
functions.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>))</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-make-instance"></a>29.3.6.5. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> <em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>
<em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a class name.
</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>a list of alternating initialization argument
names and values.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A newly allocated and initialized instance of <em class="replaceable"><code>class</code></em>.
</dd><dt><span class="term">Purpose</span></dt><dd>The generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> creates and
returns a new instance of the given class. Its behavior and use is
described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
</dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd>This method simply invokes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
recursively on the arguments <span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>
<em class="replaceable"><code>class</code></em>)</code></span> and <em class="replaceable"><code>initargs</code></em>.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> (<em class="replaceable"><code>class</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> (<em class="replaceable"><code>class</code></em>
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd>These methods implement the behavior of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-1.html">7.1
<span class="quote">“<span class="quote">Object Creation and Initialization</span>”</span></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="alloc-instance"></a>29.3.6.6. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a> <em class="replaceable"><code>class</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>alternating initialization argument names and
values.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A newly allocated instance of <em class="replaceable"><code>class</code></em>
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to create a new,
uninitialized instance of a class. The interpretation of the concept
of an <strong class="first"><em class="firstterm">uninitialized</em></strong> instance depends on the
<a class="link" href="#mop-class-mo">class metaobject</a> class.</p><p class="simpara">Before allocating the new instance, <a class="link" href="#class-finalized-p" title="29.3.3.9. Generic Function CLOS:CLASS-FINALIZED-P"><code class="function">CLOS:CLASS-FINALIZED-P</code></a> is
called to see if <em class="replaceable"><code>class</code></em> has been finalized. If it has not been
finalized, <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> is called before the new instance
is allocated.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em></code></span></span></dt><dd>This method allocates storage in the instance for
each slot with allocation <code class="constant">:INSTANCE</code>. These slots are unbound.
Slots with any other allocation are ignored by this method (no
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed).</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">This method allocates storage in the instance for
each slot with allocation <code class="constant">:INSTANCE</code>. These slots are unbound.
Slots with any other allocation are ignored by this method (no
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed).</p><p class="simpara">The funcallable instance function of the instance is
undefined - the results are undefined if the instance is applied to
arguments before <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a> has been used
to set the funcallable instance function.
</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="validate-superclass"></a>29.3.6.7. Generic Function <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> <em class="replaceable"><code>class</code></em>
<em class="replaceable"><code>superclass</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>superclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine whether
the class <em class="replaceable"><code>superclass</code></em> is suitable for use as a superclass of
<em class="replaceable"><code>class</code></em>.</p><p class="simpara">This generic function can be be called by the implementation
or user code. It is called during <a class="link" href="#mop-class-mo">class metaobject</a> initialization and
reinitialization, before the direct superclasses are stored. If this
generic function returns false, the initialization or
reinitialization will signal an error.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>superclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p>This method returns true in three situations:
</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">If the <em class="replaceable"><code>superclass</code></em> argument is the class named <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>,
</li><li class="listitem">if the class of the <em class="replaceable"><code>class</code></em> argument is the same
as the class of the <em class="replaceable"><code>superclass</code></em> argument, or
</li><li class="listitem">if the class of one of the arguments is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> and the class of the other is
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>.</li></ol></div><p>In all other cases, this method returns false.</p><p class="simpara">This method can be overridden.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>This method also returns true in a fourth situation:
</p><div class="orderedlist"><ol class="orderedlist" start="4" type="i"><li class="listitem">If the class of the <em class="replaceable"><code>class</code></em> argument is a subclass
of the class of the <em class="replaceable"><code>superclass</code></em> argument.
</li></ol></div></div></dd></dl></div><p><strong>Remarks. </strong>Defining a method on <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> requires detailed
knowledge of of the internal protocol followed by each of the two
<a class="link" href="#mop-class-mo">class metaobject</a> classes. A method on <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> which returns true
for two different <a class="link" href="#mop-class-mo">class metaobject</a> classes declares that they are
compatible.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-dsd-initargs"></a>29.3.6.8. Generic Function <a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p></p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a> <em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>
<em class="replaceable"><code>slot-spec</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>slot-spec</code></em></span></dt><dd>a
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of initialization arguments for a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function determines the initialization
arguments for the direct slot definition for a slot in a class.
It is called during initialization of a class. The resulting
initialization arguments are passed to <a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> and then to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.</p><p class="simpara">This generic function uses the supplied <a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>.
The value of <code class="constant">:NAME</code> in the returned initargs is the same as the value
of <code class="constant">:NAME</code> in the supplied <em class="replaceable"><code>slot-spec</code></em> argument.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>slot-spec</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a> (<em class="replaceable"><code>class</code></em>
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>slot-spec</code></em>)</code></span></span></dt><dd><p class="simpara">This method returns <em class="replaceable"><code>slot-spec</code></em> unmodified.</p><p class="simpara">This method can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dsd-class"></a>29.3.6.9. Generic Function <a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> <em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>
<em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>a set of initialization arguments and values.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A subclass of the class <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a>.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">When a class is initialized, each of the
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a>s must be converted to a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
This generic function is called to determine
the class of that <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</p><p class="simpara">The <em class="replaceable"><code>initargs</code></em> argument is simply the
<a class="link" href="#mop-canonicalized-slot-spec">canonicalized slot specification</a> for the slot.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> (<em class="replaceable"><code>class</code></em>
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">These methods return the class <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>.
</p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-cpl"></a>29.3.6.10. Generic Function <a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a>
<em class="replaceable"><code>class</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of <a class="link" href="#mop-class-mo">class metaobject</a>s.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic-function is called to determine the
class precedence list of a class.</p><p class="simpara">The result is a list which contains each of <em class="replaceable"><code>class</code></em> and its
superclasses once and only once. The first element of the list is
<em class="replaceable"><code>class</code></em> and the last element is the class named <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>.</p><p class="simpara">All methods on this generic function must compute the class
precedence list as a function of the ordered direct superclasses of
the superclasses of <em class="replaceable"><code>class</code></em>. The results are undefined if the
rules used to compute the class precedence list depend on any other
factors.</p><p class="simpara">When a class is finalized, <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls this
generic function and associates the returned value with the <a class="link" href="#mop-class-mo">class metaobject</a>.
The value can then be accessed by calling <a class="link" href="#cpl" title="29.3.3.5. Generic Function CLOS:CLASS-PRECEDENCE-LIST"><code class="function">CLOS:CLASS-PRECEDENCE-LIST</code></a>.</p><p class="simpara">The list returned by this function
will not be mutated by the implementation. The results are undefined
if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-cpl" title="29.3.6.10. Generic Function CLOS:COMPUTE-CLASS-PRECEDENCE-LIST"><code class="function">CLOS:COMPUTE-CLASS-PRECEDENCE-LIST</code></a> (<em class="replaceable"><code>class</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">This method computes the class precedence list
according to the rules described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_4-3-5.html">4.3.5 <span class="quote">“<span class="quote">Determining the
Class Precedence List</span>”</span></a>.</p><p class="simpara">This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if <em class="replaceable"><code>class</code></em> or any of its superclasses
is a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>.</p><p class="simpara">This method can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-slots"></a>29.3.6.11. Generic Function <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> <em class="replaceable"><code>class</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A set of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function computes a set of effective
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s for the class <em class="replaceable"><code>class</code></em>. The result is a list of <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s:
one for each slot that will be accessible in instances of <em class="replaceable"><code>class</code></em>.
</p><p class="simpara">This generic function proceeds in 3 steps:</p><p class="simpara">The first step collects the full set of direct slot
definitions from the superclasses of <em class="replaceable"><code>class</code></em>.</p><p class="simpara">The direct slot definitions are then collected into
individual lists, one list for each slot name associated with any of
the direct slot definitions. The slot names are compared with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a>. Each such list is then sorted into class precedence list
order. Direct slot definitions coming from classes earlier in the
class precedence list of <em class="replaceable"><code>class</code></em> appear before those coming from
classes later in the class precedence list. For each slot name, the
generic function <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> is called to compute an effective slot
definition. The result of <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> is a list of these
effective slot definitions, in unspecified order.</p><p class="simpara">In the final step, the location for each effective slot
definition is set. This is done by specified around-methods;
portable methods cannot take over this behavior.
For more information on the slot definition locations,
see <a class="xref" href="#mop-sa-instance-struct" title="29.10.1. Instance Structure Protocol">Section 29.10.1, “Instance Structure Protocol”</a>.</p><p class="simpara">The list returned by this function
will not be mutated by the implementation. The results are undefined
if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)}</code></span></span></dt><dd><p class="simpara">These methods implement the specified behavior of
the generic function.</p><p class="simpara">These methods can be overridden.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>
<code class="constant">:AROUND</code> (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> <code class="constant">:AROUND</code>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>))</code></span></span></dt><dd>These methods implement the specified behavior of
computing and storing slot locations.
These methods cannot be overridden.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-esd"></a>29.3.6.12. Generic Function <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>direct-slot-definitions</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd>a slot name.</dd><dt><span class="term"><em class="replaceable"><code>direct-slot-definitions</code></em></span></dt><dd>an ordered list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. The most specific
<a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> appears first in the list.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>An <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function determines the effective slot
definition for a slot in a class. It is called by <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a>
once for each slot accessible in instances of <em class="replaceable"><code>class</code></em>.</p><p class="simpara">This generic function uses the supplied list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s to
compute the inheritance of slot properties for a single slot. The
returned effective slot definition represents the result of computing
the inheritance. The name of the new effective slot definition is
the same as the name of the direct slot definitions supplied.</p><p class="simpara">The class of the <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> is determined by calling
<a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a>. The effective slot definition is then created by
calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The initialization arguments passed in this
call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> are used to initialize the new <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
See <a class="xref" href="#mop-sd" title="29.4. Slot Definitions">Section 29.4, “Slot Definitions”</a> for details.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> (<em class="replaceable"><code>class</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>direct-slot-definitions</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> (<em class="replaceable"><code>class</code></em>
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>name</code></em> <em class="replaceable"><code>direct-slot-definitions</code></em>)</code></span></span></dt><dd><p class="simpara">This method implements the
inheritance and defaulting of slot options following the rules
described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-5-3.html" target="_top">7.5.3 <span class="quote">“<span class="quote">Inheritance of Slots and Options</span>”</span></a>.</p><p class="simpara">This method can be extended, but the value returned by the
extending method must be the value returned by this method.
</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The initialization arguments that are passed
to <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> are computed through a call to
<a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a>. It is the <a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a> method that
implements the inheritance rules.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-esd-initargs"></a>29.3.6.13. Generic Function <a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p></p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>direct-slot-definitions</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>direct-slot-definitions</code></em></span></dt><dd>an ordered list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. The most specific
<a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> appears first in the list.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of initialization arguments for an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function determines the initialization
arguments for the effective slot definition for a slot in a class.
It is called by <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a>. The resulting initialization arguments
are passed to <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> and then to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.</p><p class="simpara">This generic function uses the supplied list of <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s to
compute the inheritance of slot properties for a single slot. The
returned effective slot definition initargs represent the result of
computing the inheritance. The value of <code class="constant">:NAME</code> in the returned
initargs is the same as the name of the direct slot definitions
supplied.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>direct-slot-definitions</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a> (<em class="replaceable"><code>class</code></em>
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>direct-slot-definitions</code></em>)</code></span></span></dt><dd><p class="simpara">This method implements the
inheritance and defaulting of slot options following the rules
described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-5-3.html" target="_top">7.5.3 <span class="quote">“<span class="quote">Inheritance of Slots and Options</span>”</span></a>.</p><p class="simpara">This method can be extended.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="esd-class"></a>29.3.6.14. Generic Function <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> <em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>
<em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>set of initialization arguments and values.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A subclass of the class <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a>.
</dd><dt><span class="term">Purpose</span></dt><dd>This generic function is called by <a class="link" href="#compute-esd" title="29.3.6.12. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION</code></a> to
determine the class of the resulting <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>. The <em class="replaceable"><code>initargs</code></em>
argument is the set of initialization arguments and values that will
be passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> when the <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> is created.
</dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> (<em class="replaceable"><code>class</code></em>
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">These methods return the class <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>.
</p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-default-initargs"></a>29.3.6.15. Generic Function <a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a>
<em class="replaceable"><code>class</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>s.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic-function is called to determine the
default initialization arguments for a class.</p><p class="simpara">The result is a list of <a class="link" href="#mop-canonicalized-default-initarg">canonicalized default initialization argument</a>s,
with no duplication among initialization argument names.</p><p>All methods on this generic function must compute the default
initialization arguments as a function of only:
</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">the class precedence list of <em class="replaceable"><code>class</code></em>,
and</li><li class="listitem">the direct default initialization arguments of each
class in that list.</li></ol></div><p>The results are undefined if the rules used to compute
the default initialization arguments depend on any other factors.</p><p class="simpara">When a class is finalized, <a class="link" href="#finalize-inheritance" title="29.3.6.4. Generic Function CLOS:FINALIZE-INHERITANCE"><code class="function">CLOS:FINALIZE-INHERITANCE</code></a> calls this
generic function and associates the returned value with the <a class="link" href="#mop-class-mo">class metaobject</a>.
The value can then be accessed by calling
<a class="link" href="#class-default-initargs" title="29.3.3.8. Generic Function CLOS:CLASS-DEFAULT-INITARGS"><code class="function">CLOS:CLASS-DEFAULT-INITARGS</code></a>.</p><p class="simpara">The list returned by this function
will not be mutated by the implementation. The results are undefined
if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-default-initargs" title="29.3.6.15. Generic Function CLOS:COMPUTE-DEFAULT-INITARGS"><code class="function">CLOS:COMPUTE-DEFAULT-INITARGS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">These methods compute the default initialization
arguments according to the rules described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-1-3.html">7.1.3 <span class="quote">“<span class="quote">Defaulting
of Initialization Arguments</span>”</span></a>.</p><p class="simpara">These methods signal an error if <em class="replaceable"><code>class</code></em> or any of its
superclasses is a <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a>.</p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-cl-dep"></a>29.3.7. Updating Dependencies</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#add-direct-subclass">29.3.7.1. Generic Function <code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a></span></dt><dt><span class="section"><a href="#remove-direct-subclass">29.3.7.2. Generic Function <code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="add-direct-subclass"></a>29.3.7.1. Generic Function <a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a> <em class="replaceable"><code>superclass</code></em>
<em class="replaceable"><code>subclass</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>superclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>subclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to maintain a set of
backpointers from a class to its direct subclasses. This generic
function adds <em class="replaceable"><code>subclass</code></em> to the set of direct subclasses of
<em class="replaceable"><code>superclass</code></em>.</p><p class="simpara">When a class is initialized, this generic function is called
once for each direct superclass of the class.</p><p class="simpara">When a class is reinitialized, this generic function is
called once for each added direct superclass of the class. The
generic function <a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a> is called once for each
deleted direct superclass of the class.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a>
(<em class="replaceable"><code>superclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>subclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div><p>
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="remove-direct-subclass"></a>29.3.7.2. Generic Function <a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a> <em class="replaceable"><code>superclass</code></em>
<em class="replaceable"><code>subclass</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>superclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>subclass</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to maintain a set of
backpointers from a class to its direct subclasses. It removes
<em class="replaceable"><code>subclass</code></em> from the set of direct subclasses of <em class="replaceable"><code>superclass</code></em>. No
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if <em class="replaceable"><code>subclass</code></em> is not in this set.</p><p class="simpara">Whenever a class is reinitialized, this generic function is
called once with each deleted direct superclass of the class.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-direct-subclass" title="29.3.7.2. Generic Function CLOS:REMOVE-DIRECT-SUBCLASS"><code class="function">CLOS:REMOVE-DIRECT-SUBCLASS</code></a>
(<em class="replaceable"><code>superclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>subclass</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-direct-subclass" title="29.3.7.1. Generic Function CLOS:ADD-DIRECT-SUBCLASS"><code class="function">CLOS:ADD-DIRECT-SUBCLASS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div></dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-sd"></a>29.4. Slot Definitions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-sd-inheritance">29.4.1. Inheritance Structure of slot definition metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-sd-readers">29.4.2. Introspection: Readers for slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-sd-readers-GFs">29.4.2.1. Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-name">29.4.2.1.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></span></dt><dt><span class="section"><a href="#slotdef-allocation">29.4.2.1.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></span></dt><dt><span class="section"><a href="#slotdef-initform">29.4.2.1.3. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></span></dt><dt><span class="section"><a href="#slotdef-initfunction">29.4.2.1.4. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></span></dt><dt><span class="section"><a href="#slotdef-type">29.4.2.1.5. Generic Function <code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></span></dt><dt><span class="section"><a href="#slotdef-initargs">29.4.2.1.6. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#slotd-mo-readers-methods">29.4.2.2. Methods</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-dsd">29.4.2.3. Readers for direct slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-readers">29.4.2.3.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></span></dt><dt><span class="section"><a href="#slotdef-writers">29.4.2.3.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#slotd-mo-readers-esd">29.4.2.4. Readers for effective slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-location">29.4.2.4.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-sd-init">29.4.3. Initialization of slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-mo-methods">29.4.3.1. Methods</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sd-inheritance"></a>29.4.1. Inheritance Structure of <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-sd-inheritance-fig"></a><p class="title"><strong>Figure 29.3. Inheritance structure of <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-slotdef.png" width="100%" alt="Inheritance structure of slot definition metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sd-readers"></a>29.4.2. Introspection: Readers for <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-sd-readers-GFs">29.4.2.1. Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-name">29.4.2.1.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></span></dt><dt><span class="section"><a href="#slotdef-allocation">29.4.2.1.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></span></dt><dt><span class="section"><a href="#slotdef-initform">29.4.2.1.3. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></span></dt><dt><span class="section"><a href="#slotdef-initfunction">29.4.2.1.4. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></span></dt><dt><span class="section"><a href="#slotdef-type">29.4.2.1.5. Generic Function <code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></span></dt><dt><span class="section"><a href="#slotdef-initargs">29.4.2.1.6. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#slotd-mo-readers-methods">29.4.2.2. Methods</a></span></dt><dt><span class="section"><a href="#slotd-mo-readers-dsd">29.4.2.3. Readers for direct slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-readers">29.4.2.3.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></span></dt><dt><span class="section"><a href="#slotdef-writers">29.4.2.3.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></span></dt></dl></dd><dt><span class="section"><a href="#slotd-mo-readers-esd">29.4.2.4. Readers for effective slot definition metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#slotdef-location">29.4.2.4.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a></span></dt></dl></dd></dl></div><p>The reader generic functions which simply return information
associated with <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s are presented together here
in the format described in <a class="xref" href="#mop-cl-readers" title="29.3.3. Introspection: Readers for class metaobjects">Section 29.3.3, “Introspection: Readers for class metaobjects”</a>.</p><p>Each of the reader generic functions for <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s has the same
syntax, accepting one required argument called <em class="replaceable"><code>slot</code></em>, which must be a
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>; otherwise, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>
has not been initialized.</p><p>These
generic functions can be called by the user or the implementation.</p><p>For any of these generic functions which returns a list, such lists
will not be mutated by the implementation. The results are undefined if a
portable program allows such a list to be mutated.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-sd-readers-GFs"></a>29.4.2.1. Generic Functions</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#slotdef-name">29.4.2.1.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></span></dt><dt><span class="section"><a href="#slotdef-allocation">29.4.2.1.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></span></dt><dt><span class="section"><a href="#slotdef-initform">29.4.2.1.3. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></span></dt><dt><span class="section"><a href="#slotdef-initfunction">29.4.2.1.4. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></span></dt><dt><span class="section"><a href="#slotdef-type">29.4.2.1.5. Generic Function <code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></span></dt><dt><span class="section"><a href="#slotdef-initargs">29.4.2.1.6. Generic Function <code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-name"></a>29.4.2.1.1. Generic Function <a class="link" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME"><code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME"><code class="function">CLOS:SLOT-DEFINITION-NAME</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the name of <em class="replaceable"><code>slot</code></em>. This value is a symbol that can be
used as a variable name. This is the value of the <code class="constant">:NAME</code>
initialization argument that was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during
initialization.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The slot name does not need to be usable as a
variable name. Slot names like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> are perfectly valid.
</p></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-allocation"></a>29.4.2.1.2. Generic Function <a class="link" href="#slotdef-allocation" title="29.4.2.1.2. Generic Function CLOS:SLOT-DEFINITION-ALLOCATION"><code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-allocation" title="29.4.2.1.2. Generic Function CLOS:SLOT-DEFINITION-ALLOCATION"><code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the allocation of <em class="replaceable"><code>slot</code></em>. This is a symbol. This is
the defaulted value of the <code class="constant">:ALLOCATION</code> initialization argument that
was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-initform"></a>29.4.2.1.3. Generic Function <a class="link" href="#slotdef-initform" title="29.4.2.1.3. Generic Function CLOS:SLOT-DEFINITION-INITFORM"><code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-initform" title="29.4.2.1.3. Generic Function CLOS:SLOT-DEFINITION-INITFORM"><code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the initialization form of <em class="replaceable"><code>slot</code></em>. This can be any
form. This is the defaulted value of the <code class="constant">:INITFORM</code> initialization
argument that was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.
When <em class="replaceable"><code>slot</code></em> has no initialization form, the value returned is
unspecified (however, <a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a> is guaranteed to return
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-initfunction"></a>29.4.2.1.4. Generic Function <a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the initialization function of <em class="replaceable"><code>slot</code></em>. This value is
either a function of no arguments, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, indicating that the slot
has no initialization function. This is the defaulted value of the
<code class="constant">:INITFUNCTION</code> initialization argument that was associated with the
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-type"></a>29.4.2.1.5. Generic Function <a class="link" href="#slotdef-type" title="29.4.2.1.5. Generic Function CLOS:SLOT-DEFINITION-TYPE"><code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-type" title="29.4.2.1.5. Generic Function CLOS:SLOT-DEFINITION-TYPE"><code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the type of <em class="replaceable"><code>slot</code></em>. This is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> name.
This is the defaulted value of the <code class="constant">:TYPE</code> initialization argument that
was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-initargs"></a>29.4.2.1.6. Generic Function <a class="link" href="#slotdef-initargs" title="29.4.2.1.6. Generic Function CLOS:SLOT-DEFINITION-INITARGS"><code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-initargs" title="29.4.2.1.6. Generic Function CLOS:SLOT-DEFINITION-INITARGS"><code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a> <em class="replaceable"><code>slot</code></em>)</code></h6></div></div></div><p>Returns the set of initialization argument keywords for <em class="replaceable"><code>slot</code></em>.
This is the defaulted value of the <code class="constant">:INITARGS</code> initialization argument
that was associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slotd-mo-readers-methods"></a>29.4.2.2. Methods</h4></div></div></div><div class="variablelist"><p class="title"><strong>The specified methods for the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> readers</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME"><code class="function">CLOS:SLOT-DEFINITION-NAME</code></a>
(<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-allocation" title="29.4.2.1.2. Generic Function CLOS:SLOT-DEFINITION-ALLOCATION"><code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a>
(<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-initform" title="29.4.2.1.3. Generic Function CLOS:SLOT-DEFINITION-INITFORM"><code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a>
(<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a>
(<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-type" title="29.4.2.1.5. Generic Function CLOS:SLOT-DEFINITION-TYPE"><code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a>
(<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-initargs" title="29.4.2.1.6. Generic Function CLOS:SLOT-DEFINITION-INITARGS"><code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a>
(<em class="replaceable"><code>slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd>No behavior is specified for these
methods beyond that which is specified for their respective generic
functions.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slotd-mo-readers-dsd"></a>29.4.2.3. Readers for <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#slotdef-readers">29.4.2.3.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></span></dt><dt><span class="section"><a href="#slotdef-writers">29.4.2.3.2. Generic Function <code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></span></dt></dl></div><p>The following additional reader generic functions are defined for
<a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-readers"></a>29.4.2.3.1. Generic Function <a class="link" href="#slotdef-readers" title="29.4.2.3.1. Generic Function CLOS:SLOT-DEFINITION-READERS"><code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-readers" title="29.4.2.3.1. Generic Function CLOS:SLOT-DEFINITION-READERS"><code class="function">CLOS:SLOT-DEFINITION-READERS</code></a> <em class="replaceable"><code>direct-slot-definition</code></em>)</code></h6></div></div></div><p>Returns a (possibly empty) set of readers of the <em class="replaceable"><code>direct-slot-definition</code></em>. This
value is a list of function names. This is the defaulted value of the
<code class="constant">:READERS</code> initialization argument that was associated with the direct
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-writers"></a>29.4.2.3.2. Generic Function <a class="link" href="#slotdef-writers" title="29.4.2.3.2. Generic Function CLOS:SLOT-DEFINITION-WRITERS"><code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-writers" title="29.4.2.3.2. Generic Function CLOS:SLOT-DEFINITION-WRITERS"><code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a> <em class="replaceable"><code>direct-slot-definition</code></em>)</code></h6></div></div></div><p>Returns a (possibly empty) set of writers of the <em class="replaceable"><code>direct-slot-definition</code></em>. This
value is a list of function names. This is the defaulted value of the
<code class="constant">:WRITERS</code> initialization argument that was associated with the direct
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> during initialization.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-readers" title="29.4.2.3.1. Generic Function CLOS:SLOT-DEFINITION-READERS"><code class="function">CLOS:SLOT-DEFINITION-READERS</code></a>
(<em class="replaceable"><code>direct-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-writers" title="29.4.2.3.2. Generic Function CLOS:SLOT-DEFINITION-WRITERS"><code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a>
(<em class="replaceable"><code>direct-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd>No behavior is specified for these
methods beyond that which is specified for their respective generic
functions.</dd></dl></div><p>
</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slotd-mo-readers-esd"></a>29.4.2.4. Readers for <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#slotdef-location">29.4.2.4.1. Generic Function <code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a></span></dt></dl></div><p>The following reader generic function is defined for effective
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="slotdef-location"></a>29.4.2.4.1. Generic Function <a class="link" href="#slotdef-location" title="29.4.2.4.1. Generic Function CLOS:SLOT-DEFINITION-LOCATION"><code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a></h5></div><div><h6 class="subtitle"><code class="code">(<a class="link" href="#slotdef-location" title="29.4.2.4.1. Generic Function CLOS:SLOT-DEFINITION-LOCATION"><code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a> <em class="replaceable"><code>effective-slot-definition</code></em>)</code></h6></div></div></div><p>Returns the location of <em class="replaceable"><code>effective-slot-definition</code></em>. The meaning and interpretation
of this value is described in <a class="xref" href="#mop-sa-instance-struct" title="29.10.1. Instance Structure Protocol">Section 29.10.1, “Instance Structure Protocol”</a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slotdef-location" title="29.4.2.4.1. Generic Function CLOS:SLOT-DEFINITION-LOCATION"><code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a>
(<em class="replaceable"><code>effective-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd>This method returns the value stored by
<span class="method"><code class="literal"><a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> <code class="constant">:AROUND</code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>)</code></span> and
<span class="method"><code class="literal"><a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> <code class="constant">:AROUND</code>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span>.
</dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sd-init"></a>29.4.3. Initialization of <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#slotdef-mo-methods">29.4.3.1. Methods</a></span></dt></dl></div><p>A <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> can be created by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The
initialization arguments establish the definition of the slot
definition. A <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> cannot be redefined; calling
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p>Initialization of a <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
and allowing it to call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>.
Portable programs must <span class="strong"><strong>not</strong></span>...</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> directly to
initialize a <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> directly to
initialize a <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> to change the class of any
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> or to turn a non-slot-definition object into a
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</li></ul></div><p>Since metaobject classes may not be redefined, no behavior is
specified for the result of calls to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> on <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s. Since the class of a
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> cannot be changed, no behavior is specified for the result of
calls to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_ferent-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</code></a> on <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s.</p><p>During initialization, each initialization argument is checked for
errors and then associated with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>. The value can then be
accessed by calling the appropriate accessor as shown in
<a class="xref" href="#slotd-mo-initargs" title="Table 29.3. Initialization arguments and accessors for slot definition metaobjects">Table 29.3, “Initialization arguments and accessors for slot definition metaobjects”</a>.</p><p>This section begins with a description of the error checking and
processing of each initialization argument. This is followed by a table
showing the generic functions that can be used to access the stored
initialization arguments.</p><p>In these descriptions, the phrase <span class="quote">“<span class="quote">this argument defaults to
<em class="replaceable"><code>value</code></em></span>”</span> means that when that initialization argument is not
supplied, initialization is performed as if <em class="replaceable"><code>value</code></em> had been supplied.
For some initialization arguments this could be done by the use of
default initialization arguments, but whether it is done this way is not
specified. Implementations are free to define default initialization
arguments for specified <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> classes. Portable programs are free to
define default initialization arguments for portable subclasses of the
class <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara">The <code class="constant">:NAME</code> argument is a slot name. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
if this argument is not a symbol which can be used as a variable
name. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument is not supplied.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The <code class="constant">:NAME</code> argument does not need to be
usable as a variable name. Slot names like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> are
perfectly valid.</p></div></li><li class="listitem">The <code class="constant">:INITFORM</code> argument is a form. The
<code class="constant">:INITFORM</code> argument defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the
<code class="constant">:INITFORM</code> argument is supplied, but the <code class="constant">:INITFUNCTION</code> argument
is not supplied.</li><li class="listitem">The <code class="constant">:INITFUNCTION</code> argument is a function of zero
arguments which, when called, evaluates the <code class="constant">:INITFORM</code> in the
appropriate <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>. The <code class="constant">:INITFUNCTION</code> argument
defaults to false. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <code class="constant">:INITFUNCTION</code> argument is
supplied, but the <code class="constant">:INITFORM</code> argument is not supplied.</li><li class="listitem">The <code class="constant">:TYPE</code> argument is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a> name. An
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed otherwise. The <code class="constant">:TYPE</code> argument defaults to the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.
</li><li class="listitem">The <code class="constant">:ALLOCATION</code> argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>. An
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed otherwise. The <code class="constant">:ALLOCATION</code> argument defaults to the
symbol <code class="constant">:INSTANCE</code>.</li><li class="listitem">The <code class="constant">:INITARGS</code> argument is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s.
An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>, or if any
element of this list is not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>. The <code class="constant">:INITARGS</code> argument
defaults to the empty list.</li><li class="listitem">The <code class="constant">:READERS</code> and <code class="constant">:WRITERS</code> arguments are
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>s of function names. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if they are not
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>s, or if any element is not a valid function name.
They default to the empty list. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if either of these
arguments is supplied and the metaobject is not a <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a>.
</li><li class="listitem">The <code class="constant">:DOCUMENTATION</code> argument is
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if it is not. This argument default
to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> during initialization.</li></ul></div><p>After the processing and defaulting of initialization arguments
described above, the value of each initialization argument is associated
with the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>. These values can then be accessed by calling the
corresponding generic function. The correspondences are as follows:
</p><div class="table"><a id="slotd-mo-initargs"></a><p class="title"><strong>Table 29.3. Initialization arguments and
accessors for <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>s</strong></p><div class="table-contents"><table class="table" summary="Initialization arguments and accessors for slot definition metaobjects" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Initialization Argument</th><th align="center">Generic Function</th></tr></thead><tbody><tr><td align="center"><code class="constant">:NAME</code></td><td align="center"><a class="link" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME"><code class="function">CLOS:SLOT-DEFINITION-NAME</code></a></td></tr><tr><td align="center"><code class="constant">:INITFORM</code></td><td align="center"><a class="link" href="#slotdef-initform" title="29.4.2.1.3. Generic Function CLOS:SLOT-DEFINITION-INITFORM"><code class="function">CLOS:SLOT-DEFINITION-INITFORM</code></a></td></tr><tr><td align="center"><code class="constant">:INITFUNCTION</code></td><td align="center"><a class="link" href="#slotdef-initfunction" title="29.4.2.1.4. Generic Function CLOS:SLOT-DEFINITION-INITFUNCTION"><code class="function">CLOS:SLOT-DEFINITION-INITFUNCTION</code></a></td></tr><tr><td align="center"><code class="constant">:TYPE</code></td><td align="center"><a class="link" href="#slotdef-type" title="29.4.2.1.5. Generic Function CLOS:SLOT-DEFINITION-TYPE"><code class="function">CLOS:SLOT-DEFINITION-TYPE</code></a></td></tr><tr><td align="center"><code class="constant">:ALLOCATION</code></td><td align="center"><a class="link" href="#slotdef-allocation" title="29.4.2.1.2. Generic Function CLOS:SLOT-DEFINITION-ALLOCATION"><code class="function">CLOS:SLOT-DEFINITION-ALLOCATION</code></a></td></tr><tr><td align="center"><code class="constant">:INITARGS</code></td><td align="center"><a class="link" href="#slotdef-initargs" title="29.4.2.1.6. Generic Function CLOS:SLOT-DEFINITION-INITARGS"><code class="function">CLOS:SLOT-DEFINITION-INITARGS</code></a></td></tr><tr><td align="center"><code class="constant">:READERS</code></td><td align="center"><a class="link" href="#slotdef-readers" title="29.4.2.3.1. Generic Function CLOS:SLOT-DEFINITION-READERS"><code class="function">CLOS:SLOT-DEFINITION-READERS</code></a></td></tr><tr><td align="center"><code class="constant">:WRITERS</code></td><td align="center"><a class="link" href="#slotdef-writers" title="29.4.2.3.2. Generic Function CLOS:SLOT-DEFINITION-WRITERS"><code class="function">CLOS:SLOT-DEFINITION-WRITERS</code></a></td></tr><tr><td align="center"><code class="constant">:DOCUMENTATION</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></td></tr></tbody></table></div></div><p><br class="table-break" /></p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slotdef-mo-methods"></a>29.4.3.1. Methods</h4></div></div></div><p>It is not specified which methods provide the initialization and
reinitialization behavior described above. Instead, the information
needed to allow portable programs to specialize this behavior is
presented as a set of restrictions on the methods a portable program can
define. The model is that portable initialization methods have access
to the <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> when either all or none of the specified initialization
has taken effect.</p><p>These restrictions govern the methods that a portable program can
define on the generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>. These restrictions
apply only to methods on these generic functions for which the first
specializer is a subclass of the class <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a>. Other portable
methods on these generic functions are not affected by these
restrictions.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not define methods on
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.</li><li class="listitem"><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Portable programs must not define primary methods.
</li><li class="listitem">Portable programs may define around-methods, but
these must be extending, not overriding methods.</li><li class="listitem">Portable before-methods must assume that when they
are run, none of the initialization behavior described above has been
completed.</li><li class="listitem">Portable after-methods must assume that when they
are run, all of the initialization behavior described above has been
completed.</li></ul></div></li></ul></div><p>The results are undefined if any of
these restrictions are violated.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-gf"></a>29.5. Generic Functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-gf-inheritance">29.5.1. Inheritance Structure of generic function metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-gf-readers">29.5.2. Introspection: Readers for generic function metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#gf-name">29.5.2.1. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></span></dt><dt><span class="section"><a href="#gf-methods">29.5.2.2. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a></span></dt><dt><span class="section"><a href="#gf-lambda-list">29.5.2.3. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#gf-argument-precedence-order">29.5.2.4. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></span></dt><dt><span class="section"><a href="#gf-declarations">29.5.2.5. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></span></dt><dt><span class="section"><a href="#gf-method-class">29.5.2.6. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#gf-method-combination">29.5.2.7. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></span></dt><dt><span class="section"><a href="#gf-name-methods">29.5.2.8. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-gf-init">29.5.3. Initialization of Generic Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-gf-init-defgeneric">29.5.3.1. Macro <code class="function">DEFGENERIC</code></a></span></dt><dt><span class="section"><a href="#mop-gf-invocation">29.5.3.2. Generic Function Invocation Protocol</a></span></dt><dt><span class="section"><a href="#mop-gf-init-mo">29.5.3.3. Initialization of generic function metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#gf-mo-init-methods">29.5.3.3.1. Methods</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-gf-customize">29.5.4. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#setf-gf-name">29.5.4.1. Generic Function <code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-gf">29.5.4.2. Generic Function <code class="function">ENSURE-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#ensure-gf-UC">29.5.4.3. Generic Function <code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#mop-add-method">29.5.4.4. Generic Function <code class="function">ADD-METHOD</code></a></span></dt><dt><span class="section"><a href="#mop-remove-method">29.5.4.5. Generic Function <code class="function">REMOVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods">29.5.4.6. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods-UC">29.5.4.7. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method">29.5.4.8. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method-as-function">29.5.4.9. Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#make-method-lambda">29.5.4.10. Generic Function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a></span></dt><dt><span class="section"><a href="#compute-discriminating-function">29.5.4.11. Generic Function <code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-gf-inheritance"></a>29.5.1. Inheritance Structure of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-gf-inheritance-fig"></a><p class="title"><strong>Figure 29.4. Inheritance structure of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-genfun.png" width="100%" alt="Inheritance structure of generic function metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-gf-readers"></a>29.5.2. Introspection: Readers for <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gf-name">29.5.2.1. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></span></dt><dt><span class="section"><a href="#gf-methods">29.5.2.2. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a></span></dt><dt><span class="section"><a href="#gf-lambda-list">29.5.2.3. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#gf-argument-precedence-order">29.5.2.4. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></span></dt><dt><span class="section"><a href="#gf-declarations">29.5.2.5. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></span></dt><dt><span class="section"><a href="#gf-method-class">29.5.2.6. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#gf-method-combination">29.5.2.7. Generic Function <code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></span></dt><dt><span class="section"><a href="#gf-name-methods">29.5.2.8. Methods</a></span></dt></dl></div><p>The reader generic functions which simply return information
associated with <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s are presented together here in the format
described in <a class="xref" href="#mop-cl-readers" title="29.3.3. Introspection: Readers for class metaobjects">Section 29.3.3, “Introspection: Readers for class metaobjects”</a>.</p><p>Each of the reader generic functions for <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s has the same
syntax, accepting one required argument called <em class="replaceable"><code>generic-function</code></em>, which must be a
<a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>; otherwise, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the
<a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> has not been initialized.</p><p>These
generic functions can be called by the user or the implementation.</p><p>For any of these generic functions which returns a list, such lists
will not be mutated by the implementation. The results are undefined if a
portable program allows such a list to be mutated.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-name"></a>29.5.2.1. Generic Function <a class="link" href="#gf-name" title="29.5.2.1. Generic Function CLOS:GENERIC-FUNCTION-NAME"><code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-name" title="29.5.2.1. Generic Function CLOS:GENERIC-FUNCTION-NAME"><code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the name of the generic function, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the generic
function has no name. This is the defaulted value of the <code class="constant">:NAME</code>
initialization argument that was associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during
initialization or reinitialization.
(See also <a class="link" href="#setf-gf-name" title="29.5.4.1. Generic Function (SETF CLOS:GENERIC-FUNCTION-NAME)"><code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a>.)</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-methods"></a>29.5.2.2. Generic Function <a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the set of methods currently connected to the generic
function. This is a set of <a class="link" href="#mop-method-mo">method metaobject</a>s. This value is maintained by the
generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-lambda-list"></a>29.5.2.3. Generic Function <a class="link" href="#gf-lambda-list" title="29.5.2.3. Generic Function CLOS:GENERIC-FUNCTION-LAMBDA-LIST"><code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-lambda-list" title="29.5.2.3. Generic Function CLOS:GENERIC-FUNCTION-LAMBDA-LIST"><code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the generic function. This is the
defaulted value of the <code class="constant">:LAMBDA-LIST</code> initialization argument that was
associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during initialization or reinitialization.
An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> has yet to be supplied.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-argument-precedence-order"></a>29.5.2.4. Generic Function <a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the argument precedence order of the generic function.
This value is a list of symbols, a permutation of the required
parameters in the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the generic function. This is the
defaulted value of the <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code> initialization
argument that was associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during initialization or
reinitialization.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> has not yet been
supplied.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-declarations"></a>29.5.2.5. Generic Function <a class="link" href="#gf-declarations" title="29.5.2.5. Generic Function CLOS:GENERIC-FUNCTION-DECLARATIONS"><code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-declarations" title="29.5.2.5. Generic Function CLOS:GENERIC-FUNCTION-DECLARATIONS"><code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns a possibly empty list of the <span class="quote">“<span class="quote">declarations</span>”</span>
of the generic function. The elements of this list are
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>s. This list is the defaulted value of the
<code class="constant">:DECLARATIONS</code> initialization argument that was associated with the
<a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during initialization or reinitialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-method-class"></a>29.5.2.6. Generic Function <a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the default method class of the generic function. This
class must be a subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>. This is the defaulted
value of the <code class="constant">:METHOD-CLASS</code> initialization argument that was
associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during initialization or reinitialization.
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-method-combination"></a>29.5.2.7. Generic Function <a class="link" href="#gf-method-combination" title="29.5.2.7. Generic Function CLOS:GENERIC-FUNCTION-METHOD-COMBINATION"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#gf-method-combination" title="29.5.2.7. Generic Function CLOS:GENERIC-FUNCTION-METHOD-COMBINATION"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a> <em class="replaceable"><code>generic-function</code></em>)</code></h5></div></div></div><p>Returns the method combination of the generic function. This is a
<a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>. This is the defaulted value of the <code class="constant">:METHOD-COMBINATION</code>
initialization argument that was associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> during
initialization or reinitialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="gf-name-methods"></a>29.5.2.8. Methods</h4></div></div></div><div class="variablelist"><p class="title"><strong>The specified methods for the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> reader generic
functions</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-name" title="29.5.2.1. Generic Function CLOS:GENERIC-FUNCTION-NAME"><code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-lambda-list" title="29.5.2.3. Generic Function CLOS:GENERIC-FUNCTION-LAMBDA-LIST"><code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-declarations" title="29.5.2.5. Generic Function CLOS:GENERIC-FUNCTION-DECLARATIONS"><code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-method-combination" title="29.5.2.7. Generic Function CLOS:GENERIC-FUNCTION-METHOD-COMBINATION"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span></span></dt><dd>No behavior is specified for these
methods beyond that which is specified for their respective generic
functions.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p class="simpara">The value returned by this method is maintained by
<span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</code></span> and
<span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</code></span>.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-gf-init"></a>29.5.3. Initialization of Generic Functions</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-gf-init-defgeneric">29.5.3.1. Macro <code class="function">DEFGENERIC</code></a></span></dt><dt><span class="section"><a href="#mop-gf-invocation">29.5.3.2. Generic Function Invocation Protocol</a></span></dt><dt><span class="section"><a href="#mop-gf-init-mo">29.5.3.3. Initialization of generic function metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#gf-mo-init-methods">29.5.3.3.1. Methods</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-gf-init-defgeneric"></a>29.5.3.1. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a></h4></div></div></div><p>The evaluation or execution of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form results in a
call to the <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> function. The arguments received by <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>
are derived from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form in a defined way. As with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>, the exact macro-expansion of the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form is not defined, only the relationship between the
arguments to the macro and the arguments received by <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>function-name</code></em>
argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> becomes the first argument to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.
This is the only positional argument accepted by <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>; all other
arguments are keyword arguments.</li><li class="listitem">The <em class="replaceable"><code>lambda-list</code></em> argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> becomes the value
of the <code class="constant">:LAMBDA-LIST</code> keyword argument to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.</li><li class="listitem"><p class="simpara">For each of the options <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code>,
<code class="constant">:DOCUMENTATION</code>, <code class="constant">:GENERIC-FUNCTION-CLASS</code> and <code class="constant">:METHOD-CLASS</code>, the value of the
option becomes the value of the keyword argument with the same name.
If the option does not appear in the macro form, the keyword argument
does not appear in the resulting call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If the option does not appear in the macro form,
the keyword argument appears in the resulting call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>, with a
default value: the <em class="replaceable"><code>lambda-list</code></em> for <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for
<code class="constant">:DOCUMENTATION</code>, the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> for <code class="constant">:GENERIC-FUNCTION-CLASS</code>,
the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a> for <code class="constant">:METHOD-CLASS</code>.
This is needed to make the generic function reflect the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.
</p></div></li><li class="listitem"><p class="simpara">For the option <code class="constant">:DECLARE</code>, the list
of <span class="quote">“<span class="quote">declarations</span>”</span> becomes the value of the <code class="constant">:DECLARATIONS</code>
keyword argument. If the <code class="constant">:DECLARE</code> option does not
appear in the macro form, the <code class="constant">:DECLARATIONS</code> keyword argument does not
appear in the call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If the <code class="constant">:DECLARE</code> option does not appear in
the macro form, the <code class="constant">:DECLARATIONS</code> keyword argument appears in the
resulting call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>, with a default value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. This is
needed to make the generic function reflect the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.
</p></div></li><li class="listitem"><p class="simpara">The handling of the <code class="constant">:METHOD-COMBINATION</code> option is
not specified.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>If the <code class="constant">:METHOD-COMBINATION</code> option does not
appear in the macro form, the <code class="constant">:METHOD-COMBINATION</code> keyword argument
still appears in the resulting call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>, but in a position
where it can be overridden by user-defined initargs and default initargs.
</p></div></li><li class="listitem"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The <code class="constant">:DECLARE</code> keyword is
recognized as equivalent to the <code class="constant">:DECLARATIONS</code> keyword, for
compatibility with <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]. If both <code class="constant">:DECLARE</code> and
<code class="constant">:DECLARATIONS</code> keyword arguments are specified, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p>Any other generic function options become the value of
keyword arguments with the same name. The value of the keyword
argument is the tail of the generic function option. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if
any generic function option appears more than once in the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.</p><p>The default initargs of the
<em class="replaceable"><code>generic-function-class</code></em> are added at the
end of the list of arguments to pass to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>. This is needed to
make the generic function reflect the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.</p></div></li><li class="listitem"><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a id="mop-defgeneric-user-options"></a><strong>User-defined options. </strong>Any other options become the value of keyword arguments with
the same name. The value of the keyword argument is the tail of the
option. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if any option appears more than once in the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.</p></div></li></ul></div><p>The result of the call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> is returned as the result of
evaluating or executing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> form.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-gf-invocation"></a>29.5.3.2. Generic Function Invocation Protocol</h4></div></div></div><p>Associated with each generic function is its discriminating
function. Each time the generic function is called, the discriminating
function is called to provide the behavior of the generic function. The
discriminating function receives the full set of arguments received by
the generic function. It must lookup and execute the appropriate
methods, and return the appropriate values.</p><p>The discriminating function is computed by the highest layer of
the generic function invocation protocol, <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a>.
Whenever a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> is initialized, reinitialized, or a method is added or
removed, the discriminating function is recomputed.
The new discriminating function is then stored with
<a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>.</p><p>Discriminating functions call <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>
and <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> to compute the methods
applicable to the generic functions arguments.
Applicable methods are combined by <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> to
produce an <strong class="first"><em class="firstterm">effective method
<a id="effective-method" class="indexterm"></a></em></strong>.
Provisions are made to allow memoization of the method applicability and
effective methods computations. (See the description of
<a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> for details.)</p><p>The body of method definitions are processed by <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>.
The result of this generic function is a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>
which is processed by either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> to produce a
<strong class="first"><em class="firstterm">method function<a id="me-func" class="indexterm"></a></em></strong>.
The arguments received by the method function are controlled by the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> forms appearing in the effective methods.
By default, method functions accept two arguments: a list of arguments
to the generic function, and a list of next methods.
The list of next methods corresponds to the next methods argument to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a>.
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> appears with additional arguments, these will be passed
to the method functions as well; in these cases, <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>
must have created the method lambdas to expect additional arguments.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>See <a class="xref" href="#no-make-method-lambda" title="The generic function CLOS:MAKE-METHOD-LAMBDA is not implemented">The generic function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code> is not implemented</a>.</p><p>See <a class="xref" href="#method-functions-args" title="Method function arguments">Method function arguments</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-gf-init-mo"></a>29.5.3.3. Initialization of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gf-mo-init-methods">29.5.3.3.1. Methods</a></span></dt></dl></div><p>A <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> can be created by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The
initialization arguments establish the definition of the generic
function. A <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> can be redefined by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
Some classes of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> do not support redefinition; in these cases,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p>Initialization of a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
and allowing it to call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>. Reinitialization of a
<a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
Portable programs must <span class="strong"><strong>not</strong></span></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> directly to
initialize a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> directly to
initialize or reinitialize a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> to change the class of any
<a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> or to turn a non-generic-function object into a
<a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</li></ul></div><p>Since metaobject classes may not be redefined,
no behavior is specified for the result of calls to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> on <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s.
Since the class of a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> may not be changed,
no behavior is specified for the results of calls to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_ferent-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</code></a> on <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s.</p><p>During initialization or reinitialization, each initialization
argument is checked for errors and then associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.
The value can then be accessed by calling the appropriate accessor as
shown in <a class="xref" href="#gf-mo-initargs" title="Table 29.4. Initialization arguments and accessors for generic function metaobjects">Table 29.4, “Initialization arguments and accessors for generic function metaobjects”</a>.</p><p>This section begins with a description of the error checking and
processing of each initialization argument. This is followed by a table
showing the generic functions that can be used to access the stored
initialization arguments. The section ends with a set of restrictions on
portable methods affecting <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> initialization and reinitialization.</p><p>In these descriptions, the phrase <span class="quote">“<span class="quote">this argument defaults to
<em class="replaceable"><code>value</code></em></span>”</span> means that when that initialization argument is not
supplied, initialization or reinitialization is performed as if
<em class="replaceable"><code>value</code></em> had been supplied. For some initialization arguments this
could be done by the use of default initialization arguments, but
whether it is done this way is not specified. Implementations are free
to define default initialization arguments for specified <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> classes.
Portable programs are free to define default initialization arguments
for portable subclasses of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>.</p><p>Unless there is a specific note to the
contrary, then during reinitialization, if an initialization argument
is not supplied, the previously stored value is left unchanged.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p class="simpara">The <code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code> argument is a list
of symbols.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument appears but the <code class="constant">:LAMBDA-LIST</code>
argument does not appear. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a> or if this value is not a permutation of the
symbols from the required arguments part of the <code class="constant">:LAMBDA-LIST</code>
initialization argument.</p><p class="simpara">When the generic function is being initialized or
reinitialized, and this argument is not supplied, but the
<code class="constant">:LAMBDA-LIST</code> argument is supplied, this value defaults to the
symbols from the required arguments part of the <code class="constant">:LAMBDA-LIST</code>
argument, in the order they appear in that argument. If neither
argument is supplied, neither are initialized (see the description of
<code class="constant">:LAMBDA-LIST</code>.)</p></li><li class="listitem"><p class="simpara">The <code class="constant">:DECLARATIONS</code> argument is a list of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>s.
</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a> or
if each of its elements is not a legal <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>.</p><p class="simpara">When the generic function is being initialized, and this
argument is not supplied, it defaults to the empty list.
</p></li><li class="listitem">The <code class="constant">:DOCUMENTATION</code> argument is
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if it is not. This argument default
to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> during initialization.</li><li class="listitem"><p class="simpara">The <code class="constant">:LAMBDA-LIST</code> argument is a <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a proper generic function
<a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>.</p><p class="simpara">When the generic function is being initialized, and this
argument is not supplied, the generic function's <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is not
initialized. The <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> will be initialized later, either when
the first method is added to the generic function, or a later
reinitialization of the generic function.</p></li><li class="listitem">The <code class="constant">:METHOD-COMBINATION</code> argument is a <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>.
</li><li class="listitem"><p class="simpara">The <code class="constant">:METHOD-CLASS</code> argument is a <a class="link" href="#mop-class-mo">class metaobject</a>.
</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a subclass of the
class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>.</p><p class="simpara">When the generic function is being initialized, and this
argument is not supplied, it defaults to the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>.
</p></li><li class="listitem"><p class="simpara"> The <code class="constant">:NAME</code> argument is an object.</p><p class="simpara">If the generic function is being initialized, this argument
defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</p></li></ul></div><p>After the processing and defaulting of initialization arguments
described above, the value of each initialization argument is associated
with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>. These values can then be accessed by calling the
corresponding generic function. The correspondences are as follows:
</p><div class="table"><a id="gf-mo-initargs"></a><p class="title"><strong>Table 29.4. Initialization arguments and accessors
for <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s</strong></p><div class="table-contents"><table class="table" summary="Initialization arguments and accessors for generic function metaobjects" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Initialization Argument</th><th align="center">Generic Function</th></tr></thead><tbody><tr><td align="center"><code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code></td><td align="center"><a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a></td></tr><tr><td align="center"><code class="constant">:DECLARATIONS</code></td><td align="center"><a class="link" href="#gf-declarations" title="29.5.2.5. Generic Function CLOS:GENERIC-FUNCTION-DECLARATIONS"><code class="function">CLOS:GENERIC-FUNCTION-DECLARATIONS</code></a></td></tr><tr><td align="center"><code class="constant">:DOCUMENTATION</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></td></tr><tr><td align="center"><code class="constant">:LAMBDA-LIST</code></td><td align="center"><a class="link" href="#gf-lambda-list" title="29.5.2.3. Generic Function CLOS:GENERIC-FUNCTION-LAMBDA-LIST"><code class="function">CLOS:GENERIC-FUNCTION-LAMBDA-LIST</code></a></td></tr><tr><td align="center"><code class="constant">:METHOD-COMBINATION</code></td><td align="center"><a class="link" href="#gf-method-combination" title="29.5.2.7. Generic Function CLOS:GENERIC-FUNCTION-METHOD-COMBINATION"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-COMBINATION</code></a></td></tr><tr><td align="center"><code class="constant">:METHOD-CLASS</code></td><td align="center"><a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a></td></tr><tr><td align="center"><code class="constant">:NAME</code></td><td align="center"><a class="link" href="#gf-name" title="29.5.2.1. Generic Function CLOS:GENERIC-FUNCTION-NAME"><code class="function">CLOS:GENERIC-FUNCTION-NAME</code></a></td></tr></tbody></table></div></div><p><br class="table-break" /></p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="gf-mo-init-methods"></a>29.5.3.3.1. Methods</h5></div></div></div><p>It is not specified which methods provide the initialization and
reinitialization behavior described above. Instead, the information
needed to allow portable programs to specialize this behavior is
presented as a set of restrictions on the methods a portable program can
define. The model is that portable initialization methods have access
to the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> when either all or none of the specified initialization
has taken effect.</p><p>These restrictions govern the methods that a portable program can
define on the generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>. These restrictions
apply only to methods on these generic functions for which the first
specializer is a subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>. Other
portable methods on these generic functions are not affected by these
restrictions.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not define methods on
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>.</li><li class="listitem"><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Portable programs must not define primary methods.
</li><li class="listitem">Portable programs may define around-methods, but
these must be extending, not overriding methods.</li><li class="listitem">Portable before-methods must assume that when they
are run, none of the initialization behavior described above has been
completed.</li><li class="listitem">Portable after-methods must assume that when they
are run, all of the initialization behavior described above has been
completed.</li></ul></div></li></ul></div><p>The results are undefined if any of
these restrictions are violated.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-gf-customize"></a>29.5.4. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#setf-gf-name">29.5.4.1. Generic Function <code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a></span></dt><dt><span class="section"><a href="#ensure-gf">29.5.4.2. Generic Function <code class="function">ENSURE-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#ensure-gf-UC">29.5.4.3. Generic Function <code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#mop-add-method">29.5.4.4. Generic Function <code class="function">ADD-METHOD</code></a></span></dt><dt><span class="section"><a href="#mop-remove-method">29.5.4.5. Generic Function <code class="function">REMOVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods">29.5.4.6. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a></span></dt><dt><span class="section"><a href="#compute-applicable-methods-UC">29.5.4.7. Generic Function <code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method">29.5.4.8. Generic Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a></span></dt><dt><span class="section"><a href="#compute-effective-method-as-function">29.5.4.9. Function <code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#make-method-lambda">29.5.4.10. Generic Function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a></span></dt><dt><span class="section"><a href="#compute-discriminating-function">29.5.4.11. Generic Function <code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="setf-gf-name"></a>29.5.4.1. Generic Function <a class="link" href="#setf-gf-name" title="29.5.4.1. Generic Function (SETF CLOS:GENERIC-FUNCTION-NAME)"><code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#setf-gf-name" title="29.5.4.1. Generic Function (SETF CLOS:GENERIC-FUNCTION-NAME)"><code class="code">(SETF CLOS:GENERIC-FUNCTION-NAME)</code></a> <em class="replaceable"><code>new-name</code></em> <em class="replaceable"><code>generic-function</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>new-name</code></em></span></dt><dd>a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>new-name</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function changes the name of <em class="replaceable"><code>generic-function</code></em> to <em class="replaceable"><code>new-name</code></em>.
This value is usually a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, if the generic function
is to have no name.</p><p class="simpara">This function works by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> with
<em class="replaceable"><code>generic-function</code></em> as its first argument, the symbol <code class="constant">:NAME</code> as its second argument
and <em class="replaceable"><code>new-name</code></em> as its third argument.
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="ensure-gf"></a>29.5.4.2. Generic Function <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> <em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>function-name</code></em></span></dt><dd>a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a></dd><dt><span class="term">keyword arguments</span></dt><dd>Some of the keyword arguments accepted by this
function are actually processed by <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a>, others are
processed during initialization of the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>
(as described in <a class="xref" href="#mop-gf-init-mo" title="29.5.3.3. Initialization of generic function metaobjects">Section 29.5.3.3, “Initialization of generic function metaobjects”</a>).
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to define a globally named
generic function or to specify or modify options and declarations
that pertain to a globally named generic function as a whole. It can
be called by the user or the implementation.</p><p class="simpara">It is the functional equivalent of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>, and is
called by the expansion of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macros.
</p><p class="simpara">The behavior of this function is actually
implemented by the generic function <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a>. When <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>
is called, it immediately calls <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> and returns that
result as its own.</p><p>The first argument to <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> is computed as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If <em class="replaceable"><code>function-name</code></em> names a non-generic
function, a macro, or a special form, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
</li><li class="listitem">If <em class="replaceable"><code>function-name</code></em> names a generic function, that
<a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> is used.</li><li class="listitem">Otherwise, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is used.
</li></ul></div><p class="simpara">The second argument is <em class="replaceable"><code>function-name</code></em>. The remaining arguments
are the complete set of keyword arguments received by <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="ensure-gf-UC"></a>29.5.4.3. Generic Function <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:ARGUMENT-PRECEDENCE-ORDER</code> <code class="constant">:DECLARATIONS</code> <code class="constant">:DOCUMENTATION</code>
<code class="constant">:GENERIC-FUNCTION-CLASS</code> <code class="constant">:LAMBDA-LIST</code> <code class="constant">:METHOD-CLASS</code> <code class="constant">:METHOD-COMBINATION</code>
<code class="constant">:NAME</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><em class="replaceable"><code>function-name</code></em></span></dt><dd>a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a></dd><dt><span class="term"><code class="constant">:GENERIC-FUNCTION-CLASS</code></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a class name.
If it is not supplied, it defaults to the class named
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>. If a class name is supplied, it is
interpreted as the class with that name. If a class name is
supplied, but there is no such class, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
</dd><dt><span class="term">additional keyword arguments</span></dt><dd><p class="simpara">see <a class="xref" href="#mop-gf-init-mo" title="29.5.3.3. Initialization of generic function metaobjects">Section 29.5.3.3, “Initialization of generic function metaobjects”</a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The <code class="constant">:DECLARE</code> keyword is recognized as
equivalent to the <code class="constant">:DECLARATIONS</code> keyword, for compatibility
with <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</p></div></dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">The generic function <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> is called to
define or modify the definition of a globally named generic function.
It is called by the <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> function. It can also be called
directly.</p><p>The first step performed by this generic function is to compute
the set of initialization arguments which will be used to create or
reinitialize the globally named generic function. These
initialization arguments are computed from the full set of keyword
arguments received by this generic function as follows:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <code class="constant">:GENERIC-FUNCTION-CLASS</code>
argument is not included in the initialization arguments.
</li><li class="listitem">If the <code class="constant">:METHOD-CLASS</code> argument was received by
this generic function, it is converted into a <a class="link" href="#mop-class-mo">class metaobject</a>.
This is done by looking up the class name with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_find-class.html" target="_top"><code class="function">FIND-CLASS</code></a>. If
there is no such class, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</li><li class="listitem">All other keyword arguments are included directly
in the initialization arguments.</li></ul></div><p class="simpara">If the <em class="replaceable"><code>generic-function</code></em> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, an instance of the class
specified by the <code class="constant">:GENERIC-FUNCTION-CLASS</code> argument is created by
calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> with the previously computed initialization
arguments. The function name <em class="replaceable"><code>function-name</code></em> is set to name the generic
function. The newly created <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> is returned.
</p><p class="simpara">If the class of the <em class="replaceable"><code>generic-function</code></em> argument is not the same
as the class specified by the <code class="constant">:GENERIC-FUNCTION-CLASS</code> argument, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The description of <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]
specifies that in this case, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> is called if the class of the
<em class="replaceable"><code>generic-function</code></em> argument and the class specified by the <code class="constant">:GENERIC-FUNCTION-CLASS</code> argument are
compatible. Given the description of <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>, this also applies to the
<a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> function. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s implementation calls <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a>
always, and leaves it to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> function to signal an error if
needed.</p></div><p class="simpara">Otherwise the generic function <em class="replaceable"><code>generic-function</code></em> is redefined by calling
the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> generic function with <em class="replaceable"><code>generic-function</code></em> and the
initialization arguments. The <em class="replaceable"><code>generic-function</code></em> argument is then returned.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:GENERIC-FUNCTION-CLASS</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
function in the case where <em class="replaceable"><code>function-name</code></em> names an existing generic
function.</p><p class="simpara">This method can be overridden.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_null.html" target="_top"><code class="classname">NULL</code></a>) <em class="replaceable"><code>function-name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:GENERIC-FUNCTION-CLASS</code>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></span></span></dt><dd>This method implements the behavior of the generic
function in the case where <em class="replaceable"><code>function-name</code></em> names no function, generic
function, macro or special form.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-add-method"></a>29.5.4.4. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>method</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a <a class="link" href="#mop-method-mo">method metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>generic-function</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function associates an unattached
method with a generic function.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the method is not
congruent with the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the generic function.</p><p class="simpara">An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the method is already associated with some
other generic function.</p><p class="simpara">If the given method agrees with an existing method of the
generic function on parameter specializers and qualifiers, the
existing method is removed by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> before the
new method is added. See the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-6-3.html">7.6.3 <span class="quote">“<span class="quote">Agreement on
Parameter Specializers and Qualifiers</span>”</span></a>
for a definition of agreement in this context.</p><p>Associating the method with the generic function then
proceeds in four steps:</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">add <em class="replaceable"><code>method</code></em> to the set returned by
<a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a> and arrange for <a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a> to return <em class="replaceable"><code>generic-function</code></em>;
</li><li class="listitem">call <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a> for each of the method's
specializers;</li><li class="listitem">call <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> and
install its result with <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>; and
</li><li class="listitem">update the dependents of the generic function.
</li></ol></div><p class="simpara">The generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> can be called by the user
or the implementation.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span></span></dt><dd>No behavior is specified for this
method beyond that which is specified for the generic function.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd>This method is specified by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-remove-method"></a>29.5.4.5. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>method</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a <a class="link" href="#mop-method-mo">method metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>generic-function</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function breaks the association between
a generic function and one of its methods.</p><p class="simpara">No <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the method is not among the methods of the
generic function.</p><p>Breaking the association between the method and the generic
function proceeds in four steps:</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">remove <em class="replaceable"><code>method</code></em> from the set returned by
<a class="link" href="#gf-methods" title="29.5.2.2. Generic Function CLOS:GENERIC-FUNCTION-METHODS"><code class="function">CLOS:GENERIC-FUNCTION-METHODS</code></a> and arrange for <a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a> to return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>;
</li><li class="listitem">call <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a> for each of the
method's specializers;</li><li class="listitem">call <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> and
install its result with <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>;
and</li><li class="listitem">update the dependents of the generic function.
</li></ol></div><p class="simpara">The generic function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> can be called by the
user or the implementation.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span></span></dt><dd>No behavior is specified for this
method beyond that which is specified for the generic function.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd>This method is specified by [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-applicable-methods"></a>29.5.4.6. Generic Function <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>
<em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>arguments</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>arguments</code></em></span></dt><dd>a list of objects.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A possibly empty list of <a class="link" href="#mop-method-mo">method metaobject</a>s.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function determines the method
applicability of a generic function given a list of required
arguments. The returned list of <a class="link" href="#mop-method-mo">method metaobject</a>s is sorted by
precedence order with the most specific method appearing first. If
no methods are applicable to the supplied arguments the empty list is
returned.</p><p class="simpara">When a generic function is invoked, the
discriminating function must determine the ordered list of methods
applicable to the arguments. Depending on the generic function and
the arguments, this is done in one of three ways: using a memoized
value; calling <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>; or calling
<a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>.
(Refer to the description of <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> for
the details of this process.)</p><p class="simpara">The <em class="replaceable"><code>arguments</code></em> argument is permitted to contain more elements
than the generic function accepts required arguments; in these cases
the extra arguments will be ignored. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if <em class="replaceable"><code>arguments</code></em>
contains fewer elements than the generic function accepts required
arguments.</p><p class="simpara">The list returned by this function
will not be mutated by the implementation. The results are undefined
if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>arguments</code></em>)</code></span></span></dt><dd><p class="simpara">This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if any method of the generic
function has a specializer which is neither a <a class="link" href="#mop-class-mo">class metaobject</a> nor an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer metaobject.</p><p class="simpara">Otherwise, this method computes the sorted list of applicable
methods according to the rules described in the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] section
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_7-6-6.html">7.6.6 <span class="quote">“<span class="quote">Method Selection
and Combination</span>”</span></a></p><p class="simpara">This method can be overridden. Because of the consistency
requirements between this generic function and
<a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>, doing so may require also overriding
<span class="method"><code class="literal"><a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span>.
</p></dd></dl></div><p><a id="mop-cam-remarks"></a><strong>Remarks. </strong>See also the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_com_able-methods.html" target="_top"><code class="function">COMPUTE-APPLICABLE-METHODS</code></a>.
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-applicable-methods-UC"></a>29.5.4.7. Generic Function <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>
<em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>classes</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>classes</code></em></span></dt><dd>a list of <a class="link" href="#mop-class-mo">class metaobject</a>s.
</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">A possibly empty list of <a class="link" href="#mop-method-mo">method metaobject</a>s.
</li><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></li></ol></div></dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to attempt to
determine the method applicability of a generic function given only
the classes of the required arguments.</p><p class="simpara">If it is possible to completely determine the ordered list of
applicable methods based only on the supplied classes, this generic
function returns that list as its <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> and true as its second
value. The returned list of <a class="link" href="#mop-method-mo">method metaobject</a>s is sorted by
precedence order, the most specific method coming first. If no
methods are applicable to arguments with the specified classes, the
empty list and true are returned.</p><p class="simpara">If it is not possible to completely determine the ordered
list of applicable methods based only on the supplied classes, this
generic function returns an unspecified <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> and false as its
second value.</p><p class="simpara">When a generic function is invoked, the
discriminating function must determine the ordered list of methods
applicable to the arguments. Depending on the generic function and
the arguments, this is done in one of three ways: using a memoized
value; calling <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>; or calling
<a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>.
(Refer to the description of <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> for
the details of this process.)</p><p class="simpara">The following consistency relationship between
<a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> and <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a> must
be maintained: for any given generic function and set of arguments,
if <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> returns a second value of true,
the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> must be equal to the value that would be returned by
a corresponding call to <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>. The results
are undefined if a portable method on either of these generic
functions causes this consistency to be violated.</p><p class="simpara">The list returned by this function
will not be mutated by the implementation. The results are undefined
if a portable program mutates the list returned by this function.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>classes</code></em>)</code></span></span></dt><dd><p class="simpara">If any method of the generic function has a
specializer which is neither a <a class="link" href="#mop-class-mo">class metaobject</a> nor an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a>
specializer metaobject, this method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p class="simpara">In cases where the generic function has no methods with
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers, or has no methods with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers
that could be applicable to arguments of the supplied classes, this
method returns the ordered list of applicable methods as its first
value and true as its second value.</p><p class="simpara">Otherwise this method returns an unspecified <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> and
false as its second value.</p><p class="simpara">This method can be overridden. Because of the consistency
requirements between this generic function and
<a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>, doing so may require also overriding
<span class="method"><code class="literal"><a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>) </code></span>.
</p></dd></dl></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="mop-cam-UC-remarks"></a>Remarks</h5></div></div></div><p>This generic function exists to allow user extensions which alter
method lookup rules, but which base the new rules only on the classes of
the required arguments, to take advantage of the class-based method
lookup memoization found in many implementations. (There is of course
no requirement for an implementation to provide this optimization.)</p><p>Such an extension can be implemented by two methods, one on this
generic function and one on <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>. Whenever
the user extension is in effect, the first method will return a second
value of true. This should allow the implementation to absorb these
cases into its own memoization scheme.</p><p>To get appropriate performance, other kinds of extensions may
require methods on <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> which implement
their own memoization scheme.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-effective-method"></a>29.5.4.8. Generic Function <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> <em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>method-combination</code></em>
<em class="replaceable"><code>methods</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method-combination</code></em></span></dt><dd>a <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>methods</code></em></span></dt><dd>a list of <a class="link" href="#mop-method-mo">method metaobject</a>s.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">An effective method</li><li class="listitem">A list of effective method options
</li></ol></div></dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine the
effective method from a sorted list of <a class="link" href="#mop-method-mo">method metaobject</a>s.</p><p class="simpara">An effective method is a form that describes how the
applicable methods are to be combined. Inside of effective method
forms are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> forms which indicate that a particular
method is to be called. The arguments to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> form
indicate exactly how the method function of the method should be
called. (See <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> for more details about method
functions.)</p><p class="simpara">An effective method option has the same interpretation and
syntax as either the <code class="constant">:ARGUMENTS</code> or the <code class="constant">:GENERIC-FUNCTION</code> option in the long form
of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a>.</p><p class="simpara">More information about the form and interpretation of
effective methods and effective method options can be found under
the description of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a> macro in the
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> specification.</p><p class="simpara">This generic function can be called by the user or the
implementation. It is called by discriminating functions whenever a
sorted list of applicable methods must be converted to an effective
method.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>method-combination</code></em> <em class="replaceable"><code>methods</code></em>)</code></span></span></dt><dd><p class="simpara">This method computes the effective method according
to the rules of the method combination type implemented by <em class="replaceable"><code>method-combination</code></em>.</p><p class="simpara">This method can be overridden.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The second return value may contain only one
<code class="constant">:ARGUMENTS</code> option and only one <code class="constant">:GENERIC-FUNCTION</code> option. When overriding a
<a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> method, before adding an <code class="constant">:ARGUMENTS</code> or
<code class="constant">:GENERIC-FUNCTION</code> option, you therefore need to check whether it this option is
already present.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-effective-method-as-function"></a>29.5.4.9. Function <a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p></p></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a>
<em class="replaceable"><code>generic-function</code></em> <em class="replaceable"><code>methods</code></em> <em class="replaceable"><code>arguments</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>methods</code></em></span></dt><dd>a list of <a class="link" href="#mop-method-mo">method metaobject</a>s.</dd><dt><span class="term"><em class="replaceable"><code>arguments</code></em></span></dt><dd>a list of arguments.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The effective method as a function, accepting any
set of arguments for which all of the given methods are applicable.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to determine the effective method
from a sorted list of <a class="link" href="#mop-method-mo">method metaobject</a>s, and convert it to a function.
The <em class="replaceable"><code>arguments</code></em> are a set of arguments to which the methods are applicable,
and are used solely for error message purposes.</p><p class="simpara">This function calls <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> using the <em class="replaceable"><code>generic-function</code></em>'s
method combination, wraps local macro definitions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">MAKE-METHOD</code></a> around it, handles the <code class="constant">:ARGUMENTS</code> and <code class="constant">:GENERIC-FUNCTION</code> options,
and compiles the resulting form to a function.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="make-method-lambda"></a>29.5.4.10. Generic Function <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> <em class="replaceable"><code>generic-function</code></em>
<em class="replaceable"><code>method</code></em> <em class="replaceable"><code>lambda-expression</code></em> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a (possibly uninitialized) <a class="link" href="#mop-method-mo">method metaobject</a>.
</dd><dt><span class="term"><em class="replaceable"><code>lambda-expression</code></em></span></dt><dd>a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>.</dd><dt><span class="term"><em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em></span></dt><dd>the same as the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&ENVIRONMENT</code></a> argument to
macro expansion functions.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">A <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a></li><li class="listitem">A list of initialization arguments and values
</li></ol></div></dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to produce a
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> which can itself be used to produce a method function
for a method and generic function with the specified classes.
The generic function and method the method function will be used with
are not required to be the given ones.
Moreover, the <a class="link" href="#mop-method-mo">method metaobject</a> may be uninitialized.</p><p class="simpara">Either the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile.html" target="_top"><code class="function">COMPILE</code></a>, the special form <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a> or
the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a> must be used to convert the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> a
method function. The method function itself can be applied to
arguments with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>.</p><p class="simpara">When a method is actually called by an effective method, its
first argument will be a list of the arguments to the generic
function. Its remaining arguments will be all but the first argument
passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a>. By default, all method functions must
accept two arguments: the list of arguments to the generic function
and the list of next methods.</p><p class="simpara">For a given generic function and method class, the applicable
methods on <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> and <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> must
be consistent in the following way: each use of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a>
returned by the method on <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> must have the
same number of arguments, and the method lambda returned by the
method on <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> must accept a corresponding number of
arguments.</p><p class="simpara">Note that the system-supplied implementation of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is not required to handle extra arguments to the
method function. Users who define additional arguments to the method
function must either redefine or forego <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a>. (See the
example below.)</p><p class="simpara">When the <a class="link" href="#mop-method-mo">method metaobject</a> is created with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>, the method
function must be the value of the <code class="constant">:FUNCTION</code> initialization
argument. The additional initialization arguments, returned as the
second value of this generic function, must also be passed in this
call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>)
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>) <em class="replaceable"><code>lambda-expression</code></em> <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>)</code></span></span></dt><dd><p class="simpara">This method returns a method lambda which accepts two
arguments, the list of arguments to the generic function, and the list
of next methods. What initialization arguments may be returned in the
second value are unspecified.</p><p class="simpara">This method can be overridden.</p></dd></dl></div><div class="informalexample"><a id="make-method-lambda-ex"></a><p>This example shows how to define a kind of method which, from
within the body of the method, has access to the actual <a class="link" href="#mop-method-mo">method metaobject</a> for the
method. This simplified code overrides whatever method combination is
specified for the generic function, implementing a simple method
combination supporting only primary methods, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_next-method-p.html" target="_top"><code class="function">NEXT-METHOD-P</code></a>. (In addition, its a simplified version of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> which does no error checking.)</p><p>Notice that the extra lexical function bindings get wrapped around
the body before <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> is called. In this way, the user's
definition of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_next-method-p.html" target="_top"><code class="function">NEXT-METHOD-P</code></a> are sure to
override the system's definitions.</p><pre class="programlisting">
(defclass my-generic-function (standard-generic-function)
()
(:default-initargs :method-class (find-class 'my-method)))
(defclass my-method (standard-method) ())
(defmethod make-method-lambda ((gf my-generic-function)
(method my-method)
lambda-expression
environment)
(declare (ignore environment))
`(lambda (args next-methods this-method)
(,(call-next-method gf method
`(lambda ,(cadr lambda-expression)
(flet ((this-method () this-method)
(call-next-method (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> cnm-args)
(funcall (method-function (car next-methods))
(or cnm-args args)
(cdr next-methods)
(car next-methods)))
(next-method-p ()
(not (null next-methods))))
,@(cddr lambda-expression)))
environment)
args next-methods)))
(defmethod compute-effective-method ((gf my-generic-function)
method-combination
methods)
`(call-method ,(car methods) ,(cdr methods) ,(car methods)))
</pre></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p><a id="no-make-method-lambda"></a><strong>The generic function <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> is not implemented. </strong>Its specification is misdesigned: it mixes <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a> and
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#execution_time">execution time</a> behaviour. The essential problem is: where could the
generic-function argument come from?
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form occurs in a source file, is
<a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> then called at compile time or at load time?
If it was called at compile time, there's no possible value for
the first argument, since the class of the generic function to
which the method will belong is not known until load time. If it
was called at load time, it would mean that the method's source
code could only be compiled at load time, not earlier - which
defeats the purpose of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a></li><li class="listitem">When a method is removed from a generic function
using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> and then added through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> to a
different generic function, possibly belonging to a different
generic function class, would <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> then be called
again or not? If no, then <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>'s first argument is
useless. If yes, then the source code of every method would have
to be present at runtime, and its lexical environment as well.
</li></ul></div><p><a id="method-functions-args"></a><strong>Method function arguments. </strong></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> always expect
exactly two arguments: the method and a list of next methods.
</li><li class="listitem">Method functions always
expect exactly two arguments: the list of arguments passed to the
generic function, and the list of next methods.
</li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="compute-discriminating-function"></a>29.5.4.11. Generic Function <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a>
<em class="replaceable"><code>generic-function</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A function.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine the
discriminating function for a generic function. When a generic
function is called, the <strong class="first"><em class="firstterm">installed</em></strong>
discriminating function is called with the full set of arguments
received by the generic function, and must implement the behavior of
calling the generic function: determining the ordered set of
applicable methods, determining the effective method, and running the
effective method.</p><p class="simpara">To determine the ordered set of applicable methods, the
discriminating function first calls <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a>.
If <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> returns a second value of false,
the discriminating function then calls <a class="link" href="#compute-applicable-methods" title="29.5.4.6. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS</code></a>.
</p><p>When <a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> returns a second
value of true, the discriminating function is permitted to memoize
the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> as follows. The discriminating function may
reuse the list of applicable methods without calling
<a class="link" href="#compute-applicable-methods-UC" title="29.5.4.7. Generic Function CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES"><code class="function">CLOS:COMPUTE-APPLICABLE-METHODS-USING-CLASSES</code></a> again provided that:
</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">the generic function is being called again with
required arguments which are instances of the same classes,
</li><li class="listitem">the generic function has not been reinitialized,
</li><li class="listitem">no method has been added to or removed from the
generic function,</li><li class="listitem">for all the specializers of all the generic
function's methods which are classes, their class precedence lists
have not changed, and</li><li class="listitem">for any such memoized value, the class precedence
list of the class of each of the required arguments has not changed.
</li></ol></div><p>
Determination of the effective method is done by calling
<a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>. When the effective method is run, each
method's function is called, and receives as arguments:
</p><div class="orderedlist"><ol class="orderedlist" type="i"><li class="listitem">a list of the arguments to the generic function,
</li><li class="listitem">whatever other arguments are specified in the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> form indicating that the method should be called.
</li></ol></div><p>
(See <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> for more information about how method
functions are called.)</p><p class="simpara">The generic function <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a> is
called, and its result installed, by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p class="simpara">This method can be overridden.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>Overriding methods can make use of the function
<a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a>. It is more convenient to call
<a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a> than <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>
because the in the latter case one needs a lot of <span class="quote">“<span class="quote">glue
code</span>”</span> for implementing the local macros <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">MAKE-METHOD</code></a>, and this glue code is implementation dependent because
it needs</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">to retrieve the declarations
list stored in the method-combination object and</li><li class="listitem">to handle implementation dependent options that
are returned as second value from <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>.
</li></ol></div></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-meth"></a>29.6. Methods</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-inheritance">29.6.1. Inheritance Structure of method metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers">29.6.2. Introspection: Readers for method metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#method-specializers">29.6.2.1. Generic Function <code class="function">CLOS:METHOD-SPECIALIZERS</code></a></span></dt><dt><span class="section"><a href="#method-qualifiers">29.6.2.2. Generic Function <code class="function">METHOD-QUALIFIERS</code></a></span></dt><dt><span class="section"><a href="#method-lambda-list">29.6.2.3. Generic Function <code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#method-gf">29.6.2.4. Generic Function <code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#method-function">29.6.2.5. Generic Function <code class="function">CLOS:METHOD-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers-methods">29.6.2.6. Methods</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-init">29.6.3. Initialization of Methods</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-defmethod">29.6.3.1. Macro <code class="function">DEFMETHOD</code></a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-defmethod-body">29.6.3.1.1. Processing Method Bodies</a></span></dt><dt><span class="section"><a href="#mop-meth-init-defmethod-mo">29.6.3.1.2. Initialization of Generic Function and method metaobjects</a></span></dt><dt><span class="section"><a href="#mop-meth-efficiency">29.6.3.1.3. Efficiency</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-init-mo">29.6.3.2. Initialization of method metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-mo-method">29.6.3.2.1. Methods</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#mop-meth-customize">29.6.4. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#extract-lambda-list">29.6.4.1. Function <code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#extract-specializer-names">29.6.4.2. Function <code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-inheritance"></a>29.6.1. Inheritance Structure of <a class="link" href="#mop-method-mo">method metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-meth-inheritance-fig"></a><p class="title"><strong>Figure 29.5. Inheritance structure of <a class="link" href="#mop-method-mo">method metaobject</a> classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-method.png" width="100%" alt="Inheritance structure of method metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-mo-readers"></a>29.6.2. Introspection: Readers for <a class="link" href="#mop-method-mo">method metaobject</a>s</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#method-specializers">29.6.2.1. Generic Function <code class="function">CLOS:METHOD-SPECIALIZERS</code></a></span></dt><dt><span class="section"><a href="#method-qualifiers">29.6.2.2. Generic Function <code class="function">METHOD-QUALIFIERS</code></a></span></dt><dt><span class="section"><a href="#method-lambda-list">29.6.2.3. Generic Function <code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#method-gf">29.6.2.4. Generic Function <code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#method-function">29.6.2.5. Generic Function <code class="function">CLOS:METHOD-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#mop-meth-mo-readers-methods">29.6.2.6. Methods</a></span></dt></dl></div><p>The reader generic functions which simply return information
associated with <a class="link" href="#mop-method-mo">method metaobject</a>s are presented together here in the
format described in <a class="xref" href="#mop-cl-readers" title="29.3.3. Introspection: Readers for class metaobjects">Section 29.3.3, “Introspection: Readers for class metaobjects”</a>.</p><p>Each of these reader generic functions have the same syntax,
accepting one required argument called <em class="replaceable"><code>method</code></em>, which must be a
<a class="link" href="#mop-method-mo">method metaobject</a>; otherwise, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
if the <a class="link" href="#mop-method-mo">method metaobject</a> has not been initialized.</p><p>These
generic functions can be called by the user or the implementation.</p><p>For any of these generic functions which returns a list, such lists
will not be mutated by the implementation. The results are undefined if a
portable program allows such a list to be mutated.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-specializers"></a>29.6.2.1. Generic Function <a class="link" href="#method-specializers" title="29.6.2.1. Generic Function CLOS:METHOD-SPECIALIZERS"><code class="function">CLOS:METHOD-SPECIALIZERS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#method-specializers" title="29.6.2.1. Generic Function CLOS:METHOD-SPECIALIZERS"><code class="function">CLOS:METHOD-SPECIALIZERS</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns a list of the specializers of <em class="replaceable"><code>method</code></em>. This value is a
list of specializer metaobjects. This is the value of the
<code class="constant">:SPECIALIZERS</code> initialization argument that was associated with the
method during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-qualifiers"></a>29.6.2.2. Generic Function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns a (possibly empty) list of the qualifiers of <em class="replaceable"><code>method</code></em>.
This value is a list of non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> atoms. This is the defaulted value of
the <code class="constant">:QUALIFIERS</code> initialization argument that was associated with the
method during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-lambda-list"></a>29.6.2.3. Generic Function <a class="link" href="#method-lambda-list" title="29.6.2.3. Generic Function CLOS:METHOD-LAMBDA-LIST"><code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#method-lambda-list" title="29.6.2.3. Generic Function CLOS:METHOD-LAMBDA-LIST"><code class="function">CLOS:METHOD-LAMBDA-LIST</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns the (unspecialized) <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of <em class="replaceable"><code>method</code></em>. This value
is a <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>. This is the value of the <code class="constant">:LAMBDA-LIST</code>
initialization argument that was associated with the method during
initialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-gf"></a>29.6.2.4. Generic Function <a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns the generic function that <em class="replaceable"><code>method</code></em> is currently
connected to, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if it is not currently connected to any generic
function. This value is either a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
When a method is first created it is not connected to any generic
function. This connection is maintained by the generic functions
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="method-function"></a>29.6.2.5. Generic Function <a class="link" href="#method-function" title="29.6.2.5. Generic Function CLOS:METHOD-FUNCTION"><code class="function">CLOS:METHOD-FUNCTION</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#method-function" title="29.6.2.5. Generic Function CLOS:METHOD-FUNCTION"><code class="function">CLOS:METHOD-FUNCTION</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>Returns the method function of <em class="replaceable"><code>method</code></em>. This is the
value of the <code class="constant">:FUNCTION</code> initialization argument that was associated
with the method during initialization.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-meth-mo-readers-methods"></a>29.6.2.6. Methods</h4></div></div></div><div class="variablelist"><p class="title"><strong>The specified methods for the <a class="link" href="#mop-method-mo">method metaobject</a> readers</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#method-specializers" title="29.6.2.1. Generic Function CLOS:METHOD-SPECIALIZERS"><code class="function">CLOS:METHOD-SPECIALIZERS</code></a>
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a>
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#method-lambda-list" title="29.6.2.3. Generic Function CLOS:METHOD-LAMBDA-LIST"><code class="function">CLOS:METHOD-LAMBDA-LIST</code></a>
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#method-function" title="29.6.2.5. Generic Function CLOS:METHOD-FUNCTION"><code class="function">CLOS:METHOD-FUNCTION</code></a>
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span></span></dt><dd>No behavior is specified for these
methods beyond that which is specified for their respective generic
functions.</dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#method-gf" title="29.6.2.4. Generic Function CLOS:METHOD-GENERIC-FUNCTION"><code class="function">CLOS:METHOD-GENERIC-FUNCTION</code></a>
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p class="simpara">The value returned by this method is maintained by
<span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</code></span> and
<span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>)</code></span>.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-init"></a>29.6.3. Initialization of Methods</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-init-defmethod">29.6.3.1. Macro <code class="function">DEFMETHOD</code></a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-defmethod-body">29.6.3.1.1. Processing Method Bodies</a></span></dt><dt><span class="section"><a href="#mop-meth-init-defmethod-mo">29.6.3.1.2. Initialization of Generic Function and method metaobjects</a></span></dt><dt><span class="section"><a href="#mop-meth-efficiency">29.6.3.1.3. Efficiency</a></span></dt></dl></dd><dt><span class="section"><a href="#mop-meth-init-mo">29.6.3.2. Initialization of method metaobjects</a></span></dt><dd><dl><dt><span class="section"><a href="#mop-meth-init-mo-method">29.6.3.2.1. Methods</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-meth-init-defmethod"></a>29.6.3.1. Macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a></h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-init-defmethod-body">29.6.3.1.1. Processing Method Bodies</a></span></dt><dt><span class="section"><a href="#mop-meth-init-defmethod-mo">29.6.3.1.2. Initialization of Generic Function and method metaobjects</a></span></dt><dt><span class="section"><a href="#mop-meth-efficiency">29.6.3.1.3. Efficiency</a></span></dt></dl></div><p>The evaluation or execution of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form requires first
that the body of the method be converted to a method function.
This process is described
<a class="link" href="#mop-meth-init-defmethod-body" title="29.6.3.1.1. Processing Method Bodies">below</a>.
The result of this process is a method function and a set of additional
initialization arguments to be used when creating the new method.
Given these two values, the evaluation or execution of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
form proceeds in three steps.</p><p>The first step ensures the existence of a generic function with
the specified name. This is done by calling the function <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.
The first argument in this call is the generic function name specified
in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.</p><p>The second step is the creation of the new <a class="link" href="#mop-method-mo">method metaobject</a> by calling
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>. The class of the new <a class="link" href="#mop-method-mo">method metaobject</a> is determined by calling
<a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a> on the result of the call to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> from the
first step.</p><p>The initialization arguments received by the call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
are as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The value of the <code class="constant">:QUALIFIERS</code> initialization
argument is a list of the qualifiers which appeared in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
form. No special processing is done on these values. The order of the
elements of this list is the same as in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.
</li><li class="listitem">The value of the <code class="constant">:LAMBDA-LIST</code> initialization
argument is the unspecialized <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.
</li><li class="listitem">The value of the <code class="constant">:SPECIALIZERS</code> initialization
argument is a list of the specializers for the method. For specializers
which are classes, the specializer is the <a class="link" href="#mop-class-mo">class metaobject</a> itself. In
the case of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers, it will be an <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>
metaobject obtained by calling <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a> on the result of
evaluating the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer form in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> of the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.</li><li class="listitem">The value of the <code class="constant">:FUNCTION</code> initialization
argument is the method function.</li><li class="listitem"><p class="simpara">The value of the <code class="constant">:DECLARATIONS</code> initialization
argument is a list of the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_d.html#declaration_specifier">declaration specifier</a>s from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.
If there are no declarations in the macro form, this initialization argument
either does not appear, or appears with a value of the empty list.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>No <code class="constant">:DECLARATIONS</code> initialization argument is
provided, because method initialization does not support a <code class="constant">:DECLARATIONS</code>
argument, and because the method function is already completely provided
through the <code class="constant">:FUNCTION</code> initialization argument.</p></div></li><li class="listitem">The value of the <code class="constant">:DOCUMENTATION</code> initialization
argument is the documentation string from the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form. If
there is no documentation string in the macro form this initialization
argument either does not appear, or appears with a value of false.
</li><li class="listitem">Any other initialization argument produced in
conjunction with the method function are also included.</li><li class="listitem">The implementation is free to include additional
initialization arguments provided these are not symbols accessible in
the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-2.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP-USER</span>”</span></strong></a> package, or exported by any package defined in the
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>].</li></ul></div><p>In the third step, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> is called to add the newly created
method to the set of methods associated with the <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</p><p>The result of the call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> is returned as the result
of evaluating or executing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form.</p><p>An example showing a typical <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form and a sample
expansion is shown in the following example:
</p><div class="informalexample"><a id="defmethod-ex-1"></a><p>An example <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> form and one possible correct
expansion. In the expansion, <em class="replaceable"><code>method-lambda</code></em>
is the result of calling <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> as described in
<a class="xref" href="#mop-meth-init-defmethod-body" title="29.6.3.1.1. Processing Method Bodies">Section 29.6.3.1.1, “Processing Method Bodies”</a>.
The initargs appearing after <code class="constant">:FUNCTION</code> are assumed to be additional
initargs returned from the call to <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>.</p><pre class="programlisting">
(defmethod move :before ((p position) (l (eql 0))
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (visiblyp t)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> color)
(set-to-origin p)
(when visiblyp (show-move p 0 color)))
(let ((#:g001 (ensure-generic-function 'move)))
(add-method #:g001
(make-instance (generic-function-method-class #:g001)
:qualifiers '(:before)
:specializers (list (find-class 'position)
(intern-eql-specializer 0))
:lambda-list '(p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (visiblyp t)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> color)
:function (function <em class="replaceable"><code>method-lambda</code></em>)
'additional-initarg-1 't
'additional-initarg-2 '39)))
</pre></div><p>The processing of the method body for this method is shown
<a class="link" href="#defmethod-ex-2">below</a>.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-meth-init-defmethod-body"></a>29.6.3.1.1. Processing Method Bodies</h5></div></div></div><p>Before a method can be created, the list of forms comprising the
method body must be converted to a method function. This conversion is
a two step process.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The body of methods can also appear in the
<code class="constant">:METHOD</code> option of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> forms. Initial methods are
not considered by any of the protocols specified in this document.
</p></div><div class="informalexample"><a id="defmethod-ex-2"></a><p>During macro-expansion of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macro shown in
the <a class="link" href="#defmethod-ex-1">previous example</a> code
similar to this would be run to produce the method lambda and
additional initargs. In this example, <em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em> is the macroexpansion
environment of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macro form.</p><pre class="programlisting">
(let ((gf (ensure-generic-function 'move)))
(make-method-lambda
gf
(class-prototype (generic-function-method-class gf))
'(lambda (p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (visiblyp t) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> color)
(set-to-origin p)
(when visiblyp (show-move p 0 color)))
<em class="replaceable"><code><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-4.html">environment</a></code></em>))
</pre></div><p>The first step occurs during macro-expansion of the macro form.
In this step, the method <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>, declarations and body are
converted to a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> called a <strong class="first"><em class="firstterm">method lambda
<a id="method-lambda" class="indexterm"></a></em></strong>.
This conversion is based on information associated with the generic
function definition in effect at the time the macro form is expanded.</p><p>The generic function definition is obtained by calling <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a> with
a first argument of the generic function name specified in the macro form.
The <code class="constant">:LAMBDA-LIST</code> keyword argument is not passed in this call.</p><p>Given the generic function, production of the method lambda
proceeds by calling <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a>.
The first argument in this call is the generic function obtained as
described above.
The second argument is the result of calling <a class="link" href="#class-prototype" title="29.3.3.10. Generic Function CLOS:CLASS-PROTOTYPE"><code class="function">CLOS:CLASS-PROTOTYPE</code></a> on the
result of calling <a class="link" href="#gf-method-class" title="29.5.2.6. Generic Function CLOS:GENERIC-FUNCTION-METHOD-CLASS"><code class="function">CLOS:GENERIC-FUNCTION-METHOD-CLASS</code></a> on the generic function.
The third argument is a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> formed from the method <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>,
declarations and body.
The fourth argument is the macro-expansion environment of the macro
form; this is the value of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&ENVIRONMENT</code></a> argument to the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> macro.</p><p>The generic function <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> returns two values.
The first is the method lambda itself.
The second is a list of initialization arguments and values. These are
included in the initialization arguments when the method is created.</p><p>In the second step, the method lambda is converted to a function
which properly captures the lexical scope of the macro form. This is
done by having the method lambda appear in the macro-expansion as the
argument of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a> special form. During the subsequent
evaluation of the macro-expansion, the result of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_function.html" target="_top"><code class="function">FUNCTION</code></a> special
form is the method function.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>See <a class="xref" href="#no-make-method-lambda" title="The generic function CLOS:MAKE-METHOD-LAMBDA is not implemented">The generic function <code class="function">CLOS:MAKE-METHOD-LAMBDA</code> is not implemented</a>.
</p></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-meth-init-defmethod-mo"></a>29.6.3.1.2. Initialization of Generic Function and <a class="link" href="#mop-method-mo">method metaobject</a>s</h5></div></div></div><p>An example of creating a generic function and a <a class="link" href="#mop-method-mo">method metaobject</a>, and then
adding the method to the generic function is shown below. This example
is comparable to the method definition shown
<a class="link" href="#defmethod-ex-1">above</a>:
</p><pre class="programlisting">
(let* ((gf (make-instance 'standard-generic-function
:lambda-list '(p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> visiblyp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>)))
(method-class (generic-function-method-class gf)))
(multiple-value-bind (lambda initargs)
(make-method-lambda
gf
(class-prototype method-class)
'(lambda (p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (visiblyp t) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> color)
(set-to-origin p)
(when visiblyp (show-move p 0 color)))
nil)
(add-method gf
(apply #'make-instance method-class
:function (compile nil lambda)
:specializers (list (find-class 'position)
(intern-eql-specializer 0))
:qualifiers ()
:lambda-list '(p l <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (visiblyp t)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> color)
initargs))))
</pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-meth-efficiency"></a>29.6.3.1.3. Efficiency</h5></div><div><h6 class="subtitle">Implementation dependent: only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> and some other
implementations</h6></div></div></div><p>Methods created through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> have a faster calling
convention than methods created through a portable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
invocation.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-meth-init-mo"></a>29.6.3.2. Initialization of <a class="link" href="#mop-method-mo">method metaobject</a>s</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-init-mo-method">29.6.3.2.1. Methods</a></span></dt></dl></div><p>A <a class="link" href="#mop-method-mo">method metaobject</a> can be created by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>.
The initialization arguments establish the definition of the method.
A <a class="link" href="#mop-method-mo">method metaobject</a> cannot be redefined;
calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p>Initialization of a <a class="link" href="#mop-method-mo">method metaobject</a> must be done by calling <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>
and allowing it to call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>. Portable programs must
<span class="strong"><strong>not</strong></span></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> directly to
initialize a <a class="link" href="#mop-method-mo">method metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> directly to
initialize a <a class="link" href="#mop-method-mo">method metaobject</a>;</li><li class="listitem">... call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> to change the class of any
<a class="link" href="#mop-method-mo">method metaobject</a> or to turn a non-method object into a <a class="link" href="#mop-method-mo">method metaobject</a>.
</li></ul></div><p>Since metaobject classes may not be redefined,
no behavior is specified for the result of calls to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_efined-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-REDEFINED-CLASS</code></a> on <a class="link" href="#mop-method-mo">method metaobject</a>s.
Since the class of a <a class="link" href="#mop-method-mo">method metaobject</a> cannot be changed,
no behavior is specified for the result of calls to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_upd_ferent-class.html" target="_top"><code class="function">UPDATE-INSTANCE-FOR-DIFFERENT-CLASS</code></a> on <a class="link" href="#mop-method-mo">method metaobject</a>s.</p><p>During initialization, each initialization argument is checked
for errors and then associated with the <a class="link" href="#mop-method-mo">method metaobject</a>. The value
can then be accessed by calling the appropriate accessor as shown in
<a class="xref" href="#mop-meth-initargs" title="Table 29.5. Initialization arguments and accessors for method metaobjects">Table 29.5, “Initialization arguments and accessors for method metaobjects”</a>.</p><p>This section begins with a description of the error checking and
processing of each initialization argument. This is followed by a table
showing the generic functions that can be used to access the stored
initialization arguments. The section ends with a set of restrictions
on portable methods affecting <a class="link" href="#mop-method-mo">method metaobject</a> initialization.</p><p>In these descriptions, the phrase <span class="quote">“<span class="quote">this argument defaults to
<em class="replaceable"><code>value</code></em></span>”</span> means that when that initialization argument is not
supplied, initialization is performed as if <em class="replaceable"><code>value</code></em> had been supplied.
For some initialization arguments this could be done by the use of
default initialization arguments, but whether it is done this way is not
specified. Implementations are free to define default initialization
arguments for specified <a class="link" href="#mop-method-mo">method metaobject</a> classes. Portable programs
are free to define default initialization arguments for portable
subclasses of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <code class="constant">:QUALIFIERS</code> argument is a list of method
qualifiers. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>, or if
any element of the list is not a non-null atom. This argument
defaults to the empty list.</li><li class="listitem">The <code class="constant">:LAMBDA-LIST</code> argument is the unspecialized
<a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> of the method. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a
proper <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>. If this value is not supplied, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
</li><li class="listitem">The <code class="constant">:SPECIALIZERS</code> argument is a list of the
specializer metaobjects for the method. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value
is not a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>, or if the length of the list differs from the
number of required arguments in the <code class="constant">:LAMBDA-LIST</code> argument, or if
any element of the list is not a specializer metaobject. If this
value is not supplied, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</li><li class="listitem"> The <code class="constant">:FUNCTION</code> argument is a method function. It
must be compatible with the methods on <a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a>
defined for this class of method and generic function with which it
will be used. That is, it must accept the same number of arguments
as all uses of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locmac_call-m__make-method.html" target="_top"><code class="function">CALL-METHOD</code></a> that will call it supply. (See
<a class="link" href="#compute-effective-method" title="29.5.4.8. Generic Function CLOS:COMPUTE-EFFECTIVE-METHOD"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD</code></a> and <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> for more information.)
An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this argument is not supplied.</li><li class="listitem"> When the method being initialized is an instance of
a subclass of <a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a>, the <code class="constant">:SLOT-DEFINITION</code>
initialization argument must be provided. Its value is the direct
<a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> which defines this accessor method. An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if the value
is not an instance of a subclass of <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:DIRECT-SLOT-DEFINITION</code></a>.</li><li class="listitem">The <code class="constant">:DOCUMENTATION</code> argument is a string or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed if this value is not a string or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>. This argument
defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ul></div><p>After the processing and defaulting of initialization arguments
described above, the value of each initialization argument is associated
with the <a class="link" href="#mop-method-mo">method metaobject</a>. These values can then be accessed by calling the
corresponding generic function. The correspondences are as follows:
</p><div class="table"><a id="mop-meth-initargs"></a><p class="title"><strong>Table 29.5. Initialization arguments and
accessors for <a class="link" href="#mop-method-mo">method metaobject</a>s</strong></p><div class="table-contents"><table class="table" summary="Initialization arguments and accessors for method metaobjects" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Initialization Argument</th><th align="center">Generic Function</th></tr></thead><tbody><tr><td align="center"><code class="constant">:QUALIFIERS</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_met_d-qualifiers.html" target="_top"><code class="function">METHOD-QUALIFIERS</code></a></td></tr><tr><td align="center"><code class="constant">:LAMBDA-LIST</code></td><td align="center"><a class="link" href="#method-lambda-list" title="29.6.2.3. Generic Function CLOS:METHOD-LAMBDA-LIST"><code class="function">CLOS:METHOD-LAMBDA-LIST</code></a></td></tr><tr><td align="center"><code class="constant">:SPECIALIZERS</code></td><td align="center"><a class="link" href="#method-specializers" title="29.6.2.1. Generic Function CLOS:METHOD-SPECIALIZERS"><code class="function">CLOS:METHOD-SPECIALIZERS</code></a></td></tr><tr><td align="center"><code class="constant">:FUNCTION</code></td><td align="center"><a class="link" href="#method-function" title="29.6.2.5. Generic Function CLOS:METHOD-FUNCTION"><code class="function">CLOS:METHOD-FUNCTION</code></a></td></tr><tr><td align="center"><code class="constant">:SLOT-DEFINITION</code></td><td align="center"><a class="link" href="#accessor-method-slotdef" title="29.7.1.1. Generic Function CLOS:ACCESSOR-METHOD-SLOT-DEFINITION"><code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></td></tr><tr><td align="center"><code class="constant">:DOCUMENTATION</code></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a></td></tr></tbody></table></div></div><p><br class="table-break" /></p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mop-meth-init-mo-method"></a>29.6.3.2.1. Methods</h5></div></div></div><p>It is not specified which methods provide the initialization
behavior described above. Instead, the information needed to allow
portable programs to specialize this behavior is presented in as a set
of restrictions on the methods a portable program can define. The model
is that portable initialization methods have access to the <a class="link" href="#mop-method-mo">method metaobject</a> when
either all or none of the specified initialization has taken
effect.</p><p>These restrictions govern the methods that a portable program can
define on the generic functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a>. These restrictions
apply only to methods on these generic functions for which the first
specializer is a subclass of the class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>. Other portable
methods on these generic functions are not affected by these
restrictions.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Portable programs must not define methods on
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_sha_d-initialize.html" target="_top"><code class="function">SHARED-INITIALIZE</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.</li><li class="listitem"><p>For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a>:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">Portable programs must not define primary methods.
</li><li class="listitem">Portable programs may define around-methods, but
these must be extending, not overriding methods.</li><li class="listitem">Portable before-methods must assume that when they
are run, none of the initialization behavior described above has been
completed.</li><li class="listitem">Portable after-methods must assume that when they
are run, all of the initialization behavior described above has been
completed.</li></ul></div></li></ul></div><p>The results are undefined if any of
these restrictions are violated.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-customize"></a>29.6.4. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#extract-lambda-list">29.6.4.1. Function <code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a></span></dt><dt><span class="section"><a href="#extract-specializer-names">29.6.4.2. Function <code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="extract-lambda-list"></a>29.6.4.1. Function <a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a> <em class="replaceable"><code>specialized-lambda-list</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specialized-lambda-list</code></em></span></dt><dd>a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a> as accepted by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>An unspecialized <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function takes a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a> and
returns the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> with the specializers removed. This is a
non-destructive operation. Whether the result shares any structure
with the argument is unspecified.</p><p class="simpara">If the <em class="replaceable"><code>specialized-lambda-list</code></em> argument does not have legal syntax,
an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. This syntax checking does not check the syntax of the
actual specializer names, only the syntax of the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> and
where the specializers appear.
</p></dd></dl></div><div class="informalexample"><a id="extract-lambda-list-ex"></a><pre class="programlisting">
(<a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a> '((p position)))
⇒ <code class="computeroutput">(P)</code>
(<a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a> '((p position) x y))
⇒ <code class="computeroutput">(P X Y)</code>
(<a class="link" href="#extract-lambda-list" title="29.6.4.1. Function CLOS:EXTRACT-LAMBDA-LIST"><code class="function">CLOS:EXTRACT-LAMBDA-LIST</code></a> '(a (b (eql x)) c <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> i))
⇒ <code class="computeroutput">(A B C <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> I)</code>
</pre></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="extract-specializer-names"></a>29.6.4.2. Function <a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a>
<em class="replaceable"><code>specialized-lambda-list</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specialized-lambda-list</code></em></span></dt><dd>a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a> as accepted by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A list of specializer names.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function takes a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-3.html">specialized lambda list</a> and
returns its specializer names. This is a non-destructive operation.
Whether the result shares structure with the argument is unspecified.
</p><p class="simpara">The list returned by this function
will not be mutated by the implementation. The results are undefined
if a portable program mutates the list returned by this function.</p><p class="simpara">The result of this function will be a list with a
number of elements equal to the number of required arguments in
<em class="replaceable"><code>specialized-lambda-list</code></em>. Specializers are defaulted to the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>.
</p><p class="simpara">If the <em class="replaceable"><code>specialized-lambda-list</code></em> argument does not have legal
syntax, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed. This syntax checking does not check the syntax
of the actual specializer names, only the syntax of the <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>
and where the specializers appear.
</p></dd></dl></div><div class="informalexample"><a id="extract-specializer-names-ex"></a><pre class="programlisting">
(<a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a> '((p position)))
⇒ <code class="computeroutput">(POSITION)</code>
(<a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a> '((p position) x y))
⇒ <code class="computeroutput">(POSITION T T)</code>
(<a class="link" href="#extract-specializer-names" title="29.6.4.2. Function CLOS:EXTRACT-SPECIALIZER-NAMES"><code class="function">CLOS:EXTRACT-SPECIALIZER-NAMES</code></a> '(a (b (eql x)) c <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> i))
⇒ <code class="computeroutput">(T (EQL X) T)</code>
</pre></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-accessors"></a>29.7. Accessor Methods</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-acc-readers">29.7.1. Introspection</a></span></dt><dd><dl><dt><span class="section"><a href="#accessor-method-slotdef">29.7.1.1. Generic Function <code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-acc-customize">29.7.2. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#reader-method-class">29.7.2.1. Generic Function <code class="function">CLOS:READER-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#writer-method-class">29.7.2.2. Generic Function <code class="function">CLOS:WRITER-METHOD-CLASS</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-acc-readers"></a>29.7.1. Introspection</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#accessor-method-slotdef">29.7.1.1. Generic Function <code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="accessor-method-slotdef"></a>29.7.1.1. Generic Function <a class="link" href="#accessor-method-slotdef" title="29.7.1.1. Generic Function CLOS:ACCESSOR-METHOD-SLOT-DEFINITION"><code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a></h4></div><div><h5 class="subtitle"><code class="code">(<a class="link" href="#accessor-method-slotdef" title="29.7.1.1. Generic Function CLOS:ACCESSOR-METHOD-SLOT-DEFINITION"><code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a> <em class="replaceable"><code>method</code></em>)</code></h5></div></div></div><p>This accessor can only be called on accessor methods. It returns
the <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> that defined this method. This is the value of the
<code class="constant">:SLOT-DEFINITION</code> initialization argument associated with the method during
initialization.</p><div class="variablelist"><p class="title"><strong>The specified methods for the accessor <a class="link" href="#mop-method-mo">method metaobject</a>
readers</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#accessor-method-slotdef" title="29.7.1.1. Generic Function CLOS:ACCESSOR-METHOD-SLOT-DEFINITION"><code class="function">CLOS:ACCESSOR-METHOD-SLOT-DEFINITION</code></a>
(<em class="replaceable"><code>method</code></em> <a class="link" href="#mop-meth-init-mo" title="29.6.3.2. Initialization of method metaobjects"><code class="classname">CLOS:STANDARD-ACCESSOR-METHOD</code></a>))</code></span></span></dt><dd>No behavior is specified for this
method beyond that which is specified for the generic function.</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-acc-customize"></a>29.7.2. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#reader-method-class">29.7.2.1. Generic Function <code class="function">CLOS:READER-METHOD-CLASS</code></a></span></dt><dt><span class="section"><a href="#writer-method-class">29.7.2.2. Generic Function <code class="function">CLOS:WRITER-METHOD-CLASS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="reader-method-class"></a>29.7.2.1. Generic Function <a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>direct-slot-definition</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>direct-slot-definition</code></em></span></dt><dd>a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>alternating initialization argument names and values.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine the
class of reader methods created during class initialization and
reinitialization. The result must be a subclass of
<a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-READER-METHOD</code></a>.</p><p class="simpara">The <em class="replaceable"><code>initargs</code></em> argument must be the same as will be passed
to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> to create the reader method. The <em class="replaceable"><code>initargs</code></em>
must include <code class="constant">:SLOT-DEFINITION</code> with <em class="replaceable"><code>slot-definition</code></em> as its value.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) (<em class="replaceable"><code>direct-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#reader-method-class" title="29.7.2.1. Generic Function CLOS:READER-METHOD-CLASS"><code class="function">CLOS:READER-METHOD-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) (<em class="replaceable"><code>direct-slot-definition</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">These methods return the class
<a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-READER-METHOD</code></a>.</p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="writer-method-class"></a>29.7.2.2. Generic Function <a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a> <em class="replaceable"><code>class</code></em>
<em class="replaceable"><code>direct-slot</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>direct-slot</code></em></span></dt><dd>a <a class="link" href="#mop-dsd-mo">direct</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>a list of initialization arguments and values.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to determine the
class of writer methods created during class initialization and
reinitialization. The result must be a subclass of
<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="classname">CLOS:STANDARD-WRITER-METHOD</code></a>.</p><p class="simpara">The <em class="replaceable"><code>initargs</code></em> argument must be the same as will be passed
to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> to create the reader method. The <em class="replaceable"><code>initargs</code></em>
must include <code class="constant">:SLOT-DEFINITION</code> with <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a> as its value.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>)
(<em class="replaceable"><code>direct-slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="function">CLOS:WRITER-METHOD-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)
(<em class="replaceable"><code>direct-slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-DIRECT-SLOT-DEFINITION</code></a>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)</code></span></span></dt><dd><p class="simpara">These methods return the class
<a class="link" href="#writer-method-class" title="29.7.2.2. Generic Function CLOS:WRITER-METHOD-CLASS"><code class="classname">CLOS:STANDARD-WRITER-METHOD</code></a>.</p><p class="simpara">These methods can be overridden.</p></dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-specializers"></a>29.8. Specializers</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-specializers-inheritance">29.8.1. Inheritance Structure of Specializer Metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-spec-readers">29.8.2. Introspection</a></span></dt><dd><dl><dt><span class="section"><a href="#eql-specializer-object">29.8.2.1. Function <code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-spec-init">29.8.3. Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#intern-eql-specializer">29.8.3.1. Function <code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mop-spec-dep">29.8.4. Updating Dependencies</a></span></dt><dd><dl><dt><span class="section"><a href="#specializer-direct-methods">29.8.4.1. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a></span></dt><dt><span class="section"><a href="#specializer-direct-gfs">29.8.4.2. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a></span></dt><dt><span class="section"><a href="#add-direct-method">29.8.4.3. Generic Function <code class="function">CLOS:ADD-DIRECT-METHOD</code></a></span></dt><dt><span class="section"><a href="#remove-direct-method">29.8.4.4. Generic Function <code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-specializers-inheritance"></a>29.8.1. Inheritance Structure of Specializer Metaobject Classes</h3></div></div></div><div class="figure"><a id="mop-specializers-inheritance-fig"></a><p class="title"><strong>Figure 29.6. Inheritance structure of specializer metaobject classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-specializer.png" width="100%" alt="Inheritance structure of specializer metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-spec-readers"></a>29.8.2. Introspection</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#eql-specializer-object">29.8.2.1. Function <code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="eql-specializer-object"></a>29.8.2.1. Function <a class="link" href="#eql-specializer-object" title="29.8.2.1. Function CLOS:EQL-SPECIALIZER-OBJECT"><code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#eql-specializer-object" title="29.8.2.1. Function CLOS:EQL-SPECIALIZER-OBJECT"><code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a>
<em class="replaceable"><code>eql-specializer</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>eql-specializer</code></em></span></dt><dd>an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer metaobject.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>an object.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function returns the object associated with
<em class="replaceable"><code>eql-specializer</code></em> during initialization.
The value is guaranteed to be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> to the value originally passed
to <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a>, but it is not necessarily <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to that
value.</p><p class="simpara">This function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if
<em class="replaceable"><code>eql-specializer</code></em> is not an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a>
specializer.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-spec-init"></a>29.8.3. Initialization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#intern-eql-specializer">29.8.3.1. Function <code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="intern-eql-specializer"></a>29.8.3.1. Function <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a>
<em class="replaceable"><code>object</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>any Lisp object.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer metaobject for <em class="replaceable"><code>object</code></em>.
</dd><dt><span class="term">Purpose</span></dt><dd>This function returns the unique <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializer
metaobject for <em class="replaceable"><code>object</code></em>, creating one if necessary. Two calls to
<a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> arguments will return the same
(i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>) value.</dd></dl></div><p><strong>Remarks. </strong>The result of calling <a class="link" href="#eql-specializer-object" title="29.8.2.1. Function CLOS:EQL-SPECIALIZER-OBJECT"><code class="function">CLOS:EQL-SPECIALIZER-OBJECT</code></a> on the result of a
call to <a class="link" href="#intern-eql-specializer" title="29.8.3.1. Function CLOS:INTERN-EQL-SPECIALIZER"><code class="function">CLOS:INTERN-EQL-SPECIALIZER</code></a> is only guaranteed to be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> to the
original <em class="replaceable"><code>object</code></em> argument, not necessarily <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-spec-dep"></a>29.8.4. Updating Dependencies</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#specializer-direct-methods">29.8.4.1. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a></span></dt><dt><span class="section"><a href="#specializer-direct-gfs">29.8.4.2. Generic Function <code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a></span></dt><dt><span class="section"><a href="#add-direct-method">29.8.4.3. Generic Function <code class="function">CLOS:ADD-DIRECT-METHOD</code></a></span></dt><dt><span class="section"><a href="#remove-direct-method">29.8.4.4. Generic Function <code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="specializer-direct-methods"></a>29.8.4.1. Generic Function <a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
<em class="replaceable"><code>specializer</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specializer</code></em></span></dt><dd>a specializer metaobject.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A possibly empty list of <a class="link" href="#mop-method-mo">method metaobject</a>s.
</dd><dt><span class="term">Purpose</span></dt><dd>This generic function returns the possibly empty set
of those methods, connected to generic functions, which have
<em class="replaceable"><code>specializer</code></em> as a specializer. The elements of this set are
<a class="link" href="#mop-method-mo">method metaobject</a>s. This value is maintained by the generic
functions <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a> and <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>.
</dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
(<em class="replaceable"><code>specializer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
(<em class="replaceable"><code>specializer</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>))</code></span></span></dt><dd>No behavior is specified for this
method beyond that which is specified for the generic function.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="specializer-direct-gfs"></a>29.8.4.2. Generic Function <a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
<em class="replaceable"><code>specializer</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specializer</code></em></span></dt><dd>a specializer metaobject.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A possibly empty list of <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s.
</dd><dt><span class="term">Purpose</span></dt><dd>This generic function returns the possibly empty set
of those generic functions which have a method with <em class="replaceable"><code>specializer</code></em>
as a specializer. The elements of this set are <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s. This value
is maintained by the generic functions <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a> and
<a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>.</dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
(<em class="replaceable"><code>specializer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>))</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
(<em class="replaceable"><code>specializer</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>))</code></span></span></dt><dd>No behavior is specified for this
method beyond that which is specified for the generic function.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="add-direct-method"></a>29.8.4.3. Generic Function <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
<em class="replaceable"><code>specializer</code></em> <em class="replaceable"><code>method</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specializer</code></em></span></dt><dd>a specializer metaobject.
</dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a <a class="link" href="#mop-method-mo">method metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to maintain a set of
backpointers from a specializer to the set of methods specialized to
it. If <em class="replaceable"><code>method</code></em> is already in the set, it is not added again (no
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed).</p><p class="simpara">This set can be accessed as a list by calling the generic
function <a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>. Methods are removed from the
set by <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>.</p><p class="simpara">The generic function <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a> is called by
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a> whenever a method is added to a generic function. It is
called once for each of the specializers of the method. Note that in
cases where a specializer appears more than once in the specializers
of a method, this generic function will be called more than once with
the same specializer as argument.</p><p class="simpara">The results are undefined if the <em class="replaceable"><code>specializer</code></em> argument
is not one of the specializers of the <em class="replaceable"><code>method</code></em> argument.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
(<em class="replaceable"><code>specializer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
function for class specializers.</p><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal">
<a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div><p>
</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
(<em class="replaceable"><code>specializer</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>)
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
function for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers.</p><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="remove-direct-method"></a>29.8.4.4. Generic Function <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a> <em class="replaceable"><code>specializer</code></em>
<em class="replaceable"><code>method</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specializer</code></em></span></dt><dd>a specializer metaobject.
</dd><dt><span class="term"><em class="replaceable"><code>method</code></em></span></dt><dd>a <a class="link" href="#mop-method-mo">method metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to maintain a set of
backpointers from a specializer to the set of methods specialized to
it. If <em class="replaceable"><code>method</code></em> is in the set it is removed. If it is not, no
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">This set can be accessed as a list by calling the generic
function <a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>. Methods are added to the set
by <a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>.</p><p class="simpara">The generic function <a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a> is called by
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a> whenever a method is removed from a generic function.
It is called once for each of the specializers of the method. Note
that in cases where a specializer appears more than once in the
specializers of a method, this generic function will be called more
than once with the same specializer as argument.</p><p class="simpara">The results are undefined if the <em class="replaceable"><code>specializer</code></em> argument is
not one of the specializers of the <em class="replaceable"><code>method</code></em> argument.
</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
(<em class="replaceable"><code>specializer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>) (<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
function for class specializers.</p><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-direct-method" title="29.8.4.3. Generic Function CLOS:ADD-DIRECT-METHOD"><code class="function">CLOS:ADD-DIRECT-METHOD</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-gfs" title="29.8.4.2. Generic Function CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS"><code class="function">CLOS:SPECIALIZER-DIRECT-GENERIC-FUNCTIONS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#specializer-direct-methods" title="29.8.4.1. Generic Function CLOS:SPECIALIZER-DIRECT-METHODS"><code class="function">CLOS:SPECIALIZER-DIRECT-METHODS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-direct-method" title="29.8.4.4. Generic Function CLOS:REMOVE-DIRECT-METHOD"><code class="function">CLOS:REMOVE-DIRECT-METHOD</code></a>
(<em class="replaceable"><code>specializer</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:EQL-SPECIALIZER</code></a>)
(<em class="replaceable"><code>method</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a>))</code></span></span></dt><dd><p class="simpara">This method implements the behavior of the generic
function for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typspe_eql.html" target="_top"><code class="classname">EQL</code></a> specializers.</p><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p></dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-meth-comb"></a>29.9. Method Combinations</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-meth-comb-inheritance">29.9.1. Inheritance Structure of method combination metaobject Classes</a></span></dt><dt><span class="section"><a href="#mop-meth-comb-customize">29.9.2. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#find-method-combination">29.9.2.1. Generic Function <code class="function">CLOS:FIND-METHOD-COMBINATION</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-comb-inheritance"></a>29.9.1. Inheritance Structure of <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a> Classes</h3></div></div></div><div class="figure"><a id="mop-meth-comb-inheritance-fig"></a><p class="title"><strong>Figure 29.7. Inheritance structure of method combination metaobject classes</strong></p><div class="figure-contents"><div class="mediaobject"><table border="0" summary="manufactured viewport for HTML img" style="cellpadding: 0; cellspacing: 0;" width="100%"><tr><td><img src="mop-classes-methcomb.png" width="100%" alt="Inheritance structure of method combination metaobject classes" /></td></tr></table></div></div></div><br class="figure-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-meth-comb-customize"></a>29.9.2. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#find-method-combination">29.9.2.1. Generic Function <code class="function">CLOS:FIND-METHOD-COMBINATION</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="find-method-combination"></a>29.9.2.1. Generic Function <a class="link" href="#find-method-combination" title="29.9.2.1. Generic Function CLOS:FIND-METHOD-COMBINATION"><code class="function">CLOS:FIND-METHOD-COMBINATION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#find-method-combination" title="29.9.2.1. Generic Function CLOS:FIND-METHOD-COMBINATION"><code class="function">CLOS:FIND-METHOD-COMBINATION</code></a> <em class="replaceable"><code>generic-function</code></em>
<em class="replaceable"><code>method-combination-type-name</code></em>
<em class="replaceable"><code>method-combination-options</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>generic-function</code></em></span></dt><dd>a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>method-combination-type-name</code></em></span></dt><dd>a symbol which names a type of method combination.
</dd><dt><span class="term"><em class="replaceable"><code>method-combination-options</code></em></span></dt><dd>a list of arguments to the method combination type.
</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>A <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>.</dd><dt><span class="term">Purpose</span></dt><dd>This generic function is called to determine the
method combination object used by a generic function.
</dd></dl></div><p><strong>Remarks. </strong>Further details of <a class="link" href="#mop-meth-comp-mo">method combination metaobject</a>s are not specified.
</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-slot-access"></a>29.10. Slot Access</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-sa-instance-struct">29.10.1. Instance Structure Protocol</a></span></dt><dt><span class="section"><a href="#mop-sa-funcallable">29.10.2. Funcallable Instances</a></span></dt><dt><span class="section"><a href="#mop-sa-customize">29.10.3. Customization</a></span></dt><dd><dl><dt><span class="section"><a href="#standard-instance-access">29.10.3.1. Function <code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#funcallable-standard-instance-access">29.10.3.2. Function <code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#set-fif">29.10.3.3. Function <code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#slot-value-UC">29.10.3.4. Generic Function <code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#setf-slot-value-UC">29.10.3.5. Generic Function <code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a></span></dt><dt><span class="section"><a href="#slot-boundp-UC">29.10.3.6. Generic Function <code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#slot-makunbound-UC">29.10.3.7. Generic Function <code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sa-instance-struct"></a>29.10.1. Instance Structure Protocol</h3></div></div></div><p>The instance structure protocol is responsible for implementing
the behavior of the slot access functions like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a> and
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>)</code>.</p><p>For each <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> slot access function other than <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-exists-p.html" target="_top"><code class="function">SLOT-EXISTS-P</code></a>,
there is a corresponding generic function which actually provides the
behavior of the function. When called, the slot access function finds
the pertinent <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>, calls the corresponding generic function and
returns its result. The arguments passed on to the generic function
include one additional value, the class of the <em class="replaceable"><code>object</code></em> argument,
which always immediately precedes the <em class="replaceable"><code>object</code></em> argument.</p><div class="table"><a id="mop-sa-instance-struct-table"></a><p class="title"><strong>Table 29.6. The correspondence between slot access function and
underlying slot access generic function</strong></p><div class="table-contents"><table class="table" summary="The correspondence between slot access function and underlying slot access generic function" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">Slot Access Function</th><th align="center">Corresponding
Slot Access Generic Function</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot-name</code></em></td><td align="center"><a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em></td></tr><tr><td align="center"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>)</code> <em class="replaceable"><code>new-value</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot-name</code></em></td><td align="center"><a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a> <em class="replaceable"><code>new-value</code></em> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-boundp.html" target="_top"><code class="function">SLOT-BOUNDP</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot-name</code></em></td><td align="center"><a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em></td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-makunbound.html" target="_top"><code class="function">SLOT-MAKUNBOUND</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot-name</code></em></td><td align="center"><a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em></td></tr></tbody></table></div></div><br class="table-break" /><p>At the lowest level, the instance structure protocol provides only
limited mechanisms for portable programs to control the implementation
of instances and to directly access the storage associated with
instances without going through the indirection of slot access. This is
done to allow portable programs to perform certain commonly requested
slot access optimizations.</p><p>In particular, portable programs can control the implementation
of, and obtain direct access to, slots with allocation <code class="constant">:INSTANCE</code> and
type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>. These are called <strong class="first"><em class="firstterm">directly accessible slots
<a id="slot-directly-accessible" class="indexterm"></a></em></strong>.</p><p>The relevant specified around-method on <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> determines
the implementation of instances by deciding how each slot in the
instance will be stored. For each directly accessible slot, this method
allocates a <strong class="first"><em class="firstterm">location
<a id="slot-location" class="indexterm"></a>
</em></strong> and associates it with the <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.
The location can be accessed by calling the <a class="link" href="#slotdef-location" title="29.4.2.4.1. Generic Function CLOS:SLOT-DEFINITION-LOCATION"><code class="function">CLOS:SLOT-DEFINITION-LOCATION</code></a>
generic function. Locations are non-negative integers. For a given
class, the locations increase consecutively, in the order that the
directly accessible slots appear in the list of effective slots. (Note
that here, the next paragraph, and the specification of this
around-method are the only places where the value returned by
<a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> is described as a list rather than a set.)</p><p>Given the location of a directly accessible slot, the value of
that slot in an instance can be accessed with the appropriate accessor.
For <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>, this accessor is the function
<a class="link" href="#standard-instance-access" title="29.10.3.1. Function CLOS:STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a>. For <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>, this
accessor is the function <a class="link" href="#funcallable-standard-instance-access" title="29.10.3.2. Function CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a>.
In each case, the arguments to the accessor are the instance and the
slot location, in that order. See the definition of each accessor for
additional restrictions on the use of these function.</p><p>Portable programs are permitted to affect and rely on the
allocation of locations only in the following limited way: By first
defining a portable primary method on <a class="link" href="#compute-slots" title="29.3.6.11. Generic Function CLOS:COMPUTE-SLOTS"><code class="function">CLOS:COMPUTE-SLOTS</code></a> which orders the
returned value in a predictable way, and then relying on the defined
behavior of the specified around-method to assign locations to all
directly accessible slots. Portable programs may compile-in calls to
low-level accessors which take advantage of the resulting predictable
allocation of slot locations.</p><div class="informalexample"><a id="mop-sa-instance-struct-ex"></a><p>This example shows the use of this mechanism to implement a new
<a class="link" href="#mop-class-mo">class metaobject</a> class, <code class="classname">ordered-class</code> and class
option <code class="constant">:SLOT-ORDER</code>. This option provides control
over the allocation of slot locations. In this simple example
implementation, the <code class="constant">:SLOT-ORDER</code> option is not
inherited by subclasses; it controls only instances of the class
itself.
</p><pre class="programlisting">
(defclass ordered-class (standard-class)
((slot-order :initform ()
:initarg :slot-order
:reader class-slot-order)))
(defmethod compute-slots ((class ordered-class))
(let ((order (class-slot-order class)))
(sort (copy-list (call-next-method))
#'(lambda (a b)
(< (position (slot-definition-name a) order)
(position (slot-definition-name a) order))))))
</pre><p>
Following is the source code the user of this extension would write.
Note that because the code above does not implement inheritance of
the <code class="constant">:SLOT-ORDER</code> option, the function
<code class="function">distance</code> must not be called on instances of
subclasses of <code class="classname">point</code>; it can only be called on
instances of <code class="classname">point</code> itself.
</p><pre class="programlisting">
(defclass point ()
((x :initform 0)
(y :initform 0))
(:metaclass ordered-class)
(:slot-order x y))
(defun distance (point)
(sqrt (/ (+ (expt (standard-instance-access point 0) 2)
(expt (standard-instance-access point 1) 2))
2.0)))
</pre><p>
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>You cannot assume that the slot-location
values start at 0. In class <code class="classname">point</code>, for
example, <em class="replaceable"><code>x</code></em> and <em class="replaceable"><code>y</code></em> will be at slot locations 1 and 2, not 0 and
1.</p></div><p>
In more realistic uses of this mechanism, the calls to the low-level
instance structure accessors would not actually appear textually in the
source program, but rather would be generated by a meta-level analysis
program run during the process of compiling the source program.
</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sa-funcallable"></a>29.10.2. Funcallable Instances</h3></div></div></div><p>Instances of classes which are themselves instances of
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> or one of its subclasses are called
<strong class="first"><em class="firstterm">funcallable instances</em></strong>.
Funcallable instances can only be created by
<span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span>.</p><p>Like standard instances, funcallable instances have slots with the
normal behavior. They differ from standard instances in that they can
be used as functions as well; that is, they can be passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a>
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a>, and they can be stored as the definition of a function
name. Associated with each funcallable instance is the function which
it runs when it is called. This function can be changed with
<a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>.</p><div class="informalexample"><a id="mop-sa-funcallable-ex"></a><p>The following simple example shows the use of funcallable
instances to create a simple, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a>-like facility. (Funcallable
instances are useful when a program needs to construct and maintain a
set of functions and information about those functions. They make it
possible to maintain both as the same object rather than two separate
objects linked, for example, by hash tables.)
</p><pre class="programlisting">
(defclass constructor ()
((name :initarg :name :accessor constructor-name)
(fields :initarg :fields :accessor constructor-fields))
(:metaclass funcallable-standard-class))
⇒ <code class="computeroutput">#>FUNCALLABLE-STANDARD-CLASS CONSTRUCTOR></code>
(defmethod initialize-instance :after ((c constructor) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>)
(with-slots (name fields) c
(set-funcallable-instance-function
c
#'(lambda ()
(let ((new (make-array (1+ (length fields)))))
(setf (aref new 0) name)
new)))))
⇒ <code class="computeroutput">#<STANDARD-METHOD :AFTER (#<FUNCALLABLE-STANDARD-CLASS CONSTRUCTOR>)></code>
(setq c1 (make-instance 'constructor :name 'position :fields '(x y)))
⇒ <code class="computeroutput">#<CONSTRUCTOR #<UNBOUND>></code>
(setq p1 (funcall c1))
⇒ <code class="computeroutput">#(POSITION NIL NIL)</code>
</pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-sa-customize"></a>29.10.3. Customization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#standard-instance-access">29.10.3.1. Function <code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#funcallable-standard-instance-access">29.10.3.2. Function <code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a></span></dt><dt><span class="section"><a href="#set-fif">29.10.3.3. Function <code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a></span></dt><dt><span class="section"><a href="#slot-value-UC">29.10.3.4. Generic Function <code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#setf-slot-value-UC">29.10.3.5. Generic Function <code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a></span></dt><dt><span class="section"><a href="#slot-boundp-UC">29.10.3.6. Generic Function <code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a></span></dt><dt><span class="section"><a href="#slot-makunbound-UC">29.10.3.7. Generic Function <code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="standard-instance-access"></a>29.10.3.1. Function <a class="link" href="#standard-instance-access" title="29.10.3.1. Function CLOS:STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#standard-instance-access" title="29.10.3.1. Function CLOS:STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a>
<em class="replaceable"><code>instance</code></em> <em class="replaceable"><code>location</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>instance</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>location</code></em></span></dt><dd>a slot location</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>an object.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to provide direct access to
a slot in an instance. By usurping the normal slot lookup protocol,
this function is intended to provide highly optimized access to the
slots associated with an instance.</p><p>The following restrictions apply to the use of this function:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>instance</code></em> argument must be a
standard instance (it must have been returned by
<span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>)</code></span>).
</li><li class="listitem">The <em class="replaceable"><code>instance</code></em> argument cannot be an
non-updated obsolete instance.</li><li class="listitem">The <em class="replaceable"><code>location</code></em> argument must be a location of
one of the directly accessible slots of the instance's class.
</li><li class="listitem">The slot must be bound.
</li></ul></div><p class="simpara">The results are undefined if any of
these restrictions are violated.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The second and third restrictions do not
apply in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s implementation supports non-updated
obsolete instances and also supports slots with allocation <code class="constant">:CLASS</code>.
</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="funcallable-standard-instance-access"></a>29.10.3.2. Function <a class="link" href="#funcallable-standard-instance-access" title="29.10.3.2. Function CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#funcallable-standard-instance-access" title="29.10.3.2. Function CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a>
<em class="replaceable"><code>instance</code></em> <em class="replaceable"><code>location</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>instance</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>location</code></em></span></dt><dd>a slot location</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>an object.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This function is called to provide direct access to
a slot in an instance. By usurping the normal slot lookup protocol,
this function is intended to provide highly optimized access to the
slots associated with an instance.</p><p>The following restrictions apply to the use of this function:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>instance</code></em> argument must be a
funcallable instance (it must have been returned by
<span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span>).</li><li class="listitem">The <em class="replaceable"><code>instance</code></em> argument cannot be an
non-updated obsolete instance.</li><li class="listitem">The <em class="replaceable"><code>location</code></em> argument must be a location of
one of the directly accessible slots of the instance's class.
</li><li class="listitem">The slot must be bound.
</li></ul></div><p class="simpara">The results are undefined if any of
these restrictions are violated.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Implementation dependent: only in <span class="command"><strong>CLISP</strong></span></h3><p>The second and third restrictions do not
apply in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s implementation supports non-updated
obsolete instances and also supports slots with allocation <code class="constant">:CLASS</code>.
</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="set-fif"></a>29.10.3.3. Function <a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a>
<em class="replaceable"><code>funcallable-instance</code></em> <em class="replaceable"><code>function</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>funcallable-instance</code></em></span></dt><dd>a funcallable instance (it must have been returned by
<span class="method"><code class="literal"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_all_ate-instance.html" target="_top"><code class="function">ALLOCATE-INSTANCE</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>)</code></span>).
</dd><dt><span class="term"><em class="replaceable"><code>function</code></em></span></dt><dd>A function.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd>This function is called to set or to change the
function of a funcallable instance. After
<a class="link" href="#set-fif" title="29.10.3.3. Function CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION"><code class="function">CLOS:SET-FUNCALLABLE-INSTANCE-FUNCTION</code></a> is called, any subsequent calls
to <em class="replaceable"><code>funcallable-instance</code></em> will run the new
function.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slot-value-UC"></a>29.10.3.4. Generic Function <a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em>
<em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> - the class of the
<em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>slot</code></em></span></dt><dd>an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>an object.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function implements the behavior of the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a> function. It is called by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a> with the class
of <em class="replaceable"><code>object</code></em> as its first argument and the pertinent <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> as its
third argument.</p><p class="simpara">The generic function <a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a> returns the value
contained in the given slot of the given object. If the slot is
unbound, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_slot-unbound.html" target="_top"><code class="function">SLOT-UNBOUND</code></a> is called.</p><p class="simpara">The results are undefined if
the <em class="replaceable"><code>class</code></em> argument is not the class of the <em class="replaceable"><code>object</code></em> argument, or
if the <em class="replaceable"><code>slot</code></em> argument does not appear among the set of effective
slots associated with the <em class="replaceable"><code>class</code></em> argument.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
(<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
(<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd><p class="simpara">These methods implement
the full behavior of this generic function for slots with allocation
<code class="constant">:INSTANCE</code> and <code class="constant">:CLASS</code>. If the supplied slot has an allocation
other than <code class="constant">:INSTANCE</code> or <code class="constant">:CLASS</code> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Overriding these methods is permitted,
but may require overriding other methods in the standard implementation
of the slot access protocol.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-value-UC" title="29.10.3.4. Generic Function CLOS:SLOT-VALUE-USING-CLASS"><code class="function">CLOS:SLOT-VALUE-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="setf-slot-value-UC"></a>29.10.3.5. Generic Function <a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a> <em class="replaceable"><code>new-value</code></em> <em class="replaceable"><code>class</code></em>
<em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>new-value</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> - the class of the
<em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>slot</code></em></span></dt><dd>an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>new-value</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">The generic function <a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a> implements
the behavior of the <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>)</code> function. It is called by
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-value.html" target="_top"><code class="function">SLOT-VALUE</code></a>)</code> with the class of <em class="replaceable"><code>object</code></em> as its second argument
and the pertinent <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> as its fourth argument.</p><p class="simpara">The generic function <a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a> sets the value
contained in the given slot of the given object to the given new
value; any previous value is lost.</p><p class="simpara">The results are undefined if
the <em class="replaceable"><code>class</code></em> argument is not the class of the <em class="replaceable"><code>object</code></em> argument, or
if the <em class="replaceable"><code>slot</code></em> argument does not appear among the set of effective
slots associated with the <em class="replaceable"><code>class</code></em> argument.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a>
<em class="replaceable"><code>new-value</code></em> (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
(<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a>
<em class="replaceable"><code>new-value</code></em> (<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
(<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd><p class="simpara">These methods implement
the full behavior of this generic function for slots with allocation
<code class="constant">:INSTANCE</code> and <code class="constant">:CLASS</code>. If the supplied slot has an allocation
other than <code class="constant">:INSTANCE</code> or <code class="constant">:CLASS</code> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Overriding these methods is permitted,
but may require overriding other methods in the standard implementation
of the slot access protocol.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#setf-slot-value-UC" title="29.10.3.5. Generic Function (SETF CLOS:SLOT-VALUE-USING-CLASS)"><code class="code">(SETF CLOS:SLOT-VALUE-USING-CLASS)</code></a>
<em class="replaceable"><code>new-value</code></em> (<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slot-boundp-UC"></a>29.10.3.6. Generic Function <a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em>
<em class="replaceable"><code>slot</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> - the class of the
<em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>slot</code></em></span></dt><dd>an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function implements the behavior of the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-boundp.html" target="_top"><code class="function">SLOT-BOUNDP</code></a> function. It is called by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-boundp.html" target="_top"><code class="function">SLOT-BOUNDP</code></a> with the class
of <em class="replaceable"><code>object</code></em> as its first argument and the pertinent <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> as its
third argument.</p><p class="simpara">The generic function <a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a> tests whether a
specific slot in an instance is bound.</p><p class="simpara">The results are undefined if
the <em class="replaceable"><code>class</code></em> argument is not the class of the <em class="replaceable"><code>object</code></em> argument, or
if the <em class="replaceable"><code>slot</code></em> argument does not appear among the set of effective
slots associated with the <em class="replaceable"><code>class</code></em> argument.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
(<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
(<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd><p class="simpara">These methods implement
the full behavior of this generic function for slots with allocation
<code class="constant">:INSTANCE</code> and <code class="constant">:CLASS</code>. If the supplied slot has an allocation
other than <code class="constant">:INSTANCE</code> or <code class="constant">:CLASS</code> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Overriding these methods is permitted,
but may require overriding other methods in the standard implementation
of the slot access protocol.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-boundp-UC" title="29.10.3.6. Generic Function CLOS:SLOT-BOUNDP-USING-CLASS"><code class="function">CLOS:SLOT-BOUNDP-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</dd></dl></div><p><strong>Remarks. </strong>In cases where the <a class="link" href="#mop-class-mo">class metaobject</a> class does not distinguish
unbound slots, true should be returned.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="slot-makunbound-UC"></a>29.10.3.7. Generic Function <a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a> <em class="replaceable"><code>class</code></em> <em class="replaceable"><code>object</code></em>
<em class="replaceable"><code>slot</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>class</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> - the class of the
<em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term"><em class="replaceable"><code>object</code></em></span></dt><dd>an object.</dd><dt><span class="term"><em class="replaceable"><code>slot</code></em></span></dt><dd>an <a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a>.</dd></dl></div></dd><dt><span class="term">Value</span></dt><dd>The <em class="replaceable"><code>object</code></em> argument.</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function implements the behavior of the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-makunbound.html" target="_top"><code class="function">SLOT-MAKUNBOUND</code></a> function. It is called by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_slot-makunbound.html" target="_top"><code class="function">SLOT-MAKUNBOUND</code></a> with
the class of <em class="replaceable"><code>object</code></em> as its first argument and the pertinent
<a class="link" href="#mop-esd-mo">effective</a> <a class="link" href="#mop-slot-def-mo">slot definition metaobject</a> as its third argument.</p><p class="simpara">The generic function <a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a> restores a slot in
an object to its unbound state. The interpretation
of <span class="quote">“<span class="quote">restoring a slot to its unbound state</span>”</span> depends on
the <a class="link" href="#mop-class-mo">class metaobject</a> class.</p><p class="simpara">The results are undefined if
the <em class="replaceable"><code>class</code></em> argument is not the class of the <em class="replaceable"><code>object</code></em> argument, or
if the <em class="replaceable"><code>slot</code></em> argument does not appear among the set of effective
slots associated with the <em class="replaceable"><code>class</code></em> argument.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
(<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span><br /></span><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>object</code></em>
(<em class="replaceable"><code>slot</code></em> <a class="link" href="#mop-inherit-struct" title="Table 29.1. Direct Superclass Relationships Among The Specified Metaobject Classes"><code class="classname">CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION</code></a>))</code></span></span></dt><dd><p class="simpara">These methods implement
the full behavior of this generic function for slots with allocation
<code class="constant">:INSTANCE</code> and <code class="constant">:CLASS</code>. If the supplied slot has an allocation
other than <code class="constant">:INSTANCE</code> or <code class="constant">:CLASS</code> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Overriding these methods is permitted,
but may require overriding other methods in the standard implementation
of the slot access protocol.</p></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#slot-makunbound-UC" title="29.10.3.7. Generic Function CLOS:SLOT-MAKUNBOUND-USING-CLASS"><code class="function">CLOS:SLOT-MAKUNBOUND-USING-CLASS</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_built-in-class.html" target="_top"><code class="classname">BUILT-IN-CLASS</code></a>) <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>slot</code></em>)</code></span></span></dt><dd>This method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
</dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-dep-maint"></a>29.11. Dependent Maintenance</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-dep-maint-protocol">29.11.1. Protocol</a></span></dt><dd><dl><dt><span class="section"><a href="#update-dependent">29.11.1.1. Generic Function <code class="function">CLOS:UPDATE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#add-dependent">29.11.1.2. Generic Function <code class="function">CLOS:ADD-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#remove-dependent">29.11.1.3. Generic Function <code class="function">CLOS:REMOVE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#map-dependents">29.11.1.4. Generic Function <code class="function">CLOS:MAP-DEPENDENTS</code></a></span></dt></dl></dd></dl></div><p>It is convenient for portable metaobjects to be able to memoize
information about other metaobjects, portable or otherwise. Because
class and <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s can be reinitialized, and <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s can be modified by
adding and removing methods, a means must be provided to update this
memoized information.</p><p>The dependent maintenance protocol supports this by providing a
way to register an object which should be notified whenever a class or
generic function is modified. An object which has been registered this
way is called a <strong class="first"><em class="firstterm">dependent</em></strong> of the class or <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.
The dependents of class and <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>s are maintained with <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
and <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>. The dependents of a class or <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> can be
accessed with <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>. Dependents are notified about a
modification by calling <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a>. (See the specification of
<a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> for detailed description of the circumstances under
which it is called.)</p><p>To prevent conflicts between two portable programs, or between
portable programs and the implementation, portable code must not
register metaobjects themselves as dependents. Instead, portable
programs which need to record a metaobject as a dependent, should
encapsulate that metaobject in some other kind of object, and record
that object as the dependent. The results are undefined if this
restriction is violated.</p><div class="informalexample"><a id="mop-dep-maint-ex"></a><p>This example shows a general facility for encapsulating
metaobjects before recording them as dependents. The facility defines a
basic kind of encapsulating object: an updater. Specializations of the
basic class can be defined with appropriate special updating behavior.
In this way, information about the updating required is associated with
each updater rather than with the metaobject being updated.</p><p>Updaters are used to encapsulate any metaobject which requires
updating when a given class or generic function is modified. The
function <code class="function">record-updater</code> is called to both create an
updater and add it to the dependents of the class or generic function.
Methods on the generic function <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a>, specialized to the
specific class of updater do the appropriate update work.</p><pre class="programlisting">
(defclass updater ()
((dependent :initarg :dependent :reader dependent)))
(defun record-updater (class dependee dependent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> initargs)
(let ((updater (apply #'make-instance class :dependent dependent
initargs)))
(add-dependent dependee updater)
updater))
</pre><p>A <code class="function">flush-cache-updater</code> simply flushes the
cache of the dependent when it is updated.</p><pre class="programlisting">
(defclass flush-cache-updater (updater) ())
(defmethod update-dependent (dependee (updater flush-cache-updater) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> args)
(declare (ignore args))
(flush-cache (dependent updater)))
</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-dep-maint-protocol"></a>29.11.1. Protocol</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#update-dependent">29.11.1.1. Generic Function <code class="function">CLOS:UPDATE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#add-dependent">29.11.1.2. Generic Function <code class="function">CLOS:ADD-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#remove-dependent">29.11.1.3. Generic Function <code class="function">CLOS:REMOVE-DEPENDENT</code></a></span></dt><dt><span class="section"><a href="#map-dependents">29.11.1.4. Generic Function <code class="function">CLOS:MAP-DEPENDENTS</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="update-dependent"></a>29.11.1.1. Generic Function <a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> <em class="replaceable"><code>metaobject</code></em>
<em class="replaceable"><code>dependent</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>initargs</code></em>)
</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>metaobject</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a> - the metaobject being
reinitialized or otherwise modified.</dd><dt><span class="term"><em class="replaceable"><code>dependent</code></em></span></dt><dd>an object - the dependent being updated.
</dd><dt><span class="term"><em class="replaceable"><code>initargs</code></em></span></dt><dd>a list of the initialization arguments for
the metaobject redefinition.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function is called to update a
dependent of <em class="replaceable"><code>metaobject</code></em>.</p><p class="simpara">When a class or a generic function is reinitialized each of
its dependents is updated. The <em class="replaceable"><code>initargs</code></em> argument to
<a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> is the set of initialization arguments received by
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_rei_ize-instance.html" target="_top"><code class="function">REINITIALIZE-INSTANCE</code></a>.</p><p class="simpara">When a method is added to a generic function, each of the
generic function's dependents is updated. The <em class="replaceable"><code>initargs</code></em> argument
is a list of two elements: the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_add-method.html" target="_top"><code class="function">ADD-METHOD</code></a>, and the method
that was added.</p><p class="simpara">When a method is removed from a generic function, each of the
generic function's dependents is updated. The <em class="replaceable"><code>initargs</code></em> argument
is a list of two elements: the symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_remove-method.html" target="_top"><code class="function">REMOVE-METHOD</code></a>, and the method
that was removed.</p><p>In each case, <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> is used to call
<a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> on each of the dependents. So, for example, the
update of a generic function's dependents when a method is added
could be performed by the following code:</p><pre class="programlisting">
(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> <em class="replaceable"><code>generic-function</code></em>
#'(lambda (dep)
(<a class="link" href="#update-dependent" title="29.11.1.1. Generic Function CLOS:UPDATE-DEPENDENT"><code class="function">CLOS:UPDATE-DEPENDENT</code></a> <em class="replaceable"><code>generic-function</code></em>
dep 'add-method new-method)))
</pre></dd></dl></div><p><strong>Remarks. </strong>See <a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a> for remarks about the
use of this facility.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="add-dependent"></a>29.11.1.2. Generic Function <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> <em class="replaceable"><code>metaobject</code></em>
<em class="replaceable"><code>dependent</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>metaobject</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>dependent</code></em></span></dt><dd>an object.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function adds <em class="replaceable"><code>dependent</code></em> to the
dependents of <em class="replaceable"><code>metaobject</code></em>. If <em class="replaceable"><code>dependent</code></em> is already in the set
of dependents it is not added again (no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed).</p><p class="simpara">The generic function <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> can be called to access
the set of dependents of a class or generic function. The generic
function <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> can be called to remove an object from
the set of dependents of a class or generic function. The effect of
calling <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> or <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> while a call to
<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> on the same class or generic function is in progress
is unspecified.</p><p class="simpara">The situations in which <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> is called are not
specified.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<em class="replaceable"><code>generic-function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd></dl></div><p><strong>Remarks. </strong>See <a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a> for remarks about the
use of this facility.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="remove-dependent"></a>29.11.1.3. Generic Function <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> <em class="replaceable"><code>metaobject</code></em>
<em class="replaceable"><code>dependent</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>metaobject</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>dependent</code></em></span></dt><dd>an object.</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd><p class="simpara">This generic function removes <em class="replaceable"><code>dependent</code></em> from the
dependents of <em class="replaceable"><code>metaobject</code></em>. If <em class="replaceable"><code>dependent</code></em> is not one of the
dependents of <em class="replaceable"><code>metaobject</code></em>, no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">The generic function <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> can be called to access
the set of dependents of a class or generic function. The generic
function <a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> can be called to add an object from the set
of dependents of a class or generic function. The effect of calling
<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> or <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> while a call to
<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> on the same class or generic function is in progress
is unspecified.</p><p class="simpara">The situations in which <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> is called are not
specified.</p></dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<em class="replaceable"><code>class</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<em class="replaceable"><code>class</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>dependent</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd></dl></div><p><strong>Remarks. </strong>See <a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a> for remarks about the
use of this facility.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="map-dependents"></a>29.11.1.4. Generic Function <a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">Syntax</span></dt><dd><code class="code">(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a> <em class="replaceable"><code>metaobject</code></em>
<em class="replaceable"><code>function</code></em>)</code></dd><dt><span class="term">Arguments</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>metaobject</code></em></span></dt><dd>a <a class="link" href="#mop-class-mo">class metaobject</a> or a <a class="link" href="#mop-gen-fun-mo">generic function metaobject</a>.</dd><dt><span class="term"><em class="replaceable"><code>function</code></em></span></dt><dd>a function which accepts one argument.
</dd></dl></div></dd><dt><span class="term">Values</span></dt><dd>The values returned by this generic function are unspecified.
</dd><dt><span class="term">Purpose</span></dt><dd>This generic function applies <em class="replaceable"><code>function</code></em> to each of
the dependents of <em class="replaceable"><code>metaobject</code></em>. The order in which the dependents
are processed is not specified, but <em class="replaceable"><code>function</code></em> is applied to each
dependent once and only once. If, during the mapping,
<a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a> or <a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a> is called to alter the
dependents of <em class="replaceable"><code>metaobject</code></em>, it is not specified whether the newly
added or removed dependent will have <em class="replaceable"><code>function</code></em> applied to it.
</dd></dl></div><div class="variablelist"><p class="title"><strong>Methods</strong></p><dl class="variablelist"><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<em class="replaceable"><code>metaobject</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>) <em class="replaceable"><code>function</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<em class="replaceable"><code>metaobject</code></em> <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>) <em class="replaceable"><code>function</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd><dt><span class="term"><span class="method"><code class="literal">(<a class="link" href="#map-dependents" title="29.11.1.4. Generic Function CLOS:MAP-DEPENDENTS"><code class="function">CLOS:MAP-DEPENDENTS</code></a>
(<em class="replaceable"><code>metaobject</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a>) <em class="replaceable"><code>function</code></em>)</code></span></span></dt><dd><p class="simpara">No behavior is specified for this
method beyond that which is specified for the generic function.</p><p>This method cannot be overridden unless the
following methods are overridden as well:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#add-dependent" title="29.11.1.2. Generic Function CLOS:ADD-DEPENDENT"><code class="function">CLOS:ADD-DEPENDENT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li><li class="listitem"><span class="method"><code class="literal"><a class="link" href="#remove-dependent" title="29.11.1.3. Generic Function CLOS:REMOVE-DEPENDENT"><code class="function">CLOS:REMOVE-DEPENDENT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standa_ric-function.html" target="_top"><code class="classname">STANDARD-GENERIC-FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_t.html" target="_top"><code class="classname">T</code></a>)</code></span></li></ul></div></dd></dl></div><p><strong>Remarks. </strong>See <a class="xref" href="#mop-dep-maint" title="29.11. Dependent Maintenance">Section 29.11, “Dependent Maintenance”</a> for remarks about the
use of this facility.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mop-clisp"></a>29.12. Deviations from [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>]</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-clisp-warn">29.12.1. Warning <code class="classname">CLOS:CLOS-WARNING</code></a></span></dt><dd><dl><dt><span class="section"><a href="#mop-clisp-gf-already-called-warning">29.12.1.1. Warning <code class="classname">CLOS:GF-ALREADY-CALLED-WARNING</code></a></span></dt><dt><span class="section"><a href="#mop-clisp-gf-replacing-method-warning">29.12.1.2. Warning <code class="classname">CLOS:GF-REPLACING-METHOD-WARNING</code></a></span></dt><dt><span class="section"><a href="#class-obsolescence-warning">29.12.1.3. Warning <code class="classname">CLOS:CLASS-OBSOLESCENCE-WARNING</code></a></span></dt></dl></dd></dl></div><p>This section lists the differences between the [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] and the
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implementation thereof.</p><div class="itemizedlist"><a id="mop-not-in-clisp"></a><p class="title"><strong>Not implemented in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The generic function <a class="link" href="#make-method-lambda" title="29.5.4.10. Generic Function CLOS:MAKE-METHOD-LAMBDA"><code class="function">CLOS:MAKE-METHOD-LAMBDA</code></a> is not implemented.
See <a class="xref" href="#mop-gf-invocation" title="29.5.3.2. Generic Function Invocation Protocol">Section 29.5.3.2, “Generic Function Invocation Protocol”</a>.</p></li></ul></div><div class="itemizedlist"><a id="mop-clisp-different"></a><p class="title"><strong>Features implemented differently in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The class precedence list of <a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-OBJECT</code></a>
is different. See <a class="xref" href="#mop-mo-cl-inheritance" title="29.2.2. Inheritance Structure of Metaobject Classes">Section 29.2.2, “Inheritance Structure of Metaobject Classes”</a>.</p></li><li class="listitem"><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro passes default values to <a class="link" href="#ensure-class" title="29.3.6.2. Generic Function CLOS:ENSURE-CLASS"><code class="function">CLOS:ENSURE-CLASS</code></a>.
See <a class="xref" href="#mop-cl-defclass" title="29.3.1. Macro DEFCLASS">Section 29.3.1, “Macro <code class="function">DEFCLASS</code>”</a>.</p></li><li class="listitem"><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> macro passes default values to <a class="link" href="#ensure-gf" title="29.5.4.2. Generic Function ENSURE-GENERIC-FUNCTION"><code class="function">ENSURE-GENERIC-FUNCTION</code></a>.
See <a class="xref" href="#mop-gf-init-defgeneric" title="29.5.3.1. Macro DEFGENERIC">Section 29.5.3.1, “Macro <code class="function">DEFGENERIC</code>”</a>.</p></li><li class="listitem"><p>The class <a class="link" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP"><code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code></a> is implemented differently.
See <a class="xref" href="#forward-referenced-class-clisp" title="Implementation of class CLOS:FORWARD-REFERENCED-CLASS in CLISP">Implementation of class <code class="classname">CLOS:FORWARD-REFERENCED-CLASS</code> in <span class="command"><strong>CLISP</strong></span></a>.</p></li><li class="listitem"><p>The function <a class="link" href="#gf-argument-precedence-order" title="29.5.2.4. Generic Function CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER"><code class="function">CLOS:GENERIC-FUNCTION-ARGUMENT-PRECEDENCE-ORDER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>
if the generic function has no <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>.</p></li><li class="listitem"><p>It is not possible to create a class with metaclass
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a> when specifying a superclass with metaclass
<a class="link" href="#mop-sa-funcallable" title="29.10.2. Funcallable Instances"><code class="classname">CLOS:FUNCALLABLE-STANDARD-CLASS</code></a>, even though <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a>
returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for this situation.
</p></li></ul></div><div class="itemizedlist"><a id="mop-clisp-ext"></a><p class="title"><strong>Extensions specific to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>The <a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a> is applicable to classes of type <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a>.
The default superclass for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> instances is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>.
Structure classes do not support multiple inheritance and reinitialization.
See <a class="xref" href="#mop-cl-init-mo" title="29.3.5.1. Initialization of class metaobjects">Section 29.3.5.1, “Initialization of class metaobjects”</a>.
See also <a class="xref" href="#defstruct-mop" title="8.2. The structure Meta-Object Protocol">Section 8.2, “The structure Meta-Object Protocol”</a>.</p></li><li class="listitem"><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a> macro supports user-defined options.
See <a class="xref" href="#mop-defgeneric-user-options" title="User-defined options">User-defined options</a>.</p></li><li class="listitem"><p>The class <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> is subclassable.
See <a class="xref" href="#mop-mo-cl-inheritance" title="29.2.2. Inheritance Structure of Metaobject Classes">Section 29.2.2, “Inheritance Structure of Metaobject Classes”</a>.</p></li><li class="listitem"><p>Slot names like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> are allowed.
See <a class="xref" href="#slotdef-name" title="29.4.2.1.1. Generic Function CLOS:SLOT-DEFINITION-NAME">Section 29.4.2.1.1, “Generic Function <code class="function">CLOS:SLOT-DEFINITION-NAME</code>”</a>.</p></li><li class="listitem"><p>The <a class="link" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS"><code class="function">CLOS:VALIDATE-SUPERCLASS</code></a> method is more permissive by
default and does not need to be overridden in
some <span class="quote">“<span class="quote">obvious</span>”</span> cases.
See <a class="xref" href="#validate-superclass" title="29.3.6.7. Generic Function CLOS:VALIDATE-SUPERCLASS">Section 29.3.6.7, “Generic Function <code class="function">CLOS:VALIDATE-SUPERCLASS</code>”</a>.</p></li><li class="listitem"><p>New generic function <a class="link" href="#compute-dsd-initargs" title="29.3.6.8. Generic Function CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-DIRECT-SLOT-DEFINITION-INITARGS</code></a>. It can sometimes
be used when overriding <a class="link" href="#dsd-class" title="29.3.6.9. Generic Function CLOS:DIRECT-SLOT-DEFINITION-CLASS"><code class="function">CLOS:DIRECT-SLOT-DEFINITION-CLASS</code></a> is cumbersome.</p></li><li class="listitem"><p>New generic function <a class="link" href="#compute-esd-initargs" title="29.3.6.13. Generic Function CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS"><code class="function">CLOS:COMPUTE-EFFECTIVE-SLOT-DEFINITION-INITARGS</code></a>. It can sometimes
be used when overriding <a class="link" href="#esd-class" title="29.3.6.14. Generic Function CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS"><code class="function">CLOS:EFFECTIVE-SLOT-DEFINITION-CLASS</code></a> is cumbersome.</p></li><li class="listitem"><p>New function <a class="link" href="#compute-effective-method-as-function" title="29.5.4.9. Function CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION"><code class="function">CLOS:COMPUTE-EFFECTIVE-METHOD-AS-FUNCTION</code></a>. It
can be used in overriding methods of <a class="link" href="#compute-discriminating-function" title="29.5.4.11. Generic Function CLOS:COMPUTE-DISCRIMINATING-FUNCTION"><code class="function">CLOS:COMPUTE-DISCRIMINATING-FUNCTION</code></a>.
</p></li><li class="listitem"><p>The generic function <a class="link" href="#ensure-gf-UC" title="29.5.4.3. Generic Function CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS"><code class="function">CLOS:ENSURE-GENERIC-FUNCTION-USING-CLASS</code></a> accepts a
<code class="constant">:DECLARE</code> keyword.</p></li><li class="listitem"><p>The functions <a class="link" href="#funcallable-standard-instance-access" title="29.10.3.2. Function CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:FUNCALLABLE-STANDARD-INSTANCE-ACCESS</code></a> and
<a class="link" href="#standard-instance-access" title="29.10.3.1. Function CLOS:STANDARD-INSTANCE-ACCESS"><code class="function">CLOS:STANDARD-INSTANCE-ACCESS</code></a> support non-updated obsolete instances and
also support slots with allocation <code class="constant">:CLASS</code>.</p></li><li class="listitem"><p>The existence of the function <a class="link" href="#class-direct-subclasses" title="29.3.3.6. Generic Function CLOS:CLASS-DIRECT-SUBCLASSES"><code class="function">CLOS:CLASS-DIRECT-SUBCLASSES</code></a>
does not prevent otherwise unreferenced classes from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
</p></li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mop-clisp-warn"></a>29.12.1. Warning <code class="classname">CLOS:CLOS-WARNING</code></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mop-clisp-gf-already-called-warning">29.12.1.1. Warning <code class="classname">CLOS:GF-ALREADY-CALLED-WARNING</code></a></span></dt><dt><span class="section"><a href="#mop-clisp-gf-replacing-method-warning">29.12.1.2. Warning <code class="classname">CLOS:GF-REPLACING-METHOD-WARNING</code></a></span></dt><dt><span class="section"><a href="#class-obsolescence-warning">29.12.1.3. Warning <code class="classname">CLOS:CLASS-OBSOLESCENCE-WARNING</code></a></span></dt></dl></div><p>When <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> encounters suspicious or suboptimal <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> code,
it issues a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> of type <code class="classname">CLOS:CLOS-WARNING</code>
or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> of type <code class="classname">CLOS:CLOS-STYLE-WARNING</code>.
To suppress the undesired warnings (<span class="strong"><strong>not</strong></span> recommended!) use
<a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a> with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_abortcm_c_cm_use-value.html" target="_top"><code class="function">MUFFLE-WARNING</code></a> on the appropriate
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> type;.
To find where the warnings come from (recommended), set
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stbreak-on-signalsst.html" target="_top"><code class="varname">*BREAK-ON-SIGNALS*</code></a> to the appropriate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a> type.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-clisp-gf-already-called-warning"></a>29.12.1.1. Warning
<code class="classname">CLOS:GF-ALREADY-CALLED-WARNING</code></h4></div></div></div><p>This is a hint that the order in which program files are loaded
(order of definitions, order of macro expansions, or similar) may be wrong.
Example:<a id="mop-clisp-gf-already-called-warning-code"></a></p><pre class="programlisting">
(defclass ware () ((title :initarg :title :accessor title)))
(defclass book (ware) ())
(defclass compact-disk (ware) ())
(defclass dvd (ware) ())
(defgeneric add-to-inventory (object))
(defmethod add-to-inventory ((object ware)) nil)
(add-to-inventory (make-instance 'book :title "CLtL1"))
(defvar *book-counter* 0)
(defmethod add-to-inventory ((object book)) (incf *book-counter*))
(add-to-inventory (make-instance 'book :title "CLtL2"))
*book-counter*
⇒ <code class="computeroutput">1</code>
</pre><p>
Since <a class="xref" href="#CLtL1" title="Common Lisp: the Language (1st Edition)">[<abbr class="abbrev">CLtL1</abbr>]</a> and <a class="xref" href="#CLtL2" title="Common Lisp: the Language (2nd Edition)">[<abbr class="abbrev">CLtL2</abbr>]</a> were already added to the inventory, the
programmer might have expected that <code class="varname">*book-counter*</code>
is 2.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">No warning for standard generic functions</h3><p>A few functions, such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>, are listed in the
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] and the [<span class="citation"><a class="link" href="#amop" title="The Art of the Metaobject Protocol">AMOP</a></span>] as <span class="quote">“<span class="quote">standard generic functions</span>”</span>,
to which users may add methods.
This warning is <span class="strong"><strong>not</strong></span> issued for such functions.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">This is a <code class="classname">STYLE-WARNING</code></h3><p>This warning is actually a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> because it indicates the
behavior officially sanctioned by the standard and useful in some situations.
We only warn on it because it <span class="emphasis"><em>may</em></span> lead to confusing
behavior for inexperienced users.</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="mop-clisp-gf-already-called-warning-motivation"></a>Motivation</h5></div></div></div><p>A generic function is defined by a contract.
Whoever adds a method to a generic function, however, also
expects the contract to be fulfilled.
(In the example above, the contract is that
<code class="varname">*book-counter*</code> equals the number of invocations
of <code class="function">add-to-inventory</code> on
<code class="classname">book</code> instances.)
If the generic function has already been called before the
method was added, the method's contract is definitely broken.
Maybe the programmer has foreseen this case (in this example:
he could initialize <code class="varname">*book-counter*</code> to the number of
instances of <code class="classname">book</code> that exist at this moment,
rather than to <code class="literal">0</code>), or maybe not. This is what the warning is about.
</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="mop-clisp-gf-dynamically-modifiable"></a>Disabling
the warning for a specific generic function</h5></div></div></div><p>If your generic function constitutes a public interface which is
used by adding methods (similar to aforementioned <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>), you
can declare it as such:</p><pre class="programlisting">
(defgeneric my-public-gf (a b c)
(declare (clos:dynamically-modifiable))
...)</pre><p>
</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mop-clisp-gf-replacing-method-warning"></a>29.12.1.2. Warning
<code class="classname">CLOS:GF-REPLACING-METHOD-WARNING</code></h4></div></div></div><p>This is a hint that different parts of the program, possibly
developed by independent people, are colliding.
Example: in addition to the code
<a class="link" href="#mop-clisp-gf-already-called-warning-code">above</a>:
</p><pre class="programlisting">
(defvar *book-sales-statistics* (make-hash-table :test 'equal))
(defmethod add-to-inventory ((object book))
(setf (gethash (title object) sale-stats) (cons 0 0)))
(add-to-inventory (make-instance 'book :title "AMOP"))
*book-counter*
⇒ <code class="computeroutput">1</code>
*book-sales-statistics*
⇒ <code class="computeroutput">#S(HASH-TABLE :TEST FASTHASH-EQUAL ("AMOP" . (0 . 0)))</code>
</pre><p>
The programmer who programmed the first
<span class="method"><code class="literal"><code class="function">add-to-inventory</code>@<code class="classname">book</code></code></span>
method expects that <code class="varname">*book-counter*</code> will be incremented.
The programmer who programmed the second
<span class="method"><code class="literal"><code class="function">add-to-inventory</code>@<code class="classname">book</code></code></span>
method expects that <code class="varname">*book-sales-statistics*</code> gets
augmented. If the implementation gives no warning, one of the two
programmers will waste time debugging.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">This is a <code class="classname">STYLE-WARNING</code></h3><p>This warning is actually a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> because it indicates the
behavior officially sanctioned by the standard and useful in some situations.
We only warn on it because it <span class="emphasis"><em>may</em></span> lead to confusing
behavior for inexperienced users.</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="mop-clisp-gf-replacing-method-warning-motivation"></a>Motivation</h5></div></div></div><p>This warning can be warranted for the same reason as
<a class="link" href="#mop-clisp-gf-already-called-warning-motivation" title="Motivation">above</a>:
if the old method and the new method have a different contract,
something is fishy and possibly wrong.
Additionally, the programmers may not even have intended to replace the
method. They may have intended cumulative effects of the two methods.
</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="class-obsolescence-warning"></a>29.12.1.3. Warning
<code class="classname">CLOS:CLASS-OBSOLESCENCE-WARNING</code></h4></div></div></div><p>This is a hint that different parts of the program define the same
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_class.html" target="_top"><code class="classname">CLASS</code></a> incompatibly, and some objects, created to the old
specification, have been obsoleted by the new one.
Example: in addition to the code
<a class="link" href="#mop-clisp-gf-already-called-warning-code">above</a>:
</p><pre class="programlisting">
(defclass ware ()
((title :initarg :title :accessor title)
(year :initarg :year :accessor year)))
</pre><p>
Evaluating the above will obsolete all objects of type
<code class="classname">ware</code>s, <code class="classname">book</code>s etc
created so far, i.e., their components will become inaccessible.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">This is a <code class="classname">STYLE-WARNING</code></h3><p>This warning is actually a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_style-warning.html" target="_top"><code class="classname">STYLE-WARNING</code></a> because it indicates the
behavior officially sanctioned by the standard and useful in some situations.
We only warn on it because it <span class="emphasis"><em>may</em></span> lead to confusing
behavior for inexperienced users.</p></div><div class="simplesect"><div class="titlepage"><div><div><h5 class="title"><a id="class-obsolescence-warning-motivation"></a>Motivation</h5></div></div></div><p>In addition to the
<a class="link" href="#mop-clisp-gf-already-called-warning-motivation" title="Motivation">above</a>,
this warning tells the programmers that they are losing some objects
they have already created.</p></div></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="gray"></a>Chapter 30. Gray streams</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#gray-overview">30.1. Overview</a></span></dt><dt><span class="section"><a href="#gray-classes">30.2. Defined classes</a></span></dt><dt><span class="section"><a href="#gray-gf-general">30.3. General generic functions</a></span></dt><dt><span class="section"><a href="#gray-gf-char-in">30.4. Generic functions for character input</a></span></dt><dt><span class="section"><a href="#gray-gf-char-out">30.5. Generic functions for character output</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-in">30.6. Generic functions for binary input</a></span></dt><dt><span class="section"><a href="#gray-gf-byte-out">30.7. Generic functions for binary output</a></span></dt><dt><span class="section"><a href="#fill-stream">30.8. Class <code class="classname">EXT:FILL-STREAM</code></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-overview"></a>30.1. Overview</h2></div></div></div><p>This interface permits the definition of new classes of streams,
and programming their behavior by defining methods for the elementary
stream operations.
It is based on the proposal <a class="ulink" href="http://www.nhplace.com/kent/CL/Issues/stream-definition-by-user.html" target="_top">STREAM-DEFINITION-BY-USER:GENERIC-FUNCTIONS</a> of David N. Gray to X3J13
and is supported by most <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> implementations currently in use.</p><p>All symbols defined by this interface, starting with the prefix
<code class="literal">FUNDAMENTAL-</code> or <code class="literal">STREAM-</code>,
are exported from the package <a class="link" href="#gray" title="Chapter 30. Gray streams"><strong class="package"><span class="quote">“<span class="quote">GRAY</span>”</span></strong></a>
and <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>ed from <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-classes"></a>30.2. Defined classes</h2></div></div></div><div class="variablelist"><p class="title"><strong>Defined classes</strong></p><dl class="variablelist"><dt><a id="fu-st"></a><span class="term"><a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined streams.
It is a subclass of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_standard-object.html" target="_top"><code class="classname">STANDARD-OBJECT</code></a>.
Its metaclass is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-class.html" target="_top"><code class="classname">STANDARD-CLASS</code></a>.</dd><dt><a id="fu-st-in"></a><span class="term"><a class="link" href="#fu-st-in"><code class="classname">GRAY:FUNDAMENTAL-INPUT-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.
It is a subclass of <a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a>. The built-in function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">INPUT-STREAM-P</code></a>
returns true on instances of this class. This means that when you
define a new stream class capable of doing input, you have to make it
a subclass of <a class="link" href="#fu-st-in"><code class="classname">GRAY:FUNDAMENTAL-INPUT-STREAM</code></a>.</dd><dt><a id="fu-st-out"></a><span class="term"><a class="link" href="#fu-st-out"><code class="classname">GRAY:FUNDAMENTAL-OUTPUT-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.
It is a subclass of <a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a>. The built-in function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">OUTPUT-STREAM-P</code></a>
returns true on instances of this class. This means that when you
define a new stream class capable of doing output, you have to make
it a subclass of <a class="link" href="#fu-st-out"><code class="classname">GRAY:FUNDAMENTAL-OUTPUT-STREAM</code></a>.</dd><dt><a id="fu-st-char"></a><span class="term"><a class="link" href="#fu-st-char"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined streams
whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>. It is a subclass of
<a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a>. It defines a method on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> that returns
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</dd><dt><a id="fu-st-bin"></a><span class="term"><a class="link" href="#fu-st-bin"><code class="classname">GRAY:FUNDAMENTAL-BINARY-STREAM</code></a></span></dt><dd>This is a superclass of all user-defined streams
whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is a subtype of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>. It is a
subclass of <a class="link" href="#fu-st"><code class="classname">GRAY:FUNDAMENTAL-STREAM</code></a>. When you define a subclass of <a class="link" href="#fu-st-bin"><code class="classname">GRAY:FUNDAMENTAL-BINARY-STREAM</code></a>,
you have to provide a method on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>.
</dd><dt><span class="term"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-INPUT-STREAM</code></span></dt><dd>This is a convenience class inheriting from both
<a class="link" href="#fu-st-char"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-STREAM</code></a> and <a class="link" href="#fu-st-in"><code class="classname">GRAY:FUNDAMENTAL-INPUT-STREAM</code></a>.</dd><dt><span class="term"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-OUTPUT-STREAM</code></span></dt><dd>This is a convenience class inheriting from both
<a class="link" href="#fu-st-char"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-STREAM</code></a> and <a class="link" href="#fu-st-out"><code class="classname">GRAY:FUNDAMENTAL-OUTPUT-STREAM</code></a>.</dd><dt><span class="term"><code class="classname">GRAY:FUNDAMENTAL-BINARY-INPUT-STREAM</code></span></dt><dd>This is a convenience class inheriting from both
<a class="link" href="#fu-st-bin"><code class="classname">GRAY:FUNDAMENTAL-BINARY-STREAM</code></a> and <a class="link" href="#fu-st-in"><code class="classname">GRAY:FUNDAMENTAL-INPUT-STREAM</code></a>.</dd><dt><span class="term"><code class="classname">GRAY:FUNDAMENTAL-BINARY-OUTPUT-STREAM</code></span></dt><dd>This is a convenience class inheriting from both
<a class="link" href="#fu-st-bin"><code class="classname">GRAY:FUNDAMENTAL-BINARY-STREAM</code></a> and <a class="link" href="#fu-st-out"><code class="classname">GRAY:FUNDAMENTAL-OUTPUT-STREAM</code></a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-general"></a>30.3. General generic functions</h2></div></div></div><div class="variablelist"><p class="title"><strong>General generic functions defined on streams</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns the stream's element type, normally a
subtype of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.</p><p class="simpara">The method for <a class="link" href="#fu-st-char"><code class="classname">GRAY:FUNDAMENTAL-CHARACTER-STREAM</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.
</p></dd><dt><span class="term"><code class="code">((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a>)
<em class="replaceable"><code>new-element-type</code></em> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Changes the stream's element type.</p><p class="simpara">The default method <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see <a class="xref" href="#stream-eltype" title="21.8. Function STREAM-ELEMENT-TYPE">Section 21.8, “Function <code class="function">STREAM-ELEMENT-TYPE</code>”</a>).</p></dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:ABORT</code>)</code></span></dt><dd><p class="simpara">Closes the stream and flushes any associated buffers.
</p><p class="simpara">When you define a primary method on this
function, do not forget to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/locfun_call-next-method.html" target="_top"><code class="function">CALL-NEXT-METHOD</code></a>.
</p></dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns true before the stream has been closed, and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> after the stream has been closed.</p><p class="simpara">You do not need to add methods to this function.</p></dd><dt><a id="st-position"></a><span class="term"><code class="code">(<a class="link" href="#st-position"><code class="function">GRAY:STREAM-POSITION</code></a>
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>position</code></em>)</code></span></dt><dd><p class="simpara">Just like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-position.html" target="_top"><code class="function">FILE-POSITION</code></a>, but <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
<em class="replaceable"><code>position</code></em> means inquire.</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-rd-seq"></a><span class="term"><code class="code">(GRAY:STREAM-READ-SEQUENCE
<em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code>)</code></span></dt><dd><p class="simpara">Used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-sequence.html" target="_top"><code class="function">READ-SEQUENCE</code></a>. <span class="emphasis"><em>Deprecated</em></span>.
Define <a class="link" href="#st-rd-cs"><code class="function">GRAY:STREAM-READ-CHAR-SEQUENCE</code></a> or <a class="link" href="#st-rd-bs"><code class="function">GRAY:STREAM-READ-BYTE-SEQUENCE</code></a> and call <a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>/<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a> instead.
</p><p class="simpara">The default method calls <a class="link" href="#st-rd-cs"><code class="function">GRAY:STREAM-READ-CHAR-SEQUENCE</code></a> or <a class="link" href="#st-rd-bs"><code class="function">GRAY:STREAM-READ-BYTE-SEQUENCE</code></a>.
</p></dd><dt><a id="st-wr-seq"></a><span class="term"><code class="code">(GRAY:STREAM-WRITE-SEQUENCE
<em class="replaceable"><code>sequence</code></em> <em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code>)</code></span></dt><dd><p class="simpara">Used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-sequence.html" target="_top"><code class="function">WRITE-SEQUENCE</code></a>. <span class="emphasis"><em>Deprecated</em></span>.
Define <a class="link" href="#st-wr-cs"><code class="function">GRAY:STREAM-WRITE-CHAR-SEQUENCE</code></a> or <a class="link" href="#st-wr-bs"><code class="function">GRAY:STREAM-WRITE-BYTE-SEQUENCE</code></a> and call <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a>/<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> instead.
</p><p class="simpara">The default method calls <a class="link" href="#st-wr-cs"><code class="function">GRAY:STREAM-WRITE-CHAR-SEQUENCE</code></a> or <a class="link" href="#st-wr-bs"><code class="function">GRAY:STREAM-WRITE-BYTE-SEQUENCE</code></a>.
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-char-in"></a>30.4. Generic functions for character input</h2></div></div></div><div class="variablelist"><p class="title"><strong>Generic functions for character input</strong></p><dl class="variablelist"><dt><a id="st-rc"></a><span class="term"><code class="code">(<a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">If a character was pushed back using <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>,
returns and consumes it. Otherwise returns and consumes the next
character from the stream. Returns <code class="constant">:EOF</code> if the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached.
</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-uc"></a><span class="term"><code class="code">(<a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>char</code></em>)</code></span></dt><dd><p class="simpara">Pushes <em class="replaceable"><code>char</code></em>, which must be the last character
read from the <em class="replaceable"><code>stream</code></em>, back onto the front of the <em class="replaceable"><code>stream</code></em>.
</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-rcnh"></a><span class="term"><code class="code">(<a class="link" href="#st-rcnh"><code class="function">GRAY:STREAM-READ-CHAR-NO-HANG</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns a character or <code class="constant">:EOF</code>, like <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>, if
that would return immediately. If <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>'s value is not available
immediately, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> instead of waiting.</p><p class="simpara">
The default method simply calls <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>; this is sufficient for streams
whose <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> method never blocks.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-PEEK-CHAR <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">If a character was pushed back using <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>,
returns it. Otherwise returns the next character from the stream,
avoiding any side effects <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> would do. Returns <code class="constant">:EOF</code> if the
<code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached.</p><p class="simpara">The default method calls <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> and <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>; this is
sufficient for streams whose <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> method has no
side-effects.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-LISTEN <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">If a character was pushed back using <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>,
returns it. Otherwise returns the next character from the stream, if
already available. If no character is available immediately, or if
<code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p class="simpara">The default method calls <a class="link" href="#st-rcnh"><code class="function">GRAY:STREAM-READ-CHAR-NO-HANG</code></a> and <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>; this is
sufficient for streams whose <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> method has no
side-effects.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-READ-CHAR-WILL-HANG-P
<em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> will return immediately.
Otherwise it returns true.</p><p class="simpara">The default method calls <a class="link" href="#st-rcnh"><code class="function">GRAY:STREAM-READ-CHAR-NO-HANG</code></a> and <a class="link" href="#st-uc"><code class="function">GRAY:STREAM-UNREAD-CHAR</code></a>; this is
sufficient for streams whose <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a> method has no side-effects.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see <a class="link" href="#rcwhp"><code class="function">EXT:READ-CHAR-WILL-HANG-P</code></a>).</p></dd><dt><a id="st-rd-cs"></a><span class="term"><code class="code">(<a class="link" href="#st-rd-cs"><code class="function">GRAY:STREAM-READ-CHAR-SEQUENCE</code></a>
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>sequence</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> [<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em>]])</code></span></dt><dd><p class="simpara">Fills the subsequence of <em class="replaceable"><code>sequence</code></em> specified by
<code class="constant">:START</code> and <code class="constant">:END</code> with characters consecutively read from <em class="replaceable"><code>stream</code></em>.
Returns the index of the first element of <em class="replaceable"><code>sequence</code></em> that was not
updated (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> <em class="replaceable"><code>end</code></em>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function"><</code></a> <em class="replaceable"><code>end</code></em> if the stream reached its end).
</p><p class="simpara"><em class="replaceable"><code>sequence</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, i.e. a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
<em class="replaceable"><code>start</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and defaults to <code class="literal">0</code>.
<em class="replaceable"><code>end</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>sequence</code></em>)</code>.
</p><p class="simpara">The default method repeatedly calls <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>; this
is always sufficient if speed does not matter.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see
<a class="link" href="#rd-ch-seq"><code class="function">EXT:READ-CHAR-SEQUENCE</code></a>).</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-READ-LINE <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Reads a line of characters, and return two values:
the line (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, without the terminating <span class="keysym">#\Newline</span> character),
and a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> value which is true if the line was terminated by
<code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> instead of <span class="keysym">#\Newline</span>.</p><p class="simpara">The default method repeatedly calls <a class="link" href="#st-rc"><code class="function">GRAY:STREAM-READ-CHAR</code></a>; this
is always sufficient.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-CLEAR-INPUT <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Clears all pending interactive input from the
<em class="replaceable"><code>stream</code></em>, and returns true if some pending input was removed.</p><p class="simpara">The default method does nothing and returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>; this is
sufficient for non-interactive streams.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-char-out"></a>30.5. Generic functions for character output</h2></div></div></div><div class="variablelist"><p class="title"><strong>Generic functions for character output</strong></p><dl class="variablelist"><dt><a id="st-wc"></a><span class="term"><code class="code">(<a class="link" href="#st-wc"><code class="function">GRAY:STREAM-WRITE-CHAR</code></a> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>char</code></em>)</code></span></dt><dd><p class="simpara">Writes <em class="replaceable"><code>char</code></em>.
</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-lc"></a><span class="term"><code class="code">(<a class="link" href="#st-lc"><code class="function">GRAY:STREAM-LINE-COLUMN</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns the column number where the next character
would be written (<code class="literal">0</code> stands for the first column),
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if that is not meaningful for this stream.
</p><p class="simpara">You must define a method for this function.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-START-LINE-P <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns true if the next character would be
written at the start of a new line.</p><p class="simpara">The default method calls <a class="link" href="#st-lc"><code class="function">GRAY:STREAM-LINE-COLUMN</code></a> and compares its result with
0; this is sufficient for streams whose <a class="link" href="#st-lc"><code class="function">GRAY:STREAM-LINE-COLUMN</code></a> never returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</p></dd><dt><a id="st-wr-cs"></a><span class="term"><code class="code">(<a class="link" href="#st-wr-cs"><code class="function">GRAY:STREAM-WRITE-CHAR-SEQUENCE</code></a>
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>sequence</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> [<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em>]])</code></span></dt><dd><p class="simpara">Outputs the subsequence of <em class="replaceable"><code>sequence</code></em> specified
by <code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em>.</p><p class="simpara"><em class="replaceable"><code>sequence</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, i.e. a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
<em class="replaceable"><code>start</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and defaults to 0.
<em class="replaceable"><code>end</code></em> is a nonnegative integer or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>sequence</code></em>)</code>.
</p><p class="simpara">The default method repeatedly calls <a class="link" href="#st-wc"><code class="function">GRAY:STREAM-WRITE-CHAR</code></a>; this
is always sufficient if speed does not matter.
</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension
(see <a class="link" href="#wr-ch-seq"><code class="function">EXT:WRITE-CHAR-SEQUENCE</code></a>).</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-WRITE-STRING
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> [<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em>]])</code></span></dt><dd><p class="simpara">Outputs the subsequence of <em class="replaceable"><code>string</code></em> specified by
<code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em>. Returns <em class="replaceable"><code>string</code></em>.</p><p class="simpara"><em class="replaceable"><code>string</code></em> is a string. <em class="replaceable"><code>start</code></em> is a nonnegative integer
and default to 0. <em class="replaceable"><code>end</code></em> is a nonnegative integer or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and
defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>string</code></em>)</code>.
</p><p class="simpara">The default method calls <a class="link" href="#st-wr-cs"><code class="function">GRAY:STREAM-WRITE-CHAR-SEQUENCE</code></a>;
this is always sufficient.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-TERPRI <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Outputs a <span class="keysym">#\Newline</span> character.</p><p class="simpara">The default method calls <a class="link" href="#st-wc"><code class="function">GRAY:STREAM-WRITE-CHAR</code></a>; this is always
sufficient.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-FRESH-LINE <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Possibly outputs a <span class="keysym">#\Newline</span> character, so as to ensure
that the next character would be written at the start of a new line.
Returns true if it did output a <span class="keysym">#\Newline</span> character.</p><p class="simpara">The default method calls
<code class="function">GRAY:STREAM-START-LINE-P</code> and then
<code class="function">GRAY:STREAM-TERPRI</code> if necessary; this is always
sufficient.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-FINISH-OUTPUT <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Ensures that any buffered output has reached its
destination, and then returns.</p><p class="simpara">The default method does nothing.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-FORCE-OUTPUT <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Brings any buffered output on its way towards its
destination, and returns without waiting until it has reached its
destination.</p><p class="simpara">The default method does nothing.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-CLEAR-OUTPUT <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Attempts to discard any buffered output which has
not yet reached its destination.</p><p class="simpara">The default method does nothing.</p></dd><dt><span class="term"><code class="code">(GRAY:STREAM-ADVANCE-TO-COLUMN
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>column</code></em>)</code></span></dt><dd><p class="simpara">Ensures that the next character will be written at
least at <em class="replaceable"><code>column</code></em>.</p><p class="simpara">The default method outputs an appropriate amount of space
characters; this is sufficient for non-proportional output.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-byte-in"></a>30.6. Generic functions for binary input</h2></div></div></div><div class="variablelist"><p class="title"><strong>Generic functions for binary input</strong></p><dl class="variablelist"><dt><a id="st-rb"></a><span class="term"><code class="code">(<a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">Returns and consumes the next integer from the
stream. Returns <code class="constant">:EOF</code> if the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is reached.</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-rbla"></a><span class="term"><code class="code">(<a class="link" href="#st-rbla"><code class="function">GRAY:STREAM-READ-BYTE-LOOKAHEAD</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">To be called only if <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a> would return immediately with an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> result. Returns <code class="constant">:EOF</code> if the <code class="literal"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_e.html#end-of-stream">end-of-stream</a></code> is already
known to be reached. If <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a>'s value is not available
immediately, returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> instead of waiting.</p><p class="simpara">You must define a method for this function.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see
<a class="link" href="#rbla"><code class="function">EXT:READ-BYTE-LOOKAHEAD</code></a>).</p></dd><dt><a id="st-rbwhp"></a><span class="term"><code class="code">(<a class="link" href="#rbwhp"><code class="function">GRAY:STREAM-READ-BYTE-WILL-HANG-P</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">To be called only if <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a> will return immediately.
Otherwise it returns true.</p><p class="simpara">The default method calls <a class="link" href="#st-rbla"><code class="function">GRAY:STREAM-READ-BYTE-LOOKAHEAD</code></a>; this is always sufficient.
</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see <a class="link" href="#rbwhp"><code class="function">EXT:READ-BYTE-WILL-HANG-P</code></a>).
</p></dd><dt><a id="st-rbnh"></a><span class="term"><code class="code">(<a class="link" href="#rbnh"><code class="function">GRAY:STREAM-READ-BYTE-NO-HANG</code></a> <em class="replaceable"><code>stream</code></em>)</code></span></dt><dd><p class="simpara">To be called only if <em class="replaceable"><code>stream</code></em>'s
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> is <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span>.
Returns an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or <code class="constant">:EOF</code>, like <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a>, if that would
return immediately. If <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a>'s value is not available immediately,
returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> instead of waiting.</p><p class="simpara">The default method calls <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a> if <a class="link" href="#st-rbla"><code class="function">GRAY:STREAM-READ-BYTE-LOOKAHEAD</code></a> returns true;
this is always sufficient.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see <a class="link" href="#rbnh"><code class="function">EXT:READ-BYTE-NO-HANG</code></a>).
</p></dd><dt><a id="st-rd-bs"></a><span class="term"><code class="code">(<a class="link" href="#st-rd-bs"><code class="function">GRAY:STREAM-READ-BYTE-SEQUENCE</code></a>
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>sequence</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
[<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em> [<em class="replaceable"><code>no-hang</code></em> [<em class="replaceable"><code>interactive</code></em>]]]])</code></span></dt><dd><p class="simpara">Fills the subsequence of <em class="replaceable"><code>sequence</code></em> specified by
<code class="constant">:START</code> and <code class="constant">:END</code> with integers consecutively read from <em class="replaceable"><code>stream</code></em>.
Returns the index of the first element of <em class="replaceable"><code>sequence</code></em> that was not
updated (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">=</code></a> <em class="replaceable"><code>end</code></em>, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function"><</code></a> <em class="replaceable"><code>end</code></em> if the stream reached its end).
</p><p class="simpara"><em class="replaceable"><code>sequence</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s.
<em class="replaceable"><code>start</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and defaults to 0.
<em class="replaceable"><code>end</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>sequence</code></em>)</code>.
If <em class="replaceable"><code>no-hang</code></em> is true, the function should avoid blocking and instead fill
only as many elements as are immediately available. If <em class="replaceable"><code>no-hang</code></em> is false
and <em class="replaceable"><code>interactive</code></em> is true, the function can block for reading the first
byte but should avoid blocking for any further bytes.</p><p class="simpara">The default method repeatedly calls <a class="link" href="#st-rb"><code class="function">GRAY:STREAM-READ-BYTE</code></a>; this
is always sufficient if speed does not matter.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see
<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a>).</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gray-gf-byte-out"></a>30.7. Generic functions for binary output</h2></div></div></div><div class="variablelist"><p class="title"><strong>Generic functions for binary output</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(GRAY:STREAM-WRITE-BYTE
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>integer</code></em>)</code></span></dt><dd><p class="simpara">Writes <em class="replaceable"><code>integer</code></em>.</p><p class="simpara">You must define a method for this function.</p></dd><dt><a id="st-wr-bs"></a><span class="term"><code class="code">(<a class="link" href="#st-wr-bs"><code class="function">GRAY:STREAM-WRITE-BYTE-SEQUENCE</code></a>
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>sequence</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
[<em class="replaceable"><code>start</code></em> [<em class="replaceable"><code>end</code></em> [<em class="replaceable"><code>no-hang</code></em> [<em class="replaceable"><code>interactive</code></em>]]]])</code></span></dt><dd><p class="simpara">Outputs the subsequence of <em class="replaceable"><code>sequence</code></em> specified
by <code class="constant">:START</code> and <code class="constant">:END</code> to <em class="replaceable"><code>stream</code></em></p><p class="simpara"><em class="replaceable"><code>sequence</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s.
<em class="replaceable"><code>start</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and defaults to 0.
<em class="replaceable"><code>end</code></em> is a nonnegative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
which stands for <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> <em class="replaceable"><code>sequence</code></em>)</code>.
If <em class="replaceable"><code>no-hang</code></em> is true, the function should avoid blocking and instead output
only as many elements as it can immediately proceed. If <em class="replaceable"><code>no-hang</code></em> is false
and <em class="replaceable"><code>interactive</code></em> is true, the function can block for writing the first
byte but should avoid blocking for any further bytes.</p><p class="simpara">The default method repeatedly calls
<code class="function">GRAY:STREAM-WRITE-BYTE</code>; this is always
sufficient if speed does not matter.</p><p class="simpara">This function is a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> extension (see
<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a>).</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fill-stream"></a>30.8. Class <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a></h2></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>30.1. <a href="#ex-fill-stream">Example of <code class="classname">EXT:FILL-STREAM</code> usage</a></dt></dl></div><p>As an example of the use of <a class="link" href="#gray" title="Chapter 30. Gray streams"><strong class="package"><span class="quote">“<span class="quote">GRAY</span>”</span></strong></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
offers an additional class, <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a>. An instance of this class
is a <span class="quote">“<span class="quote">formatting</span>”</span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, which makes the final
output to the underlying stream look neat: indented and filled.
An instance of <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> is created like this:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a> '<a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> :stream <em class="replaceable"><code>stream</code></em>
[:text-indent symbol-or-number]
[:sexp-indent symbol-or-number-or-function])
</pre><p>where</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>stream</code></em></span></dt><dd>is the target <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> where the output actually
goes.</dd><dt><span class="term"><em class="replaceable"><code>symbol-or-number</code></em></span></dt><dd>is the variable whose value is the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> text
indentation or the indentation itself (defaults to 0).
</dd><dt><span class="term"><em class="replaceable"><code>symbol-or-number-or-function</code></em></span></dt><dd><p>When <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> writes an S-expression to a
<a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> using <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_22-3-4-2.html"><code class="literal">~S</code></a>, and the expression's printed
representation does not fit on the current line, it is printed on
separate lines, ignoring the prescribed text indentation and
preserving spacing. When this argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the
S-expression <span class="strong"><strong>is</strong></span> indented by:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></span></dt><dd>the text indentation above;
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-value.html" target="_top"><code class="function">SYMBOL-VALUE</code></a> is the indentation;
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></span></dt><dd>the indentation itself;
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a></span></dt><dd>called with one argument, the text indentation,
and the value is used as S-expression indentation;
thus <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_identity.html" target="_top"><code class="function">IDENTITY</code></a> is equivalent to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> above.
</dd></dl></div><p>
Defaults to <a href="impnotes.html#fill-stream" class="olink"><code class="varname">CUSTOM:*FILL-INDENT-SEXP*</code></a>, whose initial value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_1plcm_1-.html" target="_top"><code class="function">1+</code></a>.
</p></dd></dl></div><p></p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Note that, due to buffering, one must call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FORCE-OUTPUT</code></a>
when done with the <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> (and before changing the indent variable).
The former is done automatically by the macro
<code class="code">(with-fill-stream (fill target-stream ...) ...)</code>.</p></div><div class="example"><a id="ex-fill-stream"></a><p class="title"><strong>Example 30.1. Example of <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a> usage</strong></p><div class="example-contents"><pre class="programlisting">
(defvar *my-indent-level*)
(with-output-to-string (out)
(let ((*print-right-margin* 20)
(*print-pretty* t)
(*my-indent-level* 2))
(with-fill-stream (fill out :text-indent '*my-indent-level*)
(format fill "~%this is some long sentence which will be broken at spaces")
(force-output fill)
(let ((*my-indent-level* 5))
(format fill "~%and properly indented to the level specified by the ~S argument which can be a ~S or an ~S - cool!"
:TEXT-INDENT 'symbol 'integer)
(force-output fill))
(format fill "~%Don't forget to call ~S on it, and/or use ~S Pretty formatting of the S-expressions printed with ~~S is preserved: ~S"
'force-output 'with-fill-stream '(defun foo (x y z) (if x (+ y z) (* y z)))))))
⇒ <code class="computeroutput">"
this is some long
sentence which
will be broken at
spaces
and properly
indented to
the level
specified by
the
:TEXT-INDENT
argument which
can be a
SYMBOL or an
INTEGER -
cool!
Don't forget to
call FORCE-OUTPUT
on it, and/or use
WITH-FILL-STREAM
Pretty formatting
of the
S-expressions
printed with ~S
is preserved:
(DEFUN FOO
(X Y Z)
(IF X (+ Y Z)
(* Y Z)))
"</code></pre></div></div><br class="example-break" /></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="ext-clisp"></a>Part III. Extensions Specific to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#ext-p-indep">31. Platform Independent Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="#custom-init-fini">31.1. Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination</a></span></dt><dd><dl><dt><span class="section"><a href="#cradle-grave">31.1.1. Cradle to Grave</a></span></dt><dt><span class="section"><a href="#init-hooks">31.1.2. Customizing Initialization</a></span></dt><dt><span class="section"><a href="#fini-hooks">31.1.3. Customizing Termination</a></span></dt></dl></dd><dt><span class="section"><a href="#image">31.2. Saving an Image</a></span></dt><dd><dl><dt><span class="section"><a href="#image-portability">31.2.1. Image Portability</a></span></dt></dl></dd><dt><span class="section"><a href="#quit">31.3. Quitting <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#i18n">31.4. Internationalization of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#language">31.4.1. The Language</a></span></dt></dl></dd><dt><span class="section"><a href="#encoding">31.5. Encodings</a></span></dt><dd><dl><dt><span class="section"><a href="#encodings-intro">31.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#charset">31.5.2. Character Sets</a></span></dt><dt><span class="section"><a href="#newline">31.5.3. Line Terminators</a></span></dt><dt><span class="section"><a href="#make-encoding">31.5.4. Function <code class="function">EXT:MAKE-ENCODING</code></a></span></dt><dt><span class="section"><a href="#enc-charset">31.5.5. Function <code class="function">EXT:ENCODING-CHARSET</code></a></span></dt><dt><span class="section"><a href="#enc-dflt">31.5.6. Default encodings</a></span></dt><dt><span class="section"><a href="#string-byte">31.5.7. Converting between strings and byte vectors</a></span></dt></dl></dd><dt><span class="section"><a href="#gstream">31.6. Generic streams</a></span></dt><dt><span class="section"><a href="#weak">31.7. Weak Objects</a></span></dt><dd><dl><dt><span class="section"><a href="#weak-pointer">31.7.1. Weak Pointers</a></span></dt><dt><span class="section"><a href="#weak-list">31.7.2. Weak Lists</a></span></dt><dt><span class="section"><a href="#weak-and-relation">31.7.3. Weak <span class="quote">“<span class="quote">And</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-or-relation">31.7.4. Weak <span class="quote">“<span class="quote">Or</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-mapping">31.7.5. Weak Associations</a></span></dt><dt><span class="section"><a href="#weak-and-mapping">31.7.6. Weak <span class="quote">“<span class="quote">And</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-or-mapping">31.7.7. Weak <span class="quote">“<span class="quote">Or</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-alist">31.7.8. Weak Association Lists</a></span></dt><dt><span class="section"><a href="#weak-ht">31.7.9. Weak Hash Tables</a></span></dt></dl></dd><dt><span class="section"><a href="#final">31.8. Finalization</a></span></dt><dt><span class="section"><a href="#prompt">31.9. The Prompt</a></span></dt><dt><span class="section"><a href="#ansi">31.10. Maximum ANSI CL compliance</a></span></dt><dt><span class="section"><a href="#macros3">31.11. Additional Fancy Macros and Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#ethe">31.11.1. Macro <code class="function">EXT:ETHE</code></a></span></dt><dt><span class="section"><a href="#letf">31.11.2. Macros <code class="function">EXT:LETF</code> & <code class="function">EXT:LETF*</code></a></span></dt><dt><span class="section"><a href="#memoized">31.11.3. Macro <code class="function">EXT:MEMOIZED</code></a></span></dt><dt><span class="section"><a href="#with-collect">31.11.4. Macro <code class="function">EXT:WITH-COLLECT</code></a></span></dt><dt><span class="section"><a href="#compile-time-value">31.11.5. Macro <code class="function">EXT:COMPILE-TIME-VALUE</code></a></span></dt><dt><span class="section"><a href="#with-gensyms">31.11.6. Macro <code class="function">EXT:WITH-GENSYMS</code></a></span></dt><dt><span class="section"><a href="#remove-plist">31.11.7. Function <code class="function">EXT:REMOVE-PLIST</code></a></span></dt><dt><span class="section"><a href="#html-http-output">31.11.8. Macros <code class="function">EXT:WITH-HTML-OUTPUT</code> and <code class="function">EXT:WITH-HTTP-OUTPUT</code></a></span></dt><dt><span class="section"><a href="#open-http">31.11.9. Function <code class="function">EXT:OPEN-HTTP</code> and macro <code class="function">EXT:WITH-HTTP-INPUT</code></a></span></dt><dt><span class="section"><a href="#http-log-stream">31.11.10. Variable <code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></span></dt><dt><span class="section"><a href="#browse-url">31.11.11. Function <code class="function">EXT:BROWSE-URL</code></a></span></dt><dt><span class="section"><a href="#http-proxy">31.11.12. Variable <code class="varname">CUSTOM:*HTTP-PROXY*</code></a></span></dt><dt><span class="section"><a href="#canonicalize">31.11.13. Function <code class="function">EXT:CANONICALIZE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#customize">31.12. Customizing <span class="command"><strong>CLISP</strong></span> behavior</a></span></dt><dt><span class="section"><a href="#code-walk">31.13. Code Walker</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ext-platform">32. Platform Specific Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="#screen">32.1. Random Screen Access</a></span></dt><dt><span class="section"><a href="#modules">32.2. External Modules</a></span></dt><dd><dl><dt><span class="section"><a href="#mod-overview">32.2.1. Overview</a></span></dt><dt><span class="section"><a href="#modinit">32.2.2. Module initialization</a></span></dt><dt><span class="section"><a href="#modfini">32.2.3. Module finalization</a></span></dt><dt><span class="section"><a href="#modinfo">32.2.4. Function <code class="function">EXT:MODULE-INFO</code></a></span></dt><dt><span class="section"><a href="#mod-dynload">32.2.5. Dynamic module loading</a></span></dt><dt><span class="section"><a href="#mod-set-example">32.2.6. Example</a></span></dt><dt><span class="section"><a href="#module-tools">32.2.7. Module tools</a></span></dt><dt><span class="section"><a href="#mod-ffi-vs-c">32.2.8. Trade-offs: <strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong> vs. <span class="command"><strong>C</strong></span> modules</a></span></dt><dt><span class="section"><a href="#included-modules">32.2.9. Modules included in the source distribution</a></span></dt></dl></dd><dt><span class="section"><a href="#dffi">32.3. The Foreign Function Call Facility</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-intro">32.3.1. Introduction</a></span></dt><dt><span class="section"><a href="#dffi-overview">32.3.2. Overview</a></span></dt><dt><span class="section"><a href="#dffi-types">32.3.3. (Foreign) <span class="command"><strong>C</strong></span> types</a></span></dt><dt><span class="section"><a href="#c-flavor">32.3.4. The choice of the <span class="command"><strong>C</strong></span> flavor</a></span></dt><dt><span class="section"><a href="#dffi-variables">32.3.5. Foreign variables</a></span></dt><dt><span class="section"><a href="#dffi-places">32.3.6. Operations on foreign places</a></span></dt><dt><span class="section"><a href="#dffi-functions">32.3.7. Foreign functions</a></span></dt><dt><span class="section"><a href="#allocation">32.3.8. Argument and result passing conventions</a></span></dt><dt><span class="section"><a href="#param-mode">32.3.9. Parameter Mode</a></span></dt><dt><span class="section"><a href="#dffi-examples">32.3.10. Examples</a></span></dt></dl></dd><dt><span class="section"><a href="#socket">32.4. Socket Streams</a></span></dt><dd><dl><dt><span class="section"><a href="#socket-intro">32.4.1. Introduction</a></span></dt><dt><span class="section"><a href="#socket-api">32.4.2. Socket API Reference</a></span></dt><dt><span class="section"><a href="#timeout-k">32.4.3. Argument <code class="constant">:TIMEOUT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mt">32.5. Multiple Threads of Execution</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-intro">32.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#mt-general">32.5.2. General principles</a></span></dt><dt><span class="section"><a href="#mt-api">32.5.3. Thread API reference</a></span></dt></dl></dd><dt><span class="section"><a href="#quickstart">32.6. Quickstarting delivery with <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#quickstart-summary">32.6.1. Summary</a></span></dt><dt><span class="section"><a href="#quickstart-unix">32.6.2. Scripting with <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#quickstart-desktop">32.6.3. Desktop Environments</a></span></dt><dt><span class="section"><a href="#quickstart-linux">32.6.4. Associating extensions with <span class="command"><strong>CLISP</strong></span> via kernel</a></span></dt></dl></dd><dt><span class="section"><a href="#shell">32.7. Shell, Pipes and Printing</a></span></dt><dd><dl><dt><span class="section"><a href="#exec">32.7.1. Shell</a></span></dt><dt><span class="section"><a href="#pipe">32.7.2. Pipes</a></span></dt><dt><span class="section"><a href="#hardcopy">32.7.3. Printing</a></span></dt></dl></dd><dt><span class="section"><a href="#getenv">32.8. Operating System Environment</a></span></dt></dl></dd><dt><span class="chapter"><a href="#ext-modules">33. Extensions Implemented as Modules</a></span></dt><dd><dl><dt><span class="section"><a href="#asdf">33.1. A System Definition Facility</a></span></dt><dt><span class="section"><a href="#syscalls">33.2. System Calls</a></span></dt><dd><dl><dt><span class="section"><a href="#neworking">33.2.1. Networking</a></span></dt><dt><span class="section"><a href="#file-system">33.2.2. File system</a></span></dt><dt><span class="section"><a href="#user-group">33.2.3. Users and Groups</a></span></dt><dt><span class="section"><a href="#sysinfo">33.2.4. System Information</a></span></dt><dt><span class="section"><a href="#posix-math">33.2.5. Mathematical functions</a></span></dt><dt><span class="section"><a href="#encryption">33.2.6. Encryption</a></span></dt><dt><span class="section"><a href="#sys-log">33.2.7. Syslog</a></span></dt><dt><span class="section"><a href="#processes">33.2.8. Processes</a></span></dt><dt><span class="section"><a href="#accounting">33.2.9. Accounting</a></span></dt><dt><span class="section"><a href="#posix-time">33.2.10. Time and Data Conversion</a></span></dt><dt><span class="section"><a href="#strverscmp">33.2.11. String comparision</a></span></dt><dt><span class="section"><a href="#wildcard">33.2.12. Wildcard Matching</a></span></dt><dt><span class="section"><a href="#mk-xterm-io">33.2.13. XTerm</a></span></dt><dt><span class="section"><a href="#stdio">33.2.14. Standard file input and output</a></span></dt><dt><span class="section"><a href="#errno">33.2.15. Error handling</a></span></dt><dt><span class="section"><a href="#misc">33.2.16. Miscellanea</a></span></dt></dl></dd><dt><span class="section"><a href="#i18n-mod">33.3. Internationalization of User Programs</a></span></dt><dd><dl><dt><span class="section"><a href="#ggettext">33.3.1. The GNU gettext</a></span></dt><dt><span class="section"><a href="#i18n-locale">33.3.2. Locale</a></span></dt></dl></dd><dt><span class="section"><a href="#regexp-mod">33.4. POSIX Regular Expressions</a></span></dt><dt><span class="section"><a href="#readline-mod">33.5. Advanced Readline and History Functionality</a></span></dt><dt><span class="section"><a href="#gdbm">33.6. GDBM - The GNU database manager</a></span></dt><dt><span class="section"><a href="#berkeley-db">33.7. Berkeley DB access</a></span></dt><dd><dl><dt><span class="section"><a href="#bdb-objects">33.7.1. Berkeley-DB Objects</a></span></dt><dt><span class="section"><a href="#bdb-close">33.7.2. Closing handles</a></span></dt><dt><span class="section"><a href="#bdb-db-environment">33.7.3. Database Environment</a></span></dt><dt><span class="section"><a href="#bdb-environment-config">33.7.4. Environment Configuration</a></span></dt><dt><span class="section"><a href="#bdb-operations">33.7.5. Database Operations</a></span></dt><dt><span class="section"><a href="#bdb-db-config">33.7.6. Database Configuration</a></span></dt><dt><span class="section"><a href="#bdb-cursor">33.7.7. Database Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-lock">33.7.8. Lock Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-log">33.7.9. Log Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-mem-pool">33.7.10. Memory Pool Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-replication">33.7.11. Replication</a></span></dt><dt><span class="section"><a href="#bdb-sequences">33.7.12. Sequences</a></span></dt><dt><span class="section"><a href="#bdb-transaction">33.7.13. Transaction Subsystem</a></span></dt></dl></dd><dt><span class="section"><a href="#dir-key">33.8. Directory Access</a></span></dt><dt><span class="section"><a href="#postgresql">33.9. PostgreSQL Database Access</a></span></dt><dt><span class="section"><a href="#oracle">33.10. Oracle Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#ora-functionality">33.10.1. Functions and Macros in package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#ora-example">33.10.2. Oracle Example</a></span></dt><dt><span class="section"><a href="#ora-config">33.10.3. Oracle Configuration</a></span></dt><dt><span class="section"><a href="#ora-build">33.10.4. Building the Oracle Interface</a></span></dt></dl></dd><dt><span class="section"><a href="#libsvm">33.11. LibSVM Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#libsvm-types">33.11.1. Types</a></span></dt><dt><span class="section"><a href="#libsvm-output">33.11.2. Output</a></span></dt><dt><span class="section"><a href="#libsvm-functions">33.11.3. Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#pari">33.12. Computer Algebra System PARI</a></span></dt><dt><span class="section"><a href="#matlab">33.13. Matlab Interface</a></span></dt><dt><span class="section"><a href="#netica">33.14. Netica Interface</a></span></dt><dt><span class="section"><a href="#pcre">33.15. Perl Compatible Regular Expressions</a></span></dt><dt><span class="section"><a href="#zlib">33.16. Interface to zlib</a></span></dt><dt><span class="section"><a href="#rawsock">33.17. Raw Socket Access</a></span></dt><dd><dl><dt><span class="section"><a href="#rawsock-intro">33.17.1. Introduction</a></span></dt><dt><span class="section"><a href="#rawsock-func">33.17.2. Single System Call Functions</a></span></dt><dt><span class="section"><a href="#rawsock-args">33.17.3. Common arguments</a></span></dt><dt><span class="section"><a href="#rawsock-return">33.17.4. Return Values</a></span></dt><dt><span class="section"><a href="#rawsock-not-implemented">33.17.5. Not Implemented</a></span></dt><dt><span class="section"><a href="#rawsock-errors">33.17.6. Errors</a></span></dt><dt><span class="section"><a href="#rawsock-high-level">33.17.7. High-Level Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#fastcgi">33.18. The FastCGI Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#fcgi-overview">33.18.1. Overview of FastCGI</a></span></dt><dt><span class="section"><a href="#fcgi-functionality">33.18.2. Functions in Package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#fcgi-example">33.18.3. FastCGI Example</a></span></dt><dt><span class="section"><a href="#fcgi-build">33.18.4. Building and configuring the FastCGI Interface</a></span></dt></dl></dd><dt><span class="section"><a href="#dbus">33.19. Interface to D-Bus</a></span></dt><dt><span class="section"><a href="#gtk">33.20. GTK Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#gtk-hi">33.20.1. High-level functions</a></span></dt></dl></dd></dl></dd></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="ext-p-indep"></a>Chapter 31. Platform Independent Extensions</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#custom-init-fini">31.1. Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination</a></span></dt><dd><dl><dt><span class="section"><a href="#cradle-grave">31.1.1. Cradle to Grave</a></span></dt><dt><span class="section"><a href="#init-hooks">31.1.2. Customizing Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#init-hooks-function">31.1.2.1. The difference between <code class="varname">CUSTOM:*INIT-HOOKS*</code> and init function</a></span></dt></dl></dd><dt><span class="section"><a href="#fini-hooks">31.1.3. Customizing Termination</a></span></dt></dl></dd><dt><span class="section"><a href="#image">31.2. Saving an Image</a></span></dt><dd><dl><dt><span class="section"><a href="#image-portability">31.2.1. Image Portability</a></span></dt></dl></dd><dt><span class="section"><a href="#quit">31.3. Quitting <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#i18n">31.4. Internationalization of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#language">31.4.1. The Language</a></span></dt></dl></dd><dt><span class="section"><a href="#encoding">31.5. Encodings</a></span></dt><dd><dl><dt><span class="section"><a href="#encodings-intro">31.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#charset">31.5.2. Character Sets</a></span></dt><dt><span class="section"><a href="#newline">31.5.3. Line Terminators</a></span></dt><dt><span class="section"><a href="#make-encoding">31.5.4. Function <code class="function">EXT:MAKE-ENCODING</code></a></span></dt><dt><span class="section"><a href="#enc-charset">31.5.5. Function <code class="function">EXT:ENCODING-CHARSET</code></a></span></dt><dt><span class="section"><a href="#enc-dflt">31.5.6. Default encodings</a></span></dt><dd><dl><dt><span class="section"><a href="#line-term-default">31.5.6.1. Default line terminator</a></span></dt></dl></dd><dt><span class="section"><a href="#string-byte">31.5.7. Converting between strings and byte vectors</a></span></dt></dl></dd><dt><span class="section"><a href="#gstream">31.6. Generic streams</a></span></dt><dt><span class="section"><a href="#weak">31.7. Weak Objects</a></span></dt><dd><dl><dt><span class="section"><a href="#weak-pointer">31.7.1. Weak Pointers</a></span></dt><dt><span class="section"><a href="#weak-list">31.7.2. Weak Lists</a></span></dt><dt><span class="section"><a href="#weak-and-relation">31.7.3. Weak <span class="quote">“<span class="quote">And</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-or-relation">31.7.4. Weak <span class="quote">“<span class="quote">Or</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-mapping">31.7.5. Weak Associations</a></span></dt><dt><span class="section"><a href="#weak-and-mapping">31.7.6. Weak <span class="quote">“<span class="quote">And</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-or-mapping">31.7.7. Weak <span class="quote">“<span class="quote">Or</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-alist">31.7.8. Weak Association Lists</a></span></dt><dt><span class="section"><a href="#weak-ht">31.7.9. Weak Hash Tables</a></span></dt></dl></dd><dt><span class="section"><a href="#final">31.8. Finalization</a></span></dt><dt><span class="section"><a href="#prompt">31.9. The Prompt</a></span></dt><dt><span class="section"><a href="#ansi">31.10. Maximum ANSI CL compliance</a></span></dt><dt><span class="section"><a href="#macros3">31.11. Additional Fancy Macros and Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#ethe">31.11.1. Macro <code class="function">EXT:ETHE</code></a></span></dt><dt><span class="section"><a href="#letf">31.11.2. Macros <code class="function">EXT:LETF</code> & <code class="function">EXT:LETF*</code></a></span></dt><dt><span class="section"><a href="#memoized">31.11.3. Macro <code class="function">EXT:MEMOIZED</code></a></span></dt><dt><span class="section"><a href="#with-collect">31.11.4. Macro <code class="function">EXT:WITH-COLLECT</code></a></span></dt><dt><span class="section"><a href="#compile-time-value">31.11.5. Macro <code class="function">EXT:COMPILE-TIME-VALUE</code></a></span></dt><dt><span class="section"><a href="#with-gensyms">31.11.6. Macro <code class="function">EXT:WITH-GENSYMS</code></a></span></dt><dt><span class="section"><a href="#remove-plist">31.11.7. Function <code class="function">EXT:REMOVE-PLIST</code></a></span></dt><dt><span class="section"><a href="#html-http-output">31.11.8. Macros <code class="function">EXT:WITH-HTML-OUTPUT</code> and <code class="function">EXT:WITH-HTTP-OUTPUT</code></a></span></dt><dt><span class="section"><a href="#open-http">31.11.9. Function <code class="function">EXT:OPEN-HTTP</code> and macro <code class="function">EXT:WITH-HTTP-INPUT</code></a></span></dt><dt><span class="section"><a href="#http-log-stream">31.11.10. Variable <code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></span></dt><dt><span class="section"><a href="#browse-url">31.11.11. Function <code class="function">EXT:BROWSE-URL</code></a></span></dt><dt><span class="section"><a href="#http-proxy">31.11.12. Variable <code class="varname">CUSTOM:*HTTP-PROXY*</code></a></span></dt><dt><span class="section"><a href="#canonicalize">31.11.13. Function <code class="function">EXT:CANONICALIZE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#customize">31.12. Customizing <span class="command"><strong>CLISP</strong></span> behavior</a></span></dt><dt><span class="section"><a href="#code-walk">31.13. Code Walker</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="custom-init-fini"></a>31.1. Customizing <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> Process
Initialization and Termination</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#cradle-grave">31.1.1. Cradle to Grave</a></span></dt><dt><span class="section"><a href="#init-hooks">31.1.2. Customizing Initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#init-hooks-function">31.1.2.1. The difference between <code class="varname">CUSTOM:*INIT-HOOKS*</code> and init function</a></span></dt></dl></dd><dt><span class="section"><a href="#fini-hooks">31.1.3. Customizing Termination</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="cradle-grave"></a>31.1.1. Cradle to Grave</h3></div><div><h4 class="subtitle">What is done when</h4></div></div></div><div class="procedure"><ol class="procedure" type="1"><li class="step"><p class="title"><strong>Initialization</strong></p><ol type="a" class="substeps"><li class="step"><p>Parse command line arguments until the first
positional argument (see <a href="impnotes.html#image-script" class="olink"><code class="constant">:SCRIPT</code></a>).</p></li><li class="step"><p>Load the <a href="impnotes.html#image" class="olink">memory image</a>.</p></li><li class="step"><p>Install internal signal handlers.</p></li><li class="step"><p>Initialize time variables.</p></li><li class="step"><p>Initialize <a class="link" href="#enc-dflt" title="31.5.6. Default encodings">locale-dependent
encodings</a>.</p></li><li class="step"><p>Initialize stream variables.</p></li><li class="step"><p>Initialize pathname variables.</p></li><li class="step"><p>Initialize <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.</p></li><li class="step"><p><a class="link" href="#modinit" title="32.2.2. Module initialization">Initialize
modules</a>.</p></li><li class="step"><p>Run all functions in <a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a>.</p></li><li class="step"><p>Say <span class="quote">“<span class="quote">hi</span>”</span>, unless suppressed by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-q</a></code>.
</p></li><li class="step"><p>Load <a href="clisp.html#opt-norc" class="olink">RC file</a>, unless suppressed by
<code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code>.</p></li></ol></li><li class="step"><p class="title"><strong>The actual work</strong></p><p>Handle command line options: file
<a href="clisp.html#opt-init" class="olink">loading</a> and/or
<a href="clisp.html#opt-compile" class="olink">compilation</a>,
<a href="clisp.html#opt-exec-expr" class="olink">form evaluation</a>,
<a href="clisp.html#opt-exec-file" class="olink">script</a> execution, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>.</p></li><li class="step"><p class="title"><strong>Finalization (executed even on abnormal exit due
to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html"><code class="function">kill</code></a>)</strong></p><ol type="a" class="substeps"><li class="step"><p>Unwind the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, executing cleanup forms in
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>.</p></li><li class="step"><p>Run all functions in <a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a>.</p></li><li class="step"><p>Call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">FRESH-LINE</code></a> on the standard streams.</p></li><li class="step"><p>Say <span class="quote">“<span class="quote">bye</span>”</span> unless suppressed by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-q</a></code>.
</p></li><li class="step"><p>Wait for a keypress if requested by
<code class="option"><a href="clisp.html#opt-wait" class="olink">-w</a></code>.
</p></li><li class="step"><p>Close all open <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>s.</p></li><li class="step"><p><a class="link" href="#modfini" title="32.2.3. Module finalization">Finalize
modules</a>.</p></li><li class="step"><p>Close all open DLLs.</p></li></ol></li></ol></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="init-hooks"></a>31.1.2. Customizing Initialization</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#init-hooks-function">31.1.2.1. The difference between <code class="varname">CUSTOM:*INIT-HOOKS*</code> and init function</a></span></dt></dl></div><p><a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a> is run like this:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_ignore-errors.html" target="_top"><code class="function">IGNORE-ERRORS</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPC</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a>))
</pre><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="init-hooks-function"></a>31.1.2.1. The difference between
<a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a> and <a href="impnotes.html#init-func" class="olink">init function</a></h4></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a> are
<span class="emphasis"><em>always</em></span> run regardless of the command line
options before even the banner is printed.</li><li class="listitem">The <a href="impnotes.html#init-func" class="olink">init function</a> is run <span class="emphasis"><em>only</em></span>
if the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> is ever entered and just before the
first <a class="link" href="#prompt" title="31.9. The Prompt">prompt</a> is printed.
</li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fini-hooks"></a>31.1.3. Customizing Termination</h3></div></div></div><p><a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a> is run like this:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPC</code></a> #'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a>)
</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="image"></a>31.2. Saving an Image</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#image-portability">31.2.1. Image Portability</a></span></dt></dl></div><p>The function <code class="code">(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
(<em class="replaceable"><code>filename</code></em> "lispinit.mem") <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :KEEP-GLOBAL-HANDLERS :QUIET
:INIT-FUNCTION :LOCKED-PACKAGES :START-PACKAGE :EXECUTABLE :NORC
:SCRIPT :DOCUMENTATION :VERBOSE)</code>
saves the running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s memory to the file <em class="replaceable"><code>filename</code></em>;
extension <code class="filename">#P".mem"</code> is recommended (when <em class="replaceable"><code>filename</code></em> does not have an
extension, <code class="filename">#P".mem"</code> extension is automatically added unless the file
being created is an executable).
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:QUIET</code></span></dt><dd><p class="simpara">If this argument is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the startup banner
and the good-bye message will be suppressed, as if by <code class="option"><a href="clisp.html#opt-verbose" class="olink">-q</a></code>.</p><p class="simpara">This is <span class="strong"><strong>not</strong></span> recommended for interactive application delivery,
please <span class="emphasis"><em>append</em></span> your banner to ours (using
<a href="impnotes.html#init-func" class="olink">init function</a>) instead of <span class="emphasis"><em>replacing</em></span> it.
</p></dd><dt><span class="term"><code class="constant">:VERBOSE</code></span></dt><dd>Print a message after writing the file.
This argument defaults to <a href="impnotes.html#image" class="olink"><code class="varname">CUSTOM:*SAVEINITMEM-VERBOSE*</code></a>; initial value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.
</dd><dt><span class="term"><code class="constant">:NORC</code></span></dt><dd>If this argument is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the <a href="clisp.html#opt-norc" class="olink">RC file</a>
loading will be suppressed, as if by <code class="option"><a href="clisp.html#opt-norc" class="olink">-norc</a></code>.
</dd><dt><a id="init-func"></a><span class="term"><code class="constant">:INIT-FUNCTION</code></span></dt><dd><p class="simpara">This argument specifies a function that will be
executed at startup of the saved image, before entering the standard <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>
(but after all other initialization, see <a class="xref" href="#cradle-grave" title="31.1.1. Cradle to Grave">Section 31.1.1, “Cradle to Grave”</a>);
thus, if you want to avoid the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>, you have to call <a class="link" href="#quit" title="31.3. Quitting CLISP"><code class="function">EXT:EXIT</code></a> at the
end of the init function yourself
(this does not prevent <a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a> from being run).</p><p class="simpara">See <a href="clisp.html#opt-exec-file" class="olink">the
manual</a> for passing command line arguments to this function.
</p><p class="simpara">See also <a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a> and <a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a>.</p></dd><dt><a id="image-script"></a><span class="term"><a href="impnotes.html#image-script" class="olink"><code class="constant">:SCRIPT</code></a></span></dt><dd><p>This options determines the handling of positional
arguments when the image is invoked.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, then the first positional argument
is the script name and the rest is placed into <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>, as described
in <a class="xref" href="#quickstart-unix" title="32.6.2. Scripting with CLISP">Section 32.6.2, “Scripting with <span class="command"><strong>CLISP</strong></span>”</a>.</li><li class="listitem">It it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, then all positional arguments
are placed into <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> to be handled by the <a href="impnotes.html#init-func" class="olink">init function</a>.
</li></ul></div><p>
This option defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> when <a href="impnotes.html#init-func" class="olink">init function</a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> when <a href="impnotes.html#init-func" class="olink">init function</a> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</p></dd><dt><a id="image-doc"></a><span class="term"><code class="constant">:DOCUMENTATION</code></span></dt><dd><p class="simpara">The description of what this image does, printed
by the <code class="option"><a href="clisp.html#opt-help-image" class="olink">-help-image</a></code> olption.</p><p class="simpara">Defaults to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a> <a href="impnotes.html#init-func" class="olink">init function</a>
'<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">FUNCTION</code></a>)</code></p></dd><dt><span class="term"><code class="constant">:LOCKED-PACKAGES</code></span></dt><dd>This argument specifies the packages to lock before
saving the image; this is convenient for application delivery, when
you do not want your users to mess up your product.
This argument defaults to <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a>.
</dd><dt><span class="term"><code class="constant">:START-PACKAGE</code></span></dt><dd>This argument specifies the starting value of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a> in the image being saved, and defaults to the current
value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a>.</dd><dt><span class="term"><code class="constant">:KEEP-GLOBAL-HANDLERS</code></span></dt><dd><p>When non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the currently established global
handlers (either with <a href="impnotes.html#global-handler" class="olink"><code class="function">EXT:SET-GLOBAL-HANDLER</code></a> or with <code class="option"><a href="clisp.html#opt-on-error" class="olink">-on-error</a></code>)
are inherited by the image. Defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, so that
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> myfile <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a>)'</pre><p>
will produce an image without any global handlers inherited
from the batch mode of the above command.</p></dd><dt><a id="image-exec"></a><span class="term"><code class="constant">:EXECUTABLE</code></span></dt><dd><p class="simpara">When non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the saved file will be a
standalone executable.
In this case, the <code class="filename">#P".mem"</code> extension is not added.
On <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> the extension <code class="filename">#P".exe"</code>
is added instead.</p><p>Additionally, if this argument is <code class="literal">0</code>, the standard
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> command line options will <span class="strong"><strong>not</strong></span> be processed by the
executable but will be placed into <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> instead.
This is convenient for application delivery, so that your
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-based application can accept, e.g., <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code>.
To override this feature of the image, you have to prefix the
options with <code class="literal">"--clisp"</code>, e.g.,
use <code class="option">--clisp-x</code> instead of <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code>.
This, given such a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-based application, you can get to an
ordinary <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> by doing </p><pre class="screen">
<strong><code class="prompt">$</code></strong> application --clisp-x '(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> "myclisp" :executable t :init-function nil)'
<strong><code class="prompt">$</code></strong> ./myclisp
[1]> (<a class="link" href="#factorial" title="Function EXT:!">!</a> 20)
2432902008176640000</pre><p>
These instructions are also printed by
<code class="option">--clisp--help</code>.</p><p class="simpara">Of course, this feature opens a <span class="emphasis"><em>security hole</em></span>
if the application is running <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setuid.html"><code class="function">setuid</code></a> root,
therefore <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> resets the effective group and user IDs to the real
ones if it sees a <code class="literal">"--clisp-*"</code> option.
</p></dd></dl></div><p>
You can use this memory image with the <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> option.
On <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems, you may compress it with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gzip.org/" target="_top"><span class="command"><strong>gzip</strong></span></a> to save disk
space.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="image-portability"></a>31.2.1. Image Portability</h3></div></div></div><p>Memory images are <span class="strong"><strong>not</strong></span> portable across different platforms
(in contrast with platform-independent <code class="filename">#P".fas"</code> files).
They are <span class="strong"><strong>not</strong></span> even portable across <a href="impnotes.html#linkset" class="olink">linking set</a>s: image saved using
the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> cannot be used with the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="clisp.html#runtime" class="olink">runtime</a>:</p><pre class="screen">
<strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> full <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a>)'
<strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> base <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> lispinit.mem
base/lisp.run: initialization file `lispinit.mem' was not created by this version of CLISP runtime</pre><p>
See also <a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.devel/17757"><code>Gmane/devel/17757</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/18854510/" target="_top">https://sourceforge.net/p/clisp/mailman/message/18854510/</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="quit"></a>31.3. Quitting <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><p>The functions </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<a class="link" href="#quit" title="31.3. Quitting CLISP"><code class="function">EXT:EXIT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>status</code></em>)</code></td></tr><tr><td><code class="code">(EXT:QUIT <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>status</code></em>)</code></td></tr><tr><td><code class="code">(EXT:BYE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>status</code></em>)</code></td></tr></table><p>
- all synonymous - terminate <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. If <em class="replaceable"><code>status</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> aborts with the supplied numeric error <em class="replaceable"><code>status</code></em>, i.e.,
the OS environment is informed that the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> session did not
succeed.</p><p><a class="link" href="#fin-delim">Final delimiter</a>s also terminate
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="i18n"></a>31.4. Internationalization of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#language">31.4.1. The Language</a></span></dt></dl></div><div class="variablelist"><p class="title"><strong>Glossary</strong></p><dl class="variablelist"><dt><span class="term">Internationalization (<span class="quote">“<span class="quote">i18n</span>”</span>)</span></dt><dd>preparing a program so that it can use multiple
national languages and national cultural conventions without requiring
further source code changes.</dd><dt><span class="term">Localization (<span class="quote">“<span class="quote">l10n</span>”</span>)</span></dt><dd>providing the data - mostly textual translations -
necessary for an internationalized program to work in a particular
language and with particular cultural conventions.
</dd></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is internationalized, and is localized for the languages
English, German, French, Spanish, Dutch, Russian, and Danish.
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> also supports internationalized Lisp programs, through
<a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">gettext</a>, see <a class="xref" href="#i18n-mod" title="33.3. Internationalization of User Programs">Section 33.3, “Internationalization of User Programs”</a>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="language"></a>31.4.1. The Language</h3></div></div></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The facilities described in this section will
work only for the languages for which <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> itself is already
localized.</p></div><p>The language <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses to communicate with the user can be one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">ENGLISH</code></td></tr><tr><td><code class="constant">DEUTSCH</code> (i.e., German)</td></tr><tr><td><code class="constant">FRANÇAIS</code> (i.e., French)</td></tr><tr><td><code class="constant">ESPAÑOL</code> (i.e., Spanish)</td></tr><tr><td><code class="constant">NEDERLANDS</code> (i.e., Dutch)</td></tr><tr><td><code class="constant">РУССКИЙ</code>
(i.e. Russian)</td></tr><tr><td><code class="constant">DANSK</code> (i.e., Danish)</td></tr></table><p>This is controlled by the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>
<strong class="first"><em class="firstterm"><a href="impnotes.html#language" class="olink"><code class="varname">CUSTOM:*CURRENT-LANGUAGE*</code></a><a id="curr-lang" class="indexterm"></a></em></strong>,
which can be set at run time as well as using the <code class="option"><a href="clisp.html#opt-lang" class="olink">-L</a></code> command line option.
If you wish to change the
<a href="clisp.html#opt-locale" class="olink">locale directory</a>
at run time too, you can do that by setting <a href="impnotes.html#language" class="olink"><code class="varname">CUSTOM:*CURRENT-LANGUAGE*</code></a> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>
cell, whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a> is the language (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, one of the above),
and whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> is the new locale directory.</p><p>More languages can be defined through the macro
<strong class="first"><em class="firstterm"><a class="link" href="#deflang"><code class="function">I18N:DEFLANGUAGE</code></a><a id="deflang" class="indexterm"></a></em></strong>:
<code class="code">(<a class="link" href="#deflang"><code class="function">I18N:DEFLANGUAGE</code></a> <em class="replaceable"><code>language</code></em>)</code>.
For such an additional language to take effect, you must install the
corresponding message catalog, or translate the messages yourself,
using <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">gettext</a> and <a class="ulink" href="http://www.gnu.org/software/emacs/" target="_top">Emacs</a> <a class="" href="http://www.google.com/search?q=po-mode">po-mode</a>.</p><p>This works only for strings. For arbitrary language-dependent
Lisp objects, you define one through the macro
<strong class="first"><em class="firstterm"><a class="link" href="#def-i-l"><code class="function">I18N:DEFINTERNATIONAL</code></a><a id="def-i-l" class="indexterm"></a></em></strong>:
<code class="code">(<a class="link" href="#def-i-l"><code class="function">I18N:DEFINTERNATIONAL</code></a> <em class="replaceable"><code>symbol</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
(<em class="replaceable"><code>default-language</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code> and add
language-dependent values through the macro
<strong class="first"><em class="firstterm"><a class="link" href="#defloc"><code class="function">I18N:DEFLOCALIZED</code></a><a id="defloc" class="indexterm"></a></em></strong>:
<code class="code">(<a class="link" href="#defloc"><code class="function">I18N:DEFLOCALIZED</code></a> <em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>language</code></em>
<em class="replaceable"><code>value-form</code></em>)</code>
(One such form for each language. Languages without an assigned
value will be treated like the default-language.)
You can then access the localized value by calling
<strong class="first"><em class="firstterm"><a class="link" href="#localized"><code class="function">I18N:LOCALIZED</code></a><a id="localized" class="indexterm"></a></em></strong>:
<code class="code">(<a class="link" href="#localized"><code class="function">I18N:LOCALIZED</code></a> <em class="replaceable"><code>symbol</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>language</code></em>)</code></p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="encoding"></a>31.5. Encodings</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#encodings-intro">31.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#charset">31.5.2. Character Sets</a></span></dt><dt><span class="section"><a href="#newline">31.5.3. Line Terminators</a></span></dt><dt><span class="section"><a href="#make-encoding">31.5.4. Function <code class="function">EXT:MAKE-ENCODING</code></a></span></dt><dt><span class="section"><a href="#enc-charset">31.5.5. Function <code class="function">EXT:ENCODING-CHARSET</code></a></span></dt><dt><span class="section"><a href="#enc-dflt">31.5.6. Default encodings</a></span></dt><dd><dl><dt><span class="section"><a href="#line-term-default">31.5.6.1. Default line terminator</a></span></dt></dl></dd><dt><span class="section"><a href="#string-byte">31.5.7. Converting between strings and byte vectors</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="encodings-intro"></a>31.5.1. Introduction</h3></div></div></div><p>An <span class="quote">“<span class="quote">encoding</span>”</span> describes the correspondence
between <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s and raw bytes during input/output via
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>.</p><p>An <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a> is an object composed of the following facets:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#charset" title="31.5.2. Character Sets">character set</a></span></dt><dd>This denotes both the set of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s that
can be represented and passed through the I/O channel, and the way
these characters translate into raw bytes, i.e., the map between
sequences of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> and <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> in the form of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s
and <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> as well as character and byte <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.
In this context, for example, <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> and <a class="link" href="#charset-UCS-4"><code class="constant">CHARSET:UCS-4</code></a>
are considered different, although they can represent the same set
of characters.</dd><dt><span class="term"><a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> mode</span></dt><dd>This denotes the way newline characters are
represented.</dd></dl></div><p><a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s are also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html" target="_top"><code class="literal">TYPE</code></a>s. As such, they represent the set of
characters encodable in the character set. In this context, the way
characters are translated into raw bytes is ignored, and the line
terminator mode is ignored as well. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_typep.html" target="_top"><code class="function">TYPEP</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> can be used
on encodings:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a>)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> ;
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a> <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a>)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> ;
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> CHARSET:ASCII CHARSET:ISO-8859-1)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> ;
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a> CHARSET:ISO-8859-1 CHARSET:ASCII)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code> ;
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
</pre><p><a id="enc1-1"></a><strong><span class="quote">“<span class="quote">1:1</span>”</span> encodings. </strong>Encodings which define a bijection between character and byte
sequences are called <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>s. <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a> is an example of such an
encoding: any byte sequence corresponds to some character sequence and
vice versa. <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>, however, is <span class="strong"><strong>not</strong></span> a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>: there are no
characters for bytes in the range [128;255]. <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> is <span class="strong"><strong>not</strong></span> a
<a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a> either: some byte sequences do not correspond to any character
sequence.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="charset"></a>31.5.2. Character Sets</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> compile-time flag <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd>Only one character set is understood: the platform's
native (8-bit) character set. See <a class="xref" href="#characters" title="Chapter 13. Characters chap-13">Chapter 13, <em>Characters chap-13</em></a>.
</dd><dt><a id="charset-symbols"></a><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span> compile-time flag <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd><p>The following character sets are supported, as values
of the corresponding (constant) symbol in the <a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a> package:
</p><div class="orderedlist"><a id="charset-symbol-list"></a><p class="title"><strong>Symbols in package <a class="link" href="#encoding" title="31.5. Encodings"><strong class="package"><span class="quote">“<span class="quote">CHARSET</span>”</span></strong></a></strong></p><ol class="orderedlist" type="1"><li class="listitem"><a id="charset-UCS-2"></a><code class="constant">UCS-2</code>
≡ <code class="constant">UNICODE-16</code>
≡ <code class="constant">UNICODE-16-BIG-ENDIAN</code>,
the 16-bit basic multilingual plane of the <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set.
Every character is represented as two bytes.</li><li class="listitem"><a id="charset-UNICODE-16-LITTLE-ENDIAN"></a><code class="constant">UNICODE-16-LITTLE-ENDIAN</code>
</li><li class="listitem"><a id="charset-UCS-4"></a><code class="constant">UCS-4</code>
≡ <code class="constant">UNICODE-32</code>
≡ <code class="constant">UNICODE-32-BIG-ENDIAN</code>,
the 21-bit <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set. Every character is represented as
four bytes. This encoding is used by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internally.</li><li class="listitem"><a id="charset-UNICODE-32-LITTLE-ENDIAN"></a><code class="constant">UNICODE-32-LITTLE-ENDIAN</code></li><li class="listitem"><a id="charset-UTF-8"></a><code class="constant">UTF-8</code>,
the 21-bit <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set.
Every character is represented as one to four bytes.
<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters represent themselves and need one byte per character.
Most Latin/Greek/Cyrillic/Hebrew characters need two bytes per
character. Most other characters need three bytes per character,
and the rarely used remaining characters need four bytes per
character. This is therefore, in general, the most space-efficient
encoding of all of Unicode.</li><li class="listitem"><a id="charset-UTF-16"></a><code class="constant">UTF-16</code>,
the 21-bit <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set. Every character in the 16-bit
basic multilingual plane is represented as two bytes, and the
rarely used remaining characters need four bytes per character.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-UTF-7"></a><code class="constant">UTF-7</code>,
the 21-bit <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set. This is a stateful 7-bit encoding.
Not all <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters represent themselves.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-JAVA"></a><code class="constant">JAVA</code>,
the 21-bit <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character set.
<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters represent themselves and need one byte per character.
All other characters of the basic multilingual plane are represented
by <code class="literal">\u<em class="replaceable"><code>nnnn</code></em></code> sequences
(<em class="replaceable"><code>nnnn</code></em> a hexadecimal number)
and need 6 bytes per character. The remaining characters are represented
by <code class="literal">\u<em class="replaceable"><code>xxxx</code></em>\u<em class="replaceable"><code>yyyy</code></em></code>
and need 12 bytes per character. While this encoding is very comfortable
for editing Unicode files using only <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>-aware tools and editors, it
cannot faithfully represent all <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> text. Only text which
does not contain <code class="literal">\u</code> (backslash followed by
lowercase Latin u) can be faithfully represented by this encoding.
</li><li class="listitem"><a id="charset-ASCII"></a><code class="constant">ASCII</code>,
the well-known US-centric 7-bit character set (American Standard
Code for Information Interchange - <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>).</li><li class="listitem"><a id="charset-ISO-8859-1"></a><p class="simpara"><code class="constant">ISO-8859-1</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Afrikaans, Albanian, Basque, Breton, Catalan,
Cornish, Danish, Dutch, English, Færoese, Finnish, French,
Frisian, Galician, German, Greenlandic, Icelandic, Irish, Italian,
Latin, Luxemburgish, Norwegian, Portuguese, Ræto-Romanic,
Scottish, Spanish, and Swedish languages.</p><p>This encoding has the nice property that</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for i :from 0 :to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_char-code-limit.html" target="_top"><code class="constant">CHAR-CODE-LIMIT</code></a> :for c = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a> i)
:always (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_not.html" target="_top"><code class="function">NOT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_typep.html" target="_top"><code class="function">TYPEP</code></a> c CHARSET:ISO-8859-1))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a> (<a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-TO-BYTES</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> c) CHARSET:ISO-8859-1)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_vector.html" target="_top"><code class="function">VECTOR</code></a> i))))
⇒ <code class="computeroutput">T</code></pre><p>
i.e., it is compatible with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_code-char.html" target="_top"><code class="function">CODE-CHAR</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_char-code.html" target="_top"><code class="function">CHAR-CODE</code></a>
in its own domain.</p></li><li class="listitem"><a id="charset-ISO-8859-2"></a><code class="constant">ISO-8859-2</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Croatian, Czech, German, Hungarian, Polish,
Slovak, Slovenian, and Sorbian languages. </li><li class="listitem"><a id="charset-ISO-8859-3"></a><code class="constant">ISO-8859-3</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Esperanto and Maltese languages.</li><li class="listitem"><a id="charset-ISO-8859-4"></a><code class="constant">ISO-8859-4</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Estonian, Latvian, Lithuanian and Sami (Lappish)
languages.</li><li class="listitem"><a id="charset-ISO-8859-5"></a><code class="constant">ISO-8859-5</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Bulgarian, Byelorussian, Macedonian, Russian,
Serbian, and Ukrainian languages.</li><li class="listitem"><a id="charset-ISO-8859-6"></a><code class="constant">ISO-8859-6</code>,
suitable for the Arabic language.</li><li class="listitem"><a id="charset-ISO-8859-7"></a><code class="constant">ISO-8859-7</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Greek language.</li><li class="listitem"><a id="charset-ISO-8859-8"></a><code class="constant">ISO-8859-8</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Hebrew language (without punctuation).</li><li class="listitem"><a id="charset-ISO-8859-9"></a><code class="constant">ISO-8859-9</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Turkish language.</li><li class="listitem"><a id="charset-ISO-8859-10"></a><code class="constant">ISO-8859-10</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Estonian, Icelandic, Inuit (Greenlandic), Latvian,
Lithuanian, and Sami (Lappish) languages.</li><li class="listitem"><a id="charset-ISO-8859-13"></a><code class="constant">ISO-8859-13</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Estonian, Latvian, Lithuanian, Polish and Sami
(Lappish) languages.</li><li class="listitem"><a id="charset-ISO-8859-14"></a><code class="constant">ISO-8859-14</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Irish Gælic, Manx Gælic, Scottish
Gælic, and Welsh languages.</li><li class="listitem"><a id="charset-ISO-8859-15"></a><code class="constant">ISO-8859-15</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the ISO-8859-1 languages, with improvements for
French, Finnish and the Euro.</li><li class="listitem"><a id="charset-ISO-8859-16"></a><code class="constant">ISO-8859-16</code>
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Rumanian language.</li><li class="listitem"><a id="charset-KOI8-R"></a><code class="constant">KOI8-R</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Russian language (very popular, especially on the
internet).</li><li class="listitem"><a id="charset-KOI8-U"></a><code class="constant">KOI8-U</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Ukrainian language (very popular, especially on the
internet).</li><li class="listitem"><a id="charset-KOI8-RU"></a><code class="constant">KOI8-RU</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Russian language. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><code class="constant">JIS_X0201</code>,
a character set for the Japanese language.</li><li class="listitem"><a id="charset-MAC-ARABIC"></a><code class="constant">MAC-ARABIC</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-CENTRAL-EUROPE"></a><code class="constant">MAC-CENTRAL-EUROPE</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-CROATIAN"></a><code class="constant">MAC-CROATIAN</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-CYRILLIC"></a><code class="constant">MAC-CYRILLIC</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-DINGBAT"></a><code class="constant">MAC-DINGBAT</code>,
a platform specific character set.</li><li class="listitem"><a id="charset-MAC-GREEK"></a><code class="constant">MAC-GREEK</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-HEBREW"></a><code class="constant">MAC-HEBREW</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-ICELAND"></a><code class="constant">MAC-ICELAND</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-ROMAN"></a><code class="constant">MAC-ROMAN</code>
≡ <code class="constant">MACINTOSH</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-ROMANIA"></a><code class="constant">MAC-ROMANIA</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-SYMBOL"></a><code class="constant">MAC-SYMBOL</code>,
a platform specific character set.</li><li class="listitem"><a id="charset-MAC-THAI"></a><code class="constant">MAC-THAI</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-TURKISH"></a><code class="constant">MAC-TURKISH</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-MAC-UKRAINE"></a><code class="constant">MAC-UKRAINE</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP437"></a><code class="constant">CP437</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP437-IBM"></a><code class="constant">CP437-IBM</code>,
an IBM variant of <code class="constant">CP437</code>.</li><li class="listitem"><a id="charset-CP737"></a><code class="constant">CP737</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Greek language.</li><li class="listitem"><a id="charset-CP775"></a><code class="constant">CP775</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for some Baltic languages.</li><li class="listitem"><a id="charset-CP850"></a><code class="constant">CP850</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP852"></a><code class="constant">CP852</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP852-IBM"></a><code class="constant">CP852-IBM</code>,
an IBM variant of <code class="constant">CP852</code>.</li><li class="listitem"><a id="charset-CP855"></a><code class="constant">CP855</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Russian language.</li><li class="listitem"><a id="charset-CP857"></a><code class="constant">CP857</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Turkish language.</li><li class="listitem"><a id="charset-CP860"></a><code class="constant">CP860</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Portuguese language.</li><li class="listitem"><a id="charset-CP860-IBM"></a><code class="constant">CP860-IBM</code>,
an IBM variant of <code class="constant">CP860</code>.</li><li class="listitem"><a id="charset-CP861"></a><code class="constant">CP861</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Icelandic language.</li><li class="listitem"><a id="charset-CP861-IBM"></a><code class="constant">CP861-IBM</code>,
an IBM variant of <code class="constant">CP861</code>.</li><li class="listitem"><a id="charset-CP862"></a><code class="constant">CP862</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Hebrew language.</li><li class="listitem"><a id="charset-CP862-IBM"></a><code class="constant">CP862-IBM</code>,
an IBM variant of <code class="constant">CP862</code>.</li><li class="listitem"><a id="charset-CP863"></a><code class="constant">CP863</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-CP863-IBM"></a><code class="constant">CP863-IBM</code>,
an IBM variant of <code class="constant">CP863</code>.</li><li class="listitem"><a id="charset-CP864"></a><code class="constant">CP864</code>, a DOS oldie,
meant to be suitable for the Arabic language.</li><li class="listitem"><a id="charset-CP864-IBM"></a><code class="constant">CP864-IBM</code>,
an IBM variant of <code class="constant">CP864</code>.
</li><li class="listitem"><a id="charset-CP865"></a><code class="constant">CP865</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for some Nordic languages.</li><li class="listitem"><a id="charset-CP865-IBM"></a><code class="constant">CP865-IBM</code>,
an IBM variant of <code class="constant">CP865</code>.
</li><li class="listitem"><a id="charset-CP866"></a><code class="constant">CP866</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Russian language.</li><li class="listitem"><a id="charset-CP869"></a><code class="constant">CP869</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Greek language.</li><li class="listitem"><a id="charset-CP869-IBM"></a><code class="constant">CP869-IBM</code>,
an IBM variant of <code class="constant">CP869</code>.
</li><li class="listitem"><a id="charset-CP874"></a><code class="constant">CP874</code>, a DOS oldie,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Thai language.</li><li class="listitem"><a id="charset-CP874-IBM"></a><code class="constant">CP874-IBM</code>,
an IBM variant of <code class="constant">CP874</code>.
</li><li class="listitem"><a id="charset-WINDOWS-1250"></a><code class="constant">WINDOWS-1250</code>
≡ <code class="constant">CP1250</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, heavily incompatible with ISO-8859-2.
</li><li class="listitem"><a id="charset-WINDOWS-1251"></a><code class="constant">WINDOWS-1251</code>
≡ <code class="constant">CP1251</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, heavily incompatible with ISO-8859-5,
meant to be suitable for the Russian language.</li><li class="listitem"><a id="charset-WINDOWS-1252"></a><code class="constant">WINDOWS-1252</code>
≡ <code class="constant">CP1252</code>,
a platform specific extension of the ISO-8859-1 character set.
</li><li class="listitem"><a id="charset-WINDOWS-1253"></a><code class="constant">WINDOWS-1253</code>
≡ <code class="constant">CP1253</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, gratuitously incompatible with ISO-8859-7,
meant to be suitable for the Greek language.</li><li class="listitem"><a id="charset-WINDOWS-1254"></a><code class="constant">WINDOWS-1254</code>
≡ <code class="constant">CP1254</code>,
a platform specific extension of the ISO-8859-9 character set.
</li><li class="listitem"><a id="charset-WINDOWS-1255"></a><code class="constant">WINDOWS-1255</code>
≡ <code class="constant">CP1255</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, gratuitously incompatible with ISO-8859-8,
suitable for the Hebrew language.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-WINDOWS-1256"></a><code class="constant">WINDOWS-1256</code>
≡ <code class="constant">CP1256</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the Arabic language.</li><li class="listitem"><a id="charset-WINDOWS-1257"></a><code class="constant">WINDOWS-1257</code>
≡ <code class="constant">CP1257</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-WINDOWS-1258"></a><code class="constant">WINDOWS-1258</code>
≡ <code class="constant">CP1258</code>, a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, meant to be suitable for the
Vietnamese language. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-HP-ROMAN8"></a><code class="constant">HP-ROMAN8</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-NEXTSTEP"></a><code class="constant">NEXTSTEP</code>,
a platform specific extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>.</li><li class="listitem"><a id="charset-EUC-JP"></a><code class="constant">EUC-JP</code>,
a multibyte character set for the Japanese language.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-SHIFT-JIS"></a><code class="constant">SHIFT-JIS</code>,
a multibyte character set for the Japanese language.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP932"></a><code class="constant">CP932</code>,
a Microsoft variant of <code class="constant">SHIFT-JIS</code>.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-JP"></a><code class="constant">ISO-2022-JP</code>,
a stateful 7-bit multibyte character set for the Japanese language.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-JP-2"></a><code class="constant">ISO-2022-JP-2</code>,
a stateful 7-bit multibyte character set for the Japanese language.
This character set is only available on platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> 2.3
or newer or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-JP-1"></a><code class="constant">ISO-2022-JP-1</code>,
a stateful 7-bit multibyte character set for the Japanese language.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-EUC-CN"></a><code class="constant">EUC-CN</code>,
a multibyte character set for simplified Chinese.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-HZ"></a><code class="constant">HZ</code>,
a stateful 7-bit multibyte character set for simplified Chinese.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-GBK"></a><code class="constant">GBK</code>,
a multibyte character set for Chinese,
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP936"></a><code class="constant">CP936</code>,
a Microsoft variant of <code class="constant">GBK</code>.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-GB18030"></a><code class="constant">GB18030</code>,
a multibyte character set for Chinese,
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-EUC-TW"></a><code class="constant">EUC-TW</code>,
a multibyte character set for traditional Chinese.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-BIG5"></a><code class="constant">BIG5</code>,
a multibyte character set for traditional Chinese.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP950"></a><code class="constant">CP950</code>,
a Microsoft variant of <code class="constant">BIG5</code>.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-BIG5-HKSCS"></a><code class="constant">BIG5-HKSCS</code>,
a multibyte character set for traditional Chinese.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-CN"></a><code class="constant">ISO-2022-CN</code>,
a stateful 7-bit multibyte character set for Chinese.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-CN-EXT"></a><code class="constant">ISO-2022-CN-EXT</code>,
a stateful 7-bit multibyte character set for Chinese.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-EUC-KR"></a><code class="constant">EUC-KR</code>,
a multibyte character set for Korean.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP949"></a><code class="constant">CP949</code>,
a Microsoft variant of <code class="constant">EUC-KR</code>.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ISO-2022-KR"></a><code class="constant">ISO-2022-KR</code>,
a stateful 7-bit multibyte character set for Korean.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-JOHAB"></a><code class="constant">JOHAB</code>,
a multibyte character set for Korean used mostly on <a class="ulink" href="http://www.freedos.org/" target="_top"><span class="platform">DOS</span></a>.
This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-ARMSCII-8"></a><code class="constant">ARMSCII-8</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Armenian. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-GEORGIAN-ACADEMY"></a><code class="constant">GEORGIAN-ACADEMY</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Georgian. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-GEORGIAN-PS"></a><code class="constant">GEORGIAN-PS</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Georgian. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-TIS-620"></a><code class="constant">TIS-620</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Thai. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-MULELAO-1"></a><code class="constant">MULELAO-1</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Laotian. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-CP1133"></a><code class="constant">CP1133</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Laotian. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-VISCII"></a><code class="constant">VISCII</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Vietnamese. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><a id="charset-TCVN"></a><code class="constant">TCVN</code>,
an extension of the <a class="link" href="#charset-ASCII">ASCII character set</a>, suitable for the Vietnamese. This character set is only available on
platforms with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>.</li><li class="listitem"><p><a id="base64"></a><code class="constant">BASE64</code>, encodes
arbitrary byte sequences with 64 <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters </p><div class="literallayout"><p><br />
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/<br />
</p></div><p> as specifined by <a class="rfc" href="http://www.ietf.org/rfc/rfc2045.txt"><code>MIME</code></a>; 3 bytes are encoded with 4
characters, line breaks are inserted after every 76 characters.</p><p class="simpara">While this is not a traditional character set (i.e., it does
not map a set of characters in a natural language into bytes), it
does define a map between arbitrary byte sequences and certain
character sequences, so it falls naturally into the <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a> class.
</p></li></ol></div><p>
</p><div class="variablelist"><dl class="variablelist"><dt><a id="iconv"></a><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only on <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> systems
with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> 2.2 or better and other systems (<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>)
on which the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library has been installed</span></span></span></dt><dd><p class="simpara">The character sets provided by the library function
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a> can also be used as encodings. To create such an encoding,
call <a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a> with the character set name (a string) as the
<code class="constant">:CHARSET</code> argument.</p><p class="simpara">When an <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a> is available both as a <a class="link" href="#charset-symbols">built-in</a> and
through <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a>, the <a class="link" href="#charset-symbols">built-in</a> is used, because it is more
efficient and available across all platforms.</p><p class="simpara">These encodings are not assigned to global variables, since
there is no portable way to get the list of all character sets
supported by <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a>.</p><p class="simpara">On standard-compliant <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems (e.g., <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> systems, such
as <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a>/<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> and <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a>/<a class="ulink" href="http://www.gnu.org/software/hurd/" target="_top"><span class="platform">Hurd</span></a>) and on systems with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a> you
get this list by calling the <span class="emphasis"><em>program</em></span>:
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/iconv.html"><span class="command"><strong>iconv -l</strong></span></a>.</p><p class="simpara">The reason we use only <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> 2.2 or <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a> is
that the other <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a> implementations are broken in various ways and
we do not want to deal with random <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> crashes caused by those bugs.
If your system supplies an <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a> implementation which passes the
<a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libiconv/" target="_top">libiconv</a>'s test suite, please report that
to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a> and a
future <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version will use <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html"><code class="function">iconv</code></a> on your system.</p></dd></dl></div><p>
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="newline"></a>31.5.3. Line Terminators</h3></div></div></div><p>The line terminator mode can be one of the following three keywords:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:UNIX</code></span></dt><dd>Newline is represented by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>
<span class="keycode">LF</span> character (<span class="keycode">U000A</span>).
</dd><dt><span class="term"><code class="constant">:MAC</code></span></dt><dd>Newline is represented by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>
<span class="keycode">CR</span> character (<span class="keycode">U000D</span>).
</dd><dt><span class="term"><code class="constant">:DOS</code></span></dt><dd>Newline is represented by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>
<span class="keycode">CR</span> followed by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> <span class="keycode">LF</span>.
</dd></dl></div><p>Windows programs typically use the <code class="constant">:DOS</code> line terminator,
sometimes they also accept <code class="constant">:UNIX</code> line terminators or produce
<code class="constant">:MAC</code> line terminators.</p><p>The <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> protocol also requires <code class="constant">:DOS</code> line terminators.</p><p>The line terminator mode is relevant only for output (writing to a
<a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>). During input, all three kinds of line terminators
are recognized. See also <a class="xref" href="#clhs-newline" title="13.11. Treatment of Newline during Input and Output sec_13-1-8">Section 13.11, “Treatment of Newline during Input and Output sec_13-1-8”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="make-encoding"></a>31.5.4. Function <a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a></h3></div></div></div><p>The function <code class="code">(<a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :CHARSET
:LINE-TERMINATOR :INPUT-ERROR-ACTION :OUTPUT-ERROR-ACTION)</code>
returns an <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>. The <code class="constant">:CHARSET</code> argument may be
an encoding, a string, or <code class="constant">:DEFAULT</code>.
The possible values for the <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> argument are the
keywords <code class="constant">:UNIX</code>, <code class="constant">:MAC</code>, <code class="constant">:DOS</code>.</p><p>The <code class="constant">:INPUT-ERROR-ACTION</code> argument specifies
what happens when an invalid byte sequence is encountered while
converting bytes to characters. Its value can be <code class="constant">:ERROR</code>, <code class="constant">:IGNORE</code>
or a character to be used instead. The <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> character
<span class="keysym">#\uFFFD</span> is typically used to indicate an error in the
input sequence.</p><p>The <code class="constant">:OUTPUT-ERROR-ACTION</code> argument specifies
what happens when an invalid character is encountered while converting
characters to bytes. Its value can be <code class="constant">:ERROR</code>, <code class="constant">:IGNORE</code>, a byte to
be used instead, or a character to be used instead. The <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a>
character <span class="keysym">#\uFFFD</span> can be used here only if it is
encodable in the character set.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="enc-charset"></a>31.5.5. Function <a class="link" href="#enc-charset" title="31.5.5. Function EXT:ENCODING-CHARSET"><code class="function">EXT:ENCODING-CHARSET</code></a></h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span> compile-time flag <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></h4></div></div></div><p>The function <code class="code">(<a class="link" href="#enc-charset" title="31.5.5. Function EXT:ENCODING-CHARSET"><code class="function">EXT:ENCODING-CHARSET</code></a> <em class="replaceable"><code>encoding</code></em>)</code> returns the
charset of the <em class="replaceable"><code>encoding</code></em>, as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> (<a class="link" href="#enc-charset" title="31.5.5. Function EXT:ENCODING-CHARSET"><code class="function">EXT:ENCODING-CHARSET</code></a> <em class="replaceable"><code>encoding</code></em>))</code> is
not necessarily a valid <a class="rfc" href="http://www.ietf.org/rfc/rfc2045.txt"><code>MIME</code></a> name.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="enc-dflt"></a>31.5.6. Default encodings</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#line-term-default">31.5.6.1. Default line terminator</a></span></dt></dl></div><p>Besides every <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> containing an encoding,
the following <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> places contain global <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s:</p><p><a id="def-file-enc"></a><strong><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> <a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a>. </strong>The <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> <a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a> is the encoding used for
new <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, when no <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> argument was specified.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span> compile-time flag <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a></span></span></span></dt><dd><p class="simpara">The following are <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> places.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><strong class="first"><em class="firstterm"><a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a>
<a id="path-enc" class="indexterm"></a></em></strong></span></dt><dd><p>is the encoding used for converting filenames in the
file system (represented with byte sequences by the OS) to lisp
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a> components (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s).
If this encoding is incompatible with some file names on your system,
file system access (e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a>) may <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s,
thus extreme caution is recommended if this is <span class="strong"><strong>not</strong></span> a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>.
Sometimes it may not be obvious that the encoding is involved at all.
E.g., on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>: </p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-namestring.html" target="_top"><code class="function">PARSE-NAMESTRING</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_string.html" target="_top"><code class="function">STRING</code></a> #\ARMENIAN_SMALL_LETTER_RA))
*** - PARSE-NAMESTRING: syntax error in filename "ռ" at position 0
</pre><p>when <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a> is <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a> because then
<span class="data"><code class="literal">#\ARMENIAN_SMALL_LETTER_RA</code></span> corresponds
to the 4 bytes <span class="data"><code class="literal">#(255 254 124 5)</code></span>
and the byte <span class="data"><code class="literal">124</code></span> is <span class="strong"><strong>not</strong></span> a valid
byte for a <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> file name because it
means <span class="data"><code class="literal">|</code></span> in <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>.</p><p class="simpara">The set of valid pathname <span class="emphasis"><em>bytes</em></span> is
determined by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top">autoconf</a> test
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/m4/filecharset.m4"><code class="filename">src/m4/filecharset.m4</code></a>
at configure time. While rather stable for the first 127 bytes,
on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> it varies wildly for the bytes 128-256, depending on the
OS version and the file system.</p><p class="simpara">The <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> mode of <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a> is ignored.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.apple.com/macosx/" target="_top"><span class="platform">Mac OS X</span></a> platform only</span></span>:
<a class="ulink" href="http://www.apple.com/macosx/" target="_top"><span class="platform">Mac OS X</span></a> pathnames are actually <a class="ulink" href="http://www.unicode.org/" target="_top"><span class="platform">UNICODE</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s, so
<a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a> is a constant with value <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a>.</p></dd><dt><span class="term"><strong class="first"><em class="firstterm"><a href="impnotes.html#term-enc" class="olink"><code class="varname">CUSTOM:*TERMINAL-ENCODING*</code></a>
<a id="term-enc" class="indexterm"></a></em></strong></span></dt><dd>is the encoding used for communication with the
terminal, in particular by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>.
</dd><dt><span class="term"><strong class="first"><em class="firstterm"><a href="impnotes.html#misc-enc" class="olink"><code class="varname">CUSTOM:*MISC-ENCODING*</code></a>
<a id="misc-enc" class="indexterm"></a></em></strong></span></dt><dd>is the encoding used for access to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s,
command line options, and the like. Its <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> mode is ignored.
</dd><dt><span class="term"><strong class="first"><em class="firstterm"><a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a>
<a id="foreign-enc" class="indexterm"></a></em></strong></span></dt><dd>is the encoding for strings passed through the
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> (some platforms only). If it is a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>,
i.e. an encoding in which every character is represented by one byte,
it is also used for passing characters through the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.
</dd></dl></div></dd></dl></div><p>The default encoding objects are initialized according to <code class="option"><a href="clisp.html#opt-enc" class="olink"><code class="option">-E<em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>encoding</code></em></code></a></code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Reminder</h3><p>You have to use <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*"><code class="function">EXT:LETF</code></a>/<a class="link" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*"><code class="function">EXT:LETF*</code></a>
for <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>s; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a> will <span class="strong"><strong>not</strong></span> work!</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="line-term-default"></a>31.5.6.1. Default <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a></h4></div></div></div><p>The <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> facet of the above <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s is determined by
the following logic: since <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> understands all possible
<a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>s on <span class="emphasis"><em>input</em></span> (see
<a class="xref" href="#clhs-newline" title="13.11. Treatment of Newline during Input and Output sec_13-1-8">Section 13.11, “Treatment of Newline during Input and Output sec_13-1-8”</a>), all that matters is what <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>
do most <span class="emphasis"><em>other</em></span> programs expect?</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd>If a non-0 <code class="literal">O_BINARY</code> <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a>
constant is defined, we assume that the OS distinguishes between text
and binary files, and, since the encodings are relevant only for text
files, we thus use <code class="constant">:DOS</code>; otherwise the default is <code class="constant">:UNIX</code>.
</dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd>Since most <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> programs expect CRLF, the default
<a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> is <code class="constant">:DOS</code>.</dd></dl></div><p>This boils down to the following code
in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/encoding.d"><code class="filename">src/encoding.d</code></a>:
</p><pre class="programlisting">
#if defined(WIN32) || (defined(UNIX) && (O_BINARY != 0))
</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="cygwin-line-term-default"></a>Default line terminator on <span class="platform">Cygwin</span></h3><p><span class="emphasis"><em>Both</em></span> of the above tests
pass on <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a>, so the default <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a> is <code class="constant">:DOS</code>.
If you so desire, you can change it in your <a href="clisp.html#opt-norc" class="olink">RC file</a>.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="string-byte"></a>31.5.7. Converting between strings and byte vectors</h3></div></div></div><p>Encodings can also be used to convert directly between strings and
their corresponding byte vector representation according to that encoding.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-FROM-BYTES</code></a>
<em class="replaceable"><code>vector</code></em> <em class="replaceable"><code>encoding</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code>)</code></span></dt><dd>converts the subsequence of <em class="replaceable"><code>vector</code></em> (a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>)
from <em class="replaceable"><code>start</code></em> to <em class="replaceable"><code>end</code></em> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, according to the given
<em class="replaceable"><code>encoding</code></em>, and returns the resulting string.
</dd><dt><span class="term"><code class="code">(<a class="link" href="#string-byte" title="31.5.7. Converting between strings and byte vectors"><code class="function">EXT:CONVERT-STRING-TO-BYTES</code></a>
<em class="replaceable"><code>string</code></em> <em class="replaceable"><code>encoding</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:START</code> <code class="constant">:END</code>)</code></span></dt><dd>converts the subsequence of <em class="replaceable"><code>string</code></em> from
<em class="replaceable"><code>start</code></em> to <em class="replaceable"><code>end</code></em> to a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>, according to the given
<em class="replaceable"><code>encoding</code></em>, and returns the resulting byte vector.
</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gstream"></a>31.6. Generic streams</h2></div></div></div><p>This interface is <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific and now obsolete. Please use
the <a class="link" href="#gray" title="Chapter 30. Gray streams">Gray streams</a> interface instead.</p><p>Generic streams are user programmable streams.
The programmer interface:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">gstream:make-generic-stream</code>
<em class="replaceable"><code>controller</code></em>)</code></span></dt><dd>returns a generic stream.
</dd><dt><span class="term"><code class="code">(<code class="function">gstream:generic-stream-controller</code>
<em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>returns a private object to which generic stream
methods dispatch. The typical usage is to retrieve the object
originally provided by the user in
<code class="function">gstream:make-generic-stream</code>.
</dd><dt><span class="term"><code class="code">(<code class="function">gstream:generic-stream-p</code>
<em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>determines whether a stream is a generic stream,
returning <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if it is, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> otherwise.
</dd></dl></div><p>In order to specify the behavior of a generic stream, the user
must define <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> methods on the following <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> generic
functions. The function <code class="function">gstream:generic-stream-<em class="replaceable"><code>x</code></em></code>
corresponds to the <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> function <code class="function"><em class="replaceable"><code>x</code></em></code>.
They all take a controller and some number of arguments.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(gstream:generic-stream-read-char
<em class="replaceable"><code>controller</code></em>)</code></span></dt><dd> Returns and consumes the next character, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> at
end of file. Takes one argument, the controller object.
</dd><dt><span class="term"><code class="code">(gstream:generic-stream-peek-char
<em class="replaceable"><code>controller</code></em>)</code></span></dt><dd> Returns the next character, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> at end of file. A
second value indicates whether the side effects associated with
consuming the character were executed: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> means that a full
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> was done, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> means that no side effects were done.
Takes one argument, the controller object.
</dd><dt><span class="term"><code class="code">(gstream:generic-stream-read-byte
<em class="replaceable"><code>controller</code></em>)</code></span></dt><dd>Returns and consumes the next integer, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> at end
of file. Takes one argument, the controller object.
</dd><dt><span class="term"><code class="code">(gstream:generic-stream-read-char-will-hang-p
<em class="replaceable"><code>controller</code></em>)</code></span></dt><dd>This generic function is used to query the stream's
input status. It returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if
<code class="function">gstream:generic-stream-read-char</code> and
<code class="function">gstream:generic-stream-peek-char</code> will certainly
return immediately. Otherwise it returns true.
</dd><dt><span class="term"><code class="code">(gstream:generic-stream-write-char
<em class="replaceable"><code>controller</code></em> <em class="replaceable"><code>char</code></em>)</code></span></dt><dd>The first argument is the controller object.
The second argument is the character to be written.
</dd><dt><span class="term"><code class="code">(gstream:generic-stream-write-byte
<em class="replaceable"><code>controller</code></em>
<em class="replaceable"><code>by</code></em>)</code></span></dt><dd>The first argument is the controller object.
The second argument is the integer to be written.
</dd><dt><span class="term"><code class="code">(gstream:generic-stream-write-string
<em class="replaceable"><code>controller</code></em>
<em class="replaceable"><code>string</code></em> <em class="replaceable"><code>start</code></em> <em class="replaceable"><code>length</code></em>)</code></span></dt><dd>Writes the subsequence of <em class="replaceable"><code>string</code></em> starting from
<em class="replaceable"><code>start</code></em> of length <em class="replaceable"><code>length</code></em>.
The first argument is the controller object.
</dd><dt><span class="term"><code class="code">(gstream:generic-stream-clear-input
<em class="replaceable"><code>controller</code></em>)</code><br /></span><span class="term"><code class="code">(gstream:generic-stream-clear-output
<em class="replaceable"><code>controller</code></em>)</code><br /></span><span class="term"><code class="code">(gstream:generic-stream-finish-output
<em class="replaceable"><code>controller</code></em>)</code><br /></span><span class="term"><code class="code">(gstream:generic-stream-force-output
<em class="replaceable"><code>controller</code></em>)</code><br /></span><span class="term"><code class="code">(gstream:generic-stream-close
<em class="replaceable"><code>controller</code></em>)</code></span></dt><dd>Take one argument, the controller object.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="weak"></a>31.7. Weak Objects</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#weak-pointer">31.7.1. Weak Pointers</a></span></dt><dt><span class="section"><a href="#weak-list">31.7.2. Weak Lists</a></span></dt><dt><span class="section"><a href="#weak-and-relation">31.7.3. Weak <span class="quote">“<span class="quote">And</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-or-relation">31.7.4. Weak <span class="quote">“<span class="quote">Or</span>”</span> Relations</a></span></dt><dt><span class="section"><a href="#weak-mapping">31.7.5. Weak Associations</a></span></dt><dt><span class="section"><a href="#weak-and-mapping">31.7.6. Weak <span class="quote">“<span class="quote">And</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-or-mapping">31.7.7. Weak <span class="quote">“<span class="quote">Or</span>”</span> Mappings</a></span></dt><dt><span class="section"><a href="#weak-alist">31.7.8. Weak Association Lists</a></span></dt><dt><span class="section"><a href="#weak-ht">31.7.9. Weak Hash Tables</a></span></dt></dl></div><p>Recall two terms: An object is called <span class="quote">“<span class="quote">"alive"</span>”</span> as
long as it can be retrieved by the user or program, through any kind of
references, starting from global and local variables. (Objects that
consume no heap storage, also known as <span class="quote">“<span class="quote">"immediate
objects"</span>”</span>, such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s, and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s, are alive indefinitely.) An object is said to be
<a href="impnotes.html#gc" class="olink">garbage-collect</a>ed when its storage is reclaimed, at some moment after it becomes
<span class="quote">“<span class="quote">"dead"</span>”</span>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-pointer"></a>31.7.1. Weak Pointers</h3></div></div></div><p>A <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a> is an object holding a reference to a given object,
without keeping the latter from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</p><div class="variablelist"><p class="title"><strong>Weak Pointer API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-POINTER</code>
<em class="replaceable"><code>value</code></em>)</code></span></dt><dd>returns a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a> referring to
<em class="replaceable"><code>value</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-POINTER-P</code> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
<a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-POINTER-VALUE</code>
<em class="replaceable"><code>weak-pointer</code></em>)</code></span></dt><dd>returns two values: The original value and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>,
if the value has not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
It is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>-able: you can change the value that the weak pointer
points to.</dd></dl></div><p>Weak pointers are useful for notification-based communication
protocols between software modules, e.g. when a change to an object
<em class="replaceable"><code>x</code></em> requires a notification to an object <em class="replaceable"><code>y</code></em>, as long as <em class="replaceable"><code>y</code></em> is
alive.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-list"></a>31.7.2. Weak Lists</h3></div></div></div><p>A <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a> is an ordered collection of references to objects
that does <span class="strong"><strong>not</strong></span> keep the objects from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed. It is
semantically equivalent to a list of <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>s, however with a
more efficient in-memory representation than a plain list of
<a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>s would be.</p><div class="variablelist"><p class="title"><strong>Weak List API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-LIST</code> <em class="replaceable"><code>list</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a> pointing to each of the
elements in the given <em class="replaceable"><code>list</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-LIST-P</code> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
<a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-LIST-LIST</code>
<em class="replaceable"><code>weak-list</code></em>)</code></span></dt><dd>returns a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of those objects from the
<em class="replaceable"><code>weak-list</code></em> that are still
alive.</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-LIST-LIST</code>
<em class="replaceable"><code>weak-list</code></em>) <em class="replaceable"><code>list</code></em>)</code></span></dt><dd>replaces the list of objects stored by the
<em class="replaceable"><code>weak-list</code></em>.</dd></dl></div><p>Weak lists are useful for notification based communication
protocols between software modules, e.g. when a change to an object
<em class="replaceable"><code>x</code></em> requires a notification to objects <em class="replaceable"><code>k<sub>1</sub></code></em>, <em class="replaceable"><code>k<sub>2</sub></code></em>, ..., as long
as such a particular <em class="replaceable"><code>k<sub>n</sub></code></em> is alive.</p><p>A <a class="link" href="#weak-list" title="31.7.2. Weak Lists"><code class="classname">EXT:WEAK-LIST</code></a> with a single element is semantically equivalent to a
single <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-and-relation"></a>31.7.3. Weak <span class="quote">“<span class="quote">And</span>”</span> Relations</h3></div></div></div><p>A weak <span class="quote">“<span class="quote">and</span>”</span> relation is an ordered collection of
references to objects, that does <span class="strong"><strong>not</strong></span> keep the objects from being
<a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, and which allows access to all the objects as long as all of
them are still alive. As soon as one of them is <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, the entire
collection of objects becomes empty.</p><div class="variablelist"><p class="title"><strong>Weak <span class="quote">“<span class="quote">And</span>”</span> Relation API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-AND-RELATION</code>
<em class="replaceable"><code>list</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a> between the objects in
the given <em class="replaceable"><code>list</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-RELATION-P</code>
<em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
<a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-RELATION-LIST</code>
<em class="replaceable"><code>weak-and-relation</code></em>)</code></span></dt><dd>returns the list of objects stored in the
<em class="replaceable"><code>weak-and-relation</code></em>. The returned list must not
be destructively modified.</dd></dl></div><p><a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a>s are useful to model relations between objects
that become worthless when one of the objects dies.</p><p>A <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a> with a single element is semantically
equivalent to a <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-or-relation"></a>31.7.4. Weak <span class="quote">“<span class="quote">Or</span>”</span> Relations</h3></div></div></div><p>A weak <span class="quote">“<span class="quote">or</span>”</span> relation is an ordered collection of
references to objects, that keeps all objects from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed as long
as one of them is still alive. In other words, each of them keeps all
others among them from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed. When all of them are unreferenced,
the collection of objects becomes empty.</p><div class="variablelist"><p class="title"><strong>Weak <span class="quote">“<span class="quote">Or</span>”</span> Relation API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-OR-RELATION</code>
<em class="replaceable"><code>list</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a> between the objects in
the given <em class="replaceable"><code>list</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-RELATION-P</code>
<em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
<a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-RELATION-LIST</code>
<em class="replaceable"><code>weak-or-relation</code></em>)</code></span></dt><dd>returns the list of objects stored in the
<em class="replaceable"><code>weak-or-relation</code></em>. The returned list must not
be destructively modified.</dd></dl></div><p><a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a>s are useful to model relations between objects
that do not become worthless when one of the objects dies.</p><p>A <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a> with a single element is semantically
equivalent to a <a class="link" href="#weak-pointer" title="31.7.1. Weak Pointers"><code class="classname">EXT:WEAK-POINTER</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-mapping"></a>31.7.5. Weak Associations</h3></div></div></div><p>A weak association is a mapping from an object called <em class="replaceable"><code>key</code></em> to
an object called <em class="replaceable"><code>value</code></em>, that exists as long as the key is alive. In
other words, as long as the key is alive, it keeps the value from being
<a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</p><div class="variablelist"><p class="title"><strong>Weak Association API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-MAPPING</code>
<em class="replaceable"><code>key</code></em> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a>.
</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-MAPPING-P</code>
<em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the object is of type
<a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-MAPPING-PAIR</code>
<em class="replaceable"><code>weak-mapping</code></em>)</code></span></dt><dd>returns three values: the original key, the original
value, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, if the key has not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-MAPPING-VALUE</code>
<em class="replaceable"><code>weak-mapping</code></em>)</code></span></dt><dd>returns the value, if the key has not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed,
else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-MAPPING-VALUE</code>
<em class="replaceable"><code>weak-mapping</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>replaces the value stored in the
<em class="replaceable"><code>weak-mapping</code></em>. It has no effect when the
key has already been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd></dl></div><p>Weak associations are useful to supplement objects with additional
information that is stored outside of the object.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-and-mapping"></a>31.7.6. Weak <span class="quote">“<span class="quote">And</span>”</span> Mappings</h3></div></div></div><p>A weak <span class="quote">“<span class="quote">and</span>”</span> mapping is a mapping from a tuple of
objects called <em class="replaceable"><code>keys</code></em> to an object called <em class="replaceable"><code>value</code></em>, that does
<span class="strong"><strong>not</strong></span> keep the keys from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed and that exists as long as all
keys are alive. As soon as one of the keys is <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, the entire
mapping goes away.</p><div class="variablelist"><p class="title"><strong>Weak <span class="quote">“<span class="quote">And</span>”</span> Mapping API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-AND-MAPPING</code>
<em class="replaceable"><code>keys</code></em> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>creates a <a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a> between the <em class="replaceable"><code>keys</code></em>
objects in the given list and the given <em class="replaceable"><code>value</code></em>.
The <em class="replaceable"><code>keys</code></em> list must be non-empty.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-MAPPING-P</code>
<em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
<a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-MAPPING-PAIR</code>
<em class="replaceable"><code>weak-and-mapping</code></em>)</code></span></dt><dd>returns three values: the list of keys, the value,
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, if none of the keys have been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
The returned keys list must not be destructively modified.
</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-AND-MAPPING-VALUE</code>
<em class="replaceable"><code>weak-and-mapping</code></em>)</code></span></dt><dd>returns the value, if none of the keys have been
<a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
(<code class="function">EXT:WEAK-AND-MAPPING-VALUE</code>
<em class="replaceable"><code>weak-and-mapping</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>replaces the value stored in the
<em class="replaceable"><code>weak-and-mapping</code></em>. It has no effect when
some key has already been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd></dl></div><p><a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a>s are useful to model properties of sets of
objects that become worthless when one of the objects dies.</p><p>A <a class="link" href="#weak-and-mapping" title="31.7.6. Weak “And” Mappings"><code class="classname">EXT:WEAK-AND-MAPPING</code></a> with a single key is semantically equivalent
to a weak association.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-or-mapping"></a>31.7.7. Weak <span class="quote">“<span class="quote">Or</span>”</span> Mappings</h3></div></div></div><p>A weak <span class="quote">“<span class="quote">or</span>”</span> mapping is a mapping from a tuple of
objects called <em class="replaceable"><code>keys</code></em> to an object called <em class="replaceable"><code>value</code></em>, that keeps all
keys and the value from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed as long as one of the keys is
still alive. In other words, each of the keys keeps all others among
them and the value from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed. When all of them are
unreferenced, the entire mapping goes away.</p><div class="variablelist"><p class="title"><strong>Weak <span class="quote">“<span class="quote">Or</span>”</span> Mapping API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-OR-MAPPING</code>
<em class="replaceable"><code>keys</code></em> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd> creates a <a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a> between the
<em class="replaceable"><code>keys</code></em> objects in the given list and the given
<em class="replaceable"><code>value</code></em>. The <em class="replaceable"><code>keys</code></em> list must be
non-empty.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-MAPPING-P</code>
<em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
<a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-MAPPING-PAIR</code>
<em class="replaceable"><code>weak-or-mapping</code></em>)</code></span></dt><dd>returns three values: the list of keys, the value,
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, if the keys have not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
The returned keys list must not be destructively modified.
</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-OR-MAPPING-VALUE</code>
<em class="replaceable"><code>weak-or-mapping</code></em>)</code></span></dt><dd>returns the value, if the keys have not yet been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed,
else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-OR-MAPPING-VALUE</code>
<em class="replaceable"><code>weak-or-mapping</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>replaces the value stored in the
<em class="replaceable"><code>weak-or-mapping</code></em>. It has no effect when the
keys have already been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd></dl></div><p><a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a>s are useful to model properties of sets of
objects that do not become worthless when one of the objects dies.</p><p>A <a class="link" href="#weak-or-mapping" title="31.7.7. Weak “Or” Mappings"><code class="classname">EXT:WEAK-OR-MAPPING</code></a> with a single key is semantically equivalent
to a weak association.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-alist"></a>31.7.8. Weak Association Lists</h3></div></div></div><p>A weak association list is an ordered collection of pairs, each
pair being built from an object called <em class="replaceable"><code>key</code></em> and an object called
<em class="replaceable"><code>value</code></em>. The lifetime of each pair depends on the type of the weak
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:KEY</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> is not <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
As long as the <em class="replaceable"><code>key</code></em> is alive, it prevents the <em class="replaceable"><code>value</code></em> from
being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd><dt><span class="term"><code class="constant">:VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>value</code></em> is not <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
As long as the <em class="replaceable"><code>value</code></em> is alive, it prevents the <em class="replaceable"><code>key</code></em> from
being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd><dt><span class="term"><code class="constant">:KEY-AND-VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>
are alive.
</dd><dt><span class="term"><code class="constant">:KEY-OR-VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> or the <em class="replaceable"><code>value</code></em>
are alive. As long as the <em class="replaceable"><code>key</code></em> is alive, it prevents the <em class="replaceable"><code>value</code></em>
from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, and as long as the <em class="replaceable"><code>value</code></em> is alive, it prevents the
<em class="replaceable"><code>key</code></em> from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd></dl></div><p>
In other words, each pair is:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:KEY</code></span></dt><dd>a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a> from the <em class="replaceable"><code>key</code></em> to the <em class="replaceable"><code>value</code></em>,
</dd><dt><span class="term"><code class="constant">:VALUE</code></span></dt><dd>a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a> from the <em class="replaceable"><code>value</code></em> to the <em class="replaceable"><code>key</code></em>,
</dd><dt><span class="term"><code class="constant">:KEY-AND-VALUE</code></span></dt><dd>a <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a> of the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>,
</dd><dt><span class="term"><code class="constant">:KEY-OR-VALUE</code></span></dt><dd>a <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a> of the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>.
</dd></dl></div><div class="variablelist"><p class="title"><strong>Weak Association List API</strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">EXT:MAKE-WEAK-ALIST</code>
:type :initial-contents)</code></span></dt><dd>creates a <a class="link" href="#weak-alist" title="31.7.8. Weak Association Lists"><code class="classname">EXT:WEAK-ALIST</code></a>. The <em class="replaceable"><code>type</code></em> argument
must be one of the four aforementioned types; the default is <code class="constant">:KEY</code>.
The <em class="replaceable"><code>initial-contents</code></em> argument must be an
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-P</code> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>returns true if the <em class="replaceable"><code>object</code></em> is of type
<a class="link" href="#weak-alist" title="31.7.8. Weak Association Lists"><code class="classname">EXT:WEAK-ALIST</code></a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-TYPE</code>
<em class="replaceable"><code>weak-alist</code></em>)</code></span></dt><dd>returns the type of the
<em class="replaceable"><code>weak-alist</code></em>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-CONTENTS</code>
<em class="replaceable"><code>weak-alist</code></em>)</code></span></dt><dd>returns an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> that corresponds to the current
contents of the <em class="replaceable"><code>weak-alist</code></em>.
</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-ALIST-CONTENTS</code>
<em class="replaceable"><code>weak-alist</code></em>)
<em class="replaceable"><code>contents</code></em>)</code></span></dt><dd>replaces the contents of a
<em class="replaceable"><code>weak-alist</code></em>. The
<em class="replaceable"><code>contents</code></em> argument must be an
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-ASSOC</code> <em class="replaceable"><code>item</code></em>
<em class="replaceable"><code>weak-alist</code></em>
[:test] [:test-not] [:key])</code></span></dt><dd>is equivalent to
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_assoccm_a_assoc-if-not.html" target="_top"><code class="function">ASSOC</code></a> <em class="replaceable"><code>item</code></em> (<code class="function">EXT:WEAK-ALIST-CONTENTS</code>
<em class="replaceable"><code>weak-alist</code></em>)
[:test] [:test-not] [:key])</code>.
</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-RASSOC</code> <em class="replaceable"><code>item</code></em>
<em class="replaceable"><code>weak-alist</code></em>
[:test] [:test-not] [:key])</code></span></dt><dd>is equivalent to
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_rassoccm__assoc-if-not.html" target="_top"><code class="function">RASSOC</code></a> <em class="replaceable"><code>item</code></em> (<code class="function">EXT:WEAK-ALIST-CONTENTS</code>
<em class="replaceable"><code>weak-alist</code></em>)
[:test] [:test-not] [:key])</code>.
</dd><dt><span class="term"><code class="code">(<code class="function">EXT:WEAK-ALIST-VALUE</code> <em class="replaceable"><code>item</code></em>
<em class="replaceable"><code>weak-alist</code></em> [:test] [:test-not])</code></span></dt><dd>is equivalent to
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> (<code class="function">EXT:WEAK-LIST-ASSOC</code>
<em class="replaceable"><code>item</code></em> <em class="replaceable"><code>weak-alist</code></em>
[:test] [:test-not]))</code>.
</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<code class="function">EXT:WEAK-ALIST-VALUE</code>
<em class="replaceable"><code>item</code></em> <em class="replaceable"><code>weak-alist</code></em> [:test] [:test-not])
<em class="replaceable"><code>value</code></em>)</code></span></dt><dd>replaces the value stored for <em class="replaceable"><code>item</code></em> in
a <em class="replaceable"><code>weak-alist</code></em>. When a pair with the given
<em class="replaceable"><code>item</code></em> as key does not exist or has already been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, a new pair
is added to the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</dd></dl></div><p>Weak associations lists are useful to supplement objects with
additional information that is stored outside of the object, when the
number of such objects is known to be small.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="weak-ht"></a>31.7.9. Weak Hash Tables</h3></div></div></div><p>A weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> is an unordered collection of pairs, each
pair being built from an object called <em class="replaceable"><code>key</code></em> and an object called
<em class="replaceable"><code>value</code></em>. There can be only one pair with a given <em class="replaceable"><code>key</code></em> in a weak
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>. The lifetime of each pair depends on the type of the
weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:KEY</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> is not <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
As long as the <em class="replaceable"><code>key</code></em> is alive, it prevents the <em class="replaceable"><code>value</code></em> from
being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd><dt><span class="term"><code class="constant">:VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>value</code></em> is not <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
As long as the <em class="replaceable"><code>value</code></em> is alive, it prevents the <em class="replaceable"><code>key</code></em> from
being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.</dd><dt><span class="term"><code class="constant">:KEY-AND-VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> and the
<em class="replaceable"><code>value</code></em> are alive.</dd><dt><span class="term"><code class="constant">:KEY-OR-VALUE</code></span></dt><dd>The pair exists as long as the <em class="replaceable"><code>key</code></em> or the
<em class="replaceable"><code>value</code></em> are alive. As long as the <em class="replaceable"><code>key</code></em> is alive, it prevents
the <em class="replaceable"><code>key</code></em> from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, and as long as the <em class="replaceable"><code>value</code></em> is
alive, it prevents the <em class="replaceable"><code>key</code></em> from being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed.
</dd></dl></div><p>
In other words, each pair is:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:KEY</code></span></dt><dd>a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a> from the <em class="replaceable"><code>key</code></em> to the <em class="replaceable"><code>value</code></em>,
</dd><dt><span class="term"><code class="constant">:VALUE</code></span></dt><dd>a <a class="link" href="#weak-mapping" title="31.7.5. Weak Associations"><code class="classname">EXT:WEAK-MAPPING</code></a> from the <em class="replaceable"><code>value</code></em> to the <em class="replaceable"><code>key</code></em>,
</dd><dt><span class="term"><code class="constant">:KEY-AND-VALUE</code></span></dt><dd>a <a class="link" href="#weak-and-relation" title="31.7.3. Weak “And” Relations"><code class="classname">EXT:WEAK-AND-RELATION</code></a> of the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>,
</dd><dt><span class="term"><code class="constant">:KEY-OR-VALUE</code></span></dt><dd>a <a class="link" href="#weak-or-relation" title="31.7.4. Weak “Or” Relations"><code class="classname">EXT:WEAK-OR-RELATION</code></a> of the <em class="replaceable"><code>key</code></em> and the <em class="replaceable"><code>value</code></em>.
</dd></dl></div><p>See also <a class="xref" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE">Section 18.2, “Function <code class="function">MAKE-HASH-TABLE</code>”</a>.</p><p>Weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s are useful to supplement objects with
additional information that is stored outside of the object. This data
structure scales up without performance degradation when the number of
pairs is big.</p><p>Weak <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s are also useful to implement canonicalization
tables.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="final"></a>31.8. Finalization</h2></div></div></div><p>Calling <code class="code">(<a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>function</code></em>)</code>
has the effect that when the specified object is being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed,
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>object</code></em>)</code> will be executed.</p><p>Calling <code class="code">(<a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a> <em class="replaceable"><code>object</code></em> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>guardian</code></em>)</code>
has a similar effect, but only as long as the <em class="replaceable"><code>guardian</code></em> has not been <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed:
when <em class="replaceable"><code>object</code></em> is being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_funcall.html" target="_top"><code class="function">FUNCALL</code></a> <em class="replaceable"><code>function</code></em> <em class="replaceable"><code>object</code></em>
<em class="replaceable"><code>guardian</code></em>)</code> will be executed.
If the <em class="replaceable"><code>guardian</code></em> is <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed before <em class="replaceable"><code>object</code></em> is, nothing happens.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The time when <span class="quote">“<span class="quote">the <em class="replaceable"><code>object</code></em> is being <a href="impnotes.html#gc" class="olink">garbage-collect</a>ed</span>”</span> is not
defined deterministically. (Actually, it might possibly never occur.)
It denotes a moment at which no references to <em class="replaceable"><code>object</code></em> exist from other
Lisp objects. When the <em class="replaceable"><code>function</code></em> is called, <em class="replaceable"><code>object</code></em> (and, possibly,
<em class="replaceable"><code>guardian</code></em>) enter the <span class="quote">“<span class="quote">arena of live Lisp objects</span>”</span> again.
</p></div><p>No finalization request will be executed more than once.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="prompt"></a>31.9. The Prompt</h2></div></div></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> prompt consists of 3 mandatory parts: <span class="quote">“<span class="quote">start</span>”</span>,
<span class="quote">“<span class="quote">body</span>”</span>, and <span class="quote">“<span class="quote">finish</span>”</span>; and 2 optional parts:
<span class="quote">“<span class="quote">break</span>”</span>, which appears only in the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> (after <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_break.html" target="_top"><code class="function">BREAK</code></a>
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a>), and <span class="quote">“<span class="quote">step</span>”</span>, which appears only in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a>er.
Each part is controlled by a custom variable, which can be either a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> of no arguments returning a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
(if it is something else - or if the return value was not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
- it is printed with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINC</code></a>). In the order of invocation:</p><div class="variablelist"><dl class="variablelist"><dt><a id="prompt-start"></a><span class="term"><a class="link" href="#prompt-start"><code class="varname">CUSTOM:*PROMPT-START*</code></a></span></dt><dd>Defaults to an empty string.
</dd><dt><a id="prompt-step"></a><span class="term"><a class="link" href="#prompt-step"><code class="varname">CUSTOM:*PROMPT-STEP*</code></a></span></dt><dd>Used only during <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a>ping.
Defaults to <span class="quote">“<span class="quote"><code class="prompt">Step n </code></span>”</span>,
where <em class="replaceable"><code>n</code></em> is the stepping level as returned by <a class="link" href="#step-level"><code class="function">EXT:STEP-LEVEL</code></a>.
</dd><dt><a id="prompt-break"></a><span class="term"><a class="link" href="#prompt-break"><code class="varname">CUSTOM:*PROMPT-BREAK*</code></a></span></dt><dd>Used only inside break loop (during debugging).
Defaults to <span class="quote">“<span class="quote"><code class="prompt">Break n </code></span>”</span>,
where <em class="replaceable"><code>n</code></em> is the break level as returned by <a class="link" href="#break-level"><code class="function">EXT:BREAK-LEVEL</code></a>.
</dd><dt><a id="prompt-body"></a><span class="term"><a class="link" href="#prompt-body"><code class="varname">CUSTOM:*PROMPT-BODY*</code></a></span></dt><dd>Defaults to <span class="quote">“<span class="quote"><code class="prompt">package[n]</code></span>”</span>
where <em class="replaceable"><code>package</code></em> is the shortest (nick)name (as returned by
<a class="link" href="#package-shortest-name"><code class="function">EXT:PACKAGE-SHORTEST-NAME</code></a>) of the current package <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a>
if it is <span class="strong"><strong>not</strong></span> the same as it was in the beginning
(determined by <a class="link" href="#prompt-new-package"><code class="function">EXT:PROMPT-NEW-PACKAGE</code></a>)
or if it does not contain symbol <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>,
(it is assumed that in the latter case you would want to keep in
mind that your current package is something weird);
and <em class="replaceable"><code>n</code></em> is the index of the current prompt, kept in <a class="link" href="#command-index"><code class="varname">EXT:*COMMAND-INDEX*</code></a>.
</dd><dt><a id="prompt-finish"></a><span class="term"><a class="link" href="#prompt-finish"><code class="varname">CUSTOM:*PROMPT-FINISH*</code></a></span></dt><dd>Defaults to <span class="quote">“<span class="quote"><code class="prompt">> </code></span>”</span>.
</dd></dl></div><p>To facilitate your own custom prompt creation, the following
functions and variables are available:</p><div class="variablelist"><dl class="variablelist"><dt><a id="break-level"></a><span class="term"><a class="link" href="#break-level"><code class="function">EXT:BREAK-LEVEL</code></a></span></dt><dd>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> returns current <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_break.html" target="_top"><code class="function">BREAK</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> level.
</dd><dt><a id="step-level"></a><span class="term"><a class="link" href="#step-level"><code class="function">EXT:STEP-LEVEL</code></a></span></dt><dd>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> returns current <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_step.html" target="_top"><code class="function">STEP</code></a> level.
</dd><dt><a id="prompt-new-package"></a><span class="term"><a class="link" href="#prompt-new-package"><code class="function">EXT:PROMPT-NEW-PACKAGE</code></a></span></dt><dd>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stpackagest.html" target="_top"><code class="varname">*PACKAGE*</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
if the current package is the same as it was initially.
</dd><dt><a id="package-shortest-name"></a><span class="term"><a class="link" href="#package-shortest-name"><code class="function">EXT:PACKAGE-SHORTEST-NAME</code></a></span></dt><dd>This <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a> takes one argument, a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>, and returns its shortest name or nickname.
</dd><dt><a id="command-index"></a><span class="term"><a class="link" href="#command-index"><code class="varname">EXT:*COMMAND-INDEX*</code></a></span></dt><dd>contains the current prompt number;
it is your responsibility to increment it
(this variable is bound to 0 before saving the <a href="impnotes.html#image" class="olink">memory image</a>).
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ansi"></a>31.10. Maximum ANSI CL compliance</h2></div></div></div><p>Some [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] features are turned off by default for convenience and
backward compatibility.
They can be switched on, all at once, by setting the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>
<a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, or they can be switched on individually.
Setting <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> implies the following:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Setting <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">Setting <a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li></ol></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you run <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with the <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code> switch or set
the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> and then save <a href="impnotes.html#image" class="olink">memory image</a>,
then all subsequent invocations of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with this image
will be as if with <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code>
(regardless whether you actually supply the <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code> switch).
You can always set the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> <a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, or invoke
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with the <code class="option"><a href="clisp.html#opt-traditional" class="olink">-traditional</a></code> switch, reversing the above
settings, i.e.,</p></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Setting <a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</li><li class="listitem">Setting <a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="macros3"></a>31.11. Additional Fancy Macros and Functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#ethe">31.11.1. Macro <code class="function">EXT:ETHE</code></a></span></dt><dt><span class="section"><a href="#letf">31.11.2. Macros <code class="function">EXT:LETF</code> & <code class="function">EXT:LETF*</code></a></span></dt><dt><span class="section"><a href="#memoized">31.11.3. Macro <code class="function">EXT:MEMOIZED</code></a></span></dt><dt><span class="section"><a href="#with-collect">31.11.4. Macro <code class="function">EXT:WITH-COLLECT</code></a></span></dt><dt><span class="section"><a href="#compile-time-value">31.11.5. Macro <code class="function">EXT:COMPILE-TIME-VALUE</code></a></span></dt><dt><span class="section"><a href="#with-gensyms">31.11.6. Macro <code class="function">EXT:WITH-GENSYMS</code></a></span></dt><dt><span class="section"><a href="#remove-plist">31.11.7. Function <code class="function">EXT:REMOVE-PLIST</code></a></span></dt><dt><span class="section"><a href="#html-http-output">31.11.8. Macros <code class="function">EXT:WITH-HTML-OUTPUT</code> and <code class="function">EXT:WITH-HTTP-OUTPUT</code></a></span></dt><dt><span class="section"><a href="#open-http">31.11.9. Function <code class="function">EXT:OPEN-HTTP</code> and macro <code class="function">EXT:WITH-HTTP-INPUT</code></a></span></dt><dt><span class="section"><a href="#http-log-stream">31.11.10. Variable <code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></span></dt><dt><span class="section"><a href="#browse-url">31.11.11. Function <code class="function">EXT:BROWSE-URL</code></a></span></dt><dt><span class="section"><a href="#http-proxy">31.11.12. Variable <code class="varname">CUSTOM:*HTTP-PROXY*</code></a></span></dt><dt><span class="section"><a href="#canonicalize">31.11.13. Function <code class="function">EXT:CANONICALIZE</code></a></span></dt></dl></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> comes with some extension macros, mostly defined in the
file <a class="link" href="#macros3-lisp"><code class="filename">macros3.lisp</code></a> and loaded from the file <a class="link" href="#init-lisp"><code class="filename">init.lisp</code></a> during <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make</strong></span></a>:</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ethe"></a>31.11.1. Macro <a class="link" href="#ethe" title="31.11.1. Macro EXT:ETHE"><code class="function">EXT:ETHE</code></a></h3></div></div></div><p><code class="code">(<a class="link" href="#ethe" title="31.11.1. Macro EXT:ETHE"><code class="function">EXT:ETHE</code></a> <em class="replaceable"><code>value-type</code></em> <em class="replaceable"><code>form</code></em>)</code>
enforces a type check in both interpreted and compiled code.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="letf"></a>31.11.2. Macros <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*"><code class="function">EXT:LETF</code></a> & <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*"><code class="function">EXT:LETF*</code></a></h3></div></div></div><p>These macros are similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a>, respectively,
except that they can bind <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s, even <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s with <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.
Example:
</p><pre class="programlisting">(letf (((values a b) form)) ...)
</pre><p>
is equivalent to
</p><pre class="programlisting">(multiple-value-bind (a b) form ...)
</pre><p>
while
</p><pre class="programlisting">(letf (((first l) 7)) ...)
</pre><p>
is approximately equivalent to
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a> ((#:g1 l) (#:g2 (first #:g1)))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_progn.html" target="_top"><code class="function">PROGN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (first #:g1) 7) ...)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (first #:g1) #:g2)))
</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="memoized"></a>31.11.3. Macro <code class="function">EXT:MEMOIZED</code></h3></div></div></div><p><code class="code">(<code class="function">EXT:MEMOIZED</code> <em class="replaceable"><code>form</code></em>)</code>
memoizes the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> of <em class="replaceable"><code>form</code></em> from its first evaluation.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="with-collect"></a>31.11.4. Macro <a class="link" href="#with-collect" title="31.11.4. Macro EXT:WITH-COLLECT"><code class="function">EXT:WITH-COLLECT</code></a></h3></div></div></div><p>Similar to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a>'s
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1-3.html"><code class="literal">COLLECT</code></a>
construct, except that it is looks more "Lispy" and can appear
arbitrarily deep. It defines local macros (with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">MACROLET</code></a>) which
collect objects given to it into lists, which are then returned as
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>. E.g., </p><pre class="programlisting">
(ext:with-collect (c0 c1)
(dotimes (i 10) (if (oddp i) (c0 i) (c1 i))))
⇒ <code class="computeroutput">(1 3 5 7 9)</code> ;
⇒ <code class="computeroutput">(0 2 4 6 8)</code>
</pre><p> returns two <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>s as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="compile-time-value"></a>31.11.5. Macro <code class="function">EXT:COMPILE-TIME-VALUE</code></h3></div></div></div><p>Sometimes one may want to call an expensive function at
compilation time and write the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> into the <code class="filename">#P".fas"</code> file,
thus speeding up loading the <code class="filename">#P".fas"</code> file.
E.g., let your file <code class="filename">primes.lisp</code> be
</p><pre class="programlisting">
(defun primes-list (limit)
"Return the list of all primes smaller than LIMIT."
...)
(defvar *all-primes* (compile-time-value (primes-list <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_most-p_ative-fixnum.html" target="_top"><code class="constant">MOST-POSITIVE-FIXNUM</code></a>)))
</pre><p>
Then </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> "primes.lisp")</code></span></dt><dd>will <span class="strong"><strong>not</strong></span> call <code class="function">primes-list</code>
and <code class="varname">*all-primes*</code> will be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> "primes.lisp")</code></span></dt><dd>will call <code class="function">primes-list</code> (and
will probably take a long time) and will write the resulting list
into <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file-pathname.html" target="_top"><code class="function">COMPILE-FILE-PATHNAME</code></a> "primes.lisp")</code>
</dd><dt><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file-pathname.html" target="_top"><code class="function">COMPILE-FILE-PATHNAME</code></a>
"primes.lisp"))</code></span></dt><dd>will <span class="strong"><strong>not</strong></span> call <code class="function">primes-list</code>
but <code class="varname">*all-primes*</code> will be the list computed during
compilation.</dd></dl></div><p>An alternative is to save a <a href="impnotes.html#image" class="olink">memory image</a>, which is faster than <code class="filename">#P".fas"</code>
file but <a class="link" href="#image-portability" title="31.2.1. Image Portability">less portable</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="with-gensyms"></a>31.11.6. Macro <code class="function">EXT:WITH-GENSYMS</code></h3></div></div></div><p>Similar to its namesake from
<a class="ulink" href="http://www.paulgraham.com/" target="_top">Paul Graham</a>'s book
<a class="ulink" href="http://www.paulgraham.com/onlisp.html" target="_top"><span class="quote">“<span class="quote">On
Lisp</span>”</span></a>, this macro is useful for writing other macros:
</p><pre class="programlisting">
(with-gensyms ("FOO-" bar baz zot) ...)
</pre><p>
expands to
</p><pre class="programlisting">
(let ((bar (gensym "FOO-BAR-"))
(baz (gensym "FOO-BAZ-"))
(zot (gensym "FOO-ZOT-")))
...)
</pre><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="remove-plist"></a>31.11.7. Function <code class="function">EXT:REMOVE-PLIST</code></h3></div></div></div><p>Similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">REMOVE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_remf.html" target="_top"><code class="function">REMF</code></a>, this function removes some
properties from a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a>. It is non-destructive and thus can be
used on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> arguments to remove some keyword parameters, e.g.,
</p><pre class="programlisting">
(defmacro with-foo ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> foo1 foo2) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> body)
`(... ,foo1 ... ,foo2 ... ,@body))
(defmacro with-foo-bar ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> opts <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> bar1 bar2
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> body)
`(with-foo (,@(remove-plist opts :bar1 :bar2)
... ,bar1 ... ,bar2 ... ,@body)))
(defun foo-bar ()
(with-foo-bar (:bar1 1 :foo2 2) ...))
</pre><p>
here <code class="function">WITH-FOO</code> does not receive the
<code class="literal">:BAR1 1</code> argument from <code class="function">FOO-BAR</code>.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="html-http-output"></a>31.11.8. Macros <code class="function">EXT:WITH-HTML-OUTPUT</code> and
<code class="function">EXT:WITH-HTTP-OUTPUT</code></h3></div></div></div><p>Defined in <a class="link" href="#inspect-lisp"><code class="filename">inspect.lisp</code></a>, these macros are useful
for the rudimentary <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> server defined there.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="open-http"></a>31.11.9. Function <a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> and
macro <code class="function">EXT:WITH-HTTP-INPUT</code></h3></div></div></div><p>Defined in
<a class="link" href="#clhs-lisp"><code class="filename">clhs.lisp</code></a>,
they allow downloading data over the Internet using the <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> protocol.
<code class="code">(<a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> url <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:IF-DOES-NOT-EXIST</code> :LOG)</code> opens
a <a class="link" href="#socket" title="32.4. Socket Streams">socket</a> connection to the <em class="replaceable"><code>url</code></em> host,
sends the <span class="command"><strong>GET</strong></span> request,
and returns two values: the <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> and content length.
<code class="code">(EXT:WITH-HTTP-INPUT (<em class="replaceable"><code>variable</code></em> url) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> body)</code> binds <em class="replaceable"><code>variable</code></em>
to the <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> returned by <a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> and executes the <em class="replaceable"><code>body</code></em>.
<code class="code">(EXT:WITH-HTTP-INPUT ((<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>contents</code></em>) url) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> body)</code>
additionally binds <em class="replaceable"><code>contents</code></em> to the content length.</p><p><a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> will check <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a> on startup and parse the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>
<code class="envar">HTTP_PROXY</code> if <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p>The <code class="constant">:LOG</code> argument binds <a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="http-log-stream"></a>31.11.10. Variable <a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></h3></div></div></div><p>Function <a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a> logs its actions to <a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a>
which is initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="browse-url"></a>31.11.11. Function <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="function">EXT:BROWSE-URL</code></a></h3></div></div></div><p>Function <code class="code">(<a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="function">EXT:BROWSE-URL</code></a> url <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">:BROWSER</code></a> <code class="constant">:OUT</code>)</code>
calls a browser on the URL. <em class="replaceable"><code>browser</code></em>
(defaults to <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="varname">CUSTOM:*BROWSER*</code></a>) should be a valid keyword in the <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">CUSTOM:*BROWSERS*</code></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.
<code class="constant">:OUT</code> specifies the stream where the progress messages are printed
(defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>).
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="http-proxy"></a>31.11.12. Variable <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a></h3></div></div></div><p>If you are behind a proxy server, you will need to set <a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a> to
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> <span class="data"><code class="literal">(name:password host port)</code></span>.
By default, the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a> <code class="envar">http_proxy</code> is used, the
expected format is <span class="data"><code class="literal">"name:password@host:port"</code></span>.
If no <span class="data"><code class="literal">#\@</code></span> is present,
<em class="replaceable"><code>name</code></em> and <em class="replaceable"><code>password</code></em> are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
If no <span class="data"><code class="literal">#\:</code></span> is present,
<em class="replaceable"><code>password</code></em> (or <em class="replaceable"><code>port</code></em>) is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p>Use function <code class="code">(EXT:HTTP-PROXY <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
(<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> "http_proxy")))</code> to reset
<a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="canonicalize"></a>31.11.13. Function <a class="link" href="#canonicalize" title="31.11.13. Function EXT:CANONICALIZE"><code class="function">EXT:CANONICALIZE</code></a></h3></div></div></div><p>If you want to canonicalize a <em class="replaceable"><code>value</code></em> before further processing it, you
can pass it to <a class="link" href="#canonicalize" title="31.11.13. Function EXT:CANONICALIZE"><code class="function">EXT:CANONICALIZE</code></a> together with a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_function.html" target="_top"><code class="classname">FUNCTION</code></a>s:
<code class="code">(<a class="link" href="#canonicalize" title="31.11.13. Function EXT:CANONICALIZE"><code class="function">EXT:CANONICALIZE</code></a> <em class="replaceable"><code>value</code></em> <em class="replaceable"><code>functions</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> (test '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>) (max-iter 1024))</code> will call <em class="replaceable"><code>function</code></em>s on
<em class="replaceable"><code>value</code></em> until it stabilizes under <em class="replaceable"><code>test</code></em>
(which should be a valid <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_hash-table-test.html" target="_top"><code class="function">HASH-TABLE-TEST</code></a>) and return the stabilized
value and the number of iterations the stabilization required.</p><p>E.g., <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> uses it together with
<strong class="first"><em class="firstterm"><code class="varname">XLIB:*CANONICALIZE-ENCODING*</code></em></strong>
to fix the broken encoding names returned by the <a class="ulink" href="http://www.x.org/" target="_top">X Window System</a> (e.g., convert
<code class="literal">"iso8859-1"</code> to <code class="literal">"ISO-8859-1"</code>)
before passing them over to <a class="link" href="#make-encoding" title="31.5.4. Function EXT:MAKE-ENCODING"><code class="function">EXT:MAKE-ENCODING</code></a>. If you encounter an <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> in <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span>, you can augment this variable to avoid it.
</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="customize"></a>31.12. Customizing <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> behavior</h2></div></div></div><p>The user-customizable variables and functions are located in the
package <a class="link" href="#customize" title="31.12. Customizing CLISP behavior"><strong class="package"><span class="quote">“<span class="quote">CUSTOM</span>”</span></strong></a> and thus can be listed using
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS</code></a> "" "CUSTOM")</code>:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a href="impnotes.html#ansi" class="olink"><code class="varname">CUSTOM:*ANSI*</code></a></td><td><code class="varname">CUSTOM:*APPLYHOOK*</code></td></tr><tr><td><a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-DO-MORE*</code></a></td><td><a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a></td></tr><tr><td><code class="varname">CUSTOM:*BREAK-ON-WARNINGS*</code></td><td><a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="varname">CUSTOM:*BROWSER*</code></a></td></tr><tr><td><a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="constant">CUSTOM:*BROWSERS*</code></a></td><td><a href="impnotes.html#clhs-root" class="olink"><code class="function">CUSTOM:CLHS-ROOT</code></a></td></tr><tr><td><a class="link" href="#clhs-root" title="Function CUSTOM:CLHS-ROOT"><code class="varname">CUSTOM:*CLHS-ROOT-DEFAULT*</code></a></td><td><a class="link" href="#fixnum-char-ansi" title="Function COERCE"><code class="varname">CUSTOM:*COERCE-FIXNUM-CHAR-ANSI*</code></a></td></tr><tr><td><a class="link" href="#compile-warn"><code class="varname">CUSTOM:*COMPILE-WARNINGS*</code></a></td><td><a class="link" href="#compiled-types"><code class="varname">CUSTOM:*COMPILED-FILE-TYPES*</code></a></td></tr><tr><td><a href="impnotes.html#language" class="olink"><code class="varname">CUSTOM:*CURRENT-LANGUAGE*</code></a></td><td><a href="impnotes.html#def-file-enc" class="olink"><code class="varname">CUSTOM:*DEFAULT-FILE-ENCODING*</code></a></td></tr><tr><td><a class="link" href="#default-float-format" title="Variable CUSTOM:*DEFAULT-FLOAT-FORMAT*"><code class="varname">CUSTOM:*DEFAULT-FLOAT-FORMAT*</code></a></td><td><a class="link" href="#default-tz" title="Default Time Zone"><code class="varname">CUSTOM:*DEFAULT-TIME-ZONE*</code></a></td></tr><tr><td><code class="varname">CUSTOM:*DEFTYPE-DEPTH-LIMIT*</code></td><td><a class="link" href="#defun-accept-spelalist" title="Variable CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*"><code class="varname">CUSTOM:*DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST*</code></a></td></tr><tr><td><a class="link" href="#device-prefix"><code class="varname">CUSTOM:*DEVICE-PREFIX*</code></a></td><td><a class="link" href="#ed" title="25.2.9. Function ED"><code class="varname">CUSTOM:*EDITOR*</code></a></td></tr><tr><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="varname">CUSTOM:*EQ-HASHFUNCTION*</code></a></td><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="varname">CUSTOM:*EQL-HASHFUNCTION*</code></a></td></tr><tr><td><a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="varname">CUSTOM:*EQUAL-HASHFUNCTION*</code></a></td><td><code class="varname">CUSTOM:*ERROR-HANDLER*</code></td></tr><tr><td><code class="varname">CUSTOM:*EVALHOOK*</code></td><td><a href="impnotes.html#fill-stream" class="olink"><code class="varname">CUSTOM:*FILL-INDENT-SEXP*</code></a></td></tr><tr><td><a class="link" href="#fini-hooks" title="31.1.3. Customizing Termination"><code class="varname">CUSTOM:*FINI-HOOKS*</code></a></td><td><a class="link" href="#flocont" title="12.2.4.1. Rule of Float Precision Contagion sec_12-1-4-4"><code class="varname">CUSTOM:*FLOATING-POINT-CONTAGION-ANSI*</code></a></td></tr><tr><td><a class="link" href="#floratcont" title="12.2.4.2. Rule of Float and Rational Contagion sec_12-1-4-1"><code class="varname">CUSTOM:*FLOATING-POINT-RATIONAL-CONTAGION-ANSI*</code></a></td><td><a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a></td></tr><tr><td><a class="link" href="#http-log-stream" title="31.11.10. Variable CUSTOM:*HTTP-LOG-STREAM*"><code class="varname">CUSTOM:*HTTP-LOG-STREAM*</code></a></td><td><a class="link" href="#http-proxy" title="31.11.12. Variable CUSTOM:*HTTP-PROXY*"><code class="varname">CUSTOM:*HTTP-PROXY*</code></a></td></tr><tr><td><a href="impnotes.html#impnotes-root" class="olink"><code class="function">CUSTOM:IMPNOTES-ROOT</code></a></td><td><a class="link" href="#impnotes-root" title="Function CUSTOM:IMPNOTES-ROOT"><code class="varname">CUSTOM:*IMPNOTES-ROOT-DEFAULT*</code></a></td></tr><tr><td><a href="impnotes.html#init-hooks" class="olink"><code class="varname">CUSTOM:*INIT-HOOKS*</code></a></td><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-BROWSER*</code></a></td></tr><tr><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-FRONTEND*</code></a></td><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-LENGTH*</code></a></td></tr><tr><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-PRINT-LENGTH*</code></a></td><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-PRINT-LEVEL*</code></a></td></tr><tr><td><a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="varname">CUSTOM:*INSPECT-PRINT-LINES*</code></a></td><td><a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a></td></tr><tr><td><a href="impnotes.html#load-comp" class="olink"><code class="varname">CUSTOM:*LOAD-COMPILING*</code></a></td><td><a href="impnotes.html#load-echo" class="olink"><code class="varname">CUSTOM:*LOAD-ECHO*</code></a></td></tr><tr><td><a href="impnotes.html#load-lpt" class="olink"><code class="varname">CUSTOM:*LOAD-LOGICAL-PATHNAME-TRANSLATIONS-DATABASE*</code></a></td><td><a class="link" href="#load-obs"><code class="varname">CUSTOM:*LOAD-OBSOLETE-ACTION*</code></a></td></tr><tr><td><a href="impnotes.html#load-paths" class="olink"><code class="varname">CUSTOM:*LOAD-PATHS*</code></a></td><td><a class="link" href="#loop-ansi" title="6.1.3. Backward Compatibility"><code class="varname">CUSTOM:*LOOP-ANSI*</code></a></td></tr><tr><td><a class="link" href="#pathmerge" title="19.5.4. Function MERGE-PATHNAMES"><code class="varname">CUSTOM:*MERGE-PATHNAMES-ANSI*</code></a></td><td><a href="impnotes.html#misc-enc" class="olink"><code class="varname">CUSTOM:*MISC-ENCODING*</code></a></td></tr><tr><td><a class="link" href="#module-providers" title="24.3.3. User variable CUSTOM::*MODULE-PROVIDER-FUNCTIONS*"><code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a></td><td><code class="varname">CUSTOM:*PACKAGE-TASKS-TREAT-SPECIALLY*</code></td></tr><tr><td><a class="link" href="#parsename" title="19.5.3. Function PARSE-NAMESTRING"><code class="varname">CUSTOM:*PARSE-NAMESTRING-ANSI*</code></a></td><td><a class="link" href="#name-type-split" title="Name/type namestring split"><code class="varname">CUSTOM:*PARSE-NAMESTRING-DOT-FILE*</code></a></td></tr><tr><td><a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a></td><td><a class="link" href="#phasecont" title="Variable CUSTOM:*PHASE-ANSI*"><code class="varname">CUSTOM:*PHASE-ANSI*</code></a></td></tr><tr><td><a class="link" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*"><code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code></a></td><td><a class="link" href="#pr-closure" title="Variable CUSTOM:*PRINT-CLOSURE*"><code class="varname">CUSTOM:*PRINT-CLOSURE*</code></a></td></tr><tr><td><a class="link" href="#pr-empty-arr-ansi" title="Variable CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*"><code class="varname">CUSTOM:*PRINT-EMPTY-ARRAYS-ANSI*</code></a></td><td><a class="link" href="#pr-indent" title="Variable CUSTOM:*PRINT-INDENT-LISTS*"><code class="varname">CUSTOM:*PRINT-INDENT-LISTS*</code></a></td></tr><tr><td><a class="link" href="#pr-sym-pack-prefix" title="Variable CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*"><code class="function">CUSTOM:*PRINT-SYMBOL-PACKAGE-PREFIX-SHORTEST*</code></a></td><td><a class="link" href="#pathprint" title="22.6.1. Printing Pathnames sec_22-1-3-11"><code class="varname">CUSTOM:*PRINT-PATHNAMES-ANSI*</code></a></td></tr><tr><td><code class="varname">CUSTOM:*PRINT-PRETTY-FILL*</code></td><td><a class="link" href="#pr-rpars" title="Variable CUSTOM:*PRINT-RPARS*"><code class="varname">CUSTOM:*PRINT-RPARS*</code></a></td></tr><tr><td><a class="link" href="#spacecharprint" title="22.3. Printing Characters sec_22-1-3-2"><code class="varname">CUSTOM:*PRINT-SPACE-CHAR-ANSI*</code></a></td><td><a class="link" href="#pr-unreadable-ansi" title="Variable CUSTOM:*PRINT-UNREADABLE-ANSI*"><code class="varname">CUSTOM:*PRINT-UNREADABLE-ANSI*</code></a></td></tr><tr><td><a class="link" href="#prompt-body"><code class="varname">CUSTOM:*PROMPT-BODY*</code></a></td><td><a class="link" href="#prompt-break"><code class="varname">CUSTOM:*PROMPT-BREAK*</code></a></td></tr><tr><td><a class="link" href="#prompt-finish"><code class="varname">CUSTOM:*PROMPT-FINISH*</code></a></td><td><a class="link" href="#prompt-start"><code class="varname">CUSTOM:*PROMPT-START*</code></a></td></tr><tr><td><a class="link" href="#prompt-step"><code class="varname">CUSTOM:*PROMPT-STEP*</code></a></td><td><a class="link" href="#reopen" title="Variable CUSTOM:*REOPEN-OPEN-FILE*"><code class="varname">CUSTOM:*REOPEN-OPEN-FILE*</code></a></td></tr><tr><td><a href="impnotes.html#err-pr-bt" class="olink"><code class="varname">CUSTOM:*REPORT-ERROR-PRINT-BACKTRACE*</code></a></td><td><a href="impnotes.html#image" class="olink"><code class="varname">CUSTOM:*SAVEINITMEM-VERBOSE*</code></a></td></tr><tr><td><a class="link" href="#count-ansi" title="Variable CUSTOM:*SEQUENCE-COUNT-ANSI*"><code class="varname">CUSTOM:*SEQUENCE-COUNT-ANSI*</code></a></td><td><a class="link" href="#source-types"><code class="varname">CUSTOM:*SOURCE-FILE-TYPES*</code></a></td></tr><tr><td><a class="link" href="#suppress-check-redef" title="Variable CUSTOM:*SUPPRESS-CHECK-REDEFINITION*"><code class="varname">CUSTOM:*SUPPRESS-CHECK-REDEFINITION*</code></a></td><td><a class="link" href="#defconstant-similar" title="5.5.1. Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*"><code class="varname">CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</code></a></td></tr><tr><td><a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a></td><td><a href="impnotes.html#term-enc" class="olink"><code class="varname">CUSTOM:*TERMINAL-ENCODING*</code></a></td></tr><tr><td><a class="link" href="#trace-indent" title="Variable CUSTOM:*TRACE-INDENT*"><code class="varname">CUSTOM:*TRACE-INDENT*</code></a></td><td><a class="link" href="#user-commands" title="25.1.1. User-defined Commands"><code class="varname">CUSTOM:*USER-COMMANDS*</code></a></td></tr><tr><td><a href="clisp-link.html#opt-install" class="olink"><code class="varname">CUSTOM:*USER-LIB-DIRECTORY*</code></a></td><td><code class="varname">CUSTOM:*USER-MAIL-ADDRESS*</code></td></tr><tr><td><a class="link" href="#warn-fpc" title="Variable CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*"><code class="varname">CUSTOM:*WARN-ON-FLOATING-POINT-CONTAGION*</code></a></td><td><a class="link" href="#hashtable-gc-rehash-warn"><code class="varname">CUSTOM:*WARN-ON-HASHTABLE-NEEDING-REHASH-AFTER-GC*</code></a></td></tr><tr><td><code class="varname">CUSTOM:*WITH-HTML-OUTPUT-DOCTYPE*</code></td><td> </td></tr></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Some of these variables are
platform-specific.</p></div><p>You should set these variables (and do whatever other
customization you see fit) in the file <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a> in the build
directory before building <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
Alternatively, after building <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, or if you are using a binary
distribution of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, you can modify <a class="link" href="#config-lisp"><code class="filename">config.lisp</code></a>, compile and load
it, and then save the <a href="impnotes.html#image" class="olink">memory image</a>.
Finally, you can create an <a href="clisp.html#opt-norc" class="olink">RC file</a> which is loaded whenever <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
is started.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="code-walk"></a>31.13. Code Walker</h2></div></div></div><p>You can use function <a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> to expand all the macros,
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a>s, etc, in a single form:
</p><pre class="programlisting">
(<a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> '(macrolet ((bar (x) `(print ,x)))
(macrolet ((baz (x) `(bar ,x)))
(symbol-macrolet ((z 3))
(baz z)))))
⇒ <code class="computeroutput">(locally (print 3))</code> <strong> ; </strong><em class="lineannotation"><span class="lineannotation">the expansion</span></em>
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> <strong> ; </strong><em class="lineannotation"><span class="lineannotation">indicator: some expansion has actually been done</span></em>
</pre><p>This is sometimes called a <span class="quote">“<span class="quote">code walker</span>”</span>,
except that a code walker would probably leave the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">MACROLET</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_symbol-macrolet.html" target="_top"><code class="function">SYMBOL-MACROLET</code></a> forms intact and just do the expansion.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Function <a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> is the exported part of the
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> interpreter (AKA <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>), so it expands forms by assuming the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> situation <code class="constant">:EXECUTE</code> and is therefore
unsuitable for forms that may later be passed to the compiler:
</p><pre class="programlisting">
(<a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (:COMPILE-TOPLEVEL) (foo)))
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code> ;
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
(<a class="link" href="#code-walk" title="31.13. Code Walker"><code class="function">EXT:EXPAND-FORM</code></a> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (:LOAD-TOPLEVEL) (foo)))
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code> ;
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code>
</pre></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="ext-platform"></a>Chapter 32. Platform Specific Extensions</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#screen">32.1. Random Screen Access</a></span></dt><dt><span class="section"><a href="#modules">32.2. External Modules</a></span></dt><dd><dl><dt><span class="section"><a href="#mod-overview">32.2.1. Overview</a></span></dt><dt><span class="section"><a href="#modinit">32.2.2. Module initialization</a></span></dt><dt><span class="section"><a href="#modfini">32.2.3. Module finalization</a></span></dt><dt><span class="section"><a href="#modinfo">32.2.4. Function <code class="function">EXT:MODULE-INFO</code></a></span></dt><dt><span class="section"><a href="#mod-dynload">32.2.5. Dynamic module loading</a></span></dt><dt><span class="section"><a href="#mod-set-example">32.2.6. Example</a></span></dt><dt><span class="section"><a href="#module-tools">32.2.7. Module tools</a></span></dt><dd><dl><dt><span class="section"><a href="#modprep">32.2.7.1. Modprep</a></span></dt><dt><span class="section"><a href="#clisp-h">32.2.7.2. clisp.h</a></span></dt><dt><span class="section"><a href="#exporting">32.2.7.3. Exporting</a></span></dt></dl></dd><dt><span class="section"><a href="#mod-ffi-vs-c">32.2.8. Trade-offs: <strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong> vs. <span class="command"><strong>C</strong></span> modules</a></span></dt><dt><span class="section"><a href="#included-modules">32.2.9. Modules included in the source distribution</a></span></dt><dd><dl><dt><span class="section"><a href="#base-modules">32.2.9.1. Base Modules</a></span></dt><dt><span class="section"><a href="#incmod-db">32.2.9.2. Database, Directory et al</a></span></dt><dt><span class="section"><a href="#incmod-kdml">32.2.9.3. Mathematics, Data Mining et al</a></span></dt><dt><span class="section"><a href="#incmod-match">32.2.9.4. Matching, File Processing et al</a></span></dt><dt><span class="section"><a href="#incmod-net">32.2.9.5. Communication, Networking</a></span></dt><dt><span class="section"><a href="#incmod-gui">32.2.9.6. Graphics</a></span></dt><dt><span class="section"><a href="#incmod-bind">32.2.9.7. Bindings</a></span></dt><dt><span class="section"><a href="#incmod-toys">32.2.9.8. Toys and Games</a></span></dt><dt><span class="section"><a href="#incmod-misc">32.2.9.9. Miscellaneous</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#dffi">32.3. The Foreign Function Call Facility</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-intro">32.3.1. Introduction</a></span></dt><dt><span class="section"><a href="#dffi-overview">32.3.2. Overview</a></span></dt><dt><span class="section"><a href="#dffi-types">32.3.3. (Foreign) <span class="command"><strong>C</strong></span> types</a></span></dt><dt><span class="section"><a href="#c-flavor">32.3.4. The choice of the <span class="command"><strong>C</strong></span> flavor</a></span></dt><dt><span class="section"><a href="#dffi-variables">32.3.5. Foreign variables</a></span></dt><dt><span class="section"><a href="#dffi-places">32.3.6. Operations on foreign places</a></span></dt><dt><span class="section"><a href="#dffi-functions">32.3.7. Foreign functions</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-callback-mem">32.3.7.1. Callbacks and memory management</a></span></dt></dl></dd><dt><span class="section"><a href="#allocation">32.3.8. Argument and result passing conventions</a></span></dt><dt><span class="section"><a href="#param-mode">32.3.9. Parameter Mode</a></span></dt><dt><span class="section"><a href="#dffi-examples">32.3.10. Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-ex-more">32.3.10.1. More examples</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#socket">32.4. Socket Streams</a></span></dt><dd><dl><dt><span class="section"><a href="#socket-intro">32.4.1. Introduction</a></span></dt><dt><span class="section"><a href="#socket-api">32.4.2. Socket API Reference</a></span></dt><dt><span class="section"><a href="#timeout-k">32.4.3. Argument <code class="constant">:TIMEOUT</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mt">32.5. Multiple Threads of Execution</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-intro">32.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#mt-general">32.5.2. General principles</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-parallelizability">32.5.2.1. Parallelizability</a></span></dt><dt><span class="section"><a href="#mt-symvalue">32.5.2.2. Special Variable Values</a></span></dt><dt><span class="section"><a href="#mt-package">32.5.2.3. Packages</a></span></dt><dt><span class="section"><a href="#mt-clos">32.5.2.4. <span class="command"><strong>CLOS</strong></span></a></span></dt><dt><span class="section"><a href="#mt-mutable">32.5.2.5. Hash Tables, Sequences, and other mutable objects</a></span></dt><dt><span class="section"><a href="#mt-unsafe">32.5.2.6. Examples of thread-unsafe code</a></span></dt></dl></dd><dt><span class="section"><a href="#mt-api">32.5.3. Thread API reference</a></span></dt></dl></dd><dt><span class="section"><a href="#quickstart">32.6. Quickstarting delivery with <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#quickstart-summary">32.6.1. Summary</a></span></dt><dt><span class="section"><a href="#quickstart-unix">32.6.2. Scripting with <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#quickstart-desktop">32.6.3. Desktop Environments</a></span></dt><dt><span class="section"><a href="#quickstart-linux">32.6.4. Associating extensions with <span class="command"><strong>CLISP</strong></span> via kernel</a></span></dt></dl></dd><dt><span class="section"><a href="#shell">32.7. Shell, Pipes and Printing</a></span></dt><dd><dl><dt><span class="section"><a href="#exec">32.7.1. Shell</a></span></dt><dt><span class="section"><a href="#pipe">32.7.2. Pipes</a></span></dt><dt><span class="section"><a href="#hardcopy">32.7.3. Printing</a></span></dt></dl></dd><dt><span class="section"><a href="#getenv">32.8. Operating System Environment</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="screen"></a>32.1. Random Screen Access</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="function">SCREEN:MAKE-WINDOW</code>)</code></span></dt><dd>returns a <span class="type">WINDOW-STREAM</span>.
As long as this stream is open, the terminal is in cbreak/noecho mode.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> should not be used for input or output during this
time. (Use <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a> and <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a> instead.)
</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WITH-WINDOW</code> .
<em class="replaceable"><code>body</code></em>)</code></span></dt><dd>binds
<strong class="first"><em class="firstterm"><a class="link" href="#screen" title="32.1. Random Screen Access"><code class="varname">SCREEN:*WINDOW*</code></a><a id="scr-win" class="indexterm"></a></em></strong>
to a <span class="type">WINDOW-STREAM</span> and executes <em class="replaceable"><code>body</code></em>.
The stream is guaranteed to be closed when the body is left.
During its execution, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stterminal-iost.html" target="_top"><code class="varname">*TERMINAL-IO*</code></a> should not be used, as above.
</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WINDOW-SIZE</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>returns the window's size, as two values:
height (= y<sub>max</sub>+1) and width (= x<sub>max</sub>+1).
</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WINDOW-CURSOR-POSITION</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>returns the position of the cursor in the window,
as two values: line (≥0, ≤y<sub>max</sub>, 0 means top), column
(≥0, ≤x<sub>max</sub>, 0 means left margin).
</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:SET-WINDOW-CURSOR-POSITION</code>
<em class="replaceable"><code>window-stream</code></em> <em class="replaceable"><code>line</code></em> <em class="replaceable"><code>column</code></em>)</code></span></dt><dd>sets the position of the cursor in the window.
</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:CLEAR-WINDOW</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>clears the window's contents and puts the cursor
in the upper left corner.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:CLEAR-WINDOW-TO-EOT</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>clears the window's contents from the cursor
position to the end of window.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:CLEAR-WINDOW-TO-EOL</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>clears the window's contents from the cursor
position to the end of line.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:DELETE-WINDOW-LINE</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>removes the cursor's line, moves the lines below
it up by one line and clears the window's last line.
</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:INSERT-WINDOW-LINE</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>inserts a line at the cursor's line, moving the
lines below it down by one line.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:HIGHLIGHT-ON</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>switches highlighted output on.
</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:HIGHLIGHT-OFF</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>switches highlighted output off.
</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WINDOW-CURSOR-ON</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>makes the cursor visible, a cursor block in most
implementations.</dd><dt><span class="term"><code class="code">(<code class="function">SCREEN:WINDOW-CURSOR-OFF</code>
<em class="replaceable"><code>window-stream</code></em>)</code></span></dt><dd>makes the cursor invisible, in implementations
where this is possible.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="modules"></a>32.2. External Modules</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mod-overview">32.2.1. Overview</a></span></dt><dt><span class="section"><a href="#modinit">32.2.2. Module initialization</a></span></dt><dt><span class="section"><a href="#modfini">32.2.3. Module finalization</a></span></dt><dt><span class="section"><a href="#modinfo">32.2.4. Function <code class="function">EXT:MODULE-INFO</code></a></span></dt><dt><span class="section"><a href="#mod-dynload">32.2.5. Dynamic module loading</a></span></dt><dt><span class="section"><a href="#mod-set-example">32.2.6. Example</a></span></dt><dt><span class="section"><a href="#module-tools">32.2.7. Module tools</a></span></dt><dd><dl><dt><span class="section"><a href="#modprep">32.2.7.1. Modprep</a></span></dt><dt><span class="section"><a href="#clisp-h">32.2.7.2. clisp.h</a></span></dt><dt><span class="section"><a href="#exporting">32.2.7.3. Exporting</a></span></dt></dl></dd><dt><span class="section"><a href="#mod-ffi-vs-c">32.2.8. Trade-offs: <strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong> vs. <span class="command"><strong>C</strong></span> modules</a></span></dt><dt><span class="section"><a href="#included-modules">32.2.9. Modules included in the source distribution</a></span></dt><dd><dl><dt><span class="section"><a href="#base-modules">32.2.9.1. Base Modules</a></span></dt><dt><span class="section"><a href="#incmod-db">32.2.9.2. Database, Directory et al</a></span></dt><dt><span class="section"><a href="#incmod-kdml">32.2.9.3. Mathematics, Data Mining et al</a></span></dt><dt><span class="section"><a href="#incmod-match">32.2.9.4. Matching, File Processing et al</a></span></dt><dt><span class="section"><a href="#incmod-net">32.2.9.5. Communication, Networking</a></span></dt><dt><span class="section"><a href="#incmod-gui">32.2.9.6. Graphics</a></span></dt><dt><span class="section"><a href="#incmod-bind">32.2.9.7. Bindings</a></span></dt><dt><span class="section"><a href="#incmod-toys">32.2.9.8. Toys and Games</a></span></dt><dt><span class="section"><a href="#incmod-misc">32.2.9.9. Miscellaneous</a></span></dt></dl></dd></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.1. <a href="#mod-set-ex-bindings">Create a module set with GNU libc bindings</a></dt></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="mod-win32"></a>Modules on <span class="platform">Win32</span></h3><p>Everything described in the section will work verbatim on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>
when using <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> or <a class="ulink" href="http://www.mingw.org/" target="_top"><span class="platform">MinGW</span></a>, <span class="emphasis"><em>except</em></span> for one
thing - you will need to replace the <code class="filename">run</code>
extension in <code class="filename">lisp.run</code> with the <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> executable
extension <code class="filename">exe</code>.</p><p>For historical reasons, all examples appear to assume <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and
use the <code class="filename">run</code> file type (<span class="quote">“<span class="quote">extension</span>”</span>)
for the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="clisp.html#runtime" class="olink">runtime</a>.
This does <span class="strong"><strong>not</strong></span> mean that they will not work on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mod-overview"></a>32.2.1. Overview</h3></div></div></div><p><span class="emphasis"><em>External modules</em></span> are a mechanism to add
extensions (written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, for example) to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
Extending <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> using an external module requires creating a <a href="impnotes.html#modset" class="olink">module set</a>
and adding it to an existing <a href="impnotes.html#linkset" class="olink">linking set</a> using <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> to prodice a
new <a href="impnotes.html#linkset" class="olink">linking set</a> which contains the extension. </p><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="modset"></a>Module Set</h4></div></div></div><p>A <strong class="first"><em class="firstterm">module<a id="module" class="indexterm"></a></em></strong> is a piece of code
(<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> or Lisp) which defines extra (non-core) Lisp objects, symbols
and functions. Together with <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>, which describes how to add the
module to an existing <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, it comprises a <a href="impnotes.html#modset" class="olink">module set</a>.</p><p>More formally,
<strong class="first"><em class="firstterm"><a href="impnotes.html#modset" class="olink">module set</a><a id="modseti" class="indexterm"></a></em></strong>
is a directory containing:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a></span></dt><dd>some <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a> commands, which prepare the directory
for linking, and set some <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s, see <a class="xref" href="#mod-vars" title="Module set variables">the section called “Module set variables”</a>
</dd><dt><span class="term">all other files that define the module functionality</span></dt><dd>needed by <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a></dd></dl></div><p>In <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a> the <a href="impnotes.html#modset" class="olink">module set</a> directory is referred to
as <code class="varname">$modulename/</code>.</p><p>A module <strong class="first"><em class="firstterm">name<a id="module-name" class="indexterm"></a></em></strong>
must consist of the characters <code class="filename">A</code>-<code class="filename">Z</code>,
<code class="filename">a</code>-<code class="filename">z</code>, <code class="filename">_</code>,
<code class="filename">0</code>-<code class="filename">9</code>.</p><p>The module name <span class="quote">“<span class="quote">clisp</span>”</span> is reserved.</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="linkset"></a>Linking Set</h4></div></div></div><p>A <strong class="first"><em class="firstterm"><a href="impnotes.html#linkset" class="olink">linking set</a><a id="linkseti" class="indexterm"></a></em></strong>
is a collection of files (<a href="clisp.html#runtime" class="olink">runtime</a>, <a href="impnotes.html#image" class="olink">memory image</a> &c) which allows
performing two major tasks:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>: to run a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
contained in some <a href="impnotes.html#linkset" class="olink">linking set</a> <em class="replaceable"><code>directory</code></em>, call</p><pre class="screen">
<strong><code class="prompt">$</code></strong> <em class="replaceable"><code>directory</code></em>/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> <em class="replaceable"><code>directory</code></em>/lispinit.mem</pre><p>
or </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> <em class="replaceable"><code>directory</code></em></pre><p>
(recommended, since it also passes
<code class="option"><a href="clisp.html#opt-libdir" class="olink">-B</a></code>
to the <a href="clisp.html#runtime" class="olink">runtime</a>).</p></li><li class="listitem">Adding a <a href="impnotes.html#modset" class="olink">module set</a> to create a new <a href="impnotes.html#linkset" class="olink">linking set</a> which
will contain the module functionality.</li></ol></div><p>
The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> build directory contains three <a href="impnotes.html#linkset" class="olink">linking set</a>s in
directories <span class="command"><strong>boot</strong></span>, <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a>, and <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a>, and a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
installation normally contains two <a href="impnotes.html#linkset" class="olink">linking set</a>s: <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a>, and <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a></p><p>More formally, a <a href="impnotes.html#linkset" class="olink">linking set</a> is a directory containing at least
these files:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">lisp.run</code></span></dt><dd>the executable <a href="clisp.html#runtime" class="olink">runtime</a></dd><dt><span class="term"><a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a></span></dt><dd>the <a href="impnotes.html#image" class="olink">memory image</a></dd><dt><span class="term"><code class="filename">modules.h</code></span></dt><dd>the list of modules contained in this <a href="impnotes.html#linkset" class="olink">linking set</a>
</dd><dt><span class="term"><code class="filename">modules.o</code></span></dt><dd>the compiled list of modules contained in this <a href="impnotes.html#linkset" class="olink">linking set</a>
</dd><dt><a id="makevars"></a><span class="term"><code class="filename">makevars</code></span></dt><dd><p>some <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a> commands, setting the variables
</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term"><code class="envar">CC</code></span></p></td><td>the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler
</td></tr><tr><td><p><span class="term"><code class="envar">CPPFLAGS</code></span></p></td><td>flags for the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler, when preprocessing
or compiling</td></tr><tr><td><p><span class="term"><code class="envar">CFLAGS</code></span></p></td><td>flags for the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler, when compiling or
linking</td></tr><tr><td><p><span class="term"><code class="envar">CLFLAGS</code></span></p></td><td>flags for the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler, when linking
</td></tr><tr><td><p><span class="term"><code class="envar">LIBS</code></span></p></td><td>libraries to use when linking (either present in
the <a href="impnotes.html#linkset" class="olink">linking set</a> directory, or system-wide)
</td></tr><tr><td><p><span class="term"><code class="envar">X_LIBS</code></span></p></td><td>additional <a class="ulink" href="http://www.x.org/" target="_top">X Window System</a> libraries to use
</td></tr><tr><td><p><span class="term"><code class="envar">RANLIB</code></span></p></td><td>the ranlib command
</td></tr><tr><td><p><span class="term"><code class="envar">FILES</code></span></p></td><td>the list of files needed when linking
</td></tr></tbody></table></div></dd><dt><span class="term">all the <code class="envar">FILES</code></span></dt><dd>listed in <code class="filename">makevars</code>
</dd></dl></div></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="clisp-link"></a>Manipulating <a href="impnotes.html#modset" class="olink">module set</a>s and <a href="impnotes.html#linkset" class="olink">linking set</a>s</h4></div></div></div><p>Use <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> to create and install <a href="impnotes.html#modset" class="olink">module set</a>s
and add them to <a href="impnotes.html#linkset" class="olink">linking set</a>s.</p><p>See also <a class="xref" href="#mod-set-example" title="32.2.6. Example">Section 32.2.6, “Example”</a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="mod-vars"></a>Module set variables</h4></div></div></div><p>The following variables should be defined in <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">NEW_FILES</code></span></dt><dd>the space-separated list of object files that
belong to the <a href="impnotes.html#modset" class="olink">module set</a> and will belong to every new <a href="impnotes.html#linkset" class="olink">linking set</a> linked
with this <a href="impnotes.html#modset" class="olink">module set</a>.</dd><dt><span class="term"><code class="envar">NEW_LIBS</code></span></dt><dd>the space-separated list of object files, libraries or
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler switches that need to be passed to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
compiler when linking the <code class="filename">lisp.run</code> belonging to a new <a href="impnotes.html#linkset" class="olink">linking set</a>.
</dd><dt><span class="term"><code class="envar">NEW_MODULES</code></span></dt><dd>the space-separated list of the module names
belonging to the <a href="impnotes.html#modset" class="olink">module set</a>. Normally, every <code class="filename">#P".c"</code> file in the
<a href="impnotes.html#modset" class="olink">module set</a> defines a module of its own. The module name is usually
derived from the file name.</dd><dt><a id="mod-load"></a><span class="term"><a class="link" href="#mod-load"><code class="envar">TO_LOAD</code></a></span></dt><dd>the space-separated list of Lisp files to load
before building the <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a> belonging to a new <a href="impnotes.html#linkset" class="olink">linking set</a>.
</dd><dt><a id="mod-preload"></a><span class="term"><a class="link" href="#mod-preload"><code class="envar">TO_PRELOAD</code></a> (optional)</span></dt><dd><p class="simpara">the space-separated list of Lisp files to load
into an intermediate <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a> file, before building the <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a>
belonging to a new <a href="impnotes.html#linkset" class="olink">linking set</a>.
This variable is usually used to <a class="link" href="#make-pack" title="11.1.1. Function MAKE-PACKAGE">create</a>
(or <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2">unlock</a>) the Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>s which
must be present when the new <code class="filename">#P".c"</code> files are initialized.
E.g., the <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a> functions must reside in already defined packages;
see <a class="xref" href="#ex-call-in" title="Example 32.7. Calling Lisp from C">Example 32.7, “Calling Lisp from <span class="command"><strong>C</strong></span>”</a>. You can find a live example in
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/syscalls/preload.lisp"><code class="filename">modules/syscalls/preload.lisp</code></a>
and <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/syscalls/link.sh.in"><code class="filename">modules/syscalls/link.sh.in</code></a>.
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If you are unlocking a package, you must also
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_removecm__elete-if-not.html" target="_top"><code class="function">DELETE</code></a> it from <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a> (see <a class="xref" href="#image" title="31.2. Saving an Image">Section 31.2, “Saving an Image”</a>) here
and re-add it to <a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="varname">CUSTOM:*SYSTEM-PACKAGE-LIST*</code></a> in one of the <a class="link" href="#mod-load"><code class="envar">TO_LOAD</code></a> files.
See, e.g., <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/i18n/preload.lisp"><code class="filename">modules/i18n/preload.lisp</code></a>
and <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/i18n/link.sh.in"><code class="filename">modules/i18n/link.sh.in</code></a>.
</p></div></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="modinit"></a>32.2.2. Module initialization</h3></div></div></div><p>Each module has two initialization functions:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">void
<code class="function">module__<em class="replaceable"><code>name</code></em>__init_function_1</code>
(struct module_t* module)</span></dt><dd><p class="simpara">called only <span class="emphasis"><em>once</em></span> when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
discovers while loading a <a href="impnotes.html#image" class="olink">memory image</a> that there is a module present
in the executable (<code class="filename">lisp.run</code>) which was not present at the time the
image was saved. It can be used to create Lisp objects,
e.g. functions or keywords, and is indeed used for that purpose by
<a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>.</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to define this function yourself;
<a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> will do that for you.</p><p class="simpara">If you use <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, <code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> :init-once ...)</code>
will add code to this function.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>s must already exist and be unlocked,
cf. <a class="link" href="#mod-preload"><code class="envar">TO_PRELOAD</code></a>.</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If you are using <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> <span class="strong"><strong>and</strong></span> defining your
own <span class="quote">“<span class="quote">init-once</span>”</span> function, it must call the
<code class="function">module__<em class="replaceable"><code>name</code></em>__init_function_1__modprep</code>
function!</p></div></dd><dt><span class="term">void <code class="function">module__<em class="replaceable"><code>name</code></em>__init_function_2</code>
(struct module_t* module)</span></dt><dd><p class="simpara">called <span class="emphasis"><em>every time</em></span> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> starts.
It can be used to bind names to foreign addresses, since the address
will be different in each invocation of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, and is indeed used
for that purpose by <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> (e.g., by <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>).
It can also be used to set parameters of the libraries to which the
module interfaces, e.g., the <span class="module"><a class="filename" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="filename">pcre</code></a></span> module
sets <code class="varname">pcre_malloc</code> and <code class="varname">pcre_free</code>.
</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to define this function yourself;
<a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> will do that for you.</p><p class="simpara">If you use <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, <code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> :init-always ...)</code>
will add code to this function.</p></dd></dl></div><p>
<em class="replaceable"><code>name</code></em> is the <a class="link" href="#mod-overview" title="32.2.1. Overview">module name</a>.</p><p>See also <a class="xref" href="#custom-init-fini" title="31.1. Customizing CLISP Process Initialization and Termination">Section 31.1, “Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="modfini"></a>32.2.3. Module finalization</h3></div></div></div><p>Each module has a finalization function
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">void
<code class="function">module__<em class="replaceable"><code>name</code></em>__fini_function</code>
(struct module_t* module)</span></dt><dd><p class="simpara">called before exiting <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to define this function yourself;
<a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> will do that for you.</p><p class="simpara">If you use <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, <code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> :fini ...)</code> will
add code to this function.</p></dd></dl></div><p>
<em class="replaceable"><code>name</code></em> is the <a class="link" href="#mod-overview" title="32.2.1. Overview">module name</a>.</p><p>See also <a class="xref" href="#custom-init-fini" title="31.1. Customizing CLISP Process Initialization and Termination">Section 31.1, “Customizing <span class="command"><strong>CLISP</strong></span> Process Initialization and Termination”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="modinfo"></a>32.2.4. Function <a class="link" href="#modinfo" title="32.2.4. Function EXT:MODULE-INFO"><code class="function">EXT:MODULE-INFO</code></a></h3></div></div></div><p>Function <code class="code">(<a class="link" href="#modinfo" title="32.2.4. Function EXT:MODULE-INFO"><code class="function">EXT:MODULE-INFO</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>name</code></em>
<em class="replaceable"><code>verbose</code></em>)</code> allows one to inquire
about what modules are available in the currently running image.
When called without arguments, it returns the list of module names,
starting with <span class="quote">“<span class="quote">clisp</span>”</span>. When <em class="replaceable"><code>name</code></em> is supplied and
names a module, 3 values are returned - <em class="replaceable"><code>name</code></em>,
<em class="replaceable"><code>subr-count</code></em>,
<em class="replaceable"><code>object-count</code></em>.
When <em class="replaceable"><code>verbose</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the full list of
module lisp function names written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> (<span class="type">Subr</span>s) and
the full list of internal lisp objects available in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code
are additionally returned for the total of 5 values.</p><p>When <em class="replaceable"><code>name</code></em> is <code class="constant">:FFI</code>, returns the list of
shared libraries opened using <code class="constant">:LIBRARY</code>.
When <em class="replaceable"><code>verbose</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return the
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> of DLL names and all foreign objects associated with it.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mod-dynload"></a>32.2.5. Dynamic module loading</h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>without</strong></span> configure flag <code class="option"><a href="impnotes.html#mod-dynload" class="olink">--without-dynamic-modules</a></code>.</span></span></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Dynamic loading does not work on all operating systems
(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html"><code class="function">dlopen</code></a> or equivalent is required).</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>You will probably never need to call the function <a href="impnotes.html#mod-dynload" class="olink"><code class="function">SYS::DYNLOAD-MODULES</code></a>
explicitly (this is why it is in <a class="link" href="#sys-pac"><strong class="package"><span class="quote">“<span class="quote">SYSTEM</span>”</span></strong></a> and not in <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>).
You should install your module with
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> <code class="option"><a href="clisp-link.html#opt-install" class="olink">install</a></code> <em class="replaceable"><code>name</code></em></pre><p>
and load it with <code class="code">(<a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> <em class="replaceable"><code>name</code></em>).</code></p></div><p>Function <code class="code">(<a href="impnotes.html#mod-dynload" class="olink"><code class="function">SYS::DYNLOAD-MODULES</code></a> <em class="replaceable"><code>filename</code></em> ({<em class="replaceable"><code>name</code></em>}+))</code>
loads a shared object file or library containing a number of named
external <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> modules.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This facility <span class="strong"><strong>cannot</strong></span> be used to
access arbitrary shared libraries. To do that, use the <code class="constant">:LIBRARY</code>
argument to <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> and <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> instead.</p></div><p>
</p><p>External modules for <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> are shared objects
(dynamic libraries) that contain the
<code class="literal">module__<em class="replaceable"><code>name</code></em>__subr_tab</code> variable, among others.
This serves to register external functions which operate on Lisp-level
structures with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p><p>To use <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html"><code class="function">dlopen</code></a> with modules, you should add
<a class="ulink" href="http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html" target="_top"><code class="option">-fPIC</code></a> to the module's compilation options.
Something like
</p><pre class="screen"><strong><code class="prompt">$</code></strong> cc -shared -o <em class="replaceable"><code>name</code></em>.so <em class="replaceable"><code>name</code></em>.o</pre><p>
may be needed to produce the shared object file.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mod-set-example"></a>32.2.6. Example</h3></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.1. <a href="#mod-set-ex-bindings">Create a module set with GNU libc bindings</a></dt></dl></div><div class="example"><a id="mod-set-ex-bindings"></a><p class="title"><strong>Example 32.1. Create a <a href="impnotes.html#modset" class="olink">module set</a> with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a> bindings</strong></p><div class="example-contents"><p>To link in the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> bindings for the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a>/<a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> operating
system, the following steps are needed. (Step 1 and step 2 need not be
executed in this order.)</p><div class="procedure"><ol class="procedure" type="1"><li class="step"><p class="title"><strong>Create a new <a href="impnotes.html#modset" class="olink">module set</a></strong></p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> create linux /<em class="replaceable"><code>pathname</code></em>/bindings/linux.c</pre></li><li class="step"><p class="title"><strong>Modify the newly created
<code class="filename">linux/<a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a></code></strong></p><ol type="a" class="substeps"><li class="step"><p class="title"><strong>add <code class="option">-lm</code> to the libraries</strong></p><p>replace </p><pre class="screen">NEW_LIBS="$file_list"</pre><p>
with </p><pre class="screen">NEW_LIBS="$file_list -lm"</pre></li><li class="step"><p class="title"><strong>load <code class="filename">linux.fas</code> before saving the
<a href="impnotes.html#image" class="olink">memory image</a></strong></p><p>replace </p><pre class="screen">TO_LOAD=''</pre><p> with
</p><pre class="screen">TO_LOAD='/<em class="replaceable"><code>pathname</code></em>/bindings/linux.fas'</pre></li></ol></li><li class="step"><p class="title"><strong>Compile <code class="filename">linux.lisp</code>, creating
<code class="filename">linux.c</code></strong></p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> /<em class="replaceable"><code>pathname</code></em>/bindings/linux.lisp</pre></li><li class="step"><p class="title"><strong>Create a new <a href="impnotes.html#linkset" class="olink">linking set</a></strong></p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> add base base+linux linux</pre></li><li class="step"><p class="title"><strong>Run and try it</strong></p><pre class="screen"><strong><code class="prompt">$</code></strong> base+linux/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base+linux/lispinit.mem <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(linux:stat "/tmp")'</pre></li></ol></div></div></div><br class="example-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="module-tools"></a>32.2.7. Module tools</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#modprep">32.2.7.1. Modprep</a></span></dt><dt><span class="section"><a href="#clisp-h">32.2.7.2. clisp.h</a></span></dt><dt><span class="section"><a href="#exporting">32.2.7.3. Exporting</a></span></dt></dl></div><p>There are some tools to facilitate easy module writing.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="modprep"></a>32.2.7.1. Modprep</h4></div></div></div><p>If your module is written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, you can pre-process your
sources with <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> distribution and define lisp
functions with the <code class="function">DEFUN</code> macro:
</p><pre class="programlisting">
DEFUN(MY-PACKAGE:MY-FUNCTION-NAME, arg1 arg2 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> FOO BAR) {
if (!boundp(STACK_0)) STACK_0 = fixnum(0); /* BAR */
if (!boundp(STACK_1)) STACK_1 = fixnum(1); /* FOO */
pushSTACK(`MY-PACKAGE::SOME-SYMBOL`); /* create a symbol in the package */
pushSTACK(`#(:THIS :IS :A :VECTOR)`); /* some vector, created once */
pushSTACK(``MY-PACKAGE::MY-FUNCTION-NAME``); /* double `` means FUNCTION */
VALUES1(listof(7)); /* cons up a new list and clean up the STACK */
}</pre><p>
Then <code class="code">(MY-PACKAGE:MY-FUNCTION-NAME 'A 12 :FOO T)</code> will
return <span class="returnvalue">(A 12 T 0 MY-PACKAGE::SOME-SYMBOL #(:THIS
:IS :A :VECTOR) #<ADD-ON-SYSTEM-FUNCTION
MY-PACKAGE:MY-FUNCTION-NAME>)</span>
(assuming you <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_export.html" target="_top"><code class="function">EXPORT</code></a>ed <code class="literal">MY-FUNCTION-NAME</code> from
<strong class="package"><span class="quote">“<span class="quote">MY-PACKAGE</span>”</span></strong>).</p><p>Note that the arguments are passed on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> (last argument
being the top) which has to be cleaned up before exit.</p><p>Another useful macros are:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">DEFVAR</code></span></dt><dd>create a GC-visible private object
</dd><dt><span class="term"><code class="function">DEFFLAGSET</code></span></dt><dd>define a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function which will remove
several flag arguments from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> and return the combined flag
value</dd><dt><span class="term"><code class="function">DEFCHECKER</code></span></dt><dd>define a map from <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> constants to lisp symbols and
functions that map between them, checking that the argument is appropriate
</dd></dl></div><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/syscalls/calls.c"><code class="filename">modules/syscalls/calls.c</code></a>
and other included modules for more examples and file <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> for full
documentation.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If you manipulate Lisp objects, you need to watch out for
<a class="link" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">GC-safety</a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="clisp-h"></a>32.2.7.2. clisp.h</h4></div></div></div><p>If your module is written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, you will probably want
to <code class="literal">#include "clisp.h"</code> to access <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects.
You will certainly need to read <a href="impnotes.html#clisp-h" class="olink"><code class="filename">"clisp.h"</code></a> and some code in
<a class="link" href="#included-modules" title="32.2.9. Modules included in the source distribution">included modules</a>, but here are
some important hints that you will need to keep in mind:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Lisp objects have type <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>.</li><li class="listitem">Variables of this type are invalidated by
<a class="link" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">lisp memory allocation</a>
(<code class="function">allocate_*()</code> functions) - but <span class="strong"><strong>not</strong></span> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
allocations (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> et al) - and must be saved on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> using <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a>
macros <code class="function">pushSTACK()</code>, <code class="function">popSTACK()</code>
and <code class="function">skipSTACK()</code>.</li><li class="listitem">Access object slots using the
appropriate <code class="function">TheFoo()</code> macro, e.g.,
<code class="function">TheCons(my_cons)->Car</code>, but first check the
type with <code class="function">consp()</code>.</li><li class="listitem">Arguments are passed on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, as illustrated
in the <a class="link" href="#modprep" title="32.2.7.1. Modprep">above example</a>.</li><li class="listitem"><p class="simpara">Wrap your system calls in
<code class="literal">begin_system_call()</code>/<code class="literal">end_system_call()</code>
pairs. These macros, defined in <a href="impnotes.html#clisp-h" class="olink"><code class="filename">"clisp.h"</code></a>, save and restore
registers used by <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> which could be clobbered by a system call.
</p><p class="simpara">If the system call could block (e.g., <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a>)
you need to use <code class="literal">begin_blocking_system_call()</code> and
<code class="literal">end_blocking_system_call()</code> instead. This will
allow other threads to run while yours is inside the system call.
This means that <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion could happen while you are inside this system
call and, thus, that all objects of type <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a> are
invalidated by the call. See also <a class="xref" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">Section 35.5, “The burden of garbage-collection upon the rest of <span class="command"><strong>CLISP</strong></span>”</a> and
<a class="xref" href="#gc-mt" title="35.8. Garbage Collection and Multithreading">Section 35.8, “Garbage Collection and Multithreading”</a>.</p></li></ul></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="exporting"></a>32.2.7.3. Exporting</h4></div></div></div><p>If your module uses <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> to interface to a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library,
you might want to make your module package <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a> and use
<a class="link" href="#exporting-lisp"><code class="filename">exporting.lisp</code></a> in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> distribution to make <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a> at al export the symbols they define.
See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/netica/"><code class="filename">modules/netica/</code></a>,
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/matlab/"><code class="filename">modules/matlab/</code></a> and
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/bindings/"><code class="filename">modules/bindings/</code></a> for examples.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mod-ffi-vs-c"></a>32.2.8. Trade-offs: <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> vs. <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
modules</h3></div></div></div><p>When deciding how to write a module: whether to use <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> or
to stick with <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> and <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>, one has to take into account
several issues: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Speed: <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> wins</span></dt><dd><p><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> has a noticeable overhead:
compare <code class="function">RAWSOCK:HTONS</code> (defined
in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/rawsock/rawsock.c"><code class="filename">modules/rawsock/rawsock.c</code></a>)
with </p><pre class="programlisting">
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> htons (<code class="constant">:NAME</code> "htons") (<code class="constant">:LIBRARY</code> :default)
(<code class="constant">:ARGUMENTS</code> (s ffi:short)) (<code class="constant">:RETURN-TYPE</code> ffi:short) (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc))
</pre><p> and observe that <code class="function">RAWSOCK:HTONS</code> is
almost 3 times as fast (this really does compare the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>
overhead to the normal lisp function call because
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html"><code class="function">htons</code></a> is computationally trivial).
This difference will matter only if you call a simple function very
many times, in which case it would make sense to put the loop itself
into <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>.</p></dd><dt><span class="term">Portability: <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> wins</span></dt><dd><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> is <span class="strong"><strong>not</strong></span> as widely
ported as <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, so it is possible that you will face a platform
where <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> runs but <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> is not present.</li><li class="listitem">It is much easier to handle portability in
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>: observe the alternative implementations
of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html"><code class="function">htonl</code></a> et al in
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/rawsock/rawsock.c"><code class="filename">modules/rawsock/rawsock.c</code></a>.
</li><li class="listitem">Certain <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> structures have different
layout on different platforms, and functions may take 64-bit
arguments on some platforms and 32-bit arguments on others; so the
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> code has to track those differences, while <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> will
mostly take care of these things for you.</li></ol></div></dd><dt><span class="term">Code size: <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> wins</span></dt><dd>You need to type much fewer characters with <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>,
and, if you use the <code class="constant">:LIBRARY</code> argument to <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> and
<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>, you do not need to leave your <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> session to try
out your code. This is a huge advantage for rapid prototyping.
</dd><dt><span class="term">UI: <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> wins</span></dt><dd>To produce a nice lispy UI (using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>word arguments etc), you will need to write wrappers to your
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s, while in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> you can do that directly.
The same goes for <span class="quote">“<span class="quote">polymorphism</span>”</span>: accepting different
argument types (like, e.g., <a class="link" href="#resolve-host"><code class="function">POSIX:RESOLVE-HOST-IPADDR</code></a> does) would require a lisp
wrapper for <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s.
</dd><dt><span class="term">Learning curve: unclear</span></dt><dd><p class="simpara">If you are comfortable with <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, you might
find the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> module facilities (e.g., <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>) very
easy to use.</p><p class="simpara"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, on the other hand, is quite high-level,
so, if you are more comfortable with high-level languages, you might
find it easier to write <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms than <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code.
</p></dd><dt><span class="term">Safety: unclear</span></dt><dd>One can get a segfault either way: if your
<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> form does not describe the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function's
expectations with respect to the arguments and return values
(including <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>), you will probably learn that the hard way.
If the module is written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, all the opportunities to shoot
oneself in the foot (and other body parts) are wide open
(although well known to most <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> users).
However, with <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, one has to watch
for <a class="link" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">GC-safety</a> too.
</dd><dt><span class="term">System requirements: <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> wins</span></dt><dd><p>Some <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> distributions offer separate
<span class="emphasis"><em>library</em></span> (containing shared libraries only)
and <span class="emphasis"><em>development</em></span> (containing static libraries and
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> headers) packages.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">When <span class="emphasis"><em>developing</em></span> using <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>
with <code class="constant">:LIBRARY</code> (and avoiding <a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a>), the
<span class="emphasis"><em>development</em></span> package is <span class="strong"><strong>not</strong></span> needed.
</li><li class="listitem">When <span class="emphasis"><em>developing</em></span> with <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>,
the <span class="emphasis"><em>development</em></span> package <span class="strong"><strong>is</strong></span> necessary.
</li><li class="listitem">When <span class="emphasis"><em>distributing</em></span> module (built
with either <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> or <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a>), only the <span class="emphasis"><em>library</em></span>
package is needed.</li></ul></div></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="mod-ffi-vs-c-granularity"></a>Note</h3><p>The granularity of the
choice is <span class="emphasis"><em>per function</em></span>: the same module can use
both <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="mod-ffi-vs-c-naming"></a>Note</h3><p>It is not a good idea to have
both <code class="filename">foo.lisp</code> and <code class="filename">foo.c</code>
files in a module, because if you ever add an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> form to the
former, <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> will
<a class="link" href="#c-file-overwrite" title="Warning">overwrite</a> the latter.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="included-modules"></a>32.2.9. Modules included in the source distribution</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#base-modules">32.2.9.1. Base Modules</a></span></dt><dt><span class="section"><a href="#incmod-db">32.2.9.2. Database, Directory et al</a></span></dt><dt><span class="section"><a href="#incmod-kdml">32.2.9.3. Mathematics, Data Mining et al</a></span></dt><dt><span class="section"><a href="#incmod-match">32.2.9.4. Matching, File Processing et al</a></span></dt><dt><span class="section"><a href="#incmod-net">32.2.9.5. Communication, Networking</a></span></dt><dt><span class="section"><a href="#incmod-gui">32.2.9.6. Graphics</a></span></dt><dt><span class="section"><a href="#incmod-bind">32.2.9.7. Bindings</a></span></dt><dt><span class="section"><a href="#incmod-toys">32.2.9.8. Toys and Games</a></span></dt><dt><span class="section"><a href="#incmod-misc">32.2.9.9. Miscellaneous</a></span></dt></dl></div><p>A few modules come with the <span class="emphasis"><em>source</em></span>
distribution of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> (but are not necessarily built in a
particular <span class="emphasis"><em>binary</em></span> distribution).</p><p>To use modules, read <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/unix/INSTALL"><code class="filename">unix/INSTALL</code></a>
and build <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> in a directory <code class="filename">build-dir</code> with,
e.g.,</p><pre class="screen">
<strong><code class="prompt">$</code></strong> ./configure --with-module=pcre --with-module=clx/new-clx --cbc build-dir</pre><p> then run it with
</p><pre class="screen"><strong><code class="prompt">$</code></strong> ./build-dir/clisp <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> full</pre><p>
This will create a <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> with modules
<span class="module"><a class="filename" href="#i18n-mod" title="33.3. Internationalization of User Programs"><code class="filename">i18n</code></a></span>, <span class="module"><a class="filename" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><code class="filename">regexp</code></a></span> and <span class="module"><a class="filename" href="#syscalls" title="33.2. System Calls"><code class="filename">syscalls</code></a></span> (and maybe <span class="module"><a class="filename" href="#readline-mod" title="33.5. Advanced Readline and History Functionality"><code class="filename">readline</code></a></span>);
and a <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> with modules <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> and <span class="module"><a class="filename" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="filename">pcre</code></a></span> in addition
to the 3 (or 4) <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> modules.</p><p>Here we list the included modules by their general theme.
See <a class="xref" href="#ext-modules" title="Chapter 33. Extensions Implemented as Modules">Chapter 33, <em>Extensions Implemented as Modules</em></a> for individual module documentation.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="base-modules"></a>32.2.9.1. Base Modules</h4></div></div></div><p>The default build process includes the following modules
in <span class="strong"><strong>both</strong></span> <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <span class="strong"><strong>and</strong></span> <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a>s:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#i18n-mod" title="33.3. Internationalization of User Programs"><code class="filename">i18n</code></a></span></span></dt><dd>Internationalization of User Programs.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><code class="filename">regexp</code></a></span></span></dt><dd>The <a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> <a class="ulink" href="regexp.html" target="_top">Regular
Expressions</a> matching, compiling, executing.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#syscalls" title="33.2. System Calls"><code class="filename">syscalls</code></a></span></span></dt><dd>Use some system calls in a platform-independent way.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#readline-mod" title="33.5. Advanced Readline and History Functionality"><code class="filename">readline</code></a></span> (only when <span class="strong"><strong>both</strong></span> <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> and
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> are available)</span></dt><dd>Some advanced readline and history features are exported
using this module.</dd></dl></div><p>The composition of the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> depends on the platform
and on the vendor preferences.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-db"></a>32.2.9.2. Database, Directory et al</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#gdbm" title="33.6. GDBM - The GNU database manager"><code class="filename">gdbm</code></a></span></span></dt><dd>Interface to <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gdbm/" target="_top">DataBase Manager</a> by
<span class="author"><span class="firstname">Masayuki</span> <span class="surname">Onjo</span></span>.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#berkeley-db" title="33.7. Berkeley DB access"><code class="filename">berkeley-db</code></a></span></span></dt><dd><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/index.html">Berkeley DB</a>
interface.</dd><dt><span class="term"><span class="module"><a class="filename" href="#dir-key" title="33.8. Directory Access"><code class="filename">dirkey</code></a></span></span></dt><dd>Directory Access (LDAP, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> registry etc).
</dd><dt><span class="term"><span class="module"><a class="filename" href="#postgresql" title="33.9. PostgreSQL Database Access"><code class="filename">postgresql</code></a></span></span></dt><dd>Access <a class="ulink" href="http://www.PostgreSQL.org/" target="_top">PostgreSQL</a> from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#oracle" title="33.10. Oracle Interface"><code class="filename">oracle</code></a></span></span></dt><dd>Access <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> RDBMS from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>; by <span class="author"><span class="firstname">John</span> <span class="surname">Hinsdale</span></span>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-kdml"></a>32.2.9.3. Mathematics, Data Mining et al</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#libsvm" title="33.11. LibSVM Interface"><code class="filename">libsvm</code></a></span></span></dt><dd>Build
<a class="ulink" href="http://www.support-vector-machines.org/" target="_top">Support
Vector Machine</a> models using <a class="ulink" href="http://www.csie.ntu.edu.tw/~cjlin/libsvm/" target="_top">LibSVM</a> inside <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#pari" title="33.12. Computer Algebra System PARI"><code class="filename">pari</code></a></span></span></dt><dd>Interface to the computer algebra system <a class="ulink" href="http://pari.math.u-bordeaux.fr/" target="_top">PARI</a>.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#matlab" title="33.13. Matlab Interface"><code class="filename">matlab</code></a></span></span></dt><dd>Do matrix computations via
<a class="ulink" href="http://www.mathworks.com/products/matlab/" target="_top">MATLAB</a>.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#netica" title="33.14. Netica Interface"><code class="filename">netica</code></a></span></span></dt><dd>Work with Bayesian belief networks and influence
diagrams using <a class="ulink" href="http://norsys.com/netica_c_api.htm" target="_top">Netica C API</a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-match"></a>32.2.9.4. Matching, File Processing et al</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#pcre" title="33.15. Perl Compatible Regular Expressions"><code class="filename">pcre</code></a></span></span></dt><dd>The <a class="ulink" href="http://www.pcre.org/" target="_top">Perl Compatible Regular Expressions</a> matching, compiling, executing.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#zlib" title="33.16. Interface to zlib"><code class="filename">zlib</code></a></span></span></dt><dd>Compress <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s using <a class="ulink" href="http://zlib.net" target="_top">ZLIB</a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-net"></a>32.2.9.5. Communication, Networking</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#rawsock" title="33.17. Raw Socket Access"><code class="filename">rawsock</code></a></span></span></dt><dd>Raw socket access.</dd><dt><span class="term"><span class="module"><a class="filename" href="#dbus" title="33.19. Interface to D-Bus"><code class="filename">dbus</code></a></span></span></dt><dd>Interface to <a class="ulink" href="http://www.freedesktop.org/wiki/Software/dbus" target="_top">D-Bus</a>.
</dd><dt><span class="term"><span class="module"><a class="filename" href="#fastcgi" title="33.18. The FastCGI Interface"><code class="filename">fastcgi</code></a></span></span></dt><dd>Access <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>;
by <span class="author"><span class="firstname">John</span> <span class="surname">Hinsdale</span></span>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-gui"></a>32.2.9.6. Graphics</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.cliki.net/CLX" target="_top"><span class="command"><strong>CLX</strong></span></a></span></dt><dd><p>Call
<a class="ulink" href="http://www.x.org/docs/X11/xlib.pdf" target="_top">Xlib</a>
functions from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. Two implementations are supplied:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/mit-clx/"><code class="filename">clx/mit-clx</code></a></span>, from MIT
<a class="ulink" href="https://www.x.org/archive/unsupported/lib/CLX/" target="_top">https://www.x.org/archive/unsupported/lib/CLX/</a></span></dt><dd>the standard implementation
</dd><dt><span class="term"><span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span>, by <span class="author"><span class="firstname">Gilbert</span> <span class="surname">Baumann</span></span></span></dt><dd><p>faster, with additional features, but not quite complete yet.
Please try it first and use <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/mit-clx/"><code class="filename">clx/mit-clx</code></a></span> only
if <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> does not work for you.
<span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> comes with several demos, please try them using
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/demos/clx-demos.lisp"><code class="filename">modules/clx/new-clx/demos/clx-demos.lisp</code></a> <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(clx-demos:run-all-demos)'</pre><p>
and follow the intructions.</p></dd></dl></div><p>This functionality is documented in the manual
<a class="ulink" href="https://common-lisp.net/project/cmucl/doc/clx/" target="_top">https://common-lisp.net/project/cmucl/doc/clx/</a>, also
available in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> source distribution as
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/clx-manual.tar.gz"><code class="filename">modules/clx/clx-manual.tar.gz</code></a>.
</p></dd><dt><span class="term"><span class="module"><a class="filename" href="#gtk" title="33.20. GTK Interface"><code class="filename">gtk2</code></a></span></span></dt><dd>Use <a class="ulink" href="http://www.gtk.org" target="_top">GTK+</a> and <a class="ulink" href="http://glade.gnome.org/" target="_top">Glade</a> to create GUI by
<span class="author"><span class="firstname">James</span> <span class="surname">Bailey</span></span>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-bind"></a>32.2.9.7. Bindings</h4></div></div></div><p>Call the operating system functions from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
The following platforms are supported:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/bindings/glibc/"><code class="filename">bindings/glibc</code></a></span></span></dt><dd><a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a>/<a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/libc/" target="_top">libc</a></dd><dt><span class="term"><span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/bindings/win32/"><code class="filename">bindings/win32</code></a></span></span></dt><dd><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-toys"></a>32.2.9.8. Toys and Games</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/queens/"><code class="filename">queens</code></a></span></span></dt><dd>Compute the number of solutions to the <em class="replaceable"><code>n</code></em>-queens
problem on a <em class="replaceable"><code>n</code></em>×<em class="replaceable"><code>n</code></em> chessboard (a toy
example for the users to explore the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#modules" class="olink">module</a> system).
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/demos/sokoban.lisp"><code class="filename">modules/clx/new-clx/demos/sokoban.lisp</code></a></span></dt><dd>a demo which comes with <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="incmod-misc"></a>32.2.9.9. Miscellaneous</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="module"><a class="filename" href="#asdf" title="33.1. A System Definition Facility"><code class="filename">asdf</code></a></span></span></dt><dd>A system definition facility.
</dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dffi"></a>32.3. The Foreign Function Call Facility</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Many <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms
only.</span></span></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#dffi-intro">32.3.1. Introduction</a></span></dt><dt><span class="section"><a href="#dffi-overview">32.3.2. Overview</a></span></dt><dt><span class="section"><a href="#dffi-types">32.3.3. (Foreign) <span class="command"><strong>C</strong></span> types</a></span></dt><dt><span class="section"><a href="#c-flavor">32.3.4. The choice of the <span class="command"><strong>C</strong></span> flavor</a></span></dt><dt><span class="section"><a href="#dffi-variables">32.3.5. Foreign variables</a></span></dt><dt><span class="section"><a href="#dffi-places">32.3.6. Operations on foreign places</a></span></dt><dt><span class="section"><a href="#dffi-functions">32.3.7. Foreign functions</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-callback-mem">32.3.7.1. Callbacks and memory management</a></span></dt></dl></dd><dt><span class="section"><a href="#allocation">32.3.8. Argument and result passing conventions</a></span></dt><dt><span class="section"><a href="#param-mode">32.3.9. Parameter Mode</a></span></dt><dt><span class="section"><a href="#dffi-examples">32.3.10. Examples</a></span></dt><dd><dl><dt><span class="section"><a href="#dffi-ex-more">32.3.10.1. More examples</a></span></dt></dl></dd></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.2. <a href="#dffi-simple">Simple declarations and access</a></dt><dt>32.3. <a href="#dffi-extern-var">External <span class="command"><strong>C</strong></span> variable and some accesses</a></dt><dt>32.4. <a href="#dffi-extern-func1">Calling an external function</a></dt><dt>32.5. <a href="#dffi-extern-func2">Another example for calling an external function</a></dt><dt>32.6. <a href="#dffi-ex-macro">Accessing <span class="command"><strong>cpp</strong></span> macros</a></dt><dt>32.7. <a href="#ex-call-in">Calling Lisp from <span class="command"><strong>C</strong></span></a></dt><dt>32.8. <a href="#ex-call-in-dll">Calling Lisp from <span class="command"><strong>C</strong></span> dynamically</a></dt><dt>32.9. <a href="#dffi-gethostname">Variable size arguments: calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> from <span class="command"><strong>CLISP</strong></span></a></dt><dt>32.10. <a href="#dffi-dll-var">Accessing variables in shared libraries</a></dt><dt>32.11. <a href="#ex-dffi-validity">Controlling validity of resources</a></dt><dt>32.12. <a href="#ex-dffi-float">Floating point arrays</a></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-intro"></a>32.3.1. Introduction</h3></div></div></div><p>This facility, also known as <span class="quote">“<span class="quote">Foreign Language Interface</span>”</span>,
allows one to call a function implemented in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> from inside <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
and to do many related things, like inspect and modify foreign memory,
define a <span class="quote">“<span class="quote">callback</span>”</span> (i.e., make a lisp function available
to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> world), etc.
To use this facility, one writes a <strong class="first"><em class="firstterm">foreign function
<a id="dffi-ff" class="indexterm"></a></em></strong> description into an
ordinary Lisp file, which is then compiled and loaded as usual;
or just evaluates the appropriate form in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>.</p><p>There are two basic ways to do define a foreign function:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p class="simpara">Use <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html"><code class="function">dlopen</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html"><code class="function">dlsym</code></a> to get to the location of the
function code in a dynamic library.
To access this facility, pass the <code class="constant">:LIBRARY</code> option to <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>
and <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>.</p><p class="simpara">Unfortunately, this functionality is not available on some
operating systems, and, also, it offers only a part of the foreign
functionality: <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> macros and <code class="literal">inline</code> functions
cannot be accessed this way. On the other hand, this functionality
is available in the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> and does not require a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler.
</p></li><li class="listitem">Use a somewhat less direct way: when you do not use
the <code class="constant">:LIBRARY</code> argument, <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> produces a <code class="filename">#P".c"</code> file
(in addition to a <code class="filename">#P".fas"</code> and a <a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a>).
Then you compile (with a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler) and link it into <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
(statically, linking it into <code class="filename">lisp.a</code>, or
dynamically, loading it into a running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html"><code class="function">dlopen</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html"><code class="function">dlsym</code></a>).
This way you can use any functionality your foreign library exports,
whether using ordinary functions, <code class="literal">inline</code> functions,
or <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> macros (see <a class="xref" href="#dffi-ex-macro" title="Example 32.6. Accessing cpp macros">Example 32.6, “Accessing <span class="command"><strong>cpp</strong></span> macros”</a>).
</li></ol></div><p>
</p><p>All symbols relating to the foreign function interface are
exported from the package <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.
To use them, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>)</code>.</p><p>Special <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms may appear anywhere in the Lisp file.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-overview"></a>32.3.2. Overview</h3></div></div></div><p>These are the special <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms. We have taken a pragmatic
approach: the only foreign languages we support for now are <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
and <a class="ulink" href="http://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Unless specifically noted otherwise, type specification
parameters are <span class="strong"><strong>not</strong></span> evaluated, so that they can be compiled by
<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> into the internal format at macroexpansion time.
</p></div><div class="variablelist"><p class="title"><strong>High-level <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms; <em class="replaceable"><code>name</code></em> is any Lisp
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>; <em class="replaceable"><code>c-name</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></strong></p><dl class="variablelist"><dt><a id="def-c-type"></a><span class="term"><code class="code">(<a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a> <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd><p class="simpara">This form makes <em class="replaceable"><code>name</code></em> a shortcut for <em class="replaceable"><code>c-type</code></em>.
Note that <em class="replaceable"><code>c-type</code></em> may already refer to <em class="replaceable"><code>name</code></em>.
Forward declarations of types are not possible, however.</p><p class="simpara">When <em class="replaceable"><code>c-type</code></em> is omitted, the type is assumed to be an
integer, and its size and signedness are determined at link time,
e.g., <code class="code">(<a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a> size_t)</code>.</p></dd><dt><a id="def-c-var"></a><span class="term"><code class="code">(<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> <em class="replaceable"><code>name</code></em>
{<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p class="simpara">This form defines a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>.
<em class="replaceable"><code>name</code></em> is the Lisp name, a regular Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>.</p><div class="variablelist"><a id="def-c-var-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="constant">:NAME</code> <em class="replaceable"><code>c-name</code></em>)</code></span></dt><dd>specifies the name as seen from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, as a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>. If not specified, it is derived from the print name of
the Lisp name.</dd><dt><span class="term"><code class="code">(<code class="constant">:TYPE</code> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd>specifies the variable's foreign type.
</dd><dt><span class="term"><code class="code">(<code class="constant">:READ-ONLY</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>)</code></span></dt><dd>If this option is specified and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
it will be impossible to change the variable's value from within
Lisp (using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> or similar).</dd><dt><span class="term"><code class="code">(:ALLOC <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>)</code></span></dt><dd>This option can be either <code class="constant">:NONE</code> or
<code class="constant">:MALLOC-FREE</code> and defaults to <code class="constant">:NONE</code>.
If it is <code class="constant">:MALLOC-FREE</code>, any values of type <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a>, <a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a>,
<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a>, <a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> within the foreign value are assumed
to be pointers to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>-allocated storage, and when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a>
replaces an old value by a new one, the old storage is freed using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> and the new storage allocated using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>.
If it is <code class="constant">:NONE</code>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> assumes that the pointers point to good
storage (not <code class="constant">NULL</code>!) and overwrites the old values by the new ones.
This is dangerous (just think of overwriting a string with a longer
one or storing some data in a <code class="constant">NULL</code> pointer...) and deprecated.
</dd><dt><span class="term"><code class="code">(<code class="constant">:LIBRARY</code> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>Specifies the (optional) dynamic library
which contains the variable, the default is set by
<a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a>.</dd><dt><span class="term"><code class="code">(<code class="constant">:VERSION</code> <em class="replaceable"><code>version</code></em>)</code></span></dt><dd>Specifies the (optional) symbol version in the library
(therefore, if <code class="constant">:VERSION</code> is supplied, <code class="constant">:LIBRARY</code> must also be supplied)
</dd><dt><span class="term"><code class="code">(<code class="constant">:DOCUMENTATION</code> <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Specifies the (optional) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">VARIABLE</code></a> documentation.
</dd></dl></div></dd><dt><a id="def-c-const"></a><span class="term"><code class="code">(<a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a> <em class="replaceable"><code>name</code></em>
{<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p>This form defines a Lisp <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-3.html">constant variable</a> <em class="replaceable"><code>name</code></em> whose value is
determined at build time using an internal <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>.</p><div class="variablelist"><a id="def-c-const-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="constant">:NAME</code> <em class="replaceable"><code>c-name</code></em>)</code></span></dt><dd>specifies the name as seen from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, as a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>. If not specified, it is derived from the print name
of the Lisp name.</dd><dt><span class="term"><code class="code">(<code class="constant">:TYPE</code> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd><p>specifies the constant's foreign type, one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><span class="type">FFI:INT</span></td></tr><tr><td><a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a></td></tr><tr><td><a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a></td></tr></table></dd><dt><span class="term"><code class="code">(<code class="constant">:GUARD</code>
<em class="replaceable"><code>string</code></em>)</code></span></dt><dd><p>specifies the <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> check to wrap around <em class="replaceable"><code>c-name</code></em>,
defaults to <span class="data"><code class="literal">"defined(<em class="replaceable"><code>c-name</code></em>)"</code></span>;
can be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> to omit the test. When the test fails, <em class="replaceable"><code>name</code></em> is
unbound.</p></dd><dt><span class="term"><code class="code">(<code class="constant">:DOCUMENTATION</code> <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Specifies the (optional) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">VARIABLE</code></a> documentation.
</dd></dl></div><p class="simpara">See also <a class="xref" href="#dffi-ex-macro" title="Example 32.6. Accessing cpp macros">Example 32.6, “Accessing <span class="command"><strong>cpp</strong></span> macros”</a>.</p></dd><dt><a id="def-call-out"></a><span class="term"><code class="code">(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>
<em class="replaceable"><code>name</code></em> {<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p class="simpara">This form defines a named call-out function (a
foreign function called from Lisp: control flow temporarily leaves Lisp).
</p><div class="variablelist"><a id="def-call-out-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="constant">:NAME</code> <em class="replaceable"><code>c-name</code></em>)</code></span></dt><dd>Any Lisp function call to <code class="function">#'<em class="replaceable"><code>name</code></em></code>
is redirected to call the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function <em class="replaceable"><code>c-name</code></em>.
</dd><dt><span class="term"><code class="code">(<code class="constant">:ARGUMENTS</code>
{(<em class="replaceable"><code>argument</code></em> <em class="replaceable"><code>c-type</code></em> [<a class="link" href="#param-mode" title="32.3.9. Parameter Mode"><em class="replaceable"><code>PARAM-MODE</code></em></a> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>]])}*)</code><br /></span><span class="term"><code class="code">(<code class="constant">:RETURN-TYPE</code> <em class="replaceable"><code>c-type</code></em> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>])</code></span></dt><dd>Argument list and return value, see
<a class="xref" href="#allocation" title="32.3.8. Argument and result passing conventions">Section 32.3.8, “Argument and result passing conventions”</a> and <a class="xref" href="#param-mode" title="32.3.9. Parameter Mode">Section 32.3.9, “Parameter Mode”</a>.
</dd><dt><span class="term"><code class="code">(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> <em class="replaceable"><code>language</code></em>)</code></span></dt><dd>See <a class="xref" href="#c-flavor" title="32.3.4. The choice of the C flavor">Section 32.3.4, “The choice of the <span class="command"><strong>C</strong></span> flavor”</a>.
</dd><dt><span class="term"><code class="code">(:BUILT-IN <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>)</code></span></dt><dd>When the function is a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> built-in, the full
prototype will be output (unless suppressed by <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a>).
</dd><dt><span class="term"><code class="code">(<code class="constant">:LIBRARY</code> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>Specifies the (optional) dynamic library
which contains the function, the default is set by
<a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a>.</dd><dt><span class="term"><code class="code">(<code class="constant">:VERSION</code> <em class="replaceable"><code>version</code></em>)</code></span></dt><dd>Specifies the (optional) symbol version in the library
(therefore, if <code class="constant">:VERSION</code> is supplied, <code class="constant">:LIBRARY</code> must also be supplied).
</dd><dt><span class="term"><code class="code">(<code class="constant">:DOCUMENTATION</code> <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Specifies the (optional) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">FUNCTION</code></a> documentation.
</dd></dl></div><p class="simpara">See also <a class="xref" href="#dffi-functions" title="32.3.7. Foreign functions">Section 32.3.7, “Foreign functions”</a>.</p></dd><dt><a id="def-call-in"></a><span class="term"><code class="code">(<a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a>
<em class="replaceable"><code>function</code></em> {<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p class="simpara">This form defines a
<strong class="first"><em class="firstterm">callback<a id="def-call-in-callback" class="indexterm"></a></em></strong> -
a named call-in function (i.e., a Lisp function called from the
foreign language: control flow temporary enters Lisp)</p><div class="variablelist"><a id="def-call-in-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a></strong></p><dl class="variablelist"><dt><span class="term"><code class="code">(<code class="constant">:NAME</code> <em class="replaceable"><code>c-name</code></em>)</code></span></dt><dd>Any <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function call to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function
<em class="replaceable"><code>c-name</code></em> is redirected to call the <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> function <em class="replaceable"><code>function</code></em>, which
should be a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a>.</dd><dt><span class="term"><code class="code">(<code class="constant">:ARGUMENTS</code>
{(<em class="replaceable"><code>argument</code></em> <em class="replaceable"><code>c-type</code></em> [<a class="link" href="#param-mode" title="32.3.9. Parameter Mode"><em class="replaceable"><code>PARAM-MODE</code></em></a> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>]])}*)</code><br /></span><span class="term"><code class="code">(<code class="constant">:RETURN-TYPE</code> <em class="replaceable"><code>c-type</code></em> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>])</code></span></dt><dd>Argument list and return value, see
<a class="xref" href="#allocation" title="32.3.8. Argument and result passing conventions">Section 32.3.8, “Argument and result passing conventions”</a> and <a class="xref" href="#param-mode" title="32.3.9. Parameter Mode">Section 32.3.9, “Parameter Mode”</a>.
</dd><dt><span class="term"><code class="code">(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> <em class="replaceable"><code>language</code></em>)</code></span></dt><dd>See <a class="xref" href="#c-flavor" title="32.3.4. The choice of the C flavor">Section 32.3.4, “The choice of the <span class="command"><strong>C</strong></span> flavor”</a>.
</dd></dl></div><p class="simpara">See also <a class="xref" href="#dffi-functions" title="32.3.7. Foreign functions">Section 32.3.7, “Foreign functions”</a>.</p></dd><dt><a id="dffi-open-lib"></a><span class="term"><code class="code">(<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a>
<em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :REQUIRE)</code></span></dt><dd><p class="simpara">Open (load) a shared foreign library.</p><p class="simpara">Some shared libraries depend on other shared libraries
and this dependency can be specified using
the <code class="constant">:REQUIRE</code> argument.</p><p class="simpara">Unless the library has dependencies, this is only needed if
you want to test for <span class="emphasis"><em>presence</em></span> of a library
without creating a foreign object referencing its contents.
When you create a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>
using <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> or <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> with a <code class="constant">:LIBRARY</code> argument,
the library <em class="replaceable"><code>name</code></em> is opened automatically.</p><p>E.g., <code class="filename">libgsl.so</code>
requires <code class="filename">libgslcblas.so</code>:</p><pre class="programlisting">
(<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a> "libgsl.so")
*** - FFI:OPEN-FOREIGN-LIBRARY: Cannot open library "libgsl.so": "/usr/lib64/libgsl.so: undefined symbol: cblas_ctrmv"
</pre><p> so a common way is to pre-open the dependency:
</p><pre class="programlisting">
(<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a> "libgslcblas.so")
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gsl_cheb_alloc (<code class="constant">:LIBRARY</code> "libgsl.so") (:language :stdc)
(:arguments (n ffi:int)) (:return-type ffi:c-pointer))
⇒ <code class="computeroutput">GSL_CHEB_ALLOC</code>
</pre><p> Alas, this would work <span class="emphasis"><em>in the current
image</em></span> only: if you save the
image, <code class="function">GSL_CHEB_ALLOC</code> will <span class="strong"><strong>not</strong></span> work there
because <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will try to re-open <code class="filename">libgsl.so</code> and
fail as above. However, using the <code class="constant">:REQUIRE</code> argument
will tell <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to re-open <span class="strong"><strong>both</strong></span> libraries in the right order:</p><pre class="screen">
<strong><code class="prompt">$</code></strong> clisp
> (<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a> "libgsl.so" :require '("libgslcblas.so"))
> (<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gsl_cheb_alloc (:library "libgsl.so") (:language :stdc)
(:arguments (n ffi:int)) (:return-type ffi:c-pointer))
> (<a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a> "foo" :executable t)
> (<a class="link" href="#quit" title="31.3. Quitting CLISP"><code class="function">EXT:EXIT</code></a>)
<strong><code class="prompt">$</code></strong> ./foo
> (gsl_cheb_alloc 10)
<code class="computeroutput">#<<a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> #x0000000017AC38A0></code>
</pre></dd><dt><a id="dffi-close-lib"></a><span class="term"><code class="code">(<a class="link" href="#dffi-close-lib"><code class="function">FFI:CLOSE-FOREIGN-LIBRARY</code></a>
<em class="replaceable"><code>name</code></em>)</code></span></dt><dd><p class="simpara">Close (unload) a shared foreign library (opened by
<a class="link" href="#dffi-open-lib"><code class="function">FFI:OPEN-FOREIGN-LIBRARY</code></a> or the <code class="constant">:LIBRARY</code> argument to <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>
or <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>).</p><p class="simpara">If you want to modify your shared library, you need to close
it using <a class="link" href="#dffi-close-lib"><code class="function">FFI:CLOSE-FOREIGN-LIBRARY</code></a> first. When you use a
<a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> which resides in the
library <em class="replaceable"><code>name</code></em>, it will be re-opened automatically.
</p></dd><dt><a id="dffi-default-lib"></a><span class="term"><code class="code">(<a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a>
<em class="replaceable"><code>library-name</code></em>)</code></span></dt><dd><p class="simpara">This macro sets the default <code class="constant">:LIBRARY</code> argument for
<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> and <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>. <em class="replaceable"><code>library-name</code></em> should be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
(meaning use the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> file produced by <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a>), a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, or, depending on the underlying <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlsym.html"><code class="function">dlsym</code></a>
or <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=dlvsym"><code class="function">dlvsym</code></a> implementation,
<code class="constant">:DEFAULT</code> or <code class="constant">:NEXT</code>.</p><p class="simpara">The default is set separately in each <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compilation_unit">compilation unit</a>, so, if you
are interfacing to a single library, you can set this variable in the
beginning of your lisp file and omit the <code class="constant">:LIBRARY</code> argument
throughout the file.</p></dd><dt><a id="def-c-struct"></a><span class="term"><code class="code">(<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a>
<em class="replaceable"><code>name</code></em> (<em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>c-type</code></em>)*)</code></span></dt><dd><p>This form defines <em class="replaceable"><code>name</code></em> to be both a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_structure-class.html" target="_top"><code class="classname">STRUCTURE-CLASS</code></a> and a foreign <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type with the given slots.
If this class representation overhead is not needed one should consider
writing <code class="code">(<a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a> <em class="replaceable"><code>name</code></em> (<a class="link" href="#c-struct"><span class="type">FFI:C-STRUCT</span></a>
{<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> | <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>} (<em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>c-type</code></em>)*))</code> instead.
<em class="replaceable"><code>name</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> (structure name) or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> whose <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_firstcm_s_inthcm_tenth.html" target="_top"><code class="function">FIRST</code></a>
element is the structure name and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_rest.html" target="_top"><code class="function">REST</code></a> is options.
Two options are supported at this time:
</p><div class="variablelist"><a id="def-c-struct-opts"></a><p class="title"><strong>Options for <a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a></strong></p><dl class="variablelist"><dt><a id="def-c-struct-typedef"></a><span class="term"><code class="constant">:TYPEDEF</code></span></dt><dd>means that the name of this structure is a
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type defined with <code class="function">typedef</code>
elsewhere.</dd><dt><a id="def-c-struct-external"></a><span class="term"><code class="constant">:EXTERNAL</code></span></dt><dd>means that this structure is defined in a
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> header file that you include with, e.g.,
<code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> "#include <filename.h>~%")</code>.
</dd></dl></div><p>
These options determine how the struct is written to the <code class="filename">#P".c"</code>.
</p></dd><dt><a id="def-c-enum"></a><span class="term"><code class="code">(<a class="link" href="#def-c-enum"><code class="function">FFI:DEF-C-ENUM</code></a>
<em class="replaceable"><code>name</code></em> {<em class="replaceable"><code>symbol</code></em> | (<em class="replaceable"><code>symbol</code></em> [<em class="replaceable"><code>value</code></em>])}*)</code></span></dt><dd><p class="simpara">This form defines <em class="replaceable"><code>symbol</code></em>s
as constants, similarly to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> declaration <span class="type">enum {
<em class="replaceable"><code>symbol</code></em> [= <em class="replaceable"><code>value</code></em>], ... };</span></p><p class="simpara">You can use <code class="code">(<code class="function">FFI:ENUM-FROM-VALUE</code>
<em class="replaceable"><code>name</code></em> <em class="replaceable"><code>value</code></em>)</code> and
<code class="code">(<code class="function">FFI:ENUM-TO-VALUE</code> <em class="replaceable"><code>name</code></em>
<em class="replaceable"><code>symbol</code></em>)</code> to convert between the numeric and symbolic
representations (of course, the latter function boils down to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-value.html" target="_top"><code class="function">SYMBOL-VALUE</code></a> plus a check that the <em class="replaceable"><code>symbol</code></em> is indeed a constant
defined in the <a class="link" href="#def-c-enum"><code class="function">FFI:DEF-C-ENUM</code></a> <em class="replaceable"><code>name</code></em>).</p></dd><dt><a id="c-lines"></a><span class="term"><code class="code">(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> <em class="replaceable"><code>format-string</code></em>
{<em class="replaceable"><code>argument</code></em>}*)</code></span></dt><dd><p class="simpara">This form outputs the string
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>format-string</code></em> {<em class="replaceable"><code>argument</code></em>}*)</code>
to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> output file's top level.
This is usually used to include the relevant header files,
see <a class="xref" href="#def-c-struct-external"><code class="constant">:EXTERNAL</code></a>
and <a class="xref" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a>.</p><p>When <em class="replaceable"><code>format-string</code></em> is not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, is should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>,
and then the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> {<em class="replaceable"><code>argument</code></em>}*)</code>
is added to the appropriate <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:INIT-ALWAYS</code><br /></span><span class="term"><code class="constant">:INIT-ONCE</code></span></dt><dd><a class="link" href="#modinit" title="32.2.2. Module initialization">initialization
function</a></dd><dt><span class="term"><code class="constant">:FINI</code></span></dt><dd><a class="link" href="#modfini" title="32.2.3. Module finalization">finalization
function</a></dd></dl></div></dd><dt><a id="element"></a><span class="term"><code class="code">(<a class="link" href="#element"><code class="function">FFI:ELEMENT</code></a> <em class="replaceable"><code>c-place</code></em> <em class="replaceable"><code>index<sub>1</sub></code></em>
... <em class="replaceable"><code>index<sub>n</sub></code></em>)</code></span></dt><dd>Array element: If <em class="replaceable"><code>c-place</code></em> is of foreign type
<span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <em class="replaceable"><code>c-type</code></em> (<em class="replaceable"><code>dim<sub>1</sub></code></em> ... <em class="replaceable"><code>dim<sub>n</sub></code></em>))</code></span>
and 0 ≤ <em class="replaceable"><code>index<sub>1</sub></code></em> < <em class="replaceable"><code>dim<sub>1</sub></code></em>, ..., 0 ≤ <em class="replaceable"><code>index<sub>n</sub></code></em> < <em class="replaceable"><code>dim<sub>n</sub></code></em>,
this will be the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> corresponding to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_aref.html" target="_top"><code class="function">AREF</code></a> <em class="replaceable"><code>c-place</code></em>
<em class="replaceable"><code>index<sub>1</sub></code></em> ... <em class="replaceable"><code>index<sub>n</sub></code></em>)</code> or
<code class="varname"><em class="replaceable"><code>c-place</code></em>[<em class="replaceable"><code>index<sub>1</sub></code></em>]...[<em class="replaceable"><code>index<sub>n</sub></code></em>]</code>.
It is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> of type <em class="replaceable"><code>c-type</code></em>.
If <em class="replaceable"><code>c-place</code></em> is of foreign type <span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a>
<em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>dim</code></em>)</code></span> and 0 ≤ <em class="replaceable"><code>index</code></em> < <em class="replaceable"><code>dim</code></em>,
this will be the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> corresponding to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_aref.html" target="_top"><code class="function">AREF</code></a> <em class="replaceable"><code>c-place</code></em>
<em class="replaceable"><code>index</code></em>)</code> or <code class="varname"><em class="replaceable"><code>c-place</code></em>[<em class="replaceable"><code>index</code></em>]</code>.
It is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> of type <em class="replaceable"><code>c-type</code></em>.
</dd><dt><a id="deref"></a><span class="term"><code class="code">(<a class="link" href="#deref"><code class="function">FFI:DEREF</code></a> <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd>Dereference pointer: If
<em class="replaceable"><code>c-place</code></em> is of foreign type
<span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span>,
<span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span> or
<span class="type"><code class="literal">(<a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span>,
this will be the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> the pointer points to.
It is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> of type <em class="replaceable"><code>c-type</code></em>.
For <span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span>,
the <em class="replaceable"><code>c-place</code></em> may not be <code class="constant">NULL</code>.
</dd><dt><a id="slot"></a><span class="term"><code class="code">(<a class="link" href="#slot"><code class="function">FFI:SLOT</code></a> <em class="replaceable"><code>c-place</code></em>
<em class="replaceable"><code>slot-name</code></em>)</code></span></dt><dd>Struct or union component: If <em class="replaceable"><code>c-place</code></em> is of
foreign type <span class="type"><code class="literal">(<a class="link" href="#c-struct"><span class="type">FFI:C-STRUCT</span></a> <em class="replaceable"><code>class</code></em> ...
(<em class="replaceable"><code>slot-name</code></em> <em class="replaceable"><code>c-type</code></em>) ...)</code></span> or of
type <span class="type"><code class="literal">(<a class="link" href="#c-union"><span class="type">FFI:C-UNION</span></a>
... (<em class="replaceable"><code>slot-name</code></em> <em class="replaceable"><code>c-type</code></em>) ...)</code></span>,
this will be of type <em class="replaceable"><code>c-type</code></em>.</dd><dt><a id="cast"></a><span class="term"><code class="code">(<a class="link" href="#cast"><code class="function">FFI:CAST</code></a>
<em class="replaceable"><code>c-place</code></em> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd>Type change: A <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> denoting the same memory
locations as the original <em class="replaceable"><code>c-place</code></em>, but of type <em class="replaceable"><code>c-type</code></em>.
</dd><dt><a id="offset"></a><span class="term"><code class="code">(<a class="link" href="#offset"><code class="function">FFI:OFFSET</code></a>
<em class="replaceable"><code>c-place</code></em> <em class="replaceable"><code>offset</code></em> <em class="replaceable"><code>c-type</code></em>)</code></span></dt><dd>Type change and displacement: return a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> denoting
a memory locations displaced from the original <em class="replaceable"><code>c-place</code></em> by an
<em class="replaceable"><code>offset</code></em> counted in bytes, with type <em class="replaceable"><code>c-type</code></em>.
This can be used to resize an array, e.g. of <em class="replaceable"><code>c-type</code></em>
<span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <span class="type">uint16</span> <em class="replaceable"><code>n</code></em>)</code></span>
via <code class="code">(<a class="link" href="#offset"><code class="function">FFI:OFFSET</code></a> <em class="replaceable"><code>c-place</code></em> 0 '(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <span class="type">uint16</span>
<em class="replaceable"><code>k</code></em>))</code>.
</dd><dt><a id="c-var-addr"></a><span class="term"><code class="code">(<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a>
<em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd>Return the address of <em class="replaceable"><code>c-place</code></em> as a Lisp object of
type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>. This is useful as an argument
to foreign functions expecting a parameter of <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>.
</dd><dt><a id="c-var-object"></a><span class="term"><code class="code">(<a class="link" href="#c-var-object"><code class="function">FFI:C-VAR-OBJECT</code></a>
<em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd>Return the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> object underlying the
<em class="replaceable"><code>c-place</code></em>. This is also an acceptable argument type to a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>
declaration.</dd><dt><a id="typeof"></a><span class="term"><code class="code">(<a class="link" href="#typeof"><code class="function">FFI:TYPEOF</code></a> <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd>returns the <em class="replaceable"><code>c-type</code></em> corresponding to the <em class="replaceable"><code>c-place</code></em>.
</dd><dt><a id="sizeof"></a><span class="term"><code class="code">(<a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a> <em class="replaceable"><code>c-type</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a> <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd><p class="simpara">The first form returns the size and alignment of the
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <em class="replaceable"><code>c-type</code></em>, measured in bytes.</p><p class="simpara">The second form returns the size and alignment of the
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type of <em class="replaceable"><code>c-place</code></em>, measured in bytes.
</p></dd><dt><a id="bitsizeof"></a><span class="term"><code class="code">(<a class="link" href="#bitsizeof"><code class="function">FFI:BITSIZEOF</code></a> <em class="replaceable"><code>c-type</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#bitsizeof"><code class="function">FFI:BITSIZEOF</code></a> <em class="replaceable"><code>c-place</code></em>)</code></span></dt><dd><p class="simpara">The first form returns the size and alignment of the
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <em class="replaceable"><code>c-type</code></em>, measured in bits.</p><p class="simpara">The second form returns the size and alignment of the
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type of <em class="replaceable"><code>c-place</code></em>, measured in bits.
</p></dd><dt><a id="faddr-u"></a><span class="term"><code class="code">(<a class="link" href="#faddr-u"><code class="function">FFI:FOREIGN-ADDRESS-UNSIGNED</code></a> <em class="replaceable"><code>foreign-entity</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#faddr-u"><code class="function">FFI:UNSIGNED-FOREIGN-ADDRESS</code></a> <em class="replaceable"><code>number</code></em>)</code></span></dt><dd><p class="simpara"><a class="link" href="#faddr-u"><code class="function">FFI:FOREIGN-ADDRESS-UNSIGNED</code></a> returns the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
address embodied in the Lisp object of type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>,
<a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>, <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>.</p><p class="simpara"><a class="link" href="#faddr-u"><code class="function">FFI:UNSIGNED-FOREIGN-ADDRESS</code></a> returns a <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>
object pointing to the given <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> address.
</p></dd><dt><a id="faddr"></a><span class="term"><code class="code">(<a class="link" href="#faddr"><code class="function">FFI:FOREIGN-ADDRESS</code></a> <em class="replaceable"><code>foreign-entity</code></em>)</code></span></dt><dd><p class="simpara"><a class="link" href="#faddr"><code class="function">FFI:FOREIGN-ADDRESS</code></a> is both a type name and a
selector/constructor function. It is the Lisp object type
corresponding to a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> external type declaration, e.g. a
call-out function with <code class="code">(<code class="constant">:RETURN-TYPE</code> <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>)</code> yields
a Lisp object of type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>.</p><p class="simpara">The function extracts the object of type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>
living within any <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object.
If the <em class="replaceable"><code>foreign-entity</code></em> already is a <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>, it returns it.
If it is a <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a> (e.g. a base foreign library address),
it encapsulates it into a <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> object, as suitable
for use with a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> external type declaration.
It does not construct addresses out of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>s,
<a class="link" href="#faddr-u"><code class="function">FFI:UNSIGNED-FOREIGN-ADDRESS</code></a> must be used for that purpose.
</p></dd><dt><a id="dffi-make-var"></a><span class="term"><code class="code">(<a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>foreign-entity</code></em>
<em class="replaceable"><code>c-type-internal</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd> This constructor creates a new <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>
from the given <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> or <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> and the
internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type descriptor (as obtained from <a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a>).
<em class="replaceable"><code>name</code></em>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, is mostly useful for documentation and
interactive debugging since it appears in the printed representation
of the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> object, as in
<code class="computeroutput">#<<a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> "foo"
#x0ADD4E55></code>.
In effect, this is similar to <a class="link" href="#cast"><code class="function">FFI:CAST</code></a> (or rather
<code class="code">(<a class="link" href="#offset"><code class="function">FFI:OFFSET</code></a> ... 0 ...)</code> for places),
except that it works with <a class="link" href="#faddr"><code class="function">FFI:FOREIGN-ADDRESS</code></a> objects and allows
caching of the internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types.</dd><dt><a id="dffi-make-func"></a><span class="term"><code class="code">(<a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a>
<em class="replaceable"><code>foreign-entity</code></em> <em class="replaceable"><code>c-type-internal</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd><p class="simpara">This constructor creates a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>
from the given <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> and the
internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type descriptor (as obtained from
<code class="code">(<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> '(<a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a> ...))</code>,
in which case it is important to specify the <a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> because the
expressions are likely to be evaluated at run time, outside the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compilation_unit">compilation unit</a>).
The <em class="replaceable"><code>name</code></em>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, is mostly useful for documentation and
interactive debugging since it appears in the printed representation
of the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object, e.g.,
<code class="computeroutput">#<<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> "foo"
#x0052B060></code>.
It is inherited from the given <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object when
available.</p><p class="simpara">See also <a class="xref" href="#dffi-functions" title="32.3.7. Foreign functions">Section 32.3.7, “Foreign functions”</a>.</p></dd><dt><a id="validp"></a><span class="term"><code class="code">(<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a> <em class="replaceable"><code>foreign-entity</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a> <em class="replaceable"><code>foreign-entity</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p class="simpara">This predicate returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the <em class="replaceable"><code>foreign-entity</code></em>
(e.g. the Lisp equivalent of a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>) refers to a pointer
which is invalid (e.g., because it comes from a previous Lisp session).
It returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <em class="replaceable"><code>foreign-entity</code></em> can be used within the current Lisp process
(thus it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for all non-foreign arguments).</p><p class="simpara">You can invalidate a foreign object using
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>)</code>.
You cannot resurrect a zombie, nor can you kill a non-foreign object.
</p></dd><dt><a id="fptr"></a><span class="term"><code class="code">(<a class="link" href="#fptr"><code class="function">FFI:FOREIGN-POINTER</code></a> <em class="replaceable"><code>foreign-entity</code></em>)</code></span></dt><dd><a class="link" href="#fptr"><code class="function">FFI:FOREIGN-POINTER</code></a> returns the <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>
associated with the Lisp object of type <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>,
<a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>, <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>.
</dd><dt><span class="term"><code class="code">(<a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> <em class="replaceable"><code>foreign-entity</code></em> {<em class="replaceable"><code>foreign-entity</code></em> |
<code class="constant">:COPY</code>})</code></span></dt><dd><a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> changes the
<a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a> associated with the Lisp object of type
<a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>, <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> to
that of the other entity.
With <code class="constant">:COPY</code>, a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a> is allocated.
The original <em class="replaceable"><code>foreign-entity</code></em> still points to the same object and is returned.
This is particularly useful with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>)</code>,
see <a class="xref" href="#ex-dffi-validity" title="Example 32.11. Controlling validity of resources">Example 32.11, “Controlling validity of resources”</a>.</dd><dt><a id="foreign-stack"></a><span class="term"><code class="code">(<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>c-type</code></em>
[<em class="replaceable"><code>initarg</code></em>]) <em class="replaceable"><code>body</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a> (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>c-type</code></em>
[<em class="replaceable"><code>initarg</code></em>]) <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">These forms allocate space on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> execution
stack, bind respectively a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> object or
a local <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-symbol-macro.html"><code class="classname">SYMBOL-MACRO</code></a> to <em class="replaceable"><code>variable</code></em> and execute <em class="replaceable"><code>body</code></em>.</p><p class="simpara">When <em class="replaceable"><code>initarg</code></em> is not supplied,
they allocate space only for <code class="code">(<a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a> <em class="replaceable"><code>c-type</code></em>)</code> bytes.
This space is filled with zeroes. E.g.,
using a <em class="replaceable"><code>c-type</code></em> of <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a> or even <span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a>
(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <span class="type">uint8</span> 32))</code></span> (!) both allocate space
for a single pointer, initialized to <code class="constant">NULL</code>.</p><p>When <em class="replaceable"><code>initarg</code></em> is supplied, they
allocate space for an arbitrarily complex set of structures rooted in
<em class="replaceable"><code>c-type</code></em>. Therefore, <a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a>, <span class="data"><code class="literal">#()</code></span>
and <span class="data"><code class="literal">""</code></span> are your friends for creating a
pointer to the empty arrays:
</p><pre class="programlisting">(with-c-var (v '(c-ptr (c-array-max uint8 32)) #())
(setf (element (deref v) 0) 127) v)</pre><p>
<em class="replaceable"><code>c-type</code></em> is evaluated, making creation of variable sized buffers easy:
</p><pre class="programlisting">(with-c-var (fv `(c-array uint8 ,(length my-vector)) my-vector)
(print fv))</pre><p>
</p></dd><dt><a id="foreign-value"></a><span class="term"><code class="code">(<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> <a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> <a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a>) ...)</code></span></dt><dd><p class="simpara">This functions converts the reference to a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
data structure which the <a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a> describes, to Lisp. Such a
reference is typically obtained from <a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-SHALLOW</code></a>,
<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a>, <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-ALLOCATE</code></a> or via a <code class="code">(<a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>
<em class="replaceable"><code>c-type</code></em>)</code> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type description.
Alternatively, macros like <a class="link" href="#with-c-place"><code class="function">FFI:WITH-C-PLACE</code></a> or <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a> and the
concept of foreign <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> hide many uses of this function.</p><p class="simpara">The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> form performs conversion from Lisp to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>,
following to the <a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a>'s type description.
</p></dd><dt><a id="foreign-stack-string"></a><span class="term"><code class="code">(<a class="link" href="#foreign-stack-string"><code class="function">FFI:WITH-FOREIGN-STRING</code></a>
(<em class="replaceable"><code>foreign-address</code></em> <em class="replaceable"><code>char-count</code></em>
<em class="replaceable"><code>byte-count</code></em> <em class="replaceable"><code>string</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>encoding</code></em> <em class="replaceable"><code>null-terminated-p</code></em>
<em class="replaceable"><code>start</code></em> <em class="replaceable"><code>end</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">This forms converts a Lisp <em class="replaceable"><code>string</code></em> according to
the <em class="replaceable"><code>encoding</code></em>, allocating space on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> execution stack.
<em class="replaceable"><code>encoding</code></em> can be any <a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>, e.g. <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a> or <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a>,
whereas <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a> must be an <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a>-compatible encoding.
</p><p class="simpara"><em class="replaceable"><code>body</code></em> is then executed with the three variables <em class="replaceable"><code>foreign-address</code></em>,
<em class="replaceable"><code>char-count</code></em> and
<em class="replaceable"><code>byte-count</code></em> respectively bound to an
untyped <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> (as known from the <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> foreign
type specification) pointing to the stack location, the number of
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s of the Lisp <em class="replaceable"><code>string</code></em> that were considered and the
number of <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> bytes that were allocated for it on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
stack.</p><p class="simpara">When <em class="replaceable"><code>null-terminated-p</code></em> is true,
which is the default, a variable number of zero bytes is appended,
depending on the encoding, e.g. 2 for <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:UTF-16</code></a>,
and accounted for in <em class="replaceable"><code>byte-count</code></em>,
and <em class="replaceable"><code>char-count</code></em> is incremented by one.</p><p class="simpara">The <a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a> object bound to <em class="replaceable"><code>foreign-address</code></em> is
invalidated upon the exit from the form.</p><p>A stupid example (a quite costly interface
to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mblen.html"><code class="function">mblen</code></a>):
</p><pre class="programlisting">(with-foreign-string (fv elems bytes string
:encoding charset:jis... :null-terminated-p nil
:end 5)
(declare (ignore fv elems))
(format t "This string would take ~D bytes." bytes))</pre><p>
</p></dd><dt><a id="c-type-parse"></a><span class="term"><code class="code">(<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> <em class="replaceable"><code>c-type</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#c-type-parse"><code class="function">FFI:DEPARSE-C-TYPE</code></a> <em class="replaceable"><code>c-type-internal</code></em>)</code></span></dt><dd><p class="simpara">Convert between the external (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>) and internal
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>) <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type representations (used by <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a>).
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Although you can memoize a <em class="replaceable"><code>c-type-internal</code></em> (see
<a class="xref" href="#memoized" title="31.11.3. Macro EXT:MEMOIZED">Section 31.11.3, “Macro <code class="function">EXT:MEMOIZED</code>”</a> - but do not expect type redefinitions to
work across memoization!), you cannot serialize it (write to
disk) because deserialization loses object identity.</p></div></dd><dt><a id="foreign-heap"></a><span class="term"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-SHALLOW</code></a>
<em class="replaceable"><code>c-type</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:COUNT</code> <code class="constant">:READ-ONLY</code>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a> <em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>contents</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:COUNT</code> <code class="constant">:READ-ONLY</code>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> <em class="replaceable"><code>foreign-entity</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :FULL)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-ALLOCATE</code></a> <em class="replaceable"><code>c-type-internal</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :INITIAL-CONTENTS <code class="constant">:COUNT</code> <code class="constant">:READ-ONLY</code>)</code></span></dt><dd><p class="simpara">Macro <a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-SHALLOW</code></a> allocates
<code class="code">(<a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a> <em class="replaceable"><code>c-type</code></em>)</code>
bytes on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> heap and zeroes them out
(like <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/calloc.html"><code class="function">calloc</code></a>).
When <code class="constant">:COUNT</code> is supplied, <em class="replaceable"><code>c-type</code></em> is substituted with
<span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>count</code></em>)</code></span>,
except when <em class="replaceable"><code>c-type</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>, in which case
<span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> <em class="replaceable"><code>count</code></em>)</code></span>
is used instead.
When <code class="constant">:READ-ONLY</code> is supplied, the Lisp side is prevented from modifying the
memory contents. This can be used as an indication that some foreign
side is going to fill this memory (e.g. via <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a>).</p><p class="simpara">Returns a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> object of the actual <em class="replaceable"><code>c-type</code></em>,
whose address part points to the newly allocated memory.</p><p class="simpara"><a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a> will call <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> as many times
as necessary to build a structure on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> heap of the given
<em class="replaceable"><code>c-type</code></em>, initialized from the given <em class="replaceable"><code>contents</code></em>.</p><p class="simpara">E.g., <code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a> '<a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a> "ABCDE")</code>
performs 2 allocations: one for a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> pointer to a string,
another for the contents of that string. This would be useful in
conjunction with a <span class="type">char**</span> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type
declaration. <code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-SHALLOW</code></a> '<a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a>)</code>
allocates room for a single pointer (probably 4 bytes).</p><p class="simpara"><code class="code">(<a class="link" href="#foreign-heap"><code class="function">FFI:ALLOCATE-DEEP</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> "ABCDEF" :count
10)</code> allocates and initializes room for the type <span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> 10)</code></span>,
corresponding to <span class="type">char*</span> or, more specifically,
<span class="type">char[10]</span> in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>.</p><p class="simpara">Function <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> deallocates memory at the address
held by the given <em class="replaceable"><code>foreign-entity</code></em>. If <code class="constant">:FULL</code> is supplied
and the argument is of type <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>, recursively frees
the whole complex structure pointed to by this variable.</p><p class="simpara">If given a <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object that corresponds to a
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> callback, deallocates it. Callbacks are automatically
created each time you pass a Lisp function via the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.</p><p class="simpara">Use <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>)</code> to disable further
references to this address from Lisp. This is currently not done
automatically. If the given pointer is already invalid,
<a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> (currently) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>. This may change to
make it easier to integrate with <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a>.</p><p class="simpara">Function <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-ALLOCATE</code></a> is a lower-level interface as it
requires an internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type descriptor as returned by
<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a>.</p></dd><dt><a id="with-c-place"></a><span class="term"><code class="code">(<a class="link" href="#with-c-place"><code class="function">FFI:WITH-C-PLACE</code></a> (<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>foreign-entity</code></em>)
<em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">Create a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> out of the given <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>
object so operations on places (e.g. <a class="link" href="#cast"><code class="function">FFI:CAST</code></a>, <a class="link" href="#deref"><code class="function">FFI:DEREF</code></a>, <a class="link" href="#slot"><code class="function">FFI:SLOT</code></a> etc.) can
be used within <em class="replaceable"><code>body</code></em>. <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a> appears as a composition of
<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> and <a class="link" href="#with-c-place"><code class="function">FFI:WITH-C-PLACE</code></a>.</p><p>Such a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> can be used to access memory referenced by a <em class="replaceable"><code>foreign-entity</code></em>
object:
</p><pre class="programlisting">(setq foo (allocate-deep '(c-array uint8 3) rgb))
(with-c-place (place foo) (element place 0))</pre><p>
</p></dd><dt><a id="ffi-extern-output"></a><span class="term"><a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a><br /></span><span class="term"><code class="varname">FFI:*OUTPUT-C-VARIABLES*</code></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will write the <span class="type">extern</span>
declarations for foreign functions (defined with <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>) and
foreign variables (defined with <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>) into the output <code class="filename">#P".c"</code>
(when the Lisp file is compiled with <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a>)
<span class="emphasis"><em>unless</em></span> these variables are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
They are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> by default, so the <span class="type">extern</span>
declarations are <span class="strong"><strong>not</strong></span> written; you are encouraged to use
<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> to include the appropriate <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> headers.
Set these variables to non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the headers are not available or
not usable.</dd><dt><a id="ffi-guard"></a><span class="term"><a class="link" href="#ffi-guard"><code class="varname">FFI:*FOREIGN-GUARD*</code></a></span></dt><dd><p>When this variable is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> at <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compile_time">compile time</a>,
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will guard the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> statements in the output file with
<a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> conditionals to take advantage of <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top">autoconf</a> feature detection.
E.g., </p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (compile) (setq *foreign-guard* t))
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> some-function (:name "function_name") ...)
</pre><p> will produce </p><pre class="programlisting">
# if defined(HAVE_FUNCTION_NAME)
register_foreign_function((void*)&function_name,"function_name",1024);
# endif
</pre><p> and will compile and link on any system.</p><p class="simpara">This is mostly useful for product delivery when you want your
module to build on any system even if some features will not be
available.</p><p class="simpara"><a class="link" href="#ffi-guard"><code class="varname">FFI:*FOREIGN-GUARD*</code></a> is initialized to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for backwards compatibility.
</p></dd><dt><a id="fptr-info"></a><span class="term"><a class="link" href="#fptr-info"><code class="function">FFI:FOREIGN-POINTER-INFO</code></a></span></dt><dd>This is an interface
to <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=dladdr"><code class="function">dladdr</code></a> and it returns the 4 fields
of <span class="type">Dl_info</span> as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.</dd></dl></div><div class="variablelist"><a id="dffi-low"></a><p class="title"><strong>Low-level <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms</strong></p><dl class="variablelist"><dt><a id="memory-as"></a><span class="term"><code class="code">(<a class="link" href="#memory-as"><code class="function">FFI:MEMORY-AS</code></a> <em class="replaceable"><code>foreign-address</code></em> <em class="replaceable"><code>c-type-internal</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>offset</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#memory-as"><code class="function">FFI:MEMORY-AS</code></a> <em class="replaceable"><code>foreign-address</code></em> <em class="replaceable"><code>c-type-internal</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>offset</code></em>) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p class="simpara">This accessor is useful when operating with untyped
foreign pointers (<a class="link" href="#faddr"><code class="classname">FFI:FOREIGN-ADDRESS</code></a>) as opposed to typed ones
(represented by <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>). It allows to type and
dereference the given pointer without the need to create an object of
type <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>.</p><p class="simpara">Alternatively, one could use <code class="code">(<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a>
(<a class="link" href="#dffi-make-var"><code class="function">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>foreign-entity</code></em> <em class="replaceable"><code>c-type-internal</code></em>))</code>
(also <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able).</p><p class="simpara">Note that <em class="replaceable"><code>c-type-internal</code></em> is the <span class="emphasis"><em>internal</em></span>
representation of a foreign type, thus <a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> is required
with literal names or types, e.g. <code class="code">(<a class="link" href="#memory-as"><code class="function">FFI:MEMORY-AS</code></a> <em class="replaceable"><code>foreign-address</code></em>
(<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> '(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> uint8 3)))</code> or <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
(<a class="link" href="#memory-as"><code class="function">FFI:MEMORY-AS</code></a> <em class="replaceable"><code>foreign-address</code></em> (<a class="link" href="#c-type-parse"><code class="function">FFI:PARSE-C-TYPE</code></a> 'uint32)) 0)</code>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-types"></a>32.3.3. (Foreign) <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types</h3></div></div></div><p>Foreign <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types are used in the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.
They are <span class="strong"><strong>not</strong></span> regular <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> types or <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> classes.</p><p>A <em class="replaceable"><code>c-type</code></em> is either a predefined <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type or the name of a
type defined by <a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a>.</p><div class="variablelist"><p class="title"><strong>the predefined <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types (<em class="replaceable"><code>c-type</code></em>)</strong></p><dl class="variablelist"><dt><a id="simple-c-type"></a><span class="term"><em class="replaceable"><code>simple-c-type</code></em></span></dt><dd><p>the simple <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> types
</p><div class="informaltable"><a id="simple-c-type-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /><col /><col /></colgroup><thead><tr><th align="center">Lisp name</th><th align="center">Lisp equivalent</th><th align="center"><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> equivalent</th><th align="center"><a class="ulink" href="http://www2.parc.com/istl/projects/ILU/" target="_top"><acronym class="acronym" title="Inter-Language Unification">ILU</acronym></a> equivalent</th><th align="center">Comment</th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><span class="type">void</span></td><td align="center"> </td><td align="center">as a result type only</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></td><td align="center"><span class="type">int</span></td><td align="center"><span class="type">BOOLEAN</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a></td><td align="center"><span class="type">char</span></td><td align="center"><span class="type">SHORT CHARACTER</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">char</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">signed char</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uchar</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">unsigned char</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">short</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">short</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">ushort</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">unsigned short</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">int</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">int</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">unsigned int</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">long</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">long</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">ulong</span></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td><td align="center"><span class="type">unsigned long</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint8</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span></td><td align="center"><span class="type">uint8</span></td><td align="center"><span class="type">BYTE</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">sint8</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 8)</code></span></td><td align="center"><span class="type">sint8</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint16</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 16)</code></span></td><td align="center"><span class="type">uint16</span></td><td align="center"><span class="type">SHORT CARDINAL</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">sint16</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 16)</code></span></td><td align="center"><span class="type">sint16</span></td><td align="center"><span class="type">SHORT INTEGER</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint32</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 32)</code></span></td><td align="center"><span class="type">uint32</span></td><td align="center"><span class="type">CARDINAL</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">sint32</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 32)</code></span></td><td align="center"><span class="type">sint32</span></td><td align="center"><span class="type">INTEGER</span></td><td class="auto-generated"> </td></tr><tr><td align="center"><span class="type">uint64</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 64)</code></span></td><td align="center"><span class="type">uint64</span></td><td align="center"><span class="type">LONG CARDINAL</span></td><td align="center">does not work on all platforms</td></tr><tr><td align="center"><span class="type">sint64</span></td><td align="center"><span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_signed-byte.html" target="_top"><code class="classname">SIGNED-BYTE</code></a> 64)</code></span></td><td align="center"><span class="type">sint64</span></td><td align="center"><span class="type">LONG INTEGER</span></td><td align="center">does not work on all platforms</td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a></td><td align="center"><span class="type">float</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a></td><td align="center"><span class="type">double</span></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></dd><dt><a id="c-pointer"></a><span class="term"><a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a></span></dt><dd>This type corresponds to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type">void*</span>, an opaque pointer.
When used as an argument, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is accepted as a <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> and
treated as <code class="constant">NULL</code>; when a function wants to return a <code class="constant">NULL</code>
<a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>, it actually returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd><dt><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>
<em class="replaceable"><code>c-type</code></em>)</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type"><em class="replaceable"><code>c-type</code></em> *</span>: a pointer to a single item of the given
<em class="replaceable"><code>c-type</code></em>. It differs from <span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a>
<em class="replaceable"><code>c-type</code></em>)</code></span> (see below) in that no conversion to and from
Lisp will occur (beyond the usual one of the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <code class="constant">NULL</code> pointer
to or from Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>). Instead, an object of type <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>
is used to represent the foreign <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>. It is assimilable to a typed
pointer.</dd><dt><a id="c-string"></a><span class="term"><a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a></span></dt><dd>This type corresponds to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type">char*</span>, a zero-terminated string. Its Lisp equivalent is
a string, without the trailing zero character.
</dd><dt><a id="c-struct"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-struct"><span class="type">FFI:C-STRUCT</span></a> <em class="replaceable"><code>class</code></em>
(<em class="replaceable"><code>ident<sub>1</sub></code></em> <em class="replaceable"><code>c-type<sub>1</sub></code></em>) ... (<em class="replaceable"><code>ident<sub>n</sub></code></em> <em class="replaceable"><code>c-type<sub>n</sub></code></em>))</code></span></span></dt><dd><p class="simpara">This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type">struct { <em class="replaceable"><code>c-type<sub>1</sub></code></em> <em class="replaceable"><code>ident<sub>1</sub></code></em>; ...; <em class="replaceable"><code>c-type<sub>n</sub></code></em> <em class="replaceable"><code>ident<sub>n</sub></code></em>; }</span>.
Its Lisp equivalent is: if <em class="replaceable"><code>class</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>, a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>; if <em class="replaceable"><code>class</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>, a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#proper_list">proper list</a>;
if <em class="replaceable"><code>class</code></em> is a symbol naming a structure or <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> class, an
instance of this class, with slots of names
<em class="replaceable"><code>ident<sub>1</sub></code></em>, ..., <em class="replaceable"><code>ident<sub>n</sub></code></em>.</p><p class="simpara">
<em class="replaceable"><code>class</code></em> may also be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> (as above) and
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> options.
</p></dd><dt><a id="c-union"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-union"><span class="type">FFI:C-UNION</span></a>
(<em class="replaceable"><code>ident<sub>1</sub></code></em> <em class="replaceable"><code>c-type<sub>1</sub></code></em>) ... (<em class="replaceable"><code>ident<sub>n</sub></code></em> <em class="replaceable"><code>c-type<sub>n</sub></code></em>))</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type">union { <em class="replaceable"><code>c-type<sub>1</sub></code></em> <em class="replaceable"><code>ident<sub>1</sub></code></em>; ...; <em class="replaceable"><code>c-type<sub>n</sub></code></em> <em class="replaceable"><code>ident<sub>n</sub></code></em>; }</span>.
Conversion to and from Lisp assumes that a value is to be viewed as
being of <em class="replaceable"><code>c-type<sub>1</sub></code></em>.
</dd><dt><a id="c-array"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a>
<em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>dim<sub>1</sub></code></em>)</code></span><br /></span><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <em class="replaceable"><code>c-type</code></em> (<em class="replaceable"><code>dim<sub>1</sub></code></em>
... <em class="replaceable"><code>dim<sub>n</sub></code></em>))</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type"><em class="replaceable"><code>c-type</code></em> [<em class="replaceable"><code>dim<sub>1</sub></code></em>] ... [<em class="replaceable"><code>dim<sub>n</sub></code></em>]</span>.
Note that when an array is passed as an argument to a function in
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, it is actually passed as a pointer; you therefore have to
write <span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> (<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> ...))</code></span> for this
argument's type.</dd><dt><a id="c-array-max"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a>
<em class="replaceable"><code>c-type</code></em> <em class="replaceable"><code>maxdimension</code></em>)</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type"><em class="replaceable"><code>c-type</code></em> [<em class="replaceable"><code>maxdimension</code></em>]</span>, an array containing up to
<em class="replaceable"><code>maxdimension</code></em> elements.
The array is zero-terminated if it contains less than <em class="replaceable"><code>maxdimension</code></em> elements.
Conversion from Lisp of an array with more than <em class="replaceable"><code>maxdimension</code></em> elements
silently ignores the extra elements.
</dd><dt><a id="c-function"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a> (<code class="constant">:ARGUMENTS</code>
{(<em class="replaceable"><code>argument</code></em> <em class="replaceable"><code>a-c-type</code></em>
[<a class="link" href="#param-mode" title="32.3.9. Parameter Mode"><em class="replaceable"><code>PARAM-MODE</code></em></a> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>]])}*)
(<code class="constant">:RETURN-TYPE</code> <em class="replaceable"><code>r-c-type</code></em> [<a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a>])
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> <em class="replaceable"><code>language</code></em>))</code></span></span></dt><dd>This type designates a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function that can be
called according to the given prototype
<code class="code">(<em class="replaceable"><code>r-c-type</code></em> (*)
(<em class="replaceable"><code>a-c-type<sub>1</sub></code></em>, ...))</code>.
Conversion between <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions and Lisp functions
is transparent, and <code class="constant">NULL</code>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is recognized and
accepted.</dd><dt><a id="c-ptr"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type"><em class="replaceable"><code>c-type</code></em> *</span>: a pointer to a single item of the given
<em class="replaceable"><code>c-type</code></em>.</dd><dt><a id="c-ptr-null"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span></span></dt><dd>This type is also equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type"><em class="replaceable"><code>c-type</code></em> *</span>: a pointer to a single item of the given
<em class="replaceable"><code>c-type</code></em>, with the exception that <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <code class="constant">NULL</code> corresponds to
Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><a id="c-array-ptr"></a><span class="term"><span class="type"><code class="literal">(<a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> <em class="replaceable"><code>c-type</code></em>)</code></span></span></dt><dd>This type is equivalent to what <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> calls
<span class="type"><em class="replaceable"><code>c-type</code></em> (*)[]</span>: a pointer to a zero-terminated array of
items of the given <em class="replaceable"><code>c-type</code></em>.</dd></dl></div><p>The conversion of <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a>,
<span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> <em class="replaceable"><code>dim<sub>1</sub></code></em>)</code></span>,
<span class="type"><code class="literal">(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a> <em class="replaceable"><code>maxdimension</code></em>)</code></span>,
<span class="type"><code class="literal">(<a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>)</code></span>
is governed by <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a> and dimensions are given
in <span class="emphasis"><em>bytes</em></span>.
The conversion of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>, and as such of
<span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>)</code></span>, or
<span class="type"><code class="literal">(<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>)</code></span>, as well as
that of multi-dimensional arrays <span class="type"><code class="literal">(<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
(<em class="replaceable"><code>dim<sub>1</sub></code></em> ... <em class="replaceable"><code>dim<sub>n</sub></code></em>))</code></span>, are governed by <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a> if
the latter is a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>, or by the <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> encoding otherwise.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Remember that the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <span class="type">char</span> is
a <span class="emphasis"><em>numeric</em></span> type and does not use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>
<a class="link" href="#encoding" title="31.5. Encodings"><code class="classname">EXT:ENCODING</code></a>s.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="c-flavor"></a>32.3.4. The choice of the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> flavor</h3></div></div></div><p><a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a>, <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a>, <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> take a <a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> argument.
The <em class="replaceable"><code>language</code></em> is either <code class="constant">:C</code> (denotes K&R <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>) or <code class="constant">:STDC</code>
(denotes <a class="ulink" href="http://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>) or <code class="constant">:STDC-STDCALL</code> (denotes <a class="ulink" href="http://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
with the <a class="" href="http://www.google.com/search?q=stdcall">stdcall</a> calling convention).
It specifies whether the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function (caller or callee) has been
compiled by a K&R <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler or by an <a class="ulink" href="http://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler,
and possibly the calling convention.</p><p>The default language is set using the macro
<strong class="first"><em class="firstterm"><a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="function">FFI:DEFAULT-FOREIGN-LANGUAGE</code></a>
<a id="dflt-ffi-lang" class="indexterm"></a></em></strong>.
If this macro has not been called in the current <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#compilation_unit">compilation unit</a>
(usually a file), a warning is issued and <code class="constant">:STDC</code> is used for the rest
of the unit.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-variables"></a>32.3.5. Foreign variables</h3></div></div></div><p><strong class="first"><em class="firstterm">Foreign variables<a id="dffi-fv" class="indexterm"></a></em></strong> are variables whose
storage is allocated in the foreign language module.
They can nevertheless be evaluated and modified through <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a>,
just as normal variables can, except that the range of allowed values
is limited according to the variable's foreign type.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="dffi-eq"></a>Equality of foreign values</h3><p>For a foreign variable <em class="replaceable"><code>x</code></em> the form <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a> <em class="replaceable"><code>x</code></em>
<em class="replaceable"><code>x</code></em>)</code> is not necessarily true, since every time <em class="replaceable"><code>x</code></em> is
evaluated its foreign value is converted to a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> Lisp value.
Ergo, <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_aref.html" target="_top"><code class="function">AREF</code></a> <em class="replaceable"><code>x</code></em> <em class="replaceable"><code>n</code></em>) <em class="replaceable"><code>y</code></em>)</code> modifies this
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> Lisp value (immediately discarded), <span class="strong"><strong>not</strong></span> the foreign data.
Use <a class="link" href="#element"><code class="function">FFI:ELEMENT</code></a> et al instead, see <a class="xref" href="#dffi-places" title="32.3.6. Operations on foreign places">Section 32.3.6, “Operations on foreign places”</a>.
</p></div><p>Foreign variables are defined using <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> and <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-places"></a>32.3.6. Operations on foreign places</h3></div></div></div><p>A <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>name</code></em> defined by <a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a>, <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-C-VAR</code></a>
or <a class="link" href="#with-c-place"><code class="function">FFI:WITH-C-PLACE</code></a> defines a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>,
i.e., a form which can also be used as argument to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>.
(An <a class="dict" href="http://foldoc.org/lvalue"><span class="quote">“<span class="quote">lvalue</span>”</span></a> in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> terminology.)
The following operations are available on foreign places:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="#element"><code class="function">FFI:ELEMENT</code></a></td><td><a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a></td></tr><tr><td><a class="link" href="#deref"><code class="function">FFI:DEREF</code></a></td><td><a class="link" href="#c-var-object"><code class="function">FFI:C-VAR-OBJECT</code></a></td></tr><tr><td><a class="link" href="#slot"><code class="function">FFI:SLOT</code></a></td><td><a class="link" href="#typeof"><code class="function">FFI:TYPEOF</code></a></td></tr><tr><td><a class="link" href="#cast"><code class="function">FFI:CAST</code></a></td><td><a class="link" href="#sizeof"><code class="function">FFI:SIZEOF</code></a></td></tr><tr><td><a class="link" href="#offset"><code class="function">FFI:OFFSET</code></a></td><td><a class="link" href="#bitsizeof"><code class="function">FFI:BITSIZEOF</code></a></td></tr></table></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-functions"></a>32.3.7. Foreign functions</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#dffi-callback-mem">32.3.7.1. Callbacks and memory management</a></span></dt></dl></div><p>Foreign functions are functions which are defined in the foreign language.
There are <strong class="first"><em class="firstterm">named foreign functions<a id="dffi-ff-n" class="indexterm"></a></em></strong>
(imported via <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> or created via <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a>) and
<strong class="first"><em class="firstterm">anonymous foreign functions<a id="dffi-ff-a" class="indexterm"></a></em></strong>; they arise through conversion of function
pointers using <a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a>.</p><p>A <strong class="first"><em class="firstterm">call-out function<a id="dffi-ff-call-out" class="indexterm"></a></em></strong> is a foreign function
called from Lisp: control flow temporarily leaves Lisp.
A <strong class="first"><em class="firstterm">call-in function<a id="dffi-ff-call-in" class="indexterm"></a></em></strong>
(AKA <strong class="first"><em class="firstterm">callback<a id="def-call-in-callback-main" class="indexterm"></a></em></strong>)
is a Lisp function called from the foreign language:
control flow temporary enters Lisp.</p><p>The following operators define foreign functions:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a></td></tr><tr><td><a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a></td></tr><tr><td><a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a></td></tr></table><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dffi-callback-mem"></a>32.3.7.1. Callbacks and memory management</h4></div></div></div><p>Callbacks (<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function calling Lisp function) create
so-called <strong class="first"><em class="firstterm">trampolines<a id="dffi-trampoline" class="indexterm"></a></em></strong>.
A trampoline is a piece of <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code which knows how to call a
particular Lisp function.
(That is how all foreign language interfaces work, not just ours).
The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> pointer that the foreign library receives is the pointer
to this piece of code.
These are <span class="strong"><strong>not</strong></span> subject to <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion, as there is no protocol to
tell the garbage collector when a given callback is not needed anymore
(unlike with Lisp objects).</p><p>With callbacks to <span class="emphasis"><em>named</em></span> functions (i.e.,
created by a <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a> form where <em class="replaceable"><code>function</code></em> is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#function_name">function name</a>) this is
mostly harmless, since <em class="replaceable"><code>function</code></em> is unlikely to be redefined.</p><p>With callbacks to <span class="emphasis"><em>anonymous</em></span> functions (i.e.,
created by <a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a> or a <a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a> form where <em class="replaceable"><code>function</code></em>
argument is a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a>), this might become an issue when they are
produced dynamically and en masse, e.g. inside a loop, so that many
trampolines are generated.</p><p>You can use <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> to free the trampoline associated with a
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object, but when you pass a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-3.html">lambda expression</a> to a
<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> as an argument of type <a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a>, such a trampoline
<span class="strong"><strong>is</strong></span> allocated, but you do <span class="strong"><strong>not</strong></span> get hold of the associated trampoline
object, and thus you cannot (trivially) free it.
Thus you may find it easier to create the <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a> object
first, pass it to the <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>, and then call <a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a>
manually.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="allocation"></a>32.3.8. Argument and result passing conventions</h3></div></div></div><p>When passed to and from functions, allocation of arguments and
results is handled as follows:</p><p>Values of <a class="link" href="#simple-c-type"><em class="replaceable"><code>SIMPLE-C-TYPE</code></em></a>, <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a> are passed on the stack,
with dynamic extent. The <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> is effectively ignored.</p><p>Values of type <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a>, <a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a>, <a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a>, <a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a>
need storage. The <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> specifies the allocation policy:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:NONE</code></span></dt><dd>no storage is allocated.
</dd><dt><span class="term"><code class="constant">:ALLOCA</code></span></dt><dd>allocation of storage on the stack, which has
dynamic extent.</dd><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>storage will be allocated via <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> and released via
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a>.</dd></dl></div><p>If no <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> is specified, the default <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> is
<code class="constant">:NONE</code> for most types, but <code class="constant">:ALLOCA</code> for <a class="link" href="#c-string"><span class="type">FFI:C-STRING</span></a> and <a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> and
<a class="link" href="#c-ptr-null"><span class="type">FFI:C-PTR-NULL</span></a> and <a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> and for <code class="constant">:OUT</code> arguments.
The <code class="constant">:MALLOC-FREE</code> policy provides the ability to pass
arbitrarily nested structures within a single conversion.</p><p><a id="dffi-allocation-out"></a><strong>Call-out function arguments: </strong></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">For arguments passed from Lisp to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>:</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>Lisp allocates the storage using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> and
never deallocates it. The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function is supposed to call
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> when done with it.</dd><dt><span class="term"><code class="constant">:ALLOCA</code></span></dt><dd>Lisp allocates the storage on the stack, with
dynamic extent. It is freed when the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function returns.
</dd><dt><span class="term"><code class="constant">:NONE</code></span></dt><dd><p class="simpara">Lisp assumes that the pointer already points to a
valid area of the proper size and puts the result value there.</p><p class="simpara">This is dangerous and deprecated.</p></dd></dl></div></dd><dt><span class="term">For results passed from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> to Lisp:</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>Lisp calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> on it when done.
</dd><dt><span class="term"><code class="constant">:NONE</code></span></dt><dd>Lisp does nothing.
</dd></dl></div></dd></dl></div><p><a id="dffi-allocation-in"></a><strong>Call-in function arguments: </strong></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">For arguments passed from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> to Lisp:</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>Lisp calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> on it when done.
</dd><dt><span class="term"><code class="constant">:ALLOCA</code><br /></span><span class="term"><code class="constant">:NONE</code></span></dt><dd>Lisp does nothing.
</dd></dl></div></dd><dt><span class="term">For results passed from Lisp to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>:</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:MALLOC-FREE</code></span></dt><dd>Lisp allocates the storage using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> and
never deallocates it. The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function is supposed to call
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a> when done with it.</dd><dt><span class="term"><code class="constant">:NONE</code></span></dt><dd><p class="simpara">Lisp assumes that the pointer already points to a
valid area of the proper size and puts the result value there.</p><p class="simpara">This is dangerous and deprecated.</p></dd></dl></div></dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="ffi-struct-arg"></a>Warning</h3><p>Passing <a class="link" href="#c-struct"><span class="type">FFI:C-STRUCT</span></a>, <a class="link" href="#c-union"><span class="type">FFI:C-UNION</span></a>,
<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a>, <a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> values as arguments (not via pointers) is
only possible to the extent the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler supports it.
Most <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compilers do it right, but some <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compilers
(such as <a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> on <span class="platform">hppa</span>,
<span class="platform">x86_64</span> and <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>)
have problems with this.
The recommended workaround is to pass pointers; this is fully supported.
See also <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>
(<a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.devel/10089"><code>Gmane/devel/10089</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/12562038/" target="_top">https://sourceforge.net/p/clisp/mailman/message/12562038/</a>).</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="param-mode"></a>32.3.9. Parameter Mode</h3></div></div></div><p>A function parameter's <a class="link" href="#param-mode" title="32.3.9. Parameter Mode"><em class="replaceable"><code>PARAM-MODE</code></em></a> may be</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:IN</code> (means: read-only):</span></dt><dd>The caller passes information to the callee.
</dd><dt><span class="term"><code class="constant">:OUT</code> (means: write-only):</span></dt><dd>The callee passes information back to the caller on
return. When viewed as a Lisp function, there is no Lisp argument
corresponding to this, instead it means an additional return value.
Requires <a class="link" href="#allocation" title="32.3.8. Argument and result passing conventions"><em class="replaceable"><code>ALLOCATION</code></em></a> = <code class="constant">:ALLOCA</code>.</dd><dt><span class="term"><code class="constant">:IN-OUT</code> (means: read-write):</span></dt><dd>Information is passed from the caller to the callee
and then back to the caller. When viewed as a Lisp function, the
<code class="constant">:OUT</code> value is returned as an additional return value.
</dd></dl></div><p>The default is <code class="constant">:IN</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="dffi-examples"></a>32.3.10. Examples</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#dffi-ex-more">32.3.10.1. More examples</a></span></dt></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.2. <a href="#dffi-simple">Simple declarations and access</a></dt><dt>32.3. <a href="#dffi-extern-var">External <span class="command"><strong>C</strong></span> variable and some accesses</a></dt><dt>32.4. <a href="#dffi-extern-func1">Calling an external function</a></dt><dt>32.5. <a href="#dffi-extern-func2">Another example for calling an external function</a></dt><dt>32.6. <a href="#dffi-ex-macro">Accessing <span class="command"><strong>cpp</strong></span> macros</a></dt><dt>32.7. <a href="#ex-call-in">Calling Lisp from <span class="command"><strong>C</strong></span></a></dt><dt>32.8. <a href="#ex-call-in-dll">Calling Lisp from <span class="command"><strong>C</strong></span> dynamically</a></dt><dt>32.9. <a href="#dffi-gethostname">Variable size arguments: calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> from <span class="command"><strong>CLISP</strong></span></a></dt><dt>32.10. <a href="#dffi-dll-var">Accessing variables in shared libraries</a></dt><dt>32.11. <a href="#ex-dffi-validity">Controlling validity of resources</a></dt><dt>32.12. <a href="#ex-dffi-float">Floating point arrays</a></dt></dl></div><div class="example"><a id="dffi-simple"></a><p class="title"><strong>Example 32.2. Simple declarations and access</strong></p><div class="example-contents"><p>The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> declaration </p><pre class="programlisting">
struct foo {
int a;
struct foo * b[100];
};
</pre><p> corresponds to </p><pre class="programlisting">
(<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> foo
(a int)
(b (c-array (c-ptr foo) 100)))
</pre><p>The element access </p><pre class="programlisting">
struct foo f;
f.b[7].a
</pre><p> corresponds to </p><pre class="programlisting">
(declare (type foo f))
(foo-a (aref (foo-b f) 7)) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or</span></em>
(slot-value (aref (slot-value f 'b) 7) 'a)
</pre></div></div><br class="example-break" /><div class="example"><a id="dffi-extern-var"></a><p class="title"><strong>Example 32.3. External <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> variable and some accesses</strong></p><div class="example-contents"><pre class="programlisting">
struct bar {
short x, y;
char a, b;
int z;
struct bar * n;
};
extern struct bar * my_struct;
my_struct->x++;
my_struct->a = 5;
my_struct = my_struct->n;
</pre><p> corresponds to </p><pre class="programlisting">
(<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> bar
(x short)
(y short)
(a char)
(b char) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or (b character) if it represents a character, not a number</span></em>
(z int)
(n (c-ptr bar)))
(<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> my_struct (:type (c-ptr bar)))
(setq my_struct (let ((s my_struct)) (incf (slot-value s 'x)) s)) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or</span></em>
(incf (slot my_struct 'x))
(setq my_struct (let ((s my_struct)) (setf (slot-value s 'a) 5) s)) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or</span></em>
(setf (slot my_struct 'a) 5)
(setq my_struct (slot-value my_struct 'n)) <strong> ; </strong><em class="lineannotation"><span class="lineannotation">or</span></em>
(setq my_struct (deref (slot my_struct 'n)))
</pre></div></div><br class="example-break" /><div class="example"><a id="dffi-extern-func1"></a><p class="title"><strong>Example 32.4. Calling an external function</strong></p><div class="example-contents"><p>On <a class="ulink" href="http://www.ansi.org/" target="_top"><acronym class="acronym" title="The American National Standards Institute">ANSI</acronym></a> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> systems, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html"><<code class="filename">stdlib.h</code>></a>
contains the declarations:
</p><pre class="programlisting">
typedef struct {
int quot; /* Quotient */
int rem; /* Remainder */
} div_t;
extern div_t div (int numer, int denom);
</pre><p>
This translates to
</p><pre class="programlisting">
(<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> (div_t :typedef)
(quot int)
(rem int))
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="function">FFI:DEFAULT-FOREIGN-LANGUAGE</code></a> :stdc)
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> div (<code class="constant">:ARGUMENTS</code> (numer int) (denom int))
(<code class="constant">:RETURN-TYPE</code> div_t))
</pre><p>
Sample call from within Lisp (after running <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span>):
</p><pre class="programlisting">
(div 20 3)
⇒ <code class="computeroutput">#S(DIV_T :QUOT 6 :REM 2)</code>
</pre></div></div><br class="example-break" /><div class="example"><a id="dffi-extern-func2"></a><p class="title"><strong>Example 32.5. Another example for calling an external function</strong></p><div class="example-contents"><p>Suppose the following is defined in a file <code class="filename">cfun.c</code>:
</p><pre class="programlisting">
struct cfunr { int x; char *s; };
struct cfunr * cfun (int i,char *s,struct cfunr * r,int a[10]) {
int j;
struct cfunr * r2;
printf("i = %d\n", i);
printf("s = %s\n", s);
printf("r->x = %d\n", r->x);
printf("r->s = %s\n", r->s);
for (j = 0; j < 10; j++) printf("a[%d] = %d.\n", j, a[j]);
r2 = (struct cfunr *) malloc (sizeof (struct cfunr));
r2->x = i+5;
r2->s = "A C string";
return r2;
}
</pre><p>
It is possible to call this function from Lisp using the file
<code class="filename">callcfun.lisp</code> (do not call it
<code class="filename">cfun.lisp</code> - <a href="impnotes.html#compilefile" class="olink"><code class="function">COMPILE-FILE</code></a> will
<a class="link" href="#c-file-overwrite" title="Warning">overwrite</a>
<code class="filename">cfun.c</code>) whose contents is:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "TEST-C-CALL" (:use <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "TEST-C-CALL")
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (compile) (setq <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a> t))
(<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> cfunr (x int) (s c-string))
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="function">FFI:DEFAULT-FOREIGN-LANGUAGE</code></a> :stdc)
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> cfun (<code class="constant">:RETURN-TYPE</code> (c-ptr cfunr))
(<code class="constant">:ARGUMENTS</code> (i int)
(s c-string)
(r (c-ptr cfunr) :in :alloca)
(a (c-ptr (c-array int 10)) :in :alloca)))
(defun call-cfun ()
(cfun 5 "A Lisp string" (make-cfunr :x 10 :s "Another Lisp string")
'#(0 1 2 3 4 5 6 7 8 9)))
</pre><p>
Use the <a href="impnotes.html#modules" class="olink">module</a> facility:
</p><pre class="screen">
<strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> create cfun callcfun.c
<strong><code class="prompt">$</code></strong> cc -O -c cfun.c
<strong><code class="prompt">$</code></strong> cd cfun
<strong><code class="prompt">$</code></strong> ln -s ../cfun.o cfun.o
Add cfun.o to NEW_LIBS and NEW_FILES in <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>.
<strong><code class="prompt">$</code></strong> cd ..
<strong><code class="prompt">$</code></strong> base/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base/lispinit.mem <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> callcfun.lisp
<strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> add base base+cfun cfun
<strong><code class="prompt">$</code></strong> base+cfun/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base+cfun/lispinit.mem <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> callcfun
> (test-c-call::call-cfun)
i = 5
s = A Lisp string
r->x = 10
r->s = Another Lisp string
a[0] = 0.
a[1] = 1.
a[2] = 2.
a[3] = 3.
a[4] = 4.
a[5] = 5.
a[6] = 6.
a[7] = 7.
a[8] = 8.
a[9] = 9.
#S(TEST-C-CALL::CFUNR :X 10 :S "A C string")
>
<strong><code class="prompt">$</code></strong> rm -r base+cfun</pre><p>Note that there is a memory leak here: The return value
<code class="varname">r2</code> of <code class="function">cfun()</code> is
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>ed but never <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html"><code class="function">free</code></a>d. Specifying</p><pre class="programlisting">
(<code class="constant">:RETURN-TYPE</code> (c-ptr cfunr) :malloc-free)
</pre><p>
is not an alternative because this would also
<code class="function">free(r2->x)</code> but <code class="varname">r2->x</code> is a
pointer to static data.</p><p>The memory leak can be avoided using
</p><pre class="programlisting">
(<code class="constant">:RETURN-TYPE</code> (c-pointer cfunr))
</pre><p>
instead, in conjunction with
</p><pre class="programlisting">
(defun call-cfun ()
(let ((data (cfun ...)))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> (<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> data)
(<a class="link" href="#foreign-heap"><code class="function">FFI:FOREIGN-FREE</code></a> data :FULL nil))))
</pre></div></div><br class="example-break" /><div class="example"><a id="dffi-ex-macro"></a><p class="title"><strong>Example 32.6. Accessing <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> macros</strong></p><div class="example-contents"><p>Suppose you are interfacing to a library <code class="filename">mylib.so</code>
which defines types, macros and <code class="literal">inline</code> functions
in <code class="filename">mylib.h</code>:</p><pre class="programlisting">
#define FOO(x) .....
#define BAR ...
struct zot { ... }
inline int bar (int x) { ... }
</pre><p>
To make them available from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, write these forms into the lisp
file <code class="filename">my.lisp</code>:</p><pre class="programlisting">
(<a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> "#include <mylib.h>
int my_foo (int x) { return FOO(x); }
int my_bar (int x) { return bar(x); }~%")
(<a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a> bar)
(<a class="link" href="#def-c-const"><code class="function">FFI:DEF-C-CONST</code></a> zot-size (:name "sizeof(struct zot)") (:guard nil))
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> my-foo (<code class="constant">:NAME</code> "my_foo") (<code class="constant">:ARGUMENTS</code> (x ffi:int)) (<code class="constant">:RETURN-TYPE</code> ffi:int))
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> my-bar (<code class="constant">:NAME</code> "my_bar") (<code class="constant">:ARGUMENTS</code> (x ffi:int)) (<code class="constant">:RETURN-TYPE</code> ffi:int))
</pre><p>Compiling this file will produce <code class="filename">my.c</code>
and <code class="filename">my.fas</code> and you have two options:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Compile <code class="filename">my.c</code>
into <code class="filename">my.o</code> with
</p><pre class="screen"><strong><code class="prompt">$</code></strong> gcc -c my.c -lmylib</pre><p>
and use <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> to create a new <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a>.
</p></li><li class="listitem"><p>Add <code class="code">(<code class="constant">:LIBRARY</code> "my.dll")</code> to the <a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a>
forms, compile <code class="filename">my.c</code> into <code class="filename">my.so</code>
(or <code class="filename">my.dll</code> on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>) with
</p><pre class="screen"><strong><code class="prompt">$</code></strong> gcc -shared -o my.so my.c -lmylib</pre><p> and
load <code class="filename">my.fas</code>.</p></li></ol></div><p>Of course, you could have created <code class="filename">my1.c</code>
containing</p><pre class="programlisting">
#include <mylib.h>
int my_foo (int x) { return FOO(x); }
int my_bar (int x) { return bar(x); }
</pre><p>manually, but <a class="link" href="#c-lines"><code class="function">FFI:C-LINES</code></a> allows you to keep the
definitions of <code class="function">my_foo</code> and <code class="function">my-foo</code>
close together for easier maintenance.</p></div></div><br class="example-break" /><div class="example"><a id="ex-call-in"></a><p class="title"><strong>Example 32.7. Calling Lisp from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a></strong></p><div class="example-contents"><p>To sort an array of double-floats using the Lisp function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sortcm_stable-sort.html" target="_top"><code class="function">SORT</code></a>
instead of the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library function
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/qsort.html"><code class="function">qsort</code></a>, one can use the
following interface code <code class="filename">sort1.c</code>.
The main problem is to pass a variable-sized array.
</p><pre class="programlisting">
extern void lispsort_begin (int);
void* lispsort_function;
void lispsort_double (int n, double * array) {
double * sorted_array;
int i;
lispsort_begin(n); /* store #'sort2 in lispsort_function */
sorted_array = ((double * (*) (double *)) lispsort_function) (array);
for (i = 0; i < n; i++) array[i] = sorted_array[i];
free(sorted_array);
}
</pre><p>
This is accompanied by <code class="filename">sort2.lisp</code>:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defpackage.html" target="_top"><code class="function">DEFPACKAGE</code></a> "FFI-TEST" (:use <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_in-package.html" target="_top"><code class="function">IN-PACKAGE</code></a> "FFI-TEST")
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (compile) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a> t))
(<a class="link" href="#def-call-in"><code class="function">FFI:DEF-CALL-IN</code></a> lispsort_begin (<code class="constant">:ARGUMENTS</code> (n int))
(<code class="constant">:RETURN-TYPE</code> nil)
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc))
(<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> lispsort_function (:type c-pointer))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> lispsort_begin (n)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#cast"><code class="function">FFI:CAST</code></a> lispsort_function
`(<a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a>
(<code class="constant">:ARGUMENTS</code> (v (c-ptr (c-array double-float ,n))))
(<code class="constant">:RETURN-TYPE</code> (c-ptr (c-array double-float ,n))
:malloc-free)))
#'sort2))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> sort2 (v)
(declare (type vector v))
(sort v #'<))
</pre><p>
To test this, use the following test file <code class="filename">sorttest.lisp</code>:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_eval-when.html" target="_top"><code class="function">EVAL-WHEN</code></a> (compile) (setq <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a> t))
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> sort10
(<code class="constant">:NAME</code> "lispsort_double")
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc)
(<code class="constant">:ARGUMENTS</code> (n ffi:int)
(array (<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> (<a class="link" href="#c-array"><span class="type">FFI:C-ARRAY</span></a> ffi:double-float 10)) :in-out)))
</pre><p>
Now try
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> create sort sort2.c sorttest.c
<strong><code class="prompt">$</code></strong> cc -O -c sort1.c
<strong><code class="prompt">$</code></strong> cd sort
<strong><code class="prompt">$</code></strong> ln -s ../sort1.o sort1.o</pre><p>
Add <code class="filename">sort1.o</code> to <code class="envar">NEW_LIBS</code>
and <code class="envar">NEW_FILES</code> in <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>.
Create a file <code class="filename">package.lisp</code> containing the form
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-package.html" target="_top"><code class="function">MAKE-PACKAGE</code></a> "FFI-TEST" :use '(<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_11-1-2-1.html"><strong class="package"><span class="quote">“<span class="quote">COMMON-LISP</span>”</span></strong></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>))</pre><p>
and add <code class="filename">package.lisp</code> to <a class="link" href="#mod-preload"><code class="envar">TO_PRELOAD</code></a> in <a href="impnotes.html#modset" class="olink"><span class="command"><strong>link.sh</strong></span></a>.
Proceed:
</p><pre class="screen"><strong><code class="prompt">$</code></strong> cd ..
<strong><code class="prompt">$</code></strong> base/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base/lispinit.mem <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> sort2.lisp <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> sorttest.lisp
<strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp-link.html#clisp-link" class="olink">clisp-link</a></strong></span> add base base+sort sort
<strong><code class="prompt">$</code></strong> base+sort/lisp.run <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> base+sort/lispinit.mem <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> sort2 sorttest
> (sort10 10 '#(0.501d0 0.528d0 0.615d0 0.550d0 0.711d0
0.523d0 0.585d0 0.670d0 0.271d0 0.063d0))
#(0.063d0 0.271d0 0.501d0 0.523d0 0.528d0 0.55d0 0.585d0 0.615d0 0.67d0 0.711d0)
<strong><code class="prompt">$</code></strong> rm -r base+sort</pre></div></div><br class="example-break" /><div class="example"><a id="ex-call-in-dll"></a><p class="title"><strong>Example 32.8. Calling Lisp from <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> dynamically</strong></p><div class="example-contents"><p>Create a dynamic library <code class="filename">lispdll</code>
(<code class="filename">#P".dll"</code> on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>,
<code class="filename">#P".so"</code> on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)
with the following function:</p><pre class="programlisting">
typedef int (*LispFunc)(int parameter);
int CallInFunc(LispFunc f) {
return f(5)+11;
}
</pre><p>
and call it from Lisp:
</p><pre class="programlisting">
(ffi:def-call-out callout
(<code class="constant">:NAME</code> "CallInFunc")
(<code class="constant">:LIBRARY</code> "lispdll.dll")
(<code class="constant">:ARGUMENTS</code> (function-arg
(<a class="link" href="#c-function"><span class="type">FFI:C-FUNCTION</span></a> (<code class="constant">:ARGUMENTS</code> (number ffi:int))
(<code class="constant">:RETURN-TYPE</code> ffi:int) (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc))))
(<code class="constant">:RETURN-TYPE</code> ffi:int)
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc))
(defun f (x) (* x 2))
⇒ <code class="computeroutput">F</code>
(callout #'f)
⇒ <code class="computeroutput">21</code>
</pre></div></div><br class="example-break" /><div class="example"><a id="dffi-gethostname"></a><p class="title"><strong>Example 32.9. Variable size arguments:
calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p><div class="example-contents"><p>The standard <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> function
</p><div class="funcsynopsis"><a id="gethostname-synopsis"></a><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <strong class="fsfunc">gethostname</strong>(</code></td><td>char* <var class="pdparam">name</var>, </td></tr><tr><td> </td><td>size_t <var class="pdparam">length</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div><p>
follows a typical pattern of <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <span class="quote">“<span class="quote">out</span>”</span>-parameter
convention: it expects a pointer to a buffer it is going to fill.
So you must view this parameter as either <code class="constant">:OUT</code> or <code class="constant">:IN-OUT</code>.
Additionally, one must tell the function the size of the buffer.
Here <em class="replaceable"><code>length</code></em> is just an <code class="constant">:IN</code> parameter.
Sometimes this will be an <code class="constant">:IN-OUT</code> parameter, returning the
number of bytes actually filled in.</p><p>So <em class="replaceable"><code>name</code></em> is actually a pointer to an array of up to <em class="replaceable"><code>length</code></em>
characters, regardless of what the poor <span class="type">char*</span> <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
prototype says, to be used like a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <span class="type">string</span>
(<code class="constant">NULL</code>-termination). <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> specifies that <span class="quote">“<span class="quote">host names are
limited to <code class="constant">HOST_NAME_MAX</code> bytes</span>”</span>, which is,
of course, system dependent, but it appears that 256 is sufficient.</p><p>In the present example, you can use allocation <code class="constant">:ALLOCA</code>, like
you would do in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>: stack-allocate a temporary:
</p><pre class="programlisting">
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gethostname
(<code class="constant">:ARGUMENTS</code> (name (<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> (<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> ffi:char 256))
<code class="constant">:OUT</code> <code class="constant">:ALLOCA</code>)
(length ffi:int))
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc) (<code class="constant">:LIBRARY</code> :default)
(<code class="constant">:RETURN-TYPE</code> ffi:int))
⇒ <code class="computeroutput">GETHOSTNAME</code>
(defun myhostname ()
(multiple-value-bind (success name)<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><code class="constant">:OUT</code> and <code class="constant">:IN-OUT</code> parameters are returned as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a></span></em>
(gethostname 256)
(if (zerop success) name
(error "~S: ~S: ~S" 'myhostname (os:errno) (os:strerror)))))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">See <a class="xref" href="#errno" title="33.2.15. Error handling">Section 33.2.15, “Error handling”</a></span></em>
⇒ <code class="computeroutput">MYHOSTNAME</code>
(myhostname)
⇒ <code class="computeroutput">#(97 98 97 122 111 110 107)</code></pre><p>
It is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>, not a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, because the <em class="replaceable"><code>name</code></em>
argument is an array of <span class="type">char</span> (an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> type, see
<a class="xref" href="#dffi-types" title="32.3.3. (Foreign) C types">Section 32.3.3, “(Foreign) <span class="command"><strong>C</strong></span> types”</a>), <span class="strong"><strong>not</strong></span> <span class="type">character</span>.
</p><pre class="programlisting">
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gethostname
(<code class="constant">:ARGUMENTS</code> (name (<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> (<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> character 256))
<code class="constant">:OUT</code> <code class="constant">:ALLOCA</code>)
(length ffi:int))
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc) (<code class="constant">:LIBRARY</code> :default)
(<code class="constant">:RETURN-TYPE</code> ffi:int))
⇒ <code class="computeroutput">GETHOSTNAME</code>
(myhostname)
⇒ <code class="computeroutput">"abazonk"</code></pre><p>
Now we have a different problem:
if <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html"><code class="function">gethostname</code></a> fails, then the buffer
allocated for <em class="replaceable"><code>name</code></em> will be filled with garbage, but it will still go
through the string conversion <span class="strong"><strong>before</strong></span> we can check
the <em class="replaceable"><code>success</code></em> status.
If <a href="impnotes.html#foreign-enc" class="olink"><code class="varname">CUSTOM:*FOREIGN-ENCODING*</code></a> is <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a>, this is not a problem since no real
conversion is happening, but with <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> may be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
A safe approach is to pass to the foreign function our own
stack-allocated buffer, and only convert the buffer to a string when the
foreign function succeeds: </p><pre class="programlisting">
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> gethostname
(<code class="constant">:ARGUMENTS</code> (name <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>)
(length ffi:int))
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc) (<code class="constant">:LIBRARY</code> :default)
(<code class="constant">:RETURN-TYPE</code> ffi:int))
⇒ <code class="computeroutput">GETHOSTNAME</code>
(defun myhostname ()
(<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> (name '(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> character 256))
(let ((success (gethostname name 256)))
(if (zerop success) (<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> name)
(error "~S: ~S: ~S" 'myhostname (os:errno) (os:strerror))))))
⇒ <code class="computeroutput">MYHOSTNAME</code>
(myhostname)
⇒ <code class="computeroutput">"abazonk"</code></pre><p>
Note that the <em class="replaceable"><code>type</code></em> argument of <a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> is evaluated,
so we do not have to make any assumptions
about <code class="constant">HOST_NAME_MAX</code>: </p><pre class="programlisting">
(defun myhostname ()
(let ((host-name-max (<a class="link" href="#sysinfo" title="33.2.4. System Information">os:sysconf</a> :host-name-max)))
(<a class="link" href="#foreign-stack"><code class="function">FFI:WITH-FOREIGN-OBJECT</code></a> (name `(<a class="link" href="#c-array-max"><span class="type">FFI:C-ARRAY-MAX</span></a> character ,host-name-max))
(let ((success (gethostname name host-name-max)))
(if (zerop success) (<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> name)
(error "~S: ~S: ~S" 'myhostname (os:errno) (os:strerror)))))))
⇒ <code class="computeroutput">MYHOSTNAME</code>
(myhostname)
⇒ <code class="computeroutput">"abazonk"</code></pre><p>
</p></div></div><br class="example-break" /><div class="example"><a id="dffi-dll-var"></a><p class="title"><strong>Example 32.10. Accessing variables in shared libraries</strong></p><div class="example-contents"><p>Suppose one wants to access and modify variables that reside in
shared libraries:
</p><pre class="programlisting">
struct bar {
double x, y;
double out;
};
struct bar my_struct = {10.0, 20.5, 0.0};
double test_dll(struct bar *ptr)
{
return ptr->out = ptr->out + ptr->x + ptr->y;
}
</pre><p>This is compiled to <code class="filename">libtest.so</code> (or
<code class="filename">libtest.dll</code>, depending on your platform).</p><p>Use the following lisp code:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>)
(<a class="link" href="#def-c-struct"><code class="function">FFI:DEF-C-STRUCT</code></a> bar
(x double-float)
(y double-float)
(out double-float))
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> get-own-c-float
(<code class="constant">:LIBRARY</code> "libtest.so")
(<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc)
(<code class="constant">:NAME</code> "test_dll")
(<code class="constant">:ARGUMENTS</code> (ptr c-pointer :in :alloca))
(<code class="constant">:RETURN-TYPE</code> double-float))
(<a class="link" href="#def-c-var"><code class="function">FFI:DEF-C-VAR</code></a> my-c-var (:name "my_struct")
(<code class="constant">:LIBRARY</code> "libtest.so") (:type (c-ptr bar)))
</pre><p>Note that <code class="function">get-own-c-float</code> takes a
<a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>, not a <span class="type"><code class="literal">(<a class="link" href="#c-ptr"><span class="type">FFI:C-PTR</span></a> bar)</code></span> as the
argument.</p><p>Now you can access call <code class="function">get-own-c-float</code> on
<code class="varname">my-c-var</code>:
</p><pre class="programlisting">
(<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var)
⇒ <code class="computeroutput">#<FOREIGN-ADDRESS #x282935D8></code>
(get-own-c-float (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var))
⇒ <code class="computeroutput">30.5d0</code>
(get-own-c-float (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var))
⇒ <code class="computeroutput">61.0d0</code>
(get-own-c-float (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var))
⇒ <code class="computeroutput">91.5d0</code>
(get-own-c-float (<a class="link" href="#c-var-addr"><code class="function">FFI:C-VAR-ADDRESS</code></a> my-c-var))
⇒ <code class="computeroutput">122.0d0</code>
</pre></div></div><br class="example-break" /><div class="example"><a id="ex-dffi-validity"></a><p class="title"><strong>Example 32.11. Controlling validity of resources</strong></p><div class="example-contents"><p><a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> is useful in conjunction with <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>)</code> to limit the extent of external resources.
Closing twice can be avoided by checking <a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a>.
All pointers depending on this resource can be disabled at once upon
close by sharing their <a class="link" href="#fptr"><code class="function">FFI:FOREIGN-POINTER</code></a> using <a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a>.
</p><pre class="programlisting">
(<a class="link" href="#def-c-type"><code class="function">FFI:DEF-C-TYPE</code></a> PGconn c-pointer)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">opaque pointer</span></em>
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> PQconnectdb (<code class="constant">:RETURN-TYPE</code> PGconn)
(<code class="constant">:ARGUMENTS</code> (conninfo c-string)))
(defun sql-connect (conninfo)
(let ((conn (PQconnectdb conninfo)))
(unless conn (error "NULL pointer"))
;; may wish to use <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a> as well
(<a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> conn <code class="constant">:COPY</code>)))
(defun sql-dependent-resource (conn arg1)
(<a class="link" href="#fptr"><code class="function">FFI:SET-FOREIGN-POINTER</code></a> (PQxxx conn arg1) conn))
(defun sql-close (connection)
(when (<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a> connection)
(PQfinish connection)
(setf (<a class="link" href="#validp"><code class="function">FFI:VALIDP</code></a> connection) nil)
T))
</pre><p>
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Sharing <a class="link" href="#fptr"><code class="function">FFI:FOREIGN-POINTER</code></a> goes both ways: invalidating
the dependent resource will invalidate the primary one.</p></div><p>
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>An alternative approach to resource management,
more suitable to non-<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> <a href="impnotes.html#modules" class="olink">module</a>s,
is implemented in the <span class="module"><a class="filename" href="#berkeley-db" title="33.7. Berkeley DB access"><code class="filename">berkeley-db</code></a></span> module,
see <a class="xref" href="#bdb-close" title="33.7.2. Closing handles">Section 33.7.2, “Closing handles”</a>.</p></div></div></div><br class="example-break" /><div class="example"><a id="ex-dffi-float"></a><p class="title"><strong>Example 32.12. Floating point arrays</strong></p><div class="example-contents"><p>Save this code into <code class="filename">sum.c</code>:
</p><pre class="programlisting">
double sum (int len, double *vec) {
int i;
double s=0;
for (i=0; i<len; i++) s+= vec[i];
return s;
}
</pre><p>
and compile it with
</p><pre class="screen"><strong><code class="prompt">$</code></strong> gcc -shared -o libsum.so sum.c</pre><p>
Now you can sum doubles:
</p><pre class="programlisting">
(<a class="link" href="#def-call-out"><code class="function">FFI:DEF-CALL-OUT</code></a> sum (<code class="constant">:NAME</code> "sum") (<code class="constant">:LIBRARY</code> "libsum.so") (<a class="link" href="#c-flavor" title="32.3.4. The choice of the C flavor"><code class="constant">:LANGUAGE</code></a> :stdc)
(<code class="constant">:RETURN-TYPE</code> ffi:double-float)
(<code class="constant">:ARGUMENTS</code> (len ffi:int) (vec (<a class="link" href="#c-array-ptr"><span class="type">FFI:C-ARRAY-PTR</span></a> ffi:double-float))))
(sum 3 #(1d0 2d0 3d0))
⇒ <code class="computeroutput">6d0</code>
</pre></div></div><br class="example-break" /><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="dffi-ex-more"></a>32.3.10.1. More examples</h4></div></div></div><p>You can find more information and examples of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> in the following <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a> messages:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">variable size values</span></dt><dd><a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/7278"><code>Gmane/general/7278</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/10143425/" target="_top">https://sourceforge.net/p/clisp/mailman/message/10143425/</a>
</dd><dt><span class="term">variable length arrays</span></dt><dd><a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/6626"><code>Gmane/general/6626</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/10142276/" target="_top">https://sourceforge.net/p/clisp/mailman/message/10142276/</a>
<a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/6628"><code>Gmane/general/6628</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/10142279/" target="_top">https://sourceforge.net/p/clisp/mailman/message/10142279/</a>
</dd></dl></div><p>Even more examples can be found in the file
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/tests/ffi.tst"><code class="filename">tests/ffi.tst</code></a>
in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> source distribution.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="socket"></a>32.4. Socket Streams</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#socket-intro">32.4.1. Introduction</a></span></dt><dt><span class="section"><a href="#socket-api">32.4.2. Socket API Reference</a></span></dt><dt><span class="section"><a href="#timeout-k">32.4.3. Argument <code class="constant">:TIMEOUT</code></a></span></dt></dl></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.13. <a href="#socket-ex-server">Lisp read-eval-print loop server</a></dt><dt>32.14. <a href="#socket-ex-client">Lisp <span class="command"><strong>HTTP</strong></span> client</a></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="socket-intro"></a>32.4.1. Introduction</h3></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>32.13. <a href="#socket-ex-server">Lisp read-eval-print loop server</a></dt><dt>32.14. <a href="#socket-ex-client">Lisp <span class="command"><strong>HTTP</strong></span> client</a></dt></dl></div><p><a class="ulink" href="http://www.freesoft.org/CIE/Topics/20.htm" target="_top">Sockets</a>
are used for interprocess communications by processes running on the
same host as well as by processes running on different hosts over a
computer network.
The most common kind of sockets is Internet stream sockets, and a
high-level interface to them is described here.
A more low level interface that closely follows the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> system
calls is also available, see <a class="xref" href="#rawsock" title="33.17. Raw Socket Access">Section 33.17, “Raw Socket Access”</a>.</p><p>Two main varieties of sockets are interfaced to:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="quote">“<span class="quote">active</span>”</span> sockets</span></dt><dd>correspond to <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s which are <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s</dd><dt><span class="term"><span class="quote">“<span class="quote">passive</span>”</span> sockets</span></dt><dd>correspond to <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>s which are a special
kind of objects that are used to allow the other side to initiate
interaction with lisp.</dd></dl></div><div class="example"><a id="socket-ex-server"></a><p class="title"><strong>Example 32.13. Lisp <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> server</strong></p><div class="example-contents"><p>Here is a simple lisp <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> server that waits for a remote
connection and evaluates forms read from it:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((server (<a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a>)))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> t "~&Waiting for a connection on ~S:~D~%"
(<a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-HOST</code></a> server) (<a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-PORT</code></a> server))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>
;; infinite loop, terminate with <span class="keycap"><strong>Control</strong></span>+<span class="keysym">C</span>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (socket (<a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a> server))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a> (local-host local-port) (<a class="link" href="#sost-local"><code class="function">SOCKET:SOCKET-STREAM-LOCAL</code></a> socket)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a> (remote-host remote-port) (<a class="link" href="#sost-peer"><code class="function">SOCKET:SOCKET-STREAM-PEER</code></a> socket)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> "~&Connection: ~S:~D -- ~S:~D~%"
remote-host remote-port local-host local-port)))
;; loop is terminated when the remote host closes the connection or on <a class="link" href="#quit" title="31.3. Quitting CLISP"><code class="function">EXT:EXIT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">WHEN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> :eof (<a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> (cons socket :input))) (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_writecm_p_rintcm_princ.html" target="_top"><code class="function">PRINT</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> socket)) socket)
;; flush everything left in socket
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for c = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char-no-hang.html" target="_top"><code class="function">READ-CHAR-NO-HANG</code></a> socket nil nil) :while c)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_terpricm_fresh-line.html" target="_top"><code class="function">TERPRI</code></a> socket))))
;; make sure server is closed
(<a class="link" href="#sose-close"><code class="function">SOCKET:SOCKET-SERVER-CLOSE</code></a> server)))
</pre><p>
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">This opens a gaping security hole!</h3><p>Functions like <a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a>, <a class="link" href="#exec" title="32.7.1. Shell"><code class="function">EXT:EXECUTE</code></a>, <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> will allow the
remote host to execute arbitrary code with your permissions.
While functions defined in lisp (like <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a>) can be removed
(using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_fmakunbound.html" target="_top"><code class="function">FMAKUNBOUND</code></a>), the built-in functions (like <a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> and <a class="link" href="#exec" title="32.7.1. Shell"><code class="function">EXT:EXECUTE</code></a>)
cannot be permanently removed from the <a href="clisp.html#runtime" class="olink">runtime</a>, and an experienced
hacker will be able to invoke them even if you <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_fmakunbound.html" target="_top"><code class="function">FMAKUNBOUND</code></a> their names.
</p><p>You should limit the socket server to local connections
by passing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> <span class="data"><code class="literal">"127.0.0.1"</code></span>
as the <code class="constant">:INTERFACE</code> argument to <a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a>.</p></div><p>
</p></div></div><br class="example-break" /><div class="example"><a id="socket-ex-client"></a><p class="title"><strong>Example 32.14. Lisp <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> client</strong></p><div class="example-contents"><p>Here are a couple of simple lisp <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> clients that fetch a web
page and a binary file, and upload a file:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> wget-text (host page file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (port 80))
;; <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requires the <code class="constant">:DOS</code> <a class="link" href="#newline" title="31.5.3. Line Terminators">line terminator</a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (socket (<a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a> port host <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> socket "GET ~A HTTP/1.0~2%" page)
;; dump the whole thing - header+data - into the output file
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (out file :direction :output)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for line = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> socket nil nil) :while line
:do (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-str_m_write-line.html" target="_top"><code class="function">WRITE-LINE</code></a> line out)))))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> wget-binary (host page file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (port 80))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (socket (<a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a> port host <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> socket "GET ~A HTTP/1.0~2%" page)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :with content-length :for line = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> socket nil nil)
;; header is separated from the data with a blank line
:until (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_zerop.html" target="_top"><code class="function">ZEROP</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> line)) :do
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_whencm_unless.html" target="_top"><code class="function">WHEN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stringeqc_ng-not-lessp.html" target="_top"><code class="function">STRING=</code></a> line #1="Content-length: " :end1 #2=<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_2-4-8-6.html"><span class="data"><code class="literal">#.</code></span></a>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> #1#))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> content-length (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_parse-integer.html" target="_top"><code class="function">PARSE-INTEGER</code></a> line :start #2#))
;; this will not work if the server does not supply the content-length header
:finally (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((data (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a> content-length
:element-type '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)))
;; switch to binary i/o on socket
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> socket) '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)
;; read the whole file in one system call
(<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a> data socket)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (out file :direction :output
<a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)
;; write the whole file in one system call
(<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> data out))
data))))))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a> wput (host page file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (port 80))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (socket (<a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a> port host <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (in file :direction :inptut <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a> ((length (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-length.html" target="_top"><code class="function">FILE-LENGTH</code></a> in))
(data (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html" target="_top"><code class="function">MAKE-ARRAY</code></a> length :element-type '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)))
;; some servers may not understand the "Content-length" header
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> socket "PUT ~A HTTP/1.0~%Content-length: ~D~2%" page length)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_stream-element-type.html" target="_top"><code class="function">STREAM-ELEMENT-TYPE</code></a> socket) '<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span>)
(<a class="link" href="#rd-by-seq"><code class="function">EXT:READ-BYTE-SEQUENCE</code></a> data in)
(<a class="link" href="#wr-by-seq"><code class="function">EXT:WRITE-BYTE-SEQUENCE</code></a> data socket)))
;; not necessary if the server understands the "Content-length" header
(<a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a> socket :output)
;; get the server response
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> :for line = (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> socket nil nil) :while line :collect line)))
</pre></div></div><br class="example-break" /></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="socket-api"></a>32.4.2. Socket API Reference</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="sose"></a><span class="term"><code class="code">(<a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>port</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:INTERFACE</code>
<code class="constant">:BACKLOG</code>)</code></span></dt><dd><p class="simpara">This function creates a passive socket an binds a
port to it. The server exists to watch for client connection
attempts.</p><p class="simpara">The optional argument is the port to use (non-negative
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>, <code class="literal">0</code> means assigned by the system).</p><p class="simpara">The <code class="constant">:BACKLOG</code> parameter defines maximum
length of queue of pending connections (see
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html"><code class="function">listen</code></a>) and defaults to 1.</p><p class="simpara">The <code class="constant">:INTERFACE</code> parameter specifies the
interface(s) on which the socket server will listen, and is either a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, interpreted as the interface <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> address that will be
bound, or a socket, from whose peer the connections will be made.</p><p class="simpara">Default is (for backward compatibility) to bind to all local
interfaces, but for security reasons it is advisable to bind to
the loopback interface <span class="data"><code class="literal">"127.0.0.1"</code></span> if
you need only local connections.</p></dd><dt><a id="sose-close"></a><span class="term"><code class="code">(<a class="link" href="#sose-close"><code class="function">SOCKET:SOCKET-SERVER-CLOSE</code></a> <em class="replaceable"><code>socket-server</code></em>)</code></span></dt><dd>Closes down the server socket. <a class="link" href="#close" title="21.14. Function CLOSE">Just
like streams</a>, <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>s are closed at <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.
You should not rely on this however, because <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion times are not
deterministic and the port assigned to the server socket cannot be
reused until it is closed.</dd><dt><a id="sose-hopo"></a><span class="term"><code class="code">(<a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-HOST</code></a> <em class="replaceable"><code>socket-server</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#sose-hopo"><code class="function">SOCKET:SOCKET-SERVER-PORT</code></a> <em class="replaceable"><code>socket-server</code></em>)</code></span></dt><dd>Returns the host mask indicating which hosts can
connect to this server and the port which was bound using <a class="link" href="#sose"><code class="function">SOCKET:SOCKET-SERVER</code></a>.
</dd><dt><a id="so-wait"></a><span class="term"><code class="code">(<a class="link" href="#so-wait"><code class="function">SOCKET:SOCKET-WAIT</code></a>
<em class="replaceable"><code>socket-server</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#timeout-opt">[<em class="replaceable"><code>seconds</code></em> [<em class="replaceable"><code>microseconds</code></em>]]</a>)</code></span></dt><dd><a id="timeout-opt"></a>Wait for a fixed time for a
connection on the <em class="replaceable"><code>socket-server</code></em> (a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>).
Without a timeout argument, <a class="link" href="#so-wait"><code class="function">SOCKET:SOCKET-WAIT</code></a> blocks indefinitely.
When timeout is zero, poll.
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> when a connection is available (i.e., <a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a> will
not block) and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on timeout.</dd><dt><a id="so-accept"></a><span class="term"><code class="code">(<a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a> <em class="replaceable"><code>socket-server</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>)</code></span></dt><dd><p class="simpara">Waits for an attempt to connect to the <em class="replaceable"><code>socket-server</code></em> and
creates the server-side <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> for the connection.
</p><p class="simpara"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> if no connection is made in that time.
</p></dd><dt><a id="so-connect"></a><span class="term"><code class="code">(<a class="link" href="#so-connect"><code class="function">SOCKET:SOCKET-CONNECT</code></a>
<em class="replaceable"><code>port</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> [<em class="replaceable"><code>host</code></em>] <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a> <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>)</code></span></dt><dd>Attempts to create a client-side <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a>
<a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>. Blocks until the server accepts the connection, for
no more than <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>. If it is 0, returns immediately
and (probably) blocks on the next i/o operation (you can use
<a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> to check whether it will actually block).
</dd><dt><a id="so-status"></a><span class="term"><code class="code">(<a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a>
<em class="replaceable"><code>socket-stream-or-list</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#timeout-opt">[<em class="replaceable"><code>seconds</code></em> [<em class="replaceable"><code>microseconds</code></em>]]</a>)</code></span></dt><dd><p class="simpara">Checks whether it is possible to read from or write
to a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> or whether a connection is available on a
<a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a> without blocking.</p><p class="simpara">This is similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a>, which checks only one
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and only for input, and <a class="link" href="#so-wait"><code class="function">SOCKET:SOCKET-WAIT</code></a>, which works only with
<a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>s.</p><p class="simpara">We define <em class="replaceable"><code>status</code></em> for a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a> or a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>
to be <code class="constant">:ERROR</code> if <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html"><code class="function">select</code></a> finds an exceptional condition pending
on any of the argument <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s.</p><p class="simpara">Additionally, for a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a>, we define
<em class="replaceable"><code>status</code></em> to be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if a connection is available, i.e.,
is <a class="link" href="#so-accept"><code class="function">SOCKET:SOCKET-ACCEPT</code></a> will not block, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> otherwise.</p><p>Additionally, for a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>, we define <em class="replaceable"><code>status</code></em> in the
given <em class="replaceable"><code>direction</code></em> (one of <code class="constant">:INPUT</code>, <code class="constant">:OUTPUT</code>, and <code class="constant">:IO</code>) to be
</p><div class="variablelist"><a id="so-status-values"></a><p class="title"><strong>Possible status values for various directions:</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term"><code class="constant">:INPUT</code> status:</span></p></td><td><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></p></td><td>reading will block
</td></tr><tr><td><p><span class="term"><code class="constant">:INPUT</code></span></p></td><td>some input is available
</td></tr><tr><td><p><span class="term"><code class="constant">:EOF</code></span></p></td><td>the stream has reached its end
</td></tr></tbody></table></div></td></tr><tr><td><p><span class="term"><code class="constant">:OUTPUT</code> status:</span></p></td><td><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></p></td><td>writing will block
</td></tr><tr><td><p><span class="term"><code class="constant">:OUTPUT</code></span></p></td><td>output to the stream will not block
</td></tr></tbody></table></div></td></tr><tr><td><p><span class="term"><code class="constant">:IO</code> status:</span></p></td><td><div class="informaltable"><a id="so-status-i-o"></a><table class="informaltable" border="1"><colgroup><col align="center" class="out" /><col align="center" class="nil" /><col align="center" class="inp" /><col align="center" class="eof" /></colgroup><thead><tr><th rowspan="2" align="center" valign="bottom">output status</th><th colspan="3" align="center">input status</th></tr><tr><th align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></th><th align="center"><code class="constant">:INPUT</code></th><th align="center"><code class="constant">:EOF</code></th></tr></thead><tbody><tr><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td><td align="center"><code class="constant">:INPUT</code></td><td align="center"><code class="constant">:EOF</code></td></tr><tr><td align="center"><code class="constant">:OUTPUT</code></td><td align="center"><code class="constant">:OUTPUT</code></td><td align="center"><code class="constant">:IO</code></td><td align="center"><code class="constant">:APPEND</code></td></tr></tbody></table></div></td></tr></tbody></table></div><div class="variablelist"><p class="title"><strong>Possible values of
<em class="replaceable"><code>socket-stream-or-list</code></em>:</strong></p><dl class="variablelist"><dt><span class="term"><a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> or <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-SERVER</code></a></span></dt><dd>Returns the appropriate status, as defined
above (<code class="constant">:IO</code> status for <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>)
</dd><dt><span class="term"><code class="code">(<a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a> . <em class="replaceable"><code>direction</code></em>)</code></span></dt><dd>Return the status in the specified direction
</dd><dt><span class="term">a non-empty list of the above</span></dt><dd>Return a list of values, one for each element of the
argument list (a la <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_mapccm_ma_istcm_mapcon.html" target="_top"><code class="function">MAPCAR</code></a>)</dd></dl></div><p class="simpara">If you want to avoid <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#cons">cons</a>ing[3] up a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> list, you can
make the elements of <em class="replaceable"><code>socket-stream-or-list</code></em>
to be <span class="data"><code class="literal">(<em class="replaceable"><code>socket-stream</code></em> <em class="replaceable"><code>direction</code></em> .
<em class="replaceable"><code>x</code></em>)</code></span> or <span class="data"><code class="literal">(<em class="replaceable"><code>socket-server</code></em> . <em class="replaceable"><code>x</code></em>)</code></span>.
Then <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> will destructively modify its argument and replace
<em class="replaceable"><code>x</code></em> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> with the status and return the modified list.
You can pass this modified list to <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> again.</p><p class="simpara">The optional arguments specify the timeout. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> means
wait forever, <code class="literal">0</code> means poll.</p><p class="simpara">The second value returned is the number of objects with
non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> status, i.e., <span class="quote">“<span class="quote">actionable</span>”</span> objects.
<a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> returns either due to a timeout or when this number is
positive, i.e., if the timeout was <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> did
return, then the second value is positive (this is the reason <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
is <span class="strong"><strong>not</strong></span> treated as an empty <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>, but as an invalid
argument).</p><p class="simpara">This is the interface to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html"><code class="function">select</code></a>
(on some platforms, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html"><code class="function">poll</code></a>),
so it will work on any <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> which is based on a
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>, e.g., <a href="impnotes.html#with-kbd" class="olink"><code class="varname">EXT:*KEYBOARD-INPUT*</code></a> and <a class="link" href="#open" title="21.12. Function OPEN">file</a>/<a class="link" href="#pipe" title="32.7.2. Pipes">pipe</a>/<a class="link" href="#socket" title="32.4. Socket Streams">socket</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s, as well as
on <a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw sockets</a>.</p></dd><dt><a id="sost-hopo"></a><span class="term"><code class="code">(<a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-HOST</code></a> <em class="replaceable"><code>socket-stream</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-PORT</code></a> <em class="replaceable"><code>socket-stream</code></em>)</code></span></dt><dd>These two functions return information about the
<a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>.</dd><dt><a id="sost-peer"></a><span class="term"><code class="code">(<a class="link" href="#sost-peer"><code class="function">SOCKET:SOCKET-STREAM-PEER</code></a>
<em class="replaceable"><code>socket-stream</code></em> [<em class="replaceable"><code>do-not-resolve-p</code></em>])</code></span></dt><dd><p class="simpara">Given a <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>, this function returns the
name of the host on the opposite side of the connection and its port
number; the server-side can use this to see who connected.</p><p class="simpara">When the optional second argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the hostname
resolution is disabled and just the <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> address is returned, without
the <acronym class="acronym" title="Fully Qualified Domain Name">FQDN</acronym>.
</p><p class="simpara">The <em class="replaceable"><code>socket-stream</code></em> argument can also be a
<a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw socket</a>.</p></dd><dt><a id="sost-local"></a><span class="term"><code class="code">(<a class="link" href="#sost-local"><code class="function">SOCKET:SOCKET-STREAM-LOCAL</code></a>
<em class="replaceable"><code>socket-stream</code></em> [<em class="replaceable"><code>do-not-resolve-p</code></em>])</code></span></dt><dd><p class="simpara">The dual to <a class="link" href="#sost-peer"><code class="function">SOCKET:SOCKET-STREAM-PEER</code></a> - same information,
host name and port number, but for the local host.
The difference from <a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-HOST</code></a> and <a class="link" href="#sost-hopo"><code class="function">SOCKET:SOCKET-STREAM-PORT</code></a> is that this function
asks the OS (and thus returns the correct trusted values) while the
other two are just accessors to the internal data structure, and
basically return the arguments given to the function which created
the <em class="replaceable"><code>socket-stream</code></em>.</p><p class="simpara">The <em class="replaceable"><code>socket-stream</code></em> argument can also be a
<a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw socket</a>.</p></dd><dt><a id="sost-shut"></a><span class="term"><code class="code">(<a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a> <em class="replaceable"><code>socket-stream</code></em>
<em class="replaceable"><code>direction</code></em>)</code></span></dt><dd><p class="simpara">Some protocols provide for closing the connection
in one <em class="replaceable"><code>direction</code></em> using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html"><code class="function">shutdown</code></a>.
This function provides an interface to this <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> system call.
<em class="replaceable"><code>direction</code></em> should be <code class="constant">:INPUT</code> or <code class="constant">:OUTPUT</code>. Note that you
should still call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> after you are done with your <em class="replaceable"><code>socket-stream</code></em>; this
is best accomplished by using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a>.</p><p>All <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s are <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s (i.e., both <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">INPUT-STREAM-P</code></a>
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">OUTPUT-STREAM-P</code></a> return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for them).
<a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a> <span class="emphasis"><em>breaks</em></span> this and turns its argument
stream into an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (if <em class="replaceable"><code>direction</code></em> is <code class="constant">:OUTPUT</code>) or <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (if
<em class="replaceable"><code>direction</code></em> is <code class="constant">:INPUT</code>).
Thus, the following important invariant is preserved: whenever
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> is open
(i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open-stream-p.html" target="_top"><code class="function">OPEN-STREAM-P</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>) and</li><li class="listitem">a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> is an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (i.e., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_input-str_put-stream-p.html" target="_top"><code class="function">INPUT-STREAM-P</code></a>
returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</li></ul></div><p>
the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> can be read from (e.g., with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-byte.html" target="_top"><code class="function">READ-BYTE</code></a>).
</p><p class="simpara">The <em class="replaceable"><code>socket-stream</code></em> argument can also be a
<a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw socket</a>.</p></dd><dt><a id="so-opt"></a><span class="term"><code class="code">(<a class="link" href="#so-opt"><code class="function">SOCKET:SOCKET-OPTIONS</code></a> <em class="replaceable"><code>socket-server</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>
{<em class="replaceable"><code>option</code></em>}*)</code></span></dt><dd><p class="simpara">Query and, optionally, set socket options using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html"><code class="function">getsockopt</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html"><code class="function">setsockopt</code></a>.
An <em class="replaceable"><code>option</code></em> is a keyword, optionally followed by the new value.
When the new value is not supplied, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html"><code class="function">setsockopt</code></a> is not called.
For each option the old (or current, if new value was not supplied)
value is returned. E.g., <code class="code">(<a class="link" href="#so-opt"><code class="function">SOCKET:SOCKET-OPTIONS</code></a> <em class="replaceable"><code>socket-server</code></em>
:SO-LINGER 1 :SO-RCVLOWAT)</code> returns 2 values: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the old
value of the <code class="constant">:SO-LINGER</code> option, and 1, the
current value of the <code class="constant">:SO-RCVLOWAT</code> option.
</p><p class="simpara">The <em class="replaceable"><code>socket-stream</code></em> argument can also be a
<a class="link" href="#rawsock" title="33.17. Raw Socket Access">raw socket</a>.</p></dd><dt><a id="st-handles"></a><span class="term"><code class="code">(<a class="link" href="#st-handles"><code class="function">EXT:STREAM-HANDLES</code></a>
<em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>Return the input and output OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s of the
<em class="replaceable"><code>stream</code></em> as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>. See <a class="xref" href="#rawsock" title="33.17. Raw Socket Access">Section 33.17, “Raw Socket Access”</a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="timeout-k"></a>32.4.3. Argument <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a></h3></div></div></div><p>The <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> argument specifies the number of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a> to wait for
an event. The value may be a</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">a non-negative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> or</li><li class="listitem">a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> <span class="data"><code class="literal">(sec usec)</code></span>
or</li><li class="listitem">a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> cell <span class="data"><code class="literal">(sec .
usec)</code></span>.</li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="mt"></a>32.5. Multiple Threads of Execution</h2></div><div><h3 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep">Only in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> built <span class="strong"><strong>with</strong></span>
configure-time flag <code class="option">--with-threads</code>.</span></span></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mt-intro">32.5.1. Introduction</a></span></dt><dt><span class="section"><a href="#mt-general">32.5.2. General principles</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-parallelizability">32.5.2.1. Parallelizability</a></span></dt><dt><span class="section"><a href="#mt-symvalue">32.5.2.2. Special Variable Values</a></span></dt><dt><span class="section"><a href="#mt-package">32.5.2.3. Packages</a></span></dt><dt><span class="section"><a href="#mt-clos">32.5.2.4. <span class="command"><strong>CLOS</strong></span></a></span></dt><dt><span class="section"><a href="#mt-mutable">32.5.2.5. Hash Tables, Sequences, and other mutable objects</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-random">32.5.2.5.1. <code class="function">RANDOM</code> and <code class="classname">RANDOM-STATE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mt-unsafe">32.5.2.6. Examples of thread-unsafe code</a></span></dt></dl></dd><dt><span class="section"><a href="#mt-api">32.5.3. Thread API reference</a></span></dt></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>This functionality is <span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span>.</p><p>Use it at your own risk.</p><p>Discuss it on <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mt-intro"></a>32.5.1. Introduction</h3></div></div></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses the OS threads to implement multiple threads of execution.
Two flavors are supported: <a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> and <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>. Both are preemptive.</p><p>All symbols are exported from the package <a class="link" href="#mt" title="32.5. Multiple Threads of Execution"><strong class="package"><span class="quote">“<span class="quote">THREADS</span>”</span></strong></a>, which has nicknames
<strong class="package"><span class="quote">“<span class="quote">MT</span>”</span></strong> (for <span class="emphasis"><em>MultiThreading</em></span>) and
<strong class="package"><span class="quote">“<span class="quote">MP</span>”</span></strong> (for <span class="emphasis"><em>MultiProcessing</em></span>).
When this functionality is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:MT</code>.</p><p>See also <a class="xref" href="#gc-mt" title="35.8. Garbage Collection and Multithreading">Section 35.8, “Garbage Collection and Multithreading”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mt-general"></a>32.5.2. General principles</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mt-parallelizability">32.5.2.1. Parallelizability</a></span></dt><dt><span class="section"><a href="#mt-symvalue">32.5.2.2. Special Variable Values</a></span></dt><dt><span class="section"><a href="#mt-package">32.5.2.3. Packages</a></span></dt><dt><span class="section"><a href="#mt-clos">32.5.2.4. <span class="command"><strong>CLOS</strong></span></a></span></dt><dt><span class="section"><a href="#mt-mutable">32.5.2.5. Hash Tables, Sequences, and other mutable objects</a></span></dt><dd><dl><dt><span class="section"><a href="#mt-random">32.5.2.5.1. <code class="function">RANDOM</code> and <code class="classname">RANDOM-STATE</code></a></span></dt></dl></dd><dt><span class="section"><a href="#mt-unsafe">32.5.2.6. Examples of thread-unsafe code</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-parallelizability"></a>32.5.2.1. Parallelizability</h4></div></div></div><p>A program developed for a single-threaded world which shares no
application objects with programs running in other threads must run
fine, without problems.</p><p>Specfically:
if, in a single-threaded world, execution of program A before program B
produces semantically the same results as execution of program B before
program A, then in a multithreaded world, it is possible to run A and B
simultaneously in different threads, and the result will be the same as
in the two single-threaded cases (A before B, or B before A).
</p><div class="itemizedlist"><p class="title"><strong>Summary</strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If A and B have no common objects, then the
implementation ensures that the principle is fulfilled.</li><li class="listitem">If A and B share some objects, the implementation
allows the programs to satisfy the principle with little effort.
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-symvalue"></a>32.5.2.2. Special Variable Values</h4></div></div></div><p>Every <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a> has a global value that can be shared across all
<a class="link" href="#thread"><span class="type">MT:THREAD</span></a>s.</p><p>Bindings of <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-2-1-1-2.html">dynamic variable</a>s (via <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET*</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_multiple-value-bind.html" target="_top"><code class="function">MULTIPLE-VALUE-BIND</code></a>)
are local to <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>s, i.e. every <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> has a different value cell in
each <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>. <a class="link" href="#symbol-value-thread"><code class="function">MT:SYMBOL-VALUE-THREAD</code></a> can be used to inspect and modify
these thread local bindings.</p><p>Threads do not inherit dynamic bindings from the parent thread.</p><p>Example:</p><pre class="programlisting">
(defvar *global* 1)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">create a <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a></span></em>
(defun thread-1 ()
<strong> ; </strong><em class="lineannotation"><span class="lineannotation">here *global* and (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-value.html" target="_top"><code class="function">SYMBOL-VALUE</code></a> *global*) will be 1 not 2!</span></em>
(setq *global* 5)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">change the <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a> value</span></em>
(let ((*global* 10))<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> value is initialized</span></em>
(setq *global* 20)<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> value is changed</span></em>
<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a> value is not accessible here (only via <a class="link" href="#symbol-value-thread"><code class="function">MT:SYMBOL-VALUE-THREAD</code></a>)</span></em>
)
(setq *global* 30))<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a> value is modified again</span></em>
(let ((*global* 2))<strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> value is initialized</span></em>
(<a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a> #'thread-1))
</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-package"></a>32.5.2.3. Packages</h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Locking discussed in this section has nothing to do with
<a class="link" href="#pack-lock" title="11.2. Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2"><code class="function">EXT:PACKAGE-LOCK</code></a>.</p></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a> objects have an internal <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a> and are locked by
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_intern.html" target="_top"><code class="function">INTERN</code></a> before adding a symbol (if <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_find-symbol.html" target="_top"><code class="function">FIND-SYMBOL</code></a> fails). All
modifications of internal package data are guarded by this <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a>.</p><p>While iterating over package symbols with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-SYMBOLS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-EXTERNAL-SYMBOLS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_do-symbol_-all-symbols.html" target="_top"><code class="function">DO-ALL-SYMBOLS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-package-iterator.html" target="_top"><code class="function">WITH-PACKAGE-ITERATOR</code></a>
or the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_6-1-2-1-7.html">for-as-package
subclause</a> the package being iterated over is also locked.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-clos"></a>32.5.2.4. <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a></h4></div><div><h5 class="subtitle">This information is likely to change in the near future</h5></div></div></div><p><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> is <span class="strong"><strong>not</strong></span> thread-safe. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a> modify <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> without any locking and may
interfere with each other.</p><p>It is recommended that all code is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_load.html" target="_top"><code class="function">LOAD</code></a>ed <span class="strong"><strong>before</strong></span>
any <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>s are spawned.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-mutable"></a>32.5.2.5. Hash Tables, Sequences, and other
mutable objects</h4></div><div><h5 class="subtitle">If you want to shoot yourself, it is <span class="emphasis"><em>your</em></span>
responsibility to wear armor.</h5></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#mt-random">32.5.2.5.1. <code class="function">RANDOM</code> and <code class="classname">RANDOM-STATE</code></a></span></dt></dl></div><p>Nothing is ever locked automatically (automatic locking will
impose an unjustifiable penalty on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a>s
local to threads), so the user must use locks when sharing
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a>s and user-defined mutable objects between
threads.</p><p>This approach is consistent with the usual <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> approach:
</p><div class="blockquote"><table border="0" class="blockquote" style="width: 100%; cellspacing: 0; cellpadding: 0;" summary="Block quote"><tr><td width="10%" valign="top"> </td><td width="80%" valign="top"><p>The consequences are undefined when code executed during an
object-traversing operation destructively modifies the object in a
way that might affect the ongoing traversal operation...
</p></td><td width="10%" valign="top"> </td></tr><tr><td width="10%" valign="top"> </td><td colspan="2" align="right" valign="top">--<span class="attribution"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-6.html">[sec_3-6]</a></span></td></tr></table></div><p>
</p><div class="blockquote"><table border="0" class="blockquote" style="width: 100%; cellspacing: 0; cellpadding: 0;" summary="Block quote"><tr><td width="10%" valign="top"> </td><td width="80%" valign="top"><p>If an object O1 is used as a key in a hash table H and is then
visibly modified with regard to the equivalence test of H, then the
consequences are unspecified if O1 is used as a key in further
operations on H...</p></td><td width="10%" valign="top"> </td></tr><tr><td width="10%" valign="top"> </td><td colspan="2" align="right" valign="top">--<span class="attribution"><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_18-1-2.html">[sec_18-1-2]</a></span></td></tr></table></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="mt-random"></a>32.5.2.5.1. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_random-state.html" target="_top"><code class="classname">RANDOM-STATE</code></a></h5></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> modifies a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_random-state.html" target="_top"><code class="classname">RANDOM-STATE</code></a> <span class="strong"><strong>without</strong></span> locking, which
means that you <span class="strong"><strong>cannot</strong></span> carelessly share such objects between threads.
However, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a> is bound per-thread (see <a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a> and
<a class="link" href="#default-special-bindings"><code class="varname">MT:*DEFAULT-SPECIAL-BINDINGS*</code></a>), i.e., each thread has its own value and
thus <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> <span class="strong"><strong>is</strong></span> thread-safe.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="mt-unsafe"></a>32.5.2.6. Examples of thread-unsafe code</h4></div></div></div><p>Here are some forms whose results are undefined if two threads
evaluate them without locking:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_incfcm_decf.html" target="_top"><code class="function">INCF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> x global-ht 0))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">see <a class="xref" href="#mt-mutable" title="32.5.2.5. Hash Tables, Sequences, and other mutable objects">Section 32.5.2.5, “Hash Tables, Sequences, and other mutable objects”</a></span></em>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_aref.html" target="_top"><code class="function">AREF</code></a> global-array ...) ...)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">ditto</span></em>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a> <em class="replaceable"><code>generic-function</code></em> (...) ...)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">see <a class="xref" href="#mt-clos" title="32.5.2.4. CLOS">Section 32.5.2.4, “<span class="command"><strong>CLOS</strong></span>”</a></span></em>
</pre><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The above code may result in a segfault!</p><p>This is the reason why the multithreading support is still
<span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span>. However, if you do not share global <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s
between your threads and define all your <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> methods <span class="strong"><strong>before</strong></span>
spawning threads, multithreading should work fine.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mt-api"></a>32.5.3. Thread API reference</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="thread"></a><span class="term"><a class="link" href="#thread"><span class="type">MT:THREAD</span></a></span></dt><dd><p class="simpara">The type of the object returned by <a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a>.</p><p class="simpara">Each <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> represent a separate computation, executed in
parallel to each other.</p></dd><dt><a id="make-thread"></a><span class="term"><code class="code">(<a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a> <em class="replaceable"><code>function</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:NAME</code> :INITIAL-BINDINGS :CSTACK-SIZE :VSTACK-SIZE)</code></span></dt><dd><p class="simpara">Start a new named <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> running <em class="replaceable"><code>function</code></em>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:INITIAL-BINDINGS</code></span></dt><dd><p class="simpara">an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> of <span class="data"><code class="literal">(<em class="replaceable"><code>symbol</code></em>
. <em class="replaceable"><code>form</code></em>)</code></span>.
The <em class="replaceable"><code>form</code></em>s are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eval.html" target="_top"><code class="function">EVAL</code></a>uated in the context of the new thread
and <em class="replaceable"><code>symbol</code></em>s are bound to the result in the thread before <em class="replaceable"><code>function</code></em> is
called. The default value is <a class="link" href="#default-special-bindings"><code class="varname">MT:*DEFAULT-SPECIAL-BINDINGS*</code></a>.</p><p class="simpara">The main purpose of this argument is to initialize some
global data that should not be shared between threads, e.g.,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_strandom-statest.html" target="_top"><code class="varname">*RANDOM-STATE*</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_streadtablest.html" target="_top"><code class="varname">*READTABLE*</code></a>.</p><p class="simpara">When using <code class="constant">:INITIAL-BINDINGS</code> it is
best to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a> the application-specific data in front of
<a class="link" href="#default-special-bindings"><code class="varname">MT:*DEFAULT-SPECIAL-BINDINGS*</code></a> or copy and modify it to fit the
application needs.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>When the same <em class="replaceable"><code>symbol</code></em> appears in this <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> multiple
times, the <span class="emphasis"><em>first</em></span> occurrence determines the value.
</p></div></dd><dt><span class="term"><code class="constant">:CSTACK-SIZE</code></span></dt><dd>the size in bytes of the control (<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>) stack.
If 0, the value is decided by the OS.</dd><dt><span class="term"><code class="constant">:VSTACK-SIZE</code></span></dt><dd>the size of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> in <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s.
The default value is calculated based on the <code class="option"><a href="clisp.html#opt-memsize" class="olink">-m</a></code> option
used when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was started.
If 0, the value will be the same as that of the calling thread.
</dd></dl></div><p class="simpara">If <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> creation fails (e.g., due to a lack of system
memory), a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_control-error.html" target="_top"><code class="classname">CONTROL-ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_create.html"><code class="function">pthread_create</code></a>.</p></dd><dt><a id="threadp"></a><span class="term"><code class="code">(<a class="link" href="#threadp"><code class="function">MT:THREADP</code></a> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>Check whether the object is of type <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>.
</dd><dt><a id="thread-yield"></a><span class="term"><code class="code">(<a class="link" href="#thread-yield"><code class="function">MT:THREAD-YIELD</code></a> <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd><p class="simpara">Relinquish the CPU. The <em class="replaceable"><code>thread</code></em> is placed at the end
of the run queue and another thread is scheduled to run.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sched_yield.html"><code class="function">sched_yield</code></a>.</p></dd><dt><a id="thread-interrupt"></a><span class="term"><code class="code">(<a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> <em class="replaceable"><code>thread</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:FUNCTION</code> <code class="constant">:OVERRIDE</code> <code class="constant">:ARGUMENTS</code>)</code></span></dt><dd><p class="simpara">Interrupt the normal execution flow in <em class="replaceable"><code>thread</code></em> and ask
it to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> <em class="replaceable"><code>function</code></em> to <em class="replaceable"><code>arguments</code></em>.</p><p class="simpara">Use <code class="code">(<a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> <em class="replaceable"><code>thread</code></em> <code class="constant">:FUNCTION</code> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code>
to debug <em class="replaceable"><code>thread</code></em> and <code class="code">(<a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> <em class="replaceable"><code>thread</code></em> <code class="constant">:FUNCTION</code>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code> to terminate <em class="replaceable"><code>thread</code></em>.</p><p class="simpara">The <code class="constant">:OVERRIDE</code> argument overrides <a class="link" href="#with-deferred-interrupts"><code class="function">MT:WITH-DEFERRED-INTERRUPTS</code></a>
and should be used with extreme care.</p><p class="simpara">Threads can only be interrupted at a point where the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion
can run, see <a class="xref" href="#gc-mt" title="35.8. Garbage Collection and Multithreading">Section 35.8, “Garbage Collection and Multithreading”</a>.</p><p class="simpara">Currently on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> blocking I/O cannot be interrupted.
The interrupt will be handled after the call returns.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Thread may be interrupted inside <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>'s
cleanup forms and on non-local exit from <em class="replaceable"><code>function</code></em> -
they may not execute entirely. In order to prevent this,
<a class="link" href="#with-deferred-interrupts"><code class="function">MT:WITH-DEFERRED-INTERRUPTS</code></a> is provided.</p></div></dd><dt><a id="thread-name"></a><span class="term"><code class="code">(<a class="link" href="#thread-name"><code class="function">MT:THREAD-NAME</code></a> <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd>Return the <em class="replaceable"><code>name</code></em> of the <em class="replaceable"><code>thread</code></em>.
</dd><dt><a id="thread-active-p"></a><span class="term"><code class="code">(<a class="link" href="#thread-active-p"><code class="function">MT:THREAD-ACTIVE-P</code></a>
<em class="replaceable"><code>thread</code></em>)</code></span></dt><dd><p class="simpara">Return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if the thread has already terminated
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> otherwise.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>By the time this function returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, <em class="replaceable"><code>thread</code></em> may have
already terminated anyway.</p></div></dd><dt><a id="current-thread"></a><span class="term"><code class="code">(<a class="link" href="#current-thread"><code class="function">MT:CURRENT-THREAD</code></a>)</code></span></dt><dd>Return the <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> object encapsulating the caller.
</dd><dt><a id="list-threads"></a><span class="term"><code class="code">(<a class="link" href="#list-threads"><code class="function">MT:LIST-THREADS</code></a>)</code></span></dt><dd><p class="simpara">Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of all currently running <a class="link" href="#thread"><span class="type">MT:THREAD</span></a>s.
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>By the time this function returns, the set of
actually running threads may have a single intersection with the
return value - the <a class="link" href="#current-thread"><code class="function">MT:CURRENT-THREAD</code></a>.
</p></div></dd><dt><a id="mutex"></a><span class="term"><a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a></span></dt><dd><p class="simpara">The type of the object return by <a class="link" href="#make-mutex"><code class="function">MT:MAKE-MUTEX</code></a>.</p><p class="simpara">This represents a <span class="emphasis"><em>lock</em></span>, i.e., a way to
prevent different threads from doing something at the same time,
e.g., modifying the same object.</p></dd><dt><a id="mutexp"></a><span class="term"><code class="code">(<a class="link" href="#mutexp"><code class="function">MT:MUTEXP</code></a> <em class="replaceable"><code>object</code></em>)</code></span></dt><dd>Check whether the object is of type <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a>.
</dd><dt><a id="make-mutex"></a><span class="term"><code class="code">(<a class="link" href="#make-mutex"><code class="function">MT:MAKE-MUTEX</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:NAME</code> <code class="constant">:RECURSIVE-P</code>)</code></span></dt><dd><p class="simpara">Create new <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a> object - not locked by any thread.
<code class="constant">:NAME</code> should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> describing the mutex (this really helps
debugging deadlocks). When <em class="replaceable"><code>RECURSIVE-P</code></em> is
non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, a recursive <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a> is created i.e., a thread can acquire
the mutex repeatedly (and should, of course, release it for each
successful acquisition).</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_init.html"><code class="function">pthread_mutex_init</code></a>.</p></dd><dt><a id="mutex-name"></a><span class="term"><code class="code">(<a class="link" href="#mutex-name"><code class="function">MT:MUTEX-NAME</code></a> <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd>Return the <em class="replaceable"><code>name</code></em> of the <a class="link" href="#mutex"><span class="type">MT:MUTEX</span></a>.
</dd><dt><a id="mutex-lock"></a><span class="term"><code class="code">(<a class="link" href="#mutex-lock"><code class="function">MT:MUTEX-LOCK</code></a> <em class="replaceable"><code>mutex</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>)</code></span></dt><dd><p class="simpara">Acquire the <em class="replaceable"><code>mutex</code></em>. If <em class="replaceable"><code>mutex</code></em> is locked by
another thread, the call blocks and waits up to <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>.
If <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> is not specified, waits forever.</p><p class="simpara">Return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> on a successful locking of <em class="replaceable"><code>mutex</code></em>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on
timeout.</p><p>If the calling thread has already acquired <em class="replaceable"><code>mutex</code></em>, then
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">if <em class="replaceable"><code>mutex</code></em> is recursive, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> is
returned (for each recursive <a class="link" href="#mutex-lock"><code class="function">MT:MUTEX-LOCK</code></a> there should be a
separate <a class="link" href="#mutex-unlock"><code class="function">MT:MUTEX-UNLOCK</code></a>);</li><li class="listitem">If <em class="replaceable"><code>mutex</code></em> is non-recursive an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed to
avoid a deadlock.</li></ul></div><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html"><code class="function">pthread_mutex_lock</code></a>.</p></dd><dt><a id="mutex-unlock"></a><span class="term"><code class="code">(<a class="link" href="#mutex-unlock"><code class="function">MT:MUTEX-UNLOCK</code></a>
<em class="replaceable"><code>mutex</code></em>)</code></span></dt><dd><p class="simpara">Release (unlock) <em class="replaceable"><code>mutex</code></em>. If the calling thread is
not locking <em class="replaceable"><code>mutex</code></em>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_unlock.html"><code class="function">pthread_mutex_unlock</code></a>.</p></dd><dt><a id="mutex-owner"></a><span class="term"><code class="code">(<a class="link" href="#mutex-owner"><code class="function">MT:MUTEX-OWNER</code></a>
<em class="replaceable"><code>mutex</code></em>)</code></span></dt><dd><p class="simpara">Return the <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> that owns (locks) <em class="replaceable"><code>mutex</code></em>,
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <em class="replaceable"><code>mutex</code></em> is not locked.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>By the time this function returns the <em class="replaceable"><code>mutex</code></em>
ownership may have changed (unless the owner is the
<a class="link" href="#current-thread"><code class="function">MT:CURRENT-THREAD</code></a>). The function is mostly useful for debugging
deadlocks.</p></div></dd><dt><a id="mutex-recursive-p"></a><span class="term"><code class="code">(<a class="link" href="#mutex-recursive-p"><code class="function">MT:MUTEX-RECURSIVE-P</code></a>
<em class="replaceable"><code>mutex</code></em>)</code></span></dt><dd>Return a indicator whether <em class="replaceable"><code>mutex</code></em> is recursive.
</dd><dt><a id="with-mutex-lock"></a><span class="term"><code class="code">(<a class="link" href="#with-mutex-lock"><code class="function">MT:WITH-MUTEX-LOCK</code></a> (<em class="replaceable"><code>mutex</code></em>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Execute <em class="replaceable"><code>body</code></em> with <em class="replaceable"><code>mutex</code></em> locked.
Upon exit <em class="replaceable"><code>mutex</code></em> is released. Return whatever <em class="replaceable"><code>body</code></em> returns.
</dd><dt><a id="exemption"></a><span class="term"><a class="link" href="#exemption"><span class="type">MT:EXEMPTION</span></a></span></dt><dd><p class="simpara">The type of the object returned by <a class="link" href="#make-exemption"><code class="function">MT:MAKE-EXEMPTION</code></a>.
These correspond to the <a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> condition variables,
see <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html"><<code class="filename">pthread.h</code>></a>.</p><p class="simpara">These objects allow broadcasting state from one <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> to
the others.</p></dd><dt><a id="exemptionp"></a><span class="term"><code class="code">(<a class="link" href="#exemptionp"><code class="function">MT:EXEMPTIONP</code></a>
<em class="replaceable"><code>object</code></em>)</code></span></dt><dd>Check whether the object is of type <a class="link" href="#exemption"><span class="type">MT:EXEMPTION</span></a>.
</dd><dt><a id="make-exemption"></a><span class="term"><code class="code">(<a class="link" href="#make-exemption"><code class="function">MT:MAKE-EXEMPTION</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:NAME</code>)</code></span></dt><dd><p class="simpara">Create a new <a class="link" href="#exemption"><span class="type">MT:EXEMPTION</span></a> object.
<code class="constant">:NAME</code> should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> describing the exemption (this really
helps debugging deadlocks).</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_init.html"><code class="function">pthread_cond_init</code></a>.</p></dd><dt><a id="exemption-name"></a><span class="term"><code class="code">(<a class="link" href="#exemption-name"><code class="function">MT:EXEMPTION-NAME</code></a>
<em class="replaceable"><code>exemption</code></em>)</code></span></dt><dd>Return the <em class="replaceable"><code>name</code></em> of the <em class="replaceable"><code>exemption</code></em>.
</dd><dt><a id="exemption-signal"></a><span class="term"><code class="code">(<a class="link" href="#exemption-signal"><code class="function">MT:EXEMPTION-SIGNAL</code></a>
<em class="replaceable"><code>exemption</code></em>)</code></span></dt><dd><p class="simpara">Signal <em class="replaceable"><code>exemption</code></em> object, i.e. wake up a thread blocked
on waiting for <em class="replaceable"><code>exemption</code></em>.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_signal.html"><code class="function">pthread_cond_signal</code></a>.</p></dd><dt><a id="exemption-wait"></a><span class="term"><code class="code">(<a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a>
<em class="replaceable"><code>exemption</code></em> <em class="replaceable"><code>mutex</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> <code class="constant">:TEST</code>)</code></span></dt><dd><p class="simpara">Wait for another <a class="link" href="#thread"><span class="type">MT:THREAD</span></a> to call <a class="link" href="#exemption-signal"><code class="function">MT:EXEMPTION-SIGNAL</code></a>
or <a class="link" href="#exemption-broadcast"><code class="function">MT:EXEMPTION-BROADCAST</code></a> on <em class="replaceable"><code>exemption</code></em>.
<em class="replaceable"><code>mutex</code></em> should be locked by the caller; otherwise an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
The function releases the <em class="replaceable"><code>mutex</code></em> and waits for <em class="replaceable"><code>exemption</code></em>.
On return <em class="replaceable"><code>mutex</code></em> is acquired again.</p><p class="simpara">When using exemptions there is always a boolean <em class="replaceable"><code>predicate</code></em> involving
shared variables associated with each exemption wait that is true if the
thread should proceed.</p><p class="simpara">The function waits up to <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>.
If timeout is not specified, waits forever.</p><p class="simpara">
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <em class="replaceable"><code>exemption</code></em> was signaled and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on timeout.</p><p>On <a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> it is possible to have
<a class="ulink" href="http://en.wikipedia.org/wiki/Spurious_wakeup" target="_top">spurious
wakeup</a>s, i.e., this function may return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> even though no
thread called <a class="link" href="#exemption-broadcast"><code class="function">MT:EXEMPTION-BROADCAST</code></a> or <a class="link" href="#exemption-signal"><code class="function">MT:EXEMPTION-SIGNAL</code></a>.
Therefore, a common idiom for using this function is: <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a>
:until (<em class="replaceable"><code>predicate</code></em>) :do (<a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> <em class="replaceable"><code>exemption</code></em> <em class="replaceable"><code>mutex</code></em>))</code></p><p class="simpara">The <code class="constant">:TEST</code> argument simplifies this. When supplied,
<a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> returns when either <code class="constant">:TEST</code> <em class="replaceable"><code>predicate</code></em> is satisfied
(always called while <em class="replaceable"><code>mutex</code></em> is held) or when <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a> elapses.
The above loop is equivalent to: <code class="code">(<a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> <em class="replaceable"><code>exemption</code></em>
<em class="replaceable"><code>mutex</code></em> <code class="constant">:TEST</code> #'<em class="replaceable"><code>predicate</code></em>)</code>.
When <code class="constant">:TEST</code> is supplied, <a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> when <em class="replaceable"><code>exemption</code></em> was
signaled and <code class="constant">:TEST</code> <em class="replaceable"><code>predicate</code></em> is satisfied and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> on timeout.
</p><p class="simpara">This is the preferred and most portable way to wait on
an exemption.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_wait.html"><code class="function">pthread_cond_wait</code></a>.</p></dd><dt><a id="exemption-broadcast"></a><span class="term"><code class="code">(<a class="link" href="#exemption-broadcast"><code class="function">MT:EXEMPTION-BROADCAST</code></a>
<em class="replaceable"><code>exemption</code></em>)</code></span></dt><dd><p class="simpara">Signal <em class="replaceable"><code>exemption</code></em> to all threads waiting for it.</p><p class="simpara">Cf. <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_broadcast.html"><code class="function">pthread_cond_broadcast</code></a>.
</p></dd><dt><a id="y-or-n-p-timeout"></a><span class="term"><code class="code">(<a class="link" href="#y-or-n-p-timeout"><code class="function">MT:Y-OR-N-P-TIMEOUT</code></a>
seconds default <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>arguments</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#y-or-n-p-timeout"><code class="function">MT:YES-OR-NO-P-TIMEOUT</code></a> seconds default <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>
<em class="replaceable"><code>arguments</code></em>)</code></span></dt><dd>Similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_y-or-n-pcm_yes-or-no-p.html" target="_top"><code class="function">Y-OR-N-P</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_y-or-n-pcm_yes-or-no-p.html" target="_top"><code class="function">YES-OR-NO-P</code></a>, but use
<a class="link" href="#with-timeout"><code class="function">MT:WITH-TIMEOUT</code></a> to return <em class="replaceable"><code>DEFAULT</code></em> when no
reply is given within timeout <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>.</dd><dt><a id="with-timeout"></a><span class="term"><code class="code">(<a class="link" href="#with-timeout"><code class="function">MT:WITH-TIMEOUT</code></a>
(seconds <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> timeout-forms) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">Execute <em class="replaceable"><code>body</code></em>. If it does not finish for up to
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-4.html">seconds</a>, it is interrupted and <em class="replaceable"><code>timeout-forms</code></em>
are executed.</p><p class="simpara">Return the values of the last evaluated form in either
<em class="replaceable"><code>body</code></em> or <em class="replaceable"><code>timeout-forms</code></em>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Since on timeout the current thread is interrupted,
special care may be needed for ensuring proper cleanup in <em class="replaceable"><code>body</code></em>.
See <a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a> and <a class="link" href="#with-deferred-interrupts"><code class="function">MT:WITH-DEFERRED-INTERRUPTS</code></a>.</p></div></dd><dt><a id="symbol-value-thread"></a><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>
(<a class="link" href="#symbol-value-thread"><code class="function">MT:SYMBOL-VALUE-THREAD</code></a> <em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>thread</code></em>) <em class="replaceable"><code>value</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#symbol-value-thread"><code class="function">MT:SYMBOL-VALUE-THREAD</code></a> <em class="replaceable"><code>symbol</code></em> <em class="replaceable"><code>thread</code></em>)</code></span></dt><dd>Access or set the <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> value.
When <em class="replaceable"><code>thread</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, use the <a class="link" href="#current-thread"><code class="function">MT:CURRENT-THREAD</code></a>; if it is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, use the
<a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Global Variable</em></span></a> binding.
Returns two values: the <em class="replaceable"><code>symbol</code></em> binding and an indicator: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if
not bound in the <em class="replaceable"><code>thread</code></em>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if bound, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_makunbound.html" target="_top"><code class="function">MAKUNBOUND</code></a> if
the <a class="link" href="#mt-symvalue" title="32.5.2.2. Special Variable Values"><span class="emphasis"><em>Per-Thread Variable</em></span></a> binding was removed with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_makunbound.html" target="_top"><code class="function">MAKUNBOUND</code></a>.
</dd><dt><a id="default-special-bindings"></a><span class="term"><a class="link" href="#default-special-bindings"><code class="varname">MT:*DEFAULT-SPECIAL-BINDINGS*</code></a></span></dt><dd>The default <code class="constant">:INITIAL-BINDINGS</code>
argument of <a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a>.</dd><dt><a id="with-deferred-interrupts"></a><span class="term">
<code class="code">(<a class="link" href="#with-deferred-interrupts"><code class="function">MT:WITH-DEFERRED-INTERRUPTS</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">Defer thread interrupts (but <span class="strong"><strong>not</strong></span> thread
preemption) while <em class="replaceable"><code>body</code></em> is executed. If there is an interrupt
while <em class="replaceable"><code>body</code></em> is run, it is queued and will be executed after
<em class="replaceable"><code>body</code></em> finishes.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Care is needed if waiting or blocking in <em class="replaceable"><code>body</code></em>,
since there is no way to interrupt it (in case of a deadlock).
The macro was added to avoid partial <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>'s cleanup
forms evaluation in case they are interrupted with a non-local exit.
</p></div></dd><dt><a id="thread-join"></a><span class="term"><code class="code">(<a class="link" href="#thread-join"><code class="function">MT:THREAD-JOIN</code></a> <em class="replaceable"><code>thread</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>)</code></span></dt><dd><p class="simpara">Wait for <em class="replaceable"><code>thread</code></em> to terminate and return two values:
<em class="replaceable"><code>thread</code></em>'s <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a> as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> and a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> indicator of whether <em class="replaceable"><code>thread</code></em>
finished normally or has been interrupted with <a class="link" href="#thread-interrupt"><code class="function">MT:THREAD-INTERRUPT</code></a>.</p><p class="simpara">This function uses <a class="link" href="#exemption-wait"><code class="function">MT:EXEMPTION-WAIT</code></a> (and <span class="strong"><strong>not</strong></span>
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_join.html"><code class="function">pthread_join</code></a>), so there are no resource
leaks normally associated with this function.</p><p class="simpara">On timeout, return <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and <a class="link" href="#timeout-k" title="32.4.3. Argument :TIMEOUT"><code class="constant">:TIMEOUT</code></a>.</p><p class="simpara">This function can be used repeatedly on the same thread,
so this is the usual way to access the return values of a finished
thread.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="quickstart"></a>32.6. Quickstarting delivery with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#quickstart-summary">32.6.1. Summary</a></span></dt><dt><span class="section"><a href="#quickstart-unix">32.6.2. Scripting with <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#quickstart-desktop">32.6.3. Desktop Environments</a></span></dt><dt><span class="section"><a href="#quickstart-linux">32.6.4. Associating extensions with <span class="command"><strong>CLISP</strong></span> via kernel</a></span></dt></dl></div><p>This section describes three ways to turn <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> programs into
executable programs, which can be started as quickly as executables
written in other languages.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="quickstart-summary"></a>32.6.1. Summary</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can act as a script interpreter.
</dd><dt><span class="term">Desktop environments such as <a class="ulink" href="http://www.kde.org/" target="_top"><span class="platform">KDE</span></a>, <a class="ulink" href="http://www.gnome.org/" target="_top"><span class="platform">Gnome</span></a>,
<a class="ulink" href="http://www.apple.com/macosx/" target="_top"><span class="platform">Mac OS X</span></a> or <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</span></dt><dd>Files created with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can be associated with
the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> executable so that clicking on them would make <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
execute the appropriate code.</dd><dt><span class="term"><a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> kernel with
<code class="option">CONFIG_BINFMT_MISC=y</code></span></dt><dd>Associate the extensions <code class="filename">#P".fas"</code>
and <code class="filename">#P".lisp"</code> with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>; then you can make the
files executable and run them from the command line.
</dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="quickstart-multifile"></a>Multi-file applications</h3><p>These three techniques apply to a single <code class="filename">#P".lisp"</code> or
<code class="filename">#P".fas"</code> file. If your application is made up of several
<code class="filename">#P".lisp"</code> or <code class="filename">#P".fas"</code> files, you can simply concatenate them
(using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cat.html"><span class="command"><strong>cat</strong></span></a>) into one file; the
techniques then apply to that concatenated file.</p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="quickstart-lispless"></a>Lisp-less target</h3><p>These three techniques assume that the target machine has <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
pre-installed and thus you can deliver just your own application, not
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> itself. If you want to deliver applications without assuming
anything about your target box, you have to resort to creating
executable <a href="impnotes.html#image" class="olink">memory image</a>s.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="quickstart-unix"></a>32.6.2. Scripting with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></h4></div></div></div><p>On <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, a text file (<code class="filename">#P".fas"</code> or <code class="filename">#P".lisp"</code>) can
be made executable by adding a first line of the form
</p><pre class="screen">#!<em class="replaceable"><code>interpreter</code></em> [<em class="replaceable"><code>interpreter-arguments</code></em>]</pre><p>
and using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/chmod.html"><span class="command"><strong>chmod</strong></span></a> to make the file
executable.</p><p><strong>OS Requirements. </strong><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can be used as a script interpreter under the following
conditions:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <em class="replaceable"><code>interpreter</code></em> must be the full pathname of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
The recommended path is <code class="filename">/usr/local/bin/clisp</code>,
and if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is actually installed elsewhere, making
<code class="filename">/usr/local/bin/clisp</code> be a symbolic link to the
real <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</li><li class="listitem">The <em class="replaceable"><code>interpreter</code></em> must be a real executable, not a script.
Unfortunately, in the binary distributions of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> on Solaris,
<span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> is a shell script because a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler cannot be
assumed to be installed on this platform. If you do have a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
compiler installed, build <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> from the source yourself;
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make install</strong></span></a> will install <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> as
a real executable.</li><li class="listitem"><p>On some platforms, the first line which specifies the
interpreter is limited in length:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">max. 32 characters on SunOS 4,</li><li class="listitem">max. 80 characters on HP-UX,</li><li class="listitem">max. 127 characters on <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a>.</li></ul></div><p>
Characters exceeding this limit are simply cut off by the system.
At least 128 characters are accepted on Solaris, IRIX, AIX, OSF/1.
There is no workaround: You have to keep the interpreter pathname
and arguments short.</p></li><li class="listitem">On Solaris and HP-UX, only the first
<em class="replaceable"><code>interpreter-arg</code></em> is passed to the <em class="replaceable"><code>interpreter</code></em>.
In order to pass more than one option (for example, <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> and
<code class="option"><a href="clisp.html#opt-load-comp" class="olink">-C</a></code>) to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, separate them with
<a class="ulink" href="http://www.fileformat.info/info/unicode/char/00a0/" target="_top">no-break
spaces</a> instead of normal spaces. (But the separator between
<em class="replaceable"><code>interpreter</code></em> and <em class="replaceable"><code>interpreter-arguments</code></em> must still be a normal space!) <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
will split the <em class="replaceable"><code>interpreter-arguments</code></em> both at no-break spaces and at normal spaces.
</li></ul></div><p><a id="script-exec"></a><strong>Script execution. </strong></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The <a href="clisp.html#opt-exec-file" class="olink">script</a> should contain Lisp
forms, except in the <code class="literal">#!</code> line.</li><li class="listitem">The file is loaded normally, through the function
<a href="impnotes.html#loadfile" class="olink"><code class="function">LOAD</code></a> (in particular, the name of the script file, which
is <code class="envar">$0</code> in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>, can be found in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pa_d-truenamest.html" target="_top"><code class="varname">*LOAD-TRUENAME*</code></a> and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stload-pa_d-truenamest.html" target="_top"><code class="varname">*LOAD-PATHNAME*</code></a>).</li><li class="listitem">Before it is loaded, the variable <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a> is bound
to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s, representing the arguments given to the
Lisp script (i.e., <code class="envar">$1</code> in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a> becomes <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_firstcm_s_inthcm_tenth.html" target="_top"><code class="function">FIRST</code></a>
<a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>)</code> etc).</li><li class="listitem">The standard <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> i/o facilities (see <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html"><<code class="filename">stdio.h</code>></a>)
are used: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-INPUT*</code></a> is bound to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a> to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a>, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a> to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html"><code class="varname">stderr</code></a>.
Note <a class="xref" href="#dribble-script" title="25.2.11.1. Scripting and DRIBBLE">Section 25.2.11.1, “Scripting and <code class="function">DRIBBLE</code>”</a>.</li><li class="listitem">The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s will be turned into <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>s
(using <a href="impnotes.html#appease-cerrors" class="olink"><code class="function">EXT:APPEASE-CERRORS</code></a>).</li><li class="listitem">Non-<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#continuable">continuable</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>s and <span class="keycap"><strong>Control</strong></span>+<span class="keysym">C</span> interrupts will
terminate the execution of the Lisp script with an error status
(using <a href="impnotes.html#exit-on-error" class="olink"><code class="function">EXT:EXIT-ON-ERROR</code></a>).</li><li class="listitem">If you wish the script's contents to be compiled
during loading, add <code class="option"><a href="clisp.html#opt-load-comp" class="olink">-C</a></code> to the <em class="replaceable"><code>interpreter-arguments</code></em>.
</li></ul></div><p><a id="script-bad"></a><strong>If nothing works. </strong>Another, quite inferior, alternative is to put the following into a file:
</p><pre class="programlisting">
#!<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>
exec <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <<EOF
(lisp-form)
(another-lisp-form)
(yet-another-lisp-form)
EOF
</pre><p>
The problem with this approach is that the return values of each form
will be printed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>.
Another problem is that no user input will be available.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="quickstart-desktop"></a>32.6.3. Desktop Environments</h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>, <a class="ulink" href="http://www.gnome.org/" target="_top"><span class="platform">Gnome</span></a>, <a class="ulink" href="http://www.kde.org/" target="_top"><span class="platform">KDE</span></a>, <a class="ulink" href="http://www.apple.com/macosx/" target="_top"><span class="platform">Mac OS X</span></a>
desktop platforms only.</span></span></h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="quickstart-desktop-win32"></a>Notations</h3><p>Although we use <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>-specific notation, these techniques work
on other desktop environments as well.</p></div><p>There are two different ways to make <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
<span class="quote">“<span class="quote">executables</span>”</span> on desktop platforms.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Associate the <code class="filename">#P".mem"</code> extension with
<span class="command"><strong>c:\clisp\clisp.exe <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> "%s"</strong></span>.
</li><li class="listitem">Associate the <code class="filename">#P".fas"</code> extension with
<span class="command"><strong>c:\clisp\clisp.exe <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code> "%s"</strong></span>
Alternatively, you may want to have a function
<code class="function">main</code> in your <code class="filename">#P".fas"</code> files and associate
the <code class="filename">#P".fas"</code> extension with <span class="command"><strong>c:\clisp\clisp.exe <code class="option"><a href="clisp.html#opt-init" class="olink">-i</a></code>
%s <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> (main)</strong></span>.
</li></ol></div><p>Then clicking on the compiled lisp file (with <code class="filename">#P".fas"</code>
extension) will load the file (thus executing all the code in the
file), while the clicking on a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#image" class="olink">memory image</a> (with <code class="filename">#P".mem"</code>
extension) will start <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with the given <a href="impnotes.html#image" class="olink">memory image</a>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>On <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is distributed with a file
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/install.bat"><code class="filename">src/install.bat</code></a>, which
runs <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/install.lisp"><code class="filename">src/install.lisp</code></a> to create a
file <code class="filename">clisp.lnk</code> on your desktop and also associates
<code class="filename">#P".fas"</code>, <code class="filename">#P".lisp"</code>, and <code class="filename">#P".mem"</code> files with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="quickstart-linux"></a>32.6.4. Associating extensions with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> via kernel</h3></div><div><h4 class="subtitle"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> platforms only.
</span></span></h4></div></div></div><p>You have to build your kernel with
<code class="option">CONFIG_BINFMT_MISC=y</code> and
<code class="option">CONFIG_PROC_FS=y</code>. Then you will have a
<code class="filename">/proc/sys/fs/binfmt_misc/</code> directory and you will
be able to do (as <code class="literal">root</code>; you might want to put
these lines into <code class="filename">/etc/rc.d/rc.local</code>):
</p><pre class="screen"><strong><code class="prompt">#</code></strong> echo ":CLISP:E::fas::/usr/local/bin/clisp:" >> /proc/sys/fs/binfmt_misc/register
<strong><code class="prompt">#</code></strong> echo ":CLISP:E::lisp::/usr/local/bin/clisp:" >> /proc/sys/fs/binfmt_misc/register</pre><p>Then you can do the following:
</p><pre class="screen"><strong><code class="prompt">$</code></strong> cat << EOF > hello.lisp
(print "hello, world!")
EOF
<strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-compile" class="olink">-c</a></code> hello.lisp
;; Compiling file hello.lisp ...
;; Wrote file hello.fas
0 errors, 0 warnings
<strong><code class="prompt">$</code></strong> chmod +x hello.fas
<strong><code class="prompt">$</code></strong> hello.fas
"hello, world!"</pre><p>Please read
<a class="ulink" href="https://www.kernel.org/doc/Documentation/admin-guide/binfmt-misc.rst" target="_top">
<code class="filename">/usr/src/linux/Documentation/binfmt_misc.txt</code></a>
for details.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="shell"></a>32.7. Shell, Pipes and Printing</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#exec">32.7.1. Shell</a></span></dt><dt><span class="section"><a href="#pipe">32.7.2. Pipes</a></span></dt><dt><span class="section"><a href="#hardcopy">32.7.3. Printing</a></span></dt></dl></div><p>This section describes how <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can invoke external
executables and communicate with the resulting processes.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="exec"></a>32.7.1. Shell</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><code class="code">(<a class="link" href="#exec" title="32.7.1. Shell"><code class="function">EXT:EXECUTE</code></a> <em class="replaceable"><code>program</code></em>
<em class="replaceable"><code>arg<sub>1</sub></code></em>
<em class="replaceable"><code>arg<sub>2</sub></code></em> ...)</code>
executes an external program.
Its name is <em class="replaceable"><code>program</code></em> (a full pathname).
It is given the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s <em class="replaceable"><code>arg<sub>1</sub></code></em>,
<em class="replaceable"><code>arg<sub>2</sub></code></em>, ... as arguments.
</dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><p class="simpara"><code class="code">(<a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> [<em class="replaceable"><code>command</code></em>])</code>
calls the operating system's shell.</p><p class="simpara"><code class="code">(<a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a>)</code> calls the shell for interactive use.</p><p><code class="code">(<a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> <em class="replaceable"><code>command</code></em>)</code> calls the shell
only for execution of the one given <em class="replaceable"><code>command</code></em>, which can be a
complex expression: </p><pre class="programlisting">
(<a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> "for x in 1 2 3; do echo $x; done")
1
2
3
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code></pre><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd><a class="link" href="#exec" title="32.7.1. Shell"><code class="function">EXT:EXECUTE</code></a> is called on the value of the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>
<code class="envar">SHELL</code> if used interactively;
<span class="command"><strong><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a> -c <em class="replaceable"><code>command</code></em></strong></span> if used non-interactively.
</dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=CreateProcess"><code class="function">CreateProcess</code></a> is
called on <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_or.html" target="_top"><code class="function">OR</code></a> <em class="replaceable"><code>command</code></em> (<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> <code class="envar">COMSPEC</code>))</code>
</dd></dl></div></dd><dt><a id="run-prog"></a><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><p class="simpara">The functions <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> and <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> are the
general interface to <a href="impnotes.html#exec" class="olink"><code class="function">EXT:SHELL</code></a> and the above:</p><p class="simpara"><code class="code">(<a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:MAY-EXEC</code> <code class="constant">:INDIRECTP</code>
<code class="constant">:INPUT</code> <code class="constant">:OUTPUT</code> <code class="constant">:IF-OUTPUT-EXISTS</code> <code class="constant">:WAIT</code>)</code>
runs a shell command (including shell built-in commands,
like <span class="command"><strong>DIR</strong></span> on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>
and <span class="command"><strong>for/do/done</strong></span> on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>).</p><p class="simpara"><code class="code">(<a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> <em class="replaceable"><code>program</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<code class="constant">:MAY-EXEC</code> <code class="constant">:INDIRECTP</code>
<code class="constant">:ARGUMENTS</code> <code class="constant">:INPUT</code> <code class="constant">:OUTPUT</code> <code class="constant">:IF-OUTPUT-EXISTS</code> <code class="constant">:WAIT</code>)</code>
runs an external program.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>command</code></em></span></dt><dd>the shell command.</dd><dt><span class="term"><em class="replaceable"><code>program</code></em></span></dt><dd>the program. The directories listed in the
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a> <code class="envar">PATH</code> will be searched for it.
</dd><dt><span class="term"><code class="constant">:ARGUMENTS</code></span></dt><dd>a list of arguments (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s) that are given
to the program.</dd><dt><span class="term"><code class="constant">:INPUT</code></span></dt><dd>where the program's input is to come from: either
<code class="constant">:TERMINAL</code> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html"><code class="varname">stdin</code></a>, the default) or
<code class="constant">:STREAM</code> (a Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> to be created) or
a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a> (an input file) or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (no input at all).
</dd><dt><span class="term"><code class="constant">:OUTPUT</code></span></dt><dd>where the program's output is to be sent to: either
<code class="constant">:TERMINAL</code> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html"><code class="varname">stdout</code></a>, the default) or
<code class="constant">:STREAM</code> (a Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> to be created) or
a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a> (an output file) or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (ignore the output).
</dd><dt><span class="term"><code class="constant">:IF-OUTPUT-EXISTS</code></span></dt><dd>what to do if the <code class="constant">:OUTPUT</code> file already exists.
The possible values are <code class="constant">:OVERWRITE</code>, <code class="constant">:APPEND</code>, <code class="constant">:ERROR</code>,
with the same meaning as for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>. The default is <code class="constant">:OVERWRITE</code>.
</dd><dt><span class="term"><code class="constant">:WAIT</code></span></dt><dd>whether to wait for program termination or not
(this is useful when no i/o to the process is needed);
the default is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, i.e., synchronous execution.
</dd><dt><span class="term"><code class="constant">:MAY-EXEC</code></span></dt><dd>pass <span class="command"><strong>exec</strong></span> to the underlying
shell (<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> only).</dd><dt><span class="term"><code class="constant">:INDIRECTP</code></span></dt><dd>use a shell to run the command, e.g.,
<code class="code">(<a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> "dir" :indirectp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code>
will run the shell built-in command <span class="command"><strong>DIR</strong></span>.
This argument defaults to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> for <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> and to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a>.
(<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> only).</dd></dl></div><p>If <code class="constant">:STREAM</code> was specified for <code class="constant">:INPUT</code> or <code class="constant">:OUTPUT</code>, a Lisp
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> is returned.
If <code class="constant">:STREAM</code> was specified for both <code class="constant">:INPUT</code> and <code class="constant">:OUTPUT</code>, three
Lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s are returned, as for the function <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-IO-STREAM</code></a>.
Otherwise, the return value depends on the process termination status:
if it exited on a signal or a core-dump,
the signal number is returned as a negative <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>,
else, if it ended normally with 0 exit status, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> is returned;
otherwise, the status is returned as a positive <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.</p><p>This use of <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> can cause
<a class="link" href="#deadlock" title="Warning">deadlocks</a>, see <a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-IO-STREAM</code></a>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="pipe"></a>32.7.2. Pipes</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(<a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-INPUT-STREAM</code></a> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a>
<a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></span></dt><dd>returns an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that will supply the output
from the execution of the given operating system command.
</dd><dt><span class="term"><code class="code">(<a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-OUTPUT-STREAM</code></a> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a>
<a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></span></dt><dd>returns an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that will pass its output as
input to the execution of the given operating system command.
</dd><dt><span class="term"><code class="code">(<a class="link" href="#pipe" title="32.7.2. Pipes"><code class="function">EXT:MAKE-PIPE-IO-STREAM</code></a> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a>
<a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></span></dt><dd><p class="simpara">returns three values.
The <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a> is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that will simultaneously pass its output
as input to the execution of the given operating system command and
supply the output from this command as input.
The second and third value are the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_i.html#input">input</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> and the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> that
make up the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, respectively.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>These three streams must be closed individually, see
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Issues/iss052.html" target="_top">CLOSE-CONSTRUCTED-STREAM:ARGUMENT-STREAM-ONLY</a>.</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="deadlock"></a>Warning</h3><p>Improper use of this function
can lead to <span class="emphasis"><em>deadlocks</em></span>.
Use it at your own risk!</p><p>A deadlock occurs if the command and your Lisp program either
both try to read from each other at the same time or both try to
write to each other at the same time.</p><p>To avoid deadlocks, it is recommended that you fix a
protocol between the command and your program and avoid any hidden
buffering: use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char.html" target="_top"><code class="function">READ-CHAR</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-char-no-hang.html" target="_top"><code class="function">READ-CHAR-NO-HANG</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listen.html" target="_top"><code class="function">LISTEN</code></a>,
<a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a> instead of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_readcm_re_g-whitespace.html" target="_top"><code class="function">READ</code></a> on the input side, and
complete every output operation by a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_finish-ou_clear-output.html" target="_top"><code class="function">FINISH-OUTPUT</code></a>.
The same precautions must apply to the called command as well.
</p></div></dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="hardcopy"></a>32.7.3. Printing</h3></div></div></div><p>The macro
<strong class="first"><em class="firstterm"><a class="link" href="#hardcopy" title="32.7.3. Printing"><code class="function">EXT:WITH-OUTPUT-TO-PRINTER</code></a><a id="with-print" class="indexterm"></a></em></strong>:
</p><pre class="programlisting">
(<a class="link" href="#hardcopy" title="32.7.3. Printing"><code class="function">EXT:WITH-OUTPUT-TO-PRINTER</code></a> (<em class="replaceable"><code>variable</code></em> [<a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a>])
{<em class="replaceable"><code>declaration</code></em>}*
{<em class="replaceable"><code>form</code></em>}*)
</pre><p>
binds the variable <em class="replaceable"><code>variable</code></em> to an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_o.html#output">output</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
that sends its output to the printer.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="getenv"></a>32.8. Operating System Environment</h2></div></div></div><p>Most modern operating systems support <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s that associate
strings (<span class="quote">“<span class="quote">variables</span>”</span>) with other strings
(<span class="quote">“<span class="quote">values</span>”</span>). These variables are somewhat similar to the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/dec_special.html" target="_top"><code class="literal">SPECIAL</code></a> variables in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>: their values are inherited by the
processes from their parent process.</p><p>You can access your OS <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s using the function
<code class="code">(<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>string</code></em>)</code>,
where <em class="replaceable"><code>string</code></em> is the name of the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>.
When <em class="replaceable"><code>string</code></em> is omitted or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, all the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s and their values
are returned in an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</p><p>You can change the value of existing <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a>s or create new ones
using <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> <em class="replaceable"><code>string</code></em>) <em class="replaceable"><code>new-value</code></em>)</code>.</p><p>Use <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> <em class="replaceable"><code>string</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code> to remove an
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a> <em class="replaceable"><code>string</code></em>.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="ext-modules"></a>Chapter 33. Extensions Implemented as Modules</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#asdf">33.1. A System Definition Facility</a></span></dt><dt><span class="section"><a href="#syscalls">33.2. System Calls</a></span></dt><dd><dl><dt><span class="section"><a href="#neworking">33.2.1. Networking</a></span></dt><dt><span class="section"><a href="#file-system">33.2.2. File system</a></span></dt><dt><span class="section"><a href="#user-group">33.2.3. Users and Groups</a></span></dt><dt><span class="section"><a href="#sysinfo">33.2.4. System Information</a></span></dt><dt><span class="section"><a href="#posix-math">33.2.5. Mathematical functions</a></span></dt><dt><span class="section"><a href="#encryption">33.2.6. Encryption</a></span></dt><dt><span class="section"><a href="#sys-log">33.2.7. Syslog</a></span></dt><dt><span class="section"><a href="#processes">33.2.8. Processes</a></span></dt><dt><span class="section"><a href="#accounting">33.2.9. Accounting</a></span></dt><dt><span class="section"><a href="#posix-time">33.2.10. Time and Data Conversion</a></span></dt><dt><span class="section"><a href="#strverscmp">33.2.11. String comparision</a></span></dt><dt><span class="section"><a href="#wildcard">33.2.12. Wildcard Matching</a></span></dt><dt><span class="section"><a href="#mk-xterm-io">33.2.13. XTerm</a></span></dt><dt><span class="section"><a href="#stdio">33.2.14. Standard file input and output</a></span></dt><dt><span class="section"><a href="#errno">33.2.15. Error handling</a></span></dt><dt><span class="section"><a href="#misc">33.2.16. Miscellanea</a></span></dt></dl></dd><dt><span class="section"><a href="#i18n-mod">33.3. Internationalization of User Programs</a></span></dt><dd><dl><dt><span class="section"><a href="#ggettext">33.3.1. The GNU gettext</a></span></dt><dd><dl><dt><span class="section"><a href="#domain">33.3.1.1. Domain</a></span></dt><dt><span class="section"><a href="#category">33.3.1.2. Category</a></span></dt><dt><span class="section"><a href="#i18n-example">33.3.1.3. Internationalization Example</a></span></dt></dl></dd><dt><span class="section"><a href="#i18n-locale">33.3.2. Locale</a></span></dt></dl></dd><dt><span class="section"><a href="#regexp-mod">33.4. POSIX Regular Expressions</a></span></dt><dt><span class="section"><a href="#readline-mod">33.5. Advanced Readline and History Functionality</a></span></dt><dt><span class="section"><a href="#gdbm">33.6. GDBM - The GNU database manager</a></span></dt><dt><span class="section"><a href="#berkeley-db">33.7. Berkeley DB access</a></span></dt><dd><dl><dt><span class="section"><a href="#bdb-objects">33.7.1. Berkeley-DB Objects</a></span></dt><dt><span class="section"><a href="#bdb-close">33.7.2. Closing handles</a></span></dt><dt><span class="section"><a href="#bdb-db-environment">33.7.3. Database Environment</a></span></dt><dt><span class="section"><a href="#bdb-environment-config">33.7.4. Environment Configuration</a></span></dt><dt><span class="section"><a href="#bdb-operations">33.7.5. Database Operations</a></span></dt><dt><span class="section"><a href="#bdb-db-config">33.7.6. Database Configuration</a></span></dt><dt><span class="section"><a href="#bdb-cursor">33.7.7. Database Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-lock">33.7.8. Lock Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-log">33.7.9. Log Subsystem</a></span></dt><dd><dl><dt><span class="section"><a href="#bdb-log-cursor">33.7.9.1. Log Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-log-seq">33.7.9.2. Log Sequence Numbers</a></span></dt></dl></dd><dt><span class="section"><a href="#bdb-mem-pool">33.7.10. Memory Pool Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-replication">33.7.11. Replication</a></span></dt><dt><span class="section"><a href="#bdb-sequences">33.7.12. Sequences</a></span></dt><dt><span class="section"><a href="#bdb-transaction">33.7.13. Transaction Subsystem</a></span></dt></dl></dd><dt><span class="section"><a href="#dir-key">33.8. Directory Access</a></span></dt><dt><span class="section"><a href="#postgresql">33.9. PostgreSQL Database Access</a></span></dt><dt><span class="section"><a href="#oracle">33.10. Oracle Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#ora-functionality">33.10.1. Functions and Macros in package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#ora-example">33.10.2. Oracle Example</a></span></dt><dt><span class="section"><a href="#ora-config">33.10.3. Oracle Configuration</a></span></dt><dt><span class="section"><a href="#ora-build">33.10.4. Building the Oracle Interface</a></span></dt></dl></dd><dt><span class="section"><a href="#libsvm">33.11. LibSVM Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#libsvm-types">33.11.1. Types</a></span></dt><dt><span class="section"><a href="#libsvm-output">33.11.2. Output</a></span></dt><dt><span class="section"><a href="#libsvm-functions">33.11.3. Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#libsvm-functions-problem">33.11.3.1. Functions related to <span class="type">problem</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-model">33.11.3.2. Functions related to <span class="type">model</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-parameter">33.11.3.3. Functions related to <span class="type">parameter</span></a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#pari">33.12. Computer Algebra System PARI</a></span></dt><dt><span class="section"><a href="#matlab">33.13. Matlab Interface</a></span></dt><dt><span class="section"><a href="#netica">33.14. Netica Interface</a></span></dt><dt><span class="section"><a href="#pcre">33.15. Perl Compatible Regular Expressions</a></span></dt><dt><span class="section"><a href="#zlib">33.16. Interface to zlib</a></span></dt><dt><span class="section"><a href="#rawsock">33.17. Raw Socket Access</a></span></dt><dd><dl><dt><span class="section"><a href="#rawsock-intro">33.17.1. Introduction</a></span></dt><dt><span class="section"><a href="#rawsock-func">33.17.2. Single System Call Functions</a></span></dt><dt><span class="section"><a href="#rawsock-args">33.17.3. Common arguments</a></span></dt><dd><dl><dt><span class="section"><a href="#rawsock-plat-dep-constants">33.17.3.1. Platform-dependent Keywords</a></span></dt></dl></dd><dt><span class="section"><a href="#rawsock-return">33.17.4. Return Values</a></span></dt><dt><span class="section"><a href="#rawsock-not-implemented">33.17.5. Not Implemented</a></span></dt><dt><span class="section"><a href="#rawsock-errors">33.17.6. Errors</a></span></dt><dt><span class="section"><a href="#rawsock-high-level">33.17.7. High-Level Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#fastcgi">33.18. The FastCGI Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#fcgi-overview">33.18.1. Overview of FastCGI</a></span></dt><dt><span class="section"><a href="#fcgi-functionality">33.18.2. Functions in Package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#fcgi-example">33.18.3. FastCGI Example</a></span></dt><dt><span class="section"><a href="#fcgi-build">33.18.4. Building and configuring the FastCGI Interface</a></span></dt></dl></dd><dt><span class="section"><a href="#dbus">33.19. Interface to D-Bus</a></span></dt><dt><span class="section"><a href="#gtk">33.20. GTK Interface</a></span></dt><dd><dl><dt><span class="section"><a href="#gtk-hi">33.20.1. High-level functions</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="asdf"></a>33.1. A System Definition Facility</h2></div></div></div><p>This module offers a system definition facility (similar to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make</strong></span></a>).
It is based on <a class="ulink" href="http://common-lisp.net/project/asdf/" target="_top"><code class="function">asdf</code></a> 3.2.0.</p><p>Additionally, it hooks into <a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> using <a class="link" href="#module-providers" title="24.3.3. User variable CUSTOM::*MODULE-PROVIDER-FUNCTIONS*"><code class="varname">CUSTOM::*MODULE-PROVIDER-FUNCTIONS*</code></a>.
This way, requiring a module causes <a class="ulink" href="http://common-lisp.net/project/asdf/" target="_top"><code class="function">asdf</code></a> to load the corresponding system.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the symbols
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:ASDF3.2</code></td></tr><tr><td><code class="constant">:ASDF3.1</code></td></tr><tr><td><code class="constant">:ASDF3</code></td></tr><tr><td><code class="constant">:ASDF2</code></td></tr><tr><td><code class="constant">:ASDF</code></td></tr><tr><td><code class="constant">:ASDF-PACKAGE-SYSTEM</code></td></tr></table><p>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="syscalls"></a>33.2. System Calls</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#neworking">33.2.1. Networking</a></span></dt><dt><span class="section"><a href="#file-system">33.2.2. File system</a></span></dt><dt><span class="section"><a href="#user-group">33.2.3. Users and Groups</a></span></dt><dt><span class="section"><a href="#sysinfo">33.2.4. System Information</a></span></dt><dt><span class="section"><a href="#posix-math">33.2.5. Mathematical functions</a></span></dt><dt><span class="section"><a href="#encryption">33.2.6. Encryption</a></span></dt><dt><span class="section"><a href="#sys-log">33.2.7. Syslog</a></span></dt><dt><span class="section"><a href="#processes">33.2.8. Processes</a></span></dt><dt><span class="section"><a href="#accounting">33.2.9. Accounting</a></span></dt><dt><span class="section"><a href="#posix-time">33.2.10. Time and Data Conversion</a></span></dt><dt><span class="section"><a href="#strverscmp">33.2.11. String comparision</a></span></dt><dt><span class="section"><a href="#wildcard">33.2.12. Wildcard Matching</a></span></dt><dt><span class="section"><a href="#mk-xterm-io">33.2.13. XTerm</a></span></dt><dt><span class="section"><a href="#stdio">33.2.14. Standard file input and output</a></span></dt><dt><span class="section"><a href="#errno">33.2.15. Error handling</a></span></dt><dt><span class="section"><a href="#misc">33.2.16. Miscellanea</a></span></dt></dl></div><p>The <a class="link" href="#syscalls" title="33.2. System Calls"><strong class="package"><span class="quote">“<span class="quote">POSIX</span>”</span></strong></a> module makes some system calls available from lisp.
Not all of these system calls are actually <a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a>, so this package has a
nickname <strong class="package"><span class="quote">“<span class="quote">OS</span>”</span></strong>. If the package prefix is
not specified below, the symbol resides in this package.</p><p>This module is present in the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> by default.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:SYSCALLS</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="neworking"></a>33.2.1. Networking</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="resolve-host"></a><span class="term"><code class="code">(<a class="link" href="#resolve-host"><code class="function">POSIX:RESOLVE-HOST-IPADDR</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>host</code></em>)</code></span></dt><dd><p>Returns the <span class="type">HOSTENT</span> structure:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="structfield"><code>name</code></em></span></dt><dd>host name</dd><dt><span class="term"><em class="structfield"><code>aliases</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of aliases</dd><dt><span class="term"><em class="structfield"><code>addr-list</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> addresses as dotted quads (for IPv4)
or coloned octets (for IPv6)</dd><dt><span class="term"><em class="structfield"><code>addrtype</code></em></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> address type (IPv4 or IPv6)
</dd></dl></div><p>
When <em class="replaceable"><code>host</code></em> is omitted or <code class="constant">:DEFAULT</code>, return the data for the
current host. When <em class="replaceable"><code>host</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, all the
host database is returned as a list (this would be the contents of the
<code class="filename">/etc/hosts</code> file on a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> system or
<code class="filename">${windir}/system32/etc/hosts</code> on a <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> system).
</p><p class="simpara">This is an interface
to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostent.html"><code class="function">gethostent</code></a>,
<a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=gethostbyname"><code class="function">gethostbyname</code></a>,
and <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=gethostbyaddr"><code class="function">gethostbyaddr</code></a>.</p></dd><dt><a id="service"></a><span class="term"><code class="code">(OS:SERVICE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>service-name</code></em> <em class="replaceable"><code>protocol</code></em>)</code></span></dt><dd><p class="simpara">A convenience function for looking up a port given
the service name, such as <span class="quote">“<span class="quote">WWW</span>”</span> or <span class="quote">“<span class="quote">FTP</span>”</span>.
It returns the <span class="type">SERVICE</span> structure
(name, list of aliases, port, protocol) for the given
<em class="replaceable"><code>service-name</code></em> and <em class="replaceable"><code>protocol</code></em>,
or all services as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> if <em class="replaceable"><code>service-name</code></em>
is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</p><p class="simpara">This is an interface
to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getservent.html"><code class="function">getservent</code></a>,
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getservbyname.html"><code class="function">getservbyname</code></a>,
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getservbyport.html"><code class="function">getservbyport</code></a>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="file-system"></a>33.2.2. File system</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="file-stat"></a><span class="term"><code class="code">(POSIX:FILE-STAT
<em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>link-p</code></em>)</code></span></dt><dd><p>Return the <span class="type">FILE-STAT</span> structure.
<em class="replaceable"><code>pathname</code></em> can be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a> (on a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> system, meaning <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>).
The first slot of the structure returned is the string or the
number on which <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html"><code class="function">stat</code></a>,
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html"><code class="function">fstat</code></a>,
or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html"><code class="function">lstat</code></a> was called.
The other slots are numbers, members of the <span class="type">struct stat</span>:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="structfield"><code>dev</code></em></span></dt><dd>Device ID of device containing file.
</dd><dt><span class="term"><em class="structfield"><code>ino</code></em></span></dt><dd>File serial number.
</dd><dt><span class="term"><em class="structfield"><code>mode</code></em></span></dt><dd>Mode of file.
</dd><dt><span class="term"><em class="structfield"><code>nlink</code></em></span></dt><dd>Number of hard links to the file.
</dd><dt><span class="term"><em class="structfield"><code>uid</code></em></span></dt><dd>User ID of file.
</dd><dt><span class="term"><em class="structfield"><code>gid</code></em></span></dt><dd>Group ID of file.
</dd><dt><span class="term"><em class="structfield"><code>rdev</code></em></span></dt><dd>Device ID (if file is character or block
special).</dd><dt><span class="term"><em class="structfield"><code>size</code></em></span></dt><dd>For regular files, the file size in bytes.
For symbolic links, the length in bytes of the pathname contained
in the symbolic link.
For a shared memory object, the length in bytes.
For a typed memory object, the length in bytes.
For other file types, the use of this field is unspecified.
</dd><dt><span class="term"><em class="structfield"><code>atime</code></em></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-2.html">universal time</a> of last access.
</dd><dt><span class="term"><em class="structfield"><code>mtime</code></em></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-2.html">universal time</a> of last data modification.
</dd><dt><span class="term"><em class="structfield"><code>ctime</code></em></span></dt><dd><a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-4-2.html">universal time</a> of last status change
(on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> - creation time).</dd><dt><span class="term"><em class="structfield"><code>blksize</code></em></span></dt><dd>A file system-specific preferred I/O block size
for this object. In some file system types, this may vary from
file to file.</dd><dt><span class="term"><em class="structfield"><code>blocks</code></em></span></dt><dd>Number of blocks allocated for this object.
</dd></dl></div><p>
All slots are read-only.</p><p class="simpara">If the system does not support a particular field (e.g.,
<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> prior to 2000 does not have hard links), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (or the
default, like 1 for the number of hard links for old <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>) is
returned.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><span class="platform">Win32</span> platform only.</h3><p>Normally, one would expect <code class="code">(POSIX:FILE-STAT
"foo")</code> and <code class="code">(POSIX:FILE-STAT (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a> "foo"))</code> to
return <span class="quote">“<span class="quote">similar</span>”</span> objects (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>ing a file changes its
access time though). This is <span class="strong"><strong>not</strong></span> the case on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>, where
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html"><code class="function">stat</code></a> works but <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html"><code class="function">fstat</code></a> does <span class="strong"><strong>not</strong></span>.
Specifically, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html"><code class="function">fstat</code></a> requires an <span class="type">int</span> argument of an unknown
nature, and it is not clear how do deduce it from the <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> file handle.
Therefore, instead of always failing on open <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a> arguments,
this function calls
<a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetFileInformationByHandle"><code class="function">GetFileInformationByHandle</code></a> and
fills the <span class="type">FILE-STAT</span> return value based on that.
</p></div></dd><dt><a id="set-file-stat"></a><span class="term"><code class="code">(POSIX:SET-FILE-STAT
<em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :ATIME :MTIME :MODE :UID :GID)</code></span></dt><dd>Set some file attributes using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html"><code class="function">chmod</code></a>,
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html"><code class="function">chown</code></a>,
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html"><code class="function">utime</code></a>.
</dd><dt><a id="stat-vfs"></a><span class="term"><code class="code">(POSIX:STAT-VFS <em class="replaceable"><code>pathname</code></em>)</code></span></dt><dd><p>Return a <span class="type">STAT-VFS</span> structure.
<em class="replaceable"><code>pathname</code></em> can be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_pathname.html" target="_top"><code class="classname">PATHNAME</code></a>, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a> (on a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> system, meaning <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>).
The first slot of the structure returned is the string
or the number on which <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/statvfs.html"><code class="function">statvfs</code></a> or
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html"><code class="function">fstatvfs</code></a> was called.
The other slots are members of the <span class="type">struct statvfs</span>:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="structfield"><code>bsize</code></em></span></dt><dd>File system block size.
</dd><dt><span class="term"><em class="structfield"><code>frsize</code></em></span></dt><dd>Fundamental file system block size.
</dd><dt><span class="term"><em class="structfield"><code>blocks</code></em></span></dt><dd>Total number of blocks on file system in units of
<em class="structfield"><code>frsize</code></em>.</dd><dt><span class="term"><em class="structfield"><code>bfree</code></em></span></dt><dd>Total number of free blocks.
</dd><dt><span class="term"><em class="structfield"><code>bavail</code></em></span></dt><dd>Number of free blocks available to
non-privileged processes.</dd><dt><span class="term"><em class="structfield"><code>files</code></em></span></dt><dd>Total number of file serial numbers.
</dd><dt><span class="term"><em class="structfield"><code>ffree</code></em></span></dt><dd>Total number of free file serial numbers.
</dd><dt><span class="term"><em class="structfield"><code>favail</code></em></span></dt><dd>Number of file serial numbers available to
non-privileged processes.</dd><dt><span class="term"><em class="structfield"><code>fsid</code></em></span></dt><dd>File system ID.</dd><dt><span class="term"><em class="structfield"><code>flag</code></em></span></dt><dd>List of platform-dependent values, such as <code class="constant">:READ-ONLY</code>.
</dd><dt><span class="term"><em class="structfield"><code>namemax</code></em></span></dt><dd>Maximum filename length.
</dd><dt><span class="term"><em class="structfield"><code>vol-name</code></em></span></dt><dd>Volume name (<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> only).
</dd><dt><span class="term"><em class="structfield"><code>fs-type</code></em></span></dt><dd>File system type (<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> only).
</dd></dl></div><p>
All slots are read-only.
</p></dd><dt><a id="chroot"></a><span class="term"><code class="code">(POSIX:CHROOT <em class="replaceable"><code>pathname</code></em>)</code></span></dt><dd><p class="simpara">Change the apparent disk root directory for the current
running process (and its children) using
<a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=chroot"><code class="function">chroot</code></a>.</p><p class="simpara">Unless the process has superuser privileges, the operation will
probably fail with <code class="constant">EPERM</code>.</p></dd><dt><a id="file-tree-walk"></a><span class="term"><code class="code">(POSIX:FILE-TREE-WALK <em class="replaceable"><code>pathname</code></em>
<em class="replaceable"><code>function</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> FD-LIMIT CHDIR DEPTH MOUNT PHYS)</code></span></dt><dd><p>For each object under <em class="replaceable"><code>pathname</code></em> calls <em class="replaceable"><code>function</code></em> with 5
arguments: </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">the pathname of the object</li><li class="listitem">the <span class="type">FILE-STAT</span> instance containing
information on the object (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, see below)</li><li class="listitem"><p>a keyword giving additional information.
Its value is one of the following:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:F</code></span></dt><dd>The object is a file.
</dd><dt><span class="term"><code class="constant">:D</code></span></dt><dd>The object is a directory.
</dd><dt><span class="term"><code class="constant">:DP</code></span></dt><dd>The object is a directory and subdirectories have
been visited. (This condition shall only occur if the
<code class="constant">:DEPTH</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.)
</dd><dt><span class="term"><code class="constant">:SL</code></span></dt><dd>The object is a symbolic link. (This condition shall
only occur if the <code class="constant">PHYS</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.)
</dd><dt><span class="term"><code class="constant">:SLN</code></span></dt><dd>The object is a symbolic link that does not name an
existing file. (This condition shall only occur if the
<code class="constant">PHYS</code> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.)
</dd><dt><span class="term"><code class="constant">:DNR</code></span></dt><dd>The object is a directory that cannot be read.
The fn function shall not be called for any of its descendants.
</dd><dt><span class="term"><code class="constant">:NS</code></span></dt><dd> The <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html"><code class="function">stat</code></a> function
failed on the object because of lack of appropriate permission.
The <span class="type">FILE-STAT</span> argument is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
If <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html"><code class="function">stat</code></a> fails for any other reason,
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</dd></dl></div><p>
</p></li><li class="listitem">the offset of the object's filename in the pathname
passed as the first argument to <em class="replaceable"><code>function</code></em>.</li><li class="listitem">the depth relative to the root of the walk,
where the root level is 0.</li></ol></div><p class="simpara">As soon as <em class="replaceable"><code>function</code></em> returns non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, this function returns that
value; if <em class="replaceable"><code>function</code></em> always returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, then this function also returns
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> when the file tree is exhausted.</p><p class="simpara">The <code class="constant">:FD-LIMIT</code> argument defaults to 5.</p><p class="simpara">If <code class="constant">:CHDIR</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the function
shall change the current working directory to each directory as it reports
files in that directory</p><p class="simpara">If <code class="constant">:DEPTH</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the function
shall report all files in a directory before reporting the directory
itself.</p><p class="simpara">If <code class="constant">:MOUNT</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the function
shall only report files in the same file system as <em class="replaceable"><code>pathname</code></em>.</p><p class="simpara">If <code class="constant">:PHYS</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the function
shall perform a physical walk and shall not follow symbolic links.</p><p class="simpara">Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/nftw.html"><code class="function">nftw</code></a>.</p></dd><dt><a id="file-info"></a><span class="term"><code class="code">(OS:FILE-INFO <em class="replaceable"><code>pathname</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> all)</code></span></dt><dd><p>Return the <span class="type">FILE-INFO</span> structure.
<em class="replaceable"><code>pathname</code></em> should be a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>. The 7 slots are</p><table border="0" summary="Simple list" class="simplelist"><tr><td><em class="structfield"><code>attributes</code></em></td></tr><tr><td><em class="structfield"><code>ctime</code></em></td></tr><tr><td><em class="structfield"><code>atime</code></em></td></tr><tr><td><em class="structfield"><code>wtime</code></em></td></tr><tr><td><em class="structfield"><code>size</code></em></td></tr><tr><td><em class="structfield"><code>name</code></em></td></tr><tr><td><em class="structfield"><code>name-short</code></em></td></tr></table><p>When <em class="replaceable"><code>pathname</code></em> is wild, returns just the first match,
unless the second (optional) argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of objects is returned, one for each match.
</p></dd><dt><a id="stream-lock"></a><span class="term"><code class="code">(POSIX:STREAM-LOCK <em class="replaceable"><code>stream</code></em>
<em class="replaceable"><code>lock-p</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
(:BLOCK <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>) (:SHARED <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>) (:START 0) (:END <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>))</code></span></dt><dd><p class="simpara">Set or remove a file lock for the (portion of the)
file associated with <em class="replaceable"><code>stream</code></em>,
depending on <em class="replaceable"><code>lock-p</code></em>.
When <em class="replaceable"><code>block</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the call is non-blocking,
and when locking fails, it returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
When <em class="replaceable"><code>shared</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
then lock can be shared between several callers.
Several processes can set a <em class="replaceable"><code>shared</code></em>
(i.e., <span class="emphasis"><em>read</em></span>) lock, but only one can set
an <em class="replaceable"><code>exclusive</code></em> (i.e., <span class="emphasis"><em>write</em></span>,
or non-<em class="replaceable"><code>shared</code></em>) lock.
Uses <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html"><code class="function">fcntl</code></a>
or <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=LockFileEx"><code class="function">LockFileEx</code></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> differ on locking 0-length files: on
<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>, two processes can have exclusive locks on it!</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> locks are <span class="emphasis"><em>mandatory</em></span>:
if you lock a file, others will not be able to open it!</p><p><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> locks are usually <span class="emphasis"><em>advisory</em></span>: a process
is free to ignore it, but on some <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems one can mount some
file system with <span class="emphasis"><em>mandatory</em></span> locks.</p></div></dd><dt><a id="with-stream-lock"></a><span class="term"><code class="code">(POSIX:WITH-STREAM-LOCK
(<em class="replaceable"><code>stream</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>options</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Lock the <em class="replaceable"><code>stream</code></em>, execute the <em class="replaceable"><code>body</code></em>, unlock
the <em class="replaceable"><code>stream</code></em>. Pass <em class="replaceable"><code>options</code></em> to <a class="link" href="#stream-lock"><code class="function">POSIX:STREAM-LOCK</code></a>.
</dd><dt><a id="fcntl"></a><span class="term"><code class="code">(<a class="link" href="#fcntl"><code class="function">POSIX:STREAM-OPTIONS</code></a>
<em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>command</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p class="simpara">Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html"><code class="function">fcntl</code></a>,
<em class="replaceable"><code>command</code></em> can be <code class="constant">:FD</code> or <code class="constant">:FL</code>.
</p><p class="simpara">When <em class="replaceable"><code>value</code></em> is missing, the option is queried and
the value is returned; if <em class="replaceable"><code>value</code></em> is supplied, the option is set and
no values are returned.</p></dd><dt><a id="file-size"></a><span class="term"><code class="code">(<a class="link" href="#file-size"><code class="function">POSIX:FILE-SIZE</code></a> <em class="replaceable"><code>file</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#file-size"><code class="function">POSIX:FILE-SIZE</code></a> <em class="replaceable"><code>file</code></em>) <em class="replaceable"><code>size</code></em>)</code></span></dt><dd><p class="simpara">Extend <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_file-length.html" target="_top"><code class="function">FILE-LENGTH</code></a> to operate on <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>s.</p><p class="simpara">Set the <em class="replaceable"><code>size</code></em> of a <em class="replaceable"><code>file</code></em> using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html"><code class="function">ftruncate</code></a> (if <em class="replaceable"><code>file</code></em> is an open
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>) or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html"><code class="function">truncate</code></a> (if
<em class="replaceable"><code>file</code></em> is a <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>).</p><p class="simpara">Use <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetFilePointerEx"><code class="function">SetFilePointerEx</code></a>
and <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetEndOfFile"><code class="function">SetEndOfFile</code></a> on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>.
</p></dd><dt><a id="mknod"></a><span class="term"><code class="code">(POSIX:MKNOD <em class="replaceable"><code>pathname</code></em> <em class="replaceable"><code>type</code></em>
<em class="replaceable"><code>mode</code></em>)</code></span></dt><dd>Create a special file using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html"><code class="function">mknod</code></a>.
Use <code class="constant">:FIFO</code> to create pipes
and <code class="constant">:SOCK</code> to create sockets.
</dd><dt><a id="convert-mode"></a><span class="term"><code class="code">(POSIX:CONVERT-MODE <em class="replaceable"><code>mode</code></em>)</code></span></dt><dd>Convert between numeric, (e.g., <code class="literal">0644</code>)
and symbolic (e.g., <span class="data"><code class="literal">(:RUSR :WUSR :RGRP
:ROTH)</code></span>) file modes.</dd><dt><a id="umask"></a><span class="term"><code class="code">(POSIX:UMASK <em class="replaceable"><code>mode</code></em>)</code></span></dt><dd>Change process mask using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/umask.html"><code class="function">umask</code></a>.
</dd><dt><a id="copy-file"></a><span class="term"><code class="code">(<a class="link" href="#copy-file"><code class="function">POSIX:COPY-FILE</code></a> <em class="replaceable"><code>source</code></em> <em class="replaceable"><code>destination</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :METHOD :PRESERVE :IF-EXISTS :IF-DOES-NOT-EXIST)</code></span></dt><dd><p class="simpara">This is an interface to
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html"><code class="function">symlink</code></a>
(when <em class="replaceable"><code>method</code></em> is <code class="constant">:SYMLINK</code>),
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html"><code class="function">link</code></a>
(when it is <code class="constant">:HARDLINK</code>),
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html"><code class="function">rename</code></a>
(when it is <code class="constant">:RENAME</code>) system calls, as well as,
you guessed it, a generic file copy utility (when <em class="replaceable"><code>method</code></em> is <code class="constant">:COPY</code>).
</p><p class="simpara">When <em class="replaceable"><code>method</code></em> is <code class="constant">:HARDLINK-OR-COPY</code>
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html"><code class="function">link</code></a> fails (e.g., because the
<em class="replaceable"><code>source</code></em> and <em class="replaceable"><code>destination</code></em> are on different devices), fall back to <code class="constant">:COPY</code>.
</p><p class="simpara">Both <em class="replaceable"><code>source</code></em> and <em class="replaceable"><code>destination</code></em> may be wild, in which
case <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_translate-pathname.html" target="_top"><code class="function">TRANSLATE-PATHNAME</code></a> is used.</p><p class="simpara">When <em class="replaceable"><code>preserve</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, try
to duplicate the time, owner, and permission characteristics of each
source file in the corresponding destination file,
similar to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html"><span class="command"><strong>cp -p</strong></span></a>.</p><p class="simpara">The meaning and defaults of <code class="constant">:IF-EXISTS</code> and
<code class="constant">:IF-DOES-NOT-EXIST</code> are the same as in <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>.</p></dd><dt><a id="dup-handle"></a><span class="term"><code class="code">(<a class="link" href="#dup-handle"><code class="function">POSIX:DUPLICATE-HANDLE</code></a>
<em class="replaceable"><code>fd1</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>fd2</code></em>)</code></span></dt><dd>This is an interface to the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html"><code class="function">dup</code></a> system calls on
<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> systems and to <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=DuplicateHandle"><code class="function">DuplicateHandle</code></a>
system call on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</dd><dt><a id="shortcut-info"></a><span class="term"><code class="code">(OS:SHORTCUT-INFO
<em class="replaceable"><code>pathname</code></em>)</code></span></dt><dd>Return information about a <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> shortcut
(<code class="filename">#P".lnk"</code>) file contents in a
<span class="type">SHORTCUT-INFO</span> structure.</dd><dt><a id="make-shortcut"></a><span class="term"><code class="code">(OS:MAKE-SHORTCUT <em class="replaceable"><code>pathname</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :WORKING-DIRECTORY :ARGUMENTS :SHOW-COMMAND :ICON :DESCRIPTION
:HOT-KEY :PATH)</code></span></dt><dd>Create (or modify the properties of an existing one)
a <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> shortcut (<code class="filename">#P".lnk"</code>) file.
</dd><dt><a id="file-properties"></a><span class="term"><code class="code">(OS:FILE-PROPERTIES
filename set <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :INITID <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></span></dt><dd><p>Wrapper for the <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>
<a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=IPropertyStorage"><code class="function">IPropertyStorage</code></a> functionality.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>filename</code></em></span></dt><dd>name of a compound file (where properties are stored)
or (on NTFS) name of any file (properties are stored in the filesystem).
For compound files on NTFS, file storage is preferred.
</dd><dt><span class="term"><em class="replaceable"><code>set</code></em></span></dt><dd>property set, either <code class="constant">:BUILT-IN</code>
or <code class="constant">:USER-DEFINED</code>
</dd><dt><span class="term"><code class="constant">:INITID</code>
<em class="replaceable"><code>init-id</code></em></span></dt><dd>set the <em class="replaceable"><code>init-id</code></em>
</dd><dt><span class="term"><em class="replaceable"><code>specifier value</code></em></span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>specifier</code></em></span></dt><dd><p>the property specifier: an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a> and a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></span></dt><dd>a property identifier
</dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a></span></dt><dd><p>Predefined <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a> IDs are
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:APPNAME</code></td><td><code class="constant">:CREATE-DTM</code></td><td><code class="constant">:LASTPRINTED</code></td><td><code class="constant">:SUBJECT</code></td></tr><tr><td><code class="constant">:AUTHOR</code></td><td><code class="constant">:DOC-SECURITY</code></td><td><code class="constant">:LASTSAVE-DTM</code></td><td><code class="constant">:TEMPLATE</code></td></tr><tr><td><code class="constant">:CHARCOUNT</code></td><td><code class="constant">:EDITTIME</code></td><td><code class="constant">:LOCALE</code></td><td><code class="constant">:THUMBNAIL</code></td></tr><tr><td><code class="constant">:CODEPAGE</code></td><td><code class="constant">:KEYWORDS</code></td><td><code class="constant">:PAGECOUNT</code></td><td><code class="constant">:TITLE</code></td></tr><tr><td><code class="constant">:COMMENTS</code></td><td><code class="constant">:LASTAUTHOR</code></td><td><code class="constant">:REVNUMBER</code></td><td><code class="constant">:WORDCOUNT</code></td></tr></table></dd><dt><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></span></dt><dd>string property specifier.
If no match is found, the first ID >= init-id
(which defaults to 2) is associated with the
string and its value is replaced with new value.
</dd><dt><span class="term">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>|<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>)</span></dt><dd>the first element is used as
a specifier, the string is associated with this ID.
</dd></dl></div><p>
</p></dd><dt><span class="term"><em class="replaceable"><code>value</code></em></span></dt><dd><p>the new value of the property, a suitable Lisp
object, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a> and the value
itself. If <em class="replaceable"><code>value</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, no assignment is done.
<code class="constant">:EMPTY</code> and <code class="constant">:NULL</code>
correspond to the <span class="type">VT_EMPTY</span>
and <span class="type">VT_NULL</span> data types.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a> in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> specifies the desired type of
the property being set.
Supported types are</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:BOOL</code></td><td><code class="constant">:I1</code></td><td><code class="constant">:LPWSTR</code></td><td><code class="constant">:UI4</code></td></tr><tr><td><code class="constant">:BSTR</code></td><td><code class="constant">:I2</code></td><td><code class="constant">:R4</code></td><td><code class="constant">:UI8</code></td></tr><tr><td><code class="constant">:DATE</code></td><td><code class="constant">:I4</code></td><td><code class="constant">:R8</code></td><td><code class="constant">:UINT</code></td></tr><tr><td><code class="constant">:ERROR</code></td><td><code class="constant">:I8</code></td><td><code class="constant">:UI1</code></td><td> </td></tr><tr><td><code class="constant">:FILETIME</code></td><td><code class="constant">:LPSTR</code></td><td><code class="constant">:UI2</code></td><td> </td></tr></table><p>
<span class="type">FILETIME</span>s are converted to/from the universal
time format, while <span class="type">DATE</span>s are not.
</p></dd></dl></div><p>
</p></dd></dl></div><p>
Returns the property contents before assignment as multiple values.
</p></dd><dt><a id="file-owner"></a><span class="term"><code class="code">(OS:FILE-OWNER
<em class="replaceable"><code>filename</code></em>)</code></span></dt><dd><p class="simpara">Return the owner of the file.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></p></dd><dt><a id="mkstemp"></a><span class="term"><code class="code">(POSIX:MKSTEMP <em class="replaceable"><code>filename</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:DIRECTION</code> <a class="link" href="#eltype"><code class="constant">:ELEMENT-TYPE</code></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#buffered"><code class="constant">:BUFFERED</code></a>)</code></span></dt><dd><p class="simpara">Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkstemp.html"><code class="function">mkstemp</code></a>;
returns a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>.</p><p class="simpara"><code class="constant">:DIRECTION</code> should allow output.</p></dd><dt><a id="mkdtemp"></a><span class="term"><code class="code">(POSIX:MKDTEMP
<em class="replaceable"><code>filename</code></em>)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdtemp.html"><code class="function">mkdtemp</code></a>;
creates a new empty temporary directory and returns its namestring.
</dd><dt><a id="sync"></a><span class="term"><code class="code">(POSIX:SYNC <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>stream</code></em>)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html"><code class="function">fsync</code></a>
(<a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=FlushFileBuffers"><code class="function">FlushFileBuffers</code></a> on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>)
on the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> associated with <em class="replaceable"><code>stream</code></em>,
or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sync.html"><code class="function">sync</code></a>
when <em class="replaceable"><code>stream</code></em> is not supplied</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="user-group"></a>33.2.3. Users and Groups</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="user-info"></a><span class="term"><code class="code">(POSIX:USER-INFO
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>user</code></em>)</code></span></dt><dd><p class="simpara">Return the <span class="type">USER-INFO</span> structure (name,
encoded password, UID, GID, full name, home directory, shell).
<em class="replaceable"><code>user</code></em> should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwnam.html"><code class="function">getpwnam</code></a> is used) or an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwuid.html"><code class="function">getpwuid</code></a> is used).
When <em class="replaceable"><code>user</code></em> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return all
users (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwent.html"><code class="function">getpwent</code></a>).
When <em class="replaceable"><code>user</code></em> is <code class="constant">:DEFAULT</code>, return the information about the current user
(using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html"><code class="function">getlogin</code></a>).</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></p></dd><dt><a id="group-info"></a><span class="term"><code class="code">(POSIX:GROUP-INFO
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>group</code></em>)</code></span></dt><dd><p class="simpara">Return the <span class="type">GROUP-INFO</span> structure (name,
GID, member <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>). <em class="replaceable"><code>group</code></em> should be a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgrnam.html"><code class="function">getgrnam</code></a> is used) or an
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgrgid.html"><code class="function">getgrgid</code></a> is used).
When <em class="replaceable"><code>group</code></em> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return all
groups (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgrent.html"><code class="function">getgrent</code></a>).</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></p></dd><dt><a id="user-shells"></a><span class="term"><code class="code">(POSIX:USER-SHELLS)</code></span></dt><dd>Call <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=getusershell"><code class="function">getusershell</code></a>.
</dd><dt><a id="get-user-sid"></a><span class="term"><code class="code">(OS:GET-USER-SID
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>user</code></em>)</code></span></dt><dd>Call <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=LookupAccountName"><code class="function">LookupAccountName</code></a>
on <em class="replaceable"><code>user</code></em> or, if that is not supplied, call
<a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=OpenProcessToken"><code class="function">OpenProcessToken</code></a>,
<a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetTokenInformation"><code class="function">GetTokenInformation</code></a>, and then
<a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=ConvertSidToStringSid"><code class="function">ConvertSidToStringSid</code></a> on
<em class="structfield"><code>User.Sid</code></em>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sysinfo"></a>33.2.4. System Information</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="uname"></a><span class="term"><code class="code">(POSIX:UNAME)</code></span></dt><dd>Return a structure describing the OS, derived from
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html"><code class="function">uname</code></a>.</dd><dt><a id="sysconf"></a><span class="term"><code class="code">(POSIX:SYSCONF <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code><br /></span><span class="term"><code class="code">(POSIX:CONFSTR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Return the specified configuration parameter or a
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a> of all available parameters (when <em class="replaceable"><code>what</code></em> is missing or
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>), by calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html"><code class="function">sysconf</code></a>
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html"><code class="function">confstr</code></a> respectively.
</dd><dt><a id="pathconf"></a><span class="term"><code class="code">(POSIX:PATHCONF <em class="replaceable"><code>pathname</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Return the specified configuration parameter or a
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a> of all available parameters (when <em class="replaceable"><code>what</code></em> is missing or
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>), by calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html"><code class="function">fpathconf</code></a> on
open file streams and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pathconf.html"><code class="function">pathconf</code></a> on
all other <a class="link" href="#path-des" title="Pathname Designators">pathname designator</a>s.</dd><dt><a id="rlimit"></a><span class="term"><code class="code">(<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Return the current and the maximal limits as two
values when <em class="replaceable"><code>what</code></em> is specified or the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a> of all available
limits (as an <span class="type">RLIMIT</span> structure) when <em class="replaceable"><code>what</code></em> is
missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, by calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrlimit.html"><code class="function">getrlimit</code></a>.
</dd><dt><a id="set-rlimit"></a><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a> <em class="replaceable"><code>what</code></em>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_values.html" target="_top"><code class="function">VALUES</code></a> <em class="replaceable"><code>cur</code></em>
<em class="replaceable"><code>max</code></em>))</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a> <em class="replaceable"><code>what</code></em>)
<em class="replaceable"><code>rlimit</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a>)
<em class="replaceable"><code>rlimit-plist</code></em>)</code></span></dt><dd><p>Set the limits using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setrlimit.html"><code class="function">setrlimit</code></a>.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">In the first form, <em class="replaceable"><code>cur</code></em>
and <em class="replaceable"><code>max</code></em> are numbers
(or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> for <code class="constant">RLIM_INFINITY</code>).</li><li class="listitem">In the second form, <em class="replaceable"><code>rlimit</code></em>
is an <span class="type">RLIMIT</span> structure.</li><li class="listitem">In the third form,
<em class="replaceable"><code>rlimit-plist</code></em> is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a>, as returned by
<code class="code">(<a class="link" href="#rlimit"><code class="function">POSIX:RLIMIT</code></a>)</code>.</li></ol></div></dd><dt><a id="usage"></a><span class="term"><code class="code">(<a class="link" href="#usage"><code class="function">POSIX:USAGE</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Return the <span class="type">USAGE</span> structure describing the
resource usage of the thread, process, or its children, using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getrusage.html"><code class="function">getrusage</code></a>. WHen <em class="replaceable"><code>what</code></em> is missing
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return all available data as a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#property_list">property list</a>.
</dd><dt><a id="bogomips"></a><span class="term"><code class="code">(POSIX:BOGOMIPS)</code></span></dt><dd>Compute the
<a class="ulink" href="http://en.wikipedia.org/wiki/BogoMips" target="_top">BogoMips</a>
rating.</dd><dt><a id="loadavg"></a><span class="term"><code class="code">(POSIX:LOADAVG <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
percentp)</code></span></dt><dd>Return 1, 5, and 15 minute system load averages,
retrieved by <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=getloadavg"><code class="function">getloadavg</code></a>.
If the argument is specified and non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the values are returned
as integer percentiles.</dd><dt><span class="term"><code class="code">(OS:SYSTEM-INFO)</code></span></dt><dd>Return <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> system information in a
<span class="type">SYSTEM-INFO</span> structure.</dd><dt><span class="term"><code class="code">(OS:VERSION)</code></span></dt><dd>Return <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> version information in a
<span class="type">VERSION</span> structure.</dd><dt><span class="term"><code class="code">(OS:MEMORY-STATUS)</code></span></dt><dd>Return <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> memory status information in a
<span class="type">MEMORY-STATUS</span> structure.</dd><dt><a id="phys-mem"></a><span class="term"><code class="code">(OS:PHYSICAL-MEMORY)</code></span></dt><dd><p class="simpara">Return 2 values: total and available physical memory.
</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></p></dd><dt><a id="hostid"></a><span class="term"><code class="code">(OS:HOSTID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (OS:HOSTID) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p class="simpara">Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostid.html"><code class="function">gethostid</code></a> and
return a (hopefully) universally unique <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> identifier of
this machine.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>On <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> this number appears to be the IPv4 32-bit
address with the first 2 bytes and the last 2 bytes swapped:
</p><pre class="programlisting">(<a class="link" href="#rawsock-convert-address"><code class="function">RAWSOCK:CONVERT-ADDRESS</code></a> :inet (os:hostid))
⇒ <code class="computeroutput">"7.3.192.168"</code>
(first (posix:hostent-addr-list (<a class="link" href="#resolve-host"><code class="function">POSIX:RESOLVE-HOST-IPADDR</code></a> :default)))
⇒ <code class="computeroutput">"192.168.7.3"</code></pre><p>This, of
course, means that <span class="quote">“<span class="quote">universally unique</span>”</span> it is <span class="strong"><strong>not</strong></span>.
</p></div><p class="simpara">Superuser can also set host identifier
using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> which calls <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=sethostid"><code class="function">sethostid</code></a>.
</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>, <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platforms only.</span></span></p></dd><dt><a id="domainname"></a><span class="term"><code class="code">(OS:DOMAINNAME)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (OS:DOMAINNAME) <em class="replaceable"><code>domain</code></em>)</code></span></dt><dd>Call <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=getdomainname"><code class="function">getdomainname</code></a>
and <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=setdomainname"><code class="function">setdomainname</code></a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="posix-math"></a>33.2.5. Mathematical functions</h3></div></div></div><p>We implement access to </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/erf.html"><code class="function">erf</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/erfc.html"><code class="function">erfc</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/j0.html"><code class="function">j0</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/j1.html"><code class="function">j1</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/jn.html"><code class="function">jn</code></a> <em class="replaceable"><code>integer</code></em>
<em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/y0.html"><code class="function">y0</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/y1.html"><code class="function">y1</code></a> <em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/yn.html"><code class="function">yn</code></a> <em class="replaceable"><code>integer</code></em>
<em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/tgamma.html"><code class="function">tgamma</code></a>
<em class="replaceable"><code>real</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/lgamma.html"><code class="function">lgamma</code></a>
<em class="replaceable"><code>real</code></em>)</code></td></tr></table><p>
which compute the error functions, Bessel functions and Gamma.</p><p>These functions are required by the <a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> standard and should
be declared in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html"><<code class="filename">math.h</code>></a>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Please note that these functions do <span class="strong"><strong>not</strong></span> provide
lisp-style error handling and precision, and do all the computations
at the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> level.</p></div><p>Function <code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ffs.html"><code class="function">ffs</code></a> <em class="replaceable"><code>n</code></em>)</code>
finds the first bit set. It is implemented in pure Lisp and supports
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>s.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="encryption"></a>33.2.6. Encryption</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="crypt"></a><span class="term"><code class="code">(POSIX:CRYPT <em class="replaceable"><code>key</code></em>
<em class="replaceable"><code>salt</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/crypt.html"><code class="function">crypt</code></a>,
arguments are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s.</dd><dt><a id="encrypt"></a><span class="term"><code class="code">(POSIX:ENCRYPT <em class="replaceable"><code>block</code></em>
<em class="replaceable"><code>decrypt-p</code></em>)</code><br /></span><span class="term"><code class="code">(POSIX:SETKEY <em class="replaceable"><code>key</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/encrypt.html"><code class="function">encrypt</code></a>
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setkey.html"><code class="function">setkey</code></a>, respectively.
<em class="replaceable"><code>block</code></em> and <em class="replaceable"><code>key</code></em> are of type
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_vector.html" target="_top"><code class="function">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8) 8)</code></span>.
<em class="replaceable"><code>decrypt-p</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="sys-log"></a>33.2.7. Syslog</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="openlog"></a><span class="term"><code class="code">(POSIX:OPENLOG ident <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:PID :CONS :NDELAY :ODELAY :NOWAIT :FACILITY)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/openlog.html"><code class="function">openlog</code></a>
</dd><dt><a id="setlogmask"></a><span class="term"><code class="code">(POSIX:SETLOGMASK
maskpri)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setlogmask.html"><code class="function">setlogmask</code></a>.
</dd><dt><a id="syslog"></a><span class="term"><code class="code">(POSIX:SYSLOG severity facility
<em class="replaceable"><code>format-string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>arguments</code></em>)</code></span></dt><dd><p class="simpara">Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/syslog.html"><code class="function">syslog</code></a> on
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_apply.html" target="_top"><code class="function">APPLY</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <em class="replaceable"><code>format-string</code></em> <em class="replaceable"><code>arguments</code></em>)</code>.</p><p class="simpara">No <span class="data"><code class="literal">%</code></span> conversion is performed,
you must do all formatting in Lisp.</p></dd><dt><a id="closelog"></a><span class="term"><code class="code">(POSIX:CLOSELOG)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/closelog.html"><code class="function">closelog</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="processes"></a>33.2.8. Processes</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="process-id"></a><span class="term"><code class="code">(OS:PROCESS-ID)</code></span></dt><dd>Return the process ID
(on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpid.html"><code class="function">getpid</code></a>,
on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> calls <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetCurrentProcessId"><code class="function">GetCurrentProcessId</code></a>)
</dd><dt><a id="priority"></a><span class="term"><code class="code">(OS:PRIORITY <em class="replaceable"><code>pid</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (OS:PRIORITY <em class="replaceable"><code>pid</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)
priority)</code></span></dt><dd><p>Return or set the process priority, platform-dependent
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> or platform-independent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>, one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:REALTIME</code></td><td><code class="constant">:NORMAL</code></td><td><code class="constant">:IDLE</code></td></tr><tr><td><code class="constant">:HIGH</code></td><td><code class="constant">:BELOW-NORMAL</code></td><td> </td></tr><tr><td><code class="constant">:ABOVE-NORMAL</code></td><td><code class="constant">:LOW</code></td><td> </td></tr></table><p>
On <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpriority.html"><code class="function">getpriority</code></a>
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html"><code class="function">setpriority</code></a>, on
<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> calls <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetPriorityClass"><code class="function">GetPriorityClass</code></a> and
<a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetPriorityClass"><code class="function">SetPriorityClass</code></a>.</p></dd><dt><a id="kill"></a><span class="term"><code class="code">(POSIX:KILL <em class="replaceable"><code>pid</code></em> <em class="replaceable"><code>signal</code></em>)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html"><code class="function">kill</code></a>.
</dd><dt><a id="getppid"></a><span class="term"><code class="code">(POSIX:GETPPID)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getppid.html"><code class="function">getppid</code></a>.
</dd><dt><a id="getpgrp"></a><span class="term"><code class="code">(POSIX:GETPGRP)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgrp.html"><code class="function">getpgrp</code></a>.
</dd><dt><a id="setpgrp"></a><span class="term"><code class="code">(POSIX:SETPGRP)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setpgrp.html"><code class="function">setpgrp</code></a>;
on non-<a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> systems where it requires 2 arguments (legacy
BSD-style), it is called as <code class="code">setpgrp(0,0)</code>.
</dd><dt><a id="getsid"></a><span class="term"><code class="code">(POSIX:GETSID <em class="replaceable"><code>pid</code></em>)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsid.html"><code class="function">getsid</code></a>.
</dd><dt><a id="setsid"></a><span class="term"><code class="code">(POSIX:SETSID)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsid.html"><code class="function">setsid</code></a>.
</dd><dt><a id="getpgid"></a><span class="term"><code class="code">(POSIX:PGID <em class="replaceable"><code>pid</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:PGID <em class="replaceable"><code>pid</code></em>)
<em class="replaceable"><code>pgid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgid.html"><code class="function">getpgid</code></a> and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setpgid.html"><code class="function">setpgid</code></a>.</dd><dt><a id="setreuid"></a><span class="term"><code class="code">(POSIX:SETREUID
ruid euid)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setreuid.html"><code class="function">setreuid</code></a>.
</dd><dt><a id="setregid"></a><span class="term"><code class="code">(POSIX:SETREGID
rgid egid)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setregid.html"><code class="function">setregid</code></a>.
</dd><dt><a id="getuid"></a><span class="term"><code class="code">(POSIX:UID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:UID) <em class="replaceable"><code>uid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getuid.html"><code class="function">getuid</code></a> and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setuid.html"><code class="function">setuid</code></a>.</dd><dt><a id="getgid"></a><span class="term"><code class="code">(POSIX:GID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:GID) <em class="replaceable"><code>gid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgid.html"><code class="function">getgid</code></a> and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setgid.html"><code class="function">setgid</code></a>.</dd><dt><a id="geteuid"></a><span class="term"><code class="code">(POSIX:EUID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:EUID) <em class="replaceable"><code>uid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/geteuid.html"><code class="function">geteuid</code></a> and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/seteuid.html"><code class="function">seteuid</code></a>.</dd><dt><a id="getegid"></a><span class="term"><code class="code">(POSIX:EGID)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:EGID) <em class="replaceable"><code>gid</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getegid.html"><code class="function">getegid</code></a> and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setegid.html"><code class="function">setegid</code></a>.</dd><dt><a id="getgroups"></a><span class="term"><code class="code">(POSIX:GROUPS)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (POSIX:GROUPS) <em class="replaceable"><code>list</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getgroups.html"><code class="function">getgroups</code></a> and
<a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=setgroups"><code class="function">setgroups</code></a>.
</dd><dt><a id="wait"></a><span class="term"><code class="code">(<a class="link" href="#wait"><code class="function">POSIX:WAIT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :PID :USAGE
:NOHANG :UNTRACED :STOPPED :EXITED :CONTINUED :NOWAIT)</code></span></dt><dd><p class="simpara">Wait for termination of the child process
<code class="constant">:PID</code> (or any child process if not specified).</p><p class="simpara">If <code class="constant">:NOHANG</code> is specifed, return <code class="literal">0</code>
as the only value immediately if no child process has terminated.</p><p class="simpara">Otherwise, the first return value is the <em class="replaceable"><code>pid</code></em> of the
terminated child process.</p><p>The second and third return values depend on the way the
process terminated:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">2nd value = <code class="constant">:EXITED</code><br /></span><span class="term">3rd value = <em class="replaceable"><code>exit status</code></em></span></dt><dd>if the child terminated normally, e.g., by
calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html"><code class="function">exit</code></a>.
</dd><dt><span class="term">2nd value = <code class="constant">:SIGNALED</code><br /></span><span class="term">3rd value = <em class="replaceable"><code>signal</code></em></span></dt><dd>if the child process was terminated by a <em class="replaceable"><code>signal</code></em>.
</dd><dt><span class="term">2nd value = <code class="constant">:STOPPED</code><br /></span><span class="term">3rd value = <em class="replaceable"><code>signal</code></em></span></dt><dd>if the child process was stopped by delivery of
a <em class="replaceable"><code>signal</code></em>.</dd><dt><span class="term">2nd value = <code class="constant">:CONTINUED</code><br /></span><span class="term">3rd value = <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>if the child process has continued from a job
control stop.</dd><dt><span class="term">2nd value = <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a><br /></span><span class="term">3rd value = <em class="replaceable"><code>number</code></em></span></dt><dd>if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> could not figure out what has happened.
Please read your local <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html"><code class="function">waitpid</code></a>
manual and send us a patch.</dd></dl></div><p class="simpara">The fourth value is only returned if <code class="constant">:USAGE</code>
is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and in that case it is a structure describing resource
usage by the terminated process, similar to what <a class="link" href="#usage"><code class="function">POSIX:USAGE</code></a> returns.</p><p class="simpara">To avoid race conditions, it is important to start your
subprocesses <span class="strong"><strong>and</strong></span> <a class="link" href="#wait"><code class="function">POSIX:WAIT</code></a> for them inside the <em class="replaceable"><code>body</code></em> of
a <a class="link" href="#with-subprocesses"><code class="function">POSIX:WITH-SUBPROCESSES</code></a> form.</p><p class="simpara">Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html"><code class="function">waitpid</code></a> and
(when the <code class="constant">:USAGE</code> argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
<a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=wait4"><code class="function">wait4</code></a>.</p></dd><dt><a id="with-subprocesses"></a><span class="term"><code class="code">(<a class="link" href="#with-subprocesses"><code class="function">POSIX:WITH-SUBPROCESSES</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a>)</code></span></dt><dd>Evaluate <em class="replaceable"><code>body</code></em> while receiving signals from
subprocesses; your <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a> and related <a class="link" href="#wait"><code class="function">POSIX:WAIT</code></a> calls should be
inside it.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="accounting"></a>33.2.9. Accounting</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="endutxent"></a><span class="term"><code class="code">(POSIX:ENDUTXENT)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/endutxent.html"><code class="function">endutxent</code></a>.
</dd><dt><a id="getutxent"></a><span class="term"><code class="code">(POSIX:GETUTXENT
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> utmpx)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getutxent.html"><code class="function">getutxent</code></a>,
returns a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> of type <span class="type">POSIX:UTMPX</span>,
which can be passed to subsequent calls to this function and re-used.
</dd><dt><a id="getutxid"></a><span class="term"><code class="code">(POSIX:GETUTXID id)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getutxid.html"><code class="function">getutxid</code></a>,
the argument is filled and returned.</dd><dt><a id="getutxline"></a><span class="term"><code class="code">(POSIX:GETUTXLINE line)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getutxline.html"><code class="function">getutxline</code></a>,
the argument is filled and returned.</dd><dt><a id="pututxline"></a><span class="term"><code class="code">(POSIX:PUTUTXLINE
utmpx)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/pututxline.html"><code class="function">pututxline</code></a>,
the argument is filled and returned.</dd><dt><a id="setutxent"></a><span class="term"><code class="code">(POSIX:SETUTXENT)</code></span></dt><dd>Calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setutxent.html"><code class="function">setutxent</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="posix-time"></a>33.2.10. Time and Data Conversion</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="strtime"></a><span class="term"><code class="code">(OS:STRING-TIME
<em class="replaceable"><code>format-string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>object</code></em> timezone)</code></span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">When <em class="replaceable"><code>object</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>,
it is parsed into a universal time according to <em class="replaceable"><code>format-string</code></em> by
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html"><code class="function">strptime</code></a>.</li><li class="listitem">When it is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>, it is formatted according
to <em class="replaceable"><code>format-string</code></em> by <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html"><code class="function">strftime</code></a>.
<em class="replaceable"><code>object</code></em> defaults to <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_get-unive_decoded-time.html" target="_top"><code class="function">GET-UNIVERSAL-TIME</code></a>)</code>.
</li></ul></div></dd><dt><a id="getdate"></a><span class="term"><code class="code">(OS:GETDATE <em class="replaceable"><code>string</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> timezone)</code></span></dt><dd><p class="simpara">Parse the <em class="replaceable"><code>string</code></em> into a universal time using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getdate.html"><code class="function">getdate</code></a>.</p><p class="simpara">If the the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html">environment variable</a> <code class="envar">DATEMSK</code> is not set when
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is invoked, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> sets it to point to the file
<code class="filename">modules/syscalls/datemsk</code>, installed as
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_merge-pathnames.html" target="_top"><code class="function">MERGE-PATHNAMES</code></a> "syscalls/datemsk" <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>)</code>.
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="strverscmp"></a>33.2.11. String comparision</h3></div></div></div><p>Functions </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(OS:VERSION< <em class="replaceable"><code>x<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>2</sub></code></em>)</code></td></tr><tr><td><code class="code">(OS:VERSION<= <em class="replaceable"><code>x<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>2</sub></code></em>)</code></td></tr><tr><td><code class="code">(OS:VERSION> <em class="replaceable"><code>x<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>2</sub></code></em>)</code></td></tr><tr><td><code class="code">(OS:VERSION>= <em class="replaceable"><code>x<sub>1</sub></code></em> <em class="replaceable"><code>x<sub>2</sub></code></em>)</code></td></tr></table><p>
compare two <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s as version numbers (e.g.,
<span class="data"><code class="literal">"foo10"</code></span> is <span class="emphasis"><em>greater</em></span> than
<span class="data"><code class="literal">"foo9"</code></span>) using
<a class="gnu" href="http://www.kernel.org/doc/man-pages/online/pages/man3/strverscmp.3.html"><code class="function">strverscmp</code></a> and return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>.</p><p>Function <code class="function">OS:VERSION-COMPARE</code> does the same but
returns either <span class="data"><code class="literal"><</code></span>,
<span class="data"><code class="literal">></code></span> or <span class="data"><code class="literal">=</code></span>.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="wildcard"></a>33.2.12. Wildcard Matching</h3></div></div></div><p>Wildcards describe sets of file names; see <span class="quote">“<span class="quote"><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13">Pathname Matching</a>
Notation</span>”</span> for the syntax description.</p><p><a id="fnmatch-f"></a><strong><code class="code">(POSIX:FNMATCH <em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>string</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :PATHNAME :PERIOD :NOESCAPE (:CASE-SENSITIVE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code>. </strong>This function returns a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> value if the <em class="replaceable"><code>string</code></em> matches
the <em class="replaceable"><code>pattern</code></em> by calling <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fnmatch.html"><code class="function">fnmatch</code></a>.
</p><p><a id="fnmatch-matcher"></a><strong><code class="code">(POSIX:FNMATCH-MATCHER
<em class="replaceable"><code>pattern</code></em>)</code>. </strong>This function is a valid value for <a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>.
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>These two functions used to reside in a separate package
<strong class="package"><span class="quote">“<span class="quote">WILDCARD</span>”</span></strong>, which has been now deprecated.
</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mk-xterm-io"></a>33.2.13. XTerm</h3></div></div></div><p><code class="code">(<a class="link" href="#mk-xterm-io" title="33.2.13. XTerm"><code class="function">POSIX:MAKE-XTERM-IO-STREAM</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> title xterm)</code>
When running under the <a class="ulink" href="http://www.x.org/" target="_top">X Window System</a>, you can create a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_b.html#bidirectional">bidirectional</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>, which uses a new
dedicated text window (created by the executable specified by
the <code class="constant">:XTERM</code> argument which should be compatible
with <span class="command"><strong>xterm</strong></span> and <span class="command"><strong>rxvt</strong></span>, i.e., accept
options <code class="option">-n</code>, <code class="option">-T</code>, and <code class="option">-e</code>)
using the function <a class="link" href="#mk-xterm-io" title="33.2.13. XTerm"><code class="function">POSIX:MAKE-XTERM-IO-STREAM</code></a>: </p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*ERROR-OUTPUT*</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*DEBUG-IO*</code></a>
(<a class="link" href="#mk-xterm-io" title="33.2.13. XTerm"><code class="function">POSIX:MAKE-XTERM-IO-STREAM</code></a> :title "clisp errors and debug")))
</pre><p><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="stdio"></a>33.2.14. Standard file input and output</h3></div></div></div><p>We define the type <span class="type">FFI:file</span> = <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a> and
the following functions:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html"><code class="function">fopen</code></a> <em class="replaceable"><code>filename</code></em>
<em class="replaceable"><code>mode</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdopen.html"><code class="function">fdopen</code></a> fd
<em class="replaceable"><code>mode</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/freopen.html"><code class="function">freopen</code></a> <em class="replaceable"><code>filename</code></em>
<em class="replaceable"><code>mode</code></em> <em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html"><code class="function">fclose</code></a>
<em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html"><code class="function">fflush</code></a>
<em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/clearerr.html"><code class="function">clearerr</code></a>
<em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/feof.html"><code class="function">feof</code></a>
<em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ferror.html"><code class="function">ferror</code></a>
<em class="replaceable"><code>file</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/fileno.html"><code class="function">fileno</code></a>
<em class="replaceable"><code>file</code></em>)</code></td></tr></table><p>call their namesakes defined in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html"><<code class="filename">stdio.h</code>></a>.</p><p>Functions </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="function">OS:FOPEN</code></td></tr><tr><td><code class="function">OS:FDOPEN</code></td></tr><tr><td><code class="function">OS:FREOPEN</code></td></tr><tr><td><code class="function">OS:FCLOSE</code></td></tr><tr><td><code class="function">OS:FFLUSH</code></td></tr><tr><td><code class="function">OS:FILENO</code></td></tr></table><p> may <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.</p><div class="variablelist"><p class="title"><strong>Return values</strong></p><dl class="variablelist"><dt><span class="term"><code class="function">OS:FOPEN</code><br /></span><span class="term"><code class="function">OS:FDOPEN</code></span></dt><dd><span class="type">FFI:file</span> = <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>
</dd><dt><span class="term"><code class="function">OS:FREOPEN</code><br /></span><span class="term"><code class="function">OS:FCLOSE</code><br /></span><span class="term"><code class="function">OS:FFLUSH</code><br /></span><span class="term"><code class="function">OS:CLEARERR</code></span></dt><dd>no values (they modify their <em class="replaceable"><code>file</code></em> argument in place)
</dd><dt><span class="term"><code class="function">OS:FEOF</code><br /></span><span class="term"><code class="function">OS:FERROR</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a></dd><dt><span class="term"><code class="function">OS:FILENO</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> (<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>)</dd></dl></div><p>We also define 3 constants </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">OS:STDIN</code></td></tr><tr><td><code class="constant">OS:STDOUT</code></td></tr><tr><td><code class="constant">OS:STDERR</code></td></tr></table><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="stdio-rationale"></a>Rationale</h4></div></div></div><p><a id="stdio-ffi"></a><strong>Iterface to foreign libraries. </strong>This functionality can be used by <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> <a href="impnotes.html#modules" class="olink">module</a>s which
interface to functions which use the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <span class="type">FILE*</span> pointers.
E.g., <span class="module"><a class="filename" href="#postgresql" title="33.9. PostgreSQL Database Access"><code class="filename">postgresql</code></a></span> has a function <a class="pq" href="http://www.postgresql.org/search/?q=PQtrace"><code class="function">PQtrace</code></a>
which expects a <span class="type">FILE*</span> argument.
You can use <code class="function">OS:FOPEN</code>
and <code class="function">OS:FCLOSE</code> for that.</p><p><a id="stdio-wild"></a><strong>Bypass <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> filename processing. </strong>You can also use this functionality to access files whose
names are interpreted as wild by <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>. E.g.,</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> ((file (posix:fopen "foo*" "r")))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a> (s (<a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> (posix:fileno file)))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> s))
(posix:fclose file)))
</pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="errno"></a>33.2.15. Error handling</h3></div></div></div><p>To handle errors in foreign functions, the following four
functions are provided: </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(POSIX:ERRNO <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd><p class="simpara">When <em class="replaceable"><code>error-code</code></em> is supplied, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a> is set (useful
before a system call which sets <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a> as the only way to report an
error).</p><p class="simpara">If <em class="replaceable"><code>error-code</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_number.html" target="_top"><code class="classname">NUMBER</code></a>, the corresponding <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_keyword.html" target="_top"><code class="classname">KEYWORD</code></a>
is returned and vice versa.</p><p class="simpara">When <em class="replaceable"><code>error-code</code></em> is not supplied, the current <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a> is
returned as a keyword if possible, a number otherwise.</p><p class="simpara">When <em class="replaceable"><code>error-code</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, all known error codes are
returned as an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.</p></dd><dt><span class="term"><code class="code">(OS:LAST-ERROR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd><p class="simpara">Just like <code class="function">POSIX:ERRNO</code>,
but uses <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetLastError"><code class="function">GetLastError</code></a>
and <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetLastError"><code class="function">SetLastError</code></a> instead
of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a>.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></p></dd><dt><span class="term"><code class="code">(POSIX:STRERROR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd><p class="simpara">Return a string description of <em class="replaceable"><code>error-code</code></em>.
When <em class="replaceable"><code>error-code</code></em> is not supplied, <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a> is used.</p><p class="simpara">This calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html"><code class="function">strerror</code></a>.</p></dd><dt><span class="term"><code class="code">(OS:FORMAT-MESSAGE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd><p class="simpara">Just like <code class="function">POSIX:STRERROR</code>,
but uses <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=FormatMessage"><code class="function">FormatMessage</code></a>
and <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetLastError"><code class="function">GetLastError</code></a>.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="misc"></a>33.2.16. Miscellanea</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="clipboard"></a><span class="term"><code class="code">(OS:CLIPBOARD)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (OS:CLIPBOARD) <em class="replaceable"><code>object</code></em>)</code></span></dt><dd><p class="simpara">Get
(using <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetClipboardData"><code class="function">GetClipboardData</code></a>) a set
(using <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=SetClipboardData"><code class="function">SetClipboardData</code></a>)
the windows clipboard.</p><p class="simpara">Return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>; convert <em class="replaceable"><code>object</code></em> to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">PRINC-TO-STRING</code></a>.</p><p class="simpara"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a> platforms only.</span></span></p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="i18n-mod"></a>33.3. Internationalization of User Programs</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#ggettext">33.3.1. The GNU gettext</a></span></dt><dd><dl><dt><span class="section"><a href="#domain">33.3.1.1. Domain</a></span></dt><dt><span class="section"><a href="#category">33.3.1.2. Category</a></span></dt><dt><span class="section"><a href="#i18n-example">33.3.1.3. Internationalization Example</a></span></dt></dl></dd><dt><span class="section"><a href="#i18n-locale">33.3.2. Locale</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ggettext"></a>33.3.1. The <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">gettext</a></h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#domain">33.3.1.1. Domain</a></span></dt><dt><span class="section"><a href="#category">33.3.1.2. Category</a></span></dt><dt><span class="section"><a href="#i18n-example">33.3.1.3. Internationalization Example</a></span></dt></dl></div><p><a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">gettext</a> is a set of functions, included in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> or the
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library, which permit looking up translations of strings
through message catalogs. It is also a set of tools which makes the
translation maintenance easy for the translator and the program
maintainer.</p><p>The <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gettext/" target="_top">gettext</a> functions are available in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> in the
<a class="link" href="#i18n" title="31.4. Internationalization of CLISP"><strong class="package"><span class="quote">“<span class="quote">I18N</span>”</span></strong></a> package, which is <a class="link" href="#re-export" title="11.1.3. Function EXT:RE-EXPORT"><code class="function">EXT:RE-EXPORT</code></a>ed from the <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>
package.</p><p>This module is present in the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> by default.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:I18N</code>.</p><div class="variablelist"><dl class="variablelist"><dt><a id="gettext"></a><span class="term"><code class="code">(<a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a>
<em class="replaceable"><code>MSGID</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>)</code></span></dt><dd>returns the translation of the message <em class="replaceable"><code>MSGID</code></em>,
in the given <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>, depending on the given <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>.
<em class="replaceable"><code>MSGID</code></em> should be an <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> string, and is normally the English message.
</dd><dt><a id="ngettext"></a><span class="term"><code class="code">(<a class="link" href="#ngettext"><code class="function">I18N:NGETTEXT</code></a>
<em class="replaceable"><code>MSGID</code></em> <em class="replaceable"><code>msgid_plural</code></em>
<em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>)</code></span></dt><dd>returns the plural form of the translation for of
<em class="replaceable"><code>MSGID</code></em> and <em class="replaceable"><code>n</code></em> in the given <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>, depending on the given
<a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>. <em class="replaceable"><code>MSGID</code></em> and <em class="replaceable"><code>msgid_plural</code></em>
should be <a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> strings, and are normally the English singular and
English plural variant of the message, respectively.
</dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="domain"></a>33.3.1.1. Domain</h4></div></div></div><p>The <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> is a string identifier denoting the program that
is requesting the translation. The pathname of the message catalog
depends on the <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>: usually it is located at
<code class="filename">TEXTDOMAINDIR/l/LC_MESSAGES/domain.mo</code>, where
<em class="replaceable"><code>l</code></em> is the <a class="ulink" href="http://www.loc.gov/standards/iso639-2/" target="_top">ISO
639-2</a> code of the language.
The notion of <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> allows several Lisp programs running in the same
image to request translations independently of each other.</p><p><a id="textdomain"></a><strong>Function <a class="link" href="#textdomain" title="Function I18N:TEXTDOMAIN"><code class="function">I18N:TEXTDOMAIN</code></a>. </strong><code class="code">(<a class="link" href="#textdomain" title="Function I18N:TEXTDOMAIN"><code class="function">I18N:TEXTDOMAIN</code></a>)</code> is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> that returns the default
<a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>, used when no <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> argument is passed to the <a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a> and
<a class="link" href="#ngettext"><code class="function">I18N:NGETTEXT</code></a> functions. It is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able.
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#textdomain" title="Function I18N:TEXTDOMAIN"><code class="function">I18N:TEXTDOMAIN</code></a>)</code> is usually used
during the startup phase of a program.
Note that the default <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> is not saved in a <a href="impnotes.html#image" class="olink">memory image</a>.
The use of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#textdomain" title="Function I18N:TEXTDOMAIN"><code class="function">I18N:TEXTDOMAIN</code></a>)</code> is
recommended only for programs that are so simple that they will never
need more than one <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>.</p><p><a id="textdomaindir"></a><strong>Function <a class="link" href="#textdomaindir" title="Function I18N:TEXTDOMAINDIR"><code class="function">I18N:TEXTDOMAINDIR</code></a>. </strong><code class="code">(<a class="link" href="#textdomaindir" title="Function I18N:TEXTDOMAINDIR"><code class="function">I18N:TEXTDOMAINDIR</code></a> <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a>)</code>
is a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a> that returns the base directory, called
<code class="filename">TEXTDOMAINDIR</code> above, where the message
catalogs for the given <a class="link" href="#domain" title="33.3.1.1. Domain"><em class="replaceable"><code>DOMAIN</code></em></a> are assumed to be installed.
It is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able.
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="link" href="#textdomaindir" title="Function I18N:TEXTDOMAINDIR"><code class="function">I18N:TEXTDOMAINDIR</code></a>)</code> is usually used
during the startup phase of a program, and should be used because only
the program knows where its message catalogs are installed.
Note that the <code class="filename">TEXTDOMAINDIR</code>s
are not saved in a <a href="impnotes.html#image" class="olink">memory image</a>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="category"></a>33.3.1.2. Category</h4></div></div></div><p>The <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a> argument of the <a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a> and <a class="link" href="#ngettext"><code class="function">I18N:NGETTEXT</code></a>
functions denotes which <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em> facet the result should depend on.
The possible values are a platform-dependent subset of
<span class="simplelist"><code class="constant">:LC_ADDRESS</code>, <code class="constant">:LC_ALL</code>, <code class="constant">:LC_COLLATE</code>, <code class="constant">:LC_CTYPE</code>, <code class="constant">:LC_IDENTIFICATION</code>, <code class="constant">:LC_MEASUREMENT</code>, <code class="constant">:LC_MESSAGES</code>, <code class="constant">:LC_MONETARY</code>, <code class="constant">:LC_NAME</code>, <code class="constant">:LC_NUMERIC</code>, <code class="constant">:LC_PAPER</code>, <code class="constant">:LC_TELEPHONE</code>, <code class="constant">:LC_TIME</code></span>
The use of these values is useful for users who have a
character/time/collation/money handling set differently from the usual
message handling.
Note that when a <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a> argument is used, the message catalog
location depends on the <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a>: it will be expected at
<code class="filename">TEXTDOMAINDIR/ll/category/domain.mo</code>.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="i18n-example"></a>33.3.1.3. Internationalization Example</h4></div></div></div><p>A non-internationalized program simulating a restaurant dialogue
might look as follows.</p><p><a id="i18n-non-i"></a><strong>prog.lisp. </strong></p><pre class="programlisting">
(setq n (parse-integer (first <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>)))
(format t "~A~%" "'Your command, please?', asked the waiter.")
(format t "~@?~%"
(if (= n 1) "a piece of cake" "~D pieces of cake")
n)
</pre><p>After being internationalized, all strings are wrapped in
<a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a> calls, and <a class="link" href="#ngettext"><code class="function">I18N:NGETTEXT</code></a> is used for plurals.
Also, <a class="link" href="#textdomaindir" title="Function I18N:TEXTDOMAINDIR"><code class="function">I18N:TEXTDOMAINDIR</code></a> is assigned a value; in our case, for simplicity,
the current directory.</p><p><a id="i18n-i"></a><strong>prog.lisp. </strong></p><pre class="programlisting">
(setf (textdomain) "prog")
(setf (textdomaindir "prog") "./")
(setq n (parse-integer (first <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>)))
(format t "~A~%"
(gettext "'Your command, please?', asked the waiter."))
(format t "~@?~%"
(ngettext "a piece of cake" "~D pieces of cake" n)
n)
</pre><p>For ease of reading, it is customary to define an abbreviation
for the <a class="link" href="#gettext"><code class="function">I18N:GETTEXT</code></a> function. An underscore is customary.</p><p><a id="i18n-i-abbrev"></a><strong>prog.lisp. </strong></p><pre class="programlisting">
(setf (textdomaindir "prog") "./")
(defun _ (msgid) (gettext msgid "prog"))
(setq n (parse-integer (first <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>)))
(format t "~A~%"
(_"'Your command, please?', asked the waiter."))
(format t "~@?~%"
(ngettext "a piece of cake" "~D pieces of cake" n "prog")
n)
</pre><p>Now the program's maintainer creates a message catalog template
through the command
</p><pre class="screen">
<strong><code class="prompt">$</code></strong> xgettext -o prog.pot prog.lisp
</pre><p>
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>xgettext version 0.11 or higher is required here.</p></div><p>The message catalog template looks roughly like this.</p><p><a id="i18n-pot"></a><strong>prog.pot. </strong></p><pre class="programlisting">
msgid "'Your command, please?', asked the waiter."
msgstr ""
msgid "a piece of cake"
msgid_plural "%d pieces of cake"
msgstr[0] ""
msgstr[1] ""
</pre><p>Then a French translator creates a French message catalog</p><p><a id="i18n-fr-po"></a><strong>prog.fr.po. </strong></p><pre class="programlisting">
msgid ""
msgstr ""
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "'Your command, please?', asked the waiter."
msgstr "«Votre commande, s'il vous plait», dit le garçon."
# Les gateaux allemands sont les meilleurs du monde.
msgid "a piece of cake"
msgid_plural "%d pieces of cake"
msgstr[0] "un morceau de gateau"
msgstr[1] "%d morceaux de gateau"
</pre><p>and sends it to the program's maintainer.</p><p>The program's maintainer compiles the catalog as follows:
</p><pre class="screen">
<strong><code class="prompt">$</code></strong> mkdir -p ./fr/LC_MESSAGES
<strong><code class="prompt">$</code></strong> msgfmt -o ./fr/LC_MESSAGES/prog.mo prog.fr.po
</pre><p>When a user in a french <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em> then runs the program
</p><pre class="screen">
<strong><code class="prompt">$</code></strong> clisp prog.lisp 2
</pre><p>
she will get the output
</p><pre class="screen">
«Votre commande, s'il vous plait», dit le garçon.
2 morceaux de gateau
</pre><p>
</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="i18n-locale"></a>33.3.2. Locale</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="set-locale"></a><span class="term"><code class="code">(<a class="link" href="#set-locale"><code class="function">I18N:SET-LOCALE</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a> <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em>)</code></span></dt><dd><p class="simpara">This is an interface to
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setlocale.html"><code class="function">setlocale</code></a>.</p><p class="simpara">When <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return the current one.</p><p class="simpara">When <a class="link" href="#category" title="33.3.1.2. Category"><em class="replaceable"><code>CATEGORY</code></em></a> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return all categories
as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.</p></dd><dt><a id="locale-conv"></a><span class="term"><code class="code">(<a class="link" href="#locale-conv"><code class="function">I18N:LOCALE-CONV</code></a>)</code></span></dt><dd><p class="simpara">This is an interface to
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html"><code class="function">localeconv</code></a>.</p><p class="simpara">Returns a <span class="type">I18N:LOCALE-CONV</span>
structure.</p></dd><dt><a id="lang-info"></a><span class="term"><code class="code">(<a class="link" href="#lang-info"><code class="function">I18N:LANGUAGE-INFORMATION</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>item</code></em>)</code></span></dt><dd><p class="simpara">This is an interface to
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/nl_langinfo.html"><code class="function">nl_langinfo</code></a> (<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>)
and <a class="win32" href="https://social.msdn.microsoft.com/search/en-US/windows?query=GetLocaleInfo"><code class="function">GetLocaleInfo</code></a> (<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>).</p><p class="simpara">When <em class="replaceable"><code>item</code></em> is missing or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
return all available information as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.</p></dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="regexp-mod"></a>33.4. POSIX Regular Expressions</h2></div></div></div><div class="list-of-examples"><p><strong>List of Examples</strong></p><dl><dt>33.1. <a href="#ex-re-match"><code class="function">REGEXP:MATCH</code></a></dt><dt>33.2. <a href="#ex-re-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a></dt><dt>33.3. <a href="#re-count-shell-users">Count unix shell users</a></dt></dl></div><p>The <a class="link" href="#regexp-mod" title="33.4. POSIX Regular Expressions"><strong class="package"><span class="quote">“<span class="quote">REGEXP</span>”</span></strong></a> module implements the <a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a>
<a class="ulink" href="regexp.html" target="_top">regular expressions</a>
matching by calling the standard <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> system facilities.
The syntax of these <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a>s is described in many places,
such as your local <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html"><<code class="filename">regex.h</code>></a> manual and <a class="ulink" href="http://www.gnu.org/software/emacs/" target="_top">Emacs</a> info pages.</p><p>This module is present in the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> by default.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:REGEXP</code>.</p><div class="variablelist"><a id="regexp-api"></a><p class="title"><strong>Regular Expression API</strong></p><dl class="variablelist"><dt><a id="re-match"></a><span class="term"><code class="code">(<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> <em class="replaceable"><code>pattern</code></em>
<em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> (<code class="constant">:START</code> 0) <code class="constant">:END</code> <a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a>
<a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a>)</code></span></dt><dd><p>This macro returns as first value a <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structure
containing the indices of the start and end of the first match for the
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> <em class="replaceable"><code>pattern</code></em> in <em class="replaceable"><code>string</code></em>; or no values if there is no match.
Additionally, a <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structure is returned for every matched
<code class="literal">"\(...\)"</code> group in <em class="replaceable"><code>pattern</code></em>, in the
order that the open parentheses appear in <em class="replaceable"><code>pattern</code></em>.
If <em class="replaceable"><code>start</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, the search starts at that index in <em class="replaceable"><code>string</code></em>.
If <em class="replaceable"><code>end</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, only <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_subseq.html" target="_top"><code class="function">SUBSEQ</code></a> <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>start</code></em>
<em class="replaceable"><code>end</code></em>)</code> is considered.
</p><div class="example"><a id="ex-re-match"></a><p class="title"><strong>Example 33.1. <a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a></strong></p><div class="example-contents"><pre class="programlisting">
(<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> "quick" "The quick brown fox jumped quickly.")
⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 4 :END 9)</code>
(<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> "quick" "The quick brown fox jumped quickly." :start 8)
⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 27 :END 32)</code>
(<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> "quick" "The quick brown fox jumped quickly." :start 8 :end 30)
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></code>
(<a class="link" href="#re-match"><code class="function">REGEXP:MATCH</code></a> "\\([a-z]*\\)[0-9]*\\(bar\\)" "foo12bar")
⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 0 :END 8)</code> ;
⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 0 :END 3)</code> ;
⇒ <code class="computeroutput">#S(<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> :START 5 :END 8)</code>
</pre></div></div><p><br class="example-break" />
</p></dd><dt><a id="re-match-access"></a><span class="term"><code class="code">(<a class="link" href="#re-match-access"><code class="function">REGEXP:MATCH-START</code></a> <em class="replaceable"><code>match</code></em>)</code><br /></span><span class="term"><code class="code">(<a class="link" href="#re-match-access"><code class="function">REGEXP:MATCH-END</code></a> <em class="replaceable"><code>match</code></em>)</code></span></dt><dd>Return the start and end the <em class="replaceable"><code>match</code></em>; <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>-able.
</dd><dt><a id="re-match-string"></a><span class="term"><code class="code">(<a class="link" href="#re-match-string"><code class="function">REGEXP:MATCH-STRING</code></a> <em class="replaceable"><code>string</code></em> <em class="replaceable"><code>match</code></em>)</code></span></dt><dd>Extracts the substring of <em class="replaceable"><code>string</code></em> corresponding
to the given pair of start and end indices of <em class="replaceable"><code>match</code></em>.
The result is shared with <em class="replaceable"><code>string</code></em>.
If you want a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_copy-seq.html" target="_top"><code class="function">COPY-SEQ</code></a> or
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-string.html" target="_top"><code class="classname">SIMPLE-STRING</code></a>.</dd><dt><a id="re-regexp-quote"></a><span class="term"><code class="code">(<a class="link" href="#re-regexp-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a>
<em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>extended</code></em>)</code></span></dt><dd><p>This function returns a <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
that matches exactly <em class="replaceable"><code>string</code></em> and nothing else.
This allows you to request an exact string match when calling a
function that wants a <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a>.
</p><div class="example"><a id="ex-re-quote"></a><p class="title"><strong>Example 33.2. <a class="link" href="#re-regexp-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a></strong></p><div class="example-contents"><pre class="programlisting">
(regexp-quote "^The cat$")
⇒ <code class="computeroutput">"\\^The cat\\$"</code></pre></div></div><p><br class="example-break" />
One use of <a class="link" href="#re-regexp-quote"><code class="function">REGEXP:REGEXP-QUOTE</code></a> is to combine an exact string match with
context described as a <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a>.
When <em class="replaceable"><code>extended</code></em> is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, also
quote <span class="keysym">#\+</span> and <span class="keysym">#\?</span>.
</p></dd><dt><a id="re-regexp-compile"></a><span class="term"><code class="code">(<a class="link" href="#re-regexp-compile"><code class="function">REGEXP:REGEXP-COMPILE</code></a>
<em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a>)</code></span></dt><dd>Compile the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> <em class="replaceable"><code>string</code></em> into an
object suitable for <a class="link" href="#re-regexp-exec"><code class="function">REGEXP:REGEXP-EXEC</code></a>.</dd><dt><a id="re-regexp-exec"></a><span class="term"><code class="code">(<a class="link" href="#re-regexp-exec"><code class="function">REGEXP:REGEXP-EXEC</code></a>
<em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:RETURN-TYPE</code>
(<code class="constant">:START</code> 0) <code class="constant">:END</code> <a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a>)</code></span></dt><dd><p class="simpara">Execute the <em class="replaceable"><code>pattern</code></em>, which must be a compiled
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> returned by <a class="link" href="#re-regexp-compile"><code class="function">REGEXP:REGEXP-COMPILE</code></a>, against the appropriate
portion of the <em class="replaceable"><code>string</code></em>.</p><p class="simpara">Returns <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structures as <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a> (one for each
subexpression which successfully matched and one for the whole pattern).
</p><p class="simpara">If <code class="constant">:RETURN-TYPE</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>), the
<a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structures are returned as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> (or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>) instead.
Also, if there are more than <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_multip_values-limit.html" target="_top"><code class="constant">MULTIPLE-VALUES-LIMIT</code></a> <a class="link" href="#regexp-api" title="Regular Expression API"><code class="classname">REGEXP:MATCH</code></a> structures
to return, a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> is returned instead of <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.
If <code class="constant">:RETURN-TYPE</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a>, return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> as an indicator
of success or failure, but do <span class="strong"><strong>not</strong></span> allocate anything.
</p></dd><dt><a id="re-regexp-split"></a><span class="term"><code class="code">(<a class="link" href="#re-regexp-split"><code class="function">REGEXP:REGEXP-SPLIT</code></a>
<em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> (<code class="constant">:START</code> 0) <code class="constant">:END</code>
<a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a> <a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a>)</code></span></dt><dd>Return a list of substrings of <em class="replaceable"><code>string</code></em> (all
sharing the structure with <em class="replaceable"><code>string</code></em>) separated by <em class="replaceable"><code>pattern</code></em> (a
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html">regular expression</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or a return value of <a class="link" href="#re-regexp-compile"><code class="function">REGEXP:REGEXP-COMPILE</code></a>)
</dd><dt><a id="re-with-loop-split"></a><span class="term"><code class="code">(<a class="link" href="#re-with-loop-split"><code class="function">REGEXP:WITH-LOOP-SPLIT</code></a>
(<em class="replaceable"><code>variable</code></em> <em class="replaceable"><code>stream</code></em> <em class="replaceable"><code>pattern</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> (<code class="constant">:START</code> 0) <code class="constant">:END</code>
<a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a> <a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Read lines from <em class="replaceable"><code>stream</code></em>, split them with
<a class="link" href="#re-regexp-split"><code class="function">REGEXP:REGEXP-SPLIT</code></a> on <em class="replaceable"><code>pattern</code></em>, and bind the resulting list to
<em class="replaceable"><code>variable</code></em>.</dd><dt><a id="re-cflags"></a><span class="term"><a class="link" href="#re-cflags"><code class="constant">:EXTENDED</code> <code class="constant">:IGNORE-CASE</code> <code class="constant">:NEWLINE</code> <code class="constant">:NOSUB</code></a></span></dt><dd>These options control compilation of a pattern.
See <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html"><<code class="filename">regex.h</code>></a> for their meaning.</dd><dt><a id="re-eflags"></a><span class="term"><a class="link" href="#re-eflags"><code class="constant">:NOTBOL</code> <code class="constant">:NOTEOL</code></a></span></dt><dd>These options control execution of a pattern.
See <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html"><<code class="filename">regex.h</code>></a> for their meaning.</dd><dt><a id="re-matcher"></a><span class="term"><a class="link" href="#re-matcher"><code class="function">REGEXP:REGEXP-MATCHER</code></a></span></dt><dd>A valid value for <a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>.
This will work only when your <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em> is <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a>
because <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses <a class="link" href="#charset-UTF-8"><code class="constant">CHARSET:UTF-8</code></a> internally and <a class="ulink" href="http://www.opengroup.org/austin/papers/posix_faq.html" target="_top"><span class="platform">POSIX</span></a> constrains
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html"><<code class="filename">regex.h</code>></a> to use the current <em class="replaceable"><code><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html">LOCALE</a></code></em>.</dd></dl></div><div class="example"><a id="re-count-shell-users"></a><p class="title"><strong>Example 33.3. Count unix shell users</strong></p><div class="example-contents"><p>The following code computes the number of people who use a
particular shell:</p><pre class="programlisting">
#!/usr/bin/clisp -C
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_use-package.html" target="_top"><code class="function">USE-PACKAGE</code></a> "REGEXP")
(let ((h (make-hash-table :test #'equal :size 10)) (n 0))
(with-open-file (f (or (first <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>) "/etc/passwd"))
(with-loop-split (s f (s f (or (second <a href="impnotes.html#script-exec" class="olink"><code class="varname">EXT:*ARGS*</code></a>) ":")))
(incf (gethash (seventh s) h 0))))
(with-hash-table-iterator (i h)
(loop (multiple-value-bind (r k v) (i)
(unless r (return))
(format t "[~d] ~s~30t== ~5:d~%" (incf n) k v)))))
</pre><p>For comparison, the same (almost - except for the nice output formatting)
can be done by the following <a class="ulink" href="http://www.perl.com" target="_top"><span class="command"><strong>Perl</strong></span></a>:</p><pre class="programlisting">
#!/usr/bin/perl -w
use diagnostics;
use strict;
my $IN = $ARGV[0] || "/etc/passwd";
open(INF,"≤ $IN") or die "$0: cannot read file [$IN]: $!\n";
my %hash;
while (≤INF≥) {
chop;
my @all = split($ARGV[1] || ":");
$hash{$all[6] || ""}++;
}
my $ii = 0;
for my $kk (keys(%hash)) {
print "[",++$ii,"] \"",$kk,"\" -- ",$hash{$kk},"\n";
}
close(INF);
</pre></div></div><br class="example-break" /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="readline-mod"></a>33.5. Advanced Readline and History Functionality</h2></div></div></div><p>The <strong class="package"><span class="quote">“<span class="quote">READLINE</span>”</span></strong> module exports most
of the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> functions using <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>.</p><p>This module is present even in the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> by default
on platforms where both <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> and <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> are available.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:READLINE</code>.</p><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/readline/test.tst"><code class="filename">modules/readline/test.tst</code></a>
for sample usage.</p><div class="variablelist"><p class="title"><strong>Lisp-level Functionality</strong></p><dl class="variablelist"><dt><span class="term"><code class="varname">READLINE:*READLINE-INPUT-STREAM*</code></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> (see <a class="xref" href="#stream-buffer" title="21.17. Functions EXT:MAKE-BUFFERED-INPUT-STREAM and EXT:MAKE-BUFFERED-OUTPUT-STREAM">Section 21.17, “Functions <code class="function">EXT:MAKE-BUFFERED-INPUT-STREAM</code>
and <code class="function">EXT:MAKE-BUFFERED-OUTPUT-STREAM</code>
”</a>)
that receives user input using <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> and the standard <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
<a class="link" href="#prompt" title="31.9. The Prompt">prompt</a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gdbm"></a>33.6. GDBM - The GNU database manager</h2></div></div></div><p>This is an interface to the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gdbm/" target="_top">DataBase Manager</a>, which extends the standard
<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ndbm.h.html"><<code class="filename">ndbm.h</code>></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
symbol <code class="constant">:GDBM</code>.</p><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/gdbm/test.tst"><code class="filename">modules/gdbm/test.tst</code></a>
for sample usage.</p><div class="variablelist"><a id="gdbm-api"></a><p class="title"><strong>GDBM module API</strong></p><dl class="variablelist"><dt><a id="gdbm-version"></a><span class="term"><code class="code">(GDBM:GDBM-VERSION)</code></span></dt><dd><p>Return the version string.</p></dd><dt><a id="gdbm-open"></a><span class="term"><code class="code">(GDBM:GDBM-OPEN <em class="replaceable"><code>filename</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :BLOCKSIZE :READ-WRITE :OPTION :MODE :DEFAULT-KEY-TYPE
:DEFAULT-VALUE-TYPE)</code></span></dt><dd><p>Open <em class="replaceable"><code>filename</code></em> database file.
The return value is a <span class="type">GDBM</span> structure.
<code class="constant">:READ-WRITE</code> can have one of following values:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:READER</code></td></tr><tr><td><code class="constant">:WRITER</code></td></tr><tr><td><code class="constant">:WRCREAT</code></td></tr><tr><td><code class="constant">:NEWDB</code></td></tr></table><p>
and <code class="constant">:OPTION</code> is one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:SYNC</code></td></tr><tr><td><code class="constant">:NOLOCK</code></td></tr><tr><td><code class="constant">:FAST</code></td></tr></table><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> can store and retrieve values of the
following types:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (meaning anything that can be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_coerce.html" target="_top"><code class="function">COERCE</code></a>d to
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>)</td></tr><tr><td><span class="type"><code class="literal">EXT:32BIT-VECTOR</code></span> (meaning
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 32)</code></span>)</code></span>)</td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a></td></tr></table><p>
and <code class="constant">:DEFAULT-KEY-TYPE</code>
and <code class="constant">:DEFAULT-VALUE-TYPE-TYPE</code> should be one of
those. If not specified (or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>), the <code class="constant">:TYPE</code>
argument is required in the access functions below.</p><p>If <em class="replaceable"><code>filename</code></em> is actually an existing <span class="type">GDBM</span> structure,
then it is re-opened (if it has been closed), and returned as is.</p><p>The return value is <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a>d with
<a class="link" href="#gdbm-close"><code class="function">GDBM-CLOSE</code></a>.</p></dd><dt><a id="gdbm-default-types"></a><span class="term"><code class="code">(GDBM:GDBM-DEFAULT-KEY-TYPE <em class="replaceable"><code>db</code></em>)</code><br /></span><span class="term"><code class="code">(GDBM:GDBM-DEFAULT-VALUE-TYPE <em class="replaceable"><code>db</code></em>)</code></span></dt><dd><p>Return the default data conversion types.</p></dd><dt><a id="gdbm-close"></a><span class="term"><code class="code">(GDBM:GDBM-CLOSE <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Close the database.
</dd><dt><a id="gdbm-open-p"></a><span class="term"><code class="code">(GDBM:GDBM-OPEN-P <em class="replaceable"><code>db</code></em>)</code></span></dt><dd><p class="simpara">Check whether <em class="replaceable"><code>db</code></em> has been already closed.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Only the above functions accept closed databases,
the following functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>s an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> when passed a closed database.
</p></div></dd><dt><a id="gdbm-store"></a><span class="term"><code class="code">(GDBM:GDBM-STORE <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em> <em class="replaceable"><code>contents</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:FLAG)</code></span></dt><dd><p><em class="replaceable"><code>db</code></em> is the <span class="type">GDBM</span> structure returned by
<a class="link" href="#gdbm-open"><code class="function">GDBM-OPEN</code></a>.
<em class="replaceable"><code>key</code></em> is the key datum.
<em class="replaceable"><code>contents</code></em> is the data to be associated with the key.
<code class="constant">:FLAG</code> can have one of following values:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:INSERT</code></td></tr><tr><td><code class="constant">:REPLACE</code></td></tr></table><p>
</p></dd><dt><a id="gdbm-fetch"></a><span class="term"><code class="code">(GDBM:GDBM-FETCH <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
(TYPE (GDBM:GDBM-DEFAULT-VALUE-TYPE <em class="replaceable"><code>db</code></em>)))</code></span></dt><dd>Search the database.
The <code class="constant">:TYPE</code> argument specifies the return type.
</dd><dt><a id="gdbm-delete"></a><span class="term"><code class="code">(GDBM:GDBM-DELETE <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em>)</code></span></dt><dd>Delete <em class="replaceable"><code>key</code></em> and its contents.
</dd><dt><a id="gdbm-exists"></a><span class="term"><code class="code">(GDBM:GDBM-EXISTS <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em>)</code></span></dt><dd>Search data without retrieving it.
</dd><dt><a id="gdbm-firstkey"></a><span class="term"><code class="code">(GDBM:GDBM-FIRSTKEY <em class="replaceable"><code>db</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
(TYPE (GDBM:GDBM-DEFAULT-KEY-TYPE <em class="replaceable"><code>db</code></em>)))</code></span></dt><dd>Return the key of the first entry, as <code class="constant">:TYPE</code>.
If the database has no entries, the return value is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd><dt><a id="gdbm-nextkey"></a><span class="term"><code class="code">(GDBM:GDBM-NEXTKEY <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>key</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
(TYPE (GDBM:GDBM-DEFAULT-KEY-TYPE <em class="replaceable"><code>db</code></em>)))</code></span></dt><dd>Return the key that follows <em class="replaceable"><code>key</code></em>, as <code class="constant">:TYPE</code>,
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if there are no further entries.
</dd><dt><a id="gdbm-reorganize"></a><span class="term"><code class="code">(GDBM:GDBM-REORGANIZE <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Reorganize the database.
</dd><dt><a id="gdbm-sync"></a><span class="term"><code class="code">(GDBM:GDBM-SYNC <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Syncronize the in-memory state of the database to
the disk file.</dd><dt><a id="gdbm-setopt"></a><span class="term"><code class="code">(GDBM:GDBM-SETOPT <em class="replaceable"><code>db</code></em> <em class="replaceable"><code>option</code></em> <em class="replaceable"><code>value</code></em>)</code></span></dt><dd><p>Set options on an already open database.
<em class="replaceable"><code>option</code></em> is one of following:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:CACHESIZE</code></span></dt><dd>set the size of the internal bucket cache.
(default is 100)</dd><dt><span class="term"><code class="constant">:FASTMODE</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (obsolete)
</dd><dt><span class="term"><code class="constant">:SYNCMODE</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><code class="constant">:CENTFREE</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><code class="constant">:COALESCEBLKS</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></dd><dt><span class="term"><code class="constant">:DEFAULT-VALUE-TYPE</code><br /></span><span class="term"><code class="constant">:DEFAULT-KEY-TYPE</code></span></dt><dd>see
<a class="link" href="#gdbm-open"><code class="function">GDBM-OPEN</code></a>
</dd></dl></div></dd><dt><a id="gdbm-file-size"></a><span class="term"><code class="code">(GDBM:GDBM-FILE-SIZE <em class="replaceable"><code>db</code></em>)</code></span></dt><dd>Return the underlying file size using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html"><code class="function">lseek</code></a>.</dd><dt><a id="gdbm-do-db"></a><span class="term"><code class="code">(GDBM:DO-DB (<em class="replaceable"><code>key</code></em> <em class="replaceable"><code>db</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>options</code></em>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Iterate over the database keys, <em class="replaceable"><code>options</code></em> are
passed to <code class="function">GDBM-FIRSTKEY</code>
and <code class="function">GDBM-NEXTKEY</code>.
<em class="replaceable"><code>body</code></em> is passed to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a>, so you can use all the standard loop
contructs, e.g., <code class="code">(do-db (k db) :collect (list k (gdbm-fetch
k)))</code> will convert the database to an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a>.
</dd><dt><a id="gdbm-with-open-db"></a><span class="term"><code class="code">(GDBM:WITH-OPEN-DB (<em class="replaceable"><code>db</code></em> <em class="replaceable"><code>filename</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>options</code></em>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Open the <em class="replaceable"><code>filename</code></em>, execute the <em class="replaceable"><code>body</code></em>, close
the database.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="berkeley-db"></a>33.7. Berkeley DB access</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#bdb-objects">33.7.1. Berkeley-DB Objects</a></span></dt><dt><span class="section"><a href="#bdb-close">33.7.2. Closing handles</a></span></dt><dt><span class="section"><a href="#bdb-db-environment">33.7.3. Database Environment</a></span></dt><dt><span class="section"><a href="#bdb-environment-config">33.7.4. Environment Configuration</a></span></dt><dt><span class="section"><a href="#bdb-operations">33.7.5. Database Operations</a></span></dt><dt><span class="section"><a href="#bdb-db-config">33.7.6. Database Configuration</a></span></dt><dt><span class="section"><a href="#bdb-cursor">33.7.7. Database Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-lock">33.7.8. Lock Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-log">33.7.9. Log Subsystem</a></span></dt><dd><dl><dt><span class="section"><a href="#bdb-log-cursor">33.7.9.1. Log Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-log-seq">33.7.9.2. Log Sequence Numbers</a></span></dt></dl></dd><dt><span class="section"><a href="#bdb-mem-pool">33.7.10. Memory Pool Subsystem</a></span></dt><dt><span class="section"><a href="#bdb-replication">33.7.11. Replication</a></span></dt><dt><span class="section"><a href="#bdb-sequences">33.7.12. Sequences</a></span></dt><dt><span class="section"><a href="#bdb-transaction">33.7.13. Transaction Subsystem</a></span></dt></dl></div><p>This interface to <a class="ulink" href="http://www.oracle.com/technetwork/products/berkeleydb/overview/index.html" target="_top">Berkeley DB</a>
from <a class="ulink" href="http://en.wikipedia.org/wiki/Sleepycat_Software" target="_top">Sleepycat
Software</a>/<a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> exports most functions in the official
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> API. Supported versions:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_2.html">4.2</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_3.html">4.3</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_4.html">4.4</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_5.html">4.5</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_6.html">4.6</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_7.html">4.7</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_4_8.html">4.8</a></td></tr><tr><td><a class="bdb" href="http://download.oracle.com/otndocs/products/berkeleydb/html/changelog_5_3.html">5.3</a></td></tr></table><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
symbol <code class="constant">:BERKELEY-DB</code>.</p><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/berkeley-db/test.tst"><code class="filename">modules/berkeley-db/test.tst</code></a>
for sample usage.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The symbol names do evolve with new Berkeley DB releases.
E.g., version 4.3 introduced <code class="constant">DB_DSYNC_LOG</code> which
was renamed to <code class="constant">DB_LOG_DSYNC</code> in version 4.7.
The corresponding Lisp symbol was renamed from
<code class="constant">:DSYNC-LOG</code> to <code class="constant">:LOG-DSYNC</code>
when support for version 4.7 was added.
This means that we always use Lisp names which correspond to the
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> names in the latest Berkeley DB release, even though we keep suport
for older releases.
This is convenient because the online documentation to which this
manual refers documents the latest Berkeley DB release.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-objects"></a>33.7.1. Berkeley-DB Objects</h3></div></div></div><p>Thie module exports the following opaque <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> types:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="type">BDB:DBE</span></span></dt><dd>environment handle</dd><dt><span class="term"><span class="type">BDB:DB</span></span></dt><dd>database handle</dd><dt><span class="term"><span class="type">BDB:DBC</span></span></dt><dd>cursor handle</dd><dt><span class="term"><span class="type">BDB:TXN</span></span></dt><dd>transaction handle</dd><dt><span class="term"><span class="type">BDB:LOGC</span></span></dt><dd>log cursor handle</dd><dt><span class="term"><span class="type">BDB:MPOOLFILE</span></span></dt><dd>memory pool file handle</dd><dt><span class="term"><span class="type">BDB:DBLOCK</span></span></dt><dd>lock handle</dd></dl></div><p>
They contain the internal handle (a <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>), the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>
of parents, and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of dependents.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-close"></a>33.7.2. Closing handles</h3></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> will close (or commit, in the case of a
<a class="link" href="#bdb-transaction" title="33.7.13. Transaction Subsystem">transaction</a>, or
put, in the case of a <a class="link" href="#bdb-lock" title="33.7.8. Lock Subsystem">lock</a>)
the Berkeley-DB handle objects. The <a href="impnotes.html#gc" class="olink">garbage-collect</a>or will also call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.
Closing an object will <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> all its dependents and remove the object
itself from the dependents lists of its parents (but see
<a class="link" href="#bdb-lock" title="33.7.8. Lock Subsystem"><code class="function">BDB:LOCK-CLOSE</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-db-environment"></a>33.7.3. Database Environment</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:DB-VERSION <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
subsystems-too)</code></span></dt><dd><p>Return version information as multiple values:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">descriptive <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
(from <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/env_version.html"><code class="function">db_version</code></a>)</li><li class="listitem">major version number (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>)</li><li class="listitem">minor version number (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>)</li><li class="listitem">patch number (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>)</li></ol></div><p>When the optional argument is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, returns the
<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> of the subsystem versions as the 5th value.
</p></dd><dt><a id="dbe-create"></a><span class="term"><code class="code">(BDB:DBE-CREATE <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
PASSWORD ENCRYPT)</code></span></dt><dd>Create an environment handle
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/env_class.html"><code class="function">db_env_create</code></a>),
possibly using encryption with password
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_encrypt.html"><code class="function">DB_ENV->set_encrypt</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DBE-CLOSE dbe)</code></span></dt><dd>Close an environment
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envclose.html"><code class="function">DB_ENV->close</code></a>).
You can also call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.</dd><dt><span class="term"><code class="code">(BDB:DBE-MESSAGES dbe)</code></span></dt><dd>Return the verbose messages accumulated so far
(requires Berkeley-DB 4.3 or better).</dd><dt><span class="term"><code class="code">(BDB:DBREMOVE dbe file
database <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> TRANSACTION AUTO-COMMIT)</code></span></dt><dd>Remove a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envdbremove.html"><code class="function">DB_ENV->dbremove</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DBREMOVE dbe file
database newname <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> TRANSACTION AUTO-COMMIT)</code></span></dt><dd>Rename a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envdbrename.html"><code class="function">DB_ENV->dbrename</code></a>).
</dd><dt><a id="dbe-open"></a><span class="term"><code class="code">(BDB:DBE-OPEN dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
FLAGS HOME JOIN INIT-CDB INIT-LOCK INIT-LOG INIT-MPOOL INIT-TXN
RECOVER RECOVER-FATAL USE-ENVIRON USE-ENVIRON-ROOT CREATE
LOCKDOWN PRIVATE SYSTEM-MEM THREAD MODE)</code></span></dt><dd>Open an environment
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envopen.html"><code class="function">DB_ENV->open</code></a>).
<code class="constant">:FLAGS</code> may be the value of a previous call
to <code class="code">(<a class="link" href="#dbe-get-options"><code class="function">BDB:DBE-GET-OPTIONS</code></a> dbe :OPEN)</code>.
</dd><dt><span class="term"><code class="code">(BDB:DBE-REMOVE dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
HOME FORCE USE-ENVIRON USE-ENVIRON-ROOT)</code></span></dt><dd>Destroy an environment
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envremove.html"><code class="function">DB_ENV->remove</code></a>).
</dd><dt><a id="with-dbe"></a><span class="term"><code class="code">(BDB:WITH-DBE (var <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<em class="replaceable"><code>create</code></em> <em class="replaceable"><code>options</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> body)</code></span></dt><dd>Create an environment, execute <em class="replaceable"><code>body</code></em>, close it.
<em class="replaceable"><code>create</code></em> is a list of options to be passed to <a class="link" href="#dbe-create"><code class="function">BDB:DBE-CREATE</code></a>,
<em class="replaceable"><code>options</code></em> is a list of options to be passed to <a class="link" href="#dbe-set-options"><code class="function">BDB:DBE-SET-OPTIONS</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-environment-config"></a>33.7.4. Environment Configuration</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="dbe-set-options"></a><span class="term"><code class="code">(BDB:DBE-SET-OPTIONS dbe
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> MSGFILE ERRFILE ERRPFX PASSWORD ENCRYPT LOCK-TIMEOUT TXN-TIMEOUT
SHM-KEY TAS-SPINS TX-TIMESTAMP TX-MAX DATA-DIR TMP-DIR
INTERMEDIATE-DIR-MODE LG-BSIZE LG-DIR
LG-MAX LG-REGIONMAX NCACHE CACHESIZE CACHE LK-CONFLICTS LK-DETECT
LK-MAX-LOCKERS LK-MAX-LOCKS LK-MAX-OBJECTS
LOG-DIRECT LOG-DSYNC LOG-AUTO-REMOVE LOG-IN-MEMORY LOG-ZERO
AUTO-COMMIT CDB-ALLDB DIRECT-DB NOLOCKING NOMMAP NOPANIC
OVERWRITE PANIC-ENVIRONMENT REGION-INIT TXN-NOSYNC TXN-WRITE-NOSYNC YIELDCPU
VERB-CHKPOINT VERB-DEADLOCK VERB-RECOVERY VERB-REPLICATION VERB-WAITSFOR
VERBOSE)</code></span></dt><dd><p>Set some environment options using </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_flags.html"><code class="function">DB_ENV->set_flags</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_shm_key.html"><code class="function">DB_ENV->set_shm_key</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_regionmax.html"><code class="function">DB_ENV->set_lg_regionmax</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_set_config.html"><code class="function">DB_ENV->log_set_config</code></a> (v4.7+)</td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_timeout.html"><code class="function">DB_ENV->set_timeout</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_conflicts.html"><code class="function">DB_ENV->set_lk_conflicts</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_verbose.html"><code class="function">DB_ENV->set_verbose</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_encrypt.html"><code class="function">DB_ENV->set_encrypt</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_detect.html"><code class="function">DB_ENV->set_lk_detect</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_intermediate_dir_mode.html"><code class="function">DB_ENV->set_intermediate_dir_mode</code></a> (v4.7+)</td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_errfile.html"><code class="function">DB_ENV->set_errfile</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_max_lockers.html"><code class="function">DB_ENV->set_lk_max_lockers</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tmp_dir.html"><code class="function">DB_ENV->set_tmp_dir</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_msgfile.html"><code class="function">DB_ENV->set_msgfile</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_max_locks.html"><code class="function">DB_ENV->set_lk_max_locks</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_data_dir.html"><code class="function">DB_ENV->set_data_dir</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_errpfx.html"><code class="function">DB_ENV->set_errpfx</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lk_max_objects.html"><code class="function">DB_ENV->set_lk_max_objects</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tx_max.html"><code class="function">DB_ENV->set_tx_max</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_bsize.html"><code class="function">DB_ENV->set_lg_bsize</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_cachesize.html"><code class="function">DB_ENV->set_cachesize</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tx_timestamp.html"><code class="function">DB_ENV->set_tx_timestamp</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_dir.html"><code class="function">DB_ENV->set_lg_dir</code></a></td><td> </td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tas_spins.html"><code class="function">DB_ENV->set_tas_spins</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_lg_max.html"><code class="function">DB_ENV->set_lg_max</code></a></td><td> </td></tr></table></dd><dt><a id="dbe-get-options"></a><span class="term"><code class="code">(BDB:DBE-GET-OPTIONS dbe
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd><p>Retrieve some environment options.
</p><div class="variablelist"><p class="title"><strong>Values of <em class="replaceable"><code>what</code></em></strong></p><dl class="variablelist"><dt><span class="term">missing<br /></span><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>all options as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>
</dd><dt><span class="term"><code class="constant">:TX-TIMESTAMP</code></span></dt><dd>Recover to the time specified by timestamp
rather than to the most current possible date
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_tx_timestamp.html"><code class="function">DB_ENV->get_tx_timestamp</code></a>)
</dd><dt><span class="term"><code class="constant">:TX-MAX</code></span></dt><dd>the number of active transactions
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_tx_max.html"><code class="function">DB_ENV->set_tx_max</code></a>)
</dd><dt><span class="term"><code class="constant">:DATA-DIR</code></span></dt><dd>list of data directories
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_data_dir.html"><code class="function">DB_ENV->get_data_dir</code></a>)
</dd><dt><span class="term"><code class="constant">:TMP-DIR</code></span></dt><dd>temporary directory
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_tmp_dir.html"><code class="function">DB_ENV->get_tmp_dir</code></a>).
May be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="constant">:INTERMEDIATE-DIR-MODE</code></span></dt><dd>mode for creating intermediate directories
during recovery (v4.7+)
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_intermediate_dir_mode.html"><code class="function">DB_ENV->get_intermediate_dir_mode</code></a>).
</dd><dt><span class="term"><code class="constant">:VERBOSE</code></span></dt><dd>the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of verbosity settings
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_verbose.html"><code class="function">DB_ENV->get_verbose</code></a>).
</dd><dt><span class="term"><code class="constant">:AUTO-COMMIT</code><br /></span><span class="term"><code class="constant">:CDB-ALLDB</code><br /></span><span class="term"><code class="constant">:DIRECT-DB</code><br /></span><span class="term"><code class="constant">:LOG-DIRECT</code><br /></span><span class="term"><code class="constant">:LOG-DSYNC</code><br /></span><span class="term"><code class="constant">:LOG-AUTO-REMOVE</code><br /></span><span class="term"><code class="constant">:LOG-IN-MEMORY</code><br /></span><span class="term"><code class="constant">:LOG-ZERO</code><br /></span><span class="term"><code class="constant">:NOLOCKING</code><br /></span><span class="term"><code class="constant">:NOMMAP</code><br /></span><span class="term"><code class="constant">:NOPANIC</code><br /></span><span class="term"><code class="constant">:OVERWRITE</code><br /></span><span class="term"><code class="constant">:PANIC-ENVIRONMENT</code><br /></span><span class="term"><code class="constant">:REGION-INIT</code><br /></span><span class="term"><code class="constant">:TXN-NOSYNC</code><br /></span><span class="term"><code class="constant">:TXN-WRITE-NOSYNC</code><br /></span><span class="term"><code class="constant">:YIELDCPU</code><br /></span><span class="term"><code class="constant">:VERB-CHKPOINT</code><br /></span><span class="term"><code class="constant">:VERB-DEADLOCK</code><br /></span><span class="term"><code class="constant">:VERB-RECOVERY</code><br /></span><span class="term"><code class="constant">:VERB-REPLICATION</code><br /></span><span class="term"><code class="constant">:VERB-WAITSFOR</code></span></dt><dd>a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> indicator of whether this
option is set or not
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_verbose.html"><code class="function">DB_ENV->get_verbose</code></a>,
<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_flags.html"><code class="function">DB_ENV->get_flags</code></a>, and
<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_get_config.html"><code class="function">DB_ENV->log_get_config</code></a>).
</dd><dt><span class="term"><code class="constant">:LG-BSIZE</code></span></dt><dd>log buffer size
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lg_bsize.html"><code class="function">DB_ENV->get_lg_bsize</code></a>).
</dd><dt><span class="term"><code class="constant">:LG-DIR</code></span></dt><dd>logging directory
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lg_dir.html"><code class="function">DB_ENV->get_lg_dir</code></a>).
</dd><dt><span class="term"><code class="constant">:LG-MAX</code></span></dt><dd>log file size
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lg_max.html"><code class="function">DB_ENV->get_lg_max</code></a>).
</dd><dt><span class="term"><code class="constant">:LG-REGIONMAX</code></span></dt><dd>logging region size
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lg_regionmax.html"><code class="function">DB_ENV->get_lg_regionmax</code></a>).
</dd><dt><span class="term"><code class="constant">:NCACHE</code><br /></span><span class="term"><code class="constant">:CACHESIZE</code><br /></span><span class="term"><code class="constant">:CACHE</code></span></dt><dd>cache parameters
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_cachesize.html"><code class="function">DB_ENV->get_cachesize</code></a>).
</dd><dt><span class="term"><code class="constant">:LK-CONFLICTS</code></span></dt><dd>lock conflicts matrix
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_conflicts.html"><code class="function">DB_ENV->get_lk_conflicts</code></a>).
</dd><dt><span class="term"><code class="constant">:LK-DETECT</code></span></dt><dd>automatic deadlock detection
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_detect.html"><code class="function">DB_ENV->get_lk_detect</code></a>).
</dd><dt><span class="term"><code class="constant">:LK-MAX-LOCKERS</code></span></dt><dd>maximum number of lockers
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_max_lockers.html"><code class="function">DB_ENV->get_lk_max_lockers</code></a>).
</dd><dt><span class="term"><code class="constant">:LK-MAX-LOCKS</code></span></dt><dd>maximum number of locks
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_max_locks.html"><code class="function">DB_ENV->get_lk_max_locks</code></a>).
</dd><dt><span class="term"><code class="constant">:LK-MAX-OBJECTS</code></span></dt><dd>maximum number of lock objects
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_lk_max_objects.html"><code class="function">DB_ENV->get_lk_max_objects</code></a>).
</dd><dt><span class="term"><code class="constant">:TAS-SPINS</code></span></dt><dd>the number of test-and-set spins
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_tas_spins.html"><code class="function">DB_ENV->get_tas_spins</code></a>).
</dd><dt><span class="term"><code class="constant">:SHM-KEY</code></span></dt><dd>base segment ID for shared memory regions
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_shm_key.html"><code class="function">DB_ENV->get_shm_key</code></a>).
</dd><dt><span class="term"><code class="constant">:LOCK-TIMEOUT</code><br /></span><span class="term"><code class="constant">:TXN-TIMEOUT</code></span></dt><dd>timeout values for locks or transactions in the
database environment
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_timeout.html"><code class="function">DB_ENV->get_timeout</code></a>).
</dd><dt><span class="term"><code class="constant">:ENCRYPT</code></span></dt><dd>encryption flags
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_encrypt_flags.html"><code class="function">DB_ENV->get_encrypt_flags</code></a>).
</dd><dt><span class="term"><code class="constant">:ERRFILE</code></span></dt><dd><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_errfile.html"><code class="function">DB_ENV->get_errfile</code></a>).
</dd><dt><span class="term"><code class="constant">:MSGFILE</code></span></dt><dd><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_msgfile.html"><code class="function">DB_ENV->get_msgfile</code></a>).
</dd><dt><span class="term"><code class="constant">:ERRPFX</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_errpfx.html"><code class="function">DB_ENV->get_errpfx</code></a>).
</dd><dt><span class="term"><code class="constant">:DB-GID-SIZE</code></span></dt><dd>the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> of the globally unique
<span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> which must be passed to
<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnprepare.html"><code class="function">DB_TXN->prepare</code></a>.
</dd><dt><span class="term"><code class="constant">:HOME</code></span></dt><dd>the home directory when open
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_home.html"><code class="function">DB_ENV->get_home</code></a>).
</dd><dt><span class="term"><code class="constant">:OPEN</code></span></dt><dd>the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of flags passed to <a class="link" href="#dbe-open"><code class="function">BDB:DBE-OPEN</code></a>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_open_flags.html"><code class="function">DB_ENV->get_open_flags</code></a>).
</dd><dt><span class="term"><code class="constant">:CACHE</code></span></dt><dd>database cache information
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_cachesize.html"><code class="function">DB_ENV->get_cachesize</code></a>).
</dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-operations"></a>33.7.5. Database Operations</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="db-create"></a><span class="term"><code class="code">(BDB:DB-CREATE dbe)</code></span></dt><dd>Create a database handle
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/db_class.html"><code class="function">db_create</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-CLOSE db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> NOSYNC)</code></span></dt><dd>Close a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbclose.html"><code class="function">DB->close</code></a>).
You can also call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.</dd><dt><span class="term"><code class="code">(BDB:DB-DEL dbe key <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
TRANSACTION AUTO-COMMIT)</code></span></dt><dd>Delete items from a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbdel.html"><code class="function">DB->del</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-FD db)</code></span></dt><dd>Return the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> for the database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbfd.html"><code class="function">DB->fd</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-GET db key <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> ACTION AUTO-COMMIT
DEGREE-2 DIRTY-READ MULTIPLE RMW TRANSACTION (ERROR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code></span></dt><dd><p>Get items from a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget.html"><code class="function">DB->get</code></a>).
If <code class="constant">:ERROR</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the record is not found, no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed,
instead <code class="constant">:NOTFOUND</code> is returned.
<code class="constant">:ACTION</code> should be one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:CONSUME</code></td><td><code class="constant">:GET-BOTH</code></td></tr><tr><td><code class="constant">:CONSUME-WAIT</code></td><td><code class="constant">:SET-RECNO</code></td></tr></table><p>
</p></dd><dt><span class="term"><code class="code">(BDB:DB-PUT db key val
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> AUTO-COMMIT ACTION TRANSACTION)</code></span></dt><dd><p>Store items into a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbput.html"><code class="function">DB->put</code></a>).
<code class="constant">:ACTION</code> should be one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:APPEND</code></td><td><code class="constant">:NODUPDATA</code></td><td><code class="constant">:NOOVERWRITE</code></td></tr></table><p>
</p></dd><dt><span class="term"><code class="code">(BDB:DB-STAT db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> FAST-STAT
TRANSACTION)</code></span></dt><dd>Return database statistics
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_byteswapped.html"><code class="function">DB->get_byteswapped</code></a>,
<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_type.html"><code class="function">DB->get_type</code></a>,
<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbstat.html"><code class="function">DB->stat</code></a>).
</dd><dt><a id="db-open"></a><span class="term"><code class="code">(BDB:DB-OPEN db file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
DATABASE TYPE MODE FLAGS CREATE DIRTY-READ EXCL NOMMAP RDONLY
THREAD TRUNCATE AUTO-COMMIT TRANSACTION)</code></span></dt><dd><p>Open a database (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbopen.html"><code class="function">DB->open</code></a>).
<code class="constant">:TYPE</code> should be one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:BTREE</code></td><td><code class="constant">:RECNO</code></td></tr><tr><td><code class="constant">:HASH</code></td><td><code class="constant">:UNKNOWN</code> (default)</td></tr><tr><td><code class="constant">:QUEUE</code></td><td> </td></tr></table><p>
<code class="constant">:FLAGS</code> may be the value of a previous call
to <code class="code">(<a class="link" href="#db-get-options"><code class="function">BDB:DB-GET-OPTIONS</code></a> db :OPEN)</code>
</p></dd><dt><span class="term"><code class="code">(BDB:DB-SYNC db)</code></span></dt><dd>Flush a database to stable storage
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbsync.html"><code class="function">DB->sync</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-TRUNCATE db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
TRANSACTION AUTO-COMMIT)</code></span></dt><dd>Empty a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbtruncate.html"><code class="function">DB->truncate</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-UPGRADE db file
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> DUPSORT)</code></span></dt><dd>Upgrade a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbupgrade.html"><code class="function">DB->upgrade</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-RENAME db file database newname)</code></span></dt><dd>Rename a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbrename.html"><code class="function">DB->rename</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-REMOVE db file database)</code></span></dt><dd>Remove a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbremove.html"><code class="function">DB->remove</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-JOIN db cursor-sequence
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> JOIN-NOSORT)</code></span></dt><dd>Create a specialized join cursor for use in
performing equality or natural joins on secondary indices
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbjoin.html"><code class="function">DB->join</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DB-KEY-RANGE db key
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> TRANSACTION)</code></span></dt><dd>return an estimate of the proportion of keys that
are less than, equal to, and greater than the specified key
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbkey_range.html"><code class="function">DB->key_range</code></a>).
The underlying database must be of type Btree.
</dd><dt><span class="term"><code class="code">(BDB:DB-VERIFY db file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
DATABASE SALVAGE AGGRESSIVE PRINTABLE NOORDERCHK)</code></span></dt><dd>Verify/salvage a database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbverify.html"><code class="function">DB->verify</code></a>).
<code class="constant">:SALVAGE</code>, if supplied, should be the output
file name. <code class="constant">:DATABASE</code>, if supplied,
will force <code class="constant">DB_ORDERCHKONLY</code>.
</dd><dt><a id="with-db"></a><span class="term"><code class="code">(BDB:WITH-DB (var dbe file
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>create</code></em> <em class="replaceable"><code>options</code></em> <em class="replaceable"><code>open</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> body)</code></span></dt><dd>Open the database, execute <em class="replaceable"><code>body</code></em>, close it.
<em class="replaceable"><code>create</code></em> is a list of options to be passed to <a class="link" href="#db-create"><code class="function">BDB:DB-CREATE</code></a>,
<em class="replaceable"><code>options</code></em> is a list of options to be passed to <a class="link" href="#db-set-options"><code class="function">BDB:DB-SET-OPTIONS</code></a>,
<em class="replaceable"><code>open</code></em> is a list of options to be passed to <a class="link" href="#db-open"><code class="function">BDB:DB-OPEN</code></a>.
</dd><dt><a id="db-compact"></a><span class="term"><code class="code">(BDB:DB-COMPACT db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
TRANSACTION START STOP FREE FILL TIMEOUT PAGES TYPE)</code></span></dt><dd>Call <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcompact.html"><code class="function">DB->compact</code></a>.
<code class="constant">:FREE</code> is either <code class="constant">:LIST-ONLY</code>
or <code class="constant">:SPACE</code>.
<code class="constant">:FILL</code>, <code class="constant">:TIMEOUT</code>,
<code class="constant">:PAGES</code> are passed in <span class="type">DB_COMPACT</span>.
<code class="constant">:TYPE</code> is how the <code class="varname">end</code> is returned.
The second return value is a <span class="type">BDB:DB-COMPACT</span>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-db-config"></a>33.7.6. Database Configuration</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="db-set-options"></a><span class="term"><code class="code">(BDB:DB-SET-OPTIONS db
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> ERRFILE MSGFILE ERRPFX PASSWORD ENCRYPTION NCACHE CACHESIZE CACHE
LORDER PAGESIZE BT-MINKEY H-FFACTOR H-NELEM Q-EXTENTSIZE
RE-DELIM RE-LEN RE-PAD RE-SOURCE
CHKSUM ENCRYPT TXN-NOT-DURABLE DUP DUPSORT INORDER RECNUM REVSPLITOFF
RENUMBER SNAPSHOT)</code></span></dt><dd><p>Set some database options using </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_errfile.html"><code class="function">DB_ENV->set_errfile</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_pagesize.html"><code class="function">DB->set_pagesize</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_re_len.html"><code class="function">DB->set_re_len</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_msgfile.html"><code class="function">DB_ENV->set_msgfile</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_bt_minkey.html"><code class="function">DB->set_bt_minkey</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_re_pad.html"><code class="function">DB->set_re_pad</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envset_errpfx.html"><code class="function">DB_ENV->set_errpfx</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_h_ffactor.html"><code class="function">DB->set_h_ffactor</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_re_source.html"><code class="function">DB->set_re_source</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_encrypt.html"><code class="function">DB->set_encrypt</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_h_nelem.html"><code class="function">DB->set_h_nelem</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_flags.html"><code class="function">DB->set_flags</code></a></td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_cachesize.html"><code class="function">DB->set_cachesize</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_q_extentsize.html"><code class="function">DB->set_q_extentsize</code></a></td><td> </td></tr><tr><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_lorder.html"><code class="function">DB->set_lorder</code></a></td><td><a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbset_re_delim.html"><code class="function">DB->set_re_delim</code></a></td><td> </td></tr></table></dd><dt><a id="db-get-options"></a><span class="term"><code class="code">(BDB:DB-GET-OPTIONS db
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd><p>Retrieve some database options.
</p><div class="variablelist"><p class="title"><strong>Values of <em class="replaceable"><code>what</code></em></strong></p><dl class="variablelist"><dt><span class="term">missing<br /></span><span class="term"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></span></dt><dd>all options as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>
</dd><dt><span class="term"><code class="constant">:FLAGS</code></span></dt><dd>all flags
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_flags.html"><code class="function">DB_ENV->get_flags</code></a>).
</dd><dt><span class="term"><code class="constant">:CHKSUM</code><br /></span><span class="term"><code class="constant">:ENCRYPT</code><br /></span><span class="term"><code class="constant">:TXN-NOT-DURABLE</code><br /></span><span class="term"><code class="constant">:DUP</code><br /></span><span class="term"><code class="constant">:DUPSORT</code><br /></span><span class="term"><code class="constant">:INORDER</code><br /></span><span class="term"><code class="constant">:RECNUM</code><br /></span><span class="term"><code class="constant">:REVSPLITOFF</code><br /></span><span class="term"><code class="constant">:RENUMBER</code><br /></span><span class="term"><code class="constant">:SNAPSHOT</code></span></dt><dd>a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_boolean.html" target="_top"><code class="classname">BOOLEAN</code></a> indicator of whether this
option is set or not
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_verbose.html"><code class="function">DB_ENV->get_verbose</code></a> and
<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_flags.html"><code class="function">DB_ENV->get_flags</code></a>).
</dd><dt><span class="term"><code class="constant">:CACHE</code></span></dt><dd>database cache information
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_cachesize.html"><code class="function">DB->get_cachesize</code></a> or
<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_cachesize.html"><code class="function">DB_ENV->get_cachesize</code></a> if the
database was created within an environment).
</dd><dt><span class="term"><code class="constant">:ENCRYPTION</code></span></dt><dd>encryption flags
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_encrypt_flags.html"><code class="function">DB_ENV->get_encrypt_flags</code></a>).
</dd><dt><span class="term"><code class="constant">:ERRFILE</code></span></dt><dd><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_errfile.html"><code class="function">DB_ENV->get_errfile</code></a>).
</dd><dt><span class="term"><code class="constant">:MSGFILE</code></span></dt><dd><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_msgfile.html"><code class="function">DB_ENV->get_msgfile</code></a>).
</dd><dt><span class="term"><code class="constant">:ERRPFX</code></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envget_errpfx.html"><code class="function">DB_ENV->get_errpfx</code></a>).
</dd><dt><span class="term"><code class="constant">:PAGESIZE</code></span></dt><dd>database page size
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_pagesize.html"><code class="function">DB->get_pagesize</code></a>).
</dd><dt><span class="term"><code class="constant">:BT-MINKEY</code></span></dt><dd>the minimum number of key/data pairs intended to
be stored on any single <code class="constant">:BTREE</code> leaf page
underlying source file
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_bt_minkey.html"><code class="function">DB->get_bt_minkey</code></a>).
</dd><dt><span class="term"><code class="constant">:H-FFACTOR</code></span></dt><dd>the desired density within
the <code class="constant">:HASH</code> table
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_h_ffactor.html"><code class="function">DB->get_h_ffactor</code></a>).
</dd><dt><span class="term"><code class="constant">:H-NELEM</code></span></dt><dd>an estimate of the final size of
the <code class="constant">:HASH</code> table
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_h_nelem.html"><code class="function">DB->get_h_nelem</code></a>).
</dd><dt><span class="term"><code class="constant">:Q-EXTENTSIZE</code></span></dt><dd>the size of the extents used to hold pages in
a <code class="constant">:QUEUE</code> database
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_q_extentsize.html"><code class="function">DB->get_q_extentsize</code></a>).
</dd><dt><span class="term"><code class="constant">:RE-DELIM</code></span></dt><dd>the record delimiter for <code class="constant">:RECNO</code> databases
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_delim.html"><code class="function">DB->get_re_delim</code></a>).
</dd><dt><span class="term"><code class="constant">:RE-LEN</code></span></dt><dd>database record length
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_len.html"><code class="function">DB->get_re_len</code></a>).
</dd><dt><span class="term"><code class="constant">:RE-PAD</code></span></dt><dd>database record pad byte
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_pad.html"><code class="function">DB->get_re_pad</code></a>).
</dd><dt><span class="term"><code class="constant">:RE-SOURCE</code></span></dt><dd>the underlying source file for <code class="constant">:RECNO</code> databases
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_source.html"><code class="function">DB->get_re_source</code></a>).
</dd><dt><span class="term"><code class="constant">:LORDER</code></span></dt><dd>database byte order
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_lorder.html"><code class="function">DB->get_lorder</code></a>).
</dd><dt><span class="term"><code class="constant">:DBNAME</code></span></dt><dd>the file name and database name
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_dbname.html"><code class="function">DB->get_dbname</code></a>)
</dd><dt><span class="term"><code class="constant">:TRANSACTIONAL</code></span></dt><dd>the indicator whether the database is transactional
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_transactional.html"><code class="function">DB->get_transactional</code></a>).
</dd><dt><span class="term"><code class="constant">:OPEN</code></span></dt><dd>the flags passed to <a class="link" href="#db-open"><code class="function">BDB:DB-OPEN</code></a>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_open_flags.html"><code class="function">DB->get_open_flags</code></a>).
</dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Once you call a method for one type of access method,
the handle can only be used for that type.
The methods <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_delim.html"><code class="function">DB->get_re_delim</code></a>
and <a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbget_re_source.html"><code class="function">DB->get_re_source</code></a> are for
a <code class="constant">:RECNO</code> database so you <span class="strong"><strong>cannot</strong></span> call them
(by passing <code class="constant">:RE-DELIM</code>
or <code class="constant">:RE-SOURCE</code> to this function)
and then use the database handle to open a database of different type
(e.g., <code class="constant">:QUEUE</code>).</p></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-cursor"></a>33.7.7. Database Cursor Operations</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="make-dbc"></a><span class="term"><code class="code">(BDB:MAKE-DBC db <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
DEGREE-2 DIRTY-READ WRITECURSOR TRANSACTION)</code></span></dt><dd>Create a cursor handle
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcursor.html"><code class="function">DB->cursor</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DBC-CLOSE cursor)</code></span></dt><dd>Close the cursor handle
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcclose.html"><code class="function">DBCursor->close</code></a>).
You can also call <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a>.</dd><dt><span class="term"><code class="code">(BDB:DBC-COUNT cursor)</code></span></dt><dd>Return count of duplicates
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbccount.html"><code class="function">DBCursor->count</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DBC-DEL cursor <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> CONSUME)</code></span></dt><dd>Delete by cursor
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcdel.html"><code class="function">DBCursor->del</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DBC-DUP cursor <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> POSITION)</code></span></dt><dd>Duplicate a cursor
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcdup.html"><code class="function">DBCursor->dup</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:DBC-GET cursor key data action
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> DEGREE-2 DIRTY-READ MULTIPLE (ERROR <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code></span></dt><dd><p>Retrieve by cursor
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcget.html"><code class="function">DBCursor->get</code></a>).
If <code class="constant">:ERROR</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the record is not found, no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed,
<code class="constant">:NOTFOUND</code> or <code class="constant">:KEYEMPTY</code>
is returned instead, as appropriate.
<em class="replaceable"><code>action</code></em> should be one of
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="constant">:CURRENT</code></td><td><code class="constant">:GET-RECNO</code></td><td><code class="constant">:NEXT-DUP</code></td><td><code class="constant">:SET</code></td></tr><tr><td><code class="constant">:FIRST</code></td><td><code class="constant">:JOIN-ITEM</code></td><td><code class="constant">:NEXT-NODUP</code></td><td><code class="constant">:SET-RANGE</code></td></tr><tr><td><code class="constant">:GET-BOTH</code></td><td><code class="constant">:LAST</code></td><td><code class="constant">:PREV</code></td><td><code class="constant">:SET-RECNO</code></td></tr><tr><td><code class="constant">:GET-BOTH-RANGE</code></td><td><code class="constant">:NEXT</code></td><td><code class="constant">:PREV-NODUP</code></td><td> </td></tr></table><p>
</p></dd><dt><span class="term"><code class="code">(BDB:DBC-PUT cursor key data flag)</code></span></dt><dd>Store by cursor
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/dbcput.html"><code class="function">DBCursor->put</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:WITH-DBC (var <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>
<em class="replaceable"><code>options</code></em>) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>))</code></span></dt><dd>Open a cursor, execute <em class="replaceable"><code>body</code></em>, close it.
<em class="replaceable"><code>options</code></em> are passed to <a class="link" href="#make-dbc"><code class="function">BDB:MAKE-DBC</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-lock"></a>33.7.8. Lock Subsystem</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:LOCK-DETECT dbe action)</code></span></dt><dd>Perform deadlock detection
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_detect.html"><code class="function">DB_ENV->lock_detect</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOCK-ID dbe)</code></span></dt><dd>Acquire a locker ID
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_id.html"><code class="function">DB_ENV->lock_id</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOCK-ID-FREE dbe id)</code></span></dt><dd>Release a locker ID
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_id_free.html"><code class="function">DB_ENV->lock_id_free</code></a>).
All associated locks should be released first.
</dd><dt><span class="term"><code class="code">(BDB:LOCK-GET dbe object locker
mode <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> NOWAIT)</code></span></dt><dd>Acquire a lock
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_get.html"><code class="function">DB_ENV->lock_get</code></a>).
The <span class="type">BDB:DBLOCK</span> object returned by this function will
<span class="strong"><strong>not</strong></span> be released when the environment is closed.
This permits long-lived locks.</dd><dt><span class="term"><code class="code">(BDB:LOCK-PUT dbe lock)</code></span></dt><dd>Release a lock
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_put.html"><code class="function">DB_ENV->lock_put</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOCK-CLOSE lock)</code></span></dt><dd><p class="simpara">Release a lock
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_put.html"><code class="function">DB_ENV->lock_put</code></a>) using the
environment with which it has been acquired.
This is used to <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a> <span class="type">BDB:DBLOCK</span> objects.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>If that environment has already been closed, you are
in a big trouble (segfault), so you better release your locks or do
not drop them.</p></div></dd><dt><span class="term"><code class="code">(BDB:LOCK-STAT dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
STAT-CLEAR)</code></span></dt><dd>Return lock subsystem statistics
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlock_stat.html"><code class="function">DB_ENV->lock_stat</code></a>).
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-log"></a>33.7.9. Log Subsystem</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#bdb-log-cursor">33.7.9.1. Log Cursor Operations</a></span></dt><dt><span class="section"><a href="#bdb-log-seq">33.7.9.2. Log Sequence Numbers</a></span></dt></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:LOG-ARCHIVE dbe
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> ARCH-ABS ARCH-DATA ARCH-LOG ARCH-REMOVE)</code></span></dt><dd>Return a list of log or database filenames
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_archive.html"><code class="function">DB_ENV->log_archive</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOG-FILE dbe lsn)</code></span></dt><dd>Return the name of the file containing the record
named by <em class="replaceable"><code>lsn</code></em>
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_file.html"><code class="function">DB_ENV->log_file</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOG-FLUSH dbe lsn)</code></span></dt><dd>Flush log records to disk
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_flush.html"><code class="function">DB_ENV->log_flush</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOG-PUT dbe data
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :FLUSH)</code></span></dt><dd>Write a log record
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_put.html"><code class="function">DB_ENV->log_put</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOG-STAT dbe
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> STAT-CLEAR)</code></span></dt><dd>Logging subsystem statistics
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_stat.html"><code class="function">DB_ENV->log_stat</code></a>).
</dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="bdb-log-cursor"></a>33.7.9.1. Log Cursor Operations</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:LOG-CURSOR dbe)</code></span></dt><dd>Create a log cursor handle
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envlog_cursor.html"><code class="function">DB_ENV->log_cursor</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOGC-CLOSE logc)</code></span></dt><dd>Close a log cursor handle
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/logcclose.html"><code class="function">DB_LOGC->close</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:LOGC-GET logc action
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> TYPE ERROR)</code></span></dt><dd><p>Retrieve a log record
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/logcget.html"><code class="function">DB_LOGC->get</code></a>).
If <code class="constant">:ERROR</code> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and the record is not found, no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed,
<code class="constant">:NOTFOUND</code> is returned instead.
</p><div class="variablelist"><p class="title"><strong>Valid <em class="replaceable"><code>action</code></em>s</strong></p><dl class="variablelist"><dt><span class="term"><code class="constant">:CURRENT</code><br /></span><span class="term"><code class="constant">:FIRST</code><br /></span><span class="term"><code class="constant">:LAST</code><br /></span><span class="term"><code class="constant">:NEXT</code><br /></span><span class="term"><code class="constant">:PREV</code></span></dt><dd>Retrieve the appropriate record.
</dd><dt><span class="term"><span class="type">DB:LSN</span></span></dt><dd>Retrieve the specified record, as
with <code class="constant">DB_SET</code>.
</dd></dl></div><p>
Returns two values: the datum of type specified by the <code class="constant">:TYPE</code>
argument and the <span class="type">DB:LSN</span> value of the record retrieved
(when <em class="replaceable"><code>action</code></em> is a <span class="type">DB:LSN</span>, it
is returned unchanged).
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="bdb-log-seq"></a>33.7.9.2. Log Sequence Numbers</h4></div></div></div><p>Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_equalp.html" target="_top"><code class="function">EQUALP</code></a> to check similarity of <span class="type">BDB:LSN</span> objects.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:LOG-COMPARE lsn1 lsn2)</code></span></dt><dd>Compare two Log Sequence Numbers
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/log_compare.html"><code class="function">log_compare</code></a>).
</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-mem-pool"></a>33.7.10. Memory Pool Subsystem</h3></div></div></div><p>not implemented yet, patches are welcome</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-replication"></a>33.7.11. Replication</h3></div></div></div><p>not implemented yet, patches are welcome</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-sequences"></a>33.7.12. Sequences</h3></div></div></div><p>not implemented yet, patches are welcome</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="bdb-transaction"></a>33.7.13. Transaction Subsystem</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(BDB:TXN-BEGIN dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
DEGREE-2 PARENT DIRTY-READ NOSYNC NOWAIT SYNC)</code></span></dt><dd>Begin a transaction
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envtxn_begin.html"><code class="function">DB_ENV->txn_begin</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-ABORT txn)</code></span></dt><dd>Abort a transaction
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnabort.html"><code class="function">DB_TXN->abort</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-COMMIT txn <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
NOSYNC SYNC)</code></span></dt><dd>Commit a transaction
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txncommit.html"><code class="function">DB_TXN->commit</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-DISCARD txn)</code></span></dt><dd>Discard a transaction
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txndiscard.html"><code class="function">DB_TXN->discard</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-ID txn)</code></span></dt><dd>Return the transaction's ID
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnid.html"><code class="function">DB_TXN->id</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-CHECKPOINT dbe
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> KBYTE MIN FORCE)</code></span></dt><dd>Checkpoint the transaction subsystem
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envtxn_checkpoint.html"><code class="function">DB_ENV->txn_checkpoint</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-PREPARE txn id)</code></span></dt><dd>Initiate the beginning of a two-phase commit
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnprepare.html"><code class="function">DB_TXN->prepare</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-RECOVER dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
FIRST NEXT)</code></span></dt><dd>Return a list of prepared but not yet resolved
transactions (<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envtxn_recover.html"><code class="function">DB_ENV->txn_recover</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-SET-TIMEOUT txn
timeout which)</code></span></dt><dd>Set timeout values for locks or transactions for the
specified transaction
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/txnset_timeout.html"><code class="function">DB_TXN->set_timeout</code></a>).
</dd><dt><span class="term"><code class="code">(BDB:TXN-STAT dbe <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
STAT-CLEAR)</code></span></dt><dd>Transaction subsystem statistics
(<a class="bdb" href="http://docs.oracle.com/cd/E17076_02/html/api_reference/C/envtxn_stat.html"><code class="function">DB_ENV->txn_stat</code></a>).
</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dir-key"></a>33.8. Directory Access</h2></div></div></div><p>This module provides some directory access from lisp,
in package <a class="link" href="#dir-key" title="33.8. Directory Access"><strong class="package"><span class="quote">“<span class="quote">LDAP</span>”</span></strong></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:DIRKEY</code>.</p><p>3 types of directory keys may exist,
depending on the compilation environment.</p><div class="variablelist"><a id="dir-key-type"></a><p class="title"><strong>valid directory key types</strong></p><dl class="variablelist"><dt><span class="term">:win32</span></dt><dd><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> registry access
</dd><dt><span class="term">:gnome</span></dt><dd><a class="ulink" href="http://library.gnome.org/devel/libgnome/stable/libgnome-gnome-config.html" target="_top">gnome-config</a> access
</dd><dt><span class="term">:ldap</span></dt><dd>LDAP interface via
<a class="ulink" href="http://www.openldap.org" target="_top">OpenLDAP</a> or compatible
</dd></dl></div><p>The following functions and macros are exported (please note that
these features are <span class="strong"><strong><a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top">experimental</a></strong></span> and the API may be modified in the
future).</p><div class="variablelist"><dl class="variablelist"><dt><a id="dir-key-open"></a><span class="term"><code class="code">(<a class="link" href="#dir-key-open"><code class="function">LDAP:DIR-KEY-OPEN</code></a>
<em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> (<code class="constant">:DIRECTION</code> <code class="constant">:INPUT</code>)
<code class="constant">:IF-DOES-NOT-EXIST</code>)</code></span></dt><dd>Open the directory key under <em class="replaceable"><code>dkey</code></em>, which should
be either an open directory key or a valid <a class="link" href="#dir-key-type" title="valid directory key types">directory key type</a>.
The meaning of the <code class="constant">:DIRECTION</code> and <code class="constant">:IF-DOES-NOT-EXIST</code> keyword
arguments is the same as for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_open.html" target="_top"><code class="function">OPEN</code></a>.</dd><dt><a id="dir-key-close"></a><span class="term"><code class="code">(<a class="link" href="#dir-key-close"><code class="function">LDAP:DIR-KEY-CLOSE</code></a>
<em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Close the directory key. The preferred way is to
use the <a class="link" href="#with-dir-key-open"><code class="function">LDAP:WITH-DIR-KEY-OPEN</code></a> macro.</dd><dt><a id="with-dir-key-open"></a><span class="term"><code class="code">(<a class="link" href="#with-dir-key-open"><code class="function">LDAP:WITH-DIR-KEY-OPEN</code></a> (<em class="replaceable"><code>variable</code></em>
<em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> {<em class="replaceable"><code>option</code></em>}*) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a>
<em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Open the directory key (by calling <a class="link" href="#dir-key-open"><code class="function">LDAP:DIR-KEY-OPEN</code></a>
on <em class="replaceable"><code>dkey</code></em>, <em class="replaceable"><code>pathname</code></em> and <em class="replaceable"><code>option</code></em>s), bind it to <em class="replaceable"><code>variable</code></em>,
execute <em class="replaceable"><code>body</code></em>, then close it with <a class="link" href="#dir-key-close"><code class="function">LDAP:DIR-KEY-CLOSE</code></a>.
</dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-TYPE</code>
<em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Return the <a class="link" href="#dir-key-type" title="valid directory key types">directory key type</a> of the directory key
</dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-PATH</code>
<em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Return the path of this directory key, which is the
<em class="replaceable"><code>pathname</code></em> argument of <a class="link" href="#dir-key-open"><code class="function">LDAP:DIR-KEY-OPEN</code></a> if <em class="replaceable"><code>dkey</code></em> was a <a class="link" href="#dir-key-type" title="valid directory key types">directory key type</a> or the
concatenation of the <em class="replaceable"><code>pathname</code></em> argument and the
<code class="function">ldap:dir-key-path</code> of <em class="replaceable"><code>dkey</code></em>.
</dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-DIRECTION</code>
<em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>One of <code class="constant">:INPUT</code>, <code class="constant">:OUTPUT</code> and <code class="constant">:IO</code>, indicating
the permitted operation on this key and its derivatives.
</dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-CLOSED-P</code>
<em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Check whether the key has been closed.
It is not an error to close a closed key.
</dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-SUBKEY-DELETE</code>
<em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>subkey</code></em>)</code>
<code class="code">(<code class="function">LDAP:DIR-KEY-VALUE-DELETE</code>
<em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>attribute</code></em>)</code></span></dt><dd>Delete the specified subkey or attribute.
</dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-SUBKEY</code>
<em class="replaceable"><code>dkey</code></em>)</code>
<code class="code">(<code class="function">LDAP:DIR-KEY-ATTRIBUTES</code> <em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Return the list of the subkeys or attributes.
</dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-VALUE</code> <em class="replaceable"><code>dkey</code></em>
<em class="replaceable"><code>attribute</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>default</code></em>)</code></span></dt><dd>Return the value of the specified attribute,
similar to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>able just like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_gethash.html" target="_top"><code class="function">GETHASH</code></a>.
</dd><dt><span class="term"><code class="code">(<code class="function">LDAP:DIR-KEY-INFO</code>
<em class="replaceable"><code>dkey</code></em>)</code></span></dt><dd>Return some information about the directory key.
This is highly platform-dependent and will probably be removed or
replaced or modified in the future.</dd><dt><a id="with-dir-key-search"></a><span class="term"><code class="code">(<a class="link" href="#with-dir-key-search"><code class="function">LDAP:WITH-DIR-KEY-SEARCH</code></a>
(<em class="replaceable"><code>key-iter</code></em>
<em class="replaceable"><code>atribute-iter</code></em>
<em class="replaceable"><code>dkey</code></em> <em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <code class="constant">:scope</code>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara">This is the main way to iterate over the subtree
under the key <em class="replaceable"><code>dkey</code></em>+<em class="replaceable"><code>pathname</code></em>.</p><p class="simpara"><em class="replaceable"><code>key-iter</code></em> is a non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> symbol
and is bound via <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_fletcm_scm_macrolet.html" target="_top"><code class="function">MACROLET</code></a> to a macro, each call of which returns
the next subkey.</p><p class="simpara"><em class="replaceable"><code>atribute-iter</code></em> is a symbol and is
bound, when non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, to a macro, each call of which returns two
values - the next attribute and its value.</p><p>The <code class="constant">:scope</code> keyword argument specifies the
scope of the search and can be
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="constant">:self</code></span></dt><dd>iterate over the key itself
</dd><dt><span class="term"><code class="constant">:level</code></span></dt><dd>iterate over the children of the key
</dd><dt><span class="term"><code class="constant">:tree</code></span></dt><dd>iterate over the subtree
</dd></dl></div><p class="simpara"><a class="link" href="#with-dir-key-search"><code class="function">LDAP:WITH-DIR-KEY-SEARCH</code></a> is used to implement
<code class="function">LDAP:DIR-KEY-VALUES</code>,
<code class="function">LDAP:DIR-KEY-CHILDREN</code> and
<code class="function">LDAP:DIR-KEY-DUMP-TREE</code> in
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/dirkey/dirkey1.lisp"><code class="filename">modules/dirkey/dirkey1.lisp</code></a>.
</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="postgresql"></a>33.9. PostgreSQL Database Access</h2></div></div></div><p>This package offers an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to
<a class="ulink" href="http://www.PostgreSQL.org/" target="_top">PostgreSQL</a>.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">SQL</span>”</span></strong>
(nicknamed <strong class="package"><span class="quote">“<span class="quote">POSTGRES</span>”</span></strong>
and <strong class="package"><span class="quote">“<span class="quote">POSTGRESQL</span>”</span></strong>) is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
so you would write <code class="code">(sql:PQconnectdb ...)</code>
when you need to call <a class="pq" href="http://www.postgresql.org/search/?q=PQconnectdb"><code class="function">PQconnectdb</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:POSTGRESQL</code>.</p><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/postgresql/test.tst"><code class="filename">modules/postgresql/test.tst</code></a>
for sample usage.</p><p>Additionally, some higher level functionality is available (defined
in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/postgresql/sql.lisp"><code class="filename">modules/postgresql/sql.lisp</code></a>):</p><div class="variablelist"><dl class="variablelist"><dt><a id="sql:pq-finish"></a><span class="term"><code class="code">(sql:pq-finish
<em class="replaceable"><code>connection</code></em>)</code></span></dt><dd><a class="pq" href="http://www.postgresql.org/search/?q=PQfinish"><code class="function">PQfinish</code></a> the <em class="replaceable"><code>connection</code></em>
and mark it as invalid</dd><dt><a id="sql:pq-clear"></a><span class="term"><code class="code">(sql:pq-clear
<em class="replaceable"><code>result</code></em>)</code></span></dt><dd><a class="pq" href="http://www.postgresql.org/search/?q=PQclear"><code class="function">PQclear</code></a> the <em class="replaceable"><code>result</code></em>
and mark it as invalid</dd><dt><span class="term"><code class="code">(sql:sql-error <em class="replaceable"><code>connection</code></em> <em class="replaceable"><code>result</code></em> <em class="replaceable"><code>format-string</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>arguments</code></em>)</code></span></dt><dd>finalize <em class="replaceable"><code>connection</code></em> and <em class="replaceable"><code>result</code></em> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> an
appropriate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a></dd><dt><a id="sql:sql-connect"></a><span class="term"><code class="code">(sql:sql-connect
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> host port options tty name login password)</code></span></dt><dd>call <a class="pq" href="http://www.postgresql.org/search/?q=PQsetdbLogin"><code class="function">PQsetdbLogin</code></a> and
return the <em class="replaceable"><code>connection</code></em></dd><dt><a id="sql:with-sql-connection"></a><span class="term"><code class="code">(sql:with-sql-connection
(<em class="replaceable"><code>variable</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>option</code></em>s <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>log</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><div class="procedure"><ol class="procedure" type="1"><li class="step"><p>bind <code class="varname">*sql-log*</code>
to the <em class="replaceable"><code>log</code></em> argument</p></li><li class="step"><p>call <code class="function">sql:sql-connect</code> on
<em class="replaceable"><code>option</code></em>s and bind <em class="replaceable"><code>variable</code></em> to the result</p></li><li class="step"><p>execute <em class="replaceable"><code>body</code></em></p></li><li class="step"><p>call <code class="function">sql:pq-finish</code> on
<em class="replaceable"><code>variable</code></em></p></li></ol></div></dd><dt><span class="term"><code class="code">(sql:sql-transaction <em class="replaceable"><code>connection</code></em> <em class="replaceable"><code>command</code></em>
<em class="replaceable"><code>status</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (clear-p <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>))</code></span></dt><dd>execute the <em class="replaceable"><code>command</code></em> via <em class="replaceable"><code>connection</code></em>;
if the status does not match <em class="replaceable"><code>status</code></em>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed;
if <em class="replaceable"><code>clear-p</code></em> is
non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <code class="function">sql:pq-clear</code> the <em class="replaceable"><code>result</code></em>;
otherwise return it</dd><dt><span class="term"><code class="code">(sql:with-sql-transaction (<em class="replaceable"><code>result</code></em> <em class="replaceable"><code>connection</code></em>
<em class="replaceable"><code>command</code></em> status) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>execure the <em class="replaceable"><code>body</code></em> on the <em class="replaceable"><code>result</code></em> of <em class="replaceable"><code>command</code></em>,
then <code class="function">sql:pq-clear</code> the <em class="replaceable"><code>result</code></em>
</dd><dt><a id="sql:sql-login"></a><span class="term"><code class="code">sql:*sql-login*</code></span></dt><dd>the default <em class="replaceable"><code>login</code></em>
argument to <code class="function">sql:sql-connect</code>
(initially set to <span class="data"><code class="literal">"postgres"</code></span>)
</dd><dt><a id="sql:sql-password"></a><span class="term"><code class="code">sql:*sql-password*</code></span></dt><dd>the default <em class="replaceable"><code>password</code></em>
argument to <code class="function">sql:sql-connect</code>
(initially set to <span class="data"><code class="literal">"postgres"</code></span>)
</dd><dt><a id="sql:sql-log"></a><span class="term"><code class="code">sql:*sql-log*</code></span></dt><dd>when non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, should be a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>;
<code class="function">sql:sql-connect</code>
and <code class="function">sql:sql-transaction</code>
will write to it (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
</dd></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Since <a class="pq" href="http://www.postgresql.org/search/?q=PQfinish"><code class="function">PQfinish</code></a>
and <a class="pq" href="http://www.postgresql.org/search/?q=PQclear"><code class="function">PQclear</code></a>
cannot be called on the same pointer twice, one needs to track their
validity (<code class="function">sql:sql-connect</code>
and <code class="function">sql:sql-transaction</code> take care of that).
See <a class="xref" href="#ex-dffi-validity" title="Example 32.11. Controlling validity of resources">Example 32.11, “Controlling validity of resources”</a>.</p></div><p>For <a class="pq" href="http://www.postgresql.org/search/?q=PQtrace"><code class="function">PQtrace</code></a>, see
<a class="xref" href="#stdio" title="33.2.14. Standard file input and output">Section 33.2.14, “Standard file input and output”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="oracle"></a>33.10. <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#ora-functionality">33.10.1. Functions and Macros in package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#ora-example">33.10.2. Oracle Example</a></span></dt><dt><span class="section"><a href="#ora-config">33.10.3. Oracle Configuration</a></span></dt><dt><span class="section"><a href="#ora-build">33.10.4. Building the Oracle Interface</a></span></dt></dl></div><p>
The <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> module allows a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> program to act as client to an
<a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> database server. The module includes full
SQL support, transactions (including auto-commit), support for most
<a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data types (<span class="type">LONG</span>, <span class="type">BLOB</span>,
<span class="type">CLOB</span>, <span class="type">RAW</span>, etc.), automatic conversion
between <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> and <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> data types, database connection caching and
retry, concurrent connections to multiple databases, proper handling
of <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> errors, and more.</p><p>The module can be used to build sophisticated <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> database
applications in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
symbol <code class="constant">:ORACLE</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ora-functionality"></a>33.10.1. Functions and Macros in
package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong></h3></div></div></div><p>Access to <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> is via these functions and macros in
package <strong class="package"><span class="quote">“<span class="quote">ORACLE</span>”</span></strong>.
When any <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> function fails, the general Lisp function
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_error.html" target="_top"><code class="function">ERROR</code></a> is called, with the condition string set to
include the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> error number, the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> message text,
and other context of the error (e.g., the text and parse location of a
SQL query).</p><div class="variablelist"><dl class="variablelist"><dt><a id="ora-connect"></a><span class="term"><code class="code">(ORACLE:CONNECT
<em class="replaceable"><code>user</code></em> <em class="replaceable"><code>password</code></em>
<em class="replaceable"><code>server</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>schema</code></em>
<em class="replaceable"><code>auto-commit</code></em>
<em class="replaceable"><code>prefetch-buffer-bytes</code></em>
<em class="replaceable"><code>long-len</code></em>
<em class="replaceable"><code>truncate-ok</code></em>)</code></span></dt><dd><p class="simpara">
Connect to an <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> database. All subsequent operations will affect
this database until the next call to <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>. A
single program can access different <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> schemas concurrently by
repeated calls to <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>. Database connections
are cached and re-used: if you call <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> again
with the same <em class="replaceable"><code>user</code></em>,
<em class="replaceable"><code>schema</code></em>, and
<em class="replaceable"><code>server</code></em>, the previous <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> connection will
be re-used. <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> may not be called inside
<code class="function">WITH-TRANSACTION</code>.
Returns: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if a cached connection was re-used, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if a new
connection was created (and cached).
The meaning of the arguments is as follows:
</p><div class="variablelist"><p class="title"><strong>Arguments for <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a></strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>user</code></em></span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> user ID</dd><dt><span class="term"><em class="replaceable"><code>password</code></em></span></dt><dd>Password for user, or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if
<em class="replaceable"><code>user</code></em> has no password (!).
</dd><dt><span class="term"><em class="replaceable"><code>server</code></em></span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> server ID (SID).
</dd><dt><span class="term"><em class="replaceable"><code>schema</code></em></span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> default schema (default: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, same as user. This allows you to log on with one user's
id/password but see the database as if you were some other user.
</dd><dt><span class="term"><em class="replaceable"><code>auto-commit</code></em></span></dt><dd>Flag: whether to commit after every operation
(default: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>). Set this to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if you intend to do transactions
and call <code class="function">COMMIT</code> explicitly. However,
<code class="function">WITH-TRANSACTION</code> is probably easier.
</dd><dt><span class="term"><em class="replaceable"><code>prefetch-buffer-bytes</code></em></span></dt><dd>Number of bytes to cache from SQL SELECT fetches
(default: 64 Kbytes) If you are very short of memory, or have a slow
connection to <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>, you can reduce this to 10k or so.
Alternatively, if you have a fast connection to <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> and
regularly do large queries, you can increase throughput by increasing
this value.</dd><dt><span class="term"><em class="replaceable"><code>long-len</code></em></span></dt><dd>Number of bytes to fetch for "long" (LONG, [BC]LOB)
types. Long data that exceeds this size will raise an error, or be
truncated depending on the value of <em class="replaceable"><code>truncate-ok</code></em>
(below). Setting <em class="replaceable"><code>long-len</code></em> to zero and
<em class="replaceable"><code>truncate-ok</code></em> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> will disable long
fetching entirely. If <em class="replaceable"><code>long-len</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
or negative, defaults to 500k bytes.</dd><dt><span class="term"><em class="replaceable"><code>truncate-ok</code></em></span></dt><dd>Flag: if set, allow truncation of LONG columns to
<em class="replaceable"><code>long-len</code></em> bytes on fetch; otherwise, fetches
of LONG columns exceeding <em class="replaceable"><code>long-len</code></em> bytes
will raise an error. Default: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd></dl></div></dd><dt><a id="ora-disconnect"></a><span class="term"><code class="code">(ORACLE:DISCONNECT)</code></span></dt><dd>
Disconnect from the database currently connected. No more calls can
be made until <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> is called again. The
connection is closed and removed from the connection cache. Does
nothing if there is no connection. <code class="function">DISCONNECT</code>
may not be called inside <code class="function">WITH-TRANSACTION</code>.
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd><dt><a id="ora-run-sql"></a><span class="term"><code class="code">(ORACLE:RUN-SQL
<em class="replaceable"><code>sql</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>params</code></em>
<em class="replaceable"><code>is-select</code></em>)</code></span></dt><dd><p class="simpara">Execute a SQL statement. Must be <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>ed
to a database. Returns the number of rows affected by the SQL operation,
for non-SELECT statements, zero for SELECT statements. For
destructive database operations (INSERT, UPDATE, DELETE), the results
are committed to the database immediately if
<em class="replaceable"><code>auto-commit</code></em> when establishing the current
connection; see <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>. The meaning of the
arguments is as follows: </p><div class="variablelist"><p class="title"><strong>Arguments for <code class="function">RUN-SQL</code></strong></p><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>sql</code></em></span></dt><dd>Text of SQL statement, as a string.
The <em class="replaceable"><code>sql</code></em> statement may contain
<a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> "named parameters," e.g. ":myparam" whose values will
be substituted from the parameters given
in <em class="replaceable"><code>params</code></em>.
</dd><dt><span class="term"><em class="replaceable"><code>params</code></em></span></dt><dd>A mapping of the names of the bind-parameters in the
query to their values. The set of named parameters in the query must
match exactly the keys mapped by <em class="replaceable"><code>params</code></em>.
The mapping may be passed as either (1) a hash table whose keys are
the named parameters or (2) a list of pairs, ((name value) (name
value) ...). Parameter values passed from Lisp are converted to the
appropriate <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data types (see <code class="function">FETCH</code>).
</dd><dt><span class="term"><em class="replaceable"><code>is-select</code></em></span></dt><dd>Flag: whether the statement is a SELECT query. You
usually do not need to set this as it is detected by default based on
the SQL text. However, there are situations, such as when a SELECT
query begins with comment, that you need to specify it explicitly.
</dd></dl></div></dd><dt><a id="ora-do-rows"></a><span class="term"><code class="code">(ORACLE:DO-ROWS
<em class="replaceable"><code>vars</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><p class="simpara"> Macro which loops over a SQL SELECT result,
evaluating, for each row in the result, the forms in <em class="replaceable"><code>body</code></em>,
binding symbols given in <em class="replaceable"><code>vars</code></em> to
corresponding database columns in the SELECT result. The
argument <em class="replaceable"><code>vars</code></em> must be a non-empty list of
symbols matching a subset of the columns of an active SELECT query.
If a SELECT column is an <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> expression such as
<code class="literal">SUBSTR(mycol, 1, 10)</code>, it is recommended to use a
column alias, e.g., <code class="literal">SELECT SUBSTR(mycol, 1, 10) AS
myvar</code>, in which case the column alias will be used as the
symbol bound to the column value.</p><p class="simpara">As <code class="function">DO-ROWS</code> expands into a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_docm_dost.html" target="_top"><code class="function">DO*</code></a>
loop, it may be terminated prematurely, before all rows are fetched,
by using <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a> anywhere in <em class="replaceable"><code>body</code></em>.</p><p class="simpara">It is allowed to call <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> in the
<em class="replaceable"><code>body</code></em> of the loop, but only to switch the connection to a database
other than the one that was used to do the SELECT. This is useful
for reading from one database while writing to another.
</p><p class="simpara">In <em class="replaceable"><code>vars</code></em>, instead of a single
symbol, a pair (<em class="replaceable"><code>bound-var</code></em>
<em class="replaceable"><code>"column-name"</code></em>) may be specified, which
will cause values from the SELECTed column or alias ,
<em class="replaceable"><code>column-name</code></em>, to be bound to Lisp variable,
<em class="replaceable"><code>bound-var</code></em>. This is for unusual cases
where a Lisp variable cannot be created with the same name as the
column (e.g., a column named "T"), or when it is inconvenient or
impossible to alias the column with <code class="literal">SELECT ... AS</code>.
</p></dd><dt><a id="ora-fetch"></a><span class="term"><code class="code">(ORACLE:FETCH
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>result-type</code></em>)</code></span></dt><dd><p>Fetch a single row of data. Returns a row of values
corresponding to the columns of an active SELECT statment. The row
data is returned in one of three different forms, depending on the
value of the symbol <em class="replaceable"><code>result-type</code></em>:
</p><div class="variablelist"><p class="title"><strong>Return values for <code class="function">FETCH</code></strong></p><dl class="variablelist"><dt><span class="term"><code class="classname">ARRAY</code></span></dt><dd>Values will be returned in an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> with the
same number of columns as in the SELECT statement, in the same
order. This is the default.</dd><dt><span class="term"><code class="classname">PAIRS</code></span></dt><dd>A list of pairs, <code class="literal">((column, value)
...)</code> is be returned. The number and order of pairs is
the same as the columns in the SELECT statement.
</dd><dt><span class="term"><code class="classname">HASH</code></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a> whose keys are the column names
and whose values are the column values in the row. The SELECT
columns <span class="emphasis"><em>must be unique</em></span> and be valid Lisp
symbols to use this option. If you are SELECTing an expression, you
probably want to use a column alias: <code class="literal">SELECT <expr> AS
some_alias ...</code></dd></dl></div><p>The following data type conversions are done between <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>
datatypes and <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> data types:
</p><div class="informaltable"><a id="ora-fetch-data-types-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> type</th><th>Converts to/from <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> type</th></tr></thead><tbody><tr><td>Numeric (NUMBER, INTEGER, FLOAT)</td><td>The appropriate <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> numeric type (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_bignum.html" target="_top"><code class="classname">BIGNUM</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>)</td></tr><tr><td>String (CHAR, VARCHAR, VARCHAR2)</td><td>A <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>. Note that CHAR will be padded out to its
full, fixed length as defined in <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>; VARCHAR will be a
string of variable length. Also note that <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> has no
"zero-length string" value - it returns the SQL special value
<code class="constant">NULL</code> which is converted to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (see below).</td></tr><tr><td>DATE</td><td>A string of the form "YYYY-MM-DD HH:MM:SS" where HH is
24-hour form. If you want dates formatted differently, convert
them to strings in <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> using <code class="literal">SELECT
TO_CHAR(mydate, '<em class="replaceable"><code>template</code></em>') AS
mydate</code>; the result will then be returned as a string,
formatted as per <em class="replaceable"><code>template</code></em>.</td></tr><tr><td>RAW, LONG RAW</td><td>A hexadecimal string, with two hex digits for each byte of
<a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data. Note that this means the Lisp string will be
twice the size, in bytes, as the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data.</td></tr><tr><td>"Large" types (LONG, BLOB, CLOB)</td><td>A Lisp string of (arbitrary, possibly binary) data. Note
that truncation may occur; see the <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>
parameters <em class="replaceable"><code>long-len</code></em>
and <em class="replaceable"><code>truncate-ok</code></em>.</td></tr><tr><td><code class="constant">NULL</code></td><td>The <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> value <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a></td></tr></tbody></table></div><p>
</p></dd><dt><a id="ora-fetch-all"></a><span class="term"><code class="code">(ORACLE:FETCH-ALL
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>max-rows</code></em>
<em class="replaceable"><code>result-type</code></em>
<em class="replaceable"><code>item-type</code></em>)</code></span></dt><dd><p class="simpara">Fetch some or all the rows from a query and return
result as a sequence of sequences. Arguments are all optional:
<em class="replaceable"><code>max-rows</code></em> limits the result to
that numbers of rows;
<em class="replaceable"><code>result-type</code></em> is the type of
sequence of the rows, either
'<code class="classname">ARRAY</code> (the default) or
'<code class="classname">LIST</code>;
<em class="replaceable"><code>item-type</code></em> is the type of
sequence of the column values for each row, either
'<code class="classname">ARRAY</code> (the default) or
'<code class="classname">LIST</code>.
Each row fetched always contains the full set of column values SELECTed.
</p><p class="simpara">
<code class="function">FETCH-ALL</code> is often useful in conjunction with
<code class="function">MAP</code> or <code class="function">REDUCE</code> to iterate
over an entire SELECT result to construct a single Lisp value.
</p></dd><dt><a id="ora-peek"></a><span class="term"><code class="code">(ORACLE:PEEK <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>result-type</code></em>)</code></span></dt><dd>
Peek at next row of data (without fetching it). Returns a row a la
<code class="function">FETCH</code>, except does not advance to the next row.
Repeated calls to <code class="function">PEEK</code> will thus return the same
row of data. Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if at EOF. If data is available, returns
row data just as <code class="function">FETCH</code> (see
<code class="function">FETCH</code> for data format and conversions done).
Optional argument <em class="replaceable"><code>result-type</code></em> is the type
of sequence of the column values for the returned row, either
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a> (the default) or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.
<code class="function">PEEK</code> is a useful look-ahead
for database reporting functions that may need to "break" on changes in
data to print headers, summaries, etc.
</dd><dt><a id="ora-columns"></a><span class="term"><code class="code">(ORACLE:COLUMNS)</code></span></dt><dd><p>Returns information on the columns of a SELECT
result, in the form of an array of SQLCOL structures, one for each
result column in the most recent SELECT statement. It is not
necessary to have called <code class="function">FETCH</code> before requesting
column information on the query, however the query must have been
compiled and executed with <code class="function">RUN-SQL</code>. Each SQLCOL
structure has these slots:
</p><div class="variablelist"><p class="title"><strong>Slots of <code class="classname">SQLCOL</code></strong></p><dl class="variablelist"><dt><span class="term">NAME</span></dt><dd>The <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> column name or the expression
selected. If the query used a column alias, <code class="literal">SELECT
<em class="replaceable"><code>expr</code></em> AS
<em class="replaceable"><code>alias</code></em></code>, then
<em class="replaceable"><code>alias</code></em> will be returned as the column name.
</dd><dt><span class="term">TYPE</span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data type (VARCHAR, NUMBER, DATE, ...)
</dd><dt><span class="term">SIZE</span></dt><dd><a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> data length (useful mostly for
character types)</dd><dt><span class="term">SCALE</span></dt><dd>For numeric (NUMBER) types, number of digits to right of
decimal; NIL for FLOAT</dd><dt><span class="term">PRECISION</span></dt><dd>For numeric types, total number of significant
digits (decimal digits for NUMBER, bits for FLOAT)</dd><dt><span class="term">NULL_OK</span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if <code class="constant">NULL</code>s allowed, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <code class="constant">NULL</code>s are
not allowed.</dd></dl></div><p class="simpara">To access the values of the SQLCOL structures, use the standard
accessor functions, e.g., <code class="literal">(ORACLE:SQLCOL-NAME (elt
(ORACLE:COLUMNS) 0))</code></p></dd><dt><a id="ora-eof"></a><span class="term"><code class="code">(ORACLE:EOF)</code></span></dt><dd>
Returns EOF status. A SELECT query cursor is considered at EOF if the next
FETCH would return no data. Must be connected to a database, and have
an active SELECT statement.
</dd><dt><a id="ora-insert-row"></a><span class="term"><code class="code">(ORACLE:INSERT-ROW
<em class="replaceable"><code>table</code></em>
<em class="replaceable"><code>values</code></em>)</code></span></dt><dd>
Inserts a single row into <em class="replaceable"><code>table</code></em>.
Second argument <em class="replaceable"><code>values</code></em> is a map of
column names to values: either a hash table whose keys are the column
names, or a list of (name, value) pairs. Columns missing from the map
will be given the default <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> value, or <code class="constant">NULL</code>.
Returns the number of rows inserted (i.e., always 1).
</dd><dt><a id="ora-update-row"></a><span class="term"><code class="code">(ORACLE:UPDATE-ROW
<em class="replaceable"><code>table</code></em>
<em class="replaceable"><code>condition</code></em>
<em class="replaceable"><code>vals</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
<em class="replaceable"><code>params</code></em>)</code></span></dt><dd>
Updates rows in <em class="replaceable"><code>table</code></em>. Second argument
<em class="replaceable"><code>condition</code></em> is a string expression for a WHERE
clause (without the "WHERE") which determines which rows are updated.
Third argument <em class="replaceable"><code>vals</code></em> is a map of columns to
be updated to their new values: a hash table whose keys are column
names, or list of (name, value) pairs. Optional
<em class="replaceable"><code>params</code></em> specifies values for named
parameters that may occur in <em class="replaceable"><code>condition</code></em>,
e.g., when the condition is a match on a primary key, e.g.: <code class="literal">"pk_column
= :pk_val"</code>. Returns the number of rows updated.
</dd><dt><a id="ora-row-count"></a><span class="term"><code class="code">(ORACLE:ROW-COUNT)</code></span></dt><dd>
For SELECT statements, returns the number of rows
<code class="function">FETCH</code>ed (<span class="strong"><strong>not</strong></span>
<code class="function">PEEK</code>ed) so far. For other statements (e.g.,
INSERT, UPDATE, DELETE), returns the number of rows affected by the
last operation (e.g., inserted, updated, deleted). Must be connected
to a database and have an active SQL statement.
</dd><dt><a id="ora-with-transaction"></a><span class="term"><code class="code">(ORACLE:WITH-TRANSACTION
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a>
<em class="replaceable"><code>body</code></em>)</code></span></dt><dd>
Evaluates the forms in <em class="replaceable"><code>body</code></em> atomically as a
database transaction, ensuring that either all the database operations
done in <em class="replaceable"><code>body</code></em> complete successfully, or none
of them do. If pending (un-committed) changes exist when this macro
is entered, they are <span class="emphasis"><em>rolled back</em></span> (undone), so
that the database is affected only by the subsequent updates inside
<em class="replaceable"><code>body</code></em>. Nesting of
<code class="function">WITH-TRANSACTION</code> blocks is not allowed and will
raise an error. There is no effect on the status of
<em class="replaceable"><code>auto-commit</code></em> given in
<a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a>; it resumes its previous state when the
macro exits. The value of the <code class="function">WITH-TRANSACTION</code>
expression is that of the last form in <em class="replaceable"><code>body</code></em>.
</dd><dt><a id="ora-commit"></a><span class="term"><code class="code">(ORACLE:COMMIT)</code></span></dt><dd>
Commits (makes permanent) any pending changes to the database. The
<em class="replaceable"><code>auto-commit</code></em> parameter to
<a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> must not have been set to use this
function, nor can it be called inside a
<code class="function">WITH-TRANSACTION</code> block. Always returns NIL.
</dd><dt><a id="ora-rollback"></a><span class="term"><code class="code">(ORACLE:ROLLBACK)</code></span></dt><dd>
Rolls back (undoes and abandons) any pending changes to the database.
The <em class="replaceable"><code>auto-commit</code></em> parameter to
<a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> must not have been set to use this
function, nor can it be called inside a
<code class="function">WITH-TRANSACTION</code> block. Always returns NIL.
</dd><dt><a id="ora-auto-commit"></a><span class="term"><code class="code">(ORACLE:AUTO-COMMIT)</code></span></dt><dd>
Toggles the state of <em class="replaceable"><code>auto-commit</code></em> initially
given to <a class="link" href="#ora-connect"><code class="function">ORACLE:CONNECT</code></a> for the current connection.
With <em class="replaceable"><code>auto-commit</code></em> enabled, modifications to
the database are committed (made permanent) after each destructive SQL
operation made with calls to <code class="function">RUN-SQL</code>,
<code class="function">INSERT-ROW</code>, <code class="function">UPDATE_ROW</code>, etc.
With <em class="replaceable"><code>auto-commit</code></em> disabled, transactional
integrity is under the programmer's control and is managed either by
(1) explicitly calling <code class="function">COMMIT</code> or
<code class="function">ROLLBACK</code> to commit or undo the pending
operations, or (2) wrapping code blocks with database operations
inside the <code class="function">WITH-TRANSACTION</code> macro.
<code class="function">AUTO-COMMIT</code> returns the previous status of
<em class="replaceable"><code>auto-commit</code></em>.
<code class="function">AUTO-COMMIT</code> may not be called inside
<code class="function">WITH-TRANSACTION</code>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ora-example"></a>33.10.2. <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Example</h3></div></div></div><p>
Below is a simple example script which uses <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>'s demo database
schema, <code class="literal">SCOTT</code>.
</p><pre class="programlisting">
(setf server "orcl") <strong> ; </strong><em class="lineannotation"><span class="lineannotation">; Change this to your server's SID</span></em>
(oracle:connect "scott" "tiger" server)
(oracle:run-sql "SELECT deptno, dname, loc FROM dept ORDER BY DNAME")
(oracle:do-rows (deptno dname loc)
(format t "Dept. no is '~A', " deptno)
(format t "Dept. name is '~A', " dname)
(format t "Dept. loc is '~A'~%" loc))
(oracle:update-row "dept" "dname = :acctval" '(("dname" "NEWACCT")) '(("acctval" "ACCOUNTING")))
(oracle:run-sql "SELECT deptno, dname, loc FROM dept ORDER BY DNAME")
(oracle:do-rows (deptno dname loc)
(format t "Dept. no is '~A', " deptno)
(format t "Dept. name is '~A', " dname)
(format t "Dept. loc is '~A'~%" loc))
(oracle:update-row "dept" "dname = :acctval" '(("dname" "ACCOUNTING")) '(("acctval" "NEWACCT")))
</pre><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ora-config"></a>33.10.3. <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Configuration</h3></div></div></div><p>Obviously, a working <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> environment is required. It is
recommended that you first be able to log on and use the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>
SQL*Plus application to test your environment
<span class="strong"><strong>before</strong></span> attempting <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> access via the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> module.
At a minimum you will need to set environment variables
<code class="envar">ORACLE_HOME</code> to the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> base directory and
<code class="envar">LD_LIBRARY_PATH</code> to include
<code class="literal">$<code class="envar">ORACLE_HOME</code>/lib</code> and possibly other
directories.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="ora-build"></a>33.10.4. Building the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Interface</h3></div></div></div><p>The module uses the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a> Call Interface (<a class="ulink" href="http://www.vivtek.com/oracle.html" target="_top">OCI</a>)
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> library. To build the module you will need the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>
<a class="ulink" href="http://www.vivtek.com/oracle.html" target="_top">OCI</a> headers and link libraries; as a quick check, make sure
you have the file <code class="filename">oci.h</code> somewhere
under <code class="envar">ORACLE_HOME</code>, probably
in <code class="filename">$<code class="envar">ORACLE_HOME</code>/rdbms/demo/oci.h</code>.</p><p>To build the module into <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, configure with
<span class="command"><strong>./configure ... --with-module=oracle ...</strong></span>.
The <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> will contain the module,
so you will need to use the <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> option to use it.
You can test that you really have the <a class="ulink" href="http://www.oracle.com" target="_top">Oracle</a>-enabled <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> by
evaluating <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_describe.html" target="_top"><code class="function">DESCRIBE</code></a> 'oracle:connect)</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>It may be necessary to edit file
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/oracle/Makefile.in"><code class="filename">modules/oracle/Makefile.in</code></a>
prior to running <span class="command"><strong>./configure</strong></span>.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="libsvm"></a>33.11. LibSVM Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#libsvm-types">33.11.1. Types</a></span></dt><dt><span class="section"><a href="#libsvm-output">33.11.2. Output</a></span></dt><dt><span class="section"><a href="#libsvm-functions">33.11.3. Functions</a></span></dt><dd><dl><dt><span class="section"><a href="#libsvm-functions-problem">33.11.3.1. Functions related to <span class="type">problem</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-model">33.11.3.2. Functions related to <span class="type">model</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-parameter">33.11.3.3. Functions related to <span class="type">parameter</span></a></span></dt></dl></dd></dl></div><p>This is an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to <a class="ulink" href="http://www.csie.ntu.edu.tw/~cjlin/libsvm/" target="_top">LibSVM</a>.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">LIBSVM</span>”</span></strong> is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
and you do not need the <code class="function">svm_</code> prefix.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:LIBSVM</code>.</p><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/libsvm/test.tst"><code class="filename">modules/libsvm/test.tst</code></a>
for sample usage.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="libsvm-types"></a>33.11.1. Types</h3></div></div></div><p>All data is kept on the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> side as much as possible, so
these foreign types do <span class="strong"><strong>not</strong></span> have a <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> counterpart.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="type">node</span></span></dt><dd>Corresponds to <span class="type">svm_node</span>, represented
as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> on the lisp side.</dd><dt><span class="term"><span class="type">problem</span></span></dt><dd>Corresponds to <span class="type">svm_problem</span>, represented
as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> on the lisp side.</dd><dt><span class="term"><span class="type">parameter</span></span></dt><dd>Corresponds to <span class="type">svm_parameter</span>, represented
as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> on the lisp side.</dd><dt><span class="term"><span class="type">model</span></span></dt><dd>Corresponds to <span class="type">svm_model</span>, an opaque
<a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="libsvm-output"></a>33.11.2. Output</h3></div></div></div><p>The output from the library functions goes to
<code class="varname">*libsvm-output*</code>, which is initialized to
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="libsvm-functions"></a>33.11.3. Functions</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#libsvm-functions-problem">33.11.3.1. Functions related to <span class="type">problem</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-model">33.11.3.2. Functions related to <span class="type">model</span></a></span></dt><dt><span class="section"><a href="#libsvm-functions-parameter">33.11.3.3. Functions related to <span class="type">parameter</span></a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="libsvm-functions-problem"></a>33.11.3.1. Functions related to <span class="type">problem</span></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(problem-l <em class="replaceable"><code>problem</code></em>)</code></span></dt><dd>Return the number of rows in the <em class="replaceable"><code>problem</code></em> (a
<a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>)</dd><dt><span class="term"><code class="code">(problem-y <em class="replaceable"><code>problem</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (<em class="replaceable"><code>length</code></em> (problem-l <em class="replaceable"><code>problem</code></em>)))</code></span></dt><dd>Return a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> <em class="replaceable"><code>length</code></em>)</code></span> representing the targets in the
<em class="replaceable"><code>problem</code></em> (a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>).</dd><dt><span class="term"><code class="code">(problem-y-n <em class="replaceable"><code>problem</code></em>
<em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (<em class="replaceable"><code>length</code></em> (problem-l <em class="replaceable"><code>problem</code></em>))))</code></span></dt><dd>Return the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a> representing the <em class="replaceable"><code>n</code></em>th
target in the <em class="replaceable"><code>problem</code></em> (a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>).
</dd><dt><span class="term"><code class="code">(problem-x <em class="replaceable"><code>problem</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (<em class="replaceable"><code>length</code></em> (problem-l <em class="replaceable"><code>problem</code></em>)))</code></span></dt><dd>Return a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>
node) <em class="replaceable"><code>length</code></em>)</code></span> representing the predictors in the <em class="replaceable"><code>problem</code></em>
(a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>).</dd><dt><span class="term"><code class="code">(problem-x-n <em class="replaceable"><code>problem</code></em>
<em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (<em class="replaceable"><code>length</code></em> (problem-l <em class="replaceable"><code>problem</code></em>))))</code></span></dt><dd>Return the <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> node)</code></span>
representing the <em class="replaceable"><code>n</code></em>th set of predictors in the <em class="replaceable"><code>problem</code></em> (a
<a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a>).</dd><dt><span class="term"><code class="code">(make-problem <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> <em class="replaceable"><code>l</code></em> <em class="replaceable"><code>y</code></em>
<em class="replaceable"><code>x</code></em>)</code></span></dt><dd>Allocate a <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> representing
a <span class="type">model</span>.</dd><dt><span class="term"><code class="code">(destroy-problem <em class="replaceable"><code>problem</code></em>)</code></span></dt><dd><p class="simpara">Release the memory taken by the <span class="type">problem</span>
object and invalidate the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>problem</code></em>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>You <span class="strong"><strong>must</strong></span> call this function yourself, but only
<span class="strong"><strong>after</strong></span> deallocating all <span class="type">model</span> objects trained from
this <em class="replaceable"><code>problem</code></em>.</p></div></dd><dt><span class="term"><code class="code">(load-problem <em class="replaceable"><code>filename</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
(<em class="replaceable"><code>log</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>))</code></span></dt><dd><p class="simpara">Read a <span class="type">problem</span> from a file in the
libsvm/svmlight format. Return two values: the <span class="type">problem</span>
and max index (i.e., the number of columns).</p><p class="simpara">Messages go to <em class="replaceable"><code>log</code></em>.</p></dd><dt><span class="term"><code class="code">(save-problem <em class="replaceable"><code>filename</code></em> <em class="replaceable"><code>problem</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> (<em class="replaceable"><code>log</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stdebug-i_ace-outputst.html" target="_top"><code class="varname">*STANDARD-OUTPUT*</code></a>))</code></span></dt><dd><p class="simpara">Write a <span class="type">problem</span> into a file.</p><p class="simpara">Messages go to <em class="replaceable"><code>log</code></em>.</p></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="libsvm-functions-model"></a>33.11.3.2. Functions related to <span class="type">model</span></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(destroy-model <em class="replaceable"><code>model</code></em>)</code></span></dt><dd><p class="simpara">Release the memory taken by the <span class="type">model</span>
object and invalidate the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>model</code></em>.</p><p class="simpara">Calls <code class="function">svm_destroy_model</code> or
<code class="function">svm_svm_free_and_destroy_model</code>.</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to call this function yourself, it is
attached to the <em class="replaceable"><code>model</code></em> by <code class="function">train</code>
and <code class="function">load-model</code> via <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a>.</p></dd><dt><span class="term"><code class="code">(check-parameter <em class="replaceable"><code>problem</code></em> <em class="replaceable"><code>parameter</code></em>)</code></span></dt><dd><p class="simpara">Check if the <em class="replaceable"><code>parameter</code></em> is appropriate for the
<em class="replaceable"><code>problem</code></em>.</p><p class="simpara">Calls <code class="function">svm_check_parameter</code>.</p></dd><dt><span class="term"><code class="code">(train <em class="replaceable"><code>problem</code></em> <em class="replaceable"><code>parameter</code></em>)</code></span></dt><dd><p class="simpara">Train a <span class="type">model</span>.</p><p class="simpara">Calls <code class="function">svm_train</code>
and <code class="function">check-parameter</code>.</p></dd><dt><span class="term"><code class="code">(cross-validation <em class="replaceable"><code>problem</code></em> <em class="replaceable"><code>parameter</code></em>
<em class="replaceable"><code>n</code></em>)</code></span></dt><dd><p class="simpara">Run <em class="replaceable"><code>n</code></em>-fold cross-validation.</p><p class="simpara">Calls <code class="function">svm_cross_validation</code>
and <code class="function">check-parameter</code>.</p></dd><dt><span class="term"><code class="code">(save-model <em class="replaceable"><code>filename</code></em> <em class="replaceable"><code>model</code></em>)</code></span></dt><dd><p class="simpara">Write a <span class="type">model</span> into a file.</p><p class="simpara">Calls <code class="function">svm_save_model</code>.</p></dd><dt><span class="term"><code class="code">(load-model <em class="replaceable"><code>filename</code></em>)</code></span></dt><dd><p class="simpara">Read a <span class="type">model</span> from a file.</p><p class="simpara">Calls <code class="function">svm_load_model</code>.</p></dd><dt><span class="term"><code class="code">(get-svm-type <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_get_svm_type</code>.
</dd><dt><span class="term"><code class="code">(get-nr-class <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_get_nr_class</code>.
</dd><dt><span class="term"><code class="code">(get-labels <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_get_labels</code>.
</dd><dt><span class="term"><code class="code">(get-svr-probability <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_get_svr_probability</code>.
</dd><dt><span class="term"><code class="code">(predict-values <em class="replaceable"><code>model</code></em> <em class="replaceable"><code>x</code></em>)</code></span></dt><dd><p class="simpara">Return the decision values
(a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>)</code></span>) given
by <em class="replaceable"><code>model</code></em> for <em class="replaceable"><code>x</code></em> (a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> node)</code></span>).
</p><p class="simpara">Calls <code class="function">svm_predict_values</code>.</p></dd><dt><span class="term"><code class="code">(predict <em class="replaceable"><code>model</code></em> <em class="replaceable"><code>x</code></em>)</code></span></dt><dd>Call <code class="function">svm_predict</code>.
</dd><dt><span class="term"><code class="code">(predict-probability <em class="replaceable"><code>model</code></em> <em class="replaceable"><code>x</code></em>)</code></span></dt><dd>Call <code class="function">svm_predict_probability</code>.
</dd><dt><span class="term"><code class="code">(check-probability-model <em class="replaceable"><code>model</code></em>)</code></span></dt><dd>Call <code class="function">svm_check_probability_model</code>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="libsvm-functions-parameter"></a>33.11.3.3. Functions related to <span class="type">parameter</span></h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(destroy-parameter <em class="replaceable"><code>parameter</code></em>)</code></span></dt><dd><p class="simpara">Release the memory taken by the <span class="type">parameter</span>
object and invalidate the <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> <em class="replaceable"><code>parameter</code></em>.</p><p class="simpara">Does <span class="strong"><strong>not</strong></span> call <code class="function">svm_destroy_param</code>.</p><p class="simpara">You do <span class="strong"><strong>not</strong></span> have to call this function yourself, it is
attached to the <em class="replaceable"><code>parameter</code></em> by <code class="function">make-parameter</code>
via <a class="link" href="#final" title="31.8. Finalization"><code class="function">EXT:FINALIZE</code></a>.</p></dd><dt><span class="term"><code class="code">(make-parameter <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :v svm_type
kernel_type degree gamma coef0 cache_size eps C nr_weight
weight_label weight nu p shrinking probability)</code></span></dt><dd><p class="simpara">Allocates a new <a class="link" href="#dffi-variables" title="32.3.5. Foreign variables"><code class="classname">FFI:FOREIGN-VARIABLE</code></a> of
type <span class="type">parameter</span> with the supplied slots.</p><p class="simpara">The defaults come from vector <em class="replaceable"><code>v</code></em> (such as returned
by <code class="code">(<a class="link" href="#foreign-value"><code class="function">FFI:FOREIGN-VALUE</code></a> <em class="replaceable"><code>parameter</code></em>)</code>), if supplied, providing
an easy way to copy <em class="replaceable"><code>parameter</code></em>s, otherwise the defaults
for <span class="command"><strong>svm-train</strong></span> are used.</p></dd><dt><span class="term"><code class="code">(parameter-alist <em class="replaceable"><code>parameter</code></em>)</code></span></dt><dd>Return the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> representing <em class="replaceable"><code>parameter</code></em>.
</dd></dl></div></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pari"></a>33.12. Computer Algebra System PARI</h2></div></div></div><p>This package offers an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to <a class="ulink" href="http://pari.math.u-bordeaux.fr/" target="_top">PARI</a>.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">PARI</span>”</span></strong>
is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
symbol <code class="constant">:PARI</code>.</p><p>PARI objects are printed and read using a special
<span class="data"><code class="literal">#Z""</code></span> syntax.</p><p>Most functions accept lisp objects as well as PARI objects and
return PARI objects, which can be converted to lisp using the
<code class="function">pari:pari-to-lisp</code> function.</p><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/pari/test.tst"><code class="filename">modules/pari/test.tst</code></a>
for sample usage.</p><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pari-ext"></a>Extending the module</h3></div></div></div><p>Not all PARI functions have a corresponding lisp function yet, but one
remedy that with just a few lines: </p><pre class="programlisting">
(<a class="link" href="#dffi-default-lib"><code class="function">FFI:DEFAULT-FOREIGN-LIBRARY</code></a> "libpari.so") ; or pari.dll on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>
(pari:pari-call-out (matrix-rank ffi:long) "rank" (x))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">long rank(GEN x);</span></em>
(pari:pari-call-out fibonacci "fibo" ((n ffi:long)))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">GEN fibo(long n);</span></em>
(pari:pari-call-out-prec pari-arctan "gatan" (x))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">GEN gatan(GEN x, long prec);</span></em>
(pari:pari-call-out (equal? boolean) "gequal" (x y))<strong> ; </strong><em class="lineannotation"><span class="lineannotation">GEN gequal(GEN x, GEN y);</span></em>
</pre><p>
(Actually, these four functions are already present in the module.)
Please feel free to submit additions for
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/pari/pari.lisp"><code class="filename">modules/pari/pari.lisp</code></a>
and <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/pari/test.tst"><code class="filename">modules/pari/test.tst</code></a>.</p></div><div class="simplesect"><div class="titlepage"><div><div><h3 class="title"><a id="pari-prec"></a>Real precision</h3></div></div></div><p>The real precision defaults to <code class="varname">pari:pari-real-precision</code>
which specifies the default precision in decimal digits:
</p><pre class="programlisting">
pari:pari-real-precision
⇒ <code class="computeroutput">19</code>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">PRIN1-TO-STRING</code></a> (pari:pari-to-lisp (pari:pari-pi))))
⇒ <code class="computeroutput">23</code>
</pre><p>
One can also pass the precision parameter explicitly:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_write-to-_nc-to-string.html" target="_top"><code class="function">PRIN1-TO-STRING</code></a> (pari:pari-to-lisp (pari:pari-pi :prec 38))))
⇒ <code class="computeroutput">41</code>
</pre><p>
Note that the <span class="emphasis"><em>actual</em></span> precision is determined by the
size of the mantissa which can be incremented only in steps of
<code class="code">(<a class="link" href="#bitsizeof"><code class="function">FFI:BITSIZEOF</code></a> 'ffi:ulong)</code> (64 bits or 32 bits).</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="matlab"></a>33.13. Matlab Interface</h2></div></div></div><p>This is an interface to the
<a class="matlab" href="http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/">Matlab C API</a>.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">MATLAB</span>”</span></strong> is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
so you would write <code class="code">(matlab:engOpen ...)</code>
when you need to call <a class="matlab" href="http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/engopen.html"><code class="function">engOpen</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:MATLAB</code>.</p><p>Additionally, some higher level functionality is available
(see <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/matlab/test.tst"><code class="filename">modules/matlab/test.tst</code></a>
for sample usage):</p><div class="variablelist"><dl class="variablelist"><dt><a id="matlab-matfile-content"></a><span class="term"><code class="code">(matlab:matfile-content mf)</code></span></dt><dd>Return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s naming the
variables in file <em class="replaceable"><code>mf</code></em>
(opened using <a class="matlab" href="http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/matopen.html"><code class="function">matOpen</code></a>).
</dd><dt><a id="matlab-command"></a><span class="term"><code class="varname">matlab:*command*</code></span></dt><dd>The default argument to
<a class="matlab" href="http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/engopen.html"><code class="function">engOpen</code></a>.
</dd><dt><a id="matlab-engine-v"></a><span class="term"><code class="varname">matlab:*engine*</code></span></dt><dd>The currrently open Matlab engine.
</dd><dt><a id="matlab-engine-f"></a><span class="term"><code class="code">(matlab:engine)</code></span></dt><dd>Make sure <code class="varname">*engine*</code> is valid and
return it.</dd><dt><a id="matlab-with-engine"></a><span class="term"><code class="code">(matlab:with-engine
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> engine command) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd>Run the <em class="replaceable"><code>body</code></em> wuth the <em class="replaceable"><code>engine</code></em>
bound to a Matlab engine (default <code class="varname">*engine*</code>).
The engine is opened with <a class="matlab" href="http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/engopen.html"><code class="function">engOpen</code></a>,
then closed with <a class="matlab" href="http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/engclose.html"><code class="function">engClose</code></a>.
</dd><dt><a id="matlab-with-MATfile"></a><span class="term"><code class="code">(matlab:with-MATfile
(file name <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> mode) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> <em class="replaceable"><code>body</code></em>)</code></span></dt><dd><a class="matlab" href="http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/matopen.html"><code class="function">matOpen</code></a> the
matlab file, do the <em class="replaceable"><code>body</code></em>, <a class="matlab" href="http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/matclose.html"><code class="function">matClose</code></a>
it.</dd><dt><a id="copy-lisp-to-mxArray"></a><span class="term"><code class="code">(matlab:copy-lisp-to-mxArray
lisp-array <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> matlab-matrix)</code></span></dt><dd>Copy data from the 2-dimensional lisp array to the
Matlab matrix.</dd><dt><a id="copy-lisp-to-matlab"></a><span class="term"><code class="code">(matlab:copy-lisp-to-matlab
lisp-array matlab-variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> engine)</code></span></dt><dd>Copy the 2-dimensional lisp array to the Matlab
variable (a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>) in the supplied engine (defaults to
<code class="varname">*engine*</code>).</dd><dt><a id="copy-mxArray-to-lisp"></a><span class="term"><code class="code">(matlab:copy-mxArray-to-lisp
matlab-matrix <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> lisp-array)</code></span></dt><dd>Copy the matlab matrix to the 2-dimensional lisp array
(created anew or re-used if supplied).</dd><dt><a id="copy-matlab-to-lisp"></a><span class="term"><code class="code">(matlab:copy-matlab-to-lisp
matlab-variable <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> lisp-array <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> engine)</code></span></dt><dd>Copy data from the matlab variable to the
2-dimensional lisp array
(created anew or re-used if supplied).</dd><dt><a id="matlab-invert-matrix"></a><span class="term"><code class="code">(matlab:invert-matrix
lisp-array <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> engine)</code></span></dt><dd>Invert the lisp matrix using the specified engine.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="netica"></a>33.14. Netica Interface</h2></div></div></div><p>This is an interface to the <a class="ulink" href="http://norsys.com/netica_c_api.htm" target="_top">Netica C API</a> (<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> API version 3.25)
for working with Bayesian belief networks and influence diagrams.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">NETICA</span>”</span></strong> is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
e.g., you would write <code class="code">(netica:GetNodeExpectedUtils_bn ...)</code>
when you need to call
<a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeExpectedUtils_bn.html"><code class="function">GetNodeExpectedUtils_bn</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:NETICA</code>.</p><p>All public <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions are available as
<a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s.</p><p>The functions which are specified to return <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> arrays,
namely </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeBeliefs_bn.html"><code class="function">GetNodeBeliefs_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeExpectedUtils_bn.html"><code class="function">GetNodeExpectedUtils_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeLikelihood_bn.html"><code class="function">GetNodeLikelihood_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeProbs_bn.html"><code class="function">GetNodeProbs_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeLevels_bn.html"><code class="function">GetNodeLevels_bn</code></a></td></tr></table><p> correspond to <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s which return <a class="link" href="#c-pointer"><span class="type">FFI:C-POINTER</span></a>s.
We define low level wrappers for them, namely </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="function">GetNodeBeliefs</code></td></tr><tr><td><code class="function">GetNodeExpectedUtils</code></td></tr><tr><td><code class="function">GetNodeLikelihood</code></td></tr><tr><td><code class="function">GetNodeProbs</code></td></tr><tr><td><code class="function">GetNodeLevels</code></td></tr></table><p> which return the appropriate <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s.</p><p>Additionally, some higher level functionality is available
(see <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/netica/demo.lisp"><code class="filename">modules/netica/demo.lisp</code></a>
for sample usage):</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(netica:start-netica <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:license :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNeticaEnviron_ns.html"><code class="function">NewNeticaEnviron_ns</code></a>
and <a class="netica" href="http://norsys.com/onLineAPIManual/functions/InitNetica2_bn.html"><code class="function">InitNetica2_bn</code></a> and print some
statistics; initialize <code class="varname">netica:*env*</code>.
</dd><dt><span class="term"><code class="code">(netica:check-errors <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:env :clear :severity)</code></span></dt><dd>Show and, optionally, clear
(<a class="netica" href="http://norsys.com/onLineAPIManual/functions/ClearError_ns.html"><code class="function">ClearError_ns</code></a>), the errors of the
given severity (<a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorSeverity_ns.html"><code class="function">ErrorSeverity_ns</code></a>)
and above.
You should call this function after <span class="emphasis"><em>every</em></span> call
to a Netica function. Every wrapper function in this list calls it,
so you do <span class="strong"><strong>not</strong></span> need to call it after a call to a wrapper function.
</dd><dt><span class="term"><code class="code">(netica:error-message error)</code></span></dt><dd><p>Convert netica error to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> containing</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorCategory_ns.html"><code class="function">ErrorCategory_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorSeverity_ns.html"><code class="function">ErrorSeverity_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorNumber_ns.html"><code class="function">ErrorNumber_ns</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/ErrorMessage_ns.html"><code class="function">ErrorMessage_ns</code></a></td></tr></table></dd><dt><span class="term"><code class="code">(netica:close-netica <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:env :verbose)</code></span></dt><dd>Terminate the Netica session.
Sets <code class="varname">netica:*env*</code> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
</dd><dt><span class="term"><code class="code">(netica:make-net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :name
:comment :title :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNet_bn.html"><code class="function">NewNet_bn</code></a>,
<a class="netica" href="http://norsys.com/onLineAPIManual/functions/SetNetTitle_bn.html"><code class="function">SetNetTitle_bn</code></a> and
<a class="netica" href="http://norsys.com/onLineAPIManual/functions/SetNetComment_bn.html"><code class="function">SetNetComment_bn</code></a>.
</dd><dt><span class="term"><code class="code">(netica:net-info net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :out)</code></span></dt><dd><p>Print some information about the net:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetName_bn.html"><code class="function">GetNetName_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetTitle_bn.html"><code class="function">GetNetTitle_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetComment_bn.html"><code class="function">GetNetComment_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetFileName_bn.html"><code class="function">GetNetFileName_bn</code></a></td></tr><tr><td><a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNetNodes_bn.html"><code class="function">GetNetNodes_bn</code></a></td></tr></table></dd><dt><span class="term"><code class="code">(netica:make-node <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:name :net :kind :levels :states :num-states :title :comment :parents
:cpt :x :y :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewNode_bn.html"><code class="function">NewNode_bn</code></a>
with the given name and many other parameters.
</dd><dt><span class="term"><code class="code">(netica:node-info node
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :header :out)</code></span></dt><dd>Print some information about the node, preceded by
the header.</dd><dt><span class="term"><code class="code">(netica:get-beliefs node
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeBeliefs_bn.html"><code class="function">GetNodeBeliefs_bn</code></a>
on the node and pretty-print the results when <code class="constant">:VERBOSE</code>
is non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><code class="code">(netica:enter-finding net node
state <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/EnterFinding_bn.html"><code class="function">EnterFinding_bn</code></a>
using <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetNodeNamed_bn.html"><code class="function">GetNodeNamed_bn</code></a>
and <a class="netica" href="http://norsys.com/onLineAPIManual/functions/GetStateNamed_bn.html"><code class="function">GetStateNamed_bn</code></a>.
</dd><dt><span class="term"><code class="code">(netica:save-net net <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:file :env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/WriteNet_bn.html"><code class="function">WriteNet_bn</code></a>.
</dd><dt><span class="term"><code class="code">(netica:read-net file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:env :verbose)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/ReadNet_bn.html"><code class="function">ReadNet_bn</code></a>.
</dd><dt><span class="term"><code class="code">(netica:with-open-dne-file (var
file <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> opts) <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-4.html" target="_top"><code class="literal">&BODY</code></a> body)</code></span></dt><dd>Call <a class="netica" href="http://norsys.com/onLineAPIManual/functions/NewFileStream_ns.html"><code class="function">NewFileStream_ns</code></a>,
execute <em class="replaceable"><code>body</code></em>, then <a class="netica" href="http://norsys.com/onLineAPIManual/functions/DeleteStream_ns.html"><code class="function">DeleteStream_ns</code></a>
- just like <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-stream.html" target="_top"><code class="function">WITH-OPEN-STREAM</code></a>.</dd><dt><span class="term"><code class="varname">netica:*verbose*</code></span></dt><dd>The log <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>; the default value for
the <code class="constant">:VERBOSE</code> argument (initially set to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>).
</dd><dt><span class="term"><code class="varname">netica:*license*</code></span></dt><dd>The license key provided by
<a class="ulink" href="http://norsys.com/" target="_top">Norsys</a>; the default value
for the <code class="literal">:LICENSE</code> argument.
</dd><dt><span class="term"><code class="varname">netica:*env*</code></span></dt><dd>The Netica environment object; the default value
for the <code class="literal">:ENV</code> argument.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pcre"></a>33.15. Perl Compatible Regular Expressions</h2></div></div></div><p>This is an interface to <a class="ulink" href="http://www.pcre.org/" target="_top">Perl Compatible Regular Expressions</a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
symbol <code class="constant">:PCRE</code>.</p><div class="variablelist"><a id="pcre-api"></a><p class="title"><strong>PCRE module API</strong></p><dl class="variablelist"><dt><a id="pcre-version"></a><span class="term"><code class="code">(PCRE:PCRE-VERSION)</code></span></dt><dd>Return version information as 4 values: descriptive
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>; 2 <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s: major and minor numbers; date <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
</dd><dt><a id="pcre-config"></a><span class="term"><code class="code">(PCRE:PCRE-CONFIG <em class="replaceable"><code>type</code></em>)</code></span></dt><dd><p>Return some information about the PCRE build
configuration. <em class="replaceable"><code>type</code></em> is one of </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="literal">:UTF8</code></td></tr><tr><td><code class="literal">:NEWLINE</code></td></tr><tr><td><code class="literal">:LINK-SIZE</code></td></tr><tr><td><code class="literal">:POSIX-MALLOC-THRESHOLD</code></td></tr><tr><td><code class="literal">:MATCH-LIMIT</code></td></tr><tr><td><code class="literal">:STACKRECURSE</code></td></tr><tr><td><code class="literal">:UNICODE-PROPERTIES </code></td></tr><tr><td><code class="literal">:MATCH-LIMIT-RECURSION</code></td></tr><tr><td><code class="literal">:BSR</code></td></tr></table></dd><dt><a id="pcre-compile"></a><span class="term"><code class="code">(PCRE:PCRE-COMPILE <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :STUDY
:IGNORE-CASE :MULTILINE :DOTALL :EXTENDED :ANCHORED :DOLLAR-ENDONLY
:EXTRA :NOTBOL :NOTEOL :UNGREEDY :NOTEMPTY :NO-AUTO-CAPTURE)</code></span></dt><dd>Compile a pattern, optionally study it.
</dd><dt><a id="pattern-info"></a><span class="term">
<code class="code">(PCRE:PATTERN-INFO <em class="replaceable"><code>pattern</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> request)</code></span></dt><dd><p>Return some information about the <em class="replaceable"><code>pattern</code></em>,
such as </p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="literal">:OPTIONS</code></td></tr><tr><td><code class="literal">:SIZE</code></td></tr><tr><td><code class="literal">:CAPTURECOUNT</code></td></tr><tr><td><code class="literal">:BACKREFMAX</code></td></tr><tr><td><code class="literal">:FIRSTBYTE</code></td></tr><tr><td><code class="literal">:FIRSTTABLE</code></td></tr><tr><td><code class="literal">:LASTLITERAL</code></td></tr><tr><td><code class="literal">:NAMEENTRYSIZE</code></td></tr><tr><td><code class="literal">:NAMECOUNT</code></td></tr><tr><td><code class="literal">:NAMETABLE</code></td></tr><tr><td><code class="literal">:STUDYSIZE</code></td></tr><tr><td><code class="literal">:OKPARTIAL</code></td></tr><tr><td><code class="literal">:JCHANGED</code></td></tr><tr><td><code class="literal">:HASCRORLF</code></td></tr><tr><td><code class="literal">:MINLENGTH</code></td></tr></table></dd><dt><a id="pcre-name-to-index"></a><span class="term"><code class="code">(PCRE:PCRE-NAME-TO-INDEX <em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>Convert the name of the sub-pattern to an index in
the return vector.</dd><dt><a id="pcre-exec"></a><span class="term"><code class="code">(PCRE:PCRE-EXEC <em class="replaceable"><code>pattern</code></em> <em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
:WORK-SPACE :DFA :BOOLEAN :OFFSET :ANCHORED :NOTBOL :NOTEOL :NOTEMPTY
:PARTIAL :DFA-SHORTEST :DFA-RESTART :FIRSTLINE :DUPNAMES :NEWLINE-CR
:NEWLINE-LF :NEWLINE-CRLF :NEWLINE-ANY :NEWLINE-ANYCRLF :BSR-ANYCRLF
:BSR-UNICODE :JAVASCRIPT-COMPAT :NO-START-OPTIMIZE :NO-START-OPTIMISE
:PARTIAL-HARD :NOTEMPTY-ATSTART)</code></span></dt><dd><p class="simpara">Execute the compiled <em class="replaceable"><code>pattern</code></em> against the
<em class="replaceable"><code>string</code></em> at the given <em class="replaceable"><code>offset</code></em> with the given options.
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if no matches or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_length.html" target="_top"><code class="function">LENGTH</code></a>
<code class="literal">CAPTURECOUNT+1</code> of <span class="type">PCRE:MATCH</span> structures,
unless <code class="literal">:BOOLEAN</code> was non-<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, in which case
return <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> as an indicator of success, but do not allocate anything.
</p><p class="simpara"><code class="constant">:DFA</code> argument determines
whether <code class="function">pcre_dfa_exec</code> is used instead
of <code class="function">pcre_exec</code> (PCRE v6 and better).</p><p class="simpara"><code class="constant">:WORK-SPACE</code> is only used
for <code class="constant">:DFA</code> and defaults to 20.</p></dd><dt><a id="pcre-match-access"></a><span class="term"><code class="code">(PCRE:MATCH-START <em class="replaceable"><code>match</code></em>)</code><br /></span><span class="term"><code class="code">(PCRE:MATCH-END <em class="replaceable"><code>match</code></em>)</code></span></dt><dd>Return the start and end of the <em class="replaceable"><code>match</code></em>. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a>-able.
</dd><dt><a id="match-substring"></a><span class="term"><code class="code">(PCRE:MATCH-SUBSTRING <em class="replaceable"><code>match</code></em> <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Return the substring of <em class="replaceable"><code>string</code></em> bounded by <em class="replaceable"><code>match</code></em>.
</dd><dt><a id="match-strings"></a><span class="term"><code class="code">(PCRE:MATCH-STRINGS return-vector <em class="replaceable"><code>string</code></em>)</code></span></dt><dd>Return all substrings for all matches found
by <code class="function">PCRE:PCRE-EXEC</code>.
</dd><dt><a id="match-string"></a><span class="term"><code class="code">(PCRE:MATCH-STRING return-vector which
<em class="replaceable"><code>string</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>pattern</code></em>)</code></span></dt><dd>Return the substring that matches the given sub-pattern.
If <em class="replaceable"><code>which</code></em> is a name of the sub-pattern (as
opposed to its number), <em class="replaceable"><code>pattern</code></em> must be supplied.
</dd><dt><a id="pcre-matcher"></a><span class="term"><code class="code">(PCRE:PCRE-MATCHER <em class="replaceable"><code>pattern</code></em>)</code></span></dt><dd>A valid value for <a class="link" href="#apropos" title="25.2.10. Functions APROPOS & APROPOS-LIST"><code class="varname">CUSTOM:*APROPOS-MATCHER*</code></a>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="zlib"></a>33.16. Interface to zlib</h2></div></div></div><p>This is an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to the <a class="ulink" href="http://zlib.net" target="_top">ZLIB</a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:ZLIB</code>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(ZLIB:Z-VERSION)</code></span></dt><dd>Return the string version of the underlying library.
</dd><dt><span class="term"><code class="code">(ZLIB:COMPRESS source <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> level)</code></span></dt><dd>Compress the <em class="replaceable"><code>source</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>.
</dd><dt><span class="term"><code class="code">(ZLIB:UNCOMPRESS
source destination-length)</code></span></dt><dd>Uncompress the <em class="replaceable"><code>source</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (returned
by <code class="function">ZLIB:COMPRESS</code>).
<em class="replaceable"><code>destination-length</code></em> should be no less than
the length of the uncompressed <em class="replaceable"><code>source</code></em>.
</dd><dt><span class="term"><code class="code">(ZLIB:COMPRESS-BOUND source-length)</code></span></dt><dd>Return the maximum length of the return value
of <code class="function">ZLIB:COMPRESS</code>.</dd><dt><span class="term"><code class="code">(ZLIB:ERROR-STRING <em class="replaceable"><code>error-code</code></em>)</code></span></dt><dd>Return a descriptive string for the supplied <em class="replaceable"><code>error-code</code></em>.
</dd><dt><span class="term"><code class="classname">ZLIB:ZERROR</code></span></dt><dd>An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> sometimes <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
by <code class="function">ZLIB:COMPRESS</code>
and <code class="function">ZLIB:UNCOMPRESS</code>.
You can find the error code and the caller
using <code class="function">ZLIB:ZERROR-ERRNO</code>
and <code class="function">ZLIB:ZERROR-CALLER</code>.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="rawsock"></a>33.17. Raw Socket Access</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#rawsock-intro">33.17.1. Introduction</a></span></dt><dt><span class="section"><a href="#rawsock-func">33.17.2. Single System Call Functions</a></span></dt><dt><span class="section"><a href="#rawsock-args">33.17.3. Common arguments</a></span></dt><dd><dl><dt><span class="section"><a href="#rawsock-plat-dep-constants">33.17.3.1. Platform-dependent Keywords</a></span></dt></dl></dd><dt><span class="section"><a href="#rawsock-return">33.17.4. Return Values</a></span></dt><dt><span class="section"><a href="#rawsock-not-implemented">33.17.5. Not Implemented</a></span></dt><dt><span class="section"><a href="#rawsock-errors">33.17.6. Errors</a></span></dt><dt><span class="section"><a href="#rawsock-high-level">33.17.7. High-Level Functions</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-intro"></a>33.17.1. Introduction</h3></div></div></div><p>This is the raw socket interface, as described in
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html"><<code class="filename">sys/socket.h</code>></a>.
Sockets are represented by their <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a>s.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
symbol <code class="constant">:RAWSOCK</code>.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="rawsock-use-sockets"></a>Try <code class="classname">SOCKET:SOCKET-STREAM</code> first!</h3><p>For most uses of sockets, the facilities described in
<a class="xref" href="#socket" title="32.4. Socket Streams">Section 32.4, “Socket Streams”</a> are adequate and much more convenient than these.
You are encouraged to consider <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s and ensure that they
are not adequate for your purposes before you use raw sockets.
</p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="rawsock-not-streams"></a>Do <span class="strong"><strong>not</strong></span> use <code class="function">EXT:MAKE-STREAM</code>!</h3><p>You can turn such a raw socket into a usual lisp <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>
using <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a>, but you should be <span class="emphasis"><em>extremely</em></span>
careful with such dubious actions!
See the <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>
<a class="ulink" href="http://sourceforge.net/mailarchive/message.php?msg_id=7203955" target="_top">mailing list archives</a> for more details.
Note that <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> will duplicate the <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_166">file descriptor</a> (using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html"><code class="function">dup</code></a>),
so you <span class="emphasis"><em>still</em></span> have to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_close.html" target="_top"><code class="function">CLOSE</code></a> the original raw socket.
</p></div><p>Test file <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/rawsock/test.tst"><code class="filename">modules/rawsock/test.tst</code></a>
and the demos in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/rawsock/demos/"><code class="filename">modules/rawsock/demos/</code></a>
contain plenty of examples.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-func"></a>33.17.2. Single System Call Functions</h3></div></div></div><p>We implement access to
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html"><code class="function">accept</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html"><code class="function">bind</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html"><code class="function">connect</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html"><code class="function">getaddrinfo</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
node service protocol socktype family passive canonname numerichost
numericserv v4mapped all addrconfig)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html"><code class="function">getnameinfo</code></a> <em class="replaceable"><code>address</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> nofqdn numerichost namereqd numericserv numericscope
dgram)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html"><code class="function">getpeername</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html"><code class="function">getsockname</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>address</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html"><code class="function">htonl</code></a> <em class="replaceable"><code>n</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html"><code class="function">htons</code></a> <em class="replaceable"><code>n</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html"><code class="function">ntohl</code></a> <em class="replaceable"><code>n</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohs.html"><code class="function">ntohs</code></a> <em class="replaceable"><code>n</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html"><code class="function">recv</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end peek oob waitall)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html"><code class="function">recvfrom</code></a> <em class="replaceable"><code>socket</code></em>
<em class="replaceable"><code>buffer</code></em> <em class="replaceable"><code>address</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end peek oob waitall)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html"><code class="function">recvmsg</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>message</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end peek oob waitall)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html"><code class="function">send</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end oob eor)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html"><code class="function">sendmsg</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>message</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end oob eor)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html"><code class="function">sendto</code></a>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <em class="replaceable"><code>address</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end oob eor)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/sockatmark.html"><code class="function">sockatmark</code></a>
<em class="replaceable"><code>socket</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html"><code class="function">socket</code></a> <em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>protocol</code></em>)</code></td></tr><tr><td><code class="code">(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html"><code class="function">socketpair</code></a> <em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>type</code></em> <em class="replaceable"><code>protocol</code></em>)</code></td></tr></table><p>using same-named lisp functions in package
<strong class="package"><span class="quote">“<span class="quote">RAWSOCK</span>”</span></strong>.
Additionally,</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="code">(<code class="function">RAWSOCK:SOCK-CLOSE</code> <em class="replaceable"><code>socket</code></em>)</code>
calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html"><code class="function">close</code></a>.</td></tr><tr><td><code class="code">(<code class="function">RAWSOCK:SOCK-LISTEN</code> <em class="replaceable"><code>socket</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (<em class="replaceable"><code>backlog</code></em> SOMAXCONN))</code>
calls <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html"><code class="function">listen</code></a>.</td></tr></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>When the OS does not provide <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html"><code class="function">socketpair</code></a>, it is emulated
using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html"><code class="function">socket</code></a> + <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html"><code class="function">connect</code></a> +
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html"><code class="function">accept</code></a>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-args"></a>33.17.3. Common arguments</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#rawsock-plat-dep-constants">33.17.3.1. Platform-dependent Keywords</a></span></dt></dl></div><div class="variablelist"><a id="rawsock-args-list"></a><dl class="variablelist"><dt><span class="term"><span class="type">void*</span> <em class="replaceable"><code>buffer</code></em></span></dt><dd>A <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>. The vector may be adjustable
and have a fill pointer. Whenever a function accepts a <em class="replaceable"><code>buffer</code></em>
argument, it also accepts <code class="constant">:START</code> and <code class="constant">:END</code> keyword arguments
with the usual meaning and defaults. You do not have to supply the
vector length because Lisp can determine it itself, but, if you want
to, you can use <code class="constant">:END</code> argument for that.
</dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>socket</code></em></span></dt><dd>An <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> (returned by <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html"><code class="function">socketpair</code></a> or
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html"><code class="function">socket</code></a>).</dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>family</code></em><br /></span><span class="term"><span class="type">int</span> <em class="replaceable"><code>domain</code></em></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (stands for <code class="constant">AF_UNSPEC</code>),
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>, or a platform-specific keyword, e.g.,
<code class="constant">:INET</code> stands for <code class="constant">AF_INET</code>.
</dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>type</code></em></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (stands for 0); <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>; or a
platform-specific keyword, e.g.,
<code class="constant">:DGRAM</code> stands for <code class="constant">SOCK_DGRAM</code>.
</dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>protocol</code></em></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> (stands for 0); <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>; a
platform-specific keyword, e.g., <code class="constant">:ETH_P_ARP</code> stands
for <code class="constant">ETH_P_ARP</code>, <code class="constant">:IPPROTO-ICMP</code>
stands for <code class="constant">IPPROTO_ICMP</code>; or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> (passed
to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotobyname.html"><code class="function">getprotobyname</code></a>).
</dd><dt><span class="term"><span class="type">int</span> <em class="replaceable"><code>flags</code></em></span></dt><dd>This <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> argument corresponds to keyword
arguments to the Lisp functions. E.g., <code class="function">rawsock:send</code>
accepts <code class="constant">:OOB</code> and <code class="constant">:EOR</code> arguments,
while <code class="function">rawsock:recv</code> accepts <code class="constant">:PEEK</code>,
<code class="constant">:OOB</code> and <code class="constant">:WAITALL</code>.
</dd><dt><span class="term"><span class="type">struct sockaddr</span> <em class="replaceable"><code>address</code></em></span></dt><dd>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> <span class="type">RAWSOCK:SOCKADDR</span>
returned by
<a class="link" href="#make-sockaddr"><code class="function">MAKE-SOCKADDR</code></a>.
</dd><dt><span class="term"><span class="type">struct msghdr</span> <em class="replaceable"><code>message</code></em></span></dt><dd><p>A <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a> <span class="type">RAWSOCK:MESSAGE</span>
with the following slots:
</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">addr</span></p></td><td>
a <a class="link" href="#make-sockaddr"><span class="type">SOCKADDR</span></a>.
</td></tr><tr><td><p><span class="term">iovec</span></p></td><td>
a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>)</code></span>
(<code class="constant">:START</code> and <code class="constant">:END</code> arguments are applied to this vector)
</td></tr><tr><td><p><span class="term">control</span></p></td><td>
a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span></td></tr><tr><td><p><span class="term">flags</span></p></td><td>
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a></td></tr></tbody></table></div></dd></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="rawsock-plat-dep-constants"></a>33.17.3.1. Platform-dependent Keywords</h4></div></div></div><p>One can extract the list of acceptable platform-dependent
keywords for, e.g., socket domain, using the following code:
</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a> ((<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_type-error.html" target="_top"><code class="classname">TYPE-ERROR</code></a>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_lambda.html" target="_top"><code class="function">LAMBDA</code></a> (c)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> "~&error: ~A~%" c)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_return.html" target="_top"><code class="function">RETURN</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDDR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_firstcm_s_inthcm_tenth.html" target="_top"><code class="function">THIRD</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_type-erro_xpected-type.html" target="_top"><code class="function">TYPE-ERROR-EXPECTED-TYPE</code></a> c)))))))
(rawsock:socket "bad" <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)))
</pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-return"></a>33.17.4. Return Values</h3></div></div></div><p>The return values of the functions described in section
<a class="xref" href="#rawsock-func" title="33.17.2. Single System Call Functions">Section 33.17.2, “Single System Call Functions”</a> are derived from the return values of
the underlying system call: if, say, the <em class="replaceable"><code>address</code></em> argument is modified
by the system call, two values are returned (in addition to the
possible values coming from the return value of the system call):
the (modified) <em class="replaceable"><code>address</code></em> structure and its new size.
If the system call fails, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-not-implemented"></a>33.17.5. Not Implemented</h3></div></div></div><p>We do not interface to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html"><code class="function">select</code></a> or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html"><code class="function">poll</code></a>
in this module, they are already available through <a class="link" href="#so-status"><code class="function">SOCKET:SOCKET-STATUS</code></a>.</p><p>We do not interface to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html"><code class="function">shutdown</code></a>
in this module, it is already available through <a class="link" href="#sost-shut"><code class="function">SOCKET:SOCKET-STREAM-SHUTDOWN</code></a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-errors"></a>33.17.6. Errors</h3></div></div></div><p>Errors in <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html"><code class="function">getaddrinfo</code></a>
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html"><code class="function">getnameinfo</code></a> are <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed
as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a>s of type <span class="type">RAWSOCK:EAI</span>
using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html"><code class="function">gai_strerror</code></a>.</p><p>Errors in other functions are reported as the usual OS errors
(using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html"><code class="function">strerror</code></a>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="rawsock-high-level"></a>33.17.7. High-Level Functions</h3></div></div></div><div class="variablelist"><a id="rawsock-high-level-list"></a><p class="title"><strong>Functions that do not
correspond to a single system call</strong></p><dl class="variablelist"><dt><a id="sock-read"></a><span class="term"><code class="code">(<code class="function">RAWSOCK:SOCK-READ</code>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end)</code><br /></span><span class="term"><code class="code">(<code class="function">RAWSOCK:SOCK-WRITE</code>
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end)</code></span></dt><dd><p class="simpara">Call one of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a>/<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html"><code class="function">readv</code></a>
or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html"><code class="function">write</code></a>/<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html"><code class="function">writev</code></a>
(depending on whether <em class="replaceable"><code>buffer</code></em> is a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> or
a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>)</code></span>).
Return the number of bytes read or written.</p><p class="simpara">When <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html"><code class="function">readv</code></a> and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html"><code class="function">writev</code></a> and not available, they are
emulated by repeated calls to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html"><code class="function">write</code></a>.</p><p class="simpara">On <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> we have to use <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html"><code class="function">recv</code></a>
instead of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html"><code class="function">send</code></a> instead of
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html"><code class="function">write</code></a> because <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html"><code class="function">read</code></a> and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html"><code class="function">write</code></a> do not work on sockets,
only on regular files.</p></dd><dt><a id="rawsock-protocol"></a><span class="term"><code class="code">(RAWSOCK:PROTOCOL
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>protocol</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotobyname.html"><code class="function">getprotobyname</code></a>
when <em class="replaceable"><code>protocol</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>,
or call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotobynumber.html"><code class="function">getprotobynumber</code></a> when
<em class="replaceable"><code>protocol</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.
Return a <span class="type">RAWSOCK:PROTOCOL</span> structure object.
When <em class="replaceable"><code>protocol</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of all known protocols using
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setprotoent.html"><code class="function">setprotoent</code></a>,
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getprotoent.html"><code class="function">getprotoent</code></a>, and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/endprotoent.html"><code class="function">endprotoent</code></a>.
</dd><dt><a id="rawsock-network"></a><span class="term"><code class="code">(RAWSOCK:NETWORK
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>network</code></em> <em class="replaceable"><code>type</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetbyname.html"><code class="function">getnetbyname</code></a>
when <em class="replaceable"><code>network</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>,
or call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetbyaddr.html"><code class="function">getnetbyaddr</code></a> when
<em class="replaceable"><code>network</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>.
Return a <span class="type">RAWSOCK:NETWORK</span> structure object.
When <em class="replaceable"><code>network</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of all known networks
using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setnetent.html"><code class="function">setnetent</code></a>,
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getnetent.html"><code class="function">getnetent</code></a>, and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/endnetent.html"><code class="function">endnetent</code></a>.
</dd><dt><a id="rawsock-if-name-index"></a><span class="term"><code class="code">(RAWSOCK:IF-NAME-INDEX
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>what</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nametoindex.html"><code class="function">if_nametoindex</code></a>
when <em class="replaceable"><code>what</code></em> is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and return an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>;
or call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_indextoname.html"><code class="function">if_indextoname</code></a> when
<em class="replaceable"><code>what</code></em> is an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> and return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>.
When <em class="replaceable"><code>what</code></em> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, return an <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_a.html#association_list">association list</a> of
pairs <span class="data"><code class="literal">(<em class="replaceable"><code>index</code></em> . <em class="replaceable"><code>name</code></em>)</code></span>
using <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/if_nameindex.html"><code class="function">if_nameindex</code></a>.
</dd><dt><a id="rawsock-ifaddrs"></a><span class="term"><code class="code">(RAWSOCK:IFADDRS
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :FLAGS-OR :FLAGS-AND)</code></span></dt><dd>Call <a class="bsd" href="http://www.freebsd.org/cgi/man.cgi?query=getifaddrs"><code class="function">getifaddrs</code></a>
and return a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> of <span class="type">ifaddrs</span> objects, optionally
filtered using flags, e.g., <code class="code">(ifaddrs :flags-or '(<em class="replaceable"><code>k</code></em> <em class="replaceable"><code>l</code></em>)
:flags-and '(<em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>))</code> will return a list of objects
which have <span class="strong"><strong>both</strong></span> flags <em class="replaceable"><code>m</code></em> <span class="strong"><strong>and</strong></span> <em class="replaceable"><code>n</code></em> <span class="strong"><strong>and</strong></span> at least one of
<em class="replaceable"><code>k</code></em> <span class="strong"><strong>or</strong></span> <em class="replaceable"><code>l</code></em> set.</dd><dt><a id="rawsock-sockopt"></a><span class="term"><code class="code">(RAWSOCK:SOCKET-OPTION
<em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>name</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :LEVEL)</code><br /></span><span class="term"><code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> (RAWSOCK:SOCKET-OPTION <em class="replaceable"><code>socket</code></em> <em class="replaceable"><code>name</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> :LEVEL) <em class="replaceable"><code>value</code></em>)</code></span></dt><dd>Call <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html"><code class="function">getsockopt</code></a>
and <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html"><code class="function">setsockopt</code></a>, returns and sets individual (for specific option
<em class="replaceable"><code>name</code></em> and <em class="replaceable"><code>level</code></em>) and multiple (when <em class="replaceable"><code>name</code></em>
is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and/or <em class="replaceable"><code>level</code></em> is <code class="constant">:ALL</code>) options.
(See also <a class="link" href="#so-opt"><code class="function">SOCKET:SOCKET-OPTIONS</code></a>.)</dd><dt><a id="rawsock-convert-address"></a><span class="term"><code class="code">(<a class="link" href="#rawsock-convert-address"><code class="function">RAWSOCK:CONVERT-ADDRESS</code></a>
<em class="replaceable"><code>family</code></em> <em class="replaceable"><code>address</code></em>)</code></span></dt><dd><p>Convert between <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a> and <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span> <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a>
<em class="replaceable"><code>address</code></em> representations using</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_addr.html"><code class="function">inet_addr</code></a></td><td><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html"><code class="function">inet_ntop</code></a></td></tr><tr><td><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntoa.html"><code class="function">inet_ntoa</code></a></td><td><a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_pton.html"><code class="function">inet_pton</code></a></td></tr></table><p>(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s are also accepted for backward
compatibility)</p></dd><dt><a id="make-sockaddr"></a><span class="term"><code class="code">(RAWSOCK:MAKE-SOCKADDR
<em class="replaceable"><code>family</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> <em class="replaceable"><code>data</code></em>)</code></span></dt><dd><p class="simpara">Create a <span class="type">sockaddr</span> object.
<em class="replaceable"><code>data</code></em> should be a sequence of <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8)</code></span> or an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>
(meaning <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-list.html" target="_top"><code class="function">MAKE-LIST</code></a> <em class="replaceable"><code>data</code></em> :initial-element 0)</code>).
When omitted, the standard platform-specific size is used.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>It is critical to use <em class="replaceable"><code>data</code></em> of the corrent size (usually
<code class="code">sizeof(struct sockaddr)</code>, but may be something depending
on the protocol to be used).</p></div></dd><dt><span class="term"><code class="code">(RAWSOCK:SOCKADDR-FAMILY <em class="replaceable"><code>address</code></em>)</code></span></dt><dd>Return the symbolic <em class="replaceable"><code>family</code></em> of the
<span class="type">sockaddr</span> object.</dd><dt><span class="term"><code class="code">(RAWSOCK:SOCKADDR-DATA <em class="replaceable"><code>address</code></em>)</code></span></dt><dd><p class="simpara">Return a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_f.html#fresh">fresh</a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> displaced to the
<em class="structfield"><code>data</code></em> field of the
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> <span class="type">struct sockaddr</span> object.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Modifying this <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>'s content will modify the
<em class="replaceable"><code>address</code></em> argument data!</p></div></dd><dt><a id="rawsock-unix-socket"></a><span class="term"><code class="code">(RAWSOCK:OPEN-UNIX-SOCKET
<em class="replaceable"><code>pathname</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> (<em class="replaceable"><code>type</code></em> <code class="constant">:STREAM</code>))</code></span></dt><dd>Open a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> socket special file.
Returns two values: <em class="replaceable"><code>socket</code></em> and <em class="replaceable"><code>address</code></em>.
</dd><dt><span class="term"><code class="code">(RAWSOCK:OPEN-UNIX-SOCKET-STREAM <em class="replaceable"><code>pathname</code></em>
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> <em class="replaceable"><code>options</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> (<em class="replaceable"><code>type</code></em> <code class="constant">:STREAM</code>)
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>)</code></span></dt><dd>Open a <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> socket special file.
Returns two values: <em class="replaceable"><code>stream</code></em> and <em class="replaceable"><code>address</code></em>. <em class="replaceable"><code>type</code></em> is passed
to <code class="function">RAWSOCK:OPEN-UNIX-SOCKET</code>, other <em class="replaceable"><code>options</code></em>
to <a class="link" href="#make-stream" title="21.9. Function EXT:MAKE-STREAM"><code class="function">EXT:MAKE-STREAM</code></a> (but see <a class="xref" href="#rawsock-not-streams" title="Do not use EXT:MAKE-STREAM!">Do <span class="strong"><strong>not</strong></span> use <code class="function">EXT:MAKE-STREAM</code>!</a>).
</dd><dt><span class="term"><code class="code">(RAWSOCK:IPCSUM <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end)</code>
- <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a><br /></span><span class="term"><code class="code">(RAWSOCK:ICMPCSUM <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end)</code>
- <a class="rfc" href="http://www.ietf.org/rfc/rfc792.txt"><code><span class="command"><strong>ICMP</strong></span></code></a><br /></span><span class="term"><code class="code">(RAWSOCK:TCPCSUM <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end)</code>
- <a class="rfc" href="http://www.ietf.org/rfc/rfc793.txt"><code><span class="command"><strong>TCP</strong></span></code></a><br /></span><span class="term"><code class="code">(RAWSOCK:UDPCSUM <em class="replaceable"><code>buffer</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> start end)</code>
- <a class="rfc" href="http://www.ietf.org/rfc/rfc768.txt"><code><span class="command"><strong>UDP</strong></span></code></a></span></dt><dd><p class="simpara">Compute the appropriate protocol checksum and record
it in the appropriate location. <em class="replaceable"><code>buffer</code></em> is assumed to be a suitable
ethernet frame for the protocol, with the appropriate header etc.</p><p class="simpara">Note that <em class="replaceable"><code>buffer</code></em> is an <span class="emphasis"><em>ethernet frame</em></span>,
starting with 6 bytes of the destination MAC address, 6 bytes of the
source MAC address, and 2 bytes specifying the next level protocol,
(e.g., <code class="literal">#x0800</code> for <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> and <code class="literal">#x0806</code>
for <a class="rfc" href="http://www.ietf.org/rfc/rfc826.txt"><code><span class="command"><strong>ARP</strong></span></code></a>), i.e., the first 14 bytes of <em class="replaceable"><code>buffer</code></em> are ignored by these
functions.</p><p class="simpara">A typical packet you send is both <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> and <a class="rfc" href="http://www.ietf.org/rfc/rfc793.txt"><code><span class="command"><strong>TCP</strong></span></code></a> and thus
has two checksums, so you would want to call <span class="emphasis"><em>two</em></span>
functions.</p></dd><dt><span class="term"><code class="code">(RAWSOCK:CONFIGDEV <em class="replaceable"><code>socket</code></em>
<em class="replaceable"><code>ifname</code></em> <em class="replaceable"><code>address</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>
<em class="replaceable"><code>promisc</code></em>
<em class="replaceable"><code>noarp</code></em>)</code></span></dt><dd>Set some socket options and <a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> <em class="replaceable"><code>address</code></em>
with <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/ioctl.html"><code class="function">ioctl</code></a>.
</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="fastcgi"></a>33.18. The <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#fcgi-overview">33.18.1. Overview of FastCGI</a></span></dt><dt><span class="section"><a href="#fcgi-functionality">33.18.2. Functions in Package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong></a></span></dt><dt><span class="section"><a href="#fcgi-example">33.18.3. FastCGI Example</a></span></dt><dt><span class="section"><a href="#fcgi-build">33.18.4. Building and configuring the FastCGI Interface</a></span></dt></dl></div><p>
The <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> module speeds up <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> CGI
scripts launched by a Web server. Working with a
<a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>-enabled Web server such as <a class="ulink" href="http://www.apache.org/" target="_top">Apache</a> with
<a class="ulink" href="https://httpd.apache.org/mod_fcgid/" target="_top">mod_fastcgi</a>, a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> program using the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>
protocol will run many times faster than a conventional CGI program.
The performance improvements stem from the fact that the script's
process remains running across <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requests, eliminating startup
overhead and allowing for caching of data structures and other resources. This
is the same approach used is in other languages (e.g., <a class="ulink" href="http://perl.apache.org" target="_top">mod_perl</a> for Perl). </p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a> contains the
symbol <code class="constant">:FASTCGI</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fcgi-overview"></a>33.18.1. Overview of <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a></h3></div></div></div><p>
Traditional CGI programs work by doing input/output with the Web
server via the following channels:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
Examining environment variables; e.g., <code class="envar">HTTP_USER_AGENT</code> is the
variable set by the Web server to name the browser used
</li><li class="listitem">
Reading from standard input. E.g., to get input data in a "method=POST" request
</li><li class="listitem">
Writing an <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> response document (usually "Content-type:
text/html") to the standard output, for eventual transmission
back to the browser client
</li><li class="listitem">
Writing error messages to the standard error, usually captured
by the Web server and logged in its log files.
</li></ol></div><p>
</p><p>
<a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> involves replacing calls the standard routines to do
the above with calls in the <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong> package. These calls will then
work exactly as before when the program is invoked as a CGI, but will
also work when invoked by a <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>-enabled Web server.
</p><p>
<a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> programs persist across <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requests, and thus incur
startup overhead costs only once. For Lisp Web programs, this overhead
can be substantial: code must be
compiled and loaded, files and databases must be opened, etc. Further,
because the program stays running from <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> request to <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> request,
it can cache information in memory such as database connections
or large in-memory data structures.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fcgi-functionality"></a>33.18.2. Functions in Package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong></h3></div></div></div><p>Access to
<a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> is via these functions in package <strong class="package"><span class="quote">“<span class="quote">FASTCGI</span>”</span></strong>.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(FASTCGI:IS-CGI)</code></span></dt><dd>
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> program has been launched as a traditional
CGI rather than in <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>. In traditional CGI, program I/O is
via operating system environment variables and standard file streams.
Under <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>, I/O is done directly with the Web server via
the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> protocol.
</dd><dt><span class="term">
<code class="code">(FASTCGI:ACCEPT)</code> <em class="replaceable"><code>cgi-forms</code></em>
<code class="code">(FASTCGI:FINISH)</code>
</span></dt><dd><p class="simpara">
In <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> mode, the program loops,
<code class="function">ACCEPT</code>ing to begin the execution of an <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a>
request, and <code class="function">FINISH</code>ing to signal that the script
is finished writing its response to the <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> request. <code class="function">ACCEPT</code>
blocks until the next <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> request comes in, returning <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> if there is
a new request to handle, and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if no more <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requests will
occur, usually because the Web server itself has terminated, in which
case the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> server loop should also exit.
</p><p>
A typical <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> top-level server loop looks like:
</p><pre class="programlisting">
(do ()
((not (fastcgi:accept)))
(run-my-script)
(fastcgi:finish))
</pre><p>
</p></dd><dt><span class="term"><code class="code">(FASTCGI:GETENV
<em class="replaceable"><code>varname</code></em>)</code></span></dt><dd>
Use in place of <a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a> to get the value of the environment variable
named <em class="replaceable"><code>varname</code></em>, which should be a string.
Unlike <a class="link" href="#getenv" title="32.8. Operating System Environment"><code class="function">EXT:GETENV</code></a>, which accesses the actual host operating system environment,
<code class="function">FASTCGI:GETENV</code> obtains its environment via
the Web server, over its FastCGI communications channel.
For more information, see the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> Web site.
Returns <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> if <em class="replaceable"><code>varname</code></em> is not defined in
the operating system environment. See <a class="ulink" href="http://www.cgi101.com/class/ch3/text.html" target="_top">here</a> for a
list of useful variables. You must first have called
<code class="function">ACCEPT</code> and not yet have called
<code class="function">FINISH</code>. </dd><dt><span class="term"><code class="code">(FASTCGI:WRITE-STDOUT
<em class="replaceable"><code>string</code></em>)</code></span></dt><dd>
Use in place of standard Lisp calls which print to standard output
(i.e., as part of the <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> response).
You must first have called <code class="function">ACCEPT</code> and not yet have
called <code class="function">FINISH</code>.
</dd><dt><span class="term"><code class="code">(FASTCGI:WRITE-STDERR
<em class="replaceable"><code>string</code></em>)</code></span></dt><dd>
Use in place of standard Lisp calls which print to
standard error. Rather than being part of
the <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> response, data written to standard error are usually
collected by the Web server in its error log. This is useful
for diagnostic purposes.
</dd><dt><span class="term"><code class="code">(FASTCGI:SLURP-STDIN)</code></span></dt><dd>
Reads in the entirety of standard input and returns it as a string.
This is usually done for <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> requests with
<code class="literal">METHOD="post"</code>, when the data are passed to the CGI
script via standard input rather than via the environment variable
<code class="envar">QUERY_STRING</code>. There is no way to read standard input
in pieces, which could be a problem, say, for <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> uploads of very large files.
</dd><dt><span class="term"><code class="code">(FASTCGI:OUT
<em class="replaceable"><code>tree</code></em>)</code></span></dt><dd>
Like <code class="function">WRITE-STDOUT</code>, except that
<em class="replaceable"><code>tree</code></em>
may be an arbitrarily nested list structure containing (at the leaves)
numbers and strings. For example,
<code class="literal">(FASTCGI:OUT '("foo" (" " 10 " " 20)))</code>
will write the string <code class="literal">"foo 10 20"</code>. This function
is useful when building strings in memory for display.
</dd></dl></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fcgi-example"></a>33.18.3. <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> Example</h3></div></div></div><p>
Below is a simple example CGI script using <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>.
</p><pre class="programlisting">
#!/usr/local/bin/clisp -q -K full
(do ((count 1 (1+ count)))
((not (fastcgi:accept)) nil)
(fastcgi:out "Content-type: text/plain" #\Newline #\Newline)
(fastcgi:out
"I am running in mode: " (if (fastcgi:is-cgi) "CGI" "FastCGI") #\Newline
"This is execution no.: " count #\Newline
"The browser string is '" (fastcgi:getenv "HTTP_USER_AGENT") "'" #\Newline)
(fastcgi:finish))
</pre><p>
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="fcgi-build"></a>33.18.4. Building and configuring the
<a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> Interface</h3></div></div></div><p>
It is necessary to download the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> developers' kit, build it,
and install it, before building <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> with <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a> support.
You also need to upgrade your Web server to speak the <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>
protocol. For <a class="ulink" href="http://www.apache.org/" target="_top">Apache</a> this means building in <a class="ulink" href="https://httpd.apache.org/mod_fcgid/" target="_top">mod_fastcgi</a>, either statically
or dynamically, and then adding a line to your <a class="ulink" href="http://www.apache.org/" target="_top">Apache</a> config like:
</p><pre class="programlisting">
Addhandler fastcgi-script .fcgi
</pre><p>
After that, you can convert <code class="filename">foo.cgi</code> by linking it
to a script names <code class="filename">foo.fcgi</code>. Since a <a class="ulink" href="https://fastcgi-archives.github.io/" target="_top">FastCGI</a>
script is also a valid CGI script, it can be run unmodified in either
mode.
</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="dbus"></a>33.19. Interface to D-Bus</h2></div></div></div><p>This is an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to the <a class="ulink" href="http://www.freedesktop.org/wiki/Software/dbus" target="_top">D-Bus</a> message bus
system, a simple way for applications to talk to one another.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">DBUS</span>”</span></strong> is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>,
e.g., you would write <code class="code">(dbus:dbus_error_init ...)</code>
when you need to call the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function
<code class="function">dbus_error_init</code>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:D-BUS</code>.</p><p>All public <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions are available as <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><code class="classname">FFI:FOREIGN-FUNCTION</code></a>s,
defined in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/dbus/dbus.lisp"><code class="filename">modules/dbus/dbus.lisp</code></a>.</p><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/dbus/test.tst"><code class="filename">modules/dbus/test.tst</code></a>
for sample usage.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gtk"></a>33.20. GTK Interface</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gtk-hi">33.20.1. High-level functions</a></span></dt></dl></div><p>This is an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>-based interface to <a class="ulink" href="http://www.gtk.org" target="_top">GTK+</a> version 2.</p><p>The package <strong class="package"><span class="quote">“<span class="quote">GTK</span>”</span></strong>
is <a class="link" href="#package-case" title="11.5. Package Case-Sensitivity"><code class="constant">:CASE-SENSITIVE</code></a>.</p><p>When this module is present, <a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>
contains the symbol <code class="constant">:GTK</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gtk-hi"></a>33.20.1. High-level functions</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">(glade-load <em class="replaceable"><code>filename</code></em>)</code></span></dt><dd>Load and connect the UI described in the
<a class="ulink" href="http://glade.gnome.org/" target="_top">Glade</a>-generated file <em class="replaceable"><code>filename</code></em>.</dd><dt><span class="term"><code class="code">(run-glade-file <em class="replaceable"><code>filename</code></em> <em class="replaceable"><code>name</code></em>)</code></span></dt><dd>Run the widget <em class="replaceable"><code>name</code></em> described in the
<a class="ulink" href="http://glade.gnome.org/" target="_top">Glade</a>-generated file <em class="replaceable"><code>filename</code></em>.</dd><dt><span class="term"><code class="code">(gui <em class="replaceable"><code>filename</code></em>)</code></span></dt><dd>Run the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> demo GUI described in the
<a class="ulink" href="http://glade.gnome.org/" target="_top">Glade</a>-generated file <em class="replaceable"><code>filename</code></em>, normally a variation
of <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/gtk2/ui.glade"><code class="filename">modules/gtk2/ui.glade</code></a>.
</dd></dl></div></div></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="internals"></a>Part IV. Internals of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> Implementation</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="chapter"><a href="#source-files">34. The source files of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#src-file-types">34.1. File Types</a></span></dt><dt><span class="section"><a href="#src-preprocessing">34.2. Source Pre-Processing</a></span></dt><dt><span class="section"><a href="#src-files">34.3. Files</a></span></dt><dd><dl><dt><span class="section"><a href="#src-unpreproc-C">34.3.1. Unpreprocessed <span class="command"><strong>C</strong></span> code</a></span></dt><dt><span class="section"><a href="#src-asm-misc">34.3.2. Other assembly language stuff</a></span></dt><dt><span class="section"><a href="#src-lisp">34.3.3. Lisp source files</a></span></dt><dt><span class="section"><a href="#src-ext-mod">34.3.4. External Modules</a></span></dt><dt><span class="section"><a href="#src-doc">34.3.5. Documentation</a></span></dt><dt><span class="section"><a href="#src-i18n">34.3.6. Internationalization</a></span></dt><dt><span class="section"><a href="#src-conf-unix">34.3.7. Automatic configuration on <span class="strong"><strong>UNIX</strong></span> and <span class="platform">MinGW</span></a></span></dt><dt><span class="section"><a href="#src-external">34.3.8. Externally maintained files</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#gc">35. Overview of <span class="command"><strong>CLISP</strong></span>'s Garbage Collection</a></span></dt><dd><dl><dt><span class="section"><a href="#internals-intro">35.1. Introduction</a></span></dt><dt><span class="section"><a href="#lisp-obj-in-c">35.2. Lisp objects in <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#typecodes">35.3. Object Pointer Representations</a></span></dt><dt><span class="section"><a href="#memory-models">35.4. Memory Models</a></span></dt><dt><span class="section"><a href="#gc-safety">35.5. The burden of garbage-collection upon the rest of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#gc-moves-data">35.5.1. Lisp <span class="type">object</span> invalidation</a></span></dt><dt><span class="section"><a href="#gc-lisp-in-C">35.5.2. Managing Lisp <span class="type">object</span>s in <span class="command"><strong>C</strong></span></a></span></dt><dt><span class="section"><a href="#gc-alloccount">35.5.3. Run-time GC-safety checks</a></span></dt><dt><span class="section"><a href="#gc-mem-prot">35.5.4. Memory protection</a></span></dt></dl></dd><dt><span class="section"><a href="#foreign-pointers">35.6. Foreign Pointers</a></span></dt><dt><span class="section"><a href="#nextgc-factor">35.7. Forcing or inhibiting Garbage Collections</a></span></dt><dt><span class="section"><a href="#gc-mt">35.8. Garbage Collection and Multithreading</a></span></dt></dl></dd><dt><span class="chapter"><a href="#extend">36. Extending <span class="command"><strong>CLISP</strong></span> Core</a></span></dt><dd><dl><dt><span class="section"><a href="#add-fun">36.1. Adding a built-in function</a></span></dt><dt><span class="section"><a href="#add-var">36.2. Adding a built-in variable</a></span></dt><dt><span class="section"><a href="#recompile">36.3. Recompilation</a></span></dt></dl></dd><dt><span class="chapter"><a href="#bytecode">37. The <span class="command"><strong>CLISP</strong></span> bytecode specification</a></span></dt><dd><dl><dt><span class="section"><a href="#byte-intro">37.1. Introduction</a></span></dt><dt><span class="section"><a href="#vm">37.2. The virtual machine</a></span></dt><dt><span class="section"><a href="#comp-fun">37.3. The structure of compiled functions</a></span></dt><dt><span class="section"><a href="#instr-struct">37.4. The general structure of the instructions</a></span></dt><dt><span class="section"><a href="#instr-set">37.5. The instruction set</a></span></dt><dd><dl><dt><span class="section"><a href="#instr-const">37.5.1. Instructions for constants</a></span></dt><dt><span class="section"><a href="#instr-lex-var">37.5.2. Instructions for lexical variables</a></span></dt><dt><span class="section"><a href="#instr-dyn-var">37.5.3. Instructions for dynamic variables</a></span></dt><dt><span class="section"><a href="#instr-stack">37.5.4. Instructions for stack operations</a></span></dt><dt><span class="section"><a href="#instr-jump">37.5.5. Instructions for control flow, jumps</a></span></dt><dt><span class="section"><a href="#instr-env">37.5.6. Instructions for lexical environment, creation of closures</a></span></dt><dt><span class="section"><a href="#instr-funcall">37.5.7. Instructions for function calls</a></span></dt><dt><span class="section"><a href="#instr-optkey">37.5.8. Instructions for optional and keyword parameters</a></span></dt><dt><span class="section"><a href="#instr-mulval">37.5.9. Instructions for multiple values</a></span></dt><dt><span class="section"><a href="#instr-block">37.5.10. Instructions for <code class="function">BLOCK</code> and <code class="function">RETURN-FROM</code></a></span></dt><dt><span class="section"><a href="#instr-tagbody">37.5.11. Instructions for <code class="function">TAGBODY</code> and <code class="function">GO</code></a></span></dt><dt><span class="section"><a href="#instr-catch">37.5.12. Instructions for <code class="function">CATCH</code> and <code class="function">THROW</code></a></span></dt><dt><span class="section"><a href="#instr-unwind">37.5.13. Instructions for <code class="function">UNWIND-PROTECT</code></a></span></dt><dt><span class="section"><a href="#instr-handler">37.5.14. Instructions for <code class="function">HANDLER-BIND</code></a></span></dt><dt><span class="section"><a href="#instr-inline">37.5.15. Instructions for some inlined functions</a></span></dt><dt><span class="section"><a href="#instr-combo">37.5.16. Combined instructions</a></span></dt><dt><span class="section"><a href="#instr-shortcut">37.5.17. Shortcut instructions</a></span></dt></dl></dd><dt><span class="section"><a href="#compiler-introspection">37.6. Examining compiled closures</a></span></dt><dt><span class="section"><a href="#bytecode-design">37.7. Bytecode Design</a></span></dt><dd><dl><dt><span class="section"><a href="#byte-when-add-q">37.7.1. When to add a new bytecode?</a></span></dt><dt><span class="section"><a href="#byte-jmptail-q">37.7.2. Why JMPTAIL?</a></span></dt></dl></dd></dl></dd></dl></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="source-files"></a>Chapter 34. The source files of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#src-file-types">34.1. File Types</a></span></dt><dt><span class="section"><a href="#src-preprocessing">34.2. Source Pre-Processing</a></span></dt><dt><span class="section"><a href="#src-files">34.3. Files</a></span></dt><dd><dl><dt><span class="section"><a href="#src-unpreproc-C">34.3.1. Unpreprocessed <span class="command"><strong>C</strong></span> code</a></span></dt><dd><dl><dt><span class="section"><a href="#src-includes">34.3.1.1. Includes</a></span></dt><dt><span class="section"><a href="#src-modules">34.3.1.2. Internal <span class="command"><strong>C</strong></span> Modules</a></span></dt><dt><span class="section"><a href="#src-arith">34.3.1.3. Number system (arithmetic)</a></span></dt><dt><span class="section"><a href="#src-asm-sp">34.3.1.4. External routines for accessing the stack, written in assembly language</a></span></dt></dl></dd><dt><span class="section"><a href="#src-asm-misc">34.3.2. Other assembly language stuff</a></span></dt><dt><span class="section"><a href="#src-lisp">34.3.3. Lisp source files</a></span></dt><dt><span class="section"><a href="#src-ext-mod">34.3.4. External Modules</a></span></dt><dt><span class="section"><a href="#src-doc">34.3.5. Documentation</a></span></dt><dt><span class="section"><a href="#src-i18n">34.3.6. Internationalization</a></span></dt><dt><span class="section"><a href="#src-conf-unix">34.3.7. Automatic configuration on <span class="strong"><strong>UNIX</strong></span> and <span class="platform">MinGW</span></a></span></dt><dt><span class="section"><a href="#src-external">34.3.8. Externally maintained files</a></span></dt></dl></dd></dl></div><p>For files in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> binary distributions,
see <a href="clisp.html#files" class="olink">the section called “Files”</a>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="src-file-types"></a>34.1. File Types</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">#P"*.d"</code></span></dt><dd>The source files for unpreprocessed <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code.
</dd><dt><span class="term"><code class="filename">#P".c"</code></span></dt><dd>The <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code after
<a class="link" href="#src-preprocessing" title="34.2. Source Pre-Processing">preprocessing</a>;
also the result of compiling some <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> forms (see <a class="link" href="#ffi-extern-output"><code class="varname">FFI:*OUTPUT-C-FUNCTIONS*</code></a>).
</dd><dt><span class="term"><code class="filename">#P".lisp"</code></span></dt><dd>The source files for Lisp code.
</dd><dt><span class="term"><code class="filename">#P"*.fas"</code></span></dt><dd>Compiled lisp code (platform-independent <a href="impnotes.html#bytecode" class="olink">bytecode</a>s).
</dd><dt><span class="term"><a class="link" href="#lib-files" title="24.3.4. Interaction with COMPILE-FILE"><code class="filename">#P".lib"</code></a></span></dt><dd>Lisp <span class="quote">“<span class="quote">header</span>”</span>, produced by
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_compile-file.html" target="_top"><code class="function">COMPILE-FILE</code></a> and used by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_providecm_require.html" target="_top"><code class="function">REQUIRE</code></a></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="src-preprocessing"></a>34.2. Source Pre-Processing</h2></div></div></div><p><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> sources are pre-processed with the following tools
before being passed to the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> compiler:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/comment5.c"><code class="filename">utils/comment5.c</code></a></span></dt><dd><p class="simpara">Convert <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>-style comments (lines starting
with <code class="literal">"# "</code>) to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>-style comments
(<code class="literal">/**/</code>).</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>The use of <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html"><span class="command"><strong>/bin/sh</strong></span></a>-style comments is deprecated.</p></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/varbrace.c"><code class="filename">utils/varbrace.c</code></a></span></dt><dd>Add braces to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> source code, so that variable
declarations (introduced with the pseudo-keyword <code class="literal">var</code>)
can be used within blocks, like in <span class="command"><strong>C++</strong></span>
and <span class="command"><strong>C99</strong></span>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/ccpaux.c"><code class="filename">utils/ccpaux.c</code></a></span></dt><dd>When <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> cannot handle indented directives, remove
the indentation.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/gctrigger.c"><code class="filename">utils/gctrigger.c</code></a></span></dt><dd>Add <code class="function">GCTRIGGER</code> statements at the
head of function bodies (for functions marked with
the <code class="literal">maygc</code> pseudo-keyword).
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/deema.c"><code class="filename">utils/deema.c</code></a></span></dt><dd>When <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> cannot handle empty macro arguments,
insert <code class="literal">_EMA_</code> instead.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/ccmp2c.c"><code class="filename">utils/ccmp2c.c</code></a></span></dt><dd>For the <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> module only.
Allows <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a>-style preprocessing <span class="strong"><strong>before</strong></span> <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> processing.
Should be merged into <a class="link" href="#modprep-file"><span class="command"><strong>modprep</strong></span></a> eventually.
</dd><dt><a id="modprep-file"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/modprep.lisp"><code class="filename">utils/modprep.lisp</code></a></span></dt><dd>For some modules only, see <a class="xref" href="#modprep" title="32.2.7.1. Modprep">Section 32.2.7.1, “Modprep”</a>.
</dd><dt><a id="utils-unicode"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/unicode/"><code class="filename">utils/unicode/</code></a></span></dt><dd><p>Generate NLS files in
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/"><code class="filename">src/</code></a>.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/utils/unicode/UnicodeDataFull.txt"><code class="filename">utils/unicode/UnicodeDataFull.txt</code></a>
</span></dt><dd>Character descriptions from <a class="ulink" href="http://www.unicode.org" target="_top">Unicode</a> <a class="ulink" href="http://www.unicode.org/unicode/reports/tr28/" target="_top">3.2</a>;
used by <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a> and installed in <code class="filename">data/</code>
under <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>.</dd></dl></div></dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="src-files"></a>34.3. Files</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#src-unpreproc-C">34.3.1. Unpreprocessed <span class="command"><strong>C</strong></span> code</a></span></dt><dd><dl><dt><span class="section"><a href="#src-includes">34.3.1.1. Includes</a></span></dt><dt><span class="section"><a href="#src-modules">34.3.1.2. Internal <span class="command"><strong>C</strong></span> Modules</a></span></dt><dt><span class="section"><a href="#src-arith">34.3.1.3. Number system (arithmetic)</a></span></dt><dd><dl><dt><span class="section"><a href="#src-ari-asm">34.3.1.3.1. External routines for the arithmetic system, written in assembly language</a></span></dt></dl></dd><dt><span class="section"><a href="#src-asm-sp">34.3.1.4. External routines for accessing the stack, written in assembly language</a></span></dt></dl></dd><dt><span class="section"><a href="#src-asm-misc">34.3.2. Other assembly language stuff</a></span></dt><dt><span class="section"><a href="#src-lisp">34.3.3. Lisp source files</a></span></dt><dt><span class="section"><a href="#src-ext-mod">34.3.4. External Modules</a></span></dt><dt><span class="section"><a href="#src-doc">34.3.5. Documentation</a></span></dt><dt><span class="section"><a href="#src-i18n">34.3.6. Internationalization</a></span></dt><dt><span class="section"><a href="#src-conf-unix">34.3.7. Automatic configuration on <span class="strong"><strong>UNIX</strong></span> and <span class="platform">MinGW</span></a></span></dt><dt><span class="section"><a href="#src-external">34.3.8. Externally maintained files</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-unpreproc-C"></a>34.3.1. Unpreprocessed <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code</h3></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#src-includes">34.3.1.1. Includes</a></span></dt><dt><span class="section"><a href="#src-modules">34.3.1.2. Internal <span class="command"><strong>C</strong></span> Modules</a></span></dt><dt><span class="section"><a href="#src-arith">34.3.1.3. Number system (arithmetic)</a></span></dt><dd><dl><dt><span class="section"><a href="#src-ari-asm">34.3.1.3.1. External routines for the arithmetic system, written in assembly language</a></span></dt></dl></dd><dt><span class="section"><a href="#src-asm-sp">34.3.1.4. External routines for accessing the stack, written in assembly language</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="src-includes"></a>34.3.1.1. Includes</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/lispbibl.d"><code class="filename">src/lispbibl.d</code></a></span></dt><dd>main include file</dd><dt><a id="fsubr-d"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/fsubr.d"><code class="filename">src/fsubr.d</code></a></span></dt><dd>list of all built-in special forms
</dd><dt><a id="subr-d"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/subr.d"><code class="filename">src/subr.d</code></a></span></dt><dd>list of all built-in functions
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/pseudofun.d"><code class="filename">src/pseudofun.d</code></a></span></dt><dd>list of all <span class="quote">“<span class="quote">pseudo functions</span>”</span>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/constpack.d"><code class="filename">src/constpack.d</code></a></span></dt><dd>list of packages accessed by <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code
</dd><dt><a id="constsym-d"></a><span class="term">
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/constsym.d"><code class="filename">src/constsym.d</code></a></span></dt><dd>list of symbols accessed by <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code
</dd><dt><a id="constobj-d"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/constobj.d"><code class="filename">src/constobj.d</code></a></span></dt><dd>list of miscellaneous objects accessed by <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/unix.d"><code class="filename">src/unix.d</code></a></span></dt><dd>include file for the <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> implementations
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/win32.d"><code class="filename">src/win32.d</code></a></span></dt><dd>include file for the <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> based versions
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/xthread.d"><code class="filename">src/xthread.d</code></a></span></dt><dd>include file for thread support
</dd><dt><span class="term"><code class="filename">build/modules.h</code></span></dt><dd>list of foreign <a href="impnotes.html#modules" class="olink">module</a>s, generated at build time
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="src-modules"></a>34.3.1.2. Internal <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> Modules</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="spvw-d"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spvw.d"><code class="filename">src/spvw.d</code></a></span></dt><dd><p>Memory management (<a href="impnotes.html#gc" class="olink">garbage-collect</a>ion), startup; some OS interface.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/avl.d"><code class="filename">src/avl.d</code></a></span></dt><dd>An implementation of AVL (Adelson-Velskii and
Landis) trees.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/sort.d"><code class="filename">src/sort.d</code></a></span></dt><dd>A sorting routine.</dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spvwtabf.d"><code class="filename">src/spvwtabf.d</code></a></span></dt><dd>The table of built-in special operators and functions.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spvwtabs.d"><code class="filename">src/spvwtabs.d</code></a></span></dt><dd>The table of all <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s accessed by <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spvwtabo.d"><code class="filename">src/spvwtabo.d</code></a></span></dt><dd>The table of miscellaneous objects accessed by
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> code.</dd><dt><a id="eval-d"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/eval.d"><code class="filename">src/eval.d</code></a></span></dt><dd><p>Evaluator (form interpreter) and <a href="impnotes.html#bytecode" class="olink">bytecode</a> interpreter.
</p><div class="variablelist"><dl class="variablelist"><dt><a id="bytecode-d"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/bytecode.d"><code class="filename">src/bytecode.d</code></a></span></dt><dd>List of <a href="impnotes.html#bytecode" class="olink">bytecode</a>s.</dd><dt><a id="lightning-c"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/lightning.c"><code class="filename">src/lightning.c</code></a></span></dt><dd>Just-in-time compiler using <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/lightning/" target="_top">lightning</a>.</dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/control.d"><code class="filename">src/control.d</code></a></span></dt><dd>Special operator interpreter.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/pathname.d"><code class="filename">src/pathname.d</code></a></span></dt><dd>Pathnames, file- and directory-related functions.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/stream.d"><code class="filename">src/stream.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s of all kinds: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_file-stream.html" target="_top"><code class="classname">FILE-STREAM</code></a>s,
<a class="link" href="#terminal" title="21.2. Terminal interaction">terminal</a> streams, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string-stream.html" target="_top"><code class="classname">STRING-STREAM</code></a>s
etc.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/socket.d"><code class="filename">src/socket.d</code></a></span></dt><dd>Opening <a class="link" href="#socket" title="32.4. Socket Streams">socket</a>s for <a class="rfc" href="http://www.ietf.org/rfc/rfc793.txt"><code><span class="command"><strong>TCP</strong></span></code></a>/<a class="rfc" href="http://www.ietf.org/rfc/rfc791.txt"><code><span class="command"><strong>IP</strong></span></code></a> and <a class="ulink" href="http://www.cliki.net/CLX" target="_top"><span class="command"><strong>CLX</strong></span></a>.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/io.d"><code class="filename">src/io.d</code></a></span></dt><dd>The lisp reader (parser) and printer (including
pretty printer).</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/array.d"><code class="filename">src/array.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_array.html" target="_top"><code class="classname">ARRAY</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/hashtabl.d"><code class="filename">src/hashtabl.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_hash-table.html" target="_top"><code class="classname">HASH-TABLE</code></a>s.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/list.d"><code class="filename">src/list.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>s.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/package.d"><code class="filename">src/package.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_package.html" target="_top"><code class="classname">PACKAGE</code></a>s.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/record.d"><code class="filename">src/record.d</code></a></span></dt><dd>Functions dealing with records (structures, closures, etc.)
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/sequence.d"><code class="filename">src/sequence.d</code></a></span></dt><dd>The generic <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_sequence.html" target="_top"><code class="classname">SEQUENCE</code></a> functions.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/funarg.d"><code class="filename">src/funarg.d</code></a></span></dt><dd>Functional arguments, like <code class="constant">:TEST</code> and <code class="constant">:KEY</code>.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/charstrg.d"><code class="filename">src/charstrg.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>s.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/debug.d"><code class="filename">src/debug.d</code></a></span></dt><dd>The <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> and the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/error.d"><code class="filename">src/error.d</code></a></span></dt><dd><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> handling and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ing.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/errunix.d"><code class="filename">src/errunix.d</code></a></span></dt><dd><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>-specific error messages.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/errwin32.d"><code class="filename">src/errwin32.d</code></a></span></dt><dd><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>-specific error messages.
</dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/misc.d"><code class="filename">src/misc.d</code></a></span></dt><dd>Miscellaneous functions.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/time.d"><code class="filename">src/time.d</code></a></span></dt><dd>Timing functions.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/predtype.d"><code class="filename">src/predtype.d</code></a></span></dt><dd>Predicates, type tests.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/symbol.d"><code class="filename">src/symbol.d</code></a></span></dt><dd>Functions dealing with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_symbol.html" target="_top"><code class="classname">SYMBOL</code></a>s.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/unixaux.d"><code class="filename">src/unixaux.d</code></a></span></dt><dd>Auxiliary functions (<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> version only).
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/win32aux.d"><code class="filename">src/win32aux.d</code></a></span></dt><dd>Auxiliary functions (<a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> version only).
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/foreign.d"><code class="filename">src/foreign.d</code></a></span></dt><dd><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> implementation.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/lisparit.d"><code class="filename">src/lisparit.d</code></a></span></dt><dd>Functions dealing with numbers (arithmetic), see
<a class="xref" href="#src-arith" title="34.3.1.3. Number system (arithmetic)">Section 34.3.1.3, “Number system (arithmetic)”</a>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/noreadline.d"><code class="filename">src/noreadline.d</code></a></span></dt><dd>Dummy plug-in for the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> library.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/zthread.d"><code class="filename">src/zthread.d</code></a></span></dt><dd>MT implementation.</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="src-arith"></a>34.3.1.3. Number system (arithmetic)</h4></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#src-ari-asm">34.3.1.3.1. External routines for the arithmetic system, written in assembly language</a></span></dt></dl></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/lisparit.d"><code class="filename">src/lisparit.d</code></a></span></dt><dd>initialization, input/output of numbers, lisp functions
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/aridecl.d"><code class="filename">src/aridecl.d</code></a></span></dt><dd>declarations</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arilev0.d"><code class="filename">src/arilev0.d</code></a></span></dt><dd>arithmetic at the machine level
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arilev1.d"><code class="filename">src/arilev1.d</code></a></span></dt><dd>digit sequences</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arilev1c.d"><code class="filename">src/arilev1c.d</code></a></span></dt><dd>operations on digit sequences, written in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arilev1i.d"><code class="filename">src/arilev1i.d</code></a></span></dt><dd>operations on digit sequences, as inline functions
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arilev1e.d"><code class="filename">src/arilev1e.d</code></a></span></dt><dd>operations on digit sequences, bindings to external
routines</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intelem.d"><code class="filename">src/intelem.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: elementary operations
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intlog.d"><code class="filename">src/intlog.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: logical connectives
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intplus.d"><code class="filename">src/intplus.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: addition and subtraction
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intcomp.d"><code class="filename">src/intcomp.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: comparison
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intbyte.d"><code class="filename">src/intbyte.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: byte operations <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_ldb.html" target="_top"><code class="function">LDB</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dpb.html" target="_top"><code class="function">DPB</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intmal.d"><code class="filename">src/intmal.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: multiplication
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intdiv.d"><code class="filename">src/intdiv.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: division
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intgcd.d"><code class="filename">src/intgcd.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_gcd.html" target="_top"><code class="function">GCD</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_lcm.html" target="_top"><code class="function">LCM</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/int2adic.d"><code class="filename">src/int2adic.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: operations on 2-adic integers
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intsqrt.d"><code class="filename">src/intsqrt.d</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a>s: square root, n-th root
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intprint.d"><code class="filename">src/intprint.d</code></a></span></dt><dd>subroutines for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> output
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intread.d"><code class="filename">src/intread.d</code></a></span></dt><dd>subroutines for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_integer.html" target="_top"><code class="classname">INTEGER</code></a> input
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/rational.d"><code class="filename">src/rational.d</code></a></span></dt><dd>rational numbers (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_ratio.html" target="_top"><code class="classname">RATIO</code></a>s)
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/sfloat.d"><code class="filename">src/sfloat.d</code></a></span></dt><dd>elementary operations for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/ffloat.d"><code class="filename">src/ffloat.d</code></a></span></dt><dd>elementary operations for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a>s
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/dfloat.d"><code class="filename">src/dfloat.d</code></a></span></dt><dd>elementary operations for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">DOUBLE-FLOAT</code></a>s
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/lfloat.d"><code class="filename">src/lfloat.d</code></a></span></dt><dd>elementary operations for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">LONG-FLOAT</code></a>s
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/flo_konv.d"><code class="filename">src/flo_konv.d</code></a></span></dt><dd>conversions between <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a>s
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/flo_rest.d"><code class="filename">src/flo_rest.d</code></a></span></dt><dd>general <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_float.html" target="_top"><code class="classname">FLOAT</code></a> operations
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/realelem.d"><code class="filename">src/realelem.d</code></a></span></dt><dd>elementary functions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> numbers
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/realrand.d"><code class="filename">src/realrand.d</code></a></span></dt><dd>random numbers
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/realtran.d"><code class="filename">src/realtran.d</code></a></span></dt><dd>transcendental functions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> numbers
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/compelem.d"><code class="filename">src/compelem.d</code></a></span></dt><dd>elementary functions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> numbers
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/comptran.d"><code class="filename">src/comptran.d</code></a></span></dt><dd>transcendental functions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> numbers
</dd></dl></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="src-ari-asm"></a>34.3.1.3.1. External routines for the arithmetic
system, written in assembly language</h5></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arisparc.d"><code class="filename">src/arisparc.d</code></a></span></dt><dd>written in SPARC assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arisparc64.d"><code class="filename">src/arisparc64.d</code></a></span></dt><dd>written in 64-bit SPARC assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/ari80386.d"><code class="filename">src/ari80386.d</code></a></span></dt><dd>written in i386/i486 assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arimips.d"><code class="filename">src/arimips.d</code></a></span></dt><dd>written in MIPS assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arimips64.d"><code class="filename">src/arimips64.d</code></a></span></dt><dd>written in 64-bit MIPS assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arihppa.d"><code class="filename">src/arihppa.d</code></a></span></dt><dd>written in HPPA-1.0 assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/arivaxunix.d"><code class="filename">src/arivaxunix.d</code></a></span></dt><dd>written in VAX assembler, Unix assembler syntax
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/ariarm.d"><code class="filename">src/ariarm.d</code></a></span></dt><dd>written in ARM assembler
</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="src-asm-sp"></a>34.3.1.4. External routines for accessing the
stack, written in assembly language</h4></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/sp68000.d"><code class="filename">src/sp68000.d</code></a></span></dt><dd>written in 68000 assembler, MIT syntax
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spsparc.d"><code class="filename">src/spsparc.d</code></a></span></dt><dd>written in SPARC assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spsparc64.d"><code class="filename">src/spsparc64.d</code></a></span></dt><dd>written in 64-bit SPARC assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/sp80386.d"><code class="filename">src/sp80386.d</code></a></span></dt><dd>written in i386/i486 assembler
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spmips.d"><code class="filename">src/spmips.d</code></a></span></dt><dd>written in MIPS assembler
</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-asm-misc"></a>34.3.2. Other assembly language stuff</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/asmi386.sh"><code class="filename">src/asmi386.sh</code></a></span></dt><dd>converts i386 assembler from MIT syntax to a macro syntax
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/asmi386.hh"><code class="filename">src/asmi386.hh</code></a></span></dt><dd>expands i386 assembler in macro syntax to either MIT
or Intel syntax</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-lisp"></a>34.3.3. Lisp source files</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="init-lisp"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/init.lisp"><code class="filename">src/init.lisp</code></a></span></dt><dd>the first file to be loaded during bootstrapping,
loads everything else</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/defseq.lisp"><code class="filename">src/defseq.lisp</code></a></span></dt><dd>defines the usual sequence types for the generic
sequence functions</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/backquote.lisp"><code class="filename">src/backquote.lisp</code></a></span></dt><dd>implements the backquote read macro
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/defmacro.lisp"><code class="filename">src/defmacro.lisp</code></a></span></dt><dd>implements <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmacro.html" target="_top"><code class="function">DEFMACRO</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/macros1.lisp"><code class="filename">src/macros1.lisp</code></a></span></dt><dd>the most important macros
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/macros2.lisp"><code class="filename">src/macros2.lisp</code></a></span></dt><dd>some other macros
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/defs1.lisp"><code class="filename">src/defs1.lisp</code></a></span></dt><dd>miscellaneous definitions
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/timezone.lisp"><code class="filename">src/timezone.lisp</code></a></span></dt><dd>site-dependent definition of time zone, except for
<a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/places.lisp"><code class="filename">src/places.lisp</code></a></span></dt><dd>macros using <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s, definitions of most standard
and extensiion <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#place">place</a>s</dd><dt><a id="floatprint-lisp"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/floatprint.lisp"><code class="filename">src/floatprint.lisp</code></a></span></dt><dd>defines <a class="link" href="#write-float-decimal" title="22.2. Printing Floats sec_22-1-3-1-3"><code class="function">SYS::WRITE-FLOAT-DECIMAL</code></a> for printing floating
point numbers in base 10</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/type.lisp"><code class="filename">src/type.lisp</code></a></span></dt><dd>functions working with <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_t.html#type_specifier">type specifier</a>s: <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_typep.html" target="_top"><code class="function">TYPEP</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_subtypep.html" target="_top"><code class="function">SUBTYPEP</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/defstruct.lisp"><code class="filename">src/defstruct.lisp</code></a></span></dt><dd>implements the macro <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defstruct.html" target="_top"><code class="function">DEFSTRUCT</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/format.lisp"><code class="filename">src/format.lisp</code></a></span></dt><dd>implements the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_format.html" target="_top"><code class="function">FORMAT</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/room.lisp"><code class="filename">src/room.lisp</code></a></span></dt><dd>implements the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a>
(see also <a class="xref" href="#room" title="25.3.1. Function ROOM">Section 25.3.1, “Function <code class="function">ROOM</code>”</a>)</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/savemem.lisp"><code class="filename">src/savemem.lisp</code></a></span></dt><dd>see <a class="xref" href="#image" title="31.2. Saving an Image">Section 31.2, “Saving an Image”</a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/xcharin.lisp"><code class="filename">src/xcharin.lisp</code></a> (optional)</span></dt><dd>implements extended character input for <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/keyboard.lisp"><code class="filename">src/keyboard.lisp</code></a> (optional)</span></dt><dd>implements the macro <a class="link" href="#with-kbd" title="21.2.2. Macro EXT:WITH-KEYBOARD"><code class="function">EXT:WITH-KEYBOARD</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/runprog.lisp"><code class="filename">src/runprog.lisp</code></a></span></dt><dd>implements the functions <a class="link" href="#run-prog"><code class="function">EXT:RUN-PROGRAM</code></a>, <a class="link" href="#run-prog"><code class="function">EXT:RUN-SHELL-COMMAND</code></a> etc.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/query.lisp"><code class="filename">src/query.lisp</code></a></span></dt><dd>implements the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_y-or-n-pcm_yes-or-no-p.html" target="_top"><code class="function">Y-OR-N-P</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_y-or-n-pcm_yes-or-no-p.html" target="_top"><code class="function">YES-OR-NO-P</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/reploop.lisp"><code class="filename">src/reploop.lisp</code></a></span></dt><dd>support for the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> and the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/dribble.lisp"><code class="filename">src/dribble.lisp</code></a></span></dt><dd>implements the functions <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_dribble.html" target="_top"><code class="function">DRIBBLE</code></a> and
<a class="link" href="#dribble" title="25.2.11. Function DRIBBLE"><code class="function">EXT:DRIBBLE-STREAM</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/complete.lisp"><code class="filename">src/complete.lisp</code></a></span></dt><dd>implements completion, see <a class="xref" href="#terminal" title="21.2. Terminal interaction">Section 21.2, “Terminal interaction”</a>.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/describe.lisp"><code class="filename">src/describe.lisp</code></a></span></dt><dd>implements functions <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a>, <a href="impnotes.html#apropos" class="olink"><code class="function">APROPOS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_aproposcm_apropos-list.html" target="_top"><code class="function">APROPOS-LIST</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/trace.lisp"><code class="filename">src/trace.lisp</code></a></span></dt><dd><a class="link" href="#trace" title="25.2.6. Macro TRACE">tracer</a>
</dd><dt><a id="macros3-lisp"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/macros3.lisp"><code class="filename">src/macros3.lisp</code></a> (optional)</span></dt><dd>macros <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*"><code class="function">EXT:LETF</code></a>, <a class="link" href="#letf" title="31.11.2. Macros EXT:LETF & EXT:LETF*"><code class="function">EXT:LETF*</code></a>, <a class="link" href="#ethe" title="31.11.1. Macro EXT:ETHE"><code class="function">EXT:ETHE</code></a>, <a class="link" href="#with-collect" title="31.11.4. Macro EXT:WITH-COLLECT"><code class="function">EXT:WITH-COLLECT</code></a>,
function <a class="link" href="#compiled-file-p" title="24.7. Function EXT:COMPILED-FILE-P [CLRFI-2]"><code class="function">EXT:COMPILED-FILE-P</code></a>.</dd><dt><a id="config-lisp"></a><span class="term"><code class="filename">build/config.lisp</code></span></dt><dd><p>site-dependent configuration, a user-modified
copy of one of the following:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/cfgunix.lisp"><code class="filename">src/cfgunix.lisp</code></a></span></dt><dd>for <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/cfgwin32.lisp"><code class="filename">src/cfgwin32.lisp</code></a></span></dt><dd>for the <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>
</dd></dl></div><p>
See <a class="xref" href="#customize" title="31.12. Customizing CLISP behavior">Section 31.12, “Customizing <span class="command"><strong>CLISP</strong></span> behavior”</a>.</p></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/compiler.lisp"><code class="filename">src/compiler.lisp</code></a></span></dt><dd>compiles Lisp code to <a href="impnotes.html#bytecode" class="olink">bytecode</a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/functions.lisp"><code class="filename">src/functions.lisp</code></a></span></dt><dd><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> et al
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/disassem.lisp"><code class="filename">src/disassem.lisp</code></a></span></dt><dd>the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/defs2.lisp"><code class="filename">src/defs2.lisp</code></a></span></dt><dd>miscellaneous [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] definitions
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/loop.lisp"><code class="filename">src/loop.lisp</code></a></span></dt><dd>implements the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>]-compatible <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_loop.html" target="_top"><code class="function">LOOP</code></a> macro
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos.lisp"><code class="filename">src/clos.lisp</code></a></span></dt><dd><p>loads the various parts of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-package.lisp"><code class="filename">src/clos-package.lisp</code></a></span></dt><dd>declares the imports and exports of the
<a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a> package</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-macros.lisp"><code class="filename">src/clos-macros.lisp</code></a></span></dt><dd>defines some internal macros used by the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
implementation</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-class0.lisp"><code class="filename">src/clos-class0.lisp</code></a></span></dt><dd>defines the <code class="classname">class-version</code>
structure</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-metaobject1.lisp"><code class="filename">src/clos-metaobject1.lisp</code></a></span></dt><dd>defines the <a class="link" href="#mop-metaobjects" title="29.2.1. Metaobjects"><code class="classname">CLOS:METAOBJECT</code></a> class
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-slotdef1.lisp"><code class="filename">src/clos-slotdef1.lisp</code></a></span></dt><dd>defines the <a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a> class and its
subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-slotdef2.lisp"><code class="filename">src/clos-slotdef2.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
<a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a> and its subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-slotdef3.lisp"><code class="filename">src/clos-slotdef3.lisp</code></a></span></dt><dd>defines the generic functions that can be used on
<a class="link" href="#mop-sd" title="29.4. Slot Definitions"><code class="classname">CLOS:SLOT-DEFINITION</code></a> objects</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-stablehash1.lisp"><code class="filename">src/clos-stablehash1.lisp</code></a></span></dt><dd>defines the <a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a> class
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-stablehash2.lisp"><code class="filename">src/clos-stablehash2.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
<a class="link" href="#make-hash" title="18.2. Function MAKE-HASH-TABLE"><code class="classname">EXT:STANDARD-STABLEHASH</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-specializer1.lisp"><code class="filename">src/clos-specializer1.lisp</code></a></span></dt><dd>defines the <a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> class and its subclasses
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-specializer2.lisp"><code class="filename">src/clos-specializer2.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
<a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> and its subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-specializer3.lisp"><code class="filename">src/clos-specializer3.lisp</code></a></span></dt><dd>defines the generic functions that can be used on
<a class="link" href="#mop-mo-spec" title="29.2.1.5. Specializers"><code class="classname">CLOS:SPECIALIZER</code></a> objects</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-class1.lisp"><code class="filename">src/clos-class1.lisp</code></a></span></dt><dd>defines the <code class="classname">potential-class</code>
class and its subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-class2.lisp"><code class="filename">src/clos-class2.lisp</code></a></span></dt><dd>implements the mapping from class names to classes
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-class3.lisp"><code class="filename">src/clos-class3.lisp</code></a></span></dt><dd>implements the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defclass.html" target="_top"><code class="function">DEFCLASS</code></a> macro, class definition
and class redefinition</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-class4.lisp"><code class="filename">src/clos-class4.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods
for <code class="classname">potential-class</code> and its
subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-class5.lisp"><code class="filename">src/clos-class5.lisp</code></a></span></dt><dd>implements the special logic of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_make-instance.html" target="_top"><code class="function">MAKE-INSTANCE</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> etc.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-class6.lisp"><code class="filename">src/clos-class6.lisp</code></a></span></dt><dd>defines the generic functions that can be used on
<code class="classname">potential-class</code> objects
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-method1.lisp"><code class="filename">src/clos-method1.lisp</code></a></span></dt><dd>defines the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> class and its subclasses
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-method2.lisp"><code class="filename">src/clos-method2.lisp</code></a></span></dt><dd>implements the bulk of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-method3.lisp"><code class="filename">src/clos-method3.lisp</code></a></span></dt><dd>defines the generic functions that can be used on
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method.html" target="_top"><code class="classname">METHOD</code></a> objects</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-method4.lisp"><code class="filename">src/clos-method4.lisp</code></a></span></dt><dd>makes generic functions on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_standard-method.html" target="_top"><code class="classname">STANDARD-METHOD</code></a>
objects extensible</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-methcomb1.lisp"><code class="filename">src/clos-methcomb1.lisp</code></a></span></dt><dd>defines the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a> class
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-methcomb2.lisp"><code class="filename">src/clos-methcomb2.lisp</code></a></span></dt><dd>implements method combination (part 2 of generic
function dispatch and execution) and the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_define-me_-combination.html" target="_top"><code class="function">DEFINE-METHOD-COMBINATION</code></a> macro
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-methcomb3.lisp"><code class="filename">src/clos-methcomb3.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-methcomb4.lisp"><code class="filename">src/clos-methcomb4.lisp</code></a></span></dt><dd>makes generic functions on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_method-combination.html" target="_top"><code class="classname">METHOD-COMBINATION</code></a>
objects extensible</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-genfun1.lisp"><code class="filename">src/clos-genfun1.lisp</code></a></span></dt><dd>defines the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a> class and its
metaclass, superclass and subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-genfun2a.lisp"><code class="filename">src/clos-genfun2a.lisp</code></a></span></dt><dd>implements part 1 of generic function dispatch and
execution</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-genfun2b.lisp"><code class="filename">src/clos-genfun2b.lisp</code></a></span></dt><dd>implements part 3 of generic function dispatch and
execution</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-genfun3.lisp"><code class="filename">src/clos-genfun3.lisp</code></a></span></dt><dd>implements creation of generic function objects,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defmethod.html" target="_top"><code class="function">DEFMETHOD</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defgeneric.html" target="_top"><code class="function">DEFGENERIC</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-genfun4.lisp"><code class="filename">src/clos-genfun4.lisp</code></a></span></dt><dd>defines <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_ini_ize-instance.html" target="_top"><code class="function">INITIALIZE-INSTANCE</code></a> methods for
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a> and its subclasses</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-genfun5.lisp"><code class="filename">src/clos-genfun5.lisp</code></a></span></dt><dd>makes generic functions on <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_generic-function.html" target="_top"><code class="classname">GENERIC-FUNCTION</code></a>
objects extensible</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-slots1.lisp"><code class="filename">src/clos-slots1.lisp</code></a></span></dt><dd>implements low-level slot access, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-slots.html" target="_top"><code class="function">WITH-SLOTS</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-accessors.html" target="_top"><code class="function">WITH-ACCESSORS</code></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-slots2.lisp"><code class="filename">src/clos-slots2.lisp</code></a></span></dt><dd>defines the generic functions that deal with slot access
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-dependent.lisp"><code class="filename">src/clos-dependent.lisp</code></a></span></dt><dd>implements notification from metaobjects to
dependent objects</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-print.lisp"><code class="filename">src/clos-print.lisp</code></a></span></dt><dd>implements the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_print-object.html" target="_top"><code class="function">PRINT-OBJECT</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clos-custom.lisp"><code class="filename">src/clos-custom.lisp</code></a></span></dt><dd>provides user customization of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a>
</dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/gray.lisp"><code class="filename">src/gray.lisp</code></a></span></dt><dd>implements <a class="ulink" href="http://www.nhplace.com/kent/CL/Issues/stream-definition-by-user.html" target="_top">STREAM-DEFINITION-BY-USER:GENERIC-FUNCTIONS</a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/fill-out.lisp"><code class="filename">src/fill-out.lisp</code></a></span></dt><dd>implements <a class="link" href="#fill-stream" title="30.8. Class EXT:FILL-STREAM"><code class="classname">EXT:FILL-STREAM</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/disassem.lisp"><code class="filename">src/disassem.lisp</code></a></span></dt><dd>implements <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/condition.lisp"><code class="filename">src/condition.lisp</code></a></span></dt><dd>implements the <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> Condition System (<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-9.html"><span class="command"><strong>CLCS</strong></span></a>)
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/gstream.lisp"><code class="filename">src/gstream.lisp</code></a> (optional)</span></dt><dd>generic stream default methods,
see <a class="xref" href="#gstream" title="31.6. Generic streams">Section 31.6, “Generic streams”</a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/foreign1.lisp"><code class="filename">src/foreign1.lisp</code></a></span></dt><dd><a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> implementation.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/screen.lisp"><code class="filename">src/screen.lisp</code></a></span></dt><dd>the screen access package, see <a class="xref" href="#screen" title="32.1. Random Screen Access">Section 32.1, “Random Screen Access”</a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/edit.lisp"><code class="filename">src/edit.lisp</code></a>
(optional)</span></dt><dd>the screen editor (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_ed.html" target="_top"><code class="function">ED</code></a>), <a class="link" href="#uncompile" title="25.2.2. Function EXT:UNCOMPILE"><code class="function">EXT:UNCOMPILE</code></a>
</dd><dt><a id="inspect-lisp"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/inspect.lisp"><code class="filename">src/inspect.lisp</code></a></span></dt><dd>implements <a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="function">INSPECT</code></a> (tty and <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> frontends)
</dd><dt><a id="clhs-lisp"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/clhs.lisp"><code class="filename">src/clhs.lisp</code></a></span></dt><dd>implements <a class="link" href="#open-http" title="31.11.9. Function EXT:OPEN-HTTP and macro EXT:WITH-HTTP-INPUT"><code class="function">EXT:OPEN-HTTP</code></a>, <a class="link" href="#browse-url" title="31.11.11. Function EXT:BROWSE-URL"><code class="function">EXT:BROWSE-URL</code></a>
</dd><dt><a id="exporting-lisp"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/exporting.lisp"><code class="filename">src/exporting.lisp</code></a></span></dt><dd>Macros that export their definienda,
see <a class="xref" href="#exporting" title="32.2.7.3. Exporting">Section 32.2.7.3, “Exporting”</a>.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/threads.lisp"><code class="filename">src/threads.lisp</code></a></span></dt><dd>MT interface</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/german.lisp"><code class="filename">src/german.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/french.lisp"><code class="filename">src/french.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spanish.lisp"><code class="filename">src/spanish.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/russian.lisp"><code class="filename">src/russian.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/danish.lisp"><code class="filename">src/danish.lisp</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/dutch.lisp"><code class="filename">src/dutch.lisp</code></a></span></dt><dd><a class="link" href="#i18n" title="31.4. Internationalization of CLISP">i18n</a> user messages
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-ext-mod"></a>34.3.4. External Modules</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/"><code class="filename">modules/</code></a></span></dt><dd>individual external module sources
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-doc"></a>34.3.5. Documentation</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><a id="src-news"></a><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/NEWS"><code class="filename">src/NEWS</code></a></span></dt><dd>the list of the user-visible changes
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/_README"><code class="filename">src/_README</code></a></span></dt><dd><p>master for the distribution's README</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/_README.en"><code class="filename">src/_README.en</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/_README.de"><code class="filename">src/_README.de</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/_README.es"><code class="filename">src/_README.es</code></a></span></dt><dd>translations of
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/_README"><code class="filename">src/_README</code></a>
</dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/clisp.xml.in"><code class="filename">doc/clisp.xml.in</code></a></span></dt><dd><a class="ulink" href="http://www.docbook.org/" target="_top">DocBook</a>/<a class="ulink" href="http://www.w3.org/XML/" target="_top">XML</a> sources for the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
<a href="clisp.html#clisp" class="olink">manual page</a>
</dd><dt><span class="term"><code class="filename"><em class="replaceable"><code>build-dir</code></em>/clisp.1</code></span></dt><dd>the platform-specific
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/man.html"><span class="command"><strong>man</strong></span></a> manual page,
generated from <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/clisp.xml.in"><code class="filename">doc/clisp.xml.in</code></a>
at <span class="emphasis"><em>build</em></span> time</dd><dt><span class="term"><code class="filename"><em class="replaceable"><code>build-dir</code></em>/clisp.html</code></span></dt><dd>the platform-specific <a class="ulink" href="http://www.w3.org/MarkUp/" target="_top">HTML</a> manual page,
generated from <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/clisp.xml.in"><code class="filename">doc/clisp.xml.in</code></a>
at <span class="emphasis"><em>build</em></span> time</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/impnotes.xml.in"><code class="filename">doc/impnotes.xml.in</code></a></span></dt><dd><p>the master <a class="ulink" href="http://www.docbook.org/" target="_top">DocBook</a>/<a class="ulink" href="http://www.w3.org/XML/" target="_top">XML</a> file for these
implementation notes; includes the following files</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/cl-ent.xml"><code class="filename">doc/cl-ent.xml</code></a></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-independent general <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>-related entities
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/clhs-ent.xml"><code class="filename">doc/clhs-ent.xml</code></a></span></dt><dd>generated list of [<span class="citation"><a class="link" href="#CLHS" title="Common Lisp HyperSpec">Common Lisp HyperSpec</a></span>] entities
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/impent.xml"><code class="filename">doc/impent.xml</code></a></span></dt><dd><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific entities
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/unix-ent.xml"><code class="filename">doc/unix-ent.xml</code></a></span></dt><dd><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a>-related entities
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/mop-ent.xml"><code class="filename">doc/mop-ent.xml</code></a></span></dt><dd><a class="link" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Meta-Object Protocol</a>-related entities
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/impbody.xml"><code class="filename">doc/impbody.xml</code></a></span></dt><dd>most of <a class="xref" href="#clhs-chapters" title="Part I. Chapters or the Common Lisp HyperSpec">Part I, “Chapters or the Common Lisp HyperSpec”</a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/impissue.xml"><code class="filename">doc/impissue.xml</code></a></span></dt><dd><a class="xref" href="#issues" title="Chapter 28. X3J13 Issue Index [CLHS-ic]">Chapter 28, <em>X3J13 Issue Index [CLHS-ic]</em></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/gray.xml"><code class="filename">doc/gray.xml</code></a></span></dt><dd><a class="xref" href="#gray" title="Chapter 30. Gray streams">Chapter 30, <em>Gray streams</em></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/mop.xml"><code class="filename">doc/mop.xml</code></a></span></dt><dd><a class="xref" href="#mop-chap" title="Chapter 29. Meta-Object Protocol">Chapter 29, <em>Meta-Object Protocol</em></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/impext.xml"><code class="filename">doc/impext.xml</code></a></span></dt><dd><a class="xref" href="#ext-p-indep" title="Chapter 31. Platform Independent Extensions">Chapter 31, <em>Platform Independent Extensions</em></a> and
<a class="xref" href="#ext-platform" title="Chapter 32. Platform Specific Extensions">Chapter 32, <em>Platform Specific Extensions</em></a></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/impbyte.xml"><code class="filename">doc/impbyte.xml</code></a></span></dt><dd>this <a class="xref" href="#internals" title="Part IV. Internals of the CLISP Implementation">Part IV, “Internals of the <span class="command"><strong>CLISP</strong></span> Implementation”</a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/faq.xml"><code class="filename">doc/faq.xml</code></a></span></dt><dd><a class="xref" href="#faq" title="Appendix A. Frequently Asked Questions (With Answers) about CLISP">Appendix A, <em>Frequently Asked Questions (With Answers) about <span class="command"><strong>CLISP</strong></span></em></a>
</dd><dt><span class="term"><code class="filename">modules/**/*.xml</code></span></dt><dd>individual external module documentation
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/Symbol-Table.text"><code class="filename">doc/Symbol-Table.text</code></a></span></dt><dd>the mapping between lisp symbols and element IDs
in these notes (see <a href="impnotes.html#describe" class="olink"><code class="function">DESCRIBE</code></a>),
installed in <code class="filename">data/</code> under <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>.
</dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/impnotes.html"><code class="filename">doc/impnotes.html</code></a></span></dt><dd>these <a class="ulink" href="http://www.w3.org/MarkUp/" target="_top">HTML</a> implementation notes,
generated from <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/impnotes.xml.in"><code class="filename">doc/impnotes.xml.in</code></a>
at <span class="emphasis"><em>release</em></span> time</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-i18n"></a>34.3.6. Internationalization</h3></div></div></div><p>These files are usually updated a couple of weeks before a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
release using <span class="command"><strong>make -f Makefile.devel tp-mail</strong></span>,
see also <a class="xref" href="#src-external" title="34.3.8. Externally maintained files">Section 34.3.8, “Externally maintained files”</a>.</p><p>We use the
<a class="ulink" href="http://translationproject.org/domain/clisp.html" target="_top">Translation
project</a> and the above command sends the updated files to the
translators.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">src/po/*.pot</code></span></dt><dd>list of translatable messages (<span class="quote">“<span class="quote">portable
object template</span>”</span>)</dd><dt><span class="term"><code class="filename">src/po/*.po</code></span></dt><dd>translated messages (<span class="quote">“<span class="quote">portable objects</span>”</span>)
</dd><dt><span class="term"><code class="filename">src/po/*.gmo</code></span></dt><dd>translated messages (<span class="quote">“<span class="quote"><a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> format message
objects</span>”</span>)</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-conf-unix"></a>34.3.7. Automatic configuration on <a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> and <a class="ulink" href="http://www.mingw.org/" target="_top"><span class="platform">MinGW</span></a></h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/configure"><code class="filename">configure</code></a></span></dt><dd>the main configuration script
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/version.sh"><code class="filename">version.sh</code></a></span></dt><dd>specifies the current <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/configure.in"><code class="filename">src/configure.in</code></a></span></dt><dd>lists features to be checked
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/m4/"><code class="filename">src/m4/</code></a></span></dt><dd><p class="simpara">a repertoire of features.
Use with <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top">autoconf</a> 2.62</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/m4/clisp.m4"><code class="filename">src/m4/clisp.m4</code></a></span></dt><dd><p>This file defines the macro <code class="function">CL_CLISP</code>
which takes two optional parameters:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">features-list</span></dt><dd>The list of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> features to check.
E.g., passing <code class="code">[foo bar]</code> results
in <code class="varname">cl_cv_clisp_FOO</code>
and <code class="varname">cl_cv_clisp_BAR</code> being defined
to <span class="returnvalue">yes</span>
or <span class="returnvalue">no</span>, depending on the value of
<a href="impnotes.html#features" class="olink"><code class="varname">*FEATURES*</code></a>, i.e., on the return value
of <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-from-string.html" target="_top"><code class="function">READ-FROM-STRING</code></a> "#+FOO \"yes\" #-FOO \"no\"")</code>.
</dd><dt><span class="term">required</span></dt><dd><p class="simpara">Determines whether <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> should fail
if <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> or one of the requested features is missing.</p><p class="simpara">Should be <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/true.html"><span class="command"><strong>true</strong></span></a> (the
default) or <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/false.html"><span class="command"><strong>false</strong></span></a>.</p></dd></dl></div><p class="simpara">Calling this macro causes the generated <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> to
accept the option <code class="option">--with-clisp="clisp command line"</code>
which allows one to use a specific <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> installation instead of
<span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> in <code class="envar">PATH</code>.</p><p>In addition to the aforementioned per-feature variables,
this macro defines the follwing variables:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="varname">cl_cv_clisp_version</code></span></dt><dd>The return value of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_lisp-impl_tion-version.html" target="_top"><code class="function">LISP-IMPLEMENTATION-VERSION</code></a>.
</dd><dt><span class="term"><code class="varname">cl_cv_clisp_libdir</code></span></dt><dd>The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_namestrin_h-namestring.html" target="_top"><code class="function">NAMESTRING</code></a> of <a href="clisp.html#opt-libdir" class="olink"><code class="varname">CUSTOM:*LIB-DIRECTORY*</code></a>.
</dd><dt><span class="term"><code class="varname">cl_cv_clisp_linkset</code></span></dt><dd>The directory of the current <a href="impnotes.html#linkset" class="olink">linking set</a>.
</dd></dl></div><p>
It also substitues the following variables:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="envar">CLISP_LINKKIT</code></td></tr><tr><td><code class="envar">CLISP_FILES</code></td></tr><tr><td><code class="envar">CLISP_LIBS</code></td></tr><tr><td><code class="envar">CLISP_CFLAGS</code></td></tr><tr><td><code class="envar">CLISP_CPPFLAGS</code></td></tr></table><p>
(taken from <code class="filename">$cl_cv_clisp_linkset/<a class="link" href="#makevars">makevars</a></code>)
and <code class="envar">CLISP</code> (the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> command line).</p><p class="simpara">This file is installed in <code class="filename">/usr/share/aclocal</code>
by <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make install</strong></span></a>.</p></dd></dl></div></dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/configure"><code class="filename">src/configure</code></a></span></dt><dd>configuration script, generated from
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/configure.in"><code class="filename">src/configure.in</code></a>
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/intparam.c"><code class="filename">src/intparam.c</code></a></span></dt><dd>figures out some machine parameters (word size,
endianness etc.)</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/floatparam.c"><code class="filename">src/floatparam.c</code></a></span></dt><dd>figures out some floating point arithmetics parameters
(rounding, epsilons etc.)</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/config.h.in"><code class="filename">src/config.h.in</code></a></span></dt><dd>header file master, generated from
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/configure.in"><code class="filename">src/configure.in</code></a>.
<code class="filename"><em class="replaceable"><code>build-dir</code></em>/config.h</code>
contains the values of the features discovered by
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/configure"><code class="filename">src/configure</code></a>.
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/makemake.in"><code class="filename">src/makemake.in</code></a></span></dt><dd>makefile construction script master
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/_clisp.c"><code class="filename">src/_clisp.c</code></a></span></dt><dd>master for the distribution's driver program
</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/_distmakefile"><code class="filename">src/_distmakefile</code></a></span></dt><dd>master for the distribution's Makefile
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="src-external"></a>34.3.8. Externally maintained files</h3></div></div></div><p>The externally maintained files are usually updated a couple of
weeks before a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> release using
<span class="command"><strong>make -f Makefile.devel pre-release</strong></span>,
see also <a class="xref" href="#src-i18n" title="34.3.6. Internationalization">Section 34.3.6, “Internationalization”</a>.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/gllib/"><code class="filename">src/gllib/</code></a><br /></span><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/glm4/"><code class="filename">src/glm4/</code></a></span></dt><dd><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> and <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top">autoconf</a> files from <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/software/gnulib/" target="_top">Portability Library</a>;
updated using <span class="command"><strong>make -f Makefile.devel gnulib-imported</strong></span>
at top level.</dd><dt><span class="term"><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/build-aux/"><code class="filename">src/build-aux/</code></a></span></dt><dd>various shell scripts, updated using
<span class="command"><strong>make -f Makefile.devel build-aux-update</strong></span>
at top level.</dd></dl></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="gc"></a>Chapter 35. Overview of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s Garbage Collection</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#internals-intro">35.1. Introduction</a></span></dt><dt><span class="section"><a href="#lisp-obj-in-c">35.2. Lisp objects in <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="section"><a href="#typecodes">35.3. Object Pointer Representations</a></span></dt><dt><span class="section"><a href="#memory-models">35.4. Memory Models</a></span></dt><dt><span class="section"><a href="#gc-safety">35.5. The burden of garbage-collection upon the rest of <span class="command"><strong>CLISP</strong></span></a></span></dt><dd><dl><dt><span class="section"><a href="#gc-moves-data">35.5.1. Lisp <span class="type">object</span> invalidation</a></span></dt><dt><span class="section"><a href="#gc-lisp-in-C">35.5.2. Managing Lisp <span class="type">object</span>s in <span class="command"><strong>C</strong></span></a></span></dt><dt><span class="section"><a href="#gc-alloccount">35.5.3. Run-time GC-safety checks</a></span></dt><dt><span class="section"><a href="#gc-mem-prot">35.5.4. Memory protection</a></span></dt></dl></dd><dt><span class="section"><a href="#foreign-pointers">35.6. Foreign Pointers</a></span></dt><dt><span class="section"><a href="#nextgc-factor">35.7. Forcing or inhibiting Garbage Collections</a></span></dt><dt><span class="section"><a href="#gc-mt">35.8. Garbage Collection and Multithreading</a></span></dt></dl></div><div class="abstract"><p class="title"><strong>Abstract</strong></p><p>These are internals, which are of interest only to the
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developers. If you do not read <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>,
this chapter is probably not for you.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="internals-intro"></a>35.1. Introduction</h2></div></div></div><p>Knowing that most <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a> implementations are buggy and/or slow,
and because <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> needs to perform <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has its
own memory management subsystem in files <code class="filename">src/spvw*.d</code>,
see <a class="xref" href="#src-modules" title="34.3.1.2. Internal C Modules">Section 34.3.1.2, “Internal <span class="command"><strong>C</strong></span> Modules”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lisp-obj-in-c"></a>35.2. Lisp objects in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="orderedlist"><p class="title"><strong>Three kinds of storage are distinguished:</strong></p><ol class="orderedlist" type="1"><li class="listitem"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> data (the <span class="quote">“<span class="quote">heap</span>”</span>), i.e. storage
which contains <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s and is managed by the <a href="impnotes.html#gc" class="olink">garbage-collect</a>or.
</li><li class="listitem"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> stack (called <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>), contains <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
<a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s visible to the <a href="impnotes.html#gc" class="olink">garbage-collect</a>or</li><li class="listitem"><a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> data (including program text, data,
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>ed memory)</li></ol></div><p>A <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> object is one word, containing a tag (partial type
information) and either immediate data or a pointer to storage.
Pointers to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> data have tag = <code class="literal">machine_type</code> = 0,
pointers to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> stack have tag = <code class="literal">system_type</code>,
most other pointers point to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> data.</p><div class="variablelist"><a id="immediate-o"></a><p class="title"><strong>Immediate objects</strong></p><dl class="variablelist"><dt><span class="term">32-bit CPU</span></dt><dd><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a></td></tr><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a></td></tr></table></dd><dt><span class="term">64-bit CPU</span></dt><dd><p>In addition to the above, </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SINGLE-FLOAT</code></a> (with <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a>)</td></tr></table></dd></dl></div><p>Let us turn to those <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects that consume regular <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> memory.
Every <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> object has a size which is determined when the object is
allocated (using one of the <code class="function">allocate_*()</code> routines).
The size can be computed from the type tag and - if necessary
- the length field of the object's header. The length field always
contains the number of elements of the object. The number of bytes is
given by the function <code class="function">objsize()</code>.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects which contain exactly 2 <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects
(i.e. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_complex.html" target="_top"><code class="classname">COMPLEX</code></a> numbers, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_ratio.html" target="_top"><code class="classname">RATIO</code></a>s) are
stored in a separate area and occupy 2 words each.
All other <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects have <span class="quote">“<span class="quote">varying</span>”</span> length
(more precisely, not a fixed length) and include a word for <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion
purposes at their beginning.</p><p>The garbage collector is invoked every now and then by
<code class="function">allocate_*()</code> calls according to certain heuristics.
It marks all objects which are <span class="quote">“<span class="quote">alive</span>”</span>
(may be reached from the <span class="quote">“<span class="quote">roots</span>”</span>),
compacts these objects and unmarks them.
Non-live objects are lost; their storage is reclaimed.</p><p>2-pointer objects are compacted by a simple hole-filling
algorithm: fill the left-most object into the right-most hole, and so
on, until the objects are contiguous at the right and the hole is
contiguous at the left.</p><p>Variable-length objects are compacted by sliding them down (their
address decreases).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="typecodes"></a>35.3. Object Pointer Representations</h2></div></div></div><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implements two ways of representing object pointers.
(An object pointer, <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>, contains a
pointer to the memory location of the object, or - for <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>
- all bits of the object itself.)
Both of them have some things in common:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">There is a distinction between <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_character.html" target="_top"><code class="classname">CHARACTER</code></a>s, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>s, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_short-flo_m_long-float.html" target="_top"><code class="classname">SHORT-FLOAT</code></a>s, etc) and
heap allocated objects.</li><li class="listitem">All object pointers are typed, i.e. contain a few
bits of information about the type of the pointed-to object. At a
minimum, these bits must allow to distinguish immediate and
heap-allocated objects.</li><li class="listitem">Not all of the type information is contained in the
object pointer. For example, <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> objects can change their type
when <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_change-class.html" target="_top"><code class="function">CHANGE-CLASS</code></a> is called. To avoid scanning all the heap for
references when this happens, the class information is stored in the
heap allocated object, not in the object pointer.</li></ul></div><p>The <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a> object representation has a minimum of type
bits in the object pointer, namely, 2 bits. They allow to distinguish
<a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s (which have some more type bits), <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es (which
have no type bits in the heap, since they occupy just two words in the
heap, with no header), other heap objects (many, from <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>s
to <a class="link" href="#fptr"><code class="classname">FFI:FOREIGN-POINTER</code></a>s), and <span class="type">Subr</span>s. Most object types are
distinguished by looking a the <em class="structfield"><code>rectype</code></em> field
in the header of the heap object.</p><p>The <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> object representation has about two dozen of types
encoded in 6 or 7 bits in the object pointer.
Typically these are the upper 8 bits of a word (on a 32-bit machine) or
the upper 16 bits or 32 bits of a word (on a 64-bit machine).
The particular values of the typecodes allow many common operations to
be performed with a single bit test (e.g. <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_consp.html" target="_top"><code class="function">CONSP</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_minuspcm_plusp.html" target="_top"><code class="function">MINUSP</code></a> for a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_real.html" target="_top"><code class="classname">REAL</code></a> are bit tests) or range check.
However, the <em class="structfield"><code>rectype</code></em> field still exists for
many types, because there are many built-in types which do not need a
particularly fast type test.</p><p>Which object representation is chosen is decided at build time
depending on the available preprocessor definitions. You can define
<a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> or <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a> to force one or the other.</p><p>One might expect that <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> is faster than <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a>
because it does not need to make as many memory accesses. This effect
is, however, hardly measurable in practice (certainly not more than 5%
faster). Apparently because, first, the situations where the type of an
object is requested but then the object is not looked into are rare.
It is much more common to look into an object, regardless of its type.
Second, due to the existence of data caches in the CPU, accessing a heap
location twice, once for the type test and then immediately afterwards
for the data, is not significantly slower than just accessing the
data.</p><p><a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a> is problematic on 32-bit machines, when you want to
use more than 16 MB of memory, because the type bits (at bit 31..24)
interfere with the bits of a heap address. For this reason,
<a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a> is the default on 32-bit platforms.</p><p><a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a> is problematic on platforms whose object alignment
is less than 4. This affects only the mc680x0 CPU; however, here the
alignment can usually be guaranteed through some <a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> options.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="memory-models"></a>35.4. Memory Models</h2></div></div></div><p>There are 6 memory models. Which one is used, depends on the
operating system and is determined at build time.</p><div class="variablelist"><p class="title"><strong>Memory Models</strong></p><dl class="variablelist"><dt><span class="term">SPVW_MIXED_BLOCKS_OPPOSITE</span></dt><dd><p>The heap consists of one block of fixed length
(allocated at startup).
The variable-length objects are allocated from the left, the 2-pointer
objects are allocated from the right.
There is a hole between them.
When the hole shrinks to 0, <a href="impnotes.html#gc" class="olink">garbage-collect</a> is invoked.
<a href="impnotes.html#gc" class="olink">garbage-collect</a> slides the variable-length objects to the left and concentrates
the 2-pointer objects at the right end of the block again.
When no more room is available, some reserve area beyond the right end
of the block is halved, and the 2-pointer objects are moved to the
right accordingly.
</p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(+)</span></p></td><td>Simple management.
</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>No fragmentation at all.
</td></tr><tr><td><p><span class="term">(-)</span></p></td><td>The total heap size is limited.
</td></tr></tbody></table></div><p>
</p></dd><dt><span class="term">SPVW_MIXED_BLOCKS_OPPOSITE & TRIVIALMAP_MEMORY</span></dt><dd><p>The heap consists of two big blocks, one for
variable-length objects and one for 2-pointer objects.
The former one has a hole to the right and is extensible to the right,
the latter one has a hole to the left and is extensible to the left.
Similar to the previous model, except that the hole is unmapped.
</p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>No fragmentation at all.
</td></tr><tr><td><p><span class="term">(*)</span></p></td><td>Works only when SINGLEMAP_MEMORY is
possible as well.</td></tr></tbody></table></div><p>
</p></dd><dt><span class="term">SPVW_MIXED_BLOCKS_STAGGERED & TRIVIALMAP_MEMORY</span></dt><dd><p>The heap consists of two big blocks, one for
variable-length objects and one for 2-pointer objects.
Both have a hole to the right, but are extensible to the right.
</p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>No fragmentation at all.
</td></tr><tr><td><p><span class="term">(*)</span></p></td><td>Works only when SINGLEMAP_MEMORY is
possible as well.</td></tr></tbody></table></div><p>
</p></dd><dt><span class="term">SPVW_MIXED_PAGES</span></dt><dd><p>The heap consists of many small pages (usually around 8 KB).
There are two kinds of pages: one for 2-pointer objects, one for
variable-length objects.
The set of all pages of a fixed kind is called a "Heap".
Each page has its hole (free space) at its end.
For every heap, the pages are kept sorted according to the size of
their hole, using AVL trees.
The <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is invoked when the used space has grown by 25% since the
last GC; until that point new pages are allocated from the OS.
The GC compacts the data in each page separately:
data is moved to the left. Emptied pages are given back to the OS.
If the holes then make up more than 25% of the occupied storage, a
second GC turn moves objects across pages, from nearly empty ones to
nearly full ones, with the aim to free as many pages as possible.
</p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(-)</span></p></td><td>Every allocation requires AVL tree operations,
thus slower</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>Works on operating systems which do not provide
large contiguous areas.</td></tr></tbody></table></div><p>
</p></dd><dt><span class="term">SPVW_PURE_PAGES</span></dt><dd><p>Just like SPVW_MIXED_PAGES, except that every page
contains data of only a single type tag, i.e. there is a Heap for
every type tag.
</p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(-)</span></p></td><td>Every allocation requires AVL tree operations,
thus slower</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>Works on operating systems which do not provide
large contiguous areas.</td></tr><tr><td><p><span class="term">(-)</span></p></td><td>More fragmentation because objects of different
type never fit into the same page.</td></tr></tbody></table></div></dd><dt><span class="term">SPVW_PURE_BLOCKS</span></dt><dd><p>There is a big block of storage for each type tag.
Each of these blocks has its data to the left and the hole to the
right, but these blocks are extensible to the right (because there is
enough room between them).
A <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is triggered when the allocation amount since the
last GC reaches 50% of the amount of used space at the last GC, but at
least 512 KB.
The <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion cleans up each block separately: data is moved left.
</p><div class="variablelist"><p class="title"><strong>Advantages and Disadvantages</strong></p><table border="0" class="variablelist"><colgroup><col align="left" valign="top" /><col /></colgroup><tbody><tr><td><p><span class="term">(+)</span></p></td><td>Total heap size grows depending on the
application's needs.</td></tr><tr><td><p><span class="term">(+)</span></p></td><td>No 16 MB total size limit.
</td></tr><tr><td><p><span class="term">(*)</span></p></td><td>Works only in combination with SINGLEMAP_MEMORY.
</td></tr></tbody></table></div><p>
</p></dd></dl></div><p>In page based memory models, an object larger than a page is the
only object carried by its pages.
There are no small objects in pages belonging to a big object.</p><p>The following combinations of memory model and
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html"><code class="function">mmap</code></a> tricks are possible (the number
indicates the order in which the respective models have been
developed):</p><div class="table"><a id="mem-models-comb-typecodes"></a><p class="title"><strong>Table 35.1. Memory models with <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">TYPECODES</code></strong></span></a></strong></p><div class="table-contents"><table class="table" summary="Memory models with TYPECODES" border="1"><colgroup><col /><col /><col /><col /><col /></colgroup><thead><tr><th align="center"> </th><th align="center"><a class="xref" href="#MMC-A">A</a></th><th align="center"><a class="xref" href="#MMC-B">B</a></th><th align="center"><a class="xref" href="#MMC-C">C</a></th><th align="center"><a class="xref" href="#MMC-D">D</a></th></tr></thead><tbody><tr><td align="center">SPVW_MIXED_BLOCKS_OPPOSITE</td><td align="center">1</td><td align="center">9</td><td align="center"> </td><td align="center">8</td></tr><tr><td align="center">SPVW_MIXED_BLOCKS_STAGGERED</td><td align="center"> </td><td align="center">6</td><td align="center"> </td><td align="center">7</td></tr><tr><td align="center">SPVW_PURE_BLOCKS</td><td align="center"> </td><td align="center"> </td><td align="center">4</td><td align="center">5</td></tr><tr><td align="center">SPVW_MIXED_PAGES</td><td align="center">2</td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr><tr><td align="center">SPVW_PURE_PAGES</td><td align="center">3</td><td align="center"> </td><td align="center"> </td><td align="center"> </td></tr></tbody></table></div></div><br class="table-break" /><div class="table"><a id="mem-models-comb-heapcodes"></a><p class="title"><strong>Table 35.2. Memory models with <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="strong"><strong><code class="option">HEAPCODES</code></strong></span></a></strong></p><div class="table-contents"><table class="table" summary="Memory models with HEAPCODES" border="1"><colgroup><col /><col /><col /><col /></colgroup><thead><tr><th align="center"> </th><th align="center"><a class="xref" href="#MMC-A">A</a></th><th align="center"><a class="xref" href="#MMC-B">B</a></th><th align="center"><a class="xref" href="#MMC-D">D</a></th></tr></thead><tbody><tr><td align="center">SPVW_MIXED_BLOCKS_OPPOSITE</td><td align="center">*</td><td align="center">*</td><td align="center">*</td></tr><tr><td align="center">SPVW_MIXED_BLOCKS_STAGGERED</td><td align="center"> </td><td align="center">*</td><td align="center">*</td></tr><tr><td align="center">SPVW_MIXED_PAGES</td><td align="center">*</td><td align="center"> </td><td align="center"> </td></tr></tbody></table></div></div><br class="table-break" /><div class="orderedlist"><p class="title"><strong>Legend to
<a class="xref" href="#mem-models-comb-typecodes" title="Table 35.1. Memory models with TYPECODES">Table 35.1, “Memory models with <span class="strong"><strong><code class="option">TYPECODES</code></strong></span>”</a> and
<a class="xref" href="#mem-models-comb-heapcodes" title="Table 35.2. Memory models with HEAPCODES">Table 35.2, “Memory models with <span class="strong"><strong><code class="option">HEAPCODES</code></strong></span>”</a></strong></p><ol class="orderedlist" type="A"><li class="listitem"><a id="MMC-A"></a>no MAP_MEMORY</li><li class="listitem"><a id="MMC-B"></a>TRIVIALMAP_MEMORY</li><li class="listitem"><a id="MMC-C"></a>SINGLEMAP_MEMORY</li><li class="listitem"><a id="MMC-D"></a>GENERATIONAL_GC</li></ol></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gc-safety"></a>35.5. The burden of <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion upon the rest of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gc-moves-data">35.5.1. Lisp <span class="type">object</span> invalidation</a></span></dt><dt><span class="section"><a href="#gc-lisp-in-C">35.5.2. Managing Lisp <span class="type">object</span>s in <span class="command"><strong>C</strong></span></a></span></dt><dt><span class="section"><a href="#gc-alloccount">35.5.3. Run-time GC-safety checks</a></span></dt><dt><span class="section"><a href="#gc-mem-prot">35.5.4. Memory protection</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-moves-data"></a>35.5.1. Lisp <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a> invalidation</h3></div></div></div><p>Every subroutine marked with <span class="quote">“<span class="quote">can trigger GC</span>”</span>
or <code class="literal">maygc</code> may invoke <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.
The <a href="impnotes.html#gc" class="olink">garbage-collect</a>or moves all the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> non-<a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s and updates the pointers.
But the <a href="impnotes.html#gc" class="olink">garbage-collect</a>or looks only at the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> and not in the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
variables. (Anything else would not be portable.)
Therefore at every "unsafe" point, i.e. every call to such a subroutine,
all the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> variables of type <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>
<span class="strong"><strong>MUST BE ASSUMED TO BECOME GARBAGE</strong></span>.
(Except for <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s that are known to be unmovable,
e.g. <a class="link" href="#immediate-o" title="Immediate objects">immediate object</a>s or <span class="type">Subr</span>s.)
Pointers inside <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> data (e.g. to the characters of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
or to the elements of a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>) become
<span class="strong"><strong>INVALID</strong></span> as well.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-lisp-in-C"></a>35.5.2. Managing Lisp <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>s in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a></h3></div></div></div><p>The workaround is usually to allocate all the needed <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> data
first and do the rest of the computation with <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> variables,
without calling unsafe routines, and without worrying about <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.</p><p>Alternatively, you can save a lisp <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a> on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> using
macros <code class="function">pushSTACK()</code> and <code class="function">popSTACK()</code>.
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>One should <span class="strong"><strong>not</strong></span> mix these macros with functions
which modify <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> in one statement because <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> may execute
different parts of the statement out of order.
E.g.,</p><pre class="programlisting">pushSTACK(listof(4));</pre><p>
is <span class="emphasis"><em>illegal</em></span> while
</p><pre class="programlisting">pushSTACK(STACK_0);</pre><p>
is <span class="emphasis"><em>legal</em></span>.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-alloccount"></a>35.5.3. Run-time GC-safety checks</h3></div></div></div><p>Run-time GC-safety checking is available when you build <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
with a C++ compiler, e.g.:
<a id="clisp-config-gxx"></a></p><pre class="screen">
<strong><code class="prompt">$</code></strong> ./configure 'CC=g++' <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> build-g-gxx
</pre><p>
When built like this, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/abort.html"><code class="function">abort</code></a>
when you reference GC-unsafe data after an allocation (which could have
triggered a <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion), and <a class="ulink" href="http://sources.redhat.com/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a> will pinpoint the trouble spot.</p><p>Specifically, when <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is configured
as <a class="link" href="#clisp-config-gxx">above</a>, there is a
global integer variable <code class="varname">alloccount</code> and the <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a>
structure contains an integer <em class="structfield"><code>allocstamp</code></em>
slot. If these two integers are not the same, the <a class="link" href="#typecodes" title="35.3. Object Pointer Representations"><span class="type">object</span></a> is invalid.
By playing with <a class="ulink" href="http://sources.redhat.com/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a>, you should be able to figure out the precise spot
where an allocation increments <code class="varname">alloccount</code>
<span class="strong"><strong>after</strong></span> the object has been retrieved from a GC-visible location.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gc-mem-prot"></a>35.5.4. Memory protection</h3></div></div></div><p>Generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or uses memory protection, so when passing pointers
into the lisp heap to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions, you may encounter errors
(<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html"><code class="varname">errno</code></a>=<code class="constant">EFAULT</code>) unless you call
<code class="function">handle_fault_range(protection,region_start,region_end)</code>
on the appropriate memory region. See files </p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/unixaux.d"><code class="filename">src/unixaux.d</code></a></td></tr><tr><td><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/win32aux.d"><code class="filename">src/win32aux.d</code></a></td></tr><tr><td><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/syscalls/calls.c"><code class="filename">modules/syscalls/calls.c</code></a></td></tr><tr><td><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/rawsock/rawsock.c"><code class="filename">modules/rawsock/rawsock.c</code></a></td></tr></table><p> for examples.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="foreign-pointers"></a>35.6. Foreign Pointers</h2></div></div></div><p>Pointers to <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> functions and to <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html"><code class="function">malloc</code></a>ed data can be
hidden in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects of type <span class="type">machine_type</span>;
<a href="impnotes.html#gc" class="olink">garbage-collect</a> will not modify its value.
But one should not dare to assume that a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> stack pointer
or the address of a <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function in a shared library satisfies the
same requirements.</p><p>If another pointer is to be viewed as a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> object, it is best
to box it, e.g. in a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-bit-vector.html" target="_top"><code class="classname">SIMPLE-BIT-VECTOR</code></a> or in an
<span class="type">Fpointer</span> (using <code class="function">allocate_fpointer()</code>.)</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="nextgc-factor"></a>35.7. Forcing or inhibiting Garbage Collections</h2></div></div></div><p>Here are some tips to debug <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion-related problems.</p><p>It is possible to force <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions to occur at specific points, by inserting
calls to <code class="function">EXT:GC</code> in the code.</p><p>It is also possible to make <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions more frequent overall, by use of the
command-line option <code class="option">-nextgc-factor</code>. This option specifies a
factor that gets applied to the amount of space that can be consumed before
the next <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is triggered. If you specify a factor smaller than 1, the
frequency of <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions is increased. For example,
<code class="literal"><code class="option">-nextgc-factor</code> 0.001</code> reduces the
"Bytes available until next GC" value displayed by the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a> function by a
factor of 1000, and thus makes <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions 1000 times more frequent.</p><p>It is equally possible to make <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions less frequent. To this effect,
you pass to <code class="option">-nextgc-factor</code> a value larger than 1. For example,
<code class="literal"><code class="option">-nextgc-factor</code> 1e9</code> multiplies the
"Bytes available until next GC" value displayed by the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_room.html" target="_top"><code class="function">ROOM</code></a> function with a
factor of 1000000000, and thus effectively inhibits <a href="impnotes.html#gc" class="olink">garbage-collect</a>ions entirely.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gc-mt"></a>35.8. Garbage Collection and Multithreading</h2></div></div></div><p>While the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion is executing, all other threads must stop.
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has a copying <a href="impnotes.html#gc" class="olink">garbage-collect</a>or, so anything else would require a write
barrier during the scan phase and a read barrier during the move phase.</p><p><a id="gc-mt-pin"></a><strong>Pinned heap objects. </strong>Heap objects may be <span class="emphasis"><em>pinned</em></span> - they will not
move during <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion. Used when execution is blocked in a
foreign/system call and a pointer into the heap is passed to non-lisp
land. The <a href="impnotes.html#gc" class="olink">garbage-collect</a>or tries to minimize the holes in the heap introduced
by the <span class="emphasis"><em>pinning</em></span> process.
See also the note about system calls in
<a class="xref" href="#clisp-h" title="32.2.7.2. clisp.h">Section 32.2.7.2, “clisp.h”</a>.</p><p><a id="gc-mt-safe-points"></a><strong>Safe points. </strong>The threads may be stopped only at certain safe points.
Currently implemented safe points are:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Any heap allocation (actually before the
allocation itself).</li><li class="listitem">Possibly blocking system call.</li><li class="listitem">Some places that may introduce infinite non-consing
loops.</li></ol></div><p>
Basically any thread that conses or can block in a system call will
not stop the <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion from executing. There are still places where infinite
non-consing loop without safe point may be reached (TODO: find and fix)</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="extend"></a>Chapter 36. Extending <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> Core</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#add-fun">36.1. Adding a built-in function</a></span></dt><dt><span class="section"><a href="#add-var">36.2. Adding a built-in variable</a></span></dt><dt><span class="section"><a href="#recompile">36.3. Recompilation</a></span></dt></dl></div><p>You are urged to use <a class="link" href="#modules" title="32.2. External Modules">External
Modules</a> instead of adding built-in functions.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> comes with an <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> which allows you
to access <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> libraries in an easy way (including creating
<a class="link" href="#dffi-make-func"><code class="function">FFI:FOREIGN-FUNCTION</code></a>s dynamically).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="add-fun"></a>36.1. Adding a built-in function</h2></div></div></div><p>In the rare cases when you really need to modify <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
internals and add a truly built-in function, you should read the
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> sources for inspiration and enlightenment, choose a file where
your brand-new built-in function should go to, and then ...
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">add the <code class="function">LISPFUN</code>
form and the implementation there</li><li class="listitem">add the <code class="function">LISPFUN</code> header to
file <a class="link" href="#subr-d"><code class="filename">subr.d</code></a></li><li class="listitem">declare the function name in file <a class="link" href="#constsym-d"><code class="filename">constsym.d</code></a> in
the appropriate package (probably <a class="link" href="#ext-pac"><strong class="package"><span class="quote">“<span class="quote">EXT</span>”</span></strong></a>, if there is no specific
package)</li><li class="listitem">if your function accepts keyword arguments, then you must
make sure that the keyword symbols are declared in <a class="link" href="#constsym-d"><code class="filename">constsym.d</code></a>
</li><li class="listitem">see the example in <a class="xref" href="#modprep" title="32.2.7.1. Modprep">Section 32.2.7.1, “Modprep”</a> for
argument passing and returning values</li><li class="listitem">export your function name from the appropriate
package in file <a class="link" href="#init-lisp"><code class="filename">init.lisp</code></a></li><li class="listitem">when you are done, you should run
<a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make check-sources</strong></span></a> in your build directory:
this will check that the definitions (source files) and the declarations
(<a class="link" href="#subr-d"><code class="filename">subr.d</code></a> and <a class="link" href="#fsubr-d"><code class="filename">fsubr.d</code></a>) are in sync.</li></ul></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Be very careful with the <span class="emphasis"><em>GC-unsafe</em></span>
functions! Always remember about <a class="link" href="#gc-safety" title="35.5. The burden of garbage-collection upon the rest of CLISP">GC-safety</a>!</p></div><p>These instructions are intentionally terse - you are encouraged to
use <a href="impnotes.html#modules" class="olink">module</a>s and/or <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a> instead of adding built-ins directly.
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="add-var"></a>36.2. Adding a built-in variable</h2></div></div></div><p>If you must be able to access the Lisp variable in the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>
code, follow these steps:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">declare the variable name
in <a class="link" href="#constsym-d"><code class="filename">constsym.d</code></a> in the appropriate package
(probably <a class="link" href="#customize" title="31.12. Customizing CLISP behavior"><strong class="package"><span class="quote">“<span class="quote">CUSTOM</span>”</span></strong></a>, if there is no specific package);
</li><li class="listitem">add a <code class="function">define_variable()</code> call
in function <code class="function">init_symbol_values()</code>
in file <a class="link" href="#spvw-d"><code class="filename">spvw.d</code></a></li><li class="listitem">export your variable name from the appropriate
package in file <a class="link" href="#init-lisp"><code class="filename">init.lisp</code></a></li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="recompile"></a>36.3. Recompilation</h2></div></div></div><p><span class="emphasis"><em>Any</em></span> change that forces <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make</strong></span></a> to remake <code class="filename">lisp.run</code>,
will force recompilation of all <code class="filename">#P".lisp"</code> files and
re-dumping of <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a>, which may be time-consuming. This is not
always necessary, depending on what kind of change you introduced.
</p><p>On the other hand, if you change any of the following files:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="link" href="#constobj-d"><code class="filename">constobj.d</code></a></td></tr><tr><td><a class="link" href="#constsym-d"><code class="filename">constsym.d</code></a></td></tr><tr><td><a class="link" href="#fsubr-d"><code class="filename">fsubr.d</code></a></td></tr><tr><td><a class="link" href="#subr-d"><code class="filename">subr.d</code></a></td></tr></table><p>
your <a class="link" href="#image" title="31.2. Saving an Image"><code class="filename">lispinit.mem</code></a> will <span class="emphasis"><em>have</em></span> to be re-dumped.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><a id="byte-version"></a>Warning</h3><p>If you change the signature of any
system function mentioned in the <a class="link" href="#byte-version" title="Warning"><code class="varname">FUNTAB</code></a>* arrays in
file <a class="link" href="#eval-d"><code class="filename">eval.d</code></a>, all the <code class="filename">#P".fas"</code> files will
become obsolete and will need to be recompiled.
You will need to add a note to that effect to the <a class="link" href="#src-news"><code class="filename">src/NEWS</code></a> file
and augment the object <code class="literal">version</code> in file <a class="link" href="#constobj-d"><code class="filename">constobj.d</code></a>.
<span class="emphasis"><em>Please try to avoid this as much as possible</em></span>.
</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="bytecode"></a>Chapter 37. The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> bytecode specification</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#byte-intro">37.1. Introduction</a></span></dt><dt><span class="section"><a href="#vm">37.2. The virtual machine</a></span></dt><dt><span class="section"><a href="#comp-fun">37.3. The structure of compiled functions</a></span></dt><dt><span class="section"><a href="#instr-struct">37.4. The general structure of the instructions</a></span></dt><dt><span class="section"><a href="#instr-set">37.5. The instruction set</a></span></dt><dd><dl><dt><span class="section"><a href="#instr-const">37.5.1. Instructions for constants</a></span></dt><dt><span class="section"><a href="#instr-lex-var">37.5.2. Instructions for lexical variables</a></span></dt><dt><span class="section"><a href="#instr-dyn-var">37.5.3. Instructions for dynamic variables</a></span></dt><dt><span class="section"><a href="#instr-stack">37.5.4. Instructions for stack operations</a></span></dt><dt><span class="section"><a href="#instr-jump">37.5.5. Instructions for control flow, jumps</a></span></dt><dt><span class="section"><a href="#instr-env">37.5.6. Instructions for lexical environment, creation of closures</a></span></dt><dt><span class="section"><a href="#instr-funcall">37.5.7. Instructions for function calls</a></span></dt><dt><span class="section"><a href="#instr-optkey">37.5.8. Instructions for optional and keyword parameters</a></span></dt><dt><span class="section"><a href="#instr-mulval">37.5.9. Instructions for multiple values</a></span></dt><dt><span class="section"><a href="#instr-block">37.5.10. Instructions for <code class="function">BLOCK</code> and <code class="function">RETURN-FROM</code></a></span></dt><dt><span class="section"><a href="#instr-tagbody">37.5.11. Instructions for <code class="function">TAGBODY</code> and <code class="function">GO</code></a></span></dt><dt><span class="section"><a href="#instr-catch">37.5.12. Instructions for <code class="function">CATCH</code> and <code class="function">THROW</code></a></span></dt><dt><span class="section"><a href="#instr-unwind">37.5.13. Instructions for <code class="function">UNWIND-PROTECT</code></a></span></dt><dt><span class="section"><a href="#instr-handler">37.5.14. Instructions for <code class="function">HANDLER-BIND</code></a></span></dt><dt><span class="section"><a href="#instr-inline">37.5.15. Instructions for some inlined functions</a></span></dt><dt><span class="section"><a href="#instr-combo">37.5.16. Combined instructions</a></span></dt><dt><span class="section"><a href="#instr-shortcut">37.5.17. Shortcut instructions</a></span></dt></dl></dd><dt><span class="section"><a href="#compiler-introspection">37.6. Examining compiled closures</a></span></dt><dt><span class="section"><a href="#bytecode-design">37.7. Bytecode Design</a></span></dt><dd><dl><dt><span class="section"><a href="#byte-when-add-q">37.7.1. When to add a new bytecode?</a></span></dt><dt><span class="section"><a href="#byte-jmptail-q">37.7.2. Why JMPTAIL?</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="byte-intro"></a>37.1. Introduction</h2></div></div></div><p>The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> compiler compiles <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> programs into instruction codes
for a virtual processor. This bytecode is optimized for saving space in
the most common cases of <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> programs. The main advantages/drawbacks
of this approach, compared to native code compilation, are:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Bytecode compiled programs are a lot smaller than
when compiled to native code. This results in better use of CPU
caches, and in less virtual memory paging. Users perceive this as good
responsiveness.</li><li class="listitem">Maximum execution speed (throughput in tight loops)
is limited.</li><li class="listitem">Since no bytecode instructions are provided for
<span class="quote">“<span class="quote">unsafe</span>”</span> operations (like unchecked array accesses,
or <span class="quote">“<span class="quote">fast</span>”</span> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>/<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>), programs run with all safety
checks enabled even when compiled.</li><li class="listitem">Execution speed of a program can easily be
understood by looking at the output of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> function.
A rule of thumb is that every elementary instruction costs 1 time
unit, whereas a function call costs 3 to 4 time units.
</li><li class="listitem">Needing to do no type inference, the compiler is
pretty straightforward and fast. As a consequence, the definition of
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-7.html"><span class="command"><strong>CLOS</strong></span></a> generic functions, which needs to compile small pieces of
generated code, is not perceived to be slow.</li><li class="listitem">The compiler is independent from the hardware CPU.
Different back-ends, one for each hardware CPU, are not needed. As a
consequence, the compiler is fairly small (and would have been easily
maintainable if it were written in a less kludgey way...), and it is
impossible for the compiler writer to introduce CPU dependent bugs.
</li></ul></div><p>
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="vm"></a>37.2. The virtual machine</h2></div></div></div><p>The bytecode can be thought of as being interpreted by a virtual
processor. The engine which interprets the bytecode (the
<span class="quote">“<span class="quote">implementation of the virtual machine</span>”</span>) is either a
<a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> function (<code class="function">interpret_bytecode</code> in <a class="link" href="#eval-d"><code class="filename">eval.d</code></a>),
or a just-in-time compiler which translates a function's bytecode into
hardware CPU instructions the first time said function is called,
see <a class="xref" href="#compile-jit" title="3.2.1.1. Just-In-Time Native Compilation">Section 3.2.1.1, “Just-In-Time Native Compilation”</a>.</p><p>The virtual machine is a stack machine with two stacks:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a></span></dt><dd>a stack for <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects and frames
(<span class="quote">“<span class="quote">Lisp stack</span>”</span>).</dd><dt><span class="term"><a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a></span></dt><dd>a stack for other data and pointers
(<span class="quote">“<span class="quote">Program stack</span>”</span>).</dd></dl></div><p>This two-stack architecture permits to save an unlimited number of
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> (needed for handling of <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>),
without <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#cons">cons</a>ing[3]. Also, in a world with a compacting no-ambiguous-roots
garbage collector, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> must only hold <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects, and <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> can
hold all the other data belonging to a frame, which would not fit into
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> without tagging/untagging overhead.</p><p>The scope of <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> and <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> is only valid for a given function
invocation. Whereas the amount of <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> space needed for executing a
function (excluding other function calls) is unlimited, the amount of
<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> space needed is known a priori, at compile time. When a function
is called, no relation is specified between the caller's <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> and the
callee's <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and between the caller's <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> and the callee's <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>.
The bytecode is designed so that outgoing arguments on the caller's
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> can be shared by the caller's incoming arguments area (on the
callee's <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>), but a virtual machine implementation may also copy
outgoing arguments to incoming arguments instead of sharing them.</p><p>The virtual machine has a special data structure,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>, containing the <span class="quote">“<span class="quote">top of stack</span>”</span>,
specially adapted to <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a></span></dt><dd>an unsigned integer.
</dd><dt><span class="term"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a></span></dt><dd>the <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#primary_value">primary value</a>, a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> object.
If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> = 0, this is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</dd><dt><span class="term"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_space</code></a></span></dt><dd>all values except the first one, an array of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
objects.</dd></dl></div><p>The contents of <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a> is short-lived.
It does not survive a function call, not even a <a href="impnotes.html#gc" class="olink">garbage-collect</a>ion.</p><p>The interpretation of some bytecode instructions depends on a
constant, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>. This is a CPU-dependent number, the value of
<code class="varname">SYSTEM::*JMPBUF-SIZE*</code>. In <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>, it is defined as
<code class="literal">ceiling(sizeof(jmp_buf),sizeof(void*))</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="comp-fun"></a>37.3. The structure of compiled functions</h2></div></div></div><p>A compiled function consists of two objects: The function itself,
containing the references to all <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects needed for the bytecode,
and a byte vector containing only immediate data, including the bytecode
proper.</p><p>Typically, the byte vector is about twice as large as the function
vector. The separation thus helps the garbage collector (since the byte
vector does not need to be scanned for pointers).</p><p>A function looks like this
(cf. the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <span class="type">Cclosure</span>):
</p><div class="variablelist"><dl class="variablelist"><dt><a id="func-name"></a><span class="term">name</span></dt><dd>This is the name of the function, normally a symbol
or a list of the form <code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <em class="replaceable"><code>symbol</code></em>)</code>.
It is used for printing the function and for error messages.
This field is immutable.</dd><dt><a id="func-codevec"></a><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">codevec</code></a></span></dt><dd>This is the byte-code vector, a <span class="type"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_unsigned-byte.html" target="_top"><code class="classname">UNSIGNED-BYTE</code></a> 8))</code></span>.
This field is immutable.</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[]</span></dt><dd>The remaining fields in the function object are
references to other <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects. These references are immutable,
which is why they are called <span class="quote">“<span class="quote">constants</span>”</span>.
(The referenced <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> objects can be mutable objects,
such as <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a>es or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a>s, however.)
</dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">The Exception to the Immutability Rule</h3><p>When a generic function's dispatch code is installed, the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">codevec</code></a>
and <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a> fields are destructively modified.</p></div><p>Some of the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a> can play special roles.
A function looks like this, in more detail:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">name</span></dt><dd>see <a class="xref" href="#func-name">name</a>.
</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">codevec</code></a></span></dt><dd>see <a class="xref" href="#func-codevec"><code class="literal">codevec</code></a>.
</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>*</span></dt><dd>At most one object, representing the closed-up
variables, representing the variables of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> in
which this function was defined. It is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a>, which
looks like this: <span class="data"><code class="literal">#(<em class="replaceable"><code>next</code></em>
<em class="replaceable"><code>value<sub>1</sub></code></em> ...
<em class="replaceable"><code>value<sub>n</sub></code></em>)</code></span>
where <em class="replaceable"><code>value<sub>1</sub></code></em>, ...,
<em class="replaceable"><code>value<sub>n</sub></code></em>
are the values of the closed-up variables,
and <em class="replaceable"><code>next</code></em> is either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> or a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> having the same
structure.</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">block-const</code></a>*</span></dt><dd>Objects representing closed-up <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> tags,
representing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> tags of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> in which
this function was defined. Each is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> containing in the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> part: either a frame pointer to the block frame, or <span class="data"><code class="literal">#<DISABLED></code></span>.
The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a> is the block's name, for error messages only.
</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">tagbody-const</code></a>*</span></dt><dd>Objects representing closed-up <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> tags,
representing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> tags of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a> in which
this function was defined. Each is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_cons.html" target="_top"><code class="classname">CONS</code></a> containing in the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a> part: either a frame pointer to the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame, or
<span class="data"><code class="literal">#<DISABLED></code></span> if the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> has already been left. The <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a> is a
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> containing the names of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> tags,
for error messages only.</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">keyword-const</code></a>*</span></dt><dd>If the function was defined with a <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a>
containing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>, here come the symbols ("keywords"), in their
correct order. They are used by the interpreter during function call.
</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">other-const</code></a>*</span></dt><dd>Other objects needed by the function's bytecode.
</dd></dl></div><p>
</p><p>If <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">block-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">tagbody-const</code></a> are all absent,
the function is called <span class="emphasis"><em>autonomous</em></span>.
This is the case if the function does not refer to lexical variables,
blocks or tags defined in compile code outside of the function.
In particular, it is the case if the function is defined in a null
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.</p><p>If some <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">block-const</code></a>, or <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">tagbody-const</code></a> are
present, the function (a <span class="quote">“<span class="quote">closure</span>”</span>) is created at runtime.
The compiler only generates a prototype, containing <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> values
instead of each <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">block-const</code></a>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">tagbody-const</code></a>.
At runtime, a function is created by copying this prototype and
replacing the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> values by the definitive ones.</p><p>The list <span class="data"><code class="literal">(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">keyword-const</code></a>*
<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">other-const</code></a>*)</code></span> normally does not contain duplicates, because
the compiler removes duplicates when possible. (Duplicates can occur
nevertheless, through the use of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_load-time-value.html" target="_top"><code class="function">LOAD-TIME-VALUE</code></a>.)</p><p>The <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">codevec</code></a> looks like this
(cf. the <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> type <span class="type">Codevec</span>):
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">spdepth_1</code> (2 bytes)</span></dt><dd>The 1st part of the maximal <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> depth.
</dd><dt><span class="term"><code class="literal">spdepth_jmpbufsize</code> (2 bytes)</span></dt><dd>The <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> part of the maximal <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> depth.
The maximal <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> depth (precomputed by the compiler) is given by
<code class="literal">spdepth_1 + spdepth_jmpbufsize * <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a></code>.
</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a> (2 bytes)</span></dt><dd>Number of required parameters.
</dd><dt><span class="term"><code class="literal">numopt</code> (2 bytes)</span></dt><dd>Number of optional parameters.
</dd><dt><span class="term"><a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">flags</code></a> (1 byte)</span></dt><dd><div class="variablelist"><dl class="variablelist"><dt><span class="term">bit 0</span></dt><dd>set if the function has the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> parameter
</dd><dt><span class="term">bit 7</span></dt><dd>set if the function has <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> parameters
</dd><dt><span class="term">bit 6</span></dt><dd>set if the function has <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&ALLOW-OTHER-KEYS</code></a>
</dd><dt><span class="term">bit 4</span></dt><dd>set if the function is a generic function
</dd><dt><span class="term">bit 3</span></dt><dd>set if the function is a generic function and its
effective method shall be returned (instead of being executed)
</dd><dt><span class="term">bit 2</span></dt><dd>set if the full original <a class="link" href="#lalist" title="3.4. Lambda Lists sec_3-4">lambda list</a> is kept in the
closure object, see <a class="xref" href="#space-decl" title="3.3.7. Declaration SPACE">Section 3.3.7, “Declaration <code class="literal">SPACE</code>”</a>
</dd><dt><span class="term">bit 1</span></dt><dd>set if the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">FUNCTION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/stagenfun_doc_umentationcp.html" target="_top"><code class="function">DOCUMENTATION</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>
is kept in the closure object, see <a class="xref" href="#space-decl" title="3.3.7. Declaration SPACE">Section 3.3.7, “Declaration <code class="literal">SPACE</code>”</a>
</dd></dl></div></dd><dt><span class="term"><code class="literal">signature</code> (1 byte)</span></dt><dd>An abbreviation code depending on
<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a>, <code class="literal">numopt</code>, <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">flags</code></a>.
It is used for speeding up the function
call.</dd><dt><span class="term"><code class="literal">numkey</code> (2 bytes, only if the
function has <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>)</span></dt><dd>The number of <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> parameters.
</dd><dt><span class="term"><code class="literal">keyconsts</code> (2 bytes, only if the
function has <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>)</span></dt><dd>The offset of the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">keyword-const</code></a> in the function.
</dd><dt><span class="term"><code class="literal">byte</code>* (any number of bytes)</span></dt><dd>The bytecode instructions.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="instr-struct"></a>37.4. The general structure of the instructions</h2></div></div></div><p>All instructions consist of one byte, denoting the opcode, and
some number of operands.</p><p>The conversion from a byte (in the range 0..255) to the opcode is
performed by lookup in the table contained in the file <a class="link" href="#bytecode-d"><code class="filename">bytecode.d</code></a>.</p><p>There are the following types of operands, denoted by different
letters:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>k</code></em>, <em class="replaceable"><code>n</code></em>, <em class="replaceable"><code>m</code></em>, <em class="replaceable"><code>l</code></em></span></dt><dd>A (nonnegative) numeric operand.
The next byte is read.
If its bit 7 is zero, then the bits 6..0 give the value (7 bits).
If its bit 7 is one, then the bits 6..0 and the subsequent byte
together form the value (15 bits).
</dd><dt><span class="term"><em class="replaceable"><code>b</code></em></span></dt><dd>A (nonnegative) 1-byte operand.
The next byte is read and is the value.
</dd><dt><span class="term"><em class="replaceable"><code>label</code></em></span></dt><dd>A label operand.
A signed numeric operand is read: The next byte is read.
If its bit 7 is zero, then the bits 6..0 give the value
(7 bits, sign-extended).
If its bit 7 is one, then the bits 6..0 and the subsequent byte
together form the value (15 bits, sign-extended).
If the latter 15-bit result is zero, then four more bytes are read
and put together (32 bits, sign-extended).
Finally, the bytecode pointer for the target is computed as the
current bytecode pointer (pointing after the operand just read), plus
the signed numeric operand.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="instr-set"></a>37.5. The instruction set</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#instr-const">37.5.1. Instructions for constants</a></span></dt><dt><span class="section"><a href="#instr-lex-var">37.5.2. Instructions for lexical variables</a></span></dt><dt><span class="section"><a href="#instr-dyn-var">37.5.3. Instructions for dynamic variables</a></span></dt><dt><span class="section"><a href="#instr-stack">37.5.4. Instructions for stack operations</a></span></dt><dt><span class="section"><a href="#instr-jump">37.5.5. Instructions for control flow, jumps</a></span></dt><dt><span class="section"><a href="#instr-env">37.5.6. Instructions for lexical environment, creation of closures</a></span></dt><dt><span class="section"><a href="#instr-funcall">37.5.7. Instructions for function calls</a></span></dt><dt><span class="section"><a href="#instr-optkey">37.5.8. Instructions for optional and keyword parameters</a></span></dt><dt><span class="section"><a href="#instr-mulval">37.5.9. Instructions for multiple values</a></span></dt><dt><span class="section"><a href="#instr-block">37.5.10. Instructions for <code class="function">BLOCK</code> and <code class="function">RETURN-FROM</code></a></span></dt><dt><span class="section"><a href="#instr-tagbody">37.5.11. Instructions for <code class="function">TAGBODY</code> and <code class="function">GO</code></a></span></dt><dt><span class="section"><a href="#instr-catch">37.5.12. Instructions for <code class="function">CATCH</code> and <code class="function">THROW</code></a></span></dt><dt><span class="section"><a href="#instr-unwind">37.5.13. Instructions for <code class="function">UNWIND-PROTECT</code></a></span></dt><dt><span class="section"><a href="#instr-handler">37.5.14. Instructions for <code class="function">HANDLER-BIND</code></a></span></dt><dt><span class="section"><a href="#instr-inline">37.5.15. Instructions for some inlined functions</a></span></dt><dt><span class="section"><a href="#instr-combo">37.5.16. Combined instructions</a></span></dt><dt><span class="section"><a href="#instr-shortcut">37.5.17. Shortcut instructions</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-const"></a>37.5.1. Instructions for constants</h3></div></div></div><div class="informaltable"><a id="instr-const-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)</code></span></td><td align="center">Load <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(PUSH-NIL <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Push <em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>s into the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center"><em class="replaceable"><code>n</code></em> times do: *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)</code></span></td><td align="center">Load <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load the function's <em class="replaceable"><code>n</code></em>th constant into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>],
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-lex-var"></a>37.5.2. Instructions for lexical variables</h3></div></div></div><div class="informaltable"><a id="instr-lex-var-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load a directly accessible local variable into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADI <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load an indirectly accessible local variable into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := *(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+ <em class="replaceable"><code>n</code></em>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADC <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Load a closed-up variable, defined in the same function and
directly accessible, into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>),1+<em class="replaceable"><code>m</code></em>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADV <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Load a closed-up variable, defined in an outer function,
into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><em class="replaceable"><code>v</code></em> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>,
<em class="replaceable"><code>m</code></em> times do: <em class="replaceable"><code>v</code></em> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,0),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,<em class="replaceable"><code>m</code></em>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADIC <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Load a closed-up variable, defined in the same function and
indirectly accessible, into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+<em class="replaceable"><code>n</code></em>),1+<em class="replaceable"><code>m</code></em>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Store values into a directly accessible local variable.</td><td align="center">*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STOREI <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Store values into an indirectly accessible local variable.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
*(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+ <em class="replaceable"><code>n</code></em>) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STOREC <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Store values into a closed-up variable, defined in the same
function and directly accessible.</td><td align="center"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>),1+m) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STOREV <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Store values into a closed-up variable, defined in an outer
function.</td><td align="center"><em class="replaceable"><code>v</code></em> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a>,
<em class="replaceable"><code>m</code></em> times do: <em class="replaceable"><code>v</code></em> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,0),
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,<em class="replaceable"><code>m</code></em>) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STOREIC <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Store values into a closed-up variable, defined in the same
function and indirectly accessible.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+<em class="replaceable"><code>n</code></em>),1+<em class="replaceable"><code>m</code></em>) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-dyn-var"></a>37.5.3. Instructions for dynamic variables</h3></div></div></div><div class="informaltable"><a id="instr-dyn-var-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(GETVALUE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load a symbol's value into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := symbol-value(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>]),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SETVALUE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Store values into a symbol's value.</td><td align="center">symbol-value(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>]) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(BIND <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Bind a symbol dynamically.</td><td align="center">Bind the value of the symbol
<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] to <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
implicitly <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 3,
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNBIND1)</code></span></td><td align="center">Dissolve one binding frame.</td><td align="center">Unbind the binding frame <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> is pointing to,
implicitly <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNBIND <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Dissolve <em class="replaceable"><code>n</code></em> binding frames.</td><td align="center"><em class="replaceable"><code>n</code></em> times do:
Unbind the binding frame <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> is pointing to, thereby
incrementing <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
Thus, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 1+2*<em class="replaceable"><code>n</code></em></td></tr><tr><td align="center"><span class="byte"><code class="literal">(PROGV)</code></span></td><td align="center">Bind a set of symbols dynamically to a set of values.</td><td align="center"><em class="replaceable"><code>symbols</code></em> := *<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,
*--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
build a single binding frame binding the symbols in
<em class="replaceable"><code>symbols</code></em> to the values in <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-stack"></a>37.5.4. Instructions for stack operations</h3></div></div></div><div class="informaltable"><a id="instr-stack-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(PUSH)</code></span></td><td align="center">Push one object onto the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center">*--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(POP)</code></span></td><td align="center">Pop one object from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := *<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SKIP <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Restore a previous <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> pointer.
Remove <em class="replaceable"><code>n</code></em> objects from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center"><a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> + <em class="replaceable"><code>n</code></em></td></tr><tr><td align="center"><span class="byte"><code class="literal">(SKIPI <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Restore a previous <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> pointer. Remove an unknown
number of objects from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>),
<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>+1,
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> + <em class="replaceable"><code>n</code></em></td></tr><tr><td align="center"><span class="byte"><code class="literal">(SKIPSP <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em>)</code></span></td><td align="center">Restore a previous <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> pointer.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-jump"></a>37.5.5. Instructions for control flow, jumps</h3></div></div></div><div class="informaltable"><a id="instr-jump-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(SKIP&RET <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Clean up the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and return from the function.</td><td align="center"><a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>,
return from the function, returning values.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SKIP&RETGF <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Clean up the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and return from the generic
function.</td><td align="center">If bit 3 is set in the function's <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">flags</code></a>,
then <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1,
and return from the function.
Otherwise: if the current function has no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> argument,
then <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a>,
apply <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> to the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a> arguments
still on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and
return from the function.
Else <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a>-1,
apply <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> to the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">numreq</code></a> arguments and the
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a> argument, all still on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and
return from the function.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMP <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>.</td><td align="center">PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is true.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is false.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIF1 <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em> and forget secondary values,
if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is true.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFNOT1 <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em> and forget secondary values,
if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is false.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, PC := <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFATOM <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not a cons.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not a cons, PC := <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFCONSP <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is a cons.</td><td align="center">If <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is a cons, PC := <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFEQ <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to the top-of-stack.</td><td align="center">If eq(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++), PC := <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFNOTEQ <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>
to the top-of-stack.</td><td align="center">If not eq(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++), PC := <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFEQTO <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>,
if the top-of-stack is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> to a constant.</td><td align="center">If eq(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>]), PC := <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFNOTEQTO <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if the top-of-stack is not <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>
to a constant.</td><td align="center">If not eq(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>]), PC := <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPHASH <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Table-driven jump, depending on <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.</td><td align="center">Lookup <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> in the hash table <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>].
(The hash table's test is either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>.)
If found, the hash table value is a signed <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>,
jump to it: PC := PC + value. Else jump to <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPHASHV <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Table-driven jump, depending on <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>,
inside a generic function.</td><td align="center">Lookup <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> in the hash table <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[0],<em class="replaceable"><code>n</code></em>).
(The hash table's test is either <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eql.html" target="_top"><code class="function">EQL</code></a>.)
If found, the hash table value is a signed <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_fixnum.html" target="_top"><code class="classname">FIXNUM</code></a>,
jump to it: PC := PC + value. Else jump to <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JSR <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Subroutine call.</td><td align="center">*--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := function. Then start interpreting the
bytecode at <em class="replaceable"><code>label</code></em>, with <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a> undefined.
When a <span class="byte"><code class="literal">(RET)</code></span> is encountered,
program execution is resumed at the instruction after
<span class="byte"><code class="literal">(JSR <em class="replaceable"><code>label</code></em>)</code></span>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPTAIL <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>
<em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Tail subroutine call.</td><td align="center"><em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eqcm_sleq__lteqcm_gteq.html" target="_top"><code class="function">>=</code></a> <em class="replaceable"><code>m</code></em>.
The <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> frame of size <em class="replaceable"><code>n</code></em> is reduced to size <em class="replaceable"><code>m</code></em>:
{*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-<em class="replaceable"><code>m</code></em>), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1)} :=
{*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>m</code></em>-1)}.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += n-m.
*--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := function.
Then jump to <em class="replaceable"><code>label</code></em>, with <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a> undefined.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-env"></a>37.5.6. Instructions for <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>,
creation of closures</h3></div></div></div><div class="informaltable"><a id="instr-env-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(VENV)</code></span></td><td align="center">Load the <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">venv-const</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[0], <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MAKE-VECTOR1&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> used for closed-up variables.</td><td align="center"><em class="replaceable"><code>v</code></em> := new <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> of size <em class="replaceable"><code>n</code></em>+1.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>v</code></em>,0) := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
*--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <em class="replaceable"><code>v</code></em>. Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(COPY-CLOSURE <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Create a closure by copying the prototype and filling in
the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-1-1-3.html">lexical environment</a>.</td><td align="center"><em class="replaceable"><code>f</code></em> := copy-function(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>m</code></em>]).
For <em class="replaceable"><code>i</code></em>=0,..,<em class="replaceable"><code>n</code></em>-1:
<em class="replaceable"><code>f</code></em>_<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[i] := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1-<em class="replaceable"><code>i</code></em>).
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>.
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <em class="replaceable"><code>f</code></em>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-funcall"></a>37.5.7. Instructions for function calls</h3></div></div></div><div class="informaltable"><a id="instr-funcall-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(CALL <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a constant function with <em class="replaceable"><code>k</code></em> arguments.</td><td align="center">The function <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] is called
with the arguments *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>k</code></em>-1), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0).
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>k</code></em>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL0 <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a constant function with 0 arguments.</td><td align="center">The function <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] is called with 0 arguments.
The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL1 <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a constant function with 1 argument.</td><td align="center">The function <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] is called with one argument *<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 1. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL2 <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a constant function with 2 arguments.</td><td align="center">The function <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] is called
with two arguments *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+1) and *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0).
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 2. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center">Calls a system function with no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>.</td><td align="center">Calls the system function <a class="link" href="#byte-version" title="Warning"><code class="varname">FUNTAB</code></a>[<em class="replaceable"><code>b</code></em>].
The right number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
(including <span class="data"><code class="literal">#<UNBOUND></code></span>s in place of absent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> or
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> parameters).
The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center">Calls a system function with no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>.</td><td align="center">Calls the system function <a class="link" href="#byte-version" title="Warning"><code class="varname">FUNTAB</code></a>[256+<em class="replaceable"><code>b</code></em>].
The right number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
(including <span class="data"><code class="literal">#<UNBOUND></code></span>s in place of absent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a> or
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> parameters).
The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center">Calls a system function with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&REST</code></a>.</td><td align="center">Calls the system function <a class="link" href="#byte-version" title="Warning"><code class="varname">FUNTAB</code></a>R[<em class="replaceable"><code>b</code></em>].
The minimum number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
and <em class="replaceable"><code>m</code></em> additional arguments as well.
The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLC)</code></span></td><td align="center">Calls a computed compiled function with no <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>s.</td><td align="center">Calls the compiled function <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
The right number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
(including <span class="data"><code class="literal">#<UNBOUND></code></span>s in place of absent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
parameters).
The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLCKEY)</code></span></td><td align="center">Calls a computed compiled function with <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a>s.</td><td align="center">Calls the compiled function <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
The right number of arguments is already on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
(including <span class="data"><code class="literal">#<UNBOUND></code></span>s in place of absent <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&OPTIONAL</code></a>
or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_3-4-1.html" target="_top"><code class="literal">&KEY</code></a> parameters).
The arguments are removed from the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(FUNCALL <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a computed function.</td><td align="center">Calls the function *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>)
with the arguments *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0).
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>+1. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(APPLY <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Calls a computed function with an unknown number of arguments.</td><td align="center">Calls the function *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>)
with the arguments *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0)
and a list of additional arguments <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>+1. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-optkey"></a>37.5.8. Instructions for optional
and keyword parameters</h3></div></div></div><div class="informaltable"><a id="instr-optkey-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(PUSH-UNBOUND <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Push <em class="replaceable"><code>n</code></em> <span class="data"><code class="literal">#<UNBOUND></code></span>s into the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center"><em class="replaceable"><code>n</code></em> times do: *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <span class="data"><code class="literal">#<UNBOUND></code></span>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNLIST <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Destructure a proper <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.</td><td align="center">0 ≤ <em class="replaceable"><code>m</code></em> ≤ <em class="replaceable"><code>n</code></em>.
<em class="replaceable"><code>n</code></em> times do: *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>).
During the last <em class="replaceable"><code>m</code></em> iterations, the list <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>
may already have reached its end;
in this case, *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <span class="data"><code class="literal">#<UNBOUND></code></span>.
At the end, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> must be <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNLIST* <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center">Destructure a proper or dotted <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>.</td><td align="center">0 ≤ <em class="replaceable"><code>m</code></em> ≤ <em class="replaceable"><code>n</code></em>, <em class="replaceable"><code>n</code></em> > 0.
<em class="replaceable"><code>n</code></em> times do: *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>).
During the last <em class="replaceable"><code>m</code></em> iterations, the list <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>
may already have reached its end;
in this case, *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <span class="data"><code class="literal">#<UNBOUND></code></span>.
At the end, after <em class="replaceable"><code>n</code></em> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>s, *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(JMPIFBOUNDP <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump to <em class="replaceable"><code>label</code></em>, if a local variable is not unbound.</td><td align="center">If *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) is not <span class="data"><code class="literal">#<UNBOUND></code></span>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>), <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, PC := <em class="replaceable"><code>label</code></em>.
Else: Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>..</td></tr><tr><td align="center"><span class="byte"><code class="literal">(BOUNDP <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Load <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a> or <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>, depending on whether a local
variable is bound.</td><td align="center">If *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) is not <span class="data"><code class="literal">#<UNBOUND></code></span>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.
Else: <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNBOUND->NIL <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">If a local variable is unbound, assign a default value
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> to it.</td><td align="center">If *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) is <span class="data"><code class="literal">#<UNBOUND></code></span>,
*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>) := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-mulval"></a>37.5.9. Instructions for <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a></h3></div></div></div><div class="informaltable"><a id="instr-mulval-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(VALUES0)</code></span></td><td align="center">Load no values into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 0</td></tr><tr><td align="center"><span class="byte"><code class="literal">(VALUES1)</code></span></td><td align="center">Forget secondary values.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>-TO-MV <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Pop the first <em class="replaceable"><code>n</code></em> objects from <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center">Load values(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1),...,*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0)) into
values. <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MV-TO-<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>)</code></span></td><td align="center">Save values on <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center">Push the <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> values onto the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
(in order: <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> comes first).
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a>. Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(NV-TO-<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Save <em class="replaceable"><code>n</code></em> values on <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.</td><td align="center">Push the first <em class="replaceable"><code>n</code></em> values onto the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>
(in order: <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> comes first).
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= <em class="replaceable"><code>n</code></em>. Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MV-TO-LIST)</code></span></td><td align="center">Convert <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a> into a list.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := list of values, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST-TO-MV)</code></span></td><td align="center">Convert a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a> into <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_m.html#multiple_values">multiple values</a>.</td><td align="center">Call the function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_values-list.html" target="_top"><code class="function">VALUES-LIST</code></a> with <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> as argument.
The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MVCALLP)</code></span></td><td align="center">Start a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_multiple-value-call.html" target="_top"><code class="function">MULTIPLE-VALUE-CALL</code></a> invocation.</td><td align="center">*--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>. *--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(MVCALL)</code></span></td><td align="center">Finish a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_multiple-value-call.html" target="_top"><code class="function">MULTIPLE-VALUE-CALL</code></a> invocation.</td><td align="center">newSTACK := *<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>++.
Call the function *(newSTACK-1), passing it
*(newSTACK-2), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0) as arguments.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := newSTACK. The returned values go into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-block"></a>37.5.10. Instructions for
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_return-from.html" target="_top"><code class="function">RETURN-FROM</code></a></h3></div></div></div><div class="informaltable"><a id="instr-block-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(BLOCK-OPEN <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> frame.</td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> frame, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 3, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> -= 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
The topmost (third) object in the block frame is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a>(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>],frame-pointer) (its <em class="replaceable"><code>block-cons</code></em>).
Upon a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_return-from.html" target="_top"><code class="function">RETURN-FROM</code></a> to this frame, execution will continue at <em class="replaceable"><code>label</code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>..</td></tr><tr><td align="center"><span class="byte"><code class="literal">(BLOCK-CLOSE)</code></span></td><td align="center">Dissolve a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> frame.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3,
<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>. Mark the <em class="replaceable"><code>block-cons</code></em> as invalid.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(RETURN-FROM <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Leave a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> whose <em class="replaceable"><code>block-cons</code></em> is given.</td><td align="center"><em class="replaceable"><code>block-cons</code></em> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>].
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>block-cons</code></em>) = <span class="data"><code class="literal">#<DISABLED></code></span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
Else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>block-cons</code></em>) is a frame-pointer.
Unwind the stack up to this frame, pass it values.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(RETURN-FROM-I <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Leave a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_block.html" target="_top"><code class="function">BLOCK</code></a> whose <em class="replaceable"><code>block-cons</code></em> is indirectly accessible.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
<em class="replaceable"><code>block-cons</code></em> := *(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+<em class="replaceable"><code>n</code></em>).
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>block-cons</code></em>) = <span class="data"><code class="literal">#<DISABLED></code></span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
Else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>block-cons</code></em>) is a frame-pointer.
Unwind the stack up to this frame, pass it values.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-tagbody"></a>37.5.11. Instructions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_go.html" target="_top"><code class="function">GO</code></a></h3></div></div></div><div class="informaltable"><a id="instr-tagbody-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(TAGBODY-OPEN <em class="replaceable"><code>m</code></em>
<em class="replaceable"><code>label<sub>1</sub></code></em> ...
<em class="replaceable"><code>label<sub>n</sub></code></em>)</code></span></td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame.</td><td align="center">Fetch <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>m</code></em>], this is a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/typ_simple-vector.html" target="_top"><code class="classname">SIMPLE-VECTOR</code></a> with
<em class="replaceable"><code>n</code></em> elements, then decode <em class="replaceable"><code>n</code></em> label operands.
Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 3+<em class="replaceable"><code>n</code></em>, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> -= 1+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
The third object in the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a>(<a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>m</code></em>],frame-pointer) (the <em class="replaceable"><code>tagbody-cons</code></em>)
Upon a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_go.html" target="_top"><code class="function">GO</code></a> to tag <em class="replaceable"><code>label</code></em> of this frame, execution
will continue at <em class="replaceable"><code>label<sub>l</sub></code></em>.
Invalidate <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(TAGBODY-CLOSE-NIL)</code></span></td><td align="center">Dissolve a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame, and load <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3+<em class="replaceable"><code>m</code></em>, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 1+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
Mark the <em class="replaceable"><code>tagbody-cons</code></em> as invalid.
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>, <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(TAGBODY-CLOSE)</code></span></td><td align="center">Dissolve a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3+<em class="replaceable"><code>m</code></em>, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 1+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
Mark the <em class="replaceable"><code>tagbody-cons</code></em> as invalid.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(GO <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump into a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> whose <em class="replaceable"><code>tagbody-cons</code></em> is given.</td><td align="center"><em class="replaceable"><code>tagbody-cons</code></em> := <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>].
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>tagbody-cons</code></em>) = <span class="data"><code class="literal">#<DISABLED></code></span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
Else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>tagbody-cons</code></em>) is a frame-pointer. Unwind the stack up
to this frame, pass it the number <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(GO-I <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Jump into a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_tagbody.html" target="_top"><code class="function">TAGBODY</code></a> whose <em class="replaceable"><code>tagbody-cons</code></em> is indirectly
accessible.</td><td align="center"><em class="replaceable"><code>k</code></em> := <em class="replaceable"><code>k<sub>1</sub></code></em> + <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a> * <em class="replaceable"><code>k<sub>2</sub></code></em>,
<em class="replaceable"><code>tagbody-cons</code></em> := *(*(<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>+<em class="replaceable"><code>k</code></em>)+<em class="replaceable"><code>n</code></em>).
If <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>tagbody-cons</code></em>) = <span class="data"><code class="literal">#<DISABLED></code></span>, an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a>ed.
Else <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<em class="replaceable"><code>tagbody-cons</code></em>) is a frame-pointer. Unwind the stack up
to this frame, pass it the number <em class="replaceable"><code>label</code></em>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-catch"></a>37.5.12. Instructions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_throw.html" target="_top"><code class="function">THROW</code></a></h3></div></div></div><div class="informaltable"><a id="instr-catch-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(CATCH-OPEN <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame.</td><td align="center">Create a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame, with <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> as tag.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 3, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> -= 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
Upon a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_throw.html" target="_top"><code class="function">THROW</code></a> to this tag execution continues at
<em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CATCH-CLOSE)</code></span></td><td align="center">Dissolve a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 3, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(THROW)</code></span></td><td align="center">Non-local exit to a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame.</td><td align="center"><em class="replaceable"><code>tag</code></em> := *<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++.
Search the innermost <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_catch.html" target="_top"><code class="function">CATCH</code></a> frame with tag
<em class="replaceable"><code>tag</code></em> on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, unwind the
stack up to it, pass it values.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-unwind"></a>37.5.13. Instructions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a></h3></div></div></div><div class="informaltable"><a id="instr-unwind-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(UNWIND-PROTECT-OPEN
<em class="replaceable"><code>label</code></em>)</code></span></td><td align="center">Create an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame.</td><td align="center">Create an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= 2, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> -= 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
When the stack will be unwound by a non-local exit,
values will be saved on <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, and execution will be
transferred to <em class="replaceable"><code>label</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNWIND-PROTECT-NORMAL-EXIT)</code></span></td><td align="center">Dissolve an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame, and start the cleanup
code.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 2, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
*--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := 0, *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := 0, *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
Save the values on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNWIND-PROTECT-CLOSE)</code></span></td><td align="center">Terminate the cleanup code.</td><td align="center">newSTACK := *<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>++. Load
values(*(newSTACK-1), ..., *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0)) into <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">values</code></a>.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := newSTACK. SPword1 := *<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>++, SPword2 := *<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>++.
Continue depending on SPword1 and SPword2.
If both are 0, simply continue execution.
If SPword2 is 0 but SPword1 is nonzero, interpret it as a
label and jump to it.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(UNWIND-PROTECT-CLEANUP)</code></span></td><td align="center">Dissolve an <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame, and execute the cleanup
code like a subroutine call.</td><td align="center">Dissolve the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_unwind-protect.html" target="_top"><code class="function">UNWIND-PROTECT</code></a> frame at <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>,
get <em class="replaceable"><code>label</code></em> out of the frame.
<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 2, <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> += 2+<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">jmpbufsize</code></a>.
*--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := 0, *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := PC, *--<a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> := <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>.
Save the values on the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> -= <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a>.
PC := <em class="replaceable"><code>label</code></em>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-handler"></a>37.5.14. Instructions for <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a></h3></div></div></div><div class="informaltable"><a id="instr-handler-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(HANDLER-OPEN <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Create a handler frame.</td><td align="center">Create a handler frame, using <a class="link" href="#comp-fun" title="37.3. The structure of compiled functions"><code class="literal">consts</code></a>[<em class="replaceable"><code>n</code></em>] which
contains the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> types, the corresponding labels and
the current <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> depth (= function entry <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> - current <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a>).
</td></tr><tr><td align="center"><span class="byte"><code class="literal">(HANDLER-BEGIN&PUSH)</code></span></td><td align="center">Start a handler.</td><td align="center">Restore the same <a href="impnotes.html#vm" class="olink"><code class="literal">SP</code></a> state as after the HANDLER-OPEN.
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_condition.html" target="_top"><code class="classname">CONDITION</code></a> that was passed to the handler,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.
*--<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> := <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-inline"></a>37.5.15. Instructions for some inlined
functions</h3></div></div></div><div class="informaltable"><a id="instr-inline-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">description</th><th align="center">semantics</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(NOT)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_not.html" target="_top"><code class="function">NOT</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := not(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>), <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(EQ)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_eq.html" target="_top"><code class="function">EQ</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := eq(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CAR)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CAR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>), <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CDR)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_carcm_cdr_darcm_cddddr.html" target="_top"><code class="function">CDR</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>), <a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONS)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_cons.html" target="_top"><code class="function">CONS</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := cons(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SYMBOL-FUNCTION)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_symbol-function.html" target="_top"><code class="function">SYMBOL-FUNCTION</code></a>(<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SVREF)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(*<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>++,<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(SVSET)</code></span></td><td align="center">Inlined call to <code class="function">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_setfcm_psetf.html" target="_top"><code class="function">SETF</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a></code>.</td><td align="center"><em class="replaceable"><code>arg1</code></em> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+1),
<em class="replaceable"><code>arg2</code></em> := *(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0), <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += 2.
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_svref.html" target="_top"><code class="function">SVREF</code></a>(<em class="replaceable"><code>arg2</code></em>,<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>) :=
<em class="replaceable"><code>arg1</code></em>.
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <em class="replaceable"><code>arg1</code></em>,
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST</code></a>(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1),...,*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0)),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>.</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST* <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">Inlined call to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST*</code></a>.</td><td align="center"><a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a> := <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_listcm_listst.html" target="_top"><code class="function">LIST*</code></a>(*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+<em class="replaceable"><code>n</code></em>-1),...,
*(<a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>+0),<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">value1</code></a>),
<a class="link" href="#vm" title="37.2. The virtual machine"><code class="varname">mv_count</code></a> := 1, <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> += <em class="replaceable"><code>n</code></em>.</td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-combo"></a>37.5.16. Combined instructions</h3></div></div></div><p>The most frequent short sequences of instructions have an
equivalent combined instruction. They are only present for space and
speed optimization. The only exception is
<span class="byte"><code class="literal">FUNCALL&SKIP&RETGF</code></span>, which is needed for
generic functions.</p><div class="informaltable"><a id="instr-combo-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">equivalent</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(NIL&PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(NIL) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(T&PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(T) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADI&PUSH <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOADI <em class="replaceable"><code>k<sub>1</sub></code></em> <em class="replaceable"><code>k<sub>2</sub></code></em> <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADC&PUSH <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOADC <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOADV&PUSH <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOADV <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>m</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(POP&STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(POP) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(GETVALUE&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(GETVALUE <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(JSR&PUSH <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(JSR <em class="replaceable"><code>label</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(COPY-CLOSURE&PUSH <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(COPY-CLOSURE <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL&PUSH <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL1&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL1 <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL2&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL2 <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1&PUSH <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2&PUSH <em class="replaceable"><code>b</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR&PUSH <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLC&PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLC) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLCKEY&PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLCKEY) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(FUNCALL&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(FUNCALL <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(APPLY&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(APPLY <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CAR&PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CAR) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CDR&PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CDR) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONS&PUSH)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONS) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LIST <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LIST*&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LIST* <em class="replaceable"><code>n</code></em>) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(NIL&STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(NIL) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(T&STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(T) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&STOREC <em class="replaceable"><code>k</code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>k</code></em>) (STOREC <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>m</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1&STORE <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>) (STORE <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2&STORE <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>) (STORE <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR&STORE <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (STORE <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&CDR&STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CDR) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&CONS&STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>+1) (CONS) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&INC&STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CALL1 #'1+) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&DEC&STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CALL1 #'1-) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&CAR&STORE <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>m</code></em>) (CAR) (STORE <em class="replaceable"><code>n</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL1&JMPIF <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL1 <em class="replaceable"><code>n</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL1&JMPIFNOT <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL1 <em class="replaceable"><code>n</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL2&JMPIF <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL2 <em class="replaceable"><code>n</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALL2&JMPIFNOT <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALL2 <em class="replaceable"><code>n</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1&JMPIF <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS1&JMPIFNOT <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS1 <em class="replaceable"><code>b</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2&JMPIF <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLS2&JMPIFNOT <em class="replaceable"><code>b</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLS2 <em class="replaceable"><code>b</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR&JMPIF <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CALLSR&JMPIFNOT <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CALLSR <em class="replaceable"><code>m</code></em> <em class="replaceable"><code>n</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&JMPIF <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (JMPIF <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&JMPIFNOT <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>label</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (JMPIFNOT <em class="replaceable"><code>label</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&CAR&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CAR) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&CDR&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CDR) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&INC&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CALL1 #'1+) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&DEC&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>) (CALL1 #'1-) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&SYMBOL-FUNCTION <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>) (SYMBOL-FUNCTION)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&SYMBOL-FUNCTION&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>) (SYMBOL-FUNCTION) (PUSH)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&SYMBOL-FUNCTION&STORE <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>) (SYMBOL-FUNCTION) (STORE <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(APPLY&SKIP&RET <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(APPLY <em class="replaceable"><code>n</code></em>) (SKIP&RET <em class="replaceable"><code>k</code></em>)</code></span></td></tr><tr><td align="center"><span class="byte"><code class="literal">(FUNCALL&SKIP&RETGF <em class="replaceable"><code>n</code></em> <em class="replaceable"><code>k</code></em>)</code></span></td><td align="center"><span class="byte"><code class="literal">(FUNCALL <em class="replaceable"><code>n</code></em>) (SKIP&RETGF <em class="replaceable"><code>k</code></em>)</code></span></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="instr-shortcut"></a>37.5.17. Shortcut instructions</h3></div></div></div><p>There are special one-byte instructions (without explicit
operands) for the following frequent instructions:</p><div class="informaltable"><a id="instr-shortcut-tab"></a><table class="informaltable" border="1"><colgroup><col /><col /></colgroup><thead><tr><th align="center">mnemonic</th><th align="center">operand range</th></tr></thead><tbody><tr><td align="center"><span class="byte"><code class="literal">(LOAD <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> < 15</td></tr><tr><td align="center"><span class="byte"><code class="literal">(LOAD&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> < 25</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> < 21</td></tr><tr><td align="center"><span class="byte"><code class="literal">(CONST&PUSH <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> < 30</td></tr><tr><td align="center"><span class="byte"><code class="literal">(STORE <em class="replaceable"><code>n</code></em>)</code></span></td><td align="center">0 ≤ <em class="replaceable"><code>n</code></em> < 8</td></tr></tbody></table></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="compiler-introspection"></a>37.6. Examining compiled closures</h2></div></div></div><p>The functions described here are defined
in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/compiler.lisp"><code class="filename">src/compiler.lisp</code></a>
and <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/record.d"><code class="filename">src/record.d</code></a>
and can be used to examine the internals of a compiled closure.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>These function are <span class="emphasis"><em>internal</em></span> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
functions, their names are <span class="strong"><strong>not</strong></span> exported, this section is
<span class="strong"><strong>not</strong></span> supposed to be comprehensive and is <span class="strong"><strong>not</strong></span> guaranteed to be
up to date. It is intended for aspiring <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> hackers who are
supposed to graduate to reading the sources right away. All others
should stick with the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] function <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>.</p></div><p><a id="closure-name"></a><strong>Closure name. </strong>The normal way to extract the name of a closure is
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a>:
</p><pre class="programlisting">
(defun my-plus-1 (x y) (declare (compile)) (+ x y))
⇒ <code class="computeroutput">MY-PLUS-1</code>
(function-lambda-expression #'my-plus-1)
⇒ <code class="computeroutput">(LAMBDA (X Y) (DECLARE (COMPILE)) (+ X Y))</code> ;
⇒ <code class="computeroutput"><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a></code> ;
⇒ <code class="computeroutput">MY-PLUS-1</code>
;; works only on closure objects
(sys::closure-name #'my-plus-1)
⇒ <code class="computeroutput">MY-PLUS-1</code></pre><p><a id="closure-codevec"></a><strong>Closure bytecode. </strong>The actual bytecode vector (if you modify it, you can get a
segfault when the function is executed):</p><pre class="programlisting">
(sys::closure-codevec #'my-plus-1)
⇒ <code class="computeroutput">#(0 0 0 0 2 0 0 0 6 3 174 174 51 2 53 25 3)</code></pre><p><a id="closure-consts"></a><strong>Closure constants. </strong>A closure can depend on external and internal values:
</p><pre class="programlisting">
(let ((x 123) (y 456))
(defun my-plus-2 (z) (declare (compile)) (+ x y z)))
⇒ <code class="computeroutput">MY-PLUS-2</code>
(sys::closure-consts #'my-plus-2)
⇒ <code class="computeroutput">(#(Y 456 X 123 NIL) 3 1)</code></pre><p>
Use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> to see how the constants are used.</p><p><a id="signature"></a><strong>Closure signature. </strong>Function <code class="function">SYS::SIGNATURE</code> returns 8 values:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">required parameter count</li><li class="listitem">optional parameters count</li><li class="listitem">rest-p</li><li class="listitem">key-p</li><li class="listitem">keyword-p</li><li class="listitem">allow-other-keys-p</li><li class="listitem">byte-list (codevec as a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>)</li><li class="listitem">const-list</li></ol></div><p><a id="closure-LAP"></a><strong>Mnemonic bytecodes. </strong>One can convert between numeric and mnemonic bytecodes
(<span class="quote">“<span class="quote">LAP</span>”</span> stands for <span class="quote">“<span class="quote">Lisp Assembly Program</span>”</span>):
</p><pre class="programlisting">
(multiple-value-bind (req-num opt-num rest-p key-p keyword-list
allow-other-keys-p byte-list const-list)
(sys::signature #'my-plus-1)
(sys::disassemble-LAP byte-list const-list))
⇒ <code class="computeroutput">((0 LOAD&PUSH 2) (1 LOAD&PUSH 2) (2 CALLSR 2 53) (5 SKIP&RET 3))</code>
(sys::assemble-LAP (mapcar #'rest *))
⇒ <code class="computeroutput">(174 174 51 2 53 25 3)</code></pre><p>
</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="bytecode-design"></a>37.7. Bytecode Design</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#byte-when-add-q">37.7.1. When to add a new bytecode?</a></span></dt><dt><span class="section"><a href="#byte-jmptail-q">37.7.2. Why JMPTAIL?</a></span></dt></dl></div><p>This section offers some insight into bytecode design in the form
of questions and answers.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="byte-when-add-q"></a>37.7.1. When to add a new bytecode?</h3></div></div></div><div class="abstract"><p class="title"><strong>Question:</strong></p><p>Does it make sense to define a new bytecode instruction for
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a>? Why? Why not?</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="byte-when-add-a"></a>Answer: Is it speed critical?</h4></div></div></div><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> is a glorified <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/speope_letcm_letst.html" target="_top"><code class="function">LET</code></a> binding
for <code class="varname">SYSTEM::*ACTIVE-RESTARTS*</code> and could well profit
from a separate bytecode: it would make it non-<a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#cons">cons</a>ing[3].
(Remember that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_restart.html" target="_top"><code class="classname">RESTART</code></a>s have dynamic extent and therefore do not
really need to be heap allocated.)</p><p>The reason <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a> has its own bytecodes and
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> does not is that <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_handler-bind.html" target="_top"><code class="function">HANDLER-BIND</code></a> can occur in inner
computation loops, whereas <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_restart-case.html" target="_top"><code class="function">RESTART-CASE</code></a> occurs only as part of
user-interface programming and therefore not in inner loops where its
consing could hurt much.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="byte-jmptail-q"></a>37.7.2. Why <a class="link" href="#instr-jump" title="37.5.5. Instructions for control flow, jumps">JMPTAIL</a>?</h3></div></div></div><div class="abstract"><p class="title"><strong>Question:</strong></p><p>Consider this function and its disassembly:
</p><pre class="programlisting">
(defun foo (x y) (if (or (= x 0) (= y 0)) (+ x y) (foo y (1- x))))
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> 'foo)
8 (LOAD&PUSH 1)
9 (LOAD&DEC&PUSH 3)
11 (JMPTAIL 2 5 L0)</pre><p>
Why are the arguments pushed onto the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a>, just to be popped off of
it during the <span class="byte"><code class="literal">JMPTAIL</code></span>?
Why not a sequence of <span class="byte"><code class="literal">LOAD</code></span>,
<span class="byte"><code class="literal">STORE</code></span> and
<span class="byte"><code class="literal">SKIP</code></span> instructions
followed by a <span class="byte"><code class="literal">JMP</code></span>?
</p></div><div class="simplesect"><div class="titlepage"><div><div><h4 class="title"><a id="byte-jmptail-a"></a>Answer: This is a shortcut for the most common use</h4></div></div></div><p>Using <span class="byte"><code class="literal">JMPTAIL</code></span> requires 3
instructions, <span class="byte"><code class="literal">JMP</code></span> requires more.
When <span class="byte"><code class="literal">JMPTAIL</code></span> needs to be called, we
usually have some stuff close to the top of the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> which will
become the new arguments, and some junk between these new arguments
and the closure object. <span class="byte"><code class="literal">JMPTAIL</code></span>
removes the junk. <span class="byte"><code class="literal">JMPTAIL</code></span> is a
convenient shortcut which shortens the bytecode - because typically
one would really have to clean-up the <a href="impnotes.html#vm" class="olink"><code class="literal">STACK</code></a> by hand or make the
calculations in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/compiler.lisp"><code class="filename">src/compiler.lisp</code></a>
more complicated.</p></div></div></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a id="appendices"></a>Part V. Appendices</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="appendix"><a href="#faq">A. Frequently Asked Questions (With Answers) about <span class="command"><strong>CLISP</strong></span></a></span></dt><dt><span class="appendix"><a href="#fdl">B. GNU Free Documentation License</a></span></dt><dt><span class="appendix"><a href="#gpl">C. GNU General Public License</a></span></dt><dd><dl><dt><span class="section"><a href="#gpl-1">C.1. Preamble</a></span></dt><dt><span class="section"><a href="#gpl-2">C.2. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dd><dl><dt><span class="section"><a href="#gpl-2-0">C.2.1. Section 0</a></span></dt><dt><span class="section"><a href="#gpl-2-1">C.2.2. Section 1</a></span></dt><dt><span class="section"><a href="#gpl-2-2">C.2.3. Section 2</a></span></dt><dt><span class="section"><a href="#gpl-2-3">C.2.4. Section 3</a></span></dt><dt><span class="section"><a href="#gpl-2-4">C.2.5. Section 4</a></span></dt><dt><span class="section"><a href="#gpl-2-5">C.2.6. Section 5</a></span></dt><dt><span class="section"><a href="#gpl-2-6">C.2.7. Section 6</a></span></dt><dt><span class="section"><a href="#gpl-2-7">C.2.8. Section 7</a></span></dt><dt><span class="section"><a href="#gpl-2-8">C.2.9. Section 8</a></span></dt><dt><span class="section"><a href="#gpl-2-9">C.2.10. Section 9</a></span></dt><dt><span class="section"><a href="#gpl-2-10">C.2.11. Section 10</a></span></dt><dt><span class="section"><a href="#gpl-2-11">C.2.12. NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="#gpl-2-12">C.2.13. Section 12</a></span></dt></dl></dd><dt><span class="section"><a href="#gpl-3">C.3. How to Apply These Terms to Your New Programs</a></span></dt></dl></dd></dl></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="faq"></a>Appendix A. Frequently Asked Questions (With Answers)
about <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h2></div></div></div><div class="abstract"><a id="faq-abstract"></a><p class="title"><strong>Abstract</strong></p><p>This is a list of frequently asked questions about <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> on the
<a class="link" href="#faq-mailing-lists" title="A.1.1.6.">CLISP mailing lists</a>
and the USENET newsgroup <a class="" href="https://groups.google.com/group/comp.lang.lisp">comp.lang.lisp</a>.
<span class="emphasis"><em>All</em></span> the legitimate technical question are addressed
in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> documentation (<a href="impnotes.html#impnotes-top" class="olink"><span class="command"><strong>CLISP</strong></span> impnotes</a>,
<a href="clisp.html#clisp" class="olink"><span class="refentrytitle">clisp</span>(1)</a>, <a href="clisp-link.html#clisp-link" class="olink"><span class="refentrytitle">clisp-link</span>(1)</a>), and for such
questions this list provides a link into the docs.
The frequently asked <a class="link" href="#faq-meta" title="Meta Information">political</a> questions
are answered here in <span class="emphasis"><em>full</em></span> detail (meaning that no
further explanations of the issues could be provided).</p><p>Please submit more questions (and answers!)
to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a>.</p></div><div class="qandaset"><h2 class="title"><a id="faq-set"></a>FAQ</h2><dl><dt>A.1. <a href="#faq-meta">Meta Information</a></dt><dd><dl><dt>A.1.1. <a href="#faq-meta-misc">Miscellaneous</a></dt><dd><dl><dt>A.1.1.1. <a href="#faq-fine">What is
“FAQ fine”?</a></dt><dt>A.1.1.2. <a href="#faq-doc">The official CLISP
documentation sucks - is anything better available?</a></dt><dt>A.1.1.3. <a href="#faq-gpl">License
- why GNU GPL?</a></dt><dt>A.1.1.4. <a href="#faq-ansi">What about
[ANSI CL standard] compliance?</a></dt><dt>A.1.1.5. <a href="#faq-help">How do I
ask for help?</a></dt><dt>A.1.1.6. <a href="#faq-mailing-lists">Which mailing lists should I subscribe to?</a></dt><dt>A.1.1.7. <a href="#faq-rejected">Why
is my mail to a mailing list rejected?</a></dt><dt>A.1.1.8. <a href="#faq-bugs">How do I
report bugs?</a></dt><dt>A.1.1.9. <a href="#faq-contrib">How
do I help?</a></dt><dt>A.1.1.10. <a href="#faq-debug">How do I
debug CLISP?</a></dt></dl></dd><dt>A.1.2. <a href="#faq-menorah">Logo</a></dt><dd><dl><dt>A.1.2.1. <a href="#faq-menorah-why">Why
is CLISP using menorah as the logo?</a></dt><dt>A.1.2.2. <a href="#faq-menorah-current">Shouldn't the logo be changed now due to the current
political developments in the Middle East?</a></dt><dt>A.1.2.3. <a href="#faq-menorah-other">Aren't there other political issues of concern?</a></dt><dt>A.1.2.4. <a href="#faq-menorah-users">Aren't you afraid of losing some users who are offended by
the logo?</a></dt><dt>A.1.2.5. <a href="#faq-menorah-unprofessional">Using software to
promote a political agenda is unprofessional!</a></dt></dl></dd></dl></dd><dt>A.2. <a href="#faq-run">Running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></a></dt><dd><dl><dt>A.2.1. <a href="#faq-defun">Why are floats printed in binary?</a></dt><dt>A.2.2. <a href="#faq-ide">Where is the IDE?</a></dt><dt>A.2.3. <a href="#faq-opt">What are the
command line arguments?</a></dt><dt>A.2.4. <a href="#faq-debugger">How
do I get out of the debugger?</a></dt><dt>A.2.5. <a href="#faq-ext">What CLISP
extensions are available?</a></dt><dt>A.2.6. <a href="#faq-rc">Where is the
init (“RC”) file on my platform?</a></dt><dt>A.2.7. <a href="#faq-modules">Where
are the modules with which I built CLISP?</a></dt><dt>A.2.8. <a href="#faq-gui">How do I create
a GUI
for my CLISP program?</a></dt></dl></dd><dt>A.3. <a href="#faq-delivery">Application Delivery</a></dt><dd><dl><dt>A.3.1. <a href="#faq-exec">How do I
create an executable file with all my code in it?</a></dt><dt>A.3.2. <a href="#faq-licensing">When
I deliver my application with CLISP, does it have to be covered by
the GNU GPL?</a></dt></dl></dd><dt>A.4. <a href="#faq-trouble">Troubles</a></dt><dd><dl><dt>A.4.1. <a href="#faq-bin-distrib">Where
is the binary distribution for my platform?</a></dt><dt>A.4.2. <a href="#faq-bin-distrib-prev">But a previous release had a binary
distribution for my platform, why does not the current one?</a></dt><dt>A.4.3. <a href="#faq-build">Why does not
CLISP build on my platform?</a></dt><dt>A.4.4. <a href="#faq-with-prefix">
Why is the --with-libsigsegv-prefix option ignored
by the configure script on my 64-bit machine?</a></dt><dt>A.4.5. <a href="#faq-enc-err">What do charset errors mean?</a></dt><dt>A.4.6. <a href="#faq-rl-tab">What does
this message mean: “Display all 1259
possibilities? (y or n)”</a></dt><dt>A.4.7. <a href="#faq-no-rl">Why does
not command line editing work?</a></dt><dt>A.4.8. <a href="#faq-stack">How do I
avoid stack overflow?</a></dt><dt>A.4.9. <a href="#faq-self-mod">Why does my function return different values on each
invocation and then hangs forever?</a></dt><dt>A.4.10. <a href="#faq-fp">Is floating point arithmetic broken?</a></dt><dt>A.4.11. <a href="#faq-random">Is RANDOM broken?</a></dt><dt>A.4.12. <a href="#faq-pp-newline">Why is an extra line break
inserted by the pretty printer?</a></dt><dt>A.4.13. <a href="#faq-warning">How do I disable this annoying
warning?</a></dt><dt>A.4.14. <a href="#faq-scope">Why does DEFVAR affect previously defined lexical closures?</a></dt><dt>A.4.15. <a href="#faq-bad-error">The error message is not helpful!</a></dt><dt>A.4.16. <a href="#faq-other-problem">Why is the function FOO
broken?!</a></dt></dl></dd></dl><table border="0" style="width: 100%;"><colgroup><col align="left" width="1%" /><col /></colgroup><tbody><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq-meta"></a>A.1. Meta Information</h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.1.1. <a href="#faq-meta-misc">Miscellaneous</a></dt><dd><dl><dt>A.1.1.1. <a href="#faq-fine">What is
“FAQ fine”?</a></dt><dt>A.1.1.2. <a href="#faq-doc">The official CLISP
documentation sucks - is anything better available?</a></dt><dt>A.1.1.3. <a href="#faq-gpl">License
- why GNU GPL?</a></dt><dt>A.1.1.4. <a href="#faq-ansi">What about
[ANSI CL standard] compliance?</a></dt><dt>A.1.1.5. <a href="#faq-help">How do I
ask for help?</a></dt><dt>A.1.1.6. <a href="#faq-mailing-lists">Which mailing lists should I subscribe to?</a></dt><dt>A.1.1.7. <a href="#faq-rejected">Why
is my mail to a mailing list rejected?</a></dt><dt>A.1.1.8. <a href="#faq-bugs">How do I
report bugs?</a></dt><dt>A.1.1.9. <a href="#faq-contrib">How
do I help?</a></dt><dt>A.1.1.10. <a href="#faq-debug">How do I
debug CLISP?</a></dt></dl></dd><dt>A.1.2. <a href="#faq-menorah">Logo</a></dt><dd><dl><dt>A.1.2.1. <a href="#faq-menorah-why">Why
is CLISP using menorah as the logo?</a></dt><dt>A.1.2.2. <a href="#faq-menorah-current">Shouldn't the logo be changed now due to the current
political developments in the Middle East?</a></dt><dt>A.1.2.3. <a href="#faq-menorah-other">Aren't there other political issues of concern?</a></dt><dt>A.1.2.4. <a href="#faq-menorah-users">Aren't you afraid of losing some users who are offended by
the logo?</a></dt><dt>A.1.2.5. <a href="#faq-menorah-unprofessional">Using software to
promote a political agenda is unprofessional!</a></dt></dl></dd></dl></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h4 class="title"><a id="faq-meta-misc"></a>A.1.1. Miscellaneous</h4></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.1.1.1. <a href="#faq-fine">What is
“FAQ fine”?</a></dt><dt>A.1.1.2. <a href="#faq-doc">The official CLISP
documentation sucks - is anything better available?</a></dt><dt>A.1.1.3. <a href="#faq-gpl">License
- why GNU GPL?</a></dt><dt>A.1.1.4. <a href="#faq-ansi">What about
[ANSI CL standard] compliance?</a></dt><dt>A.1.1.5. <a href="#faq-help">How do I
ask for help?</a></dt><dt>A.1.1.6. <a href="#faq-mailing-lists">Which mailing lists should I subscribe to?</a></dt><dt>A.1.1.7. <a href="#faq-rejected">Why
is my mail to a mailing list rejected?</a></dt><dt>A.1.1.8. <a href="#faq-bugs">How do I
report bugs?</a></dt><dt>A.1.1.9. <a href="#faq-contrib">How
do I help?</a></dt><dt>A.1.1.10. <a href="#faq-debug">How do I
debug CLISP?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-fine"></a><a id="faq-fine-q"></a><p><strong>A.1.1.1.</strong></p></td><td align="left" valign="top"><p>What is
<span class="quote">“<span class="quote">FAQ fine</span>”</span>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>We levy a fine of 10 zorkmids for
<a class="link" href="#faq-help" title="A.1.1.5.">asking a question</a> that is answered
with a link to this <a class="link" href="#faq" title="Appendix A. Frequently Asked Questions (With Answers) about CLISP">FAQ</a> document.
We further levy a fine of 1 zorkmid for asking a question that is answered
with a link to the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="link" href="#impnotes-top" title="Implementation Notes for GNU CLISP">manual</a>.
The fines are payable to the person who answered the questions.
The definition of a <span class="quote">“<span class="quote">zorkmid</span>”</span> is left to the sole
discretion of the <span class="emphasis"><em>payer</em></span>.</p><p>This should <span class="strong"><strong>not</strong></span> discourage you from asking questions, but
rather <span class="strong"><strong>encourage</strong></span> you to
<span class="strong"><strong>read</strong></span> the manual and
<span class="strong"><strong>answer</strong></span> questions from other users.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-doc"></a><a id="faq-doc-q"></a><p><strong>A.1.1.2.</strong></p></td><td align="left" valign="top"><p>The official <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
documentation sucks - is anything better available?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>As with all generic complaints, the answer to this one is
<a class="ulink" href="http://www.cygwin.com/acronyms/#PTC" target="_top"><acronym class="acronym" title="Patches Thoughtfully Considered">PTC</acronym></a>.</p><p>Additionally, the nightly builds of the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implementation
notes documenting the current <a class="ulink" href="https://www.mercurial-scm.org/" target="_top">Mercurial</a> <code class="literal">default</code> branch
are available at <a class="ulink" href="http://clisp.org/beta/impnotes/" target="_top">http://clisp.org/beta/impnotes/</a>.
It contains both the documentation for the new features and the
general improvements in the documentation.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-gpl"></a><a id="faq-gpl-q"></a><p><strong>A.1.1.3.</strong></p></td><td align="left" valign="top"><p>License
- why <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/doc/Why-CLISP-is-under-GPL">Because
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a></a>.</p><p>Note that this does <span class="strong"><strong>not</strong></span> necessarily prevent you from distributing
your proprietary products based on <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. See <span class="emphasis"><em>Note</em></span>
in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/COPYRIGHT"><code class="filename">COPYRIGHT</code></a> and
<a class="xref" href="#faq-licensing" title="A.3.2.">Q: A.3.2</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-ansi"></a><a id="faq-ansi-q"></a><p><strong>A.1.1.4.</strong></p></td><td align="left" valign="top"><p>What about
[<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] compliance?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_p.html#purports_to_conform"><span class="emphasis"><em>purports to
conform</em></span></a> to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specification, so all
deviations in </p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-ansi" class="olink">-ansi</a></code></pre><p>
from the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] are bugs and are not (yet) fixed only due
to lack of resources.</p><p>On the other hand, some decisions made by the ANSI X3J13 committee
were not as justified from the <span class="emphasis"><em>technical</em></span> point of
view as were most of them, and some of those questionable decisions
were made <span class="strong"><strong>after</strong></span> the alternative behavior has already been implemented
in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>. The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developers took pains to modify <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to
unconditionally comply with the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>] specification in all cases
<a class="link" href="#ansi" title="31.10. Maximum ANSI CL compliance">except for a handful of situations where they
believed that the committee had made a mistake</a>, in which cases
the committee behavior is <span class="emphasis"><em>still</em></span> optionally
available.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does not start in the ansi mode by default for
historical reasons and this is not about to change.
<a class="link" href="#image" title="31.2. Saving an Image">Dumping an image</a> or
<a href="clisp.html#opt-ansi" class="olink">passing a command line
argument</a> are easy enough.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-help"></a><a id="faq-help-q"></a><p><strong>A.1.1.5.</strong></p></td><td align="left" valign="top"><p>How do I
ask for help?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></strong></p></td><td align="left" valign="top"><p>Type <a href="impnotes.html#debugger-main-deb-step" class="olink"><span class="command"><strong>help</strong></span></a> and hit <span class="keycap"><strong>Enter</strong></span>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Human</strong></p></td><td align="left" valign="top"><p>Politely - please refer to <a class="rfc" href="http://www.ietf.org/rfc/rfc1855.txt"><code>Netiquette</code></a>.</p><p>If you have a question about <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, you have the following options
(listed in the order of decreasing audience size):</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">the USENET newsgroup <a class="" href="https://groups.google.com/group/comp.lang.lisp">comp.lang.lisp</a></span></dt><dd>This is the right place to ask all general Lisp
questions, such as <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/acc_charcm_schar.html">"how
do I access a character in a string?"</a></dd><dt><span class="term"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> User Mailing
List <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a></span></dt><dd><p class="simpara">This is the right place to ask user-level
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>-specific questions, such as <span class="quote">“<span class="quote">"how do I save my <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
<a href="impnotes.html#image" class="olink">memory image</a>?"</span>”</span>.</p><p class="simpara">See also <a class="xref" href="#faq-bugs" title="A.1.1.8.">Q: A.1.1.8</a>.</p></dd><dt><span class="term"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> Developer Mailing
List <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a></span></dt><dd>This is the right place to discuss <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internals,
problems with the current development sources, submit patches,
offer help.</dd><dt><span class="term"><a class="ulink" href="https://sourceforge.net/p/clisp/_members/" target="_top">Individual <span class="command"><strong>CLISP</strong></span> developers</a></span></dt><dd><p class="simpara">This is <span class="emphasis"><em>never</em></span> the right thing to
do, unless you want to <span class="emphasis"><em>hire</em></span> this developer to do
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> consulting (commercial support, custom enhancements etc).
This is actually for your own benefit: the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developers are very
busy, they might get weeks to answer your question,
and some other user may be able to help you in the meantine;
as well as for the benefit of the other <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> users,
since the mailing lists are publicly archived (you are encouraged
to <a class="ulink" href="http://clisp.org/#search" target="_top">search</a> them
before asking).</p><p class="simpara">Please do <span class="strong"><strong>not</strong></span> copy your messages to the individual
developers.</p></dd></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Mailing lists are member-only</h3><p>To avoid spam, we require that you subscribe before you can
post to a mailing list.
Alternatively, you can post to the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
<a class="ulink" href="https://sourceforge.net/p/clisp/discussion/3816/" target="_top">web
forum</a> and your message will be forwarded to
the <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a> mailing list.
If you read a list on <a class="ulink" href="http://gmane.org" target="_top">Gmane</a>
and do not want to receive it also by e-mail, you can subscribe to
it using the aforementioned web interface and then disable mail
delivery.</p><p>Alternatively, you can ask on
<a class="ulink" href="http://stackoverflow.com/questions/tagged/clisp" target="_top">StackOverflow</a>
with tags <code class="literal">clisp</code> and/or <code class="literal">common-lisp</code>.
</p></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-mailing-lists"></a><a id="faq-mailing-lists-q"></a><p><strong>A.1.1.6.</strong></p></td><td align="left" valign="top"><p>Which mailing lists should I subscribe to?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Cross-posting in the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/" target="_top">mailing lists</a>
is very actively discouraged and is virtually non-existent,
thus you can subscribe to all mailing lists that are relevant to you
without getting duplicate messages:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-announce/">clisp-announce</a></span></dt><dd>Extremely low-level moderated list, you should
definitely subscribe to this list if you have any interest in <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a>
or <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> whatsoever.</dd><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a></span></dt><dd>Subscribe to this list of you use <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> and want
to ask (and answer!) questions. If you subscribe to this list, you
probably want to subscribe to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-announce/">clisp-announce</a> too.
</dd><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a></span></dt><dd>Subscribe to this list if you want to influence
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developments; <a class="ulink" href="https://www.mercurial-scm.org/" target="_top">Mercurial</a> commit notes go here (as a daily digest).
If you subscribe to this list, you probably want to subscribe
to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a>
<span class="strong"><strong>and</strong></span> <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-announce/">clisp-announce</a> too.</dd></dl></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-rejected"></a><a id="faq-rejected-q"></a><p><strong>A.1.1.7.</strong></p></td><td align="left" valign="top"><p>Why
is my mail to a mailing list rejected?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> mailing lists get a lot of spam, so the
maintainers have to take care to protect the users. If you get a note
that <span class="quote">“<span class="quote">your message is held for moderator's approval</span>”</span>, you
can safely <span class="strong"><strong>assume that it went
to <code class="filename">/dev/null</code></strong></span>
and try again, noting the following:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-announce/">clisp-announce</a></span></dt><dd>do not mail here without a prior discussion
on <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a>
or <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a></dd><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a></span></dt><dd>subscriber-only, you <span class="strong"><strong>must</strong></span> post
from a <span class="strong"><strong>subscribed address</strong></span>,
no exceptions (see <a class="link" href="#faq-help" title="A.1.1.5.">above</a>)
</dd><dt><span class="term"><a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a></span></dt><dd><p>used to be the only open list (it is closed now), so
it is filtered especially aggressively:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">no <a class="rfc" href="http://www.ietf.org/rfc/rfc2045.txt"><code>MIME</code></a> mail (no <a class="ulink" href="http://www.w3.org/MarkUp/" target="_top">HTML</a> formatting, no
attachments - send the URL instead)</li><li class="listitem">the list address must be in <code class="literal">CC</code>
or <code class="literal">TO</code>, not <code class="literal">BCC</code>.
</li><li class="listitem">do not mention <span class="quote">“<span class="quote">virgin</span>”</span>,
<span class="quote">“<span class="quote">penis</span>”</span> or <span class="quote">“<span class="quote">viagra</span>”</span> in
the <code class="literal">Subject</code> line.</li></ul></div></dd></dl></div><p>If you do not like this policy, please volunteer to maintain the
mailing lists - you will be required to go through all the
<span class="quote">“<span class="quote">held for moderator's approval</span>”</span> mail and approve/discard
as appropriate at least twice a day.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-bugs"></a><a id="faq-bugs-q"></a><p><strong>A.1.1.8.</strong></p></td><td align="left" valign="top"><p>How do I
report bugs?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a href="clisp.html#bugs" class="olink">Patiently</a>!
</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-contrib"></a><a id="faq-contrib-q"></a><p><strong>A.1.1.9.</strong></p></td><td align="left" valign="top"><p>How
do I help?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Please read <a class="xref" href="#extend" title="Chapter 36. Extending CLISP Core">Chapter 36, <em>Extending <span class="command"><strong>CLISP</strong></span> Core</em></a> and submit your patch,
together with a <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/ChangeLog"><code class="filename">src/ChangeLog</code></a>
entry (see other entries there for inspiration),
to <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-devel/">clisp-devel</a> (if it is small) or
<a class="ulink" href="https://sourceforge.net/p/clisp/patches/" target="_top">SourceForge patch tracker</a>.</p><p>See <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/CodingStyle"><code class="filename">src/CodingStyle</code></a> for the
style one should follow.</p><p>The patch should be created using <a class="ulink" href="https://www.mercurial-scm.org/" target="_top">Mercurial</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-debug"></a><a id="faq-debug-q"></a><p><strong>A.1.1.10.</strong></p></td><td align="left" valign="top"><p>How do I
debug <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a id="with-debug"></a><strong>Configuring for debugging. </strong>Passing <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> to the top-level <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> script does not
just replace <code class="option">-O</code> with <code class="option">-g</code>
in the <a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> invocation, it also disables some optimizations
(registers, assembly, generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or) and enables
some <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html"><code class="function">printf</code></a> calls (mostly before error
messages caused by system calls).
This means that some bugs might be exhibited by the normal build but
<span class="strong"><strong>not</strong></span> by the <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> one (and vice versa).
If that is the case, please <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> normally but edit the
<code class="filename">Makefile</code> and replace the <a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a> optimization
options (<code class="option">-O</code> et al) with <code class="option">-g</code> before
running <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make</strong></span></a>.</p><p><a id="faq-debug-core"></a><strong>Debugging the core. </strong></p><pre class="screen">
<strong><code class="prompt">$</code></strong> ./configure <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> --cbc build-g
<strong><code class="prompt">$</code></strong> cd build-g
<strong><code class="prompt">$</code></strong> gdb lisp.run <em class="lineannotation"><span class="lineannotation">;; or lisp.exe on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a></span></em>
<strong><code class="prompt">(gdb)</code></strong> boot
<strong><code class="prompt">(gdb)</code></strong> run
</pre><p><a id="faq-debug-module"></a><strong>Debugging
module <code class="literal">foo</code>. </strong></p><pre class="screen">
<strong><code class="prompt">$</code></strong> ./configure <a href="impnotes.html#with-debug" class="olink"><code class="option">--with-debug</code></a> --with-module=foo --cbc build-g
<strong><code class="prompt">$</code></strong> cd build-g
<strong><code class="prompt">$</code></strong> gdb full/lisp.run <em class="lineannotation"><span class="lineannotation">;; or lisp.exe on <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> and <a class="ulink" href="http://cygwin.com/" target="_top"><span class="platform">Cygwin</span></a></span></em>
<strong><code class="prompt">(gdb)</code></strong> full
<strong><code class="prompt">(gdb)</code></strong> run</pre><p>
When debugging a <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> module, use <span class="command"><strong>base</strong></span>
instead of <span class="command"><strong>full</strong></span> and <span class="command"><strong>boot</strong></span> above.
</p><p><a id="faq-debug-gengc"></a><strong>The impact of generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or. </strong>If your <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was built with generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or, you will see
plenty of spurious segfaults (that's how the generational <a href="impnotes.html#gc" class="olink">garbage-collect</a>or
works). At the end of <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/.gdbinit"><code class="filename">src/.gdbinit</code></a>
you will find the following suggested <a class="ulink" href="http://sources.redhat.com/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a> commands:
</p><pre class="programlisting">handle SIGSEGV noprint nostop
break sigsegv_handler_failed</pre><p>
which will stop execution on a <span class="emphasis"><em>dangerous</em></span> segfault.
You can find out whether this is needed by examining the output of the
following command:
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> --version | grep GENERATIONAL_GC</pre><p>
</p><p><a id="faq-debug-gdbinit"></a><strong>Useful commands. </strong>You are encouraged to make use of commands defined in
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/.gdbinit"><code class="filename">src/.gdbinit</code></a>,
such as</p><table border="0" summary="Simple list" class="simplelist"><tr><td><span class="command"><strong>boot</strong></span></td><td><span class="command"><strong>run_mod_test</strong></span></td><td><span class="command"><strong>xout</strong></span></td></tr><tr><td><span class="command"><strong>base</strong></span></td><td><span class="command"><strong>run_all_tests</strong></span></td><td><span class="command"><strong>zout</strong></span></td></tr><tr><td><span class="command"><strong>full</strong></span></td><td><span class="command"><strong>run_ansi_tests</strong></span></td><td><span class="command"><strong>zbacktrace</strong></span></td></tr><tr><td><span class="command"><strong>run_test</strong></span></td><td><span class="command"><strong>run_ansi_tests_compiled</strong></span></td><td> </td></tr></table><p>and others; <span class="command"><strong>help <em class="replaceable"><code>command</code></em></strong></span> in <a class="ulink" href="http://sources.redhat.com/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a>
will tell you what <em class="replaceable"><code>command</code></em> does.</p><p><a id="faq-debug-macros"></a><strong>Macros. </strong><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> makes heavy use of <a class="ulink" href="http://gcc.gnu.org/onlinedocs/cpp/" target="_top"><span class="command"><strong>cpp</strong></span></a> macros
(e.g., <code class="function">pushSTACK</code>), which can complicate debugging
in <a class="ulink" href="http://sources.redhat.com/gdb/" target="_top"><span class="command"><strong>gdb</strong></span></a>. The macros are defined
in <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/lispbibl.d"><code class="filename">src/lispbibl.d</code></a>, but the maze
of conditionals may be hard to navigate. If you are using <a class="ulink" href="http://gcc.gnu.org/" target="_top"><span class="command"><strong>gcc</strong></span></a>, you
can do <a class="unix" href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html"><span class="command"><strong>make lispbibl.h</strong></span></a> and then
examine the definitions in the generated <code class="filename">lispbibl.h</code>.
See also bottom of <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/spvw_debug.d"><code class="filename">src/spvw_debug.d</code></a>.
</p><p><a id="faq-debug-binary-search"></a><strong>Binary Search in Time. </strong>When you encounter a <span class="emphasis"><em>regression error</em></span> (i.e.,
something worked in a previous version of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, but does not work in
the current version) which we cannot reproduce, we will often ask you to
figure out which specific <a class="ulink" href="https://www.mercurial-scm.org/" target="_top">Mercurial</a> commit introduced it.
The way to figure that out is to use <span class="command"><strong>hg bisect</strong></span>.
</p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h4 class="title"><a id="faq-menorah"></a>A.1.2. Logo</h4></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.1.2.1. <a href="#faq-menorah-why">Why
is CLISP using menorah as the logo?</a></dt><dt>A.1.2.2. <a href="#faq-menorah-current">Shouldn't the logo be changed now due to the current
political developments in the Middle East?</a></dt><dt>A.1.2.3. <a href="#faq-menorah-other">Aren't there other political issues of concern?</a></dt><dt>A.1.2.4. <a href="#faq-menorah-users">Aren't you afraid of losing some users who are offended by
the logo?</a></dt><dt>A.1.2.5. <a href="#faq-menorah-unprofessional">Using software to
promote a political agenda is unprofessional!</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-why"></a><a id="faq-menorah-why-q"></a><p><strong>A.1.2.1.</strong></p></td><td align="left" valign="top"><p>Why
is <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> using menorah as the logo?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Whimsical</strong></p></td><td align="left" valign="top"><p>If you must have some answer and you do not care whether it is
correct or not, you may simply think that <a class="ulink" href="https://common-lisp.net" target="_top"><span class="command"><strong>Common Lisp</strong></span></a> brings
the <span class="emphasis"><em>Light</em></span> to a programmer, and <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is a
vehicle that carries the <span class="emphasis"><em>Light</em></span>.</p><p>Accordingly, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> enables you to <span class="emphasis"><em>see</em></span> the
truth, thus you can pronounce it as <span class="emphasis"><em>see-lisp</em></span>.
Alternatively, if you are a <span class="emphasis"><em>seasoned</em></span> expert,
you might pronounce it as <span class="emphasis"><em>sea-lisp</em></span>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Historical</strong></p></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has been using the menorah for the logo since the project was
first started in the late 1980-ies by Bruno Haible and Michael Stoll.
This <span class="emphasis"><em>probably</em></span> reflects the authors' affection
toward the Jewish people, Judaism or the State of Israel
(neither of the two original authors is Jewish by birth).
You may ask the original authors for details yourself.
Both of them are very busy though, so do not expect a prompt reply.
</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-current"></a><a id="faq-menorah-current-q"></a><p><strong>A.1.2.2.</strong></p></td><td align="left" valign="top"><p>Shouldn't the logo be changed now due to the current
political developments in the Middle East?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> developers, both the original creators and the
current maintainers, do not subscribe to the mainstream view that
blames the Jews for everything from high oil prices and Islamic
extremism to El Niño and global warming (or cooling, whatever
the looming disaster du jour is).</p><p>Moreover, today, when Jews are being pushed out of the American
and European academic institutions with various obscene
<a class="ulink" href="http://www.adl.org/israel-international/m/bds/" target="_top">boycott</a>
and <a class="ulink" href="http://www.divestmentwatch.com/" target="_top">divestment</a>
campaigns, it is crucial for all of us to stand together against
the resurgence of Nazism.</p><p>For more information, please see:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.camera.org/" target="_top">Committee for
Accuracy in Middle East Reporting in America</a></li><li class="listitem"><a class="ulink" href="http://www.iris.org.il/" target="_top">Information
Regarding Israel's Security</a></li><li class="listitem"><a class="ulink" href="http://www.memri.org/" target="_top">Middle East
Media Research Institute</a></li><li class="listitem"><a class="ulink" href="http://www.mideasttruth.com/" target="_top">YES to
peace, NO to terror</a></li><li class="listitem"><a class="ulink" href="http://www.mideasttruth.com/links.html" target="_top">More
links</a></li></ul></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-other"></a><a id="faq-menorah-other-q"></a><p><strong>A.1.2.3.</strong></p></td><td align="left" valign="top"><p>Aren't there other political issues of concern?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Yes, there are! For example, in 1989 the
<a class="ulink" href="http://sds.podval.org/commies.html" target="_top">communist</a>
government of the <a class="ulink" href="http://www.chinasupport.net/" target="_top">People's
Republic of China</a> murdered some 3000+
student human rights protesters at the Tienanmen square in Beijing,
and people appear to have already forgotten this crime.
A note to that effect was kept in the file
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/timezone.lisp"><code class="filename">src/timezone.lisp</code></a>
until 2002, when it was decided that is was not visible enough there
and it was moved here.</p><p>We also oppose <a class="ulink" href="http://swpat.ffii.org/" target="_top">software
patents</a> and support other liberal (i.e., pro-liberty) causes.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-users"></a><a id="faq-menorah-users-q"></a><p><strong>A.1.2.4.</strong></p></td><td align="left" valign="top"><p>Aren't you afraid of losing some users who are offended by
the logo?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Do you have in mind people like
<a class="ulink" href="https://groups.google.com/d/msg/gnu.emacs.help/R7wEPCJXuaI/r-5lmxlY9vQJ" target="_top">this</a> one?
Good riddance!</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-menorah-unprofessional"></a><a id="faq-menorah-unprofessional-q"></a><p><strong>A.1.2.5.</strong></p></td><td align="left" valign="top"><p>Using software to
promote a political agenda is unprofessional!</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Expressing their opinion is a perfectly natural thing for the
authors, be it artistic preferences, political views or religious beliefs.
The use of the menorah has its roots somewhere between these areas,
and the authors are proud to display it.
If you are unlucky enough to have lost the freedom to express your
opinion, due to the constraints of a government, society, religion,
or expectations of <span class="quote">“<span class="quote">professional relationships</span>”</span>,
the Free World condoles with you.
The authors of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> are not operating under such constraints.
If you are unhappy about their artistic preferences, political views or
religious beliefs, you are free to ignore them.</p><p>Many scientists have been doing art, politics and religion.
René Descartes and Isaak Newton combined mathematics and Christianity.
Albert Einstein helped the U.S. to counter the danger of an atomic bomb
in the hands of the Nazis.
Bram Moolenaar, the author of <a class="ulink" href="http://www.vim.org/" target="_top">VIM</a>,
promotes charitable donations to Uganda.</p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq-run"></a>A.2. Running <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a></h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.2.1. <a href="#faq-defun">Why are floats printed in binary?</a></dt><dt>A.2.2. <a href="#faq-ide">Where is the IDE?</a></dt><dt>A.2.3. <a href="#faq-opt">What are the
command line arguments?</a></dt><dt>A.2.4. <a href="#faq-debugger">How
do I get out of the debugger?</a></dt><dt>A.2.5. <a href="#faq-ext">What CLISP
extensions are available?</a></dt><dt>A.2.6. <a href="#faq-rc">Where is the
init (“RC”) file on my platform?</a></dt><dt>A.2.7. <a href="#faq-modules">Where
are the modules with which I built CLISP?</a></dt><dt>A.2.8. <a href="#faq-gui">How do I create
a GUI
for my CLISP program?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-defun"></a><a id="faq-defun-q"></a><p><strong>A.2.1.</strong></p></td><td align="left" valign="top"><p>Why are floats printed in binary?</p><p>Where is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defun.html" target="_top"><code class="function">DEFUN</code></a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Pass <code class="option"><a href="clisp.html#opt-memfile" class="olink">-M</a></code> to the <a href="clisp.html#runtime" class="olink">runtime</a> (<code class="filename">lisp.run</code>
or <code class="filename">lisp.exe</code>).
Or, better yet, use the driver <code class="filename">clisp</code> (or
<code class="filename">clisp.exe</code>) instead of invoking the <a href="clisp.html#runtime" class="olink">runtime</a>
directly.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-ide"></a><a id="faq-ide-q"></a><p><strong>A.2.2.</strong></p></td><td align="left" valign="top"><p>Where is the <acronym class="acronym" title="Integrated Development Environment">IDE</acronym>?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong><a class="ulink" href="http://www.gnu.org/software/emacs/" target="_top">Emacs</a>-based</strong></p></td><td align="left" valign="top"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://www.gnu.org/software/emacs/manual/html_node/emacs/External-Lisp.html" target="_top"><code class="function">run-lisp</code></a></li><li class="listitem"><a class="ulink" href="http://common-lisp.net/project/slime/" target="_top">SLIME</a></li><li class="listitem"><a class="ulink" href="http://sourceforge.net/projects/ilisp/" target="_top">ILISP</a></li><li class="listitem"><a class="ulink" href="http://cl-cookbook.sourceforge.net/windows.html" target="_top">The Common Lisp Cookbook</a></li></ul></div></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>non-<a class="ulink" href="http://www.gnu.org/software/emacs/" target="_top">Emacs</a>-based</strong></p></td><td align="left" valign="top"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="" href="http://www.google.com/search?q=VisualCLisp">VisualCLisp</a></li><li class="listitem"><a class="ulink" href="http://jabberwocky.sourceforge.net/" target="_top">Jabberwocky</a></li><li class="listitem"><a class="ulink" href="http://gclisp.sourceforge.net/" target="_top">GClisp</a></li><li class="listitem"><a class="ulink" href="http://common-lisp.net/project/phemlock/" target="_top">Portable Hemlock</a></li></ul></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-opt"></a><a id="faq-opt-q"></a><p><strong>A.2.3.</strong></p></td><td align="left" valign="top"><p>What are the
command line arguments?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See <a href="clisp.html#clisp" class="olink"><span class="refentrytitle">clisp</span>(1)</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-debugger"></a><a id="faq-debugger-q"></a><p><strong>A.2.4.</strong></p></td><td align="left" valign="top"><p>How
do I get out of the debugger?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See <a class="xref" href="#repl" title="25.1. Top Level Loop sec_25-1-1">Section 25.1, “Top Level Loop sec_25-1-1”</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-ext"></a><a id="faq-ext-q"></a><p><strong>A.2.5.</strong></p></td><td align="left" valign="top"><p>What <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
extensions are available?</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>bundled</strong></p></td><td align="left" valign="top"><p>Quite a few modules are
<a class="link" href="#included-modules" title="32.2.9. Modules included in the source distribution">included</a> with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>,
pass <code class="option">--with-module=...</code> to <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a>
to build them and see <a class="xref" href="#faq-modules" title="A.2.7.">Q: A.2.7</a>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>3rd party</strong></p></td><td align="left" valign="top"><p>See the <span class="emphasis"><em>incomplete</em></span> list of
<a class="ulink" href="http://clisp.org/resources.html#software" target="_top">Common
Lisp software running in <span class="command"><strong>CLISP</strong></span></a>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong><acronym class="acronym" title="Do It Yourself">DIY</acronym></strong></p></td><td align="left" valign="top"><p>See <a class="xref" href="#modules" title="32.2. External Modules">Section 32.2, “External Modules”</a> and <a class="xref" href="#dffi" title="32.3. The Foreign Function Call Facility">Section 32.3, “The Foreign Function Call Facility”</a>
for information on how to interface with external <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a> libraries.
</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong><a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a></strong></p></td><td align="left" valign="top"><div class="itemizedlist"><p class="title"><strong>Very Frequently Asked!</strong></p><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> comes with
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/src/inspect.lisp"><code class="filename">src/inspect.lisp</code></a>
which implements a rudimentary <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> server</li><li class="listitem"><a class="ulink" href="http://clocc.sourceforge.net/clocc/src/donc/http.lisp" target="_top">CLOCC/src/donc/</a> has an <a class="ulink" href="http://www.w3.org/Protocols/" target="_top"><span class="command"><strong>HTTP</strong></span></a> server</li><li class="listitem"><a class="ulink" href="http://clocc.sourceforge.net/clocc/src/cllib/url.lisp" target="_top">CLOCC/src/cllib/</a> handles URLs</li><li class="listitem"><a class="ulink" href="http://www.cliki.net/mod_lisp" target="_top">mod_lisp</a>
hooks lisp into <a class="ulink" href="http://www.apache.org/" target="_top">Apache</a></li></ul></div><p>Both <a class="ulink" href="http://allegroserve.sourceforge.net/" target="_top">AllegroServe</a>
and <a class="ulink" href="https://en.wikipedia.org/wiki/CL-HTTP" target="_top">CL-HTTP</a>
require <a class="link" href="#mt" title="32.5. Multiple Threads of Execution">multithreading</a> and do not work
with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> yet.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-rc"></a><a id="faq-rc-q"></a><p><strong>A.2.6.</strong></p></td><td align="left" valign="top"><p>Where is the
init (<span class="quote">“<span class="quote">RC</span>”</span>) file on my platform?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Read the file <code class="filename"><clisp.html#opt-norc></code>
in your build directory or binary distribution (this is the version of
the user manual <a href="clisp.html#clisp" class="olink"><span class="refentrytitle">clisp</span>(1)</a> for your platform).</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-modules"></a><a id="faq-modules-q"></a><p><strong>A.2.7.</strong></p></td><td align="left" valign="top"><p>Where
are the modules with which I built <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>In the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a>. Run <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> like this:
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> full</pre><p>Unless your <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> was configured with option <code class="option"><a href="impnotes.html#mod-dynload" class="olink">--without-dynamic-modules</a></code>, you
should instead use <code class="code">(<a href="impnotes.html#require" class="olink"><code class="function">REQUIRE</code></a> <em class="replaceable"><code>name</code></em>)</code> where <em class="replaceable"><code>name</code></em> is
a <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_string.html" target="_top"><code class="classname">STRING</code></a>, e.g., <span class="quote">“<span class="quote"><span class="module"><a class="filename" href="#rawsock" title="33.17. Raw Socket Access"><code class="filename">rawsock</code></a></span></span>”</span>, or <span class="quote">“<span class="quote">clx</span>”</span>
(for either <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/new-clx/"><code class="filename">clx/new-clx</code></a></span> or <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/clx/mit-clx/"><code class="filename">clx/mit-clx</code></a></span>, whichever is installed),
or <span class="quote">“<span class="quote">linux</span>”</span> (for <span class="module"><a href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/modules/bindings/glibc/"><code class="filename">bindings/glibc</code></a></span>) etc.
This is more reliable because the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> may include many modules
which you do not need and, in fact, <span class="strong"><strong>cannot</strong></span> use because they require
external libraries not installed on your system.</p><p>Making <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> the default <a href="impnotes.html#linkset" class="olink">linking set</a> has some advantages:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Shared Library Hell</span></dt><dd>Avoid problems when a module requires a shared
library, and that shared library is not present (or is present but
with wrong version) on your system.</dd><dt><span class="term">Smaller Images Are Faster</span></dt><dd>Adding things to the heap increases working
set size causing a slowdown, which is especially important for
small to medium applications.</dd><dt><span class="term">Uniform User Experience</span></dt><dd>Composition of the <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>full</strong></span></a> <a href="impnotes.html#linkset" class="olink">linking set</a> is up to the
packager, while <a href="impnotes.html#base-modules" class="olink"><span class="command"><strong>base</strong></span></a> is the same on all platforms.
</dd></dl></div><p>See <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a> for more information
(<a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/8691"><code>Gmane/general/8691</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/11678654/" target="_top">https://sourceforge.net/p/clisp/mailman/message/11678654/</a>).</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-gui"></a><a id="faq-gui-q"></a><p><strong>A.2.8.</strong></p></td><td align="left" valign="top"><p>How do I create
a <acronym class="acronym" title="Graphical User Interface">GUI</acronym>
for my <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> program?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Use module <span class="module"><a class="filename" href="#gtk" title="33.20. GTK Interface"><code class="filename">gtk2</code></a></span>: create <code class="filename">ui.glade</code>
with <a class="ulink" href="http://glade.gnome.org/" target="_top">Glade</a>, then do</p><pre class="screen">
<strong><code class="prompt">$</code></strong> ./configure --with-module=gtk2 --cbc build-gtk
<strong><code class="prompt">$</code></strong> ./build-gtk/clisp <code class="option"><a href="clisp.html#opt-link-set" class="olink">-K</a></code> full <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(gtk:run-glade-file "ui.glade")'</pre><p>There are many other options,
see <a class="ulink" href="http://clisp.org/resources.html#software" target="_top">"Common
Lisp software running in <span class="command"><strong>CLISP</strong></span>"</a>.</p></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq-delivery"></a>A.3. Application Delivery</h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.3.1. <a href="#faq-exec">How do I
create an executable file with all my code in it?</a></dt><dt>A.3.2. <a href="#faq-licensing">When
I deliver my application with CLISP, does it have to be covered by
the GNU GPL?</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-exec"></a><a id="faq-exec-q"></a><p><strong>A.3.1.</strong></p></td><td align="left" valign="top"><p>How do I
create an executable file with all my code in it?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Use <a href="impnotes.html#image" class="olink"><code class="function">EXT:SAVEINITMEM</code></a>, see also <a class="xref" href="#quickstart" title="32.6. Quickstarting delivery with CLISP">Section 32.6, “Quickstarting delivery with <span class="command"><strong>CLISP</strong></span>”</a>.
</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-licensing"></a><a id="faq-licensing-q"></a><p><strong>A.3.2.</strong></p></td><td align="left" valign="top"><p>When
I deliver my application with <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>, does it have to be covered by
the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Not necessarily.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> is <a class="ulink" href="http://www.gnu.org/philosophy/free-sw.html" target="_top">Free
Software</a>, covered by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>, with special
terms governing the distribution of applications that run in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
The precise terms can be found in the
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/COPYRIGHT"><code class="filename">COPYRIGHT</code></a>
file contained in the source and binary distributions of <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
Here is an informal clarification of what these terms mean in practice.
Please refer to the said <a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/COPYRIGHT"><code class="filename">COPYRIGHT</code></a>
file when in doubt.</p><p>In many cases, <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> does not force an application to be covered
by the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>. Nevertheless, we encourage you to release your software
under an open source license. The benefits of such a license for
your users are numerous, in particular they are free to modify the
application when their needs/requirements change, and they are free to
recompile the application when they upgrade their machine or operating
system.</p><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <span class="emphasis"><em>extensions</em></span>, i.e. programs which need
to access non-portable <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> internal symbols (in the packages
<a class="link" href="#sys-pac"><strong class="package"><span class="quote">“<span class="quote">SYSTEM</span>”</span></strong></a>, <a class="link" href="#classes" title="4.2. Classes sec_4-3"><strong class="package"><span class="quote">“<span class="quote">CLOS</span>”</span></strong></a>, <a class="link" href="#dffi" title="32.3. The Foreign Function Call Facility"><strong class="package"><span class="quote">“<span class="quote">FFI</span>”</span></strong></a>, etc), must be covered by <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>
as well.</p><p>Other programs running in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> have to or need not to be placed
under <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>, depending on their distribution form:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Programs distributed as Lisp source or <code class="filename">#P".fas"</code>
files can be distributed without restrictions coming from <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
</li><li class="listitem">Programs distributed as <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a href="impnotes.html#image" class="olink">memory image</a>s can be
distributed only if accompanied with the non-<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <code class="filename">#P".fas"</code> files
which make up the <a href="impnotes.html#image" class="olink">memory image</a>, and a <code class="filename">Makefile</code> (or clear textual
instructions) for rebuilding the <a href="impnotes.html#image" class="olink">memory image</a>.</li><li class="listitem">If you need to distribute a modified <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
executable (for example, incorporating additional <a href="impnotes.html#modules" class="olink">module</a>s written
in <a class="ulink" href="http://c-faq.com/" target="_top"><span class="command"><strong>C</strong></span></a>), you must distribute its full source under <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://www.gnu.org/copyleft/gpl.html" target="_top">GPL</a>.
If you are not satisfied with this, you can instead put the additional
<a href="impnotes.html#modules" class="olink">module</a>s into a separate (non-<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>) program, with which your Lisp
program will communicate via <a class="link" href="#socket" title="32.4. Socket Streams"><code class="classname">SOCKET:SOCKET-STREAM</code></a>s.</li></ul></div></td></tr><tr class="qandadiv"><td align="left" valign="top" colspan="2"><h3 class="title"><a id="faq-trouble"></a>A.4. Troubles</h3></td></tr><tr class="toc"><td align="left" valign="top" colspan="2"><dl><dt>A.4.1. <a href="#faq-bin-distrib">Where
is the binary distribution for my platform?</a></dt><dt>A.4.2. <a href="#faq-bin-distrib-prev">But a previous release had a binary
distribution for my platform, why does not the current one?</a></dt><dt>A.4.3. <a href="#faq-build">Why does not
CLISP build on my platform?</a></dt><dt>A.4.4. <a href="#faq-with-prefix">
Why is the --with-libsigsegv-prefix option ignored
by the configure script on my 64-bit machine?</a></dt><dt>A.4.5. <a href="#faq-enc-err">What do charset errors mean?</a></dt><dt>A.4.6. <a href="#faq-rl-tab">What does
this message mean: “Display all 1259
possibilities? (y or n)”</a></dt><dt>A.4.7. <a href="#faq-no-rl">Why does
not command line editing work?</a></dt><dt>A.4.8. <a href="#faq-stack">How do I
avoid stack overflow?</a></dt><dt>A.4.9. <a href="#faq-self-mod">Why does my function return different values on each
invocation and then hangs forever?</a></dt><dt>A.4.10. <a href="#faq-fp">Is floating point arithmetic broken?</a></dt><dt>A.4.11. <a href="#faq-random">Is RANDOM broken?</a></dt><dt>A.4.12. <a href="#faq-pp-newline">Why is an extra line break
inserted by the pretty printer?</a></dt><dt>A.4.13. <a href="#faq-warning">How do I disable this annoying
warning?</a></dt><dt>A.4.14. <a href="#faq-scope">Why does DEFVAR affect previously defined lexical closures?</a></dt><dt>A.4.15. <a href="#faq-bad-error">The error message is not helpful!</a></dt><dt>A.4.16. <a href="#faq-other-problem">Why is the function FOO
broken?!</a></dt></dl></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-bin-distrib"></a><a id="faq-bin-distrib-q"></a><p><strong>A.4.1.</strong></p></td><td align="left" valign="top"><p>Where
is the binary distribution for my platform?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>The <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> maintainers do not offer <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> binary
distributions, we believe that software packagers specializing on a
particular platform are in a better position to provide quality binaries.
Indeed, the section <span class="quote">“<span class="quote">Get CLISP</span>”</span> on the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>'s home
page points to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> packages for all major <a class="ulink" href="https://www.kernel.org/" target="_top"><span class="platform">Linux</span></a> and <a class="ulink" href="http://www.bsd.org/" target="_top"><span class="platform">*BSD</span></a>
variants.</p><p>The only exception is <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> for which there is no centralized
packager: <span class="emphasis"><em>usually</em></span>, after each <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> release,
a <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> user <span class="emphasis"><em>volunteers</em></span> to build a <a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a>
binary package, which we then distribute at
<a class="ulink" href="https://sourceforge.net/projects/clisp/files/" target="_top">https://sourceforge.net/projects/clisp/files/</a>.
</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-bin-distrib-prev"></a><a id="faq-bin-distrib-prev-q"></a><p><strong>A.4.2.</strong></p></td><td align="left" valign="top"><p>But a previous release <span class="emphasis"><em>had</em></span> a binary
distribution for my platform, why does not the current one?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>It was probably contributed by a user who did not (yet?)
contribute a binary distribution for the current release. You can
find out who contributed a specific binary distribution by looking at
the release notes in the <a class="ulink" href="https://sourceforge.net" target="_top">SourceForge</a>
<a class="ulink" href="https://sourceforge.net/projects/clisp/files/" target="_top">Files</a> section.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-build"></a><a id="faq-build-q"></a><p><strong>A.4.3.</strong></p></td><td align="left" valign="top"><p>Why does not
<a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> build on my platform?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Please see file
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/unix/PLATFORMS"><code class="filename">unix/PLATFORMS</code></a> in your source
distribution for information about some known troublesome platforms
as well as instructions on porting <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to new platforms.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-with-prefix"></a><a id="faq-with-prefix-q"></a><p><strong>A.4.4.</strong></p></td><td align="left" valign="top"><p>
Why is the <code class="option">--with-libsigsegv-prefix</code> option ignored
by the <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a> script on my 64-bit machine?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See a note on <span class="quote">“<span class="quote">bi-arch systems</span>”</span> in section 2 of
<a class="clisp-cvs" href="https://sourceforge.net/p/clisp/clisp/ci/tip/tree/unix/INSTALL"><code class="filename">unix/INSTALL</code></a> in your source distribution
(for the impatient: pass <code class="option">--libdir=='${exec_prefix}/lib64'</code>
to the <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://libsigsegv.sourceforge.net/" target="_top">libsigsegv</a> <a class="ulink" href="http://www.gnu.org/software/autoconf/" target="_top"><span class="command"><strong>configure</strong></span></a>).</p><p>See these threads which discuss the situation in depth:</p><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="ulink" href="http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/14565" target="_top">http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/14565</a>/<a class="ulink" href="https://lists.gnu.org/archive/html/bug-gnulib/2008-09/msg00070.html" target="_top">https://lists.gnu.org/archive/html/bug-gnulib/2008-09/msg00070.html</a></td></tr><tr><td><a class="ulink" href="http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/10827" target="_top">http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/10827</a>/<a class="ulink" href="http://lists.gnu.org/archive/html/autoconf/2008-09/msg00059.html" target="_top">http://lists.gnu.org/archive/html/autoconf/2008-09/msg00059.html</a></td></tr></table></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-enc-err"></a><a id="faq-enc-err-q"></a><p><strong>A.4.5.</strong></p></td><td align="left" valign="top"><p>What do these error messages
mean: <span class="quote">“<span class="quote"><code class="computeroutput">invalid byte #x94 in
CHARSET:ASCII conversion</code></span>”</span> and
<span class="quote">“<span class="quote"><code class="computeroutput">character #\u00B3 cannot be represented in the
character set CHARSET:ASCII</code></span>”</span>?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>This means that you are trying to read (<span class="quote">“<span class="quote">invalid
byte</span>”</span>) or write (<span class="quote">“<span class="quote">character cannot be represented</span>”</span>)
a non-<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> character from (or to) a character stream which has
<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a>. The default is described in
<a href="clisp.html#opt-enc" class="olink"><code class="option">-E<em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>encoding</code></em></code></a>.</p><p>This may also be caused by filesystem access.
If you have files with names incompatible with your <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a>,
filesystem access (e.g., <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a>) will <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_signal.html" target="_top"><code class="function">SIGNAL</code></a> this <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_error.html" target="_top"><code class="classname">ERROR</code></a>.
You will need to set <a href="impnotes.html#path-enc" class="olink"><code class="varname">CUSTOM:*PATHNAME-ENCODING*</code></a> or pass <code class="option"><a href="clisp.html#opt-enc" class="olink"><code class="option">-E<em class="replaceable"><code>domain</code></em> <em class="replaceable"><code>encoding</code></em></code></a></code> to <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
Using a <a class="link" href="#enc1-1" title="“1:1” encodings"><span class="quote">“<span class="quote">1:1</span>”</span> encoding</a>, such as <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a>,
should help you avoid this error.</p><p>Note that this error may be signaled by the <span class="quote">“<span class="quote">Print</span>”</span>
part of the <a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/sec_25-1-1.html">read-eval-print loop</a> and <span class="strong"><strong>not</strong></span> by the function you call.
E.g., if file <code class="filename">"foo"</code> contains non-<a class="ulink" href="https://en.wikipedia.org/wiki/ASCII" target="_top"><span class="platform">ASCII</span></a> characters,
you will see such an error when you type</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (s "foo" :direction :input <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> s))
</pre><p> If instead you type </p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_with-open-file.html" target="_top"><code class="function">WITH-OPEN-FILE</code></a> (s "foo" :direction :input <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <a class="link" href="#charset-UTF-16"><code class="constant">CHARSET:ISO-8859-1</code></a>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> l (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_read-line.html" target="_top"><code class="function">READ-LINE</code></a> s))
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>)
</pre><p> <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> will just print <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a> and signal the error
when you type <code class="literal">l</code>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-rl-tab"></a><a id="faq-rl-tab-q"></a><p><strong>A.4.6.</strong></p></td><td align="left" valign="top"><p>What does
this message mean: <span class="quote">“<span class="quote"><code class="computeroutput">Display all 1259
possibilities? (y or n)</code></span>”</span></p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> uses <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://tiswww.case.edu/php/chet/readline/readline.html" target="_top">readline</a> for command line editing and
<a href="clisp.html#completion" class="olink">completion</a>.
You get this <span class="quote">“<span class="quote">Display all 1259 possibilities</span>”</span> message
(and sometimes many screens of symbols) when you
hit <span class="keycode">TAB</span> too many times in an inappropriate place.
<a href="clisp.html#opt-ilisp" class="olink">You can turn this feature
off</a> if you are using <a class="ulink" href="http://www.gnu.org/software/emacs/" target="_top">Emacs</a>. It is a good idea
<a class="ulink" href="http://www.w3.org/MarkUp/html3/literal.html" target="_top">not</a> to
use <span class="keycode">TAB</span>s in your code.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-no-rl"></a><a id="faq-no-rl-q"></a><p><strong>A.4.7.</strong></p></td><td align="left" valign="top"><p>Why does
not command line editing work?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See <a class="xref" href="#readline" title="21.2.1. Command line editing with GNU readline">Section 21.2.1, “Command line editing with GNU readline”</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-stack"></a><a id="faq-stack-q"></a><p><strong>A.4.8.</strong></p></td><td align="left" valign="top"><p>How do I
avoid stack overflow?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> has <a class="link" href="#vm" title="37.2. The virtual machine"><span class="emphasis"><em>two</em></span>
stacks</a>, the <span class="quote">“<span class="quote">program stack</span>”</span> and the <span class="quote">“<span class="quote">lisp
stack</span>”</span>, and both may occasionally overflow.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Generic</strong></p></td><td align="left" valign="top"><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">You will always get a stack overflow when you try
to print a <a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#circular">circular</a> object (<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_list.html" target="_top"><code class="classname">LIST</code></a>,
<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/cla_structure-object.html" target="_top"><code class="classname">STRUCTURE-OBJECT</code></a>, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_vector.html" target="_top"><code class="classname">VECTOR</code></a> etc) and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> is <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_nil.html" target="_top"><code class="constant">NIL</code></a>.
Just set <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> to <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>.</li><li class="listitem">You will always get a stack overflow on infinite
recursion.</li><li class="listitem">Some simple functions (like
<a class="ulink" href="http://en.wikipedia.org/wiki/Ackermann_function" target="_top">Ackermann's</a>)
recurse more than you might expect and can run out of stack on
relatively small inputs.</li><li class="listitem">Compiled code uses less stack (and memory) and is
faster.</li><li class="listitem">If you really do need more Lisp stack, you can
increase it by telling <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> to pre-allocate more memory using
<code class="option"><a href="clisp.html#opt-memsize" class="olink">-m</a></code> or <a class="link" href="#make-thread"><code class="function">MT:MAKE-THREAD</code></a>.</li><li class="listitem">If you get a segmentation fault after (or instead
of) a <span class="quote">“<span class="quote">program stack overflow</span>”</span> message, please make
sure that you had <a class="ulink" href="https://www.gnu.org" target="_top">GNU</a> <a class="ulink" href="http://libsigsegv.sourceforge.net/" target="_top">libsigsegv</a> installed when you configured and
built <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.</li></ul></div></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Specific</strong></p></td><td align="left" valign="top"><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://winehq.org/" target="_top"><span class="platform">Win32</span></a> platform only.</span></span></span></dt><dd><p>You have several option, use whichever is applicable
to your situation:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">modify the
global <code class="filename">SYSTEM.INI</code></li><li class="listitem">modify the <code class="filename">PIF</code>
that you use to invoke <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
(<a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/4656"><code>Gmane/general/4656</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/9033347/" target="_top">https://sourceforge.net/p/clisp/mailman/message/9033347/</a>)</li><li class="listitem">or set the program stack (of the run
times <span class="command"><strong>base/lisp.exe</strong></span> or
<span class="command"><strong>full/lisp.exe</strong></span>, <span class="strong"><strong>not</strong></span> the driver
<span class="command"><strong>clisp.exe</strong></span>) using <span class="command"><strong>editbin</strong></span>
(<a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/5523"><code>Gmane/general/5523</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/9033144/" target="_top">https://sourceforge.net/p/clisp/mailman/message/9033144/</a>); you can find the
current stack size using <span class="command"><strong>dumpbin</strong></span>.
</li></ul></div></dd><dt><span class="term"><span class="plat-dep">Platform Dependent: <span class="plat-dep"><a class="ulink" href="http://www.unix.org/online.html" target="_top"><span class="strong"><strong>UNIX</strong></span></a> platform only.</span></span></span></dt><dd>Increase program stack with <span class="command"><strong>ulimit
-s</strong></span> (or <span class="command"><strong>limit stacksize</strong></span> if you are using
<a class="ulink" href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/" target="_top"><code class="literal">csh</code></a>) to at least 8 MB.
</dd></dl></div></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-self-mod"></a><a id="faq-self-mod-q"></a><p><strong>A.4.9.</strong></p></td><td align="left" valign="top"><p>Why does my function return different values on each
invocation and then hangs forever?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>The following code modifies itself:
</p><pre class="programlisting">(defun my-func ()<strong> ; </strong><em class="lineannotation"><span class="lineannotation">modifies internal data!</span></em>
(let ((var '(a b c)))
(nconc var '(1 2 3))))</pre><p>
and will not work as one would naively expect:</p><pre class="programlisting">
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stprint-circlest.html" target="_top"><code class="varname">*PRINT-CIRCLE*</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_t.html" target="_top"><code class="constant">T</code></a>)
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> #'my-func)
⇒ <code class="computeroutput">(LAMBDA NIL (DECLARE (SYSTEM::IN-DEFUN MY-FUNC))
(BLOCK MY-FUNC (LET ((VAR '(A B C))) (NCONC VAR '(1 2 3)))))</code>
(my-func)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">the first invocation</span></em>
⇒ <code class="computeroutput">(a b c 1 2 3)</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">modifies the internal data:</span></em>
(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> #'my-func)
⇒ <code class="computeroutput">(LAMBDA NIL (DECLARE (SYSTEM::IN-DEFUN MY-FUNC))
(BLOCK MY-FUNC (LET ((VAR '(A B C . #1=(1 2 3)))) (NCONC VAR '#1#))))</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">note shared structure!</span></em>
(my-func)
⇒ <code class="computeroutput">(A B C . #1=(1 2 3 . #1#))</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation"><a class="" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/glo_c.html#circular_list">circular list</a>!</span></em>
(function-lambda-expression #'my-func )
⇒ <code class="computeroutput">(LAMBDA NIL (DECLARE (SYSTEM::IN-DEFUN MY-FUNC))
(BLOCK MY-FUNC (LET ((VAR '(A B C . #1=(1 2 3 . #1#)))) (NCONC VAR '#1#))))</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">note circular value of var</span></em>
(my-func)<strong> ; </strong><em class="lineannotation"><span class="lineannotation">hangs because <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_nconc.html" target="_top"><code class="function">NCONC</code></a> cannot handle a circular argument</span></em></pre><p>Instead you must do
</p><pre class="programlisting">(defun my-func ()
(let ((var (copy-list '(a b c))))
(nconc var (copy-list '(1 2 3)))))</pre><p><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a> will show the constants in your compiled functions
(see <a class="xref" href="#bytecode" title="Chapter 37. The CLISP bytecode specification">Chapter 37, <em>The <span class="command"><strong>CLISP</strong></span> bytecode specification</em></a> for the explanation of the <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_disassemble.html" target="_top"><code class="function">DISASSEMBLE</code></a>
output.) As you see above, <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_function-_a-expression.html" target="_top"><code class="function">FUNCTION-LAMBDA-EXPRESSION</code></a> works for the
interpreted ones.</p><p>See <a class="ulink" href="http://norvig.com/luv-slides.ps" target="_top">Lisp Programming
Style</a> for more useful information.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-fp"></a><a id="faq-fp-q"></a><p><strong>A.4.10.</strong></p></td><td align="left" valign="top"><p>Why don't floating point arithmetic
return what I want?</p><pre class="programlisting">
(- 1.1 0.9)
⇒ <code class="computeroutput">0.20000005</code>
</pre></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>inexact</strong></p></td><td align="left" valign="top"><p>Floating point arithmetic is
inherently <span class="emphasis"><em>inexact</em></span>, so this <span class="strong"><strong>not</strong></span> a bug,
at least not a bug in <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>.
You may argue that this is a bug in <a class="ulink" href="http://grouper.ieee.org/groups/754/" target="_top">IEEE 754</a>,
but, before you do, please make sure that you do know
<a class="ulink" href="http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html" target="_top">What
Every Computer Scientist Should Know About Floating-Point Arithmetic</a>
(or are at least familiar with the
<a class="ulink" href="http://floating-point-gui.de/" target="_top">light version</a> thereof).
</p><p>See also <a class="" href="https://sourceforge.net/p/clisp/mailman/clisp-list/">clisp-list</a>
(<a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/9850"><code>Gmane/general/9850</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/12275968/" target="_top">https://sourceforge.net/p/clisp/mailman/message/12275968/</a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/12275958/" target="_top">https://sourceforge.net/p/clisp/mailman/message/12275958/</a>).</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>exact</strong></p></td><td align="left" valign="top"><p>If you want <span class="emphasis"><em>exact</em></span>
calculations, use <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_rational.html" target="_top"><code class="classname">RATIONAL</code></a>s:</p><pre class="programlisting">
(- 11/10 9/10)
⇒ <code class="computeroutput">1/5</code></pre><p>
</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-random"></a><a id="faq-random-q"></a><p><strong>A.4.11.</strong></p></td><td align="left" valign="top"><p>Why does
</p><pre class="screen"><strong><code class="prompt">$</code></strong> <span class="command"><strong><a href="clisp.html#clisp" class="olink">clisp</a></strong></span> <code class="option"><a href="clisp.html#opt-exec-expr" class="olink">-x</a></code> '(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_random.html" target="_top"><code class="function">RANDOM</code></a> 1s0)'</pre><p>
always print the same number?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Reproducibility is important.
See <a class="xref" href="#random-state" title="12.2.7. Random-State Operations sec_12-1-7">Section 12.2.7, “Random-State Operations sec_12-1-7”</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-pp-newline"></a><a id="faq-pp-newline-q"></a><p><strong>A.4.12.</strong></p></td><td align="left" valign="top"><p>Why is an extra line break
inserted by the pretty printer?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>See <a class="xref" href="#ppr-first-newline" title="Variable CUSTOM:*PPRINT-FIRST-NEWLINE*">the section called “Variable <code class="varname">CUSTOM:*PPRINT-FIRST-NEWLINE*</code>”</a>.</p><p>For example, here you are pretty-printing two objects: a
one-liner <span class="keysym">#\Q</span> and a two-liner <span class="keycode">CR</span>+<span class="keycode">LF</span>,
and a line break is inserted between them so that they are printed on
separate lines: </p><pre class="programlisting">
(defparameter crlf (coerce '(#\Return #\Linefeed) 'string))
⇒ <code class="computeroutput">CRLF</code>
(map 'list #'char-code (format nil "Q~a" crlf))
⇒ <code class="computeroutput">(81 10 13 10)</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">not (81 13 10) !</span></em>
</pre><p>When you want <span class="keycode">CR</span>+<span class="keycode">LF</span>-terminated lines, use <a class="link" href="#extfmt"><code class="constant">:EXTERNAL-FORMAT</code></a> <code class="constant">:DOS</code>
argument when opening your <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/syscla_stream.html" target="_top"><code class="classname">STREAM</code></a>s.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-warning"></a><a id="faq-warning-q"></a><p><strong>A.4.13.</strong></p></td><td align="left" valign="top"><p>How do I disable this annoying
warning?</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p><a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> often issues <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>s when it encounters
suspicious behavior. It is best to fix your code rather than to
suppress them. To figure out where the warning is coming from, do
<code class="code">(<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/spefor_setq.html" target="_top"><code class="function">SETQ</code></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/var_stbreak-on-signalsst.html" target="_top"><code class="varname">*BREAK-ON-SIGNALS*</code></a> '<a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/contyp_warning.html" target="_top"><code class="classname">WARNING</code></a>)</code> and examine
the stack in the <a class="link" href="#debugger" title="25.2. Debugging Utilities sec_25-1-2">debugger</a> to see where the warning is coming from.</p><p>If everything else fails, read the
<a class="link" href="#impnotes-top" title="Implementation Notes for GNU CLISP">manual</a>.</p></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-scope"></a><a id="faq-scope-q"></a><p><strong>A.4.14.</strong></p></td><td align="left" valign="top"><p>Why does <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> affect previously defined lexical closures?</p><pre class="programlisting">
(defun adder (val) (lambda (x) (+ x val)))
⇒ <code class="computeroutput">ADDER</code>
(setq add-10 (adder 10))
⇒ <code class="computeroutput">ADD-10</code>
(funcall add-10 32)
⇒ <code class="computeroutput">42</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">as expected</span></em>
(defvar val 12)
⇒ <code class="computeroutput">VAL</code>
(funcall add-10 0)
⇒ <code class="computeroutput">12</code><strong> ; </strong><em class="lineannotation"><span class="lineannotation">why not 10?!</span></em>
</pre></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Explanation</strong></p></td><td align="left" valign="top"><p>The above code does not conform to [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], therefore <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a>
can produce arbitrary results.
See <a class="xref" href="#semantic-constraints" title="3.2.2.3. Semantic Constraints sec_3-2-2-3">Section 3.2.2.3, “Semantic Constraints sec_3-2-2-3”</a>.</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>Remedy</strong></p></td><td align="left" valign="top"><p>Always follow the naming convention for global special variables
defined by <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFVAR</code></a> and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defparametercm_defvar.html" target="_top"><code class="function">DEFPARAMETER</code></a> (e.g., <code class="varname">*FOO*</code>)
and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_defconstant.html" target="_top"><code class="function">DEFCONSTANT</code></a> (e.g., <code class="varname">+BAR+</code>).</p></td></tr><tr class="answer"><td align="left" valign="top"><p><strong>More</strong></p></td><td align="left" valign="top"><table border="0" summary="Simple list" class="simplelist"><tr><td><a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/11945"><code>Gmane/general/11945</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/13174197/" target="_top">https://sourceforge.net/p/clisp/mailman/message/13174197/</a></td></tr><tr><td><a class="gmane" href="http://article.gmane.org/gmane.lisp.clisp.general/11949"><code>Gmane/general/11949</code></a>/<a class="ulink" href="https://sourceforge.net/p/clisp/mailman/message/13174204/" target="_top">https://sourceforge.net/p/clisp/mailman/message/13174204/</a></td></tr></table></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-bad-error"></a><a id="faq-bad-error-q"></a><p><strong>A.4.15.</strong></p></td><td align="left" valign="top"><p>The error message is not helpful!</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>Sometimes an error message contains a compound object
whose content you want to examine. Often this object will be available
for <a class="link" href="#inspect" title="25.2.7. Function INSPECT"><code class="function">INSPECT</code></a>ion via the <span class="command"><strong>Inspect</strong></span> command (see
<a class="xref" href="#debugger-deb-step-1" title="Table 25.3. Commands common to the debugger and the stepper">Table 25.3, “Commands common to the debugger and the stepper”</a>). E.g., </p><pre class="screen">
*** - READ: input stream #<INPUT STRING-INPUT-STREAM> ends within an object
The following restarts are available:
ABORT :R1 ABORT
<strong><code class="prompt">Break 4 [1]></code></strong> <big><strong class="userinput"><code>:i</code></strong></big>
#<SYSTEM::SIMPLE-END-OF-FILE #x000333CB82F8>: standard object
type: SYSTEM::SIMPLE-END-OF-FILE
0 [$STREAM]: #<INPUT STRING-INPUT-STREAM>
1 [$FORMAT-CONTROL]:
"~S: input stream ~S ends within an object
"
2 [$FORMAT-ARGUMENTS]: (READ #<INPUT STRING-INPUT-STREAM>)
<strong><code class="prompt">INSPECT-- type :h for help; :q to return to the REPL ---></code></strong> <big><strong class="userinput"><code>0</code></strong></big>
#<INPUT STRING-INPUT-STREAM>: atom
type: STRING-STREAM
class: #1=#<BUILT-IN-CLASS STRING-STREAM>
<strong><code class="prompt">INSPECT-- type :h for help; :q to return to the REPL ---></code></strong> <big><strong class="userinput"><code>:d</code></strong></big>
#<INPUT STRING-INPUT-STREAM> is an input-stream. It reads from "(foo" from 0 to 4 at 4.
</pre></td></tr><tr class="question"><td align="left" valign="top"><a id="faq-other-problem"></a><a id="faq-other-problem-q"></a><p><strong>A.4.16.</strong></p></td><td align="left" valign="top"><p>Why is the function <code class="function">FOO</code>
broken?!</p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p>When confronted with unexpected behavior,
try looking in the <a class="xref" href="#impnotes-top" title="Implementation Notes for GNU CLISP"><span class="command"><strong>CLISP</strong></span> impnotes</a>.</p><p>E.g., <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> is different from the <a class="ulink" href="http://www.cons.org/cmucl/" target="_top"><span class="command"><strong>CMU CL</strong></span></a>
implementation, so, to find out how to get the results you want,
you should search the <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> implementation notes for "DIRECTORY".</p><p>Alternatively, since the implementation notes are organized in
parallel to the [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>], and <a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_directory.html" target="_top"><code class="function">DIRECTORY</code></a> belongs to the
<a class="clhs" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/chap-20.html">Chapter 20</a> in [<span class="citation"><a class="link" href="#ansi-cl" title="ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)]">ANSI CL standard</a></span>],
you can just go to <a class="xref" href="#files" title="Chapter 20. Files chap-20">Chapter 20, <em>Files chap-20</em></a> in impnotes and look
for "DIRECTORY" <a class="link" href="#directory" title="20.3.2. Function DIRECTORY">there</a>.
</p></td></tr></tbody></table></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="fdl"></a>Appendix B. GNU Free Documentation License</h2></div></div></div><p>Version 1.3, 3 November 2008</p><p>
Copyright © 2000, 2001, 2002, 2007, 2008
<a class="ulink" href="https://www.fsf.org/" target="_top">Free Software Foundation, Inc.</a>
</p><p>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
</p><h3><a id="section0"></a>
0. PREAMBLE
</h3><p>
The purpose of this License is to make a manual, textbook, or other
functional and useful document “free” in the sense of freedom:
to assure everyone the effective freedom to copy and redistribute it, with
or without modifying it, either commercially or
noncommercially. Secondarily, this License preserves for the author and
publisher a way to get credit for their work, while not being considered
responsible for modifications made by others.
</p><p>
This License is a kind of “copyleft”, which means that
derivative works of the document must themselves be free in the same
sense. It complements the GNU General Public License, which is a copyleft
license designed for free software.
</p><p>
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free program
should come with manuals providing the same freedoms that the software
does. But this License is not limited to software manuals; it can be used
for any textual work, regardless of subject matter or whether it is
published as a printed book. We recommend this License principally for
works whose purpose is instruction or reference.
</p><h3><a id="section1"></a>
1. APPLICABILITY AND DEFINITIONS
</h3><p>
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that work
under the conditions stated herein. The “Document”, below,
refers to any such manual or work. Any member of the public is a licensee,
and is addressed as “you”. You accept the license if you copy,
modify or distribute the work in a way requiring permission under
copyright law.
</p><p>
A “Modified Version” of the Document means any work containing
the Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
</p><p>
A “Secondary Section” is a named appendix or a front-matter
section of the Document that deals exclusively with the relationship of
the publishers or authors of the Document to the Document’s overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical connection
with the subject or with related matters, or of legal, commercial,
philosophical, ethical or political position regarding them.
</p><p>
The “Invariant Sections” are certain Secondary Sections whose
titles are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a section
does not fit the above definition of Secondary then it is not allowed to
be designated as Invariant. The Document may contain zero Invariant
Sections. If the Document does not identify any Invariant Sections then
there are none.
</p><p>
The “Cover Texts” are certain short passages of text that are
listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says
that the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
</p><p>
A “Transparent” copy of the Document means a machine-readable
copy, represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or for
automatic translation to a variety of formats suitable for input to text
formatters. A copy made in an otherwise Transparent file format whose
markup, or absence of markup, has been arranged to thwart or discourage
subsequent modification by readers is not Transparent. An image format is
not Transparent if used for any substantial amount of text. A copy that is
not “Transparent” is called “Opaque”.
</p><p>
Examples of suitable formats for Transparent copies include plain ASCII
without markup, Texinfo input format, LaTeX input format, SGML or XML
using a publicly available DTD, and standard-conforming simple HTML,
PostScript or PDF designed for human modification. Examples of transparent
image formats include PNG, XCF and JPG. Opaque formats include proprietary
formats that can be read and edited only by proprietary word processors,
SGML or XML for which the DTD and/or processing tools are not generally
available, and the machine-generated HTML, PostScript or PDF produced by
some word processors for output purposes only.
</p><p>
The “Title Page” means, for a printed book, the title page
itself, plus such following pages as are needed to hold, legibly, the
material this License requires to appear in the title page. For works in
formats which do not have any title page as such, “Title Page”
means the text near the most prominent appearance of the work’s
title, preceding the beginning of the body of the text.
</p><p>
The “publisher” means any person or entity that distributes
copies of the Document to the public.
</p><p>
A section “Entitled XYZ” means a named subunit of the Document
whose title either is precisely XYZ or contains XYZ in parentheses
following text that translates XYZ in another language. (Here XYZ stands
for a specific section name mentioned below, such as
“Acknowledgements”, “Dedications”,
“Endorsements”, or “History”.) To “Preserve
the Title” of such a section when you modify the Document means that
it remains a section “Entitled XYZ” according to this
definition.
</p><p>
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this License,
but only as regards disclaiming warranties: any other implication that
these Warranty Disclaimers may have is void and has no effect on the
meaning of this License.
</p><h3><a id="section2"></a>
2. VERBATIM COPYING
</h3><p>
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the copyright
notices, and the license notice saying this License applies to the
Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use technical
measures to obstruct or control the reading or further copying of the
copies you make or distribute. However, you may accept compensation in
exchange for copies. If you distribute a large enough number of copies you
must also follow the conditions in section 3.
</p><p>
You may also lend copies, under the same conditions stated above, and you
may publicly display copies.
</p><h3><a id="section3"></a>
3. COPYING IN QUANTITY
</h3><p>
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document’s license notice requires Cover Texts, you must enclose
the copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the
back cover. Both covers must also clearly and legibly identify you as the
publisher of these copies. The front cover must present the full title
with all words of the title equally prominent and visible. You may add
other material on the covers in addition. Copying with changes limited to
the covers, as long as they preserve the title of the Document and satisfy
these conditions, can be treated as verbatim copying in other respects.
</p><p>
If the required texts for either cover are too voluminous to fit legibly,
you should put the first ones listed (as many as fit reasonably) on the
actual cover, and continue the rest onto adjacent pages.
</p><p>
If you publish or distribute Opaque copies of the Document numbering more
than 100, you must either include a machine-readable Transparent copy
along with each Opaque copy, or state in or with each Opaque copy a
computer-network location from which the general network-using public has
access to download using public-standard network protocols a complete
Transparent copy of the Document, free of added material. If you use the
latter option, you must take reasonably prudent steps, when you begin
distribution of Opaque copies in quantity, to ensure that this Transparent
copy will remain thus accessible at the stated location until at least one
year after the last time you distribute an Opaque copy (directly or
through your agents or retailers) of that edition to the public.
</p><p>
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
</p><h3><a id="section4"></a>
4. MODIFICATIONS
</h3><p>
You may copy and distribute a Modified Version of the Document under the
conditions of sections 2 and 3 above, provided that you release the
Modified Version under precisely this License, with the Modified Version
filling the role of the Document, thus licensing distribution and
modification of the Modified Version to whoever possesses a copy of it. In
addition, you must do these things in the Modified Version:
</p><div class="orderedlist"><ol class="orderedlist" type="A"><li class="listitem">
Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions (which
should, if there were any, be listed in the History section of the
Document). You may use the same title as a previous version if the
original publisher of that version gives permission.
</li><li class="listitem">
List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
</li><li class="listitem">
State on the Title page the name of the publisher of the Modified
Version, as the publisher.
</li><li class="listitem">
Preserve all the copyright notices of the Document.
</li><li class="listitem">
Add an appropriate copyright notice for your modifications adjacent to
the other copyright notices.
</li><li class="listitem">
Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
</li><li class="listitem">
Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document’s license
notice.
</li><li class="listitem">
Include an unaltered copy of this License.
</li><li class="listitem">
Preserve the section Entitled “History”, Preserve its
Title, and add to it an item stating at least the title, year, new
authors, and publisher of the Modified Version as given on the Title
Page. If there is no section Entitled “History” in the
Document, create one stating the title, year, authors, and publisher
of the Document as given on its Title Page, then add an item
describing the Modified Version as stated in the previous sentence.
</li><li class="listitem">
Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise the
network locations given in the Document for previous versions it was
based on. These may be placed in the “History”
section. You may omit a network location for a work that was published
at least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
</li><li class="listitem">
For any section Entitled “Acknowledgements” or
“Dedications”, Preserve the Title of the section, and
preserve in the section all the substance and tone of each of the
contributor acknowledgements and/or dedications given therein.
</li><li class="listitem">
Preserve all the Invariant Sections of the Document, unaltered in
their text and in their titles. Section numbers or the equivalent are
not considered part of the section titles.
</li><li class="listitem">
Delete any section Entitled “Endorsements”. Such a section
may not be included in the Modified Version.
</li><li class="listitem">
Do not retitle any existing section to be Entitled
“Endorsements” or to conflict in title with any Invariant
Section.
</li><li class="listitem">
Preserve any Warranty Disclaimers.
</li></ol></div><p>
If the Modified Version includes new front-matter sections or appendices
that qualify as Secondary Sections and contain no material copied from the
Document, you may at your option designate some or all of these sections
as invariant. To do this, add their titles to the list of Invariant
Sections in the Modified Version’s license notice. These titles
must be distinct from any other section titles.
</p><p>
You may add a section Entitled “Endorsements”, provided it
contains nothing but endorsements of your Modified Version by various
parties — for example, statements of peer review or that the text
has been approved by an organization as the authoritative definition of a
standard.
</p><p>
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list of
Cover Texts in the Modified Version. Only one passage of Front-Cover Text
and one of Back-Cover Text may be added by (or through arrangements made
by) any one entity. If the Document already includes a cover text for the
same cover, previously added by you or by arrangement made by the same
entity you are acting on behalf of, you may not add another; but you may
replace the old one, on explicit permission from the previous publisher
that added the old one.
</p><p>
The author(s) and publisher(s) of the Document do not by this License give
permission to use their names for publicity for or to assert or imply
endorsement of any Modified Version.
</p><h3><a id="section5"></a>
5. COMBINING DOCUMENTS
</h3><p>
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified versions,
provided that you include in the combination all of the Invariant Sections
of all of the original documents, unmodified, and list them all as
Invariant Sections of your combined work in its license notice, and that
you preserve all their Warranty Disclaimers.
</p><p>
The combined work need only contain one copy of this License, and multiple
identical Invariant Sections may be replaced with a single copy. If there
are multiple Invariant Sections with the same name but different contents,
make the title of each such section unique by adding at the end of it, in
parentheses, the name of the original author or publisher of that section
if known, or else a unique number. Make the same adjustment to the section
titles in the list of Invariant Sections in the license notice of the
combined work.
</p><p>
In the combination, you must combine any sections Entitled
“History” in the various original documents, forming one
section Entitled “History”; likewise combine any sections
Entitled “Acknowledgements”, and any sections Entitled
“Dedications”. You must delete all sections Entitled
“Endorsements”.
</p><h3><a id="section6"></a>
6. COLLECTIONS OF DOCUMENTS
</h3><p>
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
</p><p>
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all other
respects regarding verbatim copying of that document.
</p><h3><a id="section7"></a>
7. AGGREGATION WITH INDEPENDENT WORKS
</h3><p>
A compilation of the Document or its derivatives with other separate and
independent documents or works, in or on a volume of a storage or
distribution medium, is called an “aggregate” if the copyright
resulting from the compilation is not used to limit the legal rights of
the compilation’s users beyond what the individual works
permit. When the Document is included in an aggregate, this License does
not apply to the other works in the aggregate which are not themselves
derivative works of the Document.
</p><p>
If the Cover Text requirement of section 3 is applicable to these copies
of the Document, then if the Document is less than one half of the entire
aggregate, the Document’s Cover Texts may be placed on covers that
bracket the Document within the aggregate, or the electronic equivalent of
covers if the Document is in electronic form. Otherwise they must appear
on printed covers that bracket the whole aggregate.
</p><h3><a id="section8"></a>
8. TRANSLATION
</h3><p>
Translation is considered a kind of modification, so you may distribute
translations of the Document under the terms of section 4. Replacing
Invariant Sections with translations requires special permission from
their copyright holders, but you may include translations of some or all
Invariant Sections in addition to the original versions of these Invariant
Sections. You may include a translation of this License, and all the
license notices in the Document, and any Warranty Disclaimers, provided
that you also include the original English version of this License and the
original versions of those notices and disclaimers. In case of a
disagreement between the translation and the original version of this
License or a notice or disclaimer, the original version will prevail.
</p><p>
If a section in the Document is Entitled “Acknowledgements”,
“Dedications”, or “History”, the requirement
(section 4) to Preserve its Title (section 1) will typically require
changing the actual title.
</p><h3><a id="section9"></a>
9. TERMINATION
</h3><p>
You may not copy, modify, sublicense, or distribute the Document except as
expressly provided under this License. Any attempt otherwise to copy,
modify, sublicense, or distribute it is void, and will automatically
terminate your rights under this License.
</p><p>
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally, unless
and until the copyright holder explicitly and finally terminates your
license, and (b) permanently, if the copyright holder fails to notify you
of the violation by some reasonable means prior to 60 days after the
cessation.
</p><p>
Moreover, your license from a particular copyright holder is reinstated
permanently if the copyright holder notifies you of the violation by some
reasonable means, this is the first time you have received notice of
violation of this License (for any work) from that copyright holder, and
you cure the violation prior to 30 days after your receipt of the notice.
</p><p>
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under this
License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does not
give you any rights to use it.
</p><h3><a id="section10"></a>
10. FUTURE REVISIONS OF THIS LICENSE
</h3><p>
The Free Software Foundation may publish new, revised versions of the GNU
Free Documentation License from time to time. Such new versions will be
similar in spirit to the present version, but may differ in detail to
address new problems or concerns. See
<a class="ulink" href="https://www.gnu.org/licenses/" target="_top">https://www.gnu.org/licenses/</a>.
</p><p>
Each version of the License is given a distinguishing version number. If
the Document specifies that a particular numbered version of this License
“or any later version” applies to it, you have the option of
following the terms and conditions either of that specified version or of
any later version that has been published (not as a draft) by the Free
Software Foundation. If the Document does not specify a version number of
this License, you may choose any version ever published (not as a draft)
by the Free Software Foundation. If the Document specifies that a proxy
can decide which future versions of this License can be used, that
proxy’s public statement of acceptance of a version permanently
authorizes you to choose that version for the Document.
</p><h3><a id="section11"></a>
11. RELICENSING
</h3><p>
“Massive Multiauthor Collaboration Site” (or “MMC
Site”) means any World Wide Web server that publishes copyrightable
works and also provides prominent facilities for anybody to edit those
works. A public wiki that anybody can edit is an example of such a
server. A “Massive Multiauthor Collaboration” (or
“MMC”) contained in the site means any set of copyrightable
works thus published on the MMC site.
</p><p>
“CC-BY-SA” means the Creative Commons Attribution-Share Alike
3.0 license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license published
by that same organization.
</p><p>
“Incorporate” means to publish or republish a Document, in
whole or in part, as part of another Document.
</p><p>
An MMC is “eligible for relicensing” if it is licensed under
this License, and if all works that were first published under this
License somewhere other than this MMC, and subsequently incorporated in
whole or in part into the MMC, (1) had no cover texts or invariant
sections, and (2) were thus incorporated prior to November 1, 2008.
</p><p>
The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
</p><h3><a id="addendum"></a>
ADDENDUM: How to use this License for your documents
</h3><p>
To use this License in a document you have written, include a copy of the
License in the document and put the following copyright and license
notices just after the title page:
</p><pre class="screen">Copyright © YEAR YOUR NAME
Permission is granted to copy, distribute and/or modify this document under the
terms of the GNU Free Documentation License, Version 1.3 or any later version
published by the Free Software Foundation; with no Invariant Sections, no
Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in
the section entitled “GNU Free Documentation License”.</pre><p>
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the “with… Texts.” line with this:
</p><pre class="screen">with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts
being LIST, and with the Back-Cover Texts being LIST.</pre><p>
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
</p><p>
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of free
software license, such as the GNU General Public License, to permit their
use in free software.
</p></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a id="gpl"></a>Appendix C. GNU General Public License</h2></div><div><p class="releaseinfo">Version 2, June 1991</p></div><div><p class="copyright">Copyright © 1989, 1991 Free Software Foundation, Inc.</p></div><div><div class="legalnotice"><a id="gpl-legalnotice"></a><p>
</p><div class="address"><p>Free Software Foundation, Inc.<br />
<span class="street">51 Franklin Street, Fifth Floor</span>,<br />
<span class="city">Boston</span>, <span class="state">MA</span> <span class="postcode">02110-1301</span><br />
<span class="country">USA</span><br />
</p></div><p>
</p><p>Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.</p></div></div><div><p class="pubdate">Version 2, June 1991</p></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#gpl-1">C.1. Preamble</a></span></dt><dt><span class="section"><a href="#gpl-2">C.2. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></span></dt><dd><dl><dt><span class="section"><a href="#gpl-2-0">C.2.1. Section 0</a></span></dt><dt><span class="section"><a href="#gpl-2-1">C.2.2. Section 1</a></span></dt><dt><span class="section"><a href="#gpl-2-2">C.2.3. Section 2</a></span></dt><dt><span class="section"><a href="#gpl-2-3">C.2.4. Section 3</a></span></dt><dt><span class="section"><a href="#gpl-2-4">C.2.5. Section 4</a></span></dt><dt><span class="section"><a href="#gpl-2-5">C.2.6. Section 5</a></span></dt><dt><span class="section"><a href="#gpl-2-6">C.2.7. Section 6</a></span></dt><dt><span class="section"><a href="#gpl-2-7">C.2.8. Section 7</a></span></dt><dt><span class="section"><a href="#gpl-2-8">C.2.9. Section 8</a></span></dt><dt><span class="section"><a href="#gpl-2-9">C.2.10. Section 9</a></span></dt><dt><span class="section"><a href="#gpl-2-10">C.2.11. Section 10</a></span></dt><dt><span class="section"><a href="#gpl-2-11">C.2.12. NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="#gpl-2-12">C.2.13. Section 12</a></span></dt></dl></dd><dt><span class="section"><a href="#gpl-3">C.3. How to Apply These Terms to Your New Programs</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gpl-1"></a>C.1. Preamble</h2></div></div></div><p>The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public License is
intended to guarantee your freedom to share and change
free software - to make sure the software is free for all its users.
This General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit
to using it. (Some other Free Software Foundation software is covered
by the GNU Library General Public License instead.) You can apply it
to your programs, too.</p><p>When we speak of free software, we are referring to freedom, not price.
Our General Public Licenses are designed to make sure that you have the
freedom to distribute copies of free software (and charge for this
service if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.</p><p>To protect your rights, we need to make restrictions that forbid anyone
to deny you these rights or to ask you to surrender the rights. These
restrictions translate to certain responsibilities for you if you distribute
copies of the software, or if you modify it.</p><p>For example, if you distribute copies of such a program, whether gratis or
for a fee, you must give the recipients all the rights that you have. You
must make sure that they, too, receive or can get the source code. And you
must show them these terms so they know their rights.</p><p>We protect your rights with two steps:
</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>copyright the software, and</p></li><li class="listitem"><p>offer you this license which gives you legal permission to copy,
distribute and/or modify the software.</p></li></ol></div><p>
</p><p>Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If
the software is modified by someone else and passed on, we want its
recipients to know that what they have is not the original, so that any
problems introduced by others will not reflect on the original authors'
reputations.</p><p>Finally, any free program is threatened constantly by software patents.
We wish to avoid the danger that redistributors of a free program will
individually obtain patent licenses, in effect making the program
proprietary. To prevent this, we have made it clear that any patent must be
licensed for everyone's free use or not licensed at all.</p><p>The precise terms and conditions for copying, distribution and modification
follow.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gpl-2"></a>C.2. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="#gpl-2-0">C.2.1. Section 0</a></span></dt><dt><span class="section"><a href="#gpl-2-1">C.2.2. Section 1</a></span></dt><dt><span class="section"><a href="#gpl-2-2">C.2.3. Section 2</a></span></dt><dt><span class="section"><a href="#gpl-2-3">C.2.4. Section 3</a></span></dt><dt><span class="section"><a href="#gpl-2-4">C.2.5. Section 4</a></span></dt><dt><span class="section"><a href="#gpl-2-5">C.2.6. Section 5</a></span></dt><dt><span class="section"><a href="#gpl-2-6">C.2.7. Section 6</a></span></dt><dt><span class="section"><a href="#gpl-2-7">C.2.8. Section 7</a></span></dt><dt><span class="section"><a href="#gpl-2-8">C.2.9. Section 8</a></span></dt><dt><span class="section"><a href="#gpl-2-9">C.2.10. Section 9</a></span></dt><dt><span class="section"><a href="#gpl-2-10">C.2.11. Section 10</a></span></dt><dt><span class="section"><a href="#gpl-2-11">C.2.12. NO WARRANTY Section 11</a></span></dt><dt><span class="section"><a href="#gpl-2-12">C.2.13. Section 12</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-0"></a>C.2.1. Section 0</h3></div></div></div><p>This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
of this General Public License. The <span class="quote">“<span class="quote">Program</span>”</span>, below, refers to any such
program or work, and a
<span class="quote">“<span class="quote">work based on the Program</span>”</span> means either
the Program or any derivative work under copyright law: that is to say, a
work containing the Program or a portion of it, either verbatim or with
modifications and/or translated into another language. (Hereinafter, translation
is included without limitation in the term
<span class="quote">“<span class="quote">modification</span>”</span>.) Each licensee is addressed as <span class="quote">“<span class="quote">you</span>”</span>.</p><p>Activities other than copying, distribution and modification are not covered by
this License; they are outside its scope. The act of running the Program is not
restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made by running
the Program). Whether that is true depends on what the Program does.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-1"></a>C.2.2. Section 1</h3></div></div></div><p>You may copy and distribute verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and appropriately
publish on each copy an appropriate copyright notice and disclaimer of warranty;
keep intact all the notices that refer to this License and to the absence of any
warranty; and give any other recipients of the Program a copy of this License
along with the Program.</p><p>You may charge a fee for the physical act of transferring a copy, and you may at
your option offer warranty protection in exchange for a fee.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-2"></a>C.2.3. Section 2</h3></div></div></div><p>You may modify your copy or copies of the Program or any portion of it, thus
forming a work based on the Program, and copy and distribute such modifications
or work under the terms of
<a class="link" href="#gpl-2-1" title="C.2.2. Section 1">Section 1</a> above, provided
that you also meet all of these conditions:
</p><div class="orderedlist"><ol class="orderedlist" type="a"><li class="listitem"><p>You must cause the modified files to carry prominent notices stating that
you changed the files and the date of any change.</p></li><li class="listitem"><p>You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of
this License.</p></li><li class="listitem"><p>If the modified program normally reads commands interactively when run, you
must cause it, when started running for such interactive use in the most
ordinary way, to print or display an announcement including an appropriate
copyright notice and a notice that there is no warranty (or else, saying
that you provide a warranty) and that users may redistribute the program
under these conditions, and telling the user how to view a copy of this
License. (Exception: If the Program itself is interactive but does not
normally print such an announcement, your work based on the Program is not
required to print an announcement.)</p></li></ol></div><p>
</p><p>These requirements apply to the modified work as a whole. If identifiable sections
of that work are not derived from the Program, and can be reasonably considered
independent and separate works in themselves, then this License, and its terms,
do not apply to those sections when you distribute them as separate works. But when
you distribute the same sections as part of a whole which is a work based on the
Program, the distribution of the whole must be on the terms of this License, whose
permissions for other licensees extend to the entire whole, and thus to each and
every part regardless of who wrote it.</p><p>Thus, it is not the intent of this section to claim rights or contest your rights
to work written entirely by you; rather, the intent is to exercise the right to control
the distribution of derivative or collective works based on the Program.</p><p>In addition, mere aggregation of another work not based on the Program with the Program
(or with a work based on the Program) on a volume of a storage or distribution medium
does not bring the other work under the scope of this License.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-3"></a>C.2.4. Section 3</h3></div></div></div><p>You may copy and distribute the Program (or a work based on it, under
<a class="link" href="#gpl-2-2" title="C.2.3. Section 2">Section 2</a> in object code or executable form under the terms of
<a class="link" href="#gpl-2-1" title="C.2.2. Section 1">Sections 1</a> and
<a class="link" href="#gpl-2-2" title="C.2.3. Section 2">2</a> above provided that you also do one of the following:
</p><div class="orderedlist"><ol class="orderedlist" type="a"><li class="listitem"><p>Accompany it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,</p></li><li class="listitem"><p>Accompany it with a written offer, valid for at least three years, to give any
third party, for a charge no more than your cost of physically performing source
distribution, a complete machine-readable copy of the corresponding source code,
to be distributed under the terms of Sections 1 and 2 above on a medium customarily
used for software interchange; or,</p></li><li class="listitem"><p>Accompany it with the information you received as to the offer to distribute
corresponding source code. (This alternative is allowed only for noncommercial
distribution and only if you received the program in object code or executable form
with such an offer, in accord with Subsection b above.)</p></li></ol></div><p>
</p><p>The source code for a work means the preferred form of the work for making modifications
to it. For an executable work, complete source code means all the source code for all modules
it contains, plus any associated interface definition files, plus the scripts used to control
compilation and installation of the executable. However, as a special exception, the source
code distributed need not include anything that is normally distributed (in either source or
binary form) with the major components (compiler, kernel, and so on) of the operating system
on which the executable runs, unless that component itself accompanies the executable.</p><p>If distribution of executable or object code is made by offering access to copy from a
designated place, then offering equivalent access to copy the source code from the same place
counts as distribution of the source code, even though third parties are not compelled to
copy the source along with the object code.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-4"></a>C.2.5. Section 4</h3></div></div></div><p>You may not copy, modify, sublicense, or distribute the Program except as expressly provided
under this License. Any attempt otherwise to copy, modify, sublicense or distribute the
Program is void, and will automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this License will not have their
licenses terminated so long as such parties remain in full compliance.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-5"></a>C.2.6. Section 5</h3></div></div></div><p>You are not required to accept this License, since you have not signed it. However, nothing
else grants you permission to modify or distribute the Program or its derivative works.
These actions are prohibited by law if you do not accept this License. Therefore, by modifying
or distributing the Program (or any work based on the Program), you indicate your acceptance
of this License to do so, and all its terms and conditions for copying, distributing or
modifying the Program or works based on it.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-6"></a>C.2.7. Section 6</h3></div></div></div><p>Each time you redistribute the Program (or any work based on the Program), the recipient
automatically receives a license from the original licensor to copy, distribute or modify
the Program subject to these terms and conditions. You may not impose any further restrictions
on the recipients' exercise of the rights granted herein. You are not responsible for enforcing
compliance by third parties to this License.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-7"></a>C.2.8. Section 7</h3></div></div></div><p>If, as a consequence of a court judgment or allegation of patent infringement or for any other
reason (not limited to patent issues), conditions are imposed on you (whether by court order,
agreement or otherwise) that contradict the conditions of this License, they do not excuse you
from the conditions of this License. If you cannot distribute so as to satisfy simultaneously
your obligations under this License and any other pertinent obligations, then as a consequence
you may not distribute the Program at all. For example, if a patent license would not permit
royalty-free redistribution of the Program by all those who receive copies directly or
indirectly through you, then the only way you could satisfy both it and this License would be
to refrain entirely from distribution of the Program.</p><p>If any portion of this section is held invalid or unenforceable under any particular circumstance,
the balance of the section is intended to apply and the section as a whole is intended to apply
in other circumstances.</p><p>It is not the purpose of this section to induce you to infringe any patents or other property
right claims or to contest validity of any such claims; this section has the sole purpose of
protecting the integrity of the free software distribution system, which is implemented by public
license practices. Many people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that system; it is up
to the author/donor to decide if he or she is willing to distribute software through any other
system and a licensee cannot impose that choice.</p><p>This section is intended to make thoroughly clear what is believed to be a consequence of the
rest of this License.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-8"></a>C.2.9. Section 8</h3></div></div></div><p>If the distribution and/or use of the Program is restricted in certain countries either by patents
or by copyrighted interfaces, the original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding those countries, so that
distribution is permitted only in or among countries not thus excluded. In such case, this License
incorporates the limitation as if written in the body of this License.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-9"></a>C.2.10. Section 9</h3></div></div></div><p>The Free Software Foundation may publish revised and/or new versions of the General Public License
from time to time. Such new versions will be similar in spirit to the present version, but may differ
in detail to address new problems or concerns.</p><p>Each version is given a distinguishing version number. If the Program specifies a version number of
this License which applies to it and <span class="quote">“<span class="quote">any later version</span>”</span>, you have the option of following the terms
and conditions either of that version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of this License, you may choose any
version ever published by the Free Software Foundation.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-10"></a>C.2.11. Section 10</h3></div></div></div><p>If you wish to incorporate parts of the Program into other free programs whose distribution
conditions are different, write to the author to ask for permission. For software which is copyrighted
by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions
for this. Our decision will be guided by the two goals of preserving the free status of all
derivatives of our free software and of promoting the sharing and reuse of software generally.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-11"></a>C.2.12. NO WARRANTY Section 11</h3></div></div></div><p>BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE PROGRAM <span class="quote">“<span class="quote">AS IS</span>”</span> WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="gpl-2-12"></a>C.2.13. Section 12</h3></div></div></div><p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR
ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.</p><p>END OF TERMS AND CONDITIONS</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="gpl-3"></a>C.3. How to Apply These Terms to Your New Programs</h2></div></div></div><p>If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.</p><p>To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the <span class="quote">“<span class="quote">copyright</span>”</span> line and a pointer to where the full notice is found.</p><p><one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author></p><p>This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.</p><p>This program 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 General Public License for more details.</p><p>You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</p><p>Also add information on how to contact you by electronic and paper mail.</p><p>If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:</p><p>Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type <span class="quote">“<span class="quote">show w</span>”</span>.
This is free software, and you are welcome to redistribute it
under certain conditions; type <span class="quote">“<span class="quote">show c</span>”</span> for details.</p><p>The hypothetical commands <span class="quote">“<span class="quote">show w</span>”</span> and <span class="quote">“<span class="quote">show c</span>”</span> should
show the appropriate parts of the General Public License. Of course, the commands you
use may be called something other than <span class="quote">“<span class="quote">show w</span>”</span> and <span class="quote">“<span class="quote">show c</span>”</span>;
they could even be mouse-clicks or menu items--whatever suits your program.</p><p>You should also get your employer (if you work as a programmer) or your
school, if any, to sign a <span class="quote">“<span class="quote">copyright disclaimer</span>”</span> for the program, if
necessary. Here is a sample; alter the names:</p><p>Yoyodyne, Inc., hereby disclaims all copyright interest in the program
<span class="quote">“<span class="quote">Gnomovision</span>”</span> (which makes passes at compilers) written by James Hacker.</p><p><signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice</p><p>This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.</p></div></div></div><div class="index"><div class="titlepage"><div><div><h1 class="title"><a id="idx"></a>Index</h1></div></div></div><div xmlns:xlink="http://www.w3.org/1999/xlink" class="index"><div class="indexdiv"><h3>Symbols</h3><dl><dt id="ientry-idm278135370976">*COMPILE-WARNINGS*, <a class="indexterm" href="#compile-warn">Function COMPILE-FILE</a></dt><dt id="ientry-idm278135136368">*COMPILED-FILE-TYPES*, <a class="indexterm" href="#compiled-types">Function LOAD</a></dt><dt id="ientry-idm278117036176">*CURRENT-LANGUAGE*
, <a class="indexterm" href="#curr-lang">The Language</a></dt><dt id="ientry-idm278134525840">*EDITOR*, <a class="indexterm" href="#editor">Function ED</a></dt><dt id="ientry-idm278137714112">*EQ-HASHFUNCTION*, <a class="indexterm" href="#eq-hashfunction">Function MAKE-HASH-TABLE</a></dt><dt id="ientry-idm278137704336">*EQL-HASHFUNCTION*, <a class="indexterm" href="#eql-hashfunction">Function MAKE-HASH-TABLE</a></dt><dt id="ientry-idm278137699328">*EQUAL-HASHFUNCTION*, <a class="indexterm" href="#equal-hashfunction">Function MAKE-HASH-TABLE</a></dt><dt id="ientry-idm278116444736">*FOREIGN-ENCODING*
, <a class="indexterm" href="#foreign-enc">Default encodings</a></dt><dt id="ientry-idm278126274928">*FORWARD-REFERENCED-CLASS-MISDESIGN*, <a class="indexterm" href="#frc-bad">Inheritance Structure of Metaobject Classes</a></dt><dt id="ientry-idm278134555712">*INSPECT-LENGTH*, <a class="indexterm" href="#inspect-length">Function INSPECT</a></dt><dt id="ientry-idm278135147264">*LOAD-COMPILING*, <a class="indexterm" href="#load-comp">Function LOAD</a></dt><dt id="ientry-idm278135154192">*LOAD-ECHO*, <a class="indexterm" href="#load-echo">Function LOAD</a></dt><dt id="ientry-idm278135108032">*LOAD-OBSOLETE-ACTION*, <a class="indexterm" href="#load-obs">Function LOAD</a></dt><dt id="ientry-idm278116450144">*MISC-ENCODING*
, <a class="indexterm" href="#misc-enc">Default encodings</a></dt><dt id="ientry-idm278116491520">*PATHNAME-ENCODING*
, <a class="indexterm" href="#path-enc">Default encodings</a></dt><dt id="ientry-idm278135140112">*SOURCE-FILE-TYPES*, <a class="indexterm" href="#source-types">Function LOAD</a></dt><dt id="ientry-idm278116454512">*TERMINAL-ENCODING*
, <a class="indexterm" href="#term-enc">Default encodings</a></dt><dt id="ientry-idm278137641680">*WARN-ON-HASHTABLE-NEEDING-REHASH-AFTER-GC*, <a class="indexterm" href="#hashtable-gc-rehash-warn">Interaction between HASH-TABLEs and garbage-collection</a></dt><dt id="ientry-idm278115529040">*WINDOW*
, <a class="indexterm" href="#scr-win">Random Screen Access</a></dt></dl></div><div class="indexdiv"><h3>C</h3><dl><dt id="ientry-idm278114653360">callback, <a class="indexterm" href="#def-call-in-callback">Overview</a>, <a class="indexterm" href="#def-call-in-callback-main">Foreign functions</a></dt><dt id="ientry-idm278126219008">class</dt><dd><dl><dt>anonymous, <a class="indexterm" href="#class-anonymous">Initialization of Anonymous Classes</a></dt><dt>finalization, <a class="indexterm" href="#class-finalization">Class Finalization Protocol</a></dt><dt>interposed, <a class="indexterm" href="#class-interposed">Implementation and User Specialization</a></dt></dl></dd></dl></div><div class="indexdiv"><h3>D</h3><dl><dt id="ientry-idm278113779968">DEFAULT-FOREIGN-LANGUAGE
, <a class="indexterm" href="#dflt-ffi-lang">The choice of the C flavor</a></dt><dt id="ientry-idm278117015728">DEFINTERNATIONAL
, <a class="indexterm" href="#def-i-l">The Language</a></dt><dt id="ientry-idm278117024320">DEFLANGUAGE, <a class="indexterm" href="#deflang">The Language</a></dt><dt id="ientry-idm278117008720">DEFLOCALIZED, <a class="indexterm" href="#defloc">The Language</a></dt></dl></div><div class="indexdiv"><h3>E</h3><dl><dt id="ientry-idm278136613472">endianness, <a class="indexterm" href="#endianness-i">Binary input, READ-BYTE, EXT:READ-INTEGER & EXT:READ-FLOAT</a></dt></dl></div><div class="indexdiv"><h3>F</h3><dl><dt id="ientry-idm278141078384">final delimiter, <a class="indexterm" href="#fin-delim">Special Symbols sec_1-4-1-3</a></dt><dt id="ientry-idm278114821456">foreign function, <a class="indexterm" href="#dffi-ff">Introduction</a></dt><dd><dl><dt>anonymous, <a class="indexterm" href="#dffi-ff-a">Foreign functions</a></dt><dt>call-in, <a class="indexterm" href="#dffi-ff-call-in">Foreign functions</a></dt><dt>call-out, <a class="indexterm" href="#dffi-ff-call-out">Foreign functions</a></dt><dt>named, <a class="indexterm" href="#dffi-ff-n">Foreign functions</a></dt></dl></dd><dt id="ientry-idm278113774624">foreign
variable, <a class="indexterm" href="#dffi-fv">Foreign variables</a></dt><dt id="ientry-idm278135515040">FORMAT</dt><dd><dl><dt>~!, <a class="indexterm" href="#format-bang">Formatted Output sec_22-3</a></dt><dt>~., <a class="indexterm" href="#format-dot">Formatted Output sec_22-3</a></dt></dl></dd></dl></div><div class="indexdiv"><h3>G</h3><dl><dt id="ientry-idm278134353536">GC, <a class="indexterm" href="#gc-func">Function EXT:GC
</a></dt><dt id="ientry-idm278140188560">GENERIC-FLET, <a class="indexterm" href="#gen-flet">Deviations from ANSI CL standard</a></dt><dt id="ientry-idm278140186512">GENERIC-LABELS, <a class="indexterm" href="#gen-labels">Deviations from ANSI CL standard</a></dt></dl></div><div class="indexdiv"><h3>L</h3><dl><dt id="ientry-idm278115429968">linking set, <a class="indexterm" href="#linkseti">Linking Set</a></dt><dt id="ientry-idm278117003264">LOCALIZED, <a class="indexterm" href="#localized">The Language</a></dt></dl></div><div class="indexdiv"><h3>M</h3><dl><dt id="ientry-idm278135835744">MAKE-BUFFERED-INPUT-STREAM, <a class="indexterm" href="#stream-buffer-i">Functions EXT:MAKE-BUFFERED-INPUT-STREAM
and EXT:MAKE-BUFFERED-OUTPUT-STREAM
</a></dt><dt id="ientry-idm278135833728">MAKE-BUFFERED-OUTPUT-STREAM, <a class="indexterm" href="#stream-buffer-o">Functions EXT:MAKE-BUFFERED-INPUT-STREAM
and EXT:MAKE-BUFFERED-OUTPUT-STREAM
</a></dt><dt id="ientry-idm278126530000">metaobject, <a class="indexterm" href="#mop-mo">Metaobjects</a></dt><dd><dl><dt>class, <a class="indexterm" href="#mop-class-mo">Classes</a></dt><dt>generic function, <a class="indexterm" href="#mop-gen-fun-mo">Generic Functions</a></dt><dt>implementation-specific, <a class="indexterm" href="#mo-impl">Implementation and User Specialization</a></dt><dt>method, <a class="indexterm" href="#mop-method-mo">Methods</a></dt><dt>method combination, <a class="indexterm" href="#mop-meth-comp-mo">Method Combinations</a></dt><dt>portable, <a class="indexterm" href="#mo-portable">Implementation and User Specialization</a></dt><dt>slot definition, <a class="indexterm" href="#mop-slot-def-mo">Slot Definitions</a></dt><dd><dl><dt>direct, <a class="indexterm" href="#mop-dsd-mo">Slot Definitions</a></dt><dt>effective, <a class="indexterm" href="#mop-esd-mo">Slot Definitions</a></dt></dl></dd><dt>specializer, <a class="indexterm" href="#spec-mo">Specializers</a></dt><dt>specified, <a class="indexterm" href="#mo-specified">Implementation and User Specialization</a></dt><dt>standard, <a class="indexterm" href="#std-mo">Inheritance Structure of Metaobject Classes</a></dt></dl></dd><dt id="ientry-idm278126540336">metaobject class, <a class="indexterm" href="#mo-cl">Metaobjects</a></dt><dd><dl><dt>basic, <a class="indexterm" href="#mop-ba-mo-cl">Metaobjects</a></dt></dl></dd><dt id="ientry-idm278126211808">method</dt><dd><dl><dt>effective, <a class="indexterm" href="#effective-method">Generic Function Invocation Protocol</a></dt><dt>extends, <a class="indexterm" href="#method-extends">Implementation and User Specialization</a></dt><dt>function, <a class="indexterm" href="#me-func">Generic Function Invocation Protocol</a>, <a class="indexterm" href="#method-lambda">Processing Method Bodies</a></dt><dt>overrides, <a class="indexterm" href="#method-overrides">Implementation and User Specialization</a></dt><dt>promoted, <a class="indexterm" href="#method-promoted">Implementation and User Specialization</a></dt><dt>specialized, <a class="indexterm" href="#method-specialized">Implementation and User Specialization</a></dt></dl></dd><dt id="ientry-idm278139856064">METHOD-CALL-ERROR, <a class="indexterm" href="#meth-call-err">Standard Method Combination sec_7-6-6-2</a></dt><dt id="ientry-idm278139847696">METHOD-CALL-TYPE-ERROR, <a class="indexterm" href="#meth-call-type-err">Standard Method Combination sec_7-6-6-2</a></dt><dt id="ientry-idm278115460528">module, <a class="indexterm" href="#module">Module Set</a></dt><dd><dl><dt>name, <a class="indexterm" href="#module-name">Module Set</a></dt></dl></dd><dt id="ientry-idm278115452432">module set, <a class="indexterm" href="#modseti">Module Set</a></dt></dl></div><div class="indexdiv"><h3>N</h3><dl><dt id="ientry-idm278139865536">NO-PRIMARY-METHOD, <a class="indexterm" href="#no-prim">Standard Method Combination sec_7-6-6-2</a></dt></dl></div><div class="indexdiv"><h3>P</h3><dl><dt id="ientry-idm278139263024">PACKAGE</dt><dd><dl><dt>case-inverted, <a class="indexterm" href="#pack-case-inverted">Package Case-Sensitivity</a></dt><dt>case-sensitive, <a class="indexterm" href="#pack-case-sensitive">Package Case-Sensitivity</a></dt><dt>modern, <a class="indexterm" href="#pack-modern">Package Case-Sensitivity</a></dt></dl></dd><dt id="ientry-idm278139403936">PACKAGE-LOCK, <a class="indexterm" href="#pack-lock-f">Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2</a></dt></dl></div><div class="indexdiv"><h3>R</h3><dl><dt id="ientry-idm278134367024">ROOM, <a class="indexterm" href="#room-func">Function ROOM</a></dt></dl></div><div class="indexdiv"><h3>S</h3><dl><dt id="ientry-idm278122970768">slot</dt><dd><dl><dt>directly
accessible, <a class="indexterm" href="#slot-directly-accessible">Instance Structure Protocol</a></dt><dt>location, <a class="indexterm" href="#slot-location">Instance Structure Protocol</a></dt></dl></dd><dt id="ientry-idm278140838176">SYMBOL-MACRO-EXPAND, <a class="indexterm" href="#symbol-mex">Macro DEFINE-SYMBOL-MACRO</a></dt></dl></div><div class="indexdiv"><h3>T</h3><dl><dt id="ientry-idm278134539392">TIMES, <a class="indexterm" href="#times">Macro TIME</a></dt><dt id="ientry-idm278141037472">token</dt><dd><dl><dt>reserved, <a class="indexterm" href="#res-token">Symbols as Tokens sec_2-3-4</a></dt></dl></dd><dt id="ientry-idm278113715296">trampoline, <a class="indexterm" href="#dffi-trampoline">Callbacks and memory management</a></dt></dl></div><div class="indexdiv"><h3>V</h3><dl><dt id="ientry-idm278139953504">visually similar, <a class="indexterm" href="#visually-similar">Variable CUSTOM:*SUPPRESS-SIMILAR-CONSTANT-REDEFINITION-WARNING*</a></dt></dl></div><div class="indexdiv"><h3>W</h3><dl><dt id="ientry-idm278112100608">WITH-OUTPUT-TO-PRINTER
, <a class="indexterm" href="#with-print">Printing</a></dt><dt id="ientry-idm278139372224">WITHOUT-PACKAGE-LOCK, <a class="indexterm" href="#without-pack-lock">Constraints on the “COMMON-LISP” Package for Conforming Programs - package locking sec_11-1-2-1-2</a></dt></dl></div></div></div><div class="bibliography"><div class="titlepage"><div><div><h1 class="title"><a id="references"></a>References</h1></div></div></div><div class="bibliodiv"><h3 class="title"><a id="ref-books"></a>Books</h3><div class="biblioentry"><a id="CLtL1"></a><p>[<abbr class="abbrev">CLtL1</abbr>] <span class="authorgroup"><span class="firstname">Guy L.</span> <span class="surname">Steele</span>, <span class="lineage">Jr.</span>. </span><span class="title"><em>Common Lisp: the Language (1st Edition)</em>. </span><span class="pubdate">1984. </span><span class="pagenums">465 pages. </span>ISBN 0-932376-41-X. <span class="publisher"><span class="publishername">Digital Press. </span></span></p></div><div class="biblioentry"><a id="CLtL2"></a><p>[<abbr class="abbrev">CLtL2</abbr>] <span class="authorgroup"><span class="firstname">Guy L.</span> <span class="surname">Steele</span>, <span class="lineage">Jr.</span>. </span><span class="title"><em><a class="ulink" href="http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/cltl2.html" target="_top">Common Lisp: the Language (2nd Edition)</a></em>. </span><span class="pubdate">1990. </span><span class="pagenums">1032 pages. </span>ISBN 1-555-58041-6. <span class="publisher"><span class="publishername">Digital Press. </span></span></p></div><div class="biblioentry"><a id="amop"></a><p>[<abbr class="abbrev">AMOP</abbr>] <span class="authorgroup"><span class="firstname">Gregor</span> <span class="surname">Kiczales</span>, <span class="firstname">Jim</span> <span class="surname">des Rivieres</span>, and <span class="firstname">Daniel G.</span> <span class="surname">Bobrow</span>. </span><span class="title"><em><a class="ulink" href="http://mop.lisp.se/" target="_top">The Art of the Metaobject
Protocol</a></em>. </span><span class="pubdate">1991. </span><span class="pagenums">335 pages. </span>ISBN 0-262-61074-4. <span class="publisher"><span class="publishername"><a class="ulink" href="http://mitpress.mit.edu" target="_top">MIT
Press</a>. </span></span></p></div></div><div class="bibliodiv"><h3 class="title"><a id="ref-ansi"></a>ANSI standard documents</h3><div class="biblioentry"><a id="ansi-cl"></a><p>[<abbr class="abbrev">ANSI CL</abbr>] ANSI CL standard<span class="pubdate">1994. </span><span class="title"><em><a class="ulink" href="http://webstore.ansi.org" target="_top">ANSI</a> INCITS 226-1994 (R1999)
Information Technology - Programming Language - Common Lisp
[formerly ANSI X3.226-1994 (R1999)]</em>. </span></p></div><div class="biblioentry"><a id="CLHS"></a><p>[<abbr class="abbrev">CLHS</abbr>] Common Lisp HyperSpec<span class="title"><em><a class="ulink" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/FrontMatter/" target="_top">Common Lisp HyperSpec</a></em>. </span></p></div></div></div></div><div class="bookinfo"><hr /><table width="100%" summary="impnotes meta info"><th><td align="left">These notes document <a class="ulink" href="http://clisp.org" target="_top"><span class="command"><strong>CLISP</strong></span></a> version 2.49.60+</td><td align="right">Last modified: 2017-10-27</td></th></table></div><div class="custom-footer"><hr /><table width="100%"><tr><td align="left"><a href="http://clisp.org"><img src="clisp.png" width="48" height="48" alt="[CLISP home]" /></a></td><td align="center"><a href="https://sourceforge.net/p/clisp/donate/?source=impnotes-top"><img src="" width="88" height="32" alt="[Support CLISP]" /></a></td><td align="right"><a href="https://sourceforge.net/projects/clisp/"><img width="120" height="30" alt="[SourceForge]" src="" /></a></td></tr></table></div><hr /><form method="get" action="http://www.google.com/custom" target="_top"><table width="100%" border="0"><tr><td nowrap="nowrap" align="center"><input type="hidden" name="domains" value="clisp.org" /><label for="sbi" style="display: none">Enter your search terms</label><input type="text" name="q" size="50" maxlength="255" id="sbi" value="Implementation Notes for GNU CLISP" /><label for="sbb" style="display: none">Submit search form</label><input type="submit" name="sa" value="Google Search" id="sbb" /></td></tr><tr><td nowrap="nowrap" align="center"><input type="radio" name="sitesearch" value="" checked="1" id="ss0" /><label for="ss0" title="Search the Web"><small>Web</small></label><input type="radio" name="sitesearch" value="clisp.org" id="ss1" /><label for="ss1" title="Search clisp.org"><small>clisp.org</small></label><input type="hidden" name="client" value="pub-4445255502750357" /><input type="hidden" name="forid" value="1" /><input type="hidden" name="ie" value="UTF-8" /><input type="hidden" name="oe" value="UTF-8" /><input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:000000;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:48;LW:48;L:http://clisp.cons.org/clisp.png;S:http://clisp.cons.org;FORID:1" /><input type="hidden" name="hl" value="en" /></td></tr></table></form><hr /></body></html>
|