This file is indexed.

/usr/share/doc/sbcl/sbcl.html is in sbcl-doc 2:1.4.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

    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
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is part of the SBCL software system. See the
README file for more information.

This manual is largely derived from the manual for the CMUCL system,
which was produced at Carnegie Mellon University and later released
into the public domain. This manual is in the public domain and is
provided with absolutely no warranty. See the COPYING and
CREDITS files for more information. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SBCL 1.4.5.debian User Manual</title>

<meta name="description" content="SBCL 1.4.5.debian User Manual">
<meta name="keywords" content="SBCL 1.4.5.debian User Manual">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="#Top" rel="start" title="Top">
<link href="#Concept-Index" rel="index" title="Concept Index">
<link href="#SEC_Contents" rel="contents" title="Table of Contents">
<link href="dir.html#Top" rel="up" title="(dir)">
<style type="text/css">
<!--
/*
 * Based on version 1.0.1 of the texinfo-css stylesheet published by
 * sirgazil (https://bitbucket.org/sirgazil/texinfo-css).
 *
 * Public domain 2016 sirgazil. All rights waived.
*/

/* NATIVE ELEMENTS */

a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
a:link,
a:visited {
    color: #1E90FF;
    text-decoration: none;
}

a:active,
a:focus,
a:hover {
    text-decoration: underline;
}

abbr,
acronym {
    cursor: help;
}

blockquote {
    color: #555753;
    font-style: oblique;
    margin: 30px 0px;
    padding-left: 3em;
}

body {
    background-color: white;
    box-shadow: 0 0 2px gray;
    box-sizing: border-box;
    color: #333;
    font-family: sans-serif;
    font-size: 16px;
    margin: 50px auto;
    max-width: 70em; /*960px;*/
    padding: 50px;
}

code,
samp,
tt,
var {
    color: purple;
    font-size: 0.8em;
}

div.example,
div.lisp {
    margin: 0px;
}

dl {
    margin: 3em 0em;
}

dl dl {
    margin: 0em;
}

dt {
    background-color: #F5F5F5;
    padding: 0.5em;
}

h1,
h2,
h2.contents-heading,
h3,
h4 {
    padding: 20px 0px 0px 0px;
    font-weight: normal;
}

h1 {
    font-size: 2.4em;
}

h2 {
    font-size: 2.2em;
    font-weight: bold;
}

h3 {
    font-size: 1.8em;
}

h4 {
    font-size: 1.4em;
}

hr {
    background-color: silver;
    border-style: none;
    height: 1px;
    margin: 0px;
}

html {
    background-color: #F5F5F5;
}

img {
    max-width: 100%;
}

li {
    padding: 5px;
}

div.display,
div.example,
div.format,
div.lisp,
div.verbatim {
    overflow: auto;
}

div.example,
div.lisp,
div.verbatim {
    background-color: #F5F5F5; /* #2D3743;*/
    border-color: #000;
    border-style: solid;
    border-width: thin;
    /*color: #E1E1E1;*/
    font-size: smaller;
    padding: 1em;
}

pre {
    padding: 0;
    margin: 0 0 1em 0;
}
pre:last-of-type {
    margin: 0 0 0 0;
}

table {
    border-collapse: collapse;
    margin: 40px 0px;
}

table.index-cp *,
table.index-fn *,
table.index-ky *,
table.index-pg *,
table.index-tp *,
table.index-vr * {
    background-color: inherit;
    border-style: none;
}

td,
th {
    border-color: silver;
    border-style: solid;
    border-width: thin;
    padding: 10px;
}

th {
    background-color: #F5F5F5;
}
/* END NATIVE ELEMENTS */



/* CLASSES */
.contents {
    margin-bottom: 4em;
}

.float {
    margin: 3em 0em;
}

.float-caption {
    font-size: smaller;
    text-align: center;
}

.float > img {
    display: block;
    margin: auto;
}

.footnote {
    font-size: smaller;
    margin: 5em 0em;
}

.footnote h3 {
    display: inline;
    font-size: small;
}

.key {
    color: purple;
    font-size: 0.8em;
}

/* END CLASSES */
.header {
    display: none;
}

.menu {
    display: none;
}

-->
</style>


</head>

<body lang="en">
<h1 class="settitle" align="center">SBCL 1.4.5.debian User Manual</h1>






<a name="SEC_Contents"></a>
<h2 class="contents-heading">Table of Contents</h2>

<div class="contents">

<ul class="no-bullet">
  <li><a name="toc-Getting-Support-and-Reporting-Bugs-1" href="#Getting-Support-and-Reporting-Bugs">1 Getting Support and Reporting Bugs</a>
  <ul class="no-bullet">
    <li><a name="toc-Volunteer-Support-1" href="#Volunteer-Support">1.1 Volunteer Support</a></li>
    <li><a name="toc-Commercial-Support-1" href="#Commercial-Support">1.2 Commercial Support</a></li>
    <li><a name="toc-Reporting-Bugs-1" href="#Reporting-Bugs">1.3 Reporting Bugs</a>
    <ul class="no-bullet">
      <li><a name="toc-How-to-Report-Bugs-Effectively" href="#How-to-Report-Bugs-Effectively">1.3.1 How to Report Bugs Effectively</a></li>
      <li><a name="toc-Signal-Related-Bugs" href="#Signal-Related-Bugs">1.3.2 Signal Related Bugs</a></li>
    </ul></li>
  </ul></li>
  <li><a name="toc-Introduction-1" href="#Introduction">2 Introduction</a>
  <ul class="no-bullet">
    <li><a name="toc-ANSI-Conformance-1" href="#ANSI-Conformance">2.1 ANSI Conformance</a></li>
    <li><a name="toc-Extensions-1" href="#Extensions">2.2 Extensions</a></li>
    <li><a name="toc-Idiosyncrasies-1" href="#Idiosyncrasies">2.3 Idiosyncrasies</a>
    <ul class="no-bullet">
      <li><a name="toc-Declarations-1" href="#Declarations">2.3.1 Declarations</a></li>
      <li><a name="toc-FASL-Format-1" href="#FASL-Format">2.3.2 FASL Format</a></li>
      <li><a name="toc-Compiler_002donly-Implementation-1" href="#Compiler_002donly-Implementation">2.3.3 Compiler-only Implementation</a></li>
      <li><a name="toc-Defining-Constants-1" href="#Defining-Constants">2.3.4 Defining Constants</a></li>
      <li><a name="toc-Style-Warnings-1" href="#Style-Warnings">2.3.5 Style Warnings</a></li>
    </ul></li>
    <li><a name="toc-Development-Tools-1" href="#Development-Tools">2.4 Development Tools</a>
    <ul class="no-bullet">
      <li><a name="toc-Editor-Integration-1" href="#Editor-Integration">2.4.1 Editor Integration</a></li>
      <li><a name="toc-Language-Reference-1" href="#Language-Reference">2.4.2 Language Reference</a></li>
      <li><a name="toc-Generating-Executables-1" href="#Generating-Executables">2.4.3 Generating Executables</a></li>
    </ul></li>
    <li><a name="toc-More-SBCL-Information-1" href="#More-SBCL-Information">2.5 More SBCL Information</a>
    <ul class="no-bullet">
      <li><a name="toc-SBCL-Homepage-1" href="#SBCL-Homepage">2.5.1 SBCL Homepage</a></li>
      <li><a name="toc-Online-Documentation-1" href="#Online-Documentation">2.5.2 Online Documentation</a></li>
      <li><a name="toc-Additional-Documentation-Files-1" href="#Additional-Documentation-Files">2.5.3 Additional Documentation Files</a></li>
      <li><a name="toc-Internals-Documentation-1" href="#Internals-Documentation">2.5.4 Internals Documentation</a></li>
    </ul></li>
    <li><a name="toc-More-Common-Lisp-Information-1" href="#More-Common-Lisp-Information">2.6 More Common Lisp Information</a>
    <ul class="no-bullet">
      <li><a name="toc-Internet-Community-1" href="#Internet-Community">2.6.1 Internet Community</a></li>
      <li><a name="toc-Third_002dparty-Libraries-1" href="#Third_002dparty-Libraries">2.6.2 Third-party Libraries</a></li>
      <li><a name="toc-Common-Lisp-Books-1" href="#Common-Lisp-Books">2.6.3 Common Lisp Books</a></li>
    </ul></li>
    <li><a name="toc-History-and-Implementation-of-SBCL-1" href="#History-and-Implementation-of-SBCL">2.7 History and Implementation of SBCL</a></li>
  </ul></li>
  <li><a name="toc-Starting-and-Stopping-1" href="#Starting-and-Stopping">3 Starting and Stopping</a>
  <ul class="no-bullet">
    <li><a name="toc-Starting-SBCL-1" href="#Starting-SBCL">3.1 Starting SBCL</a>
    <ul class="no-bullet">
      <li><a name="toc-From-Shell-to-Lisp" href="#Running-from-Shell">3.1.1 From Shell to Lisp</a></li>
      <li><a name="toc-Running-from-Emacs-1" href="#Running-from-Emacs">3.1.2 Running from Emacs</a></li>
      <li><a name="toc-Shebang-Scripts-1" href="#Shebang-Scripts">3.1.3 Shebang Scripts</a></li>
    </ul></li>
    <li><a name="toc-Stopping-SBCL-1" href="#Stopping-SBCL">3.2 Stopping SBCL</a>
    <ul class="no-bullet">
      <li><a name="toc-Exit-1" href="#Exit">3.2.1 Exit</a></li>
      <li><a name="toc-End-of-File-1" href="#End-of-File">3.2.2 End of File</a></li>
      <li><a name="toc-Saving-a-Core-Image-1" href="#Saving-a-Core-Image">3.2.3 Saving a Core Image</a></li>
      <li><a name="toc-Exit-on-Errors-1" href="#Exit-on-Errors">3.2.4 Exit on Errors</a></li>
    </ul></li>
    <li><a name="toc-Command-Line-Options-1" href="#Command-Line-Options">3.3 Command Line Options</a>
    <ul class="no-bullet">
      <li><a name="toc-Runtime-Options-1" href="#Runtime-Options">3.3.1 Runtime Options</a></li>
      <li><a name="toc-Toplevel-Options-1" href="#Toplevel-Options">3.3.2 Toplevel Options</a></li>
    </ul></li>
    <li><a name="toc-Initialization-Files-1" href="#Initialization-Files">3.4 Initialization Files</a></li>
    <li><a name="toc-Initialization-and-Exit-Hooks-1" href="#Initialization-and-Exit-Hooks">3.5 Initialization and Exit Hooks</a></li>
  </ul></li>
  <li><a name="toc-Compiler-1" href="#Compiler">4 Compiler</a>
  <ul class="no-bullet">
    <li><a name="toc-Diagnostic-Messages-1" href="#Diagnostic-Messages">4.1 Diagnostic Messages</a>
    <ul class="no-bullet">
      <li><a name="toc-Controlling-Verbosity-1" href="#Controlling-Verbosity">4.1.1 Controlling Verbosity</a></li>
      <li><a name="toc-Diagnostic-Severity-1" href="#Diagnostic-Severity">4.1.2 Diagnostic Severity</a></li>
      <li><a name="toc-Understanding-Compile-Diagnostics" href="#Understanding-Compiler-Diagnostics">4.1.3 Understanding Compile Diagnostics</a>
      <ul class="no-bullet">
        <li><a name="toc-The-Parts-of-a-Compiler-Diagnostic-1" href="#The-Parts-of-a-Compiler-Diagnostic">4.1.3.1 The Parts of a Compiler Diagnostic</a></li>
        <li><a name="toc-The-Original-and-Actual-Source-1" href="#The-Original-and-Actual-Source">4.1.3.2 The Original and Actual Source</a></li>
        <li><a name="toc-The-Processing-Path-1" href="#The-Processing-Path">4.1.3.3 The Processing Path</a></li>
      </ul></li>
    </ul></li>
    <li><a name="toc-Handling-of-Types-1" href="#Handling-of-Types">4.2 Handling of Types</a>
    <ul class="no-bullet">
      <li><a name="toc-Declarations-as-Assertions-1" href="#Declarations-as-Assertions">4.2.1 Declarations as Assertions</a></li>
      <li><a name="toc-Precise-Type-Checking-1" href="#Precise-Type-Checking">4.2.2 Precise Type Checking</a></li>
      <li><a name="toc-Getting-Existing-Programs-to-Run-1" href="#Getting-Existing-Programs-to-Run">4.2.3 Getting Existing Programs to Run</a></li>
      <li><a name="toc-Implementation-Limitations-1" href="#Implementation-Limitations">4.2.4 Implementation Limitations</a></li>
    </ul></li>
    <li><a name="toc-Compiler-Policy-1" href="#Compiler-Policy">4.3 Compiler Policy</a></li>
    <li><a name="toc-Compiler-Errors-1" href="#Compiler-Errors">4.4 Compiler Errors</a>
    <ul class="no-bullet">
      <li><a name="toc-Type-Errors-at-Compile-Time-1" href="#Type-Errors-at-Compile-Time">4.4.1 Type Errors at Compile Time</a></li>
      <li><a name="toc-Errors-During-Macroexpansion-1" href="#Errors-During-Macroexpansion">4.4.2 Errors During Macroexpansion</a></li>
      <li><a name="toc-Read-Errors-1" href="#Read-Errors">4.4.3 Read Errors</a></li>
    </ul></li>
    <li><a name="toc-Open-Coding-and-Inline-Expansion-1" href="#Open-Coding-and-Inline-Expansion">4.5 Open Coding and Inline Expansion</a></li>
    <li><a name="toc-Interpreter-1" href="#Interpreter">4.6 Interpreter</a></li>
  </ul></li>
  <li><a name="toc-Debugger-1" href="#Debugger">5 Debugger</a>
  <ul class="no-bullet">
    <li><a name="toc-Debugger-Entry-1" href="#Debugger-Entry">5.1 Debugger Entry</a>
    <ul class="no-bullet">
      <li><a name="toc-Debugger-Banner-1" href="#Debugger-Banner">5.1.1 Debugger Banner</a></li>
      <li><a name="toc-Debugger-Invocation-1" href="#Debugger-Invocation">5.1.2 Debugger Invocation</a></li>
    </ul></li>
    <li><a name="toc-Debugger-Command-Loop-1" href="#Debugger-Command-Loop">5.2 Debugger Command Loop</a></li>
    <li><a name="toc-Stack-Frames-1" href="#Stack-Frames">5.3 Stack Frames</a>
    <ul class="no-bullet">
      <li><a name="toc-Stack-Motion-1" href="#Stack-Motion">5.3.1 Stack Motion</a></li>
      <li><a name="toc-How-Arguments-are-Printed-1" href="#How-Arguments-are-Printed">5.3.2 How Arguments are Printed</a></li>
      <li><a name="toc-Function-Names-1" href="#Function-Names">5.3.3 Function Names</a>
      <ul class="no-bullet">
        <li><a name="toc-Entry-Point-Details-1" href="#Entry-Point-Details">5.3.3.1 Entry Point Details</a></li>
      </ul></li>
      <li><a name="toc-Debug-Tail-Recursion-1" href="#Debug-Tail-Recursion">5.3.4 Debug Tail Recursion</a></li>
      <li><a name="toc-Unknown-Locations-and-Interrupts-1" href="#Unknown-Locations-and-Interrupts">5.3.5 Unknown Locations and Interrupts</a></li>
    </ul></li>
    <li><a name="toc-Variable-Access-1" href="#Variable-Access">5.4 Variable Access</a>
    <ul class="no-bullet">
      <li><a name="toc-Variable-Value-Availability-1" href="#Variable-Value-Availability">5.4.1 Variable Value Availability</a></li>
      <li><a name="toc-Note-On-Lexical-Variable-Access-1" href="#Note-On-Lexical-Variable-Access">5.4.2 Note On Lexical Variable Access</a></li>
    </ul></li>
    <li><a name="toc-Source-Location-Printing-1" href="#Source-Location-Printing">5.5 Source Location Printing</a>
    <ul class="no-bullet">
      <li><a name="toc-How-the-Source-is-Found-1" href="#How-the-Source-is-Found">5.5.1 How the Source is Found</a></li>
      <li><a name="toc-Source-Location-Availability-1" href="#Source-Location-Availability">5.5.2 Source Location Availability</a></li>
    </ul></li>
    <li><a name="toc-Debugger-Policy-Control-1" href="#Debugger-Policy-Control">5.6 Debugger Policy Control</a></li>
    <li><a name="toc-Exiting-Commands-1" href="#Exiting-Commands">5.7 Exiting Commands</a></li>
    <li><a name="toc-Information-Commands-1" href="#Information-Commands">5.8 Information Commands</a></li>
    <li><a name="toc-Function-Tracing-1" href="#Function-Tracing">5.9 Function Tracing</a></li>
    <li><a name="toc-Single-Stepping-1" href="#Single-Stepping">5.10 Single Stepping</a></li>
    <li><a name="toc-Enabling-and-Disabling-the-Debugger-1" href="#Enabling-and-Disabling-the-Debugger">5.11 Enabling and Disabling the Debugger</a></li>
  </ul></li>
  <li><a name="toc-Efficiency-1" href="#Efficiency">6 Efficiency</a>
  <ul class="no-bullet">
    <li><a name="toc-Slot-access-1" href="#Slot-access">6.1 Slot access</a>
    <ul class="no-bullet">
      <li><a name="toc-Structure-object-slot-access" href="#Structure-object-slot-access">6.1.1 Structure object slot access</a></li>
      <li><a name="toc-Standard-object-slot-access" href="#Standard-object-slot-access">6.1.2 Standard object slot access</a></li>
    </ul></li>
    <li><a name="toc-Dynamic_002dextent-allocation-1" href="#Dynamic_002dextent-allocation">6.2 Dynamic-extent allocation</a></li>
    <li><a name="toc-Modular-arithmetic-1" href="#Modular-arithmetic">6.3 Modular arithmetic</a></li>
    <li><a name="toc-Global-and-Always_002dBound-variables-1" href="#Global-and-Always_002dBound-variables">6.4 Global and Always-Bound variables</a></li>
    <li><a name="toc-Miscellaneous-Efficiency-Issues-1" href="#Miscellaneous-Efficiency-Issues">6.5 Miscellaneous Efficiency Issues</a></li>
  </ul></li>
  <li><a name="toc-Beyond-the-ANSI-Standard-1" href="#Beyond-the-ANSI-Standard">7 Beyond the ANSI Standard</a>
  <ul class="no-bullet">
    <li><a name="toc-Reader-Extensions-1" href="#Reader-Extensions">7.1 Reader Extensions</a></li>
    <li><a name="toc-Package_002dLocal-Nicknames-1" href="#Package_002dLocal-Nicknames">7.2 Package-Local Nicknames</a></li>
    <li><a name="toc-Package-Variance-1" href="#Package-Variance">7.3 Package Variance</a></li>
    <li><a name="toc-Garbage-Collection-1" href="#Garbage-Collection">7.4 Garbage Collection</a>
    <ul class="no-bullet">
      <li><a name="toc-Finalization" href="#Finalization">7.4.1 Finalization</a></li>
      <li><a name="toc-Weak-Pointers" href="#Weak-Pointers">7.4.2 Weak Pointers</a></li>
      <li><a name="toc-Introspection-and-Tuning" href="#Introspection-and-Tuning">7.4.3 Introspection and Tuning</a></li>
    </ul></li>
    <li><a name="toc-Metaobject-Protocol-1" href="#Metaobject-Protocol">7.5 Metaobject Protocol</a>
    <ul class="no-bullet">
      <li><a name="toc-AMOP-Compatibility-of-Metaobject-Protocol" href="#AMOP-Compatibility-of-Metaobject-Protocol">7.5.1 AMOP Compatibility of Metaobject Protocol</a></li>
      <li><a name="toc-Metaobject-Protocol-Extensions" href="#Metaobject-Protocol-Extensions">7.5.2 Metaobject Protocol Extensions</a></li>
    </ul></li>
    <li><a name="toc-Extensible-Sequences-1" href="#Extensible-Sequences">7.6 Extensible Sequences</a>
    <ul class="no-bullet">
      <li><a name="toc-Iterator-Protocol-1" href="#Iterator-Protocol">7.6.1 Iterator Protocol</a></li>
      <li><a name="toc-Simple-Iterator-Protocol-1" href="#Simple-Iterator-Protocol">7.6.2 Simple Iterator Protocol</a></li>
    </ul></li>
    <li><a name="toc-Support-For-Unix-1" href="#Support-For-Unix">7.7 Support For Unix</a>
    <ul class="no-bullet">
      <li><a name="toc-Command_002dline-arguments-1" href="#Command_002dline-arguments">7.7.1 Command-line arguments</a></li>
      <li><a name="toc-Querying-the-process-environment-1" href="#Querying-the-process-environment">7.7.2 Querying the process environment</a></li>
      <li><a name="toc-Running-external-programs-1" href="#Running-external-programs">7.7.3 Running external programs</a></li>
    </ul></li>
    <li><a name="toc-Unicode-Support-1" href="#Unicode-Support">7.8 Unicode Support</a>
    <ul class="no-bullet">
      <li><a name="toc-Unicode-property-access" href="#Unicode-property-access">7.8.1 Unicode property access</a></li>
      <li><a name="toc-String-operations" href="#String-operations">7.8.2 String operations</a></li>
      <li><a name="toc-Breaking-strings" href="#Breaking-strings">7.8.3 Breaking strings</a></li>
    </ul></li>
    <li><a name="toc-Customization-Hooks-for-Users-1" href="#Customization-Hooks-for-Users">7.9 Customization Hooks for Users</a></li>
    <li><a name="toc-Tools-To-Help-Developers-1" href="#Tools-To-Help-Developers">7.10 Tools To Help Developers</a></li>
    <li><a name="toc-Resolution-of-Name-Conflicts-1" href="#Resolution-of-Name-Conflicts">7.11 Resolution of Name Conflicts</a></li>
    <li><a name="toc-Hash-Table-Extensions-1" href="#Hash-Table-Extensions">7.12 Hash Table Extensions</a></li>
    <li><a name="toc-Random-Number-Generation-1" href="#Random-Number-Generation">7.13 Random Number Generation</a></li>
    <li><a name="toc-Timeouts-and-Deadlines-1" href="#Timeouts-and-Deadlines">7.14 Timeouts and Deadlines</a>
    <ul class="no-bullet">
      <li><a name="toc-Timeout-Parameters-1" href="#Timeout-Parameters">7.14.1 Timeout Parameters</a></li>
      <li><a name="toc-Synchronous-Timeouts-_0028Deadlines_0029-1" href="#Synchronous-Timeouts-_0028Deadlines_0029">7.14.2 Synchronous Timeouts (Deadlines)</a></li>
      <li><a name="toc-Asynchronous-Timeouts-1" href="#Asynchronous-Timeouts">7.14.3 Asynchronous Timeouts</a></li>
      <li><a name="toc-Operations-Supporting-Timeouts-and-Deadlines-1" href="#Operations-Supporting-Timeouts-and-Deadlines">7.14.4 Operations Supporting Timeouts and Deadlines</a></li>
    </ul></li>
    <li><a name="toc-Miscellaneous-Extensions-1" href="#Miscellaneous-Extensions">7.15 Miscellaneous Extensions</a></li>
    <li><a name="toc-Stale-Extensions-1" href="#Stale-Extensions">7.16 Stale Extensions</a></li>
    <li><a name="toc-Efficiency-Hacks-1" href="#Efficiency-Hacks">7.17 Efficiency Hacks</a></li>
  </ul></li>
  <li><a name="toc-Foreign-Function-Interface-1" href="#Foreign-Function-Interface">8 Foreign Function Interface</a>
  <ul class="no-bullet">
    <li><a name="toc-Introduction-to-the-Foreign-Function-Interface-1" href="#Introduction-to-the-Foreign-Function-Interface">8.1 Introduction to the Foreign Function Interface</a></li>
    <li><a name="toc-Foreign-Types-1" href="#Foreign-Types">8.2 Foreign Types</a>
    <ul class="no-bullet">
      <li><a name="toc-Defining-Foreign-Types-1" href="#Defining-Foreign-Types">8.2.1 Defining Foreign Types</a></li>
      <li><a name="toc-Foreign-Types-and-Lisp-Types-1" href="#Foreign-Types-and-Lisp-Types">8.2.2 Foreign Types and Lisp Types</a></li>
      <li><a name="toc-Foreign-Type-Specifiers-1" href="#Foreign-Type-Specifiers">8.2.3 Foreign Type Specifiers</a></li>
    </ul></li>
    <li><a name="toc-Operations-On-Foreign-Values-1" href="#Operations-On-Foreign-Values">8.3 Operations On Foreign Values</a>
    <ul class="no-bullet">
      <li><a name="toc-Accessing-Foreign-Values-1" href="#Accessing-Foreign-Values">8.3.1 Accessing Foreign Values</a>
      <ul class="no-bullet">
        <li><a name="toc-Untyped-memory" href="#Untyped-memory">8.3.1.1 Untyped memory</a></li>
      </ul></li>
      <li><a name="toc-Coercing-Foreign-Values-1" href="#Coercing-Foreign-Values">8.3.2 Coercing Foreign Values</a></li>
      <li><a name="toc-Foreign-Dynamic-Allocation-1" href="#Foreign-Dynamic-Allocation">8.3.3 Foreign Dynamic Allocation</a></li>
    </ul></li>
    <li><a name="toc-Foreign-Variables-1" href="#Foreign-Variables">8.4 Foreign Variables</a>
    <ul class="no-bullet">
      <li><a name="toc-Local-Foreign-Variables-1" href="#Local-Foreign-Variables">8.4.1 Local Foreign Variables</a></li>
      <li><a name="toc-External-Foreign-Variables-1" href="#External-Foreign-Variables">8.4.2 External Foreign Variables</a></li>
    </ul></li>
    <li><a name="toc-Foreign-Data-Structure-Examples-1" href="#Foreign-Data-Structure-Examples">8.5 Foreign Data Structure Examples</a></li>
    <li><a name="toc-Loading-Shared-Object-Files-1" href="#Loading-Shared-Object-Files">8.6 Loading Shared Object Files</a></li>
    <li><a name="toc-Foreign-Function-Calls-1" href="#Foreign-Function-Calls">8.7 Foreign Function Calls</a>
    <ul class="no-bullet">
      <li><a name="toc-The-alien_002dfuncall-Primitive-1" href="#The-alien_002dfuncall-Primitive">8.7.1 The <code>alien-funcall</code> Primitive</a></li>
      <li><a name="toc-The-define_002dalien_002droutine-Macro-1" href="#The-define_002dalien_002droutine-Macro">8.7.2 The <code>define-alien-routine</code> Macro</a></li>
      <li><a name="toc-define_002dalien_002droutine-Example-1" href="#define_002dalien_002droutine-Example">8.7.3 <code>define-alien-routine</code> Example</a></li>
      <li><a name="toc-Calling-Lisp-From-C-1" href="#Calling-Lisp-From-C">8.7.4 Calling Lisp From C</a></li>
    </ul></li>
    <li><a name="toc-Step_002dBy_002dStep-Example-of-the-Foreign-Function-Interface-1" href="#Step_002dBy_002dStep-Example-of-the-Foreign-Function-Interface">8.8 Step-By-Step Example of the Foreign Function Interface</a></li>
  </ul></li>
  <li><a name="toc-Pathnames-1" href="#Pathnames">9 Pathnames</a>
  <ul class="no-bullet">
    <li><a name="toc-Lisp-Pathnames-1" href="#Lisp-Pathnames">9.1 Lisp Pathnames</a>
    <ul class="no-bullet">
      <li><a name="toc-Home-Directory-Specifiers" href="#Home-Directory-Specifiers">9.1.1 Home Directory Specifiers</a></li>
      <li><a name="toc-The-SYS-Logical-Pathname-Host" href="#The-SYS-Logical-Pathname-Host">9.1.2 The SYS Logical Pathname Host</a></li>
    </ul></li>
    <li><a name="toc-Native-Filenames-1" href="#Native-Filenames">9.2 Native Filenames</a></li>
  </ul></li>
  <li><a name="toc-Streams-1" href="#Streams">10 Streams</a>
  <ul class="no-bullet">
    <li><a name="toc-External-Formats-1" href="#External-Formats">10.1 External Formats</a></li>
    <li><a name="toc-Bivalent-Streams-1" href="#Bivalent-Streams">10.2 Bivalent Streams</a></li>
    <li><a name="toc-Gray-Streams-1" href="#Gray-Streams">10.3 Gray Streams</a>
    <ul class="no-bullet">
      <li><a name="toc-Gray-Streams-classes-1" href="#Gray-Streams-classes">10.3.1 Gray Streams classes</a></li>
      <li><a name="toc-Methods-common-to-all-streams-1" href="#Methods-common-to-all-streams">10.3.2 Methods common to all streams</a></li>
      <li><a name="toc-Input-stream-methods-1" href="#Input-stream-methods">10.3.3 Input stream methods</a></li>
      <li><a name="toc-Character-input-stream-methods-1" href="#Character-input-stream-methods">10.3.4 Character input stream methods</a></li>
      <li><a name="toc-Output-stream-methods-1" href="#Output-stream-methods">10.3.5 Output stream methods</a></li>
      <li><a name="toc-Character-output-stream-methods-1" href="#Character-output-stream-methods">10.3.6 Character output stream methods</a></li>
      <li><a name="toc-Binary-stream-methods-1" href="#Binary-stream-methods">10.3.7 Binary stream methods</a></li>
      <li><a name="toc-Gray-Streams-examples-1" href="#Gray-Streams-examples">10.3.8 Gray Streams examples</a>
      <ul class="no-bullet">
        <li><a name="toc-Character-counting-input-stream-1" href="#Character-counting-input-stream">10.3.8.1 Character counting input stream</a></li>
        <li><a name="toc-Output-prefixing-character-stream-1" href="#Output-prefixing-character-stream">10.3.8.2 Output prefixing character stream</a></li>
      </ul></li>
    </ul></li>
    <li><a name="toc-Simple-Streams-1" href="#Simple-Streams">10.4 Simple Streams</a></li>
  </ul></li>
  <li><a name="toc-Package-Locks-1" href="#Package-Locks">11 Package Locks</a>
  <ul class="no-bullet">
    <li><a name="toc-Package-Lock-Concepts-1" href="#Package-Lock-Concepts">11.1 Package Lock Concepts</a>
    <ul class="no-bullet">
      <li><a name="toc-Package-Locking-Overview" href="#Package-Lock-Overview">11.1.1 Package Locking Overview</a></li>
      <li><a name="toc-Implementation-Packages-1" href="#Implementation-Packages">11.1.2 Implementation Packages</a></li>
      <li><a name="toc-Package-Lock-Violations-1" href="#Package-Lock-Violations">11.1.3 Package Lock Violations</a>
      <ul class="no-bullet">
        <li><a name="toc-Lexical-Bindings-and-Declarations" href="#Lexical-Bindings-and-Declarations">11.1.3.1 Lexical Bindings and Declarations</a></li>
        <li><a name="toc-Other-Operations" href="#Other-Operations">11.1.3.2 Other Operations</a></li>
      </ul></li>
      <li><a name="toc-Package-Locks-in-Compiled-Code-1" href="#Package-Locks-in-Compiled-Code">11.1.4 Package Locks in Compiled Code</a>
      <ul class="no-bullet">
        <li><a name="toc-Interned-Symbols" href="#Interned-Symbols">11.1.4.1 Interned Symbols</a></li>
        <li><a name="toc-Other-Limitations-on-Compiled-Code" href="#Other-Limitations-on-Compiled-Code">11.1.4.2 Other Limitations on Compiled Code</a></li>
      </ul></li>
      <li><a name="toc-Operations-Violating-Package-Locks-1" href="#Operations-Violating-Package-Locks">11.1.5 Operations Violating Package Locks</a>
      <ul class="no-bullet">
        <li><a name="toc-Operations-on-Packages" href="#Operations-on-Packages">11.1.5.1 Operations on Packages</a></li>
        <li><a name="toc-Operations-on-Symbols" href="#Operations-on-Symbols">11.1.5.2 Operations on Symbols</a></li>
      </ul></li>
    </ul></li>
    <li><a name="toc-Package-Lock-Dictionary-1" href="#Package-Lock-Dictionary">11.2 Package Lock Dictionary</a></li>
  </ul></li>
  <li><a name="toc-Threading-1" href="#Threading">12 Threading</a>
  <ul class="no-bullet">
    <li><a name="toc-Threading-basics-1" href="#Threading-basics">12.1 Threading basics</a>
    <ul class="no-bullet">
      <li><a name="toc-Thread-Objects" href="#Thread-Objects">12.1.1 Thread Objects</a></li>
      <li><a name="toc-Making_002c-Returning-From_002c-Joining_002c-and-Yielding-Threads" href="#Making_002c-Returning-From_002c-Joining_002c-and-Yielding-Threads">12.1.2 Making, Returning From, Joining, and Yielding Threads</a></li>
      <li><a name="toc-Asynchronous-Operations" href="#Asynchronous-Operations">12.1.3 Asynchronous Operations</a></li>
      <li><a name="toc-Miscellaneous-Operations" href="#Miscellaneous-Operations">12.1.4 Miscellaneous Operations</a></li>
      <li><a name="toc-Error-Conditions" href="#Error-Conditions">12.1.5 Error Conditions</a></li>
    </ul></li>
    <li><a name="toc-Special-Variables-1" href="#Special-Variables">12.2 Special Variables</a></li>
    <li><a name="toc-Atomic-Operations-1" href="#Atomic-Operations">12.3 Atomic Operations</a>
    <ul class="no-bullet">
      <li><a name="toc-CAS-Protocol" href="#CAS-Protocol">CAS Protocol</a></li>
    </ul></li>
    <li><a name="toc-Mutex-Support-1" href="#Mutex-Support">12.4 Mutex Support</a></li>
    <li><a name="toc-Semaphores-1" href="#Semaphores">12.5 Semaphores</a></li>
    <li><a name="toc-Waitqueue_002fcondition-variables-1" href="#Waitqueue_002fcondition-variables">12.6 Waitqueue/condition variables</a></li>
    <li><a name="toc-Barriers-1" href="#Barriers">12.7 Barriers</a></li>
    <li><a name="toc-Sessions_002fDebugging-1" href="#Sessions_002fDebugging">12.8 Sessions/Debugging</a></li>
    <li><a name="toc-Foreign-threads-1" href="#Foreign-threads">12.9 Foreign threads</a></li>
    <li><a name="toc-Implementation-_0028Linux-x86_002fx86_002d64_0029-1" href="#Implementation-_0028Linux-x86_002fx86_002d64_0029">12.10 Implementation (Linux x86/x86-64)</a></li>
  </ul></li>
  <li><a name="toc-Timers-1" href="#Timers">13 Timers</a>
  <ul class="no-bullet">
    <li><a name="toc-Timer-Dictionary" href="#Timer-Dictionary">13.1 Timer Dictionary</a></li>
  </ul></li>
  <li><a name="toc-Networking-1" href="#Networking">14 Networking</a>
  <ul class="no-bullet">
    <li><a name="toc-Sockets-Overview-1" href="#Sockets-Overview">14.1 Sockets Overview</a></li>
    <li><a name="toc-General-Sockets-1" href="#General-Sockets">14.2 General Sockets</a></li>
    <li><a name="toc-Socket-Options-1" href="#Socket-Options">14.3 Socket Options</a></li>
    <li><a name="toc-INET-Domain-Sockets-1" href="#INET-Domain-Sockets">14.4 INET Domain Sockets</a></li>
    <li><a name="toc-Local-_0028Unix_0029-Domain-Sockets-1" href="#Local-_0028Unix_0029-Domain-Sockets">14.5 Local (Unix) Domain Sockets</a></li>
    <li><a name="toc-Name-Service-1" href="#Name-Service">14.6 Name Service</a></li>
  </ul></li>
  <li><a name="toc-Profiling-1" href="#Profiling">15 Profiling</a>
  <ul class="no-bullet">
    <li><a name="toc-Deterministic-Profiler-1" href="#Deterministic-Profiler">15.1 Deterministic Profiler</a></li>
    <li><a name="toc-Statistical-Profiler-1" href="#Statistical-Profiler">15.2 Statistical Profiler</a>
    <ul class="no-bullet">
      <li><a name="toc-Example-Usage" href="#Example-Usage">15.2.1 Example Usage</a></li>
      <li><a name="toc-Output" href="#Output">15.2.2 Output</a></li>
      <li><a name="toc-Platform-support" href="#Platform-support">15.2.3 Platform support</a></li>
      <li><a name="toc-Macros" href="#Macros">15.2.4 Macros</a></li>
      <li><a name="toc-Functions" href="#Functions">15.2.5 Functions</a></li>
      <li><a name="toc-Variables" href="#Variables">15.2.6 Variables</a></li>
      <li><a name="toc-Credits" href="#Credits">15.2.7 Credits</a></li>
    </ul></li>
  </ul></li>
  <li><a name="toc-Contributed-Modules-1" href="#Contributed-Modules">16 Contributed Modules</a>
  <ul class="no-bullet">
    <li><a name="toc-sb_002daclrepl-1" href="#sb_002daclrepl">16.1 sb-aclrepl</a>
    <ul class="no-bullet">
      <li><a name="toc-Usage" href="#Usage">16.1.1 Usage</a></li>
      <li><a name="toc-Customization" href="#Customization">16.1.2 Customization</a></li>
      <li><a name="toc-Example-Initialization" href="#Example-Initialization">16.1.3 Example Initialization</a></li>
      <li><a name="toc-Credits-1" href="#Credits-1">16.1.4 Credits</a></li>
    </ul></li>
    <li><a name="toc-sb_002dconcurrency-1" href="#sb_002dconcurrency">16.2 sb-concurrency</a>
    <ul class="no-bullet">
      <li><a name="toc-Queue" href="#Queue">16.2.1 Queue</a></li>
      <li><a name="toc-Mailbox-_0028lock_002dfree_0029" href="#Mailbox-_0028lock_002dfree_0029">16.2.2 Mailbox (lock-free)</a></li>
      <li><a name="toc-Gates" href="#Gates">16.2.3 Gates</a></li>
      <li><a name="toc-Frlocks_002c-aka-Fast-Read-Locks" href="#Frlocks_002c-aka-Fast-Read-Locks">16.2.4 Frlocks, aka Fast Read Locks</a></li>
    </ul></li>
    <li><a name="toc-sb_002dcover-1" href="#sb_002dcover">16.3 sb-cover</a>
    <ul class="no-bullet">
      <li><a name="toc-Example-Usage-1" href="#Example-Usage-1">16.3.1 Example Usage</a></li>
      <li><a name="toc-Functions-1" href="#Functions-1">16.3.2 Functions</a></li>
    </ul></li>
    <li><a name="toc-sb_002dgrovel-1" href="#sb_002dgrovel">16.4 sb-grovel</a>
    <ul class="no-bullet">
      <li><a name="toc-Using-sb_002dgrovel-in-your-own-ASDF-system" href="#Using-sb_002dgrovel-in-your-own-ASDF-system">16.4.1 Using sb-grovel in your own ASDF system</a></li>
      <li><a name="toc-Contents-of-a-grovel_002dconstants_002dfile" href="#Contents-of-a-grovel_002dconstants_002dfile">16.4.2 Contents of a grovel-constants-file</a></li>
      <li><a name="toc-Programming-with-sb_002dgrovel_0027s-structure-types" href="#Programming-with-sb_002dgrovel_0027s-structure-types">16.4.3 Programming with sb-grovel&rsquo;s structure types</a>
      <ul class="no-bullet">
        <li><a name="toc-Traps-and-Pitfalls" href="#Traps-and-Pitfalls">16.4.3.1 Traps and Pitfalls</a></li>
      </ul></li>
    </ul></li>
    <li><a name="toc-sb_002dmd5-1" href="#sb_002dmd5">16.5 sb-md5</a>
    <ul class="no-bullet">
      <li><a name="toc-Credits-2" href="#Credits-2">16.5.1 Credits</a></li>
    </ul></li>
    <li><a name="toc-sb_002dposix-1" href="#sb_002dposix">16.6 sb-posix</a>
    <ul class="no-bullet">
      <li><a name="toc-Lisp-names-for-C-names-1" href="#Lisp-names-for-C-names">16.6.1 Lisp names for C names</a></li>
      <li><a name="toc-Types-1" href="#Types">16.6.2 Types</a>
      <ul class="no-bullet">
        <li><a name="toc-File_002ddescriptors-1" href="#File_002ddescriptors">16.6.2.1 File-descriptors</a></li>
        <li><a name="toc-Filenames-1" href="#Filenames">16.6.2.2 Filenames</a></li>
      </ul></li>
      <li><a name="toc-Function-Parameters-1" href="#Function-Parameters">16.6.3 Function Parameters</a></li>
      <li><a name="toc-Function-Return-Values-1" href="#Function-Return-Values">16.6.4 Function Return Values</a></li>
      <li><a name="toc-Lisp-objects-and-C-structures-1" href="#Lisp-objects-and-C-structures">16.6.5 Lisp objects and C structures</a></li>
      <li><a name="toc-Functions-with-idiosyncratic-bindings-1" href="#Functions-with-idiosyncratic-bindings">16.6.6 Functions with idiosyncratic bindings</a></li>
    </ul></li>
    <li><a name="toc-sb_002dqueue-1" href="#sb_002dqueue">16.7 sb-queue</a></li>
    <li><a name="toc-sb_002drotate_002dbyte-1" href="#sb_002drotate_002dbyte">16.8 sb-rotate-byte</a></li>
  </ul></li>
  <li><a name="toc-Deprecation-1" href="#Deprecation">17 Deprecation</a>
  <ul class="no-bullet">
    <li><a name="toc-Why-Deprecate_003f-1" href="#Why-Deprecate_003f">17.1 Why Deprecate?</a></li>
    <li><a name="toc-The-Deprecation-Pipeline-1" href="#The-Deprecation-Pipeline">17.2 The Deprecation Pipeline</a></li>
    <li><a name="toc-Deprecation-Conditions-1" href="#Deprecation-Conditions">17.3 Deprecation Conditions</a></li>
    <li><a name="toc-Introspecting-Deprecation-Information-1" href="#Introspecting-Deprecation-Information">17.4 Introspecting Deprecation Information</a></li>
    <li><a name="toc-Deprecation-Declaration-1" href="#Deprecation-Declaration">17.5 Deprecation Declaration</a></li>
    <li><a name="toc-Deprecation-Examples-1" href="#Deprecation-Examples">17.6 Deprecation Examples</a></li>
    <li><a name="toc-Deprecated-Interfaces-in-SBCL-1" href="#Deprecated-Interfaces-in-SBCL">17.7 Deprecated Interfaces in SBCL</a>
    <ul class="no-bullet">
      <li><a name="toc-List-of-Deprecated-Interfaces" href="#List-of-Deprecated-Interfaces">17.7.1 List of Deprecated Interfaces</a>
      <ul class="no-bullet">
        <li><a name="toc-Early-Deprecation" href="#Early-Deprecation">17.7.1.1 Early Deprecation</a></li>
        <li><a name="toc-Late-Deprecation" href="#Late-Deprecation">17.7.1.2 Late Deprecation</a></li>
        <li><a name="toc-Final-Deprecation" href="#Final-Deprecation">17.7.1.3 Final Deprecation</a></li>
      </ul></li>
      <li><a name="toc-Historical-Interfaces" href="#Historical-Interfaces">17.7.2 Historical Interfaces</a></li>
    </ul></li>
  </ul></li>
  <li><a name="toc-Concept-Index-1" href="#Concept-Index">Appendix A Concept Index</a></li>
  <li><a name="toc-Function-Index-1" href="#Function-Index">Appendix B Function Index</a></li>
  <li><a name="toc-Variable-Index-1" href="#Variable-Index">Appendix C Variable Index</a></li>
  <li><a name="toc-Type-Index-1" href="#Type-Index">Appendix D Type Index</a></li>
  <li><a name="toc-Colophon-1" href="#Colophon">Colophon</a></li>
</ul>
</div>





<a name="Top"></a>
<div class="header">
<p>
Next: <a href="#Getting-Support-and-Reporting-Bugs" accesskey="n" rel="next">Getting Support and Reporting Bugs</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sbcl"></a>
<h1 class="top">sbcl</h1>

<blockquote>
<p>This manual is part of the SBCL software system. See the
<samp>README</samp> file for more information.
</p>
<p>This manual is largely derived from the manual for the CMUCL system,
which was produced at Carnegie Mellon University and later released
into the public domain. This manual is in the public domain and is
provided with absolutely no warranty. See the <samp>COPYING</samp> and
<samp>CREDITS</samp> files for more information.
</p></blockquote>


<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Getting-Support-and-Reporting-Bugs" accesskey="1">Getting Support and Reporting Bugs</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Introduction" accesskey="2">Introduction</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Starting-and-Stopping" accesskey="3">Starting and Stopping</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Compiler" accesskey="4">Compiler</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Debugger" accesskey="5">Debugger</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Efficiency" accesskey="6">Efficiency</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Beyond-the-ANSI-Standard" accesskey="7">Beyond the ANSI Standard</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-Function-Interface" accesskey="8">Foreign Function Interface</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Pathnames" accesskey="9">Pathnames</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Streams">Streams</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Package-Locks">Package Locks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Threading">Threading</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Timers">Timers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Networking">Networking</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Profiling">Profiling</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Contributed-Modules">Contributed Modules</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Deprecation">Deprecation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Concept-Index">Concept Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Function-Index">Function Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Variable-Index">Variable Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Type-Index">Type Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Colophon">Colophon</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>


<hr>
<a name="Getting-Support-and-Reporting-Bugs"></a>
<div class="header">
<p>
Next: <a href="#Introduction" accesskey="n" rel="next">Introduction</a>, Previous: <a href="#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Getting-Support-and-Reporting-Bugs-1"></a>
<h2 class="chapter">1 Getting Support and Reporting Bugs</h2>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Volunteer-Support" accesskey="1">Volunteer Support</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Commercial-Support" accesskey="2">Commercial Support</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Reporting-Bugs" accesskey="3">Reporting Bugs</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Volunteer-Support"></a>
<div class="header">
<p>
Next: <a href="#Commercial-Support" accesskey="n" rel="next">Commercial Support</a>, Up: <a href="#Getting-Support-and-Reporting-Bugs" accesskey="u" rel="up">Getting Support and Reporting Bugs</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Volunteer-Support-1"></a>
<h3 class="section">1.1 Volunteer Support</h3>

<p>Your primary source of SBCL support should probably be the mailing
list <strong>sbcl-help</strong>: in addition to other users SBCL developers
monitor this list and are available for advice. As an anti-spam
measure subscription is required for posting:
</p>
<p>&nbsp;<!-- /@w --> &nbsp;<!-- /@w --> <a href="https://lists.sourceforge.net/lists/listinfo/sbcl-help">https://lists.sourceforge.net/lists/listinfo/sbcl-help</a>
</p>
<p>Remember that the people answering your question are volunteers, so
you stand a much better chance of getting a good answer if you ask a
good question.
</p>
<p>Before sending mail, check the list archives at either
</p>
<p>&nbsp;<!-- /@w --> &nbsp;<!-- /@w --> <a href="http://sourceforge.net/mailarchive/forum.php?forum_name=sbcl-help">http://sourceforge.net/mailarchive/forum.php?forum_name=sbcl-help</a>
</p>
<p>or
</p>
<p>&nbsp;<!-- /@w --> &nbsp;<!-- /@w --> <a href="http://news.gmane.org/gmane.lisp.steel-bank.general">http://news.gmane.org/gmane.lisp.steel-bank.general</a>
</p>
<p>to see if your question has been answered already. Checking the bug
database is also worth it See <a href="#Reporting-Bugs">Reporting Bugs</a>, to see if the issue
is already known.
</p>
<p>For general advice on asking good questions, see
</p>
<p>&nbsp;<!-- /@w --> &nbsp;<!-- /@w --> <a href="http://www.catb.org/~esr/faqs/smart-questions.html">http://www.catb.org/~esr/faqs/smart-questions.html</a>.
</p>
<hr>
<a name="Commercial-Support"></a>
<div class="header">
<p>
Next: <a href="#Reporting-Bugs" accesskey="n" rel="next">Reporting Bugs</a>, Previous: <a href="#Volunteer-Support" accesskey="p" rel="prev">Volunteer Support</a>, Up: <a href="#Getting-Support-and-Reporting-Bugs" accesskey="u" rel="up">Getting Support and Reporting Bugs</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Commercial-Support-1"></a>
<h3 class="section">1.2 Commercial Support</h3>

<p>There is no formal organization developing SBCL, but if you need a
paid support arrangement or custom SBCL development, we maintain the
list of companies and consultants below. Use it to identify service
providers with appropriate skills and interests, and contact them
directly.
</p>
<p>The SBCL project cannot verify the accuracy of the information or the
competence of the people listed, and they have provided their own
blurbs below: you must make your own judgement of suitability from the
available information - refer to the links they provide, the CREDITS
file, mailing list archives, CVS commit messages, and so on. Please
feel free to ask for advice on the sbcl-help list.
</p>
<p>(At present, no companies or consultants wish to advertise paid support
or custom SBCL development in this manual).
</p>
<hr>
<a name="Reporting-Bugs"></a>
<div class="header">
<p>
Previous: <a href="#Commercial-Support" accesskey="p" rel="prev">Commercial Support</a>, Up: <a href="#Getting-Support-and-Reporting-Bugs" accesskey="u" rel="up">Getting Support and Reporting Bugs</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Reporting-Bugs-1"></a>
<h3 class="section">1.3 Reporting Bugs</h3>

<p>SBCL uses Launchpad to track bugs. The bug database is available at
</p>
<p>&nbsp;<!-- /@w --> &nbsp;<!-- /@w --> <a href="https://bugs.launchpad.net/sbcl">https://bugs.launchpad.net/sbcl</a>
</p>
<p>Reporting bugs there requires registering at Launchpad. However, bugs
can also be reported on the mailing list <strong>sbcl-bugs</strong>, which is
moderated but does <em>not</em> require subscribing.
</p>
<p>Simply send email to <a href="mailto:sbcl-bugs@lists.sourceforge.net">sbcl-bugs@lists.sourceforge.net</a> and the
bug will be checked and added to Launchpad by SBCL maintainers.
</p>
<a name="How-to-Report-Bugs-Effectively"></a>
<h4 class="subsection">1.3.1 How to Report Bugs Effectively</h4>

<p>Please include enough information in a bug report that someone reading
it can reproduce the problem, i.e. don&rsquo;t write
</p>
<div class="example">
<pre class="example">Subject: apparent bug in PRINT-OBJECT (or *PRINT-LENGTH*?)
PRINT-OBJECT doesn't seem to work with *PRINT-LENGTH*. Is this a bug?
</pre></div>

<p>but instead
</p>
<div class="example">
<pre class="example">Subject: apparent bug in PRINT-OBJECT (or *PRINT-LENGTH*?)
In sbcl-1.2.3 running under OpenBSD 4.5 on my Alpha box, when
I compile and load the file
   (DEFSTRUCT (FOO (:PRINT-OBJECT (LAMBDA (X Y)
                                    (LET ((*PRINT-LENGTH* 4))
                                      (PRINT X Y)))))
     X Y)
then at the command line type
   (MAKE-FOO)
the program loops endlessly instead of printing the object.
</pre></div>

<p>A more in-depth discussion on reporting bugs effectively can be found
at
</p>
<p>&nbsp;<!-- /@w --> &nbsp;<!-- /@w --> <a href="http://www.chiark.greenend.org.uk/~sgtatham/bugs.html">http://www.chiark.greenend.org.uk/~sgtatham/bugs.html</a>.
</p>
<a name="Signal-Related-Bugs"></a>
<h4 class="subsection">1.3.2 Signal Related Bugs</h4>

<p>If you run into a signal related bug, you are getting fatal errors
such as <code>signal N is [un]blocked</code> or just hangs, and you want to
send a useful bug report then:
</p>
<ol>
<li> <a name="index-ldb"></a>
Compile SBCL with ldb enabled (feature <code>:sb-ldb</code>, see
<samp>base-target-features.lisp-expr</samp>) and change <code>#define
QSHOW_SIGNAL 0</code> to <code>#define QSHOW_SIGNAL 1</code> in
<samp>src/runtime/runtime.h</samp>.

</li><li> Isolate a smallish test case, run it.

</li><li> If it just hangs kill it with sigabrt: <code>kill -ABRT &lt;pidof sbcl&gt;</code>.

</li><li> Print the backtrace from ldb by typing <code>ba</code>.

</li><li> Attach gdb: <code>gdb -p &lt;pidof sbcl&gt;</code> and get backtraces for all threads:
<code>thread apply all ba</code>.

</li><li> If multiple threads are in play then still in gdb, try to get Lisp
backtrace for all threads: <code>thread apply all call
backtrace_from_fp($ebp, 100)</code>. Substitute <code>$ebp</code> with <code>$rbp</code>
on x86-64. The backtraces will appear in the stdout of the SBCL
process.

</li><li> Send a report with the backtraces and the output (both stdout and
stderr) produced by SBCL.

</li><li> Don&rsquo;t forget to include OS and SBCL version.

</li><li> If available, include information on outcome of the same test with
other versions of SBCL, OS, ...
</li></ol>
<hr>
<a name="Introduction"></a>
<div class="header">
<p>
Next: <a href="#Starting-and-Stopping" accesskey="n" rel="next">Starting and Stopping</a>, Previous: <a href="#Getting-Support-and-Reporting-Bugs" accesskey="p" rel="prev">Getting Support and Reporting Bugs</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Introduction-1"></a>
<h2 class="chapter">2 Introduction</h2>

<p>SBCL is a mostly-conforming implementation of the ANSI Common Lisp
standard. This manual focuses on behavior which is specific to SBCL,
not on behavior which is common to all implementations of ANSI Common
Lisp.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#ANSI-Conformance" accesskey="1">ANSI Conformance</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Extensions" accesskey="2">Extensions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Idiosyncrasies" accesskey="3">Idiosyncrasies</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Development-Tools" accesskey="4">Development Tools</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#More-SBCL-Information" accesskey="5">More SBCL Information</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#More-Common-Lisp-Information" accesskey="6">More Common Lisp Information</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#History-and-Implementation-of-SBCL" accesskey="7">History and Implementation of SBCL</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>



<hr>
<a name="ANSI-Conformance"></a>
<div class="header">
<p>
Next: <a href="#Extensions" accesskey="n" rel="next">Extensions</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="ANSI-Conformance-1"></a>
<h3 class="section">2.1 ANSI Conformance</h3>

<p>Essentially every type of non-conformance is considered a bug. (The
exceptions involve internal inconsistencies in the standard.)
See <a href="#Reporting-Bugs">Reporting Bugs</a>.
</p>
<hr>
<a name="Extensions"></a>
<div class="header">
<p>
Next: <a href="#Idiosyncrasies" accesskey="n" rel="next">Idiosyncrasies</a>, Previous: <a href="#ANSI-Conformance" accesskey="p" rel="prev">ANSI Conformance</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Extensions-1"></a>
<h3 class="section">2.2 Extensions</h3>

<p>SBCL comes with numerous extensions, some in core and some in modules
loadable with <code>require</code>. Unfortunately, not all of these
extensions have proper documentation yet.
</p>

<dl compact="compact">
<dt><strong>System Definition Tool</strong></dt>
<dd><p><code>asdf</code> is a flexible and popular protocol-oriented system
definition tool by Daniel Barlow. See <a href="asdf.html#Top">(asdf)the asdf manual</a>, for
more information.
</p>
</dd>
<dt><strong>Foreign Function Interface</strong></dt>
<dd><p><code>sb-alien</code> package allows interfacing with C-code, loading shared
object files, etc. See <a href="#Foreign-Function-Interface">Foreign Function Interface</a>.
</p>
<p><code>sb-grovel</code> can be used to partially automate generation of
foreign function interface definitions. See <a href="#sb_002dgrovel">sb-grovel</a>.
</p>
</dd>
<dt><strong>Recursive Event Loop</strong></dt>
<dd><p>SBCL provides a recursive event loop (<code>serve-event</code>) for doing
non-blocking IO on multiple streams without using threads.
</p>
</dd>
<dt><strong>Timeouts and Deadlines</strong></dt>
<dd><p>SBCL allows restricting the execution time of individual operations or
parts of a computation using <code>:timeout</code> arguments to certain
blocking operations, synchronous timeouts and asynchronous timeouts. The
latter two affect operations without explicit timeout support (such as
standard functions and macros). See <a href="#Timeouts-and-Deadlines">Timeouts and Deadlines</a>.
</p>
</dd>
<dt><strong>Metaobject Protocol</strong></dt>
<dd><p><code>sb-mop</code> package provides a metaobject protocol for the Common
Lisp Object System as described in <cite>Art of Metaobject Protocol</cite>.
</p>
</dd>
<dt><strong>Extensible Sequences</strong></dt>
<dd><p>SBCL allows users to define subclasses of the <code>sequence</code>
class. See <a href="#Extensible-Sequences">Extensible Sequences</a>.
</p>
</dd>
<dt><strong>Native Threads</strong></dt>
<dd><p>SBCL has native threads on x86/Linux, capable of taking advantage
of SMP on multiprocessor machines. See <a href="#Threading">Threading</a>.
</p>
</dd>
<dt><strong>Network Interface</strong></dt>
<dd><p><code>sb-bsd-sockets</code> is a low-level networking interface, providing
both TCP and UDP sockets. See <a href="#Networking">Networking</a>.
</p>
</dd>
<dt><strong>Introspective Facilities</strong></dt>
<dd><p><code>sb-introspect</code> module offers numerous introspective extensions,
including access to function lambda-lists and a cross referencing
facility.
</p>
</dd>
<dt><strong>Operating System Interface</strong></dt>
<dd><p><code>sb-ext</code> contains a number of functions for running external
processes, accessing environment variables, etc.
</p>
<p><code>sb-posix</code> module provides a lispy interface to standard POSIX
facilities.
</p>
</dd>
<dt><strong>Extensible Streams</strong></dt>
<dd><p><code>sb-gray</code> is an implementation of <em>Gray Streams</em>. See <a href="#Gray-Streams">Gray Streams</a>.
</p>
<p><code>sb-simple-streams</code> is an implementation of the <em>simple
streams</em> API proposed by Franz Inc. See <a href="#Simple-Streams">Simple Streams</a>.
</p>
</dd>
<dt><strong>Profiling</strong></dt>
<dd><p><code>sb-profile</code> is a exact per-function profiler. See <a href="#Deterministic-Profiler">Deterministic Profiler</a>.
</p>
<p><code>sb-sprof</code> is a statistical profiler, capable of call-graph
generation and instruction level profiling, which also supports
allocation profiling. See <a href="#Statistical-Profiler">Statistical Profiler</a>.
</p>
</dd>
<dt><strong>Customization Hooks</strong></dt>
<dd><p>SBCL contains a number of extra-standard customization hooks that
can be used to tweak the behaviour of the system. See <a href="#Customization-Hooks-for-Users">Customization Hooks for Users</a>.
</p>
<p><code>sb-aclrepl</code> provides an Allegro CL -style toplevel for SBCL,
as an alternative to the classic CMUCL-style one. See <a href="#sb_002daclrepl">sb-aclrepl</a>.
</p>
</dd>
<dt><strong>CLTL2 Compatibility Layer</strong></dt>
<dd><p><code>sb-cltl2</code> module provides <code>compiler-let</code> and environment
access functionality described in <cite>Common Lisp The Language, 2nd
Edition</cite> which were removed from the language during the ANSI
standardization process.
</p>
</dd>
<dt><strong>Executable Delivery</strong></dt>
<dd><p>The <code>:executable</code> argument to <a href="#Function-sb_002dext_003asave_002dlisp_002dand_002ddie">Function sb-ext:save-lisp-and-die</a> can produce a &lsquo;standalone&rsquo; executable
containing both an image of the current Lisp session and an SBCL
runtime.
</p>
</dd>
<dt><strong>Bitwise Rotation</strong></dt>
<dd><p><code>sb-rotate-byte</code> provides an efficient primitive for bitwise
rotation of integers, an operation required by e.g. numerous
cryptographic algorithms, but not available as a primitive in ANSI
Common Lisp. See <a href="#sb_002drotate_002dbyte">sb-rotate-byte</a>.
</p>
</dd>
<dt><strong>Test Harness</strong></dt>
<dd><p><code>sb-rt</code> module is a simple yet attractive regression and
unit-test framework.
</p>
</dd>
<dt><strong>MD5 Sums</strong></dt>
<dd><p><code>sb-md5</code> is an implementation of the MD5 message digest algorithm
for Common Lisp, using the modular arithmetic optimizations provided
by SBCL. See <a href="#sb_002dmd5">sb-md5</a>.
</p>
</dd>
</dl>




<hr>
<a name="Idiosyncrasies"></a>
<div class="header">
<p>
Next: <a href="#Development-Tools" accesskey="n" rel="next">Development Tools</a>, Previous: <a href="#Extensions" accesskey="p" rel="prev">Extensions</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Idiosyncrasies-1"></a>
<h3 class="section">2.3 Idiosyncrasies</h3>

<p>The information in this section describes some of the ways that SBCL
deals with choices that the ANSI standard leaves to the
implementation.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Declarations" accesskey="1">Declarations</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#FASL-Format" accesskey="2">FASL Format</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Compiler_002donly-Implementation" accesskey="3">Compiler-only Implementation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Defining-Constants" accesskey="4">Defining Constants</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Style-Warnings" accesskey="5">Style Warnings</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Declarations"></a>
<div class="header">
<p>
Next: <a href="#FASL-Format" accesskey="n" rel="next">FASL Format</a>, Up: <a href="#Idiosyncrasies" accesskey="u" rel="up">Idiosyncrasies</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Declarations-1"></a>
<h4 class="subsection">2.3.1 Declarations</h4>

<p>Declarations are generally treated as assertions. This general
principle, and its implications, and the bugs which still keep the
compiler from quite satisfying this principle, are discussed in
<a href="#Declarations-as-Assertions">Declarations as Assertions</a>.
</p>

<hr>
<a name="FASL-Format"></a>
<div class="header">
<p>
Next: <a href="#Compiler_002donly-Implementation" accesskey="n" rel="next">Compiler-only Implementation</a>, Previous: <a href="#Declarations" accesskey="p" rel="prev">Declarations</a>, Up: <a href="#Idiosyncrasies" accesskey="u" rel="up">Idiosyncrasies</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="FASL-Format-1"></a>
<h4 class="subsection">2.3.2 FASL Format</h4>

<p>SBCL fasl-format is binary compatible only with the exact SBCL version
it was generated with. While this is obviously suboptimal, it has
proven more robust than trying to maintain fasl compatibility across
versions: accidentally breaking things is far too easy, and can lead
to hard to diagnose bugs.
</p>
<p>The following snippet handles fasl recompilation automatically for
ASDF-based systems, and makes a good candidate for inclusion in
the user or system initialization file (see <a href="#Initialization-Files">Initialization Files</a>.)
</p>
<div class="lisp">
<pre class="lisp">(require :asdf)

;;; If a fasl was stale, try to recompile and load (once).
(defmethod asdf:perform :around ((o asdf:load-op)
                                 (c asdf:cl-source-file))
   (handler-case (call-next-method o c)
      ;; If a fasl was stale, try to recompile and load (once).
      (sb-ext:invalid-fasl ()
         (asdf:perform (make-instance 'asdf:compile-op) c)
         (call-next-method))))
</pre></div>


<hr>
<a name="Compiler_002donly-Implementation"></a>
<div class="header">
<p>
Next: <a href="#Defining-Constants" accesskey="n" rel="next">Defining Constants</a>, Previous: <a href="#FASL-Format" accesskey="p" rel="prev">FASL Format</a>, Up: <a href="#Idiosyncrasies" accesskey="u" rel="up">Idiosyncrasies</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Compiler_002donly-Implementation-1"></a>
<h4 class="subsection">2.3.3 Compiler-only Implementation</h4>

<p>SBCL is essentially a compiler-only implementation of Common Lisp.
That is, for all but a few special cases, <code>eval</code> creates a lambda
expression, calls <code>compile</code> on the lambda expression to create a
compiled function, and then calls <code>funcall</code> on the resulting
function object. A more traditional interpreter is also available on
default builds; it is usually only called internally.  This is
explicitly allowed by the ANSI standard, but leads to some oddities;
e.g. at default settings, <code>functionp</code> and
<code>compiled-function-p</code> are equivalent, and they collapse into the
same function when SBCL is built without the interpreter.
</p>
<hr>
<a name="Defining-Constants"></a>
<div class="header">
<p>
Next: <a href="#Style-Warnings" accesskey="n" rel="next">Style Warnings</a>, Previous: <a href="#Compiler_002donly-Implementation" accesskey="p" rel="prev">Compiler-only Implementation</a>, Up: <a href="#Idiosyncrasies" accesskey="u" rel="up">Idiosyncrasies</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Defining-Constants-1"></a>
<h4 class="subsection">2.3.4 Defining Constants</h4>
<a name="index-defconstant-_005bcl_005d"></a>

<p>SBCL is quite strict about ANSI&rsquo;s definition of <code>defconstant</code>.
ANSI says that doing <code>defconstant</code> of the same symbol more than
once is undefined unless the new value is <code>eql</code> to the old value.
Conforming to this specification is a nuisance when the &ldquo;constant&rdquo;
value is only constant under some weaker test like <code>string=</code> or
<code>equal</code>.
</p>
<p>It&rsquo;s especially annoying because, in SBCL, <code>defconstant</code> takes
effect not only at load time but also at compile time, so that just
compiling and loading reasonable code like
</p><div class="lisp">
<pre class="lisp">(defconstant +foobyte+ '(1 4))
</pre></div>
<p>runs into this undefined behavior. Many implementations of Common Lisp
try to help the programmer around this annoyance by silently accepting
the undefined code and trying to do what the programmer probably
meant.
</p>
<p>SBCL instead treats the undefined behavior as an error. Often such
code can be rewritten in portable ANSI Common Lisp which has the
desired behavior. E.g., the code above can be given an exactly defined
meaning by replacing <code>defconstant</code> either with
<code>defparameter</code> or with a customized macro which does the right
thing, e.g.
</p><div class="lisp">
<pre class="lisp">(defmacro define-constant (name value &amp;optional doc)
  `(defconstant ,name (if (boundp ',name) (symbol-value ',name) ,value)
                      ,@(when doc (list doc))))
</pre></div>
<p>or possibly along the lines of the <code>defconstant-eqx</code> macro used
internally in the implementation of SBCL itself. In circumstances
where this is not appropriate, the programmer can handle the condition
type <code>sb-ext:defconstant-uneql</code>, and choose either the
<code>continue</code> or <code>abort</code> restart as appropriate.
</p>
<hr>
<a name="Style-Warnings"></a>
<div class="header">
<p>
Previous: <a href="#Defining-Constants" accesskey="p" rel="prev">Defining Constants</a>, Up: <a href="#Idiosyncrasies" accesskey="u" rel="up">Idiosyncrasies</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Style-Warnings-1"></a>
<h4 class="subsection">2.3.5 Style Warnings</h4>

<p>SBCL gives style warnings about various kinds of perfectly legal code,
e.g.
</p>
<ul>
<li> multiple <code>defun</code>s of the same symbol in different units;

</li><li> special variables not named in the conventional <code>*foo*</code> style,
and lexical variables unconventionally named in the <code>*foo*</code> style

</li></ul>

<p>This causes friction with people who point out that other ways of
organizing code (especially avoiding the use of <code>defgeneric</code>) are
just as aesthetically stylish.  However, these warnings should be read
not as &ldquo;warning, bad aesthetics detected, you have no style&rdquo; but
&ldquo;warning, this style keeps the compiler from understanding the code
as well as you might like.&rdquo; That is, unless the compiler warns about
such conditions, there&rsquo;s no way for the compiler to warn about some
programming errors which would otherwise be easy to overlook. (Related
bug: The warning about multiple <code>defun</code>s is pointlessly annoying
when you compile and then load a function containing <code>defun</code>
wrapped in <code>eval-when</code>, and ideally should be suppressed in that
case, but still isn&rsquo;t as of SBCL 0.7.6.)
</p>



<hr>
<a name="Development-Tools"></a>
<div class="header">
<p>
Next: <a href="#More-SBCL-Information" accesskey="n" rel="next">More SBCL Information</a>, Previous: <a href="#Idiosyncrasies" accesskey="p" rel="prev">Idiosyncrasies</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Development-Tools-1"></a>
<h3 class="section">2.4 Development Tools</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Editor-Integration" accesskey="1">Editor Integration</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Language-Reference" accesskey="2">Language Reference</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Generating-Executables" accesskey="3">Generating Executables</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Editor-Integration"></a>
<div class="header">
<p>
Next: <a href="#Language-Reference" accesskey="n" rel="next">Language Reference</a>, Up: <a href="#Development-Tools" accesskey="u" rel="up">Development Tools</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Editor-Integration-1"></a>
<h4 class="subsection">2.4.1 Editor Integration</h4>

<p>Though SBCL can be used running &ldquo;bare&rdquo;, the recommended mode of
development is with an editor connected to SBCL, supporting not
only basic lisp editing (paren-matching, etc), but providing among
other features an integrated debugger, interactive compilation, and
automated documentation lookup.
</p>
<p>Currently <em>SLIME</em><a name="DOCF1" href="#FOOT1"><sup>1</sup></a> (Superior Lisp Interaction
Mode for Emacs) together with Emacs is recommended for use with
SBCL, though other options exist as well.
</p>
<p>SLIME can be downloaded from
<a href="http://www.common-lisp.net/project/slime/">http://www.common-lisp.net/project/slime/</a>.
</p>
<hr>
<a name="Language-Reference"></a>
<div class="header">
<p>
Next: <a href="#Generating-Executables" accesskey="n" rel="next">Generating Executables</a>, Previous: <a href="#Editor-Integration" accesskey="p" rel="prev">Editor Integration</a>, Up: <a href="#Development-Tools" accesskey="u" rel="up">Development Tools</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Language-Reference-1"></a>
<h4 class="subsection">2.4.2 Language Reference</h4>

<p><em>CLHS</em> (Common Lisp Hyperspec) is a hypertext version of the ANSI
standard, made freely available by <em>LispWorks</em> &ndash; an invaluable
reference.
</p>
<p>See: <a href="http://www.lispworks.com/reference/HyperSpec/index.html">http://www.lispworks.com/reference/HyperSpec/index.html</a>
</p>
<hr>
<a name="Generating-Executables"></a>
<div class="header">
<p>
Previous: <a href="#Language-Reference" accesskey="p" rel="prev">Language Reference</a>, Up: <a href="#Development-Tools" accesskey="u" rel="up">Development Tools</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Generating-Executables-1"></a>
<h4 class="subsection">2.4.3 Generating Executables</h4>

<p>SBCL can generate stand-alone executables.  The generated executables
include the SBCL runtime itself, so no restrictions are placed on
program functionality.  For example, a deployed program can call
<code>compile</code> and <code>load</code>, which requires the compiler to be present
in the executable.  For further information, See <a href="#Function-sb_002dext_003asave_002dlisp_002dand_002ddie">Function sb-ext:save-lisp-and-die</a>.
</p>

<hr>
<a name="More-SBCL-Information"></a>
<div class="header">
<p>
Next: <a href="#More-Common-Lisp-Information" accesskey="n" rel="next">More Common Lisp Information</a>, Previous: <a href="#Development-Tools" accesskey="p" rel="prev">Development Tools</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="More-SBCL-Information-1"></a>
<h3 class="section">2.5 More SBCL Information</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#SBCL-Homepage" accesskey="1">SBCL Homepage</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Online-Documentation" accesskey="2">Online Documentation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Additional-Documentation-Files" accesskey="3">Additional Documentation Files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Internals-Documentation" accesskey="4">Internals Documentation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="SBCL-Homepage"></a>
<div class="header">
<p>
Next: <a href="#Online-Documentation" accesskey="n" rel="next">Online Documentation</a>, Up: <a href="#More-SBCL-Information" accesskey="u" rel="up">More SBCL Information</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="SBCL-Homepage-1"></a>
<h4 class="subsection">2.5.1 SBCL Homepage</h4>

<p>The SBCL website at <a href="http://www.sbcl.org/">http://www.sbcl.org/</a> has some general
information, plus links to mailing lists devoted to SBCL, and to
archives of these mailing lists. Subscribing to the mailing lists
<cite>sbcl-help</cite> and <cite>sbcl-announce</cite> is recommended: both are
fairly low-volume, and help you keep abreast with SBCL development.
</p>
<hr>
<a name="Online-Documentation"></a>
<div class="header">
<p>
Next: <a href="#Additional-Documentation-Files" accesskey="n" rel="next">Additional Documentation Files</a>, Previous: <a href="#SBCL-Homepage" accesskey="p" rel="prev">SBCL Homepage</a>, Up: <a href="#More-SBCL-Information" accesskey="u" rel="up">More SBCL Information</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Online-Documentation-1"></a>
<h4 class="subsection">2.5.2 Online Documentation</h4>

<p>Documentation for non-ANSI extensions for various commands is
available online from the SBCL executable itself. The extensions
for functions which have their own command prompts (e.g. the debugger,
and <code>inspect</code>) are documented in text available by typing
<code>help</code> at their command prompts. The extensions for functions
which don&rsquo;t have their own command prompt (such as <code>trace</code>) are
described in their documentation strings, unless your SBCL was
compiled with an option not to include documentation strings, in which
case the documentation strings are only readable in the source code.
</p>
<hr>
<a name="Additional-Documentation-Files"></a>
<div class="header">
<p>
Next: <a href="#Internals-Documentation" accesskey="n" rel="next">Internals Documentation</a>, Previous: <a href="#Online-Documentation" accesskey="p" rel="prev">Online Documentation</a>, Up: <a href="#More-SBCL-Information" accesskey="u" rel="up">More SBCL Information</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Additional-Documentation-Files-1"></a>
<h4 class="subsection">2.5.3 Additional Documentation Files</h4>

<p>Besides this user manual both SBCL source and binary distributions
include some other SBCL-specific documentation files, which should be
installed along with this manual on your system, e.g. in
<samp>/usr/local/share/doc/sbcl/</samp>.
</p>
<dl compact="compact">
<dt><samp>COPYING</samp></dt>
<dd><p>Licence and copyright summary.
</p>
</dd>
<dt><samp>CREDITS</samp></dt>
<dd><p>Authorship information on various parts of SBCL.
</p>
</dd>
<dt><samp>INSTALL</samp></dt>
<dd><p>Covers installing SBCL from both source and binary distributions on
your system, and also has some installation related troubleshooting
information.
</p>
</dd>
<dt><samp>NEWS</samp></dt>
<dd><p>Summarizes changes between various SBCL versions.
</p>
</dd>
</dl>

<hr>
<a name="Internals-Documentation"></a>
<div class="header">
<p>
Previous: <a href="#Additional-Documentation-Files" accesskey="p" rel="prev">Additional Documentation Files</a>, Up: <a href="#More-SBCL-Information" accesskey="u" rel="up">More SBCL Information</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Internals-Documentation-1"></a>
<h4 class="subsection">2.5.4 Internals Documentation</h4>

<p>If you&rsquo;re interested in the development of the SBCL system itself,
then subscribing to <cite>sbcl-devel</cite> is a good idea.
</p>
<p>SBCL internals documentation &ndash; besides comments in the source &ndash; is
currently maintained as a <em>wiki-like</em> website:
<a href="http://sbcl-internals.cliki.net/">http://sbcl-internals.cliki.net/</a>.
</p>
<p>Some low-level information describing the programming details of the
conversion from CMUCL to SBCL is available in the
<samp>doc/FOR-CMUCL-DEVELOPERS</samp> file in the SBCL distribution, though
it is not installed by default.
</p>
<hr>
<a name="More-Common-Lisp-Information"></a>
<div class="header">
<p>
Next: <a href="#History-and-Implementation-of-SBCL" accesskey="n" rel="next">History and Implementation of SBCL</a>, Previous: <a href="#More-SBCL-Information" accesskey="p" rel="prev">More SBCL Information</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="More-Common-Lisp-Information-1"></a>
<h3 class="section">2.6 More Common Lisp Information</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Internet-Community" accesskey="1">Internet Community</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Third_002dparty-Libraries" accesskey="2">Third-party Libraries</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Common-Lisp-Books" accesskey="3">Common Lisp Books</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Internet-Community"></a>
<div class="header">
<p>
Next: <a href="#Third_002dparty-Libraries" accesskey="n" rel="next">Third-party Libraries</a>, Up: <a href="#More-Common-Lisp-Information" accesskey="u" rel="up">More Common Lisp Information</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Internet-Community-1"></a>
<h4 class="subsection">2.6.1 Internet Community</h4>


<p>The Common Lisp internet community is fairly diverse:
<a href="news://comp.lang.lisp">news://comp.lang.lisp</a> is fairly high volume newsgroup, but has
a rather poor signal/noise ratio. Various special interest mailing
lists and IRC tend to provide more content and less flames.
<a href="http://www.lisp.org">http://www.lisp.org</a> and <a href="http://www.cliki.net">http://www.cliki.net</a> contain
numerous pointers places in the net where lispers talks shop.
</p>
<hr>
<a name="Third_002dparty-Libraries"></a>
<div class="header">
<p>
Next: <a href="#Common-Lisp-Books" accesskey="n" rel="next">Common Lisp Books</a>, Previous: <a href="#Internet-Community" accesskey="p" rel="prev">Internet Community</a>, Up: <a href="#More-Common-Lisp-Information" accesskey="u" rel="up">More Common Lisp Information</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Third_002dparty-Libraries-1"></a>
<h4 class="subsection">2.6.2 Third-party Libraries</h4>

<p>For a wealth of information about free Common Lisp libraries and tools
we recommend checking out <em>CLiki</em>: <a href="http://www.cliki.net/">http://www.cliki.net/</a>.
</p>
<hr>
<a name="Common-Lisp-Books"></a>
<div class="header">
<p>
Previous: <a href="#Third_002dparty-Libraries" accesskey="p" rel="prev">Third-party Libraries</a>, Up: <a href="#More-Common-Lisp-Information" accesskey="u" rel="up">More Common Lisp Information</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Common-Lisp-Books-1"></a>
<h4 class="subsection">2.6.3 Common Lisp Books</h4>

<p>If you&rsquo;re not a programmer and you&rsquo;re trying to learn, many
introductory Lisp books are available. However, we don&rsquo;t have any
standout favorites. If you can&rsquo;t decide, try checking the Usenet
<a href="news://comp.lang.lisp">news://comp.lang.lisp</a> FAQ for recent recommendations.
</p>

<p>If you are an experienced programmer in other languages but need to
learn about Common Lisp, some books stand out:
</p>
<dl compact="compact">
<dt><cite>Practical Common Lisp, by Peter Seibel</cite></dt>
<dd><p>An excellent introduction to the language, covering both the basics
and &ldquo;advanced topics&rdquo; like macros, CLOS, and packages. Available
both in print format and on the web: <a href="http://www.gigamonkeys.com/book/">http://www.gigamonkeys.com/book/</a>.
</p>
</dd>
<dt><cite>Paradigms Of Artificial Intelligence Programming, by Peter Norvig</cite></dt>
<dd><p>Good information on general Common Lisp programming, and many
nontrivial examples. Whether or not your work is AI, it&rsquo;s a very good
book to look at.
</p>
</dd>
<dt><cite>On Lisp, by Paul Graham</cite></dt>
<dd><p>An in-depth treatment of macros, but not recommended as a first Common
Lisp book, since it is slightly pre-ANSI so you need to be on your
guard against non-standard usages, and since it doesn&rsquo;t really even
try to cover the language as a whole, focusing solely on macros.
Downloadable from <a href="http://www.paulgraham.com/onlisp.html">http://www.paulgraham.com/onlisp.html</a>.
</p>
</dd>
<dt><cite>Object-Oriented Programming In Common Lisp, by Sonya Keene</cite></dt>
<dd><p>With the exception of <cite>Practical Common Lisp</cite> most introductory
books don&rsquo;t emphasize CLOS. This one does. Even if you&rsquo;re very
knowledgeable about object oriented programming in the abstract, it&rsquo;s
worth looking at this book if you want to do any OO in Common Lisp.
Some abstractions in CLOS (especially multiple dispatch) go beyond
anything you&rsquo;ll see in most OO systems, and there are a number of
lesser differences as well. This book tends to help with the culture
shock.
</p>
</dd>
<dt><cite>Art Of Metaobject Programming, by Gregor Kiczales et al.</cite></dt>
<dd><p>Currently the prime source of information on the Common Lisp Metaobject
Protocol, which is supported by SBCL. Section 2 (Chapters 5 and 6) are
freely available at <a href="http://www.lisp.org/mop/">http://www.lisp.org/mop/</a>.
</p>
</dd>
</dl>




<hr>
<a name="History-and-Implementation-of-SBCL"></a>
<div class="header">
<p>
Previous: <a href="#More-Common-Lisp-Information" accesskey="p" rel="prev">More Common Lisp Information</a>, Up: <a href="#Introduction" accesskey="u" rel="up">Introduction</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="History-and-Implementation-of-SBCL-1"></a>
<h3 class="section">2.7 History and Implementation of SBCL</h3>

<p>You can work productively with SBCL without knowing or
understanding anything about where it came from, how it is
implemented, or how it extends the ANSI Common Lisp standard. However,
a little knowledge can be helpful in order to understand error
messages, to troubleshoot problems, to understand why some parts of
the system are better debugged than others, and to anticipate which
known bugs, known performance problems, and missing extensions are
likely to be fixed, tuned, or added.
</p>
<p>SBCL is descended from CMUCL, which is itself descended from Spice
Lisp, including early implementations for the Mach operating system on
the IBM RT, back in the 1980s. Some design decisions from that time are
still reflected in the current implementation:
</p>
<ul>
<li> The system expects to be loaded into a fixed-at-compile-time location
in virtual memory, and also expects the location of all of its heap
storage to be specified at compile time.

</li><li> The system overcommits memory, allocating large amounts of address
space from the system (often more than the amount of virtual memory
available) and then failing if ends up using too much of the allocated
storage.

</li><li> The system is implemented as a C program which is responsible for
supplying low-level services and loading a Lisp <samp>.core</samp>
file.

</li></ul>

<a name="index-Garbage-Collection_002c-generational"></a>
<p>SBCL also inherited some newer architectural features from CMUCL. The
most important is that on some architectures it has a generational
garbage collector (&ldquo;GC&rdquo;), which has various implications (mostly
good) for performance. These are discussed in another chapter,
<a href="#Efficiency">Efficiency</a>.
</p>
<p>SBCL has diverged from CMUCL in that SBCL is now essentially a
&ldquo;compiler-only implementation&rdquo; of Common Lisp. This is a change in
implementation strategy, taking advantage of the freedom &ldquo;any of these
facilities might share the same execution strategy&rdquo; guaranteed in the
ANSI specification section 3.1 (&ldquo;Evaluation&rdquo;). It does not mean SBCL
can&rsquo;t be used interactively, and in fact the change is largely invisible
to the casual user, since SBCL still can and does execute code
interactively by compiling it on the fly. (It is visible if you know how
to look, like using <code>compiled-function-p</code>; and it is visible in the
way that SBCL doesn&rsquo;t have many bugs which behave differently in
interpreted code than in compiled code.) What it means is that in SBCL,
the <code>eval</code> function only truly &ldquo;interprets&rdquo; a few easy kinds of
forms, such as symbols which are <code>boundp</code>. More complicated forms
are evaluated by calling <code>compile</code> and then calling <code>funcall</code>
on the returned result.
</p>
<p>The direct ancestor of SBCL is the x86 port of CMUCL. This port was in
some ways the most cobbled-together of all the CMUCL ports, since a
number of strange changes had to be made to support the register-poor
x86 architecture. Some things (like tracing and debugging) do not work
particularly well there. SBCL should be able to improve in these areas
(and has already improved in some other areas), but it takes a while.
</p>
<a name="index-Garbage-Collection_002c-conservative"></a>
<p>On the x86 SBCL &ndash; like the x86 port of CMUCL &ndash; uses a
<em>conservative</em> GC. This means that it doesn&rsquo;t maintain a strict
separation between tagged and untagged data, instead treating some
untagged data (e.g. raw floating point numbers) as possibly-tagged
data and so not collecting any Lisp objects that they point to. This
has some negative consequences for average time efficiency (though
possibly no worse than the negative consequences of trying to
implement an exact GC on a processor architecture as register-poor as
the X86) and also has potentially unlimited consequences for
worst-case memory efficiency. In practice, conservative garbage
collectors work reasonably well, not getting anywhere near the worst
case. But they can occasionally cause odd patterns of memory usage.
</p>
<p>The fork from CMUCL was based on a major rewrite of the system
bootstrap process. CMUCL has for many years tolerated a very unusual
&ldquo;build&rdquo; procedure which doesn&rsquo;t actually build the complete system
from scratch, but instead progressively overwrites parts of a running
system with new versions. This quasi-build procedure can cause various
bizarre bootstrapping hangups, especially when a major change is made
to the system. It also makes the connection between the current source
code and the current executable more tenuous than in other software
systems &ndash; it&rsquo;s easy to accidentally &ldquo;build&rdquo; a CMUCL system
containing characteristics not reflected in the current version of the
source code.
</p>
<p>Other major changes since the fork from CMUCL include
</p>
<ul>
<li> SBCL has removed many CMUCL extensions, (e.g. IP networking,
remote procedure call, Unix system interface, and X11 interface) from
the core system. Most of these are available as contributed modules
(distributed with SBCL) or third-party modules instead.

</li><li> SBCL has deleted or deprecated some nonstandard features and code
complexity which helped efficiency at the price of
maintainability. For example, the SBCL compiler no longer implements
memory pooling internally (and so is simpler and more maintainable,
but generates more garbage and runs more slowly), and various
block-compilation efficiency-increasing extensions to the language
have been deleted or are no longer used in the implementation of SBCL
itself.

</li></ul>
<hr>
<a name="Starting-and-Stopping"></a>
<div class="header">
<p>
Next: <a href="#Compiler" accesskey="n" rel="next">Compiler</a>, Previous: <a href="#Introduction" accesskey="p" rel="prev">Introduction</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Starting-and-Stopping-1"></a>
<h2 class="chapter">3 Starting and Stopping</h2>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Starting-SBCL" accesskey="1">Starting SBCL</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Stopping-SBCL" accesskey="2">Stopping SBCL</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Command-Line-Options" accesskey="3">Command Line Options</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Initialization-Files" accesskey="4">Initialization Files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Initialization-and-Exit-Hooks" accesskey="5">Initialization and Exit Hooks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Starting-SBCL"></a>
<div class="header">
<p>
Next: <a href="#Stopping-SBCL" accesskey="n" rel="next">Stopping SBCL</a>, Up: <a href="#Starting-and-Stopping" accesskey="u" rel="up">Starting and Stopping</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Starting-SBCL-1"></a>
<h3 class="section">3.1 Starting SBCL</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Running-from-Shell" accesskey="1">Running from Shell</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Running-from-Emacs" accesskey="2">Running from Emacs</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Shebang-Scripts" accesskey="3">Shebang Scripts</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Running-from-Shell"></a>
<div class="header">
<p>
Next: <a href="#Running-from-Emacs" accesskey="n" rel="next">Running from Emacs</a>, Up: <a href="#Starting-SBCL" accesskey="u" rel="up">Starting SBCL</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="From-Shell-to-Lisp"></a>
<h4 class="subsection">3.1.1 From Shell to Lisp</h4>

<p>To run SBCL type <code>sbcl</code> at the command line.
</p>
<p>You should end up in the toplevel <em>REPL</em> (read, eval, print
-loop), where you can interact with SBCL by typing expressions.
</p>
<div class="smallexample">
<pre class="smallexample">$ sbcl
This is SBCL 0.8.13.60, an implementation of ANSI Common Lisp.
More information about SBCL is available at &lt;http://www.sbcl.org/&gt;.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (+ 2 2)

4
* (exit)
$
</pre></div>

<p>See also <a href="#Command-Line-Options">Command Line Options</a> and <a href="#Stopping-SBCL">Stopping SBCL</a>.
</p>
<hr>
<a name="Running-from-Emacs"></a>
<div class="header">
<p>
Next: <a href="#Shebang-Scripts" accesskey="n" rel="next">Shebang Scripts</a>, Previous: <a href="#Running-from-Shell" accesskey="p" rel="prev">Running from Shell</a>, Up: <a href="#Starting-SBCL" accesskey="u" rel="up">Starting SBCL</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Running-from-Emacs-1"></a>
<h4 class="subsection">3.1.2 Running from Emacs</h4>

<p>To run SBCL as an inferior-lisp from Emacs in your <samp>.emacs</samp> do
something like:
</p>
<div class="lisp">
<pre class="lisp">;;; The SBCL binary and command-line arguments
(setq inferior-lisp-program &quot;/usr/local/bin/sbcl --noinform&quot;)
</pre></div>

<p>For more information on using SBCL with Emacs, see <a href="#Editor-Integration">Editor Integration</a>.
</p>

<hr>
<a name="Shebang-Scripts"></a>
<div class="header">
<p>
Previous: <a href="#Running-from-Emacs" accesskey="p" rel="prev">Running from Emacs</a>, Up: <a href="#Starting-SBCL" accesskey="u" rel="up">Starting SBCL</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Shebang-Scripts-1"></a>
<h4 class="subsection">3.1.3 Shebang Scripts</h4>
<a name="index-_002aposix_002dargv_002a-_005bsb_002dext_005d"></a>

<p>Standard Unix tools that are interpreters follow a common command line
protocol that is necessary to work with &ldquo;shebang scripts&rdquo;. SBCL supports
this via the <code>--script</code> command line option.
</p>
<p>Example file (<samp>hello.lisp</samp>):
</p>
<div class="lisp">
<pre class="lisp">#!/usr/local/bin/sbcl --script
(write-line &quot;Hello, World!&quot;)
</pre></div>

<p>Usage examples:
</p>
<div class="smallexample">
<pre class="smallexample">$ ./hello.lisp
Hello, World!
</pre></div>

<div class="smallexample">
<pre class="smallexample">$ sbcl --script hello.lisp
Hello, World!
</pre></div>

<hr>
<a name="Stopping-SBCL"></a>
<div class="header">
<p>
Next: <a href="#Command-Line-Options" accesskey="n" rel="next">Command Line Options</a>, Previous: <a href="#Starting-SBCL" accesskey="p" rel="prev">Starting SBCL</a>, Up: <a href="#Starting-and-Stopping" accesskey="u" rel="up">Starting and Stopping</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Stopping-SBCL-1"></a>
<h3 class="section">3.2 Stopping SBCL</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Exit" accesskey="1">Exit</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#End-of-File" accesskey="2">End of File</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Saving-a-Core-Image" accesskey="3">Saving a Core Image</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Exit-on-Errors" accesskey="4">Exit on Errors</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Exit"></a>
<div class="header">
<p>
Next: <a href="#End-of-File" accesskey="n" rel="next">End of File</a>, Up: <a href="#Stopping-SBCL" accesskey="u" rel="up">Stopping SBCL</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Exit-1"></a>
<h4 class="subsection">3.2.1 Exit</h4>

<p>SBCL can be stopped at any time by calling <code>sb-ext:exit</code>,
optionally returning a specified numeric value to the calling process.
See <a href="#Threading">Threading</a> for information about terminating individual threads.
</p>
<a name="Function-sb_002dext_003aexit"></a><dl>
<dt><a name="index-exit"></a>Function: <strong>exit</strong> <em>[sb-ext] &amp;key code abort timeout</em></dt>
<dd><p>Terminates the process, causing <code>sbcl</code> to exit with <code>code</code>. <code>code</code>
defaults to 0 when <code>abort</code> is false, and 1 when it is true.
</p>
<p>When <code>abort</code> is false (the default), current thread is first unwound,
<code>*exit-hooks*</code> are run, other threads are terminated, and standard
output streams are flushed before <code>sbcl</code> calls exit(3) <code>--</code> at which point
atexit(3) functions will run. If multiple threads call <code>exit</code> with <code>abort</code>
being false, the first one to call it will complete the protocol.
</p>
<p>When <code>abort</code> is true, <code>sbcl</code> exits immediately by calling _exit(2) without
unwinding stack, or calling exit hooks. Note that _exit(2) does not
call atexit(3) functions unlike exit(3).
</p>
<p>Recursive calls to <code>exit</code> cause <code>exit</code> to behave as if <code>abort</code> was true.
</p>
<p><code>timeout</code> controls waiting for other threads to terminate when <code>abort</code> is
<code>nil</code>. Once current thread has been unwound and <code>*exit-hooks*</code> have been
run, spawning new threads is prevented and all other threads are
terminated by calling <code>terminate-thread</code> on them. The system then waits
for them to finish using <code>join-thread</code>, waiting at most a total <code>timeout</code>
seconds for all threads to join. Those threads that do not finish
in time are simply ignored while the exit protocol continues. <code>timeout</code>
defaults to <code>*exit-timeout*</code>, which in turn defaults to 60. <code>timeout</code> <code>nil</code>
means to wait indefinitely.
</p>
<p>Note that <code>timeout</code> applies only to <code>join-thread</code>, not <code>*exit-hooks*</code>. Since
<code>terminate-thread</code> is asynchronous, getting multithreaded application
termination with complex cleanups right using it can be tricky. To
perform an orderly synchronous shutdown use an exit hook instead of
relying on implicit thread termination.
</p>
<p>Consequences are unspecified if serious conditions occur during <code>exit</code>
excepting errors from <code>*exit-hooks*</code>, which cause warnings and stop
execution of the hook that signaled, but otherwise allow the exit
process to continue normally.
</p></dd></dl>

<hr>
<a name="End-of-File"></a>
<div class="header">
<p>
Next: <a href="#Saving-a-Core-Image" accesskey="n" rel="next">Saving a Core Image</a>, Previous: <a href="#Exit" accesskey="p" rel="prev">Exit</a>, Up: <a href="#Stopping-SBCL" accesskey="u" rel="up">Stopping SBCL</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="End-of-File-1"></a>
<h4 class="subsection">3.2.2 End of File</h4>

<p>By default SBCL also exits on end of input, caused either by user
pressing <kbd>Control-D</kbd> on an attached terminal, or end of input when
using SBCL as part of a shell pipeline.
</p>
<hr>
<a name="Saving-a-Core-Image"></a>
<div class="header">
<p>
Next: <a href="#Exit-on-Errors" accesskey="n" rel="next">Exit on Errors</a>, Previous: <a href="#End-of-File" accesskey="p" rel="prev">End of File</a>, Up: <a href="#Stopping-SBCL" accesskey="u" rel="up">Stopping SBCL</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Saving-a-Core-Image-1"></a>
<h4 class="subsection">3.2.3 Saving a Core Image</h4>

<p>SBCL has the ability to save its state as a file for later
execution. This functionality is important for its bootstrapping
process, and is also provided as an extension to the user.
</p>
<a name="Function-sb_002dext_003asave_002dlisp_002dand_002ddie"></a><dl>
<dt><a name="index-save_002dlisp_002dand_002ddie"></a>Function: <strong>save-lisp-and-die</strong> <em>[sb-ext] core-file-name &amp;key toplevel executable save-runtime-options purify root-structures environment-name compression</em></dt>
<dd><p>Save a &quot;core image&quot;, i.e. enough information to restart a Lisp
process later in the same state, in the file of the specified name.
Only global state is preserved: the stack is unwound in the process.
</p>
<p>The following <code>&amp;key</code> arguments are defined:
</p>

<dl compact="compact">
<dt><em><code>:toplevel</code></em></dt>
<dd><p>The function to run when the created core file is resumed. The
     default function handles command line toplevel option processing
     and runs the top level read-eval-print loop. This function returning
     is equivalent to <code>(sb-ext:exit :code 0) </code>being called.
</p>
<p><code>toplevel</code> functions should always provide an <code>abort</code> restart: otherwise
     code they call will run without one.
</p>

</dd>
<dt><em><code>:executable</code></em></dt>
<dd><p>If true, arrange to combine the <code>sbcl</code> runtime and the core image
     to create a standalone executable.  If false (the default), the
     core image will not be executable on its own. Executable images
     always behave as if they were passed the &ndash;noinform runtime option.
</p>

</dd>
<dt><em><code>:save-runtime-options</code></em></dt>
<dd><p>If true, values of runtime options &ndash;dynamic-space-size and
     &ndash;control-stack-size that were used to start <code>sbcl</code> are stored in
     the standalone executable, and restored when the executable is
     run. This also inhibits normal runtime option processing, causing
     all command line arguments to be passed to the toplevel.
     Meaningless if <code>:executable</code> is <code>nil</code>.
</p>

</dd>
<dt><em><code>:purify</code></em></dt>
<dd><p>If true (the default on cheneygc), do a purifying <code>gc</code> which moves all
     dynamically allocated objects into static space. This takes
     somewhat longer than the normal <code>gc</code> which is otherwise done, but
     it&rsquo;s only done once, and subsequent GC&rsquo;s will be done less often
     and will take less time in the resulting core file. See the <code>purify</code>
     function. This parameter has no effect on platforms using the
     generational garbage collector.
</p>

</dd>
<dt><em><code>:root-structures</code></em></dt>
<dd><p>This should be a list of the main entry points in any newly loaded
     systems. This need not be supplied, but locality and/or <code>gc</code> performance
     may be better if they are. This has two different but related meanings:
     If <code>:purify</code> is true <code>-</code> and only for cheneygc <code>-</code> the root structures
     are those which anchor the set of objects moved into static space.
     On gencgc <code>-</code> and only on platforms supporting immobile code <code>-</code> these are
     the functions and/or function-names which commence a depth-first scan
     of code when reordering based on the statically observable call chain.
     The complete set of reachable objects is not affected per se.
     This argument is meaningless if neither enabling precondition holds.
</p>

</dd>
<dt><em><code>:environment-name</code></em></dt>
<dd><p>This has no purpose; it is accepted only for legacy compatibility.
</p>

</dd>
<dt><em><code>:compression</code></em></dt>
<dd><p>This is only meaningful if the runtime was built with the <code>:sb-core-compression</code>
     feature enabled. If <code>nil</code> (the default), saves to uncompressed core files. If
     <code>:sb-core-compression</code> was enabled at build-time, the argument may also be
     an integer from -1 to 9, corresponding to zlib compression levels, or <code>t</code>
     (which is equivalent to the default compression level, -1).
</p>

</dd>
<dt><em><code>:application-type</code></em></dt>
<dd><p>Present only on Windows and is meaningful only with <code>:executable</code> <code>t</code>.
     Specifies the subsystem of the executable, <code>:console</code> or <code>:gui</code>.
     The notable difference is that <code>:gui</code> doesn&rsquo;t automatically create a console
     window. The default is <code>:console</code>.
</p>
</dd>
</dl>

<p>The save/load process changes the values of some global variables:
</p>

<dl compact="compact">
<dt><em><code>*standard-output*</code>, <code>*debug-io*</code>, etc.</em></dt>
<dd><p>Everything related to open streams is necessarily changed, since
    the <code>os</code> won&rsquo;t let us preserve a stream across save and load.
</p>

</dd>
<dt><em><code>*default-pathname-defaults*</code></em></dt>
<dd><p>This is reinitialized to reflect the working directory where the
    saved core is loaded.
</p>
</dd>
</dl>

<p><code>save-lisp-and-die</code> interacts with <code>sb-alien:load-shared-object:</code> see its
documentation for details.
</p>
<p>On threaded platforms only a single thread may remain running after
<code>sb-ext:*save-hooks*</code> have run. Applications using multiple threads can
be <code>save-lisp-and-die</code> friendly by registering a save-hook that quits
any additional threads, and an init-hook that restarts them.
</p>
<p>This implementation is not as polished and painless as you might like:
</p><ul>
<li> It corrupts the current Lisp image enough that the current process
    needs to be killed afterwards. This can be worked around by forking
    another process that saves the core.
</li><li> There is absolutely no binary compatibility of core images between
    different runtime support programs. Even runtimes built from the same
    sources at different times are treated as incompatible for this
    purpose.
</li></ul>
<p>This isn&rsquo;t because we like it this way, but just because there don&rsquo;t
seem to be good quick fixes for either limitation and no one has been
sufficiently motivated to do lengthy fixes.
</p></dd></dl>
<a name="Variable-sb_002dext_003a_002asave_002dhooks_002a"></a><dl>
<dt><a name="index-_002asave_002dhooks_002a"></a>Variable: <strong>*save-hooks*</strong> <em>[sb-ext]</em></dt>
<dd><p>A list of function designators which are called in an unspecified
order before creating a saved core image.
</p>
<p>Unused by <code>sbcl</code> itself: reserved for user and applications.
</p></dd></dl>

<p>In cases where the standard initialization files have already been loaded
into the saved core, and alternative ones should be used (or none at all),
SBCL allows customizing the initfile pathname computation.
</p>
<a name="Variable-sb_002dext_003a_002asysinit_002dpathname_002dfunction_002a"></a><dl>
<dt><a name="index-_002asysinit_002dpathname_002dfunction_002a"></a>Variable: <strong>*sysinit-pathname-function*</strong> <em>[sb-ext]</em></dt>
<dd><p>Designator for a function of zero arguments called to obtain a
pathname designator for the default sysinit file, or <code>nil</code>. If the
function returns <code>nil</code>, no sysinit file is used unless one has been
specified on the command-line.
</p></dd></dl>
<a name="Variable-sb_002dext_003a_002auserinit_002dpathname_002dfunction_002a"></a><dl>
<dt><a name="index-_002auserinit_002dpathname_002dfunction_002a"></a>Variable: <strong>*userinit-pathname-function*</strong> <em>[sb-ext]</em></dt>
<dd><p>Designator for a function of zero arguments called to obtain a
pathname designator or a stream for the default userinit file, or <code>nil</code>.
If the function returns <code>nil</code>, no userinit file is used unless one has
been specified on the command-line.
</p></dd></dl>

<p>To facilitate distribution of SBCL applications using external
resources, the filesystem location of the SBCL core file being used is
available from Lisp.
</p>
<a name="Variable-sb_002dext_003a_002acore_002dpathname_002a"></a><dl>
<dt><a name="index-_002acore_002dpathname_002a"></a>Variable: <strong>*core-pathname*</strong> <em>[sb-ext]</em></dt>
<dd><p>The absolute pathname of the running <code>sbcl</code> core.
</p></dd></dl>

<hr>
<a name="Exit-on-Errors"></a>
<div class="header">
<p>
Previous: <a href="#Saving-a-Core-Image" accesskey="p" rel="prev">Saving a Core Image</a>, Up: <a href="#Stopping-SBCL" accesskey="u" rel="up">Stopping SBCL</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Exit-on-Errors-1"></a>
<h4 class="subsection">3.2.4 Exit on Errors</h4>

<p>SBCL can also be configured to exit if an unhandled error occurs,
which is mainly useful for acting as part of a shell pipeline; doing
so under most other circumstances would mean giving up large parts of
the flexibility and robustness of Common Lisp. See <a href="#Debugger-Entry">Debugger Entry</a>.
</p>
<hr>
<a name="Command-Line-Options"></a>
<div class="header">
<p>
Next: <a href="#Initialization-Files" accesskey="n" rel="next">Initialization Files</a>, Previous: <a href="#Stopping-SBCL" accesskey="p" rel="prev">Stopping SBCL</a>, Up: <a href="#Starting-and-Stopping" accesskey="u" rel="up">Starting and Stopping</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Command-Line-Options-1"></a>
<h3 class="section">3.3 Command Line Options</h3>


<p>Command line options can be considered an advanced topic; for ordinary
interactive use, no command line arguments should be necessary.
</p>
<p>In order to understand the command line argument syntax for SBCL, it
is helpful to understand that the SBCL system is implemented as two
components, a low-level runtime environment written in C and a
higher-level system written in Common Lisp itself. Some command line
arguments are processed during the initialization of the low-level
runtime environment, some command line arguments are processed during
the initialization of the Common Lisp system, and any remaining
command line arguments are passed on to user code.
</p>
<p>The full, unambiguous syntax for invoking SBCL at the command line is:
</p>
<p><code>sbcl</code> <var>runtime-option</var>* <code>--end-runtime-options</code> <var>toplevel-option</var>* <code>--end-toplevel-options</code> <var>user-options</var>*
</p>
<p>For convenience, the <code>--end-runtime-options</code> and
<code>--end-toplevel-options</code> elements can be omitted. Omitting these
elements can be convenient when you are running the program
interactively, and you can see that no ambiguities are possible with
the option values you are using. Omitting these elements is probably a
bad idea for any batch file where any of the options are under user
control, since it makes it impossible for SBCL to detect erroneous
command line input, so that erroneous command line arguments will be
passed on to the user program even if they was intended for the
runtime system or the Lisp system.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Runtime-Options" accesskey="1">Runtime Options</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Toplevel-Options" accesskey="2">Toplevel Options</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Runtime-Options"></a>
<div class="header">
<p>
Next: <a href="#Toplevel-Options" accesskey="n" rel="next">Toplevel Options</a>, Up: <a href="#Command-Line-Options" accesskey="u" rel="up">Command Line Options</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Runtime-Options-1"></a>
<h4 class="subsection">3.3.1 Runtime Options</h4>

<dl compact="compact">
<dt><code>--core <var>corefilename</var></code></dt>
<dd><p>Run the specified Lisp core file instead of the default. Note that if
the Lisp core file is a user-created core file, it may run a
nonstandard toplevel which does not recognize the standard toplevel
options.
</p>
</dd>
<dt><code>--dynamic-space-size <var>megabytes</var></code></dt>
<dd><p>Size of the dynamic space reserved on startup in megabytes. Default
value is platform dependent.
</p>
</dd>
<dt><code>--control-stack-size <var>megabytes</var></code></dt>
<dd><p>Size of control stack reserved for each thread in megabytes. Default
value is 2.
</p>
</dd>
<dt><code>--noinform</code></dt>
<dd><p>Suppress the printing of any banner or other informational message at
startup. This makes it easier to write Lisp programs which work
cleanly in Unix pipelines. See also the <code>--noprint</code> and
<code>--disable-debugger</code> options.
</p>
</dd>
<dt><code>--disable-ldb</code></dt>
<dd><a name="index-ldb-1"></a>
<a name="index-ldb_002c-disabling"></a>
<a name="index-disabling-ldb"></a>
<p>Disable the low-level debugger. Only effective if SBCL is compiled
with LDB.
</p>
</dd>
<dt><code>--lose-on-corruption</code></dt>
<dd><a name="index-ldb-2"></a>
<p>There are some dangerous low level errors (for instance, control stack
exhausted, memory fault) that (or whose handlers) can corrupt the
image. By default SBCL prints a warning, then tries to continue and
handle the error in Lisp, but this will not always work and SBCL may
malfunction or even hang. With this option, upon encountering such an
error SBCL will invoke ldb (if present and enabled) or else exit.
</p>

</dd>
<dt><code>--script <var>filename</var></code></dt>
<dd><p>As a runtime option this is equivalent to <code>--noinform</code>
<code>--disable-ldb</code> <code>--lose-on-corruption</code>
<code>--end-runtime-options</code> <code>--script</code> <var>filename</var>. See the
description of <code>--script</code> as a toplevel option below. If there
are no other command line arguments following <code>--script</code>, the
filename argument can be omitted.
</p>

</dd>
<dt><code>--merge-core-pages</code></dt>
<dd><p>When platform support is present, provide hints to the operating system
that identical pages may be shared between processes until they are
written to.  This can be useful to reduce the memory usage on systems
with multiple SBCL processes started from similar but differently-named
core files, or from compressed cores.  Without platform support, do
nothing. By default only compressed cores trigger hinting.
</p>
</dd>
<dt><code>--no-merge-core-pages</code></dt>
<dd><p>Ensures that no sharing hint is provided to the operating system.
</p>
</dd>
<dt><code>--help</code></dt>
<dd><p>Print some basic information about SBCL, then exit.
</p>
</dd>
<dt><code>--version</code></dt>
<dd><p>Print SBCL&rsquo;s version information, then exit.
</p>
</dd>
</dl>

<p>In the future, runtime options may be added to control behaviour such
as lazy allocation of memory.
</p>
<p>Runtime options, including any &ndash;end-runtime-options option, are
stripped out of the command line before the Lisp toplevel logic gets a
chance to see it.
</p>
<hr>
<a name="Toplevel-Options"></a>
<div class="header">
<p>
Previous: <a href="#Runtime-Options" accesskey="p" rel="prev">Runtime Options</a>, Up: <a href="#Command-Line-Options" accesskey="u" rel="up">Command Line Options</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Toplevel-Options-1"></a>
<h4 class="subsection">3.3.2 Toplevel Options</h4>

<dl compact="compact">
<dt><code>--sysinit <var>filename</var></code></dt>
<dd><p>Load filename instead of the default system initialization file
(see <a href="#Initialization-Files">Initialization Files</a>.)
</p>
</dd>
<dt><code>--no-sysinit</code></dt>
<dd><p>Don&rsquo;t load a system-wide initialization file.  If this option is given,
the <code>--sysinit</code> option is ignored.
</p>
</dd>
<dt><code>--userinit <var>filename</var></code></dt>
<dd><p>Load filename instead of the default user initialization file
(see <a href="#Initialization-Files">Initialization Files</a>.)
</p>
</dd>
<dt><code>--no-userinit</code></dt>
<dd><p>Don&rsquo;t load a user initialization file.  If this option is given,
the <code>--userinit</code> option is ignored.
</p>
</dd>
<dt><code>--eval <var>command</var></code></dt>
<dd><p>After executing any initialization file, but before starting the
read-eval-print loop on standard input, read and evaluate the command
given. More than one <code>--eval</code> option can be used, and all will be
read and executed, in the order they appear on the command line.
</p>
</dd>
<dt><code>--load <var>filename</var></code></dt>
<dd><p>This is equivalent to <code>--eval '(load &quot;<var>filename</var>&quot;)'</code>. The
special syntax is intended to reduce quoting headaches when invoking
SBCL from shell scripts.
</p>
</dd>
<dt><code>--noprint</code></dt>
<dd><p>When ordinarily the toplevel &quot;read-eval-print loop&quot; would be executed,
execute a &quot;read-eval loop&quot; instead, i.e. don&rsquo;t print a prompt and
don&rsquo;t echo results. Combined with the <code>--noinform</code> runtime
option, this makes it easier to write Lisp &quot;scripts&quot; which work
cleanly in Unix pipelines.
</p>
</dd>
<dt><code>--disable-debugger</code></dt>
<dd><p>By default when SBCL encounters an error, it enters the builtin
debugger, allowing interactive diagnosis and possible intercession.
This option disables the debugger, causing errors to print a backtrace
and exit with status 1 instead. When given, this option takes effect
before loading of initialization files or processing <code>--eval</code> and
<code>--load</code> options. See <code>sb-ext:disable-debugger</code> for details.
See <a href="#Debugger-Entry">Debugger Entry</a>.
</p>
</dd>
<dt><code>--script <var>filename</var></code></dt>
<dd><p>Implies <code>--no-userinit</code> <code>--no-sysinit</code>
<code>--disable-debugger</code> <code>--end-toplevel-options</code>.
</p>
<p>Causes the system to load the specified file instead of entering the
read-eval-print-loop, and exit afterwards. If the file begins with a
shebang line, it is ignored.
</p>
<p>If there are no other command line arguments following, the filename
can be omitted: this causes the script to be loaded from standard
input instead. Shebang lines in standard input script are currently
<em>not</em> ignored.
</p>
<p>In either case, if there is an unhandled error (e.g. end of file, or a
broken pipe) on either standard input, standard output, or standard
error, the script silently exits with code 0. This allows e.g. safely
piping output from SBCL to <code>head -n1</code> or similar.
</p>
</dd>
</dl>

<hr>
<a name="Initialization-Files"></a>
<div class="header">
<p>
Next: <a href="#Initialization-and-Exit-Hooks" accesskey="n" rel="next">Initialization and Exit Hooks</a>, Previous: <a href="#Command-Line-Options" accesskey="p" rel="prev">Command Line Options</a>, Up: <a href="#Starting-and-Stopping" accesskey="u" rel="up">Starting and Stopping</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Initialization-Files-1"></a>
<h3 class="section">3.4 Initialization Files</h3>

<p>SBCL processes initialization files with <code>read</code> and <code>eval</code>,
not <code>load</code>; hence initialization files can be used to set startup
<code>*package*</code> and <code>*readtable*</code>, and for proclaiming a global
optimization policy.
</p>
<dl compact="compact">
<dt><strong>System Initialization File</strong></dt>
<dd><p>Defaults to <samp><code>$SBCL_HOME</code>/sbclrc</samp>, or if that doesn&rsquo;t exist to
<samp>/etc/sbclrc</samp>. Can be overridden with the command line option
<code>--sysinit</code> or <code>--no-sysinit</code> (see <a href="#Toplevel-Options">Toplevel Options</a>).
</p>
<p>The system initialization file is intended for system administrators
and software packagers to configure locations of installed third party
modules, etc.
</p>
</dd>
<dt><strong>User Initialization File</strong></dt>
<dd><p>Defaults to <samp><code>$HOME</code>/.sbclrc</samp>. Can be overridden with the
command line option <code>--userinit</code> or <code>--no-userinit</code>
(see <a href="#Toplevel-Options">Toplevel Options</a>).
</p>
<p>The user initialization file is intended for personal customizations,
such as loading certain modules at startup, defining convenience
functions to use in the REPL, handling automatic recompilation
of FASLs (see <a href="#FASL-Format">FASL Format</a>), etc.
</p>
</dd>
</dl>

<p>Neither initialization file is required.
</p>
<hr>
<a name="Initialization-and-Exit-Hooks"></a>
<div class="header">
<p>
Previous: <a href="#Initialization-Files" accesskey="p" rel="prev">Initialization Files</a>, Up: <a href="#Starting-and-Stopping" accesskey="u" rel="up">Starting and Stopping</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Initialization-and-Exit-Hooks-1"></a>
<h3 class="section">3.5 Initialization and Exit Hooks</h3>

<p>SBCL provides hooks into the system initialization and exit.
</p>
<a name="Variable-sb_002dext_003a_002ainit_002dhooks_002a"></a><dl>
<dt><a name="index-_002ainit_002dhooks_002a"></a>Variable: <strong>*init-hooks*</strong> <em>[sb-ext]</em></dt>
<dd><p>A list of function designators which are called in an unspecified
order when a saved core image starts up, after the system itself has
been initialized.
</p>
<p>Unused by <code>sbcl</code> itself: reserved for user and applications.
</p></dd></dl>
<a name="Variable-sb_002dext_003a_002aexit_002dhooks_002a"></a><dl>
<dt><a name="index-_002aexit_002dhooks_002a"></a>Variable: <strong>*exit-hooks*</strong> <em>[sb-ext]</em></dt>
<dd><p>A list of function designators which are called in an unspecified
order when <code>sbcl</code> process exits.
</p>
<p>Unused by <code>sbcl</code> itself: reserved for user and applications.
</p>
<p>Using <code>(sb-ext:exit :abort t)</code>, or calling exit(3) directly circumvents
these hooks.
</p></dd></dl>
<hr>
<a name="Compiler"></a>
<div class="header">
<p>
Next: <a href="#Debugger" accesskey="n" rel="next">Debugger</a>, Previous: <a href="#Starting-and-Stopping" accesskey="p" rel="prev">Starting and Stopping</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Compiler-1"></a>
<h2 class="chapter">4 Compiler</h2>

<p>This chapter will discuss most compiler issues other than efficiency,
including compiler error messages, the SBCL compiler&rsquo;s unusual
approach to type safety in the presence of type declarations, the
effects of various compiler optimization policies, and the way that
inlining and open coding may cause optimized code to differ from a
naive translation. Efficiency issues are sufficiently varied and
separate that they have their own chapter, <a href="#Efficiency">Efficiency</a>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Diagnostic-Messages" accesskey="1">Diagnostic Messages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Handling-of-Types" accesskey="2">Handling of Types</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Compiler-Policy" accesskey="3">Compiler Policy</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Compiler-Errors" accesskey="4">Compiler Errors</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Open-Coding-and-Inline-Expansion" accesskey="5">Open Coding and Inline Expansion</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Interpreter" accesskey="6">Interpreter</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Diagnostic-Messages"></a>
<div class="header">
<p>
Next: <a href="#Handling-of-Types" accesskey="n" rel="next">Handling of Types</a>, Up: <a href="#Compiler" accesskey="u" rel="up">Compiler</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Diagnostic-Messages-1"></a>
<h3 class="section">4.1 Diagnostic Messages</h3>
<a name="index-Messages_002c-Compiler"></a>
<a name="index-Compiler-messages"></a>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Controlling-Verbosity" accesskey="1">Controlling Verbosity</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Diagnostic-Severity" accesskey="2">Diagnostic Severity</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Understanding-Compiler-Diagnostics" accesskey="3">Understanding Compiler Diagnostics</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Controlling-Verbosity"></a>
<div class="header">
<p>
Next: <a href="#Diagnostic-Severity" accesskey="n" rel="next">Diagnostic Severity</a>, Up: <a href="#Diagnostic-Messages" accesskey="u" rel="up">Diagnostic Messages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Controlling-Verbosity-1"></a>
<h4 class="subsection">4.1.1 Controlling Verbosity</h4>

<p>The compiler can be quite verbose in its diagnostic reporting, rather
more then some users would prefer &ndash; the amount of noise emitted can
be controlled, however.
</p>
<p>To control emission of compiler diagnostics (of any severity other
than <code>error</code>: see <a href="#Diagnostic-Severity">Diagnostic Severity</a>) use the
<code>sb-ext:muffle-conditions</code> and <code>sb-ext:unmuffle-conditions</code>
declarations, specifying the type of condition that is to be muffled
(the muffling is done using an associated <code>muffle-warning</code> restart).
</p>
<p>Global control:
</p><div class="lisp">
<pre class="lisp">;;; Muffle compiler-notes globally
(declaim (sb-ext:muffle-conditions sb-ext:compiler-note))
</pre></div>

<p>Local control:
</p><div class="lisp">
<pre class="lisp">;;; Muffle compiler-notes based on lexical scope
(defun foo (x)
  (declare (optimize speed) (fixnum x)
           (sb-ext:muffle-conditions sb-ext:compiler-note))
  (values (* x 5) ; no compiler note from this
    (locally
      (declare (sb-ext:unmuffle-conditions sb-ext:compiler-note))
      ;; this one gives a compiler note
      (* x -5))))
</pre></div>

<dl>
<dt><a name="index-muffle_002dconditions"></a>Declaration: <strong>muffle-conditions</strong> <em>[sb-ext]</em></dt>
<dd><p>Syntax: type*
</p>
<p>Muffles the diagnostic messages that would be caused by compile-time
signals of given types.
</p></dd></dl>

<dl>
<dt><a name="index-unmuffle_002dconditions"></a>Declaration: <strong>unmuffle-conditions</strong> <em>[sb-ext]</em></dt>
<dd><p>Syntax: type*
</p>
<p>Cancels the effect of a previous <code>sb-ext:muffle-conditions</code>
declaration.
</p></dd></dl>

<p>Various details of <em>how</em> the compiler messages are printed can be
controlled via the alist
<code>sb-ext:*compiler-print-variable-alist*</code>.
</p>
<a name="Variable-sb_002dext_003a_002acompiler_002dprint_002dvariable_002dalist_002a"></a><dl>
<dt><a name="index-_002acompiler_002dprint_002dvariable_002dalist_002a"></a>Variable: <strong>*compiler-print-variable-alist*</strong> <em>[sb-ext]</em></dt>
<dd><p>an association list describing new bindings for special variables
to be used by the compiler for error-reporting, etc. Eg.
</p>
<div class="lisp">
<pre class="lisp"> ((*PRINT-LENGTH* . 10) (*PRINT-LEVEL* . 6) (*PRINT-PRETTY* . NIL))
</pre></div>

<p>The variables in the <code>car</code> positions are bound to the values in the <code>cdr</code>
during the execution of some debug commands. When evaluating arbitrary
expressions in the debugger, the normal values of the printer control
variables are in effect.
</p>
<p>Initially empty, <code>*compiler-print-variable-alist*</code> is Typically used to
specify bindings for printer control variables.
</p></dd></dl>

<p>For information about muffling warnings signaled outside of the
compiler, see <a href="#Customization-Hooks-for-Users">Customization Hooks for Users</a>.
</p>

<hr>
<a name="Diagnostic-Severity"></a>
<div class="header">
<p>
Next: <a href="#Understanding-Compiler-Diagnostics" accesskey="n" rel="next">Understanding Compiler Diagnostics</a>, Previous: <a href="#Controlling-Verbosity" accesskey="p" rel="prev">Controlling Verbosity</a>, Up: <a href="#Diagnostic-Messages" accesskey="u" rel="up">Diagnostic Messages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Diagnostic-Severity-1"></a>
<h4 class="subsection">4.1.2 Diagnostic Severity</h4>
<a name="index-Severity-of-compiler-messages"></a>
<a name="index-Compiler-Diagnostic-Severity"></a>
<a name="index-error-_005bcl_005d"></a>
<a name="index-warning-_005bcl_005d"></a>
<a name="index-style_002dwarning-_005bcl_005d"></a>
<a name="index-compiler_002dnote-_005bsb_002dext_005d"></a>
<a name="index-code_002ddeletion_002dnote-_005bsb_002dext_005d"></a>

<p>There are four levels of compiler diagnostic severity:
</p>
<ol>
<li> error
</li><li> warning
</li><li> style warning
</li><li> note
</li></ol>

<p>The first three levels correspond to condition classes which are
defined in the ANSI standard for Common Lisp and which have special
significance to the <code>compile</code> and <code>compile-file</code> functions.
These levels of compiler error severity occur when the compiler
handles conditions of these classes.
</p>
<p>The fourth level of compiler error severity, <em>note</em>, corresponds
to the <code>sb-ext:compiler-note</code>, and is used for problems which are
too mild for the standard condition classes, typically hints about how
efficiency might be improved. The <code>sb-ext:code-deletion-note</code>, a
subtype of <code>compiler-note</code>, is signalled when the compiler
deletes user-supplied code after proving that the code in question is
unreachable.
</p>
<p>Future work for SBCL includes expanding this hierarchy of types to
allow more fine-grained control over emission of diagnostic messages.
</p>
<a name="Condition-sb_002dext_003acompiler_002dnote"></a><dl>
<dt><a name="index-compiler_002dnote"></a>Condition: <strong>compiler-note</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>compiler-note, condition, t</code>
</p>
<p>Root of the hierarchy of conditions representing information discovered
by the compiler that the user might wish to know, but which does not merit
a <code>style-warning</code> (or any more serious condition).
</p></dd></dl>
<a name="Condition-sb_002dext_003acode_002ddeletion_002dnote"></a><dl>
<dt><a name="index-code_002ddeletion_002dnote"></a>Condition: <strong>code-deletion-note</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>code-deletion-note, compiler-note, condition, t</code>
</p>
<p>A condition type signalled when the compiler deletes code that the user
has written, having proved that it is unreachable.
</p></dd></dl>


<hr>
<a name="Understanding-Compiler-Diagnostics"></a>
<div class="header">
<p>
Previous: <a href="#Diagnostic-Severity" accesskey="p" rel="prev">Diagnostic Severity</a>, Up: <a href="#Diagnostic-Messages" accesskey="u" rel="up">Diagnostic Messages</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Understanding-Compile-Diagnostics"></a>
<h4 class="subsection">4.1.3 Understanding Compile Diagnostics</h4>

<p>The messages emitted by the compiler contain a lot of detail in a
terse format, so they may be confusing at first. The messages will be
illustrated using this example program:
</p>
<div class="lisp">
<pre class="lisp">(defmacro zoq (x)
  `(roq (ploq (+ ,x 3))))

(defun foo (y)
  (declare (symbol y))
  (zoq y))
</pre></div>

<p>The main problem with this program is that it is trying to add
<code>3</code> to a symbol. Note also that the functions <code>roq</code> and
<code>ploq</code> aren&rsquo;t defined anywhere.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#The-Parts-of-a-Compiler-Diagnostic" accesskey="1">The Parts of a Compiler Diagnostic</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-Original-and-Actual-Source" accesskey="2">The Original and Actual Source</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-Processing-Path" accesskey="3">The Processing Path</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="The-Parts-of-a-Compiler-Diagnostic"></a>
<div class="header">
<p>
Next: <a href="#The-Original-and-Actual-Source" accesskey="n" rel="next">The Original and Actual Source</a>, Up: <a href="#Understanding-Compiler-Diagnostics" accesskey="u" rel="up">Understanding Compiler Diagnostics</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-Parts-of-a-Compiler-Diagnostic-1"></a>
<h4 class="subsubsection">4.1.3.1 The Parts of a Compiler Diagnostic</h4>

<p>When processing this program, the compiler will produce this warning:
</p>
<div class="example">
<pre class="example">; file: /tmp/foo.lisp
; in: DEFUN FOO
;     (ZOQ Y)
; --&gt; ROQ PLOQ
; ==&gt;
;   (+ Y 3)
;
; caught WARNING:
;   Asserted type NUMBER conflicts with derived type (VALUES SYMBOL &amp;OPTIONAL).
</pre></div>

<p>In this example we see each of the six possible parts of a compiler
diagnostic:
</p>
<ol>
<li> <a name="index-with_002dcompilation_002dunit-_005bcl_005d"></a>
&lsquo;<samp>file: /tmp/foo.lisp</samp>&rsquo; This is the name of the file that the
compiler read the relevant code from.  The file name is displayed
because it may not be immediately obvious when there is an error
during compilation of a large system, especially when
<code>with-compilation-unit</code> is used to delay undefined warnings.

</li><li> &lsquo;<samp>in: DEFUN FOO</samp>&rsquo; This is the definition top level form responsible
for the diagnostic. It is obtained by taking the first two elements of
the enclosing form whose first element is a symbol beginning with
&ldquo;&lsquo;<samp>def</samp>&rsquo;&rdquo;. If there is no such enclosing &ldquo;&lsquo;<samp>def</samp>&rsquo;&rdquo; form,
then the outermost form is used. If there are multiple &lsquo;<samp>def</samp>&rsquo;
forms, then they are all printed from the outside in, separated by
&lsquo;<samp>=&gt;</samp>&rsquo;&rsquo;s. In this example, the problem was in the <code>defun</code> for
<code>foo</code>.

</li><li> <a name="index-Original-Source"></a>
&lsquo;<samp>(ZOQ Y)</samp>&rsquo; This is the <em>original source</em> form responsible for
the diagnostic. Original source means that the form directly appeared
in the original input to the compiler, i.e. in the lambda passed to
<code>compile</code> or in the top level form read from the source file. In
this example, the expansion of the <code>zoq</code> macro was responsible
for the message.

</li><li> <a name="index-Processing-Path"></a>
&lsquo;<samp>--&gt; ROQ PLOQ</samp>&rsquo; This is the <em>processing path</em> that the
compiler used to produce the code that caused the message to be
emitted. The processing path is a representation of the evaluated
forms enclosing the actual source that the compiler encountered when
processing the original source. The path is the first element of each
form, or the form itself if the form is not a list. These forms result
from the expansion of macros or source-to-source transformation done
by the compiler. In this example, the enclosing evaluated forms are
the calls to <code>roq</code> and <code>ploq</code>. These calls resulted from the
expansion of the <code>zoq</code> macro.

</li><li> <a name="index-Actual-Source"></a>
&lsquo;<samp>==&gt; (+ Y 3)</samp>&rsquo; This is the <em>actual source</em> responsible for the
diagnostic. If the actual source appears in the explanation, then we
print the next enclosing evaluated form, instead of printing the
actual source twice. (This is the form that would otherwise have been
the last form of the processing path.) In this example, the problem is
with the evaluation of the reference to the variable <code>y</code>.

</li><li> &lsquo;<samp>caught WARNING: Asserted type NUMBER conflicts with derived type
(VALUES SYMBOL &amp;OPTIONAL).</samp>&rsquo;  This is the <em>explanation</em> of the
problem. In this example, the problem is that, while the call to
<code>+</code> requires that its arguments are all of type <code>number</code>,
the compiler has derived that <code>y</code> will evaluate to a
<code>symbol</code>.  Note that &lsquo;<samp>(VALUES SYMBOL &amp;OPTIONAL)</samp>&rsquo; expresses
that <code>y</code> evaluates to precisely one value.

</li></ol>

<p>Note that each part of the message is distinctively marked:
</p>
<ul>
<li> &lsquo;<samp>file:</samp>&rsquo; and &lsquo;<samp>in:</samp>&rsquo; mark the file and definition,
respectively.

</li><li> The original source is an indented form with no prefix.

</li><li> Each line of the processing path is prefixed with &lsquo;<samp>--&gt;</samp>&rsquo;

</li><li> The actual source form is indented like the original source, but is
marked by a preceding &lsquo;<samp>==&gt;</samp>&rsquo; line.

</li><li> The explanation is prefixed with the diagnostic severity, which can be
&lsquo;<samp>caught ERROR:</samp>&rsquo;, &lsquo;<samp>caught WARNING:</samp>&rsquo;, &lsquo;<samp>caught
STYLE-WARNING:</samp>&rsquo;, or &lsquo;<samp>note:</samp>&rsquo;.

</li></ul>

<p>Each part of the message is more specific than the preceding one. If
consecutive messages are for nearby locations, then the front part of
the messages would be the same. In this case, the compiler omits as
much of the second message as in common with the first. For example:
</p>
<div class="example">
<pre class="example">; file: /tmp/foo.lisp
; in: DEFUN FOO
;     (ZOQ Y)
; --&gt; ROQ
; ==&gt;
;   (PLOQ (+ Y 3))
;
; caught STYLE-WARNING:
;   undefined function: PLOQ

; ==&gt;
;   (ROQ (PLOQ (+ Y 3)))
;
; caught STYLE-WARNING:
;   undefined function: ROQ
</pre></div>

<p>In this example, the file, definition and original source are
identical for the two messages, so the compiler omits them in the
second message. If consecutive messages are entirely identical, then
the compiler prints only the first message, followed by: &lsquo;<samp>[Last
message occurs <var>repeats</var> times]</samp>&rsquo; where <var>repeats</var> is the number
of times the message was given.
</p>
<p>If the source was not from a file, then no file line is printed. If
the actual source is the same as the original source, then the
processing path and actual source will be omitted. If no forms
intervene between the original source and the actual source, then the
processing path will also be omitted.
</p>

<hr>
<a name="The-Original-and-Actual-Source"></a>
<div class="header">
<p>
Next: <a href="#The-Processing-Path" accesskey="n" rel="next">The Processing Path</a>, Previous: <a href="#The-Parts-of-a-Compiler-Diagnostic" accesskey="p" rel="prev">The Parts of a Compiler Diagnostic</a>, Up: <a href="#Understanding-Compiler-Diagnostics" accesskey="u" rel="up">Understanding Compiler Diagnostics</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-Original-and-Actual-Source-1"></a>
<h4 class="subsubsection">4.1.3.2 The Original and Actual Source</h4>
<a name="index-Original-Source-1"></a>
<a name="index-Actual-Source-1"></a>

<p>The <em>original source</em> displayed will almost always be a list. If
the actual source for an message is a symbol, the original source will
be the immediately enclosing evaluated list form. So even if the
offending symbol does appear in the original source, the compiler will
print the enclosing list and then print the symbol as the actual
source (as though the symbol were introduced by a macro.)
</p>
<p>When the <em>actual source</em> is displayed (and is not a symbol), it
will always be code that resulted from the expansion of a macro or a
source-to-source compiler optimization. This is code that did not
appear in the original source program; it was introduced by the
compiler.
</p>
<p>Keep in mind that when the compiler displays a source form in an
diagnostic message, it always displays the most specific (innermost)
responsible form. For example, compiling this function
</p>
<div class="lisp">
<pre class="lisp">(defun bar (x)
  (let (a)
    (declare (fixnum a))
    (setq a (foo x))
    a))
</pre></div>

<p>gives this error message
</p>
<div class="example">
<pre class="example">; file: /tmp/foo.lisp
; in: DEFUN BAR
;     (LET (A)
;     (DECLARE (FIXNUM A))
;     (SETQ A (FOO X))
;     A)
;
; caught WARNING:
;   Asserted type FIXNUM conflicts with derived type (VALUES NULL &amp;OPTIONAL).
</pre></div>

<p>This message is not saying &ldquo;there is a problem somewhere in this
<code>let</code>&rdquo; &ndash; it is saying that there is a problem with the
<code>let</code> itself. In this example, the problem is that <code>a</code>&rsquo;s
<code>nil</code> initial value is not a <code>fixnum</code>.
</p>
<hr>
<a name="The-Processing-Path"></a>
<div class="header">
<p>
Previous: <a href="#The-Original-and-Actual-Source" accesskey="p" rel="prev">The Original and Actual Source</a>, Up: <a href="#Understanding-Compiler-Diagnostics" accesskey="u" rel="up">Understanding Compiler Diagnostics</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-Processing-Path-1"></a>
<h4 class="subsubsection">4.1.3.3 The Processing Path</h4>
<a name="index-Processing-Path-1"></a>
<a name="index-Macroexpansion"></a>
<a name="index-Source_002dto_002dsource-transformation"></a>

<p>The processing path is mainly useful for debugging macros, so if you
don&rsquo;t write macros, you can probably ignore it. Consider this example:
</p>
<div class="lisp">
<pre class="lisp">(defun foo (n)
  (dotimes (i n *undefined*)))
</pre></div>

<p>Compiling results in this error message:
</p>
<div class="example">
<pre class="example">; in: DEFUN FOO
;     (DOTIMES (I N *UNDEFINED*))
; --&gt; DO BLOCK LET TAGBODY RETURN-FROM
; ==&gt;
;   (PROGN *UNDEFINED*)
;
; caught WARNING:
;   undefined variable: *UNDEFINED*
</pre></div>

<p>Note that <code>do</code> appears in the processing path. This is because
<code>dotimes</code> expands into:
</p>
<div class="lisp">
<pre class="lisp">(do ((i 0 (1+ i)) (#:g1 n))
    ((&gt;= i #:g1) *undefined*)
  (declare (type unsigned-byte i)))
</pre></div>

<p>The rest of the processing path results from the expansion of
<code>do</code>:
</p>
<div class="lisp">
<pre class="lisp">(block nil
  (let ((i 0) (#:g1 n))
    (declare (type unsigned-byte i))
    (tagbody (go #:g3)
      #:g2    (psetq i (1+ i))
      #:g3    (unless (&gt;= i #:g1) (go #:g2))
      (return-from nil (progn *undefined*)))))
</pre></div>

<p>In this example, the compiler descended into the <code>block</code>,
<code>let</code>, <code>tagbody</code> and <code>return-from</code> to reach the
<code>progn</code> printed as the actual source. This is a place where the
&ldquo;actual source appears in explanation&rdquo; rule was applied. The
innermost actual source form was the symbol <code>*undefined*</code> itself,
but that also appeared in the explanation, so the compiler backed out
one level.
</p>




<hr>
<a name="Handling-of-Types"></a>
<div class="header">
<p>
Next: <a href="#Compiler-Policy" accesskey="n" rel="next">Compiler Policy</a>, Previous: <a href="#Diagnostic-Messages" accesskey="p" rel="prev">Diagnostic Messages</a>, Up: <a href="#Compiler" accesskey="u" rel="up">Compiler</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Handling-of-Types-1"></a>
<h3 class="section">4.2 Handling of Types</h3>

<p>One of the most important features of the SBCL compiler (similar to
the original CMUCL compiler, also known as <em>Python</em>) is its fairly
sophisticated understanding of the Common Lisp type system and its
conservative approach to the implementation of type declarations.
</p>
<p>These two features reward the use of type declarations throughout
development, even when high performance is not a concern. Also, as
discussed in the chapter on performance (see <a href="#Efficiency">Efficiency</a>), the use
of appropriate type declarations can be very important for performance
as well.
</p>
<a name="index-satisfies-_005bcl_005d"></a>
<p>The SBCL compiler also has a greater knowledge of the Common Lisp
type system than other compilers. Support is incomplete only for types
involving the <code>satisfies</code> type specifier.
</p>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Declarations-as-Assertions" accesskey="1">Declarations as Assertions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Precise-Type-Checking" accesskey="2">Precise Type Checking</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Getting-Existing-Programs-to-Run" accesskey="3">Getting Existing Programs to Run</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Implementation-Limitations" accesskey="4">Implementation Limitations</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Declarations-as-Assertions"></a>
<div class="header">
<p>
Next: <a href="#Precise-Type-Checking" accesskey="n" rel="next">Precise Type Checking</a>, Up: <a href="#Handling-of-Types" accesskey="u" rel="up">Handling of Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Declarations-as-Assertions-1"></a>
<h4 class="subsection">4.2.1 Declarations as Assertions</h4>
<a name="index-Safety-optimization-quality"></a>

<p>The SBCL compiler treats type declarations differently from most other
Lisp compilers. Under default compilation policy the compiler doesn&rsquo;t
blindly believe type declarations, but considers them assertions about
the program that should be checked: all type declarations that have
not been proven to always hold are asserted at runtime.
</p>
<blockquote>
<p><em>Remaining bugs in the compiler&rsquo;s handling of types unfortunately
provide some exceptions to this rule, see <a href="#Implementation-Limitations">Implementation Limitations</a>.</em>
</p></blockquote>

<p>CLOS slot types form a notable exception. Types declared using the
<code>:type</code> slot option in <code>defclass</code> are asserted if and only
if the class was defined in <em>safe code</em> and the slot access
location is in <em>safe code</em> as well. This laxness does not pose
any internal consistency issues, as the CLOS slot types are not
available for the type inferencer, nor do CLOS slot types provide any
efficiency benefits.
</p>
<p>There are three type checking policies available in SBCL, selectable
via <code>optimize</code> declarations.
</p>
<dl compact="compact">
<dt><strong>Full Type Checks</strong></dt>
<dd><p>All declarations are considered assertions to be checked at runtime,
and all type checks are precise. The default compilation policy
provides full type checks.
</p>
<p>Used when <code>(or (&gt;= safety 2) (&gt;= safety speed 1))</code>.
</p>
</dd>
<dt><strong>Weak Type Checks</strong></dt>
<dd><p>Declared types may be simplified into faster to check supertypes: for
example, <code>(or (integer -17 -7) (integer 7 17))</code> is simplified
into <code>(integer -17 17)</code>.
</p>
<p><strong>Note</strong>: it is relatively easy to corrupt the heap when weak
type checks are used if the program contains type-errors.
</p>
<p>Used when <code>(and (&lt; safety 2) (&lt; safety speed))</code>
</p>
</dd>
<dt><strong>No Type Checks</strong></dt>
<dd><p>All declarations are believed without assertions. Also disables
argument count and array bounds checking.
</p>
<p><strong>Note</strong>: any type errors in code where type checks are not
performed are liable to corrupt the heap.
</p>
<p>Used when <code>(= safety 0)</code>.
</p>
</dd>
</dl>

<hr>
<a name="Precise-Type-Checking"></a>
<div class="header">
<p>
Next: <a href="#Getting-Existing-Programs-to-Run" accesskey="n" rel="next">Getting Existing Programs to Run</a>, Previous: <a href="#Declarations-as-Assertions" accesskey="p" rel="prev">Declarations as Assertions</a>, Up: <a href="#Handling-of-Types" accesskey="u" rel="up">Handling of Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Precise-Type-Checking-1"></a>
<h4 class="subsection">4.2.2 Precise Type Checking</h4>
<a name="index-Precise-type-checking"></a>
<a name="index-Type-checking_002c-precise"></a>

<p>Precise checking means that the check is done as though <code>typep</code>
had been called with the exact type specifier that appeared in the
declaration.
</p>
<p>If a variable is declared to be <code>(integer 3 17)</code> then its value
must always be an integer between <code>3</code> and <code>17</code>. If multiple
type declarations apply to a single variable, then all the
declarations must be correct; it is as though all the types were
intersected producing a single <code>and</code> type specifier.
</p>
<p>To gain maximum benefit from the compiler&rsquo;s type checking, you should
always declare the types of function arguments and structure slots as
precisely as possible. This often involves the use of <code>or</code>,
<code>member</code>, and other list-style type specifiers.
</p>

<hr>
<a name="Getting-Existing-Programs-to-Run"></a>
<div class="header">
<p>
Next: <a href="#Implementation-Limitations" accesskey="n" rel="next">Implementation Limitations</a>, Previous: <a href="#Precise-Type-Checking" accesskey="p" rel="prev">Precise Type Checking</a>, Up: <a href="#Handling-of-Types" accesskey="u" rel="up">Handling of Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Getting-Existing-Programs-to-Run-1"></a>
<h4 class="subsection">4.2.3 Getting Existing Programs to Run</h4>
<a name="index-Existing-programs_002c-to-run"></a>
<a name="index-Types_002c-portability"></a>
<a name="index-Compatibility-with-other-Lisps"></a>

<p>Since SBCL&rsquo;s compiler does much more comprehensive type checking than
most Lisp compilers, SBCL may detect type errors in programs that have
been debugged using other compilers. These errors are mostly incorrect
declarations, although compile-time type errors can find actual bugs
if parts of the program have never been tested.
</p>
<p>Some incorrect declarations can only be detected by run-time type
checking. It is very important to initially compile a program with
full type checks (high <code>safety</code> optimization) and then test this
safe version. After the checking version has been tested, then you can
consider weakening or eliminating type checks.  <em>This applies
even to previously debugged programs,</em> because the SBCL compiler does
much more type inference than other Common Lisp compilers, so an
incorrect declaration can do more damage.
</p>
<p>The most common problem is with variables whose constant initial value
doesn&rsquo;t match the type declaration. Incorrect constant initial values
will always be flagged by a compile-time type error, and they are
simple to fix once located. Consider this code fragment:
</p>
<div class="lisp">
<pre class="lisp">(prog (foo)
  (declare (fixnum foo))
  (setq foo ...)
  ...)
</pre></div>

<p>Here <code>foo</code> is given an initial value of <code>nil</code>, but is
declared to be a <code>fixnum</code>.  Even if it is never read, the initial
value of a variable must match the declared type.  There are two ways
to fix this problem. Change the declaration
</p>
<div class="lisp">
<pre class="lisp">(prog (foo)
  (declare (type (or fixnum null) foo))
  (setq foo ...)
  ...)
</pre></div>

<p>or change the initial value
</p>
<div class="lisp">
<pre class="lisp">(prog ((foo 0))
  (declare (fixnum foo))
  (setq foo ...)
  ...)
</pre></div>

<p>It is generally preferable to change to a legal initial value rather
than to weaken the declaration, but sometimes it is simpler to weaken
the declaration than to try to make an initial value of the
appropriate type.
</p>
<p>Another declaration problem occasionally encountered is incorrect
declarations on <code>defmacro</code> arguments. This can happen when a
function is converted into a macro. Consider this macro:
</p>
<div class="lisp">
<pre class="lisp">(defmacro my-1+ (x)
  (declare (fixnum x))
  `(the fixnum (1+ ,x)))
</pre></div>

<p>Although legal and well-defined Common Lisp code, this meaning of this
definition is almost certainly not what the writer intended. For
example, this call is illegal:
</p>
<div class="lisp">
<pre class="lisp">(my-1+ (+ 4 5))
</pre></div>

<p>This call is illegal because the argument to the macro is <code>(+ 4
5)</code>, which is a <code>list</code>, not a <code>fixnum</code>.  Because of macro
semantics, it is hardly ever useful to declare the types of macro
arguments.  If you really want to assert something about the type of
the result of evaluating a macro argument, then put a <code>the</code> in
the expansion:
</p>
<div class="lisp">
<pre class="lisp">(defmacro my-1+ (x)
  `(the fixnum (1+ (the fixnum ,x))))
</pre></div>

<p>In this case, it would be stylistically preferable to change this
macro back to a function and declare it inline.
</p>
<p>Some more subtle problems are caused by incorrect declarations that
can&rsquo;t be detected at compile time.  Consider this code:
</p>
<div class="lisp">
<pre class="lisp">(do ((pos 0 (position #\a string :start (1+ pos))))
  ((null pos))
  (declare (fixnum pos))
  ...)
</pre></div>

<p>Although <code>pos</code> is almost always a <code>fixnum</code>, it is <code>nil</code>
at the end of the loop. If this example is compiled with full type
checks (the default), then running it will signal a type error at the
end of the loop. If compiled without type checks, the program will go
into an infinite loop (or perhaps <code>position</code> will complain
because <code>(1+ nil)</code> isn&rsquo;t a sensible start.) Why? Because if you
compile without type checks, the compiler just quietly believes the
type declaration. Since the compiler believes that <code>pos</code> is
always a <code>fixnum</code>, it believes that <code>pos</code> is never
<code>nil</code>, so <code>(null pos)</code> is never true, and the loop exit test
is optimized away. Such errors are sometimes flagged by unreachable
code notes, but it is still important to initially compile and test
any system with full type checks, even if the system works fine when
compiled using other compilers.
</p>
<p>In this case, the fix is to weaken the type declaration to <code>(or
fixnum null)</code> <a name="DOCF2" href="#FOOT2"><sup>2</sup></a>.
</p>
<p>Note that there is usually little performance penalty for weakening a
declaration in this way. Any numeric operations in the body can still
assume that the variable is a <code>fixnum</code>, since <code>nil</code> is not a
legal numeric argument. Another possible fix would be to say:
</p>
<div class="lisp">
<pre class="lisp">(do ((pos 0 (position #\a string :start (1+ pos))))
    ((null pos))
  (let ((pos pos))
    (declare (fixnum pos))
    ...))
</pre></div>

<p>This would be preferable in some circumstances, since it would allow a
non-standard representation to be used for the local <code>pos</code>
variable in the loop body.
</p>
<hr>
<a name="Implementation-Limitations"></a>
<div class="header">
<p>
Previous: <a href="#Getting-Existing-Programs-to-Run" accesskey="p" rel="prev">Getting Existing Programs to Run</a>, Up: <a href="#Handling-of-Types" accesskey="u" rel="up">Handling of Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Implementation-Limitations-1"></a>
<h4 class="subsection">4.2.4 Implementation Limitations</h4>

<p>Ideally, the compiler would consider <em>all</em> type declarations to
be assertions, so that adding type declarations to a program, no
matter how incorrect they might be, would <em>never</em> cause undefined
behavior. However, the compiler is known to fall short of this goal in
two areas:
</p>
<ul>
<li> <em>Proclaimed</em> constraints on argument and result types of a
function are supposed to be checked by the function. If the function
type is proclaimed before function definition, type checks are
inserted by the compiler, but the standard allows the reversed order,
in which case the compiler will trust the declaration.

</li><li> The compiler cannot check types of an unknown number of values; if the
number of generated values is unknown, but the number of consumed is
known, only consumed values are checked.

<p>For example,
</p>
<div class="lisp">
<pre class="lisp">(defun foo (x)
  (the integer (bar x)))
</pre></div>

<p>causes the following compiler diagnostic to be emitted:
</p>
<div class="example">
<pre class="example">; note: type assertion too complex to check:
;  (VALUES INTEGER &amp;REST T).
</pre></div>

<p>A partial workaround is instead write:
</p>
<div class="lisp">
<pre class="lisp">(defun foo (x)
  (the (values integer &amp;optional) (bar x)))
</pre></div>

</li></ul>

<p>These are important issues, but are not necessarily easy to fix, so
they may, alas, remain in the system for a while.
</p>
<hr>
<a name="Compiler-Policy"></a>
<div class="header">
<p>
Next: <a href="#Compiler-Errors" accesskey="n" rel="next">Compiler Errors</a>, Previous: <a href="#Handling-of-Types" accesskey="p" rel="prev">Handling of Types</a>, Up: <a href="#Compiler" accesskey="u" rel="up">Compiler</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Compiler-Policy-1"></a>
<h3 class="section">4.3 Compiler Policy</h3>

<p>Compiler policy is controlled by the <code>optimize</code> declaration,
supporting all ANSI optimization qualities (<code>debug</code>,
<code>safety</code>, <code>space</code>, and <code>speed</code>).<a name="DOCF3" href="#FOOT3"><sup>3</sup></a>
</p>
<p>For effects of various optimization qualities on type-safety and
debuggability see <a href="#Declarations-as-Assertions">Declarations as Assertions</a> and <a href="#Debugger-Policy-Control">Debugger Policy Control</a>.
</p>
<p>Ordinarily, when the <code>speed</code> quality is high, the compiler emits
notes to notify the programmer about its inability to apply various
optimizations. For selective muffling of these notes See <a href="#Controlling-Verbosity">Controlling Verbosity</a>.
</p>
<p>The value of <code>space</code> mostly influences the compiler&rsquo;s decision
whether to inline operations, which tend to increase the size of
programs. Use the value <code>0</code> with caution, since it can cause the
compiler to inline operations so indiscriminately that the net effect
is to slow the program by causing cache misses or even swapping.
</p>

<a name="Function-sb_002dext_003adescribe_002dcompiler_002dpolicy"></a><dl>
<dt><a name="index-describe_002dcompiler_002dpolicy"></a>Function: <strong>describe-compiler-policy</strong> <em>[sb-ext] &amp;optional spec</em></dt>
<dd><p>Print all global optimization settings, augmented by <code>spec</code>.
</p></dd></dl>
<a name="Function-sb_002dext_003arestrict_002dcompiler_002dpolicy"></a><dl>
<dt><a name="index-restrict_002dcompiler_002dpolicy"></a>Function: <strong>restrict-compiler-policy</strong> <em>[sb-ext] &amp;optional quality min max</em></dt>
<dd><p>Assign a minimum value to an optimization quality. <code>quality</code> is the name of
the optimization quality to restrict, <code>min</code> (defaulting to zero) is the
minimum allowed value, and <code>max</code> (defaults to 3) is the maximum.
</p>
<p>Returns the alist describing the current policy restrictions.
</p>
<p>If <code>quality</code> is <code>nil</code> or not given, nothing is done.
</p>
<p>Otherwise, if <code>min</code> is zero or <code>max</code> is 3 or neither are given, any
existing restrictions of <code>quality</code> are removed.
</p>
<p>See also <code>:policy</code> option in <code>with-compilation-unit</code>.
</p></dd></dl>
<a name="Macro-common_002dlisp_003awith_002dcompilation_002dunit"></a><dl>
<dt><a name="index-with_002dcompilation_002dunit"></a>Macro: <strong>with-compilation-unit</strong> <em>[cl] options &amp;body body</em></dt>
<dd><p>Affects compilations that take place within its dynamic extent. It is
intended to be eg. wrapped around the compilation of all files in the same system.
</p>
<p>Following options are defined:
</p>

<dl compact="compact">
<dt><em><code>:override</code> Boolean-Form</em></dt>
<dd><p>One of the effects of this form is to delay undefined warnings until the
      end of the form, instead of giving them at the end of each compilation.
      If <code>override</code> is <code>nil</code> (the default), then the outermost
      <code>with-compilation-unit</code> form grabs the undefined warnings. Specifying
      <code>override</code> true causes that form to grab any enclosed warnings, even if it
      is enclosed by another <code>with-compilation-unit</code>.
</p>

</dd>
<dt><em><code>:policy</code> Optimize-Declaration-Form</em></dt>
<dd><p>Provides dynamic scoping for global compiler optimization qualities and
      restrictions, limiting effects of subsequent <code>optimize</code> proclamations and
      calls to <code>sb-ext:restrict-compiler-policy</code> to the dynamic scope of <code>body</code>.
</p>
<p>If <code>override</code> is false, specified <code>policy</code> is merged with current global
      policy. If <code>override</code> is true, current global policy, including any
      restrictions, is discarded in favor of the specified <code>policy</code>.
</p>
<p>Supplying <code>policy</code> <code>nil</code> is equivalent to the option not being supplied at
      all, ie. dynamic scoping of policy does not take place.
</p>
<p>This option is an SBCL-specific experimental extension: Interface
      subject to change.
</p>

</dd>
<dt><em><code>:source-namestring</code> Namestring-Form</em></dt>
<dd><p>Attaches the value returned by the Namestring-Form to the internal
      debug-source information as the namestring of the source file. Normally
      the namestring of the input-file for <code>compile-file</code> is used: this option
      can be used to provide source-file information for functions compiled
      using <code>compile</code>, or to override the input-file of <code>compile-file</code>.
</p>
<p>If both an outer and an inner <code>with-compilation-unit</code> provide a
      <code>source-namestring</code>, the inner one takes precedence. Unaffected
      by <code>:override</code>.
</p>
<p>This is an SBCL-specific extension.
</p>

</dd>
<dt><em><code>:source-plist</code> Plist-Form</em></dt>
<dd><p>Attaches the value returned by the Plist-Form to internal debug-source
      information of functions compiled in within the dynamic extent of <code>body</code>.
</p>
<p>Primarily for use by development environments, in order to eg. associate
      function definitions with editor-buffers. Can be accessed using
      <code>sb-introspect:definition-source-plist</code>.
</p>
<p>If an outer <code>with-compilation-unit</code> form also provide a <code>source-plist</code>, it
      is appended to the end of the provided <code>source-plist</code>. Unaffected
      by <code>:override</code>.
</p>
<p>This is an SBCL-specific extension.
</p>
</dd>
</dl>

<p>Examples:
</p>
<div class="lisp">
<pre class="lisp">  ;; Prevent proclamations from the file leaking, and restrict
  ;; SAFETY to 3 -- otherwise uses the current global policy.
  (with-compilation-unit (:policy '(optimize))
    (restrict-compiler-policy 'safety 3)
    (load &quot;foo.lisp&quot;))

  ;; Using default policy instead of the current global one,
  ;; except for DEBUG 3.
  (with-compilation-unit (:policy '(optimize debug)
                          :override t)
    (load &quot;foo.lisp&quot;))

  ;; Same as if :POLICY had not been specified at all: SAFETY 3
  ;; proclamation leaks out from WITH-COMPILATION-UNIT.
  (with-compilation-unit (:policy nil)
    (declaim (optimize safety))
    (load &quot;foo.lisp&quot;))
</pre></div>
</dd></dl>

<hr>
<a name="Compiler-Errors"></a>
<div class="header">
<p>
Next: <a href="#Open-Coding-and-Inline-Expansion" accesskey="n" rel="next">Open Coding and Inline Expansion</a>, Previous: <a href="#Compiler-Policy" accesskey="p" rel="prev">Compiler Policy</a>, Up: <a href="#Compiler" accesskey="u" rel="up">Compiler</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Compiler-Errors-1"></a>
<h3 class="section">4.4 Compiler Errors</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Type-Errors-at-Compile-Time" accesskey="1">Type Errors at Compile Time</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Errors-During-Macroexpansion" accesskey="2">Errors During Macroexpansion</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Read-Errors" accesskey="3">Read Errors</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Type-Errors-at-Compile-Time"></a>
<div class="header">
<p>
Next: <a href="#Errors-During-Macroexpansion" accesskey="n" rel="next">Errors During Macroexpansion</a>, Up: <a href="#Compiler-Errors" accesskey="u" rel="up">Compiler Errors</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Type-Errors-at-Compile-Time-1"></a>
<h4 class="subsection">4.4.1 Type Errors at Compile Time</h4>
<a name="index-Compile-time-type-errors"></a>
<a name="index-Type-checking_002c-at-compile-time"></a>

<p>If the compiler can prove at compile time that some portion of the
program cannot be executed without a type error, then it will give a
warning at compile time.
</p>
<p>It is possible that the offending code would never actually be
executed at run-time due to some higher level consistency constraint
unknown to the compiler, so a type warning doesn&rsquo;t always indicate an
incorrect program.
</p>
<p>For example, consider this code fragment:
</p>
<div class="lisp">
<pre class="lisp">(defun raz (foo)
  (let ((x (case foo
              (:this 13)
              (:that 9)
              (:the-other 42))))
    (declare (fixnum x))
    (foo x)))
</pre></div>

<p>Compilation produces this warning:
</p>
<div class="example">
<pre class="example">; in: DEFUN RAZ
;     (CASE FOO (:THIS 13) (:THAT 9) (:THE-OTHER 42))
; --&gt; LET COND IF COND IF COND IF
; ==&gt;
;   (COND)
;
; caught WARNING:
;   This is not a FIXNUM:
;   NIL
</pre></div>

<p>In this case, the warning means that if <code>foo</code> isn&rsquo;t any of
<code>:this</code>, <code>:that</code> or <code>:the-other</code>, then <code>x</code> will be
initialized to <code>nil</code>, which the <code>fixnum</code> declaration makes
illegal. The warning will go away if <code>ecase</code> is used instead of
<code>case</code>, or if <code>:the-other</code> is changed to <code>t</code>.
</p>
<p>This sort of spurious type warning happens moderately often in the
expansion of complex macros and in inline functions. In such cases,
there may be dead code that is impossible to correctly execute. The
compiler can&rsquo;t always prove this code is dead (could never be
executed), so it compiles the erroneous code (which will always signal
an error if it is executed) and gives a warning.
</p>
<hr>
<a name="Errors-During-Macroexpansion"></a>
<div class="header">
<p>
Next: <a href="#Read-Errors" accesskey="n" rel="next">Read Errors</a>, Previous: <a href="#Type-Errors-at-Compile-Time" accesskey="p" rel="prev">Type Errors at Compile Time</a>, Up: <a href="#Compiler-Errors" accesskey="u" rel="up">Compiler Errors</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Errors-During-Macroexpansion-1"></a>
<h4 class="subsection">4.4.2 Errors During Macroexpansion</h4>
<a name="index-Macroexpansion_002c-errors-during"></a>

<p>The compiler handles errors that happen during macroexpansion, turning
them into compiler errors. If you want to debug the error (to debug a
macro), you can set <code>*break-on-signals*</code> to <code>error</code>. For
example, this definition:
</p>
<div class="lisp">
<pre class="lisp">(defun foo (e l)
  (do ((current l (cdr current))
       ((atom current) nil))
      (when (eq (car current) e) (return current))))
</pre></div>

<p>gives this error:
</p>
<div class="example">
<pre class="example">; in: DEFUN FOO
;     (DO ((CURRENT L (CDR CURRENT))
;        ((ATOM CURRENT) NIL))
;       (WHEN (EQ (CAR CURRENT) E) (RETURN CURRENT)))
;
; caught ERROR:
;   (in macroexpansion of (DO # #))
;   (hint: For more precise location, try *BREAK-ON-SIGNALS*.)
;   DO step variable is not a symbol: (ATOM CURRENT)
</pre></div>


<hr>
<a name="Read-Errors"></a>
<div class="header">
<p>
Previous: <a href="#Errors-During-Macroexpansion" accesskey="p" rel="prev">Errors During Macroexpansion</a>, Up: <a href="#Compiler-Errors" accesskey="u" rel="up">Compiler Errors</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Read-Errors-1"></a>
<h4 class="subsection">4.4.3 Read Errors</h4>
<a name="index-Read-errors_002c-compiler"></a>

<p>SBCL&rsquo;s compiler does not attempt to recover from read errors when
reading a source file, but instead just reports the offending
character position and gives up on the entire source file.
</p>
<hr>
<a name="Open-Coding-and-Inline-Expansion"></a>
<div class="header">
<p>
Next: <a href="#Interpreter" accesskey="n" rel="next">Interpreter</a>, Previous: <a href="#Compiler-Errors" accesskey="p" rel="prev">Compiler Errors</a>, Up: <a href="#Compiler" accesskey="u" rel="up">Compiler</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Open-Coding-and-Inline-Expansion-1"></a>
<h3 class="section">4.5 Open Coding and Inline Expansion</h3>
<a name="index-Open_002dcoding"></a>
<a name="index-Inline-expansion"></a>
<a name="index-Static-functions"></a>

<p>Since Common Lisp forbids the redefinition of standard functions, the
compiler can have special knowledge of these standard functions
embedded in it. This special knowledge is used in various ways (open
coding, inline expansion, source transformation), but the implications
to the user are basically the same:
</p>
<ul>
<li> Attempts to redefine standard functions may be frustrated, since the
function may never be called. Although it is technically illegal to
redefine standard functions, users sometimes want to implicitly
redefine these functions when they are debugging using the
<code>trace</code> macro.  Special-casing of standard functions can be
inhibited using the <code>notinline</code> declaration, but even then some
phases of analysis such as type inferencing are applied by the
compiler.

</li><li> The compiler can have multiple alternate implementations of standard
functions that implement different trade-offs of speed, space and
safety.  This selection is based on the compiler policy, <a href="#Compiler-Policy">Compiler Policy</a>.

</li></ul>

<p>When a function call is <em>open coded</em>, inline code whose effect is
equivalent to the function call is substituted for that function
call. When a function call is <em>closed coded</em>, it is usually left
as is, although it might be turned into a call to a different function
with different arguments. As an example, if <code>nthcdr</code> were to be
open coded, then
</p>
<div class="lisp">
<pre class="lisp">(nthcdr 4 foobar)
</pre></div>

<p>might turn into
</p>
<div class="lisp">
<pre class="lisp">(cdr (cdr (cdr (cdr foobar))))
</pre></div>

<p>or even
</p>
<div class="lisp">
<pre class="lisp">(do ((i 0 (1+ i))
  (list foobar (cdr foobar)))
  ((= i 4) list))
</pre></div>

<p>If <code>nth</code> is closed coded, then
</p>
<div class="lisp">
<pre class="lisp">(nth x l)
</pre></div>

<p>might stay the same, or turn into something like
</p>
<div class="lisp">
<pre class="lisp">(car (nthcdr x l))
</pre></div>

<p>In general, open coding sacrifices space for speed, but some functions
(such as <code>car</code>) are so simple that they are always
open-coded. Even when not open-coded, a call to a standard function
may be transformed into a different function call (as in the last
example) or compiled as <em>static call</em>. Static function call uses
a more efficient calling convention that forbids redefinition.
</p>
<hr>
<a name="Interpreter"></a>
<div class="header">
<p>
Previous: <a href="#Open-Coding-and-Inline-Expansion" accesskey="p" rel="prev">Open Coding and Inline Expansion</a>, Up: <a href="#Compiler" accesskey="u" rel="up">Compiler</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Interpreter-1"></a>
<h3 class="section">4.6 Interpreter</h3>
<a name="index-Interpreter"></a>
<a name="index-eval-_005bcl_005d"></a>
<a name="index-_002aevaluator_002dmode_002a-_005bsb_002dext_005d"></a>

<p>By default SBCL implements <code>eval</code> by calling the native code
compiler.
</p>
<p>SBCL also includes an interpreter for use in special cases where using
the compiler is undesirable, for example due to compilation overhead.
Unlike in some other Lisp implementations, in SBCL interpreted code is
not safer or more debuggable than compiled code.
</p>
<a name="Variable-sb_002dext_003a_002aevaluator_002dmode_002a"></a><dl>
<dt><a name="index-_002aevaluator_002dmode_002a"></a>Variable: <strong>*evaluator-mode*</strong> <em>[sb-ext]</em></dt>
<dd><p>Toggle between different evaluator implementations. If set to <code>:compile</code>,
an implementation of <code>eval</code> that calls the compiler will be used. If set
to <code>:interpret</code>, an interpreter will be used.
</p></dd></dl>
<hr>
<a name="Debugger"></a>
<div class="header">
<p>
Next: <a href="#Efficiency" accesskey="n" rel="next">Efficiency</a>, Previous: <a href="#Compiler" accesskey="p" rel="prev">Compiler</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Debugger-1"></a>
<h2 class="chapter">5 Debugger</h2>
<a name="index-Debugger"></a>

<p>This chapter documents the debugging facilities of SBCL, including
the debugger, single-stepper and <code>trace</code>, and the effect of
<code>(optimize debug)</code> declarations.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Debugger-Entry" accesskey="1">Debugger Entry</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Debugger-Command-Loop" accesskey="2">Debugger Command Loop</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Stack-Frames" accesskey="3">Stack Frames</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Variable-Access" accesskey="4">Variable Access</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Source-Location-Printing" accesskey="5">Source Location Printing</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Debugger-Policy-Control" accesskey="6">Debugger Policy Control</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Exiting-Commands" accesskey="7">Exiting Commands</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Information-Commands" accesskey="8">Information Commands</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Function-Tracing" accesskey="9">Function Tracing</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Single-Stepping">Single Stepping</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Debugger-Entry"></a>
<div class="header">
<p>
Next: <a href="#Debugger-Command-Loop" accesskey="n" rel="next">Debugger Command Loop</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Debugger-Entry-1"></a>
<h3 class="section">5.1 Debugger Entry</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Debugger-Banner" accesskey="1">Debugger Banner</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Debugger-Invocation" accesskey="2">Debugger Invocation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Debugger-Banner"></a>
<div class="header">
<p>
Next: <a href="#Debugger-Invocation" accesskey="n" rel="next">Debugger Invocation</a>, Up: <a href="#Debugger-Entry" accesskey="u" rel="up">Debugger Entry</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Debugger-Banner-1"></a>
<h4 class="subsection">5.1.1 Debugger Banner</h4>

<p>When you enter the debugger, it looks something like this:
</p>
<div class="example">
<pre class="example">debugger invoked on a TYPE-ERROR in thread 11184:
  The value 3 is not of type LIST.

You can type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT   ] Reduce debugger level (leaving debugger, returning to toplevel).
  1: [TOPLEVEL] Restart at toplevel READ/EVAL/PRINT loop.
(CAR 1 3)
0]
</pre></div>

<p>The first group of lines describe what the error was that put us in
the debugger.  In this case <code>car</code> was called on <code>3</code>, causing
a <code>type-error</code>.
</p>
<p>This is followed by the &ldquo;beginner help line&rdquo;, which appears only if
<code>sb-debug:*debug-beginner-help-p*</code> is true (default).
</p>
<p>Next comes a listing of the active restart names, along with their
descriptions &ndash; the ways we can restart execution after this error. In
this case, both options return to top-level. Restarts can be selected
by entering the corresponding number or name.
</p>
<p>The current frame appears right underneath the restarts, immediately
followed by the debugger prompt.
</p>
<hr>
<a name="Debugger-Invocation"></a>
<div class="header">
<p>
Previous: <a href="#Debugger-Banner" accesskey="p" rel="prev">Debugger Banner</a>, Up: <a href="#Debugger-Entry" accesskey="u" rel="up">Debugger Entry</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Debugger-Invocation-1"></a>
<h4 class="subsection">5.1.2 Debugger Invocation</h4>

<p>The debugger is invoked when:
</p>
<ul>
<li> <code>error</code> is called, and the condition it signals is not handled.

</li><li> <code>break</code> is called, or <code>signal</code> is called with a condition
that matches the current <code>*break-on-signals*</code>.

</li><li> the debugger is explicitly entered with the <code>invoke-debugger</code>
function.

</li></ul>

<p>When the debugger is invoked by a condition, ANSI mandates that the
value of <code>*debugger-hook*</code>, if any, be called with two arguments:
the condition that caused the debugger to be invoked and the previous
value of <code>*debugger-hook*</code>. When this happens,
<code>*debugger-hook*</code> is bound to NIL to prevent recursive errors.
However, ANSI also mandates that <code>*debugger-hook*</code> not be invoked
when the debugger is to be entered by the <code>break</code> function. For
users who wish to provide an alternate debugger interface (and thus
catch <code>break</code> entries into the debugger), SBCL provides
<code>sb-ext:*invoke-debugger-hook*</code>, which is invoked during any
entry into the debugger.
</p>
<a name="Variable-sb_002dext_003a_002ainvoke_002ddebugger_002dhook_002a"></a><dl>
<dt><a name="index-_002ainvoke_002ddebugger_002dhook_002a"></a>Variable: <strong>*invoke-debugger-hook*</strong> <em>[sb-ext]</em></dt>
<dd><p>This is either <code>nil</code> or a designator for a function of two arguments,
   to be run when the debugger is about to be entered.  The function is
   run with <code>*invoke-debugger-hook*</code> bound to <code>nil</code> to minimize recursive
   errors, and receives as arguments the condition that triggered
   debugger entry and the previous value of <code>*invoke-debugger-hook*</code>
</p>
<p>This mechanism is an <code>sbcl</code> extension similar to the standard <code>*debugger-hook*</code>.
   In contrast to <code>*debugger-hook*</code>, it is observed by <code>invoke-debugger</code> even when
   called by <code>break</code>.
</p></dd></dl>

<hr>
<a name="Debugger-Command-Loop"></a>
<div class="header">
<p>
Next: <a href="#Stack-Frames" accesskey="n" rel="next">Stack Frames</a>, Previous: <a href="#Debugger-Entry" accesskey="p" rel="prev">Debugger Entry</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Debugger-Command-Loop-1"></a>
<h3 class="section">5.2 Debugger Command Loop</h3>

<p>The debugger is an interactive read-eval-print loop much like the
normal top level, but some symbols are interpreted as debugger
commands instead of being evaluated. A debugger command starts with
the symbol name of the command, possibly followed by some arguments on
the same line. Some commands prompt for additional input. Debugger
commands can be abbreviated by any unambiguous prefix: <code>help</code>
can be typed as &lsquo;<samp>h</samp>&rsquo;, &lsquo;<samp>he</samp>&rsquo;, etc.
</p>
<p>The package is not significant in debugger commands; any symbol with
the name of a debugger command will work. If you want to show the
value of a variable that happens also to be the name of a debugger
command you can wrap the variable in a <code>progn</code> to hide it from
the command loop.
</p>
<p>The debugger prompt is &ldquo;<code><var>frame</var>]</code>&rdquo;, where <var>frame</var> is
the number of the current frame.  Frames are numbered starting from
zero at the top (most recent call), increasing down to the bottom.
The current frame is the frame that commands refer to.
</p>
<p>It is possible to override the normal printing behaviour in the
debugger by using the <code>sb-ext:*debug-print-variable-alist*</code>.
</p>
<a name="Variable-sb_002dext_003a_002adebug_002dprint_002dvariable_002dalist_002a"></a><dl>
<dt><a name="index-_002adebug_002dprint_002dvariable_002dalist_002a"></a>Variable: <strong>*debug-print-variable-alist*</strong> <em>[sb-ext]</em></dt>
<dd><p>an association list describing new bindings for special variables
to be used within the debugger. Eg.
</p>
<div class="lisp">
<pre class="lisp"> ((*PRINT-LENGTH* . 10) (*PRINT-LEVEL* . 6) (*PRINT-PRETTY* . NIL))
</pre></div>

<p>The variables in the <code>car</code> positions are bound to the values in the <code>cdr</code>
during the execution of some debug commands. When evaluating arbitrary
expressions in the debugger, the normal values of the printer control
variables are in effect.
</p>
<p>Initially empty, <code>*debug-print-variable-alist*</code> is typically used to
provide bindings for printer control variables.
</p></dd></dl>

<hr>
<a name="Stack-Frames"></a>
<div class="header">
<p>
Next: <a href="#Variable-Access" accesskey="n" rel="next">Variable Access</a>, Previous: <a href="#Debugger-Command-Loop" accesskey="p" rel="prev">Debugger Command Loop</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Stack-Frames-1"></a>
<h3 class="section">5.3 Stack Frames</h3>
<a name="index-Stack-frames"></a>

<p>A <em>stack frame</em> is the run-time representation of a call to a
function; the frame stores the state that a function needs to remember
what it is doing.  Frames have:
</p>
<ul>
<li> <em>variables</em> (see <a href="#Variable-Access">Variable Access</a>), which are the values being operated
on.

</li><li> <em>arguments</em> to the call (which are really just particularly
interesting variables).

</li><li> a current source location (see <a href="#Source-Location-Printing">Source Location Printing</a>), which is
the place in the program where the function was running when it
stopped to call another function, or because of an interrupt or error.

</li></ul>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Stack-Motion" accesskey="1">Stack Motion</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#How-Arguments-are-Printed" accesskey="2">How Arguments are Printed</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Function-Names" accesskey="3">Function Names</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Debug-Tail-Recursion" accesskey="4">Debug Tail Recursion</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Unknown-Locations-and-Interrupts" accesskey="5">Unknown Locations and Interrupts</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Stack-Motion"></a>
<div class="header">
<p>
Next: <a href="#How-Arguments-are-Printed" accesskey="n" rel="next">How Arguments are Printed</a>, Up: <a href="#Stack-Frames" accesskey="u" rel="up">Stack Frames</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Stack-Motion-1"></a>
<h4 class="subsection">5.3.1 Stack Motion</h4>

<p>These commands move to a new stack frame and print the name of the
function and the values of its arguments in the style of a Lisp
function call:
</p>
<dl>
<dt><a name="index-up"></a>Debugger Command: <strong>up</strong></dt>
<dd><p>Move up to the next higher frame.  More recent function calls are
considered to be higher on the stack.
</p></dd></dl>

<dl>
<dt><a name="index-down"></a>Debugger Command: <strong>down</strong></dt>
<dd><p>Move down to the next lower frame.
</p></dd></dl>

<dl>
<dt><a name="index-top"></a>Debugger Command: <strong>top</strong></dt>
<dd><p>Move to the highest frame, that is, the frame where the debugger was
entered.
</p></dd></dl>

<dl>
<dt><a name="index-bottom"></a>Debugger Command: <strong>bottom</strong></dt>
<dd><p>Move to the lowest frame.
</p></dd></dl>

<dl>
<dt><a name="index-frame"></a>Debugger Command: <strong>frame</strong> <em>[<var>n</var>]</em></dt>
<dd><p>Move to the frame with the specified number.  Prompts for the number if not
supplied.  The frame with number 0 is the frame where the debugger
was entered.
</p></dd></dl>


<hr>
<a name="How-Arguments-are-Printed"></a>
<div class="header">
<p>
Next: <a href="#Function-Names" accesskey="n" rel="next">Function Names</a>, Previous: <a href="#Stack-Motion" accesskey="p" rel="prev">Stack Motion</a>, Up: <a href="#Stack-Frames" accesskey="u" rel="up">Stack Frames</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="How-Arguments-are-Printed-1"></a>
<h4 class="subsection">5.3.2 How Arguments are Printed</h4>

<p>A frame is printed to look like a function call, but with the actual
argument values in the argument positions.  So the frame for this call
in the source:
</p>
<div class="lisp">
<pre class="lisp">(myfun (+ 3 4) 'a)
</pre></div>

<p>would look like this:
</p>
<div class="example">
<pre class="example">(MYFUN 7 A)
</pre></div>

<p>All keyword and optional arguments are displayed with their actual
values; if the corresponding argument was not supplied, the value will
be the default.  So this call:
</p>
<div class="lisp">
<pre class="lisp">(subseq &quot;foo&quot; 1)
</pre></div>

<p>would look like this:
</p>
<div class="example">
<pre class="example">(SUBSEQ &quot;foo&quot; 1 3)
</pre></div>

<p>And this call:
</p>
<div class="lisp">
<pre class="lisp">(string-upcase &quot;test case&quot;)
</pre></div>

<p>would look like this:
</p>
<div class="example">
<pre class="example">(STRING-UPCASE &quot;test case&quot; :START 0 :END NIL)
</pre></div>

<p>The arguments to a function call are displayed by accessing the
argument variables.  Although those variables are initialized to the
actual argument values, they can be set inside the function; in this
case the new value will be displayed.
</p>
<p><code>&amp;rest</code> arguments are handled somewhat differently.  The value of
the rest argument variable is displayed as the spread-out arguments to
the call, so:
</p>
<div class="lisp">
<pre class="lisp">(format t &quot;~A is a ~A.&quot; &quot;This&quot; 'test)
</pre></div>

<p>would look like this:
</p>
<div class="example">
<pre class="example">(FORMAT T &quot;~A is a ~A.&quot; &quot;This&quot; 'TEST)
</pre></div>

<p>Rest arguments cause an exception to the normal display of keyword
arguments in functions that have both <code>&amp;rest</code> and <code>&amp;key</code>
arguments.  In this case, the keyword argument variables are not
displayed at all; the rest arg is displayed instead.  So for these
functions, only the keywords actually supplied will be shown, and the
values displayed will be the argument values, not values of the
(possibly modified) variables.
</p>
<p>If the variable for an argument is never referenced by the function,
it will be deleted.  The variable value is then unavailable, so the
debugger prints &lsquo;<samp>#&lt;unused-arg&gt;</samp>&rsquo; instead of the value.  Similarly,
if for any of a number of reasons the value of the variable is
unavailable or not known to be available (see <a href="#Variable-Access">Variable Access</a>),
then &lsquo;<samp>#&lt;unavailable-arg&gt;</samp>&rsquo; will be printed instead of the argument
value.
</p>
<p>Note that inline expansion and open-coding affect what frames
are present in the debugger, see <a href="#Debugger-Policy-Control">Debugger Policy Control</a>.
</p>

<hr>
<a name="Function-Names"></a>
<div class="header">
<p>
Next: <a href="#Debug-Tail-Recursion" accesskey="n" rel="next">Debug Tail Recursion</a>, Previous: <a href="#How-Arguments-are-Printed" accesskey="p" rel="prev">How Arguments are Printed</a>, Up: <a href="#Stack-Frames" accesskey="u" rel="up">Stack Frames</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Function-Names-1"></a>
<h4 class="subsection">5.3.3 Function Names</h4>

<p>If a function is defined by <code>defun</code> it will appear in backtrace
by that name. Functions defined by <code>labels</code> and <code>flet</code> will
appear as <code>(FLET <var>name</var>)</code> and <code>(LABELS <var>name</var>)</code> respectively.
Anonymous lambdas will appear as <code>(LAMDBA <var>lambda-list</var>)</code>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Entry-Point-Details" accesskey="1">Entry Point Details</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Entry-Point-Details"></a>
<div class="header">
<p>
Up: <a href="#Function-Names" accesskey="u" rel="up">Function Names</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Entry-Point-Details-1"></a>
<h4 class="subsubsection">5.3.3.1 Entry Point Details</h4>
<a name="index-External-entry-points"></a>
<a name="index-Entry-points_002c-external"></a>
<a name="index-Block-compilation_002c-debugger-implications"></a>
<a name="index-External_002c-stack-frame-kind"></a>
<a name="index-Optional_002c-stack-frame-kind"></a>
<a name="index-Cleanup_002c-stack-frame-kind"></a>

<p>Sometimes the compiler introduces new functions that are used to
implement a user function, but are not directly specified in the
source. This is mostly done for argument type and count checking.
</p>


<p>With recursive functions, an additional <code>external</code> frame may
appear before the frame representing the first call to the recursive
function. This is a consequence of the way the compiler works: there
is nothing odd with your program. You may also see <code>cleanup</code>
frames during the execution of <code>unwind-protect</code> cleanup code, and
<code>optional</code> for variable argument entry points.
</p>
<hr>
<a name="Debug-Tail-Recursion"></a>
<div class="header">
<p>
Next: <a href="#Unknown-Locations-and-Interrupts" accesskey="n" rel="next">Unknown Locations and Interrupts</a>, Previous: <a href="#Function-Names" accesskey="p" rel="prev">Function Names</a>, Up: <a href="#Stack-Frames" accesskey="u" rel="up">Stack Frames</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Debug-Tail-Recursion-1"></a>
<h4 class="subsection">5.3.4 Debug Tail Recursion</h4>
<a name="index-Tail-recursion"></a>
<a name="index-Recursion_002c-tail"></a>

<p>The compiler is &ldquo;properly tail recursive.&rdquo; If a function call is in
a tail-recursive position, the stack frame will be deallocated
<em>at the time of the call</em>, rather than after the call returns.
Consider this backtrace:
</p>
<div class="example">
<pre class="example">(BAR ...)
(FOO ...)
</pre></div>

<p>Because of tail recursion, it is not necessarily the case that
<code>FOO</code> directly called <code>BAR</code>.  It may be that <code>FOO</code>
called some other function <code>FOO2</code> which then called <code>BAR</code>
tail-recursively, as in this example:
</p>
<div class="lisp">
<pre class="lisp">(defun foo ()
  ...
  (foo2 ...)
  ...)

(defun foo2 (...)
  ...
  (bar ...))

(defun bar (...)
  ...)
</pre></div>

<p>Usually the elimination of tail-recursive frames makes debugging more
pleasant, since these frames are mostly uninformative.  If there is any
doubt about how one function called another, it can usually be
eliminated by finding the source location in the calling frame.
See <a href="#Source-Location-Printing">Source Location Printing</a>.
</p>
<p>The elimination of tail-recursive frames can be prevented by disabling
tail-recursion optimization, which happens when the <code>debug</code>
optimization quality is greater than <code>2</code>.
See <a href="#Debugger-Policy-Control">Debugger Policy Control</a>.
</p>

<hr>
<a name="Unknown-Locations-and-Interrupts"></a>
<div class="header">
<p>
Previous: <a href="#Debug-Tail-Recursion" accesskey="p" rel="prev">Debug Tail Recursion</a>, Up: <a href="#Stack-Frames" accesskey="u" rel="up">Stack Frames</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Unknown-Locations-and-Interrupts-1"></a>
<h4 class="subsection">5.3.5 Unknown Locations and Interrupts</h4>
<a name="index-Unknown-code-locations"></a>
<a name="index-Locations_002c-unknown"></a>
<a name="index-Interrupts"></a>
<a name="index-Errors_002c-run_002dtime"></a>

<p>The debugger operates using special debugging information attached to
the compiled code.  This debug information tells the debugger what it
needs to know about the locations in the code where the debugger can
be invoked.  If the debugger somehow encounters a location not
described in the debug information, then it is said to be
<em>unknown</em>.  If the code location for a frame is unknown, then some
variables may be inaccessible, and the source location cannot be
precisely displayed.
</p>
<p>There are three reasons why a code location could be unknown:
</p>
<ul>
<li> There is inadequate debug information due to the value of the <code>debug</code>
optimization quality.  See <a href="#Debugger-Policy-Control">Debugger Policy Control</a>.

</li><li> The debugger was entered because of an interrupt such as <tt class="key">C-c</tt>.

</li><li> A hardware error such as &ldquo;&lsquo;<samp>bus error</samp>&rsquo;&rdquo; occurred in code that was
compiled unsafely due to the value of the <code>safety</code> optimization
quality.

</li></ul>

<p>In the last two cases, the values of argument variables are
accessible, but may be incorrect.  For more details on when variable
values are accessible, <a href="#Variable-Value-Availability">Variable Value Availability</a>.
</p>
<p>It is possible for an interrupt to happen when a function call or
return is in progress.  The debugger may then flame out with some
obscure error or insist that the bottom of the stack has been reached,
when the real problem is that the current stack frame can&rsquo;t be
located.  If this happens, return from the interrupt and try again.
</p>

<hr>
<a name="Variable-Access"></a>
<div class="header">
<p>
Next: <a href="#Source-Location-Printing" accesskey="n" rel="next">Source Location Printing</a>, Previous: <a href="#Stack-Frames" accesskey="p" rel="prev">Stack Frames</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Variable-Access-1"></a>
<h3 class="section">5.4 Variable Access</h3>
<a name="index-Debug-variables"></a>
<a name="index-Variables_002c-debugger-access"></a>

<p>There are two ways to access the current frame&rsquo;s local variables in
the debugger: <code>list-locals</code> and <code>sb-debug:var</code>.
</p>
<p>The debugger doesn&rsquo;t really understand lexical scoping; it has just
one namespace for all the variables in the current stack frame.  If a
symbol is the name of multiple variables in the same function, then
the reference appears ambiguous, even though lexical scoping specifies
which value is visible at any given source location.  If the scopes of
the two variables are not nested, then the debugger can resolve the
ambiguity by observing that only one variable is accessible.
</p>
<p>When there are ambiguous variables, the evaluator assigns each one a
small integer identifier.  The <code>sb-debug:var</code> function uses this
identifier to distinguish between ambiguous variables.  The
<code>list-locals</code> command prints the identifier.  In the
following example, there are two variables named <code>X</code>.  The first
one has identifier 0 (which is not printed), the second one has
identifier 1.
</p>
<div class="example">
<pre class="example">X  =  1
X#1  =  2
</pre></div>

<dl>
<dt><a name="index-list_002dlocals"></a>Debugger Command: <strong>list-locals</strong> <em>[<var>prefix</var>]</em></dt>
<dd><p>This command prints the name and value of all variables in the current
frame whose name has the specified <var>prefix</var>.  <var>prefix</var> may be
a string or a symbol.  If no <var>prefix</var> is given, then all available
variables are printed.  If a variable has a potentially ambiguous
name, then the name is printed with a &ldquo;<code>#<var>identifier</var></code>&rdquo;
suffix, where <var>identifier</var> is the small integer used to make the
name unique.
</p></dd></dl>

<dl>
<dt><a name="index-var"></a>Function: <strong>var</strong> <em>[sb-debug] <var>name</var> &amp;optional <var>identifier</var></em></dt>
<dd><p>This function returns the value of the variable in the current frame
with the specified <var>name</var>.  If supplied, <var>identifier</var>
determines which value to return when there are ambiguous variables.
</p>
<p>When <var>name</var> is a symbol, it is interpreted as the symbol name of
the variable, i.e. the package is significant.  If <var>name</var> is an
uninterned symbol (gensym), then return the value of the uninterned
variable with the same name.  If <var>name</var> is a string,
<code>sb-debug:var</code> interprets it as the prefix of a variable name
that must unambiguously complete to the name of a valid variable.
</p>
<p><var>identifier</var> is used to disambiguate the variable name; use
<code>list-locals</code> to find out the identifiers.
</p></dd></dl>


<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Variable-Value-Availability" accesskey="1">Variable Value Availability</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Note-On-Lexical-Variable-Access" accesskey="2">Note On Lexical Variable Access</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Variable-Value-Availability"></a>
<div class="header">
<p>
Next: <a href="#Note-On-Lexical-Variable-Access" accesskey="n" rel="next">Note On Lexical Variable Access</a>, Up: <a href="#Variable-Access" accesskey="u" rel="up">Variable Access</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Variable-Value-Availability-1"></a>
<h4 class="subsection">5.4.1 Variable Value Availability</h4>
<a name="index-Availability-of-debug-variables"></a>
<a name="index-Validity-of-debug-variables"></a>
<a name="index-Debug-optimization-quality"></a>

<p>The value of a variable may be unavailable to the debugger in portions
of the program where Lisp says that the variable is defined.  If a
variable value is not available, the debugger will not let you read or
write that variable.  With one exception, the debugger will never
display an incorrect value for a variable.  Rather than displaying
incorrect values, the debugger tells you the value is unavailable.
</p>
<p>The one exception is this: if you interrupt (e.g., with <tt class="key">C-c</tt>) or
if there is an unexpected hardware error such as &ldquo;&lsquo;<samp>bus error</samp>&rsquo;&rdquo;
(which should only happen in unsafe code), then the values displayed
for arguments to the interrupted frame might be
incorrect.<a name="DOCF4" href="#FOOT4"><sup>4</sup></a>  This exception applies only to the
interrupted frame: any frame farther down the stack will be fine.
</p>
<p>The value of a variable may be unavailable for these reasons:
</p>
<ul>
<li> The value of the <code>debug</code> optimization quality may have omitted debug
information needed to determine whether the variable is available.
Unless a variable is an argument, its value will only be available when
<code>debug</code> is at least <code>2</code>.

</li><li> The compiler did lifetime analysis and determined that the value was no longer
needed, even though its scope had not been exited.  Lifetime analysis is
inhibited when the <code>debug</code> optimization quality is <code>3</code>.

</li><li> The variable&rsquo;s name is an uninterned symbol (gensym).  To save space, the
compiler only dumps debug information about uninterned variables when the
<code>debug</code> optimization quality is <code>3</code>.

</li><li> The frame&rsquo;s location is unknown (see <a href="#Unknown-Locations-and-Interrupts">Unknown Locations and Interrupts</a>) because the debugger was entered due to an interrupt or
unexpected hardware error.  Under these conditions the values of
arguments will be available, but might be incorrect.  This is the
exception mentioned above.

</li><li> The variable (or the code referencing it) was optimized out
of existence.  Variables with no reads are always optimized away.  The
degree to which the compiler deletes variables will depend on the
value of the <code>compilation-speed</code> optimization quality, but most
source-level optimizations are done under all compilation policies.

</li><li> The variable is never set and its definition looks like
<div class="lisp">
<pre class="lisp">(LET ((var1 var2))
   ...)
</pre></div>
<p>In this case, <code>var1</code> is substituted with <code>var2</code>.
</p>
</li><li> The variable is never set and is referenced exactly once.  In this
case, the reference is substituted with the variable initial value.

</li></ul>

<p>Since it is especially useful to be able to get the arguments to a
function, argument variables are treated specially when the
<code>speed</code> optimization quality is less than <code>3</code> and the
<code>debug</code> quality is at least <code>1</code>.  With this compilation
policy, the values of argument variables are almost always available
everywhere in the function, even at unknown locations.  For
non-argument variables, <code>debug</code> must be at least <code>2</code> for
values to be available, and even then, values are only available at
known locations.
</p>

<hr>
<a name="Note-On-Lexical-Variable-Access"></a>
<div class="header">
<p>
Previous: <a href="#Variable-Value-Availability" accesskey="p" rel="prev">Variable Value Availability</a>, Up: <a href="#Variable-Access" accesskey="u" rel="up">Variable Access</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Note-On-Lexical-Variable-Access-1"></a>
<h4 class="subsection">5.4.2 Note On Lexical Variable Access</h4>

<p>When the debugger command loop establishes variable bindings for
available variables, these variable bindings have lexical scope and
dynamic extent.<a name="DOCF5" href="#FOOT5"><sup>5</sup></a>  You can close
over them, but such closures can&rsquo;t be used as upward function arguments.
</p>
<p>You can also set local variables using <code>setq</code>, but if the
variable was closed over in the original source and never set, then
setting the variable in the debugger may not change the value in all
the functions the variable is defined in.  Another risk of setting
variables is that you may assign a value of a type that the compiler
proved the variable could never take on.  This may result in bad
things happening.
</p>

<hr>
<a name="Source-Location-Printing"></a>
<div class="header">
<p>
Next: <a href="#Debugger-Policy-Control" accesskey="n" rel="next">Debugger Policy Control</a>, Previous: <a href="#Variable-Access" accesskey="p" rel="prev">Variable Access</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Source-Location-Printing-1"></a>
<h3 class="section">5.5 Source Location Printing</h3>
<a name="index-Source-location-printing_002c-debugger"></a>

<p>One of the debugger&rsquo;s capabilities is source level debugging of
compiled code.  These commands display the source location for the
current frame:
</p>
<dl>
<dt><a name="index-source"></a>Debugger Command: <strong>source</strong> <em>[<var>context</var>]</em></dt>
<dd><p>This command displays the file that the current frame&rsquo;s function was
defined from (if it was defined from a file), and then the source form
responsible for generating the code that the current frame was
executing.  If <var>context</var> is specified, then it is an integer
specifying the number of enclosing levels of list structure to print.
</p></dd></dl>

<p>The source form for a location in the code is the innermost list present
in the original source that encloses the form responsible for generating
that code.  If the actual source form is not a list, then some enclosing
list will be printed.  For example, if the source form was a reference
to the variable <code>*some-random-special*</code>, then the innermost
enclosing evaluated form will be printed.  Here are some possible
enclosing forms:
</p>
<div class="lisp">
<pre class="lisp">(let ((a *some-random-special*))
  ...)

(+ *some-random-special* ...)
</pre></div>

<p>If the code at a location was generated from the expansion of a macro
or a source-level compiler optimization, then the form in the original
source that expanded into that code will be printed.  Suppose the file
<samp>/usr/me/mystuff.lisp</samp> looked like this:
</p>
<div class="lisp">
<pre class="lisp">(defmacro mymac ()
  '(myfun))

(defun foo ()
  (mymac)
  ...)
</pre></div>

<p>If <code>foo</code> has called <code>myfun</code>, and is waiting for it to
return, then the <code>source</code> command would print:
</p>
<div class="example">
<pre class="example">; File: /usr/me/mystuff.lisp

(MYMAC)
</pre></div>

<p>Note that the macro use was printed, not the actual function call form,
<code>(myfun)</code>.
</p>
<p>If enclosing source is printed by giving an argument to
<code>source</code> or <code>vsource</code>, then the actual source form is
marked by wrapping it in a list whose first element is
&lsquo;<samp>#:***HERE***</samp>&rsquo;.  In the previous example, <code>source 1</code> would
print:
</p>
<div class="example">
<pre class="example">; File: /usr/me/mystuff.lisp

(DEFUN FOO ()
  (#:***HERE***
   (MYMAC))
  ...)
</pre></div>


<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#How-the-Source-is-Found" accesskey="1">How the Source is Found</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Source-Location-Availability" accesskey="2">Source Location Availability</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="How-the-Source-is-Found"></a>
<div class="header">
<p>
Next: <a href="#Source-Location-Availability" accesskey="n" rel="next">Source Location Availability</a>, Up: <a href="#Source-Location-Printing" accesskey="u" rel="up">Source Location Printing</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="How-the-Source-is-Found-1"></a>
<h4 class="subsection">5.5.1 How the Source is Found</h4>

<p>If the code was defined from Lisp by <code>compile</code> or
<code>eval</code>, then the source can always be reliably located.  If the
code was defined from a <samp>fasl</samp> file created by
<code>compile-file</code>, then the debugger gets the source forms it
prints by reading them from the original source file.  This is a
potential problem, since the source file might have moved or changed
since the time it was compiled.
</p>
<p>The source file is opened using the <code>truename</code> of the source file
pathname originally given to the compiler.  This is an absolute pathname
with all logical names and symbolic links expanded.  If the file can&rsquo;t
be located using this name, then the debugger gives up and signals an
error.
</p>
<p>If the source file can be found, but has been modified since the time it was
compiled, the debugger prints this warning:
</p>
<div class="example">
<pre class="example">; File has been modified since compilation:
;   <var>filename</var>
; Using form offset instead of character position.
</pre></div>

<p>where <var>filename</var> is the name of the source file.  It then proceeds
using a robust but not foolproof heuristic for locating the source.
This heuristic works if:
</p>
<ul>
<li> No top-level forms before the top-level form containing the source
have been added or deleted, and

</li><li> The top-level form containing the source has not been modified much.
(More precisely, none of the list forms beginning before the source
form have been added or deleted.)

</li></ul>

<p>If the heuristic doesn&rsquo;t work, the displayed source will be wrong, but will
probably be near the actual source.  If the &ldquo;shape&rdquo; of the top-level form in
the source file is too different from the original form, then an error will be
signaled.  When the heuristic is used, the source location commands are
noticeably slowed.
</p>
<p>Source location printing can also be confused if (after the source was
compiled) a read-macro you used in the code was redefined to expand
into something different, or if a read-macro ever returns the same
<code>eq</code> list twice.  If you don&rsquo;t define read macros and don&rsquo;t use
<code>##</code> in perverted ways, you don&rsquo;t need to worry about this.
</p>

<hr>
<a name="Source-Location-Availability"></a>
<div class="header">
<p>
Previous: <a href="#How-the-Source-is-Found" accesskey="p" rel="prev">How the Source is Found</a>, Up: <a href="#Source-Location-Printing" accesskey="u" rel="up">Source Location Printing</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Source-Location-Availability-1"></a>
<h4 class="subsection">5.5.2 Source Location Availability</h4>
<a name="index-Debug-optimization-quality-1"></a>
<a name="index-Block_002c-basic"></a>
<a name="index-Block_002c-start-location"></a>

<p>Source location information is only available when the <code>debug</code>
optimization quality is at least <code>2</code>.  If source location
information is unavailable, the source commands will give an error
message.
</p>
<p>If source location information is available, but the source location
is unknown because of an interrupt or unexpected hardware error
(see <a href="#Unknown-Locations-and-Interrupts">Unknown Locations and Interrupts</a>), then the command will
print:
</p>
<div class="example">
<pre class="example">Unknown location: using block start.
</pre></div>

<p>and then proceed to print the source location for the start of the
<em>basic block</em> enclosing the code location.  It&rsquo;s a bit
complicated to explain exactly what a basic block is, but here are
some properties of the block start location:
</p>
<ul>
<li> The block start location may be the same as the true location.

</li><li> The block start location will never be later in the
program&rsquo;s flow of control than the true location.

</li><li> No conditional control structures (such as <code>if</code>,
<code>cond</code>, <code>or</code>) will intervene between the block start and the
true location (but note that some conditionals present in the original
source could be optimized away.)  Function calls <em>do not</em> end
basic blocks.

</li><li> The head of a loop will be the start of a block.

</li><li> The programming language concept of &ldquo;block structure&rdquo; and the
Lisp <code>block</code> special form are totally unrelated to the compiler&rsquo;s
basic block.

</li></ul>

<p>In other words, the true location lies between the printed location and the
next conditional (but watch out because the compiler may have changed the
program on you.)
</p>

<hr>
<a name="Debugger-Policy-Control"></a>
<div class="header">
<p>
Next: <a href="#Exiting-Commands" accesskey="n" rel="next">Exiting Commands</a>, Previous: <a href="#Source-Location-Printing" accesskey="p" rel="prev">Source Location Printing</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Debugger-Policy-Control-1"></a>
<h3 class="section">5.6 Debugger Policy Control</h3>
<a name="index-Policy_002c-debugger"></a>
<a name="index-Debug-optimization-quality-2"></a>
<a name="index-Optimize-declaration"></a>
<a name="index-Inline-expansion-1"></a>
<a name="index-Semi_002dinline-expansion"></a>

<p>The compilation policy specified by <code>optimize</code> declarations
affects the behavior seen in the debugger.  The <code>debug</code> quality
directly affects the debugger by controlling the amount of debugger
information dumped.  Other optimization qualities have indirect but
observable effects due to changes in the way compilation is done.
</p>
<p>Unlike the other optimization qualities (which are compared in relative value
to evaluate tradeoffs), the <code>debug</code> optimization quality is directly
translated to a level of debug information.  This absolute interpretation
allows the user to count on a particular amount of debug information being
available even when the values of the other qualities are changed during
compilation.  These are the levels of debug information that correspond to the
values of the <code>debug</code> quality:
</p>
<dl compact="compact">
<dt><code>0</code></dt>
<dd><p>Only the function name and enough information to allow the stack to
be parsed.
</p>
</dd>
<dt><code>&gt; 0</code></dt>
<dd><p>Any level greater than <code>0</code> gives level <code>0</code> plus all argument
variables.  Values will only be accessible if the argument variable is
never set and <code>speed</code> is not <code>3</code>.  SBCL allows any real
value for optimization qualities.  It may be useful to specify
<code>0.5</code> to get backtrace argument display without argument
documentation.
</p>
</dd>
<dt><code>1</code></dt>
<dd><p>Level <code>1</code> provides argument documentation (printed argument lists) and
derived argument/result type information.  This makes <code>describe</code>
more informative, and allows the compiler to do compile-time argument
count and type checking for any calls compiled at run-time.  This is
the default.
</p>
</dd>
<dt><code>2</code></dt>
<dd><p>Level <code>1</code> plus all interned local variables, source location
information, and lifetime information that tells the debugger when
arguments are available (even when <code>speed</code> is <code>3</code> or the
argument is set).
</p>
</dd>
<dt><code>&gt; 2</code></dt>
<dd><p>Any level greater than <code>2</code> gives level <code>2</code> and in addition
disables tail-call optimization, so that the backtrace will contain
frames for all invoked functions, even those in tail positions.
</p>
</dd>
<dt><code>3</code></dt>
<dd><p>Level <code>2</code> plus all uninterned variables.  In addition, lifetime
analysis is disabled (even when <code>speed</code> is <code>3</code>), ensuring
that all variable values are available at any known location within
the scope of the binding.  This has a speed penalty in addition to the
obvious space penalty.
</p>
</dd>
<dt><code>&gt; (max speed space)</code></dt>
<dd><p>If <code>debug</code> is greater than both <code>speed</code> and <code>space</code>,
the command <code>return</code> can be used to continue execution by
returning a value from the current stack frame.
</p>
</dd>
<dt><code>&gt; (max speed space compilation-speed)</code></dt>
<dd><p>If <code>debug</code> is greater than all of <code>speed</code>, <code>space</code> and
<code>compilation-speed</code> the code will be steppable (see <a href="#Single-Stepping">Single Stepping</a>).
</p>
</dd>
</dl>

<p>As you can see, if the <code>speed</code> quality is <code>3</code>, debugger performance is
degraded.  This effect comes from the elimination of argument variable
special-casing (see <a href="#Variable-Value-Availability">Variable Value Availability</a>).  Some degree of
speed/debuggability tradeoff is unavoidable, but the effect is not too drastic
when <code>debug</code> is at least <code>2</code>.
</p>
<p>In addition to <code>inline</code> and <code>notinline</code> declarations, the
relative values of the <code>speed</code> and <code>space</code> qualities also
change whether functions are inline expanded.
If a function is inline expanded, then
there will be no frame to represent the call, and the arguments will
be treated like any other local variable.  Functions may also be
&ldquo;semi-inline&rdquo;, in which case there is a frame to represent the call,
but the call is to an optimized local version of the function, not to
the original function.
</p>

<hr>
<a name="Exiting-Commands"></a>
<div class="header">
<p>
Next: <a href="#Information-Commands" accesskey="n" rel="next">Information Commands</a>, Previous: <a href="#Debugger-Policy-Control" accesskey="p" rel="prev">Debugger Policy Control</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Exiting-Commands-1"></a>
<h3 class="section">5.7 Exiting Commands</h3>

<p>These commands get you out of the debugger.
</p>
<dl>
<dt><a name="index-toplevel"></a>Debugger Command: <strong>toplevel</strong></dt>
<dd><p>Throw to top level.
</p></dd></dl>

<dl>
<dt><a name="index-restart"></a>Debugger Command: <strong>restart</strong> <em>[<var>n</var>]</em></dt>
<dd><p>Invokes the <var>n</var>th restart case as displayed by the <code>error</code>
command.  If <var>n</var> is not specified, the available restart cases are
reported.
</p></dd></dl>

<dl>
<dt><a name="index-continue"></a>Debugger Command: <strong>continue</strong></dt>
<dd><p>Calls <code>continue</code> on the condition given to <code>debug</code>.  If there is no
restart case named <var>continue</var>, then an error is signaled.
</p></dd></dl>

<dl>
<dt><a name="index-abort"></a>Debugger Command: <strong>abort</strong></dt>
<dd><p>Calls <code>abort</code> on the condition given to <code>debug</code>.  This is
useful for popping debug command loop levels or aborting to top level,
as the case may be.
</p></dd></dl>

<dl>
<dt><a name="index-return"></a>Debugger Command: <strong>return</strong> <em><var>value</var></em></dt>
<dd><p>Returns <var>value</var> from the current stack frame.  This command is
available when the <code>debug</code> optimization quality is greater than
both <code>speed</code> and <code>space</code>.  Care must be taken that the value
is of the same type as SBCL expects the stack frame to return.
</p></dd></dl>

<dl>
<dt><a name="index-restart_002dframe"></a>Debugger Command: <strong>restart-frame</strong></dt>
<dd><p>Restarts execution of the current stack frame. This command is
available when the <code>debug</code> optimization quality is greater than
both <code>speed</code> and <code>space</code> and when the frame is for is a global
function. If the function is redefined in the debugger before the frame
is restarted, the new function will be used.
</p></dd></dl>

<hr>
<a name="Information-Commands"></a>
<div class="header">
<p>
Next: <a href="#Function-Tracing" accesskey="n" rel="next">Function Tracing</a>, Previous: <a href="#Exiting-Commands" accesskey="p" rel="prev">Exiting Commands</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Information-Commands-1"></a>
<h3 class="section">5.8 Information Commands</h3>

<p>Most of these commands print information about the current frame or
function, but a few show general information.
</p>
<dl>
<dt><a name="index-help"></a>Debugger Command: <strong>help</strong></dt>
<dt><a name="index-_003f"></a>Debugger Command: <strong>?</strong></dt>
<dd><p>Displays a synopsis of debugger commands.
</p></dd></dl>

<dl>
<dt><a name="index-describe"></a>Debugger Command: <strong>describe</strong></dt>
<dd><p>Calls <code>describe</code> on the current function and displays the number of
local variables.
</p></dd></dl>

<dl>
<dt><a name="index-print"></a>Debugger Command: <strong>print</strong></dt>
<dd><p>Displays the current function call as it would be displayed by moving to
this frame.
</p></dd></dl>

<dl>
<dt><a name="index-error"></a>Debugger Command: <strong>error</strong></dt>
<dd><p>Prints the condition given to <code>invoke-debugger</code> and the active
proceed cases.
</p></dd></dl>

<dl>
<dt><a name="index-backtrace"></a>Debugger Command: <strong>backtrace</strong> <em>[<var>n</var>]</em></dt>
<dd><p>Displays all the frames from the current to the bottom. Only shows
<var>n</var> frames if specified. The printing is controlled by
<code>*debug-print-variable-alist*</code>.
</p></dd></dl>

































<hr>
<a name="Function-Tracing"></a>
<div class="header">
<p>
Next: <a href="#Single-Stepping" accesskey="n" rel="next">Single Stepping</a>, Previous: <a href="#Information-Commands" accesskey="p" rel="prev">Information Commands</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Function-Tracing-1"></a>
<h3 class="section">5.9 Function Tracing</h3>
<a name="index-Tracing"></a>
<a name="index-Function_002c-tracing"></a>

<p>The tracer causes selected functions to print their arguments and
their results whenever they are called.  Options allow conditional
printing of the trace information and conditional breakpoints on
function entry or exit.
</p>
<a name="Macro-common_002dlisp_003atrace"></a><dl>
<dt><a name="index-trace"></a>Macro: <strong>trace</strong> <em>[cl] &amp;rest specs</em></dt>
<dd><p><code>trace</code> {Option Global-Value}* {Name {Option Value}*}*
</p>
<p><code>trace</code> is a debugging tool that provides information when specified
functions are called. In its simplest form:
</p>
<div class="lisp">
<pre class="lisp">       (TRACE NAME-1 NAME-2 ...)
</pre></div>

<p>The NAMEs are not evaluated. Each may be a symbol, denoting an
individual function, or a string, denoting all functions fbound to
symbols whose home package is the package with the given name.
</p>
<p>Options allow modification of the default behavior. Each option is a
pair of an option keyword and a value form. Global options are
specified before the first name, and affect all functions traced by a
given use of <code>trace</code>. Options may also be interspersed with function
names, in which case they act as local options, only affecting tracing
of the immediately preceding function name. Local options override
global options.
</p>
<p>By default, <code>trace</code> causes a printout on <code>*trace-output*</code> each time that
one of the named functions is entered or returns. (This is the basic,
<code>ansi</code> Common Lisp behavior of <code>trace</code>.)
</p>
<p>The following options are defined:
</p>

<dl compact="compact">
<dt><em><code>:report</code> Report-Type</em></dt>
<dd><p>If Report-Type is <code>trace</code> (the default) then information is
       reported by printing immediately. If Report-Type is <code>nil</code>, then
       the only effect of the trace is to execute other
       options (e.g. <code>print</code> or BREAK).
</p>

</dd>
<dt><em><code>:condition</code> Form</em></dt>
<dt><em><code>:condition-after</code> Form</em></dt>
<dt><em><code>:condition-all</code> Form</em></dt>
<dd><p>If <code>:condition</code> is specified, then <code>trace</code> does nothing unless Form
       evaluates to true at the time of the call. <code>:condition-after</code> is
       similar, but suppresses the initial printout, and is tested when the
       function returns. <code>:condition-all</code> tries both before and after.
</p>

</dd>
<dt><em><code>:break</code> Form</em></dt>
<dt><em><code>:break-after</code> Form</em></dt>
<dt><em><code>:break-all</code> Form</em></dt>
<dd><p>If specified, and Form evaluates to true, then the debugger is invoked
       at the start of the function, at the end of the function, or both,
       according to the respective option.
</p>

</dd>
<dt><em><code>:print</code> Form</em></dt>
<dt><em><code>:print-after</code> Form</em></dt>
<dt><em><code>:print-all</code> Form</em></dt>
<dd><p>In addition to the usual printout, the result of evaluating Form is
       printed at the start of the function, at the end of the function, or
       both, according to the respective option. Multiple print options cause
       multiple values to be printed.
</p>

</dd>
<dt><em><code>:wherein</code> Names</em></dt>
<dd><p>If specified, Names is a function name or list of names. <code>trace</code> does
       nothing unless a call to one of those functions encloses the call to
       this function (i.e. it would appear in a backtrace.)  Anonymous
       functions have string names like &quot;DEFUN FOO&quot;.
</p>

</dd>
<dt><em><code>:encapsulate</code> {:DEFAULT | <code>t</code> | NIL}</em></dt>
<dd><p>If <code>t</code>, the tracing is done via encapsulation (redefining the function
       name) rather than by modifying the function. <code>:default</code> is the default,
       and means to use encapsulation for interpreted functions and funcallable
       instances, breakpoints otherwise. When encapsulation is used, forms are
       *not* evaluated in the function&rsquo;s lexical environment, but <code>sb-debug:arg</code>
       can still be used.
</p>

</dd>
<dt><em><code>:methods</code> {T | NIL}</em></dt>
<dd><p>If <code>t</code>, any function argument naming a generic function will have its
       methods traced in addition to the generic function itself.
</p>

</dd>
<dt><em><code>:function</code> Function-Form</em></dt>
<dd><p>This is a not really an option, but rather another way of specifying
       what function to trace. The Function-Form is evaluated immediately,
       and the resulting function is traced.
</p>
</dd>
</dl>

<p><code>:condition</code>, <code>:break</code> and <code>:print</code> forms are evaluated in a context which
mocks up the lexical environment of the called function, so that
<code>sb-debug:var</code> and <code>sb-debug:arg</code> can be used.
The <code>-after</code> and <code>-all</code> forms can use <code>sb-debug:arg</code>.
</p></dd></dl>

<a name="Macro-common_002dlisp_003auntrace"></a><dl>
<dt><a name="index-untrace"></a>Macro: <strong>untrace</strong> <em>[cl] &amp;rest specs</em></dt>
<dd><p>Remove tracing from the specified functions. Untraces all
functions when called with no arguments.
</p></dd></dl>

<a name="Variable-sb_002ddebug_003a_002atrace_002dindentation_002dstep_002a"></a><dl>
<dt><a name="index-_002atrace_002dindentation_002dstep_002a"></a>Variable: <strong>*trace-indentation-step*</strong> <em>[sb-debug]</em></dt>
<dd><p>the increase in trace indentation at each call level
</p></dd></dl>

<a name="Variable-sb_002ddebug_003a_002amax_002dtrace_002dindentation_002a"></a><dl>
<dt><a name="index-_002amax_002dtrace_002dindentation_002a"></a>Variable: <strong>*max-trace-indentation*</strong> <em>[sb-debug]</em></dt>
<dd><p>If the trace indentation exceeds this value, then indentation restarts at
   0.
</p></dd></dl>

<a name="Variable-sb_002ddebug_003a_002atrace_002dencapsulate_002ddefault_002a"></a><dl>
<dt><a name="index-_002atrace_002dencapsulate_002ddefault_002a"></a>Variable: <strong>*trace-encapsulate-default*</strong> <em>[sb-debug]</em></dt>
<dd><p>the default value for the <code>:encapsulate</code> option to <code>trace</code>
</p></dd></dl>


<hr>
<a name="Single-Stepping"></a>
<div class="header">
<p>
Next: <a href="#Enabling-and-Disabling-the-Debugger" accesskey="n" rel="next">Enabling and Disabling the Debugger</a>, Previous: <a href="#Function-Tracing" accesskey="p" rel="prev">Function Tracing</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Single-Stepping-1"></a>
<h3 class="section">5.10 Single Stepping</h3>
<a name="index-Stepper"></a>
<a name="index-Single-Stepping"></a>

<p>SBCL includes an instrumentation based single-stepper for compiled
code, that can be invoked via the <code>step</code> macro, or from within
the debugger. See <a href="#Debugger-Policy-Control">Debugger Policy Control</a>, for details on enabling
stepping for compiled code.
</p>
<p>The following debugger commands are used for controlling single stepping.
</p>
<dl>
<dt><a name="index-start"></a>Debugger Command: <strong>start</strong></dt>
<dd><p>Selects the <code>continue</code> restart if one exists and starts single stepping.
None of the other single stepping commands can be used before stepping has
been started either by using <code>start</code> or by using the standard
<code>step</code> macro.
</p></dd></dl>

<dl>
<dt><a name="index-step"></a>Debugger Command: <strong>step</strong></dt>
<dd><p>Steps into the current form. Stepping will be resumed when the next
form that has been compiled with stepper instrumentation is evaluated.
</p></dd></dl>

<dl>
<dt><a name="index-next"></a>Debugger Command: <strong>next</strong></dt>
<dd><p>Steps over the current form. Stepping will be disabled until evaluation of
the form is complete.
</p></dd></dl>

<dl>
<dt><a name="index-out"></a>Debugger Command: <strong>out</strong></dt>
<dd><p>Steps out of the current frame. Stepping will be disabled until the
topmost stack frame that had been stepped into returns.
</p></dd></dl>

<dl>
<dt><a name="index-stop"></a>Debugger Command: <strong>stop</strong></dt>
<dd><p>Stops the single stepper and resumes normal execution.
</p></dd></dl>

<a name="Macro-common_002dlisp_003astep"></a><dl>
<dt><a name="index-step-1"></a>Macro: <strong>step</strong> <em>[cl] form</em></dt>
<dd><p>The form is evaluated with single stepping enabled. Function calls
outside the lexical scope of the form can be stepped into only if the
functions in question have been compiled with sufficient <code>debug</code> policy
to be at least partially steppable.
</p></dd></dl>

<hr>
<a name="Enabling-and-Disabling-the-Debugger"></a>
<div class="header">
<p>
Previous: <a href="#Single-Stepping" accesskey="p" rel="prev">Single Stepping</a>, Up: <a href="#Debugger" accesskey="u" rel="up">Debugger</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Enabling-and-Disabling-the-Debugger-1"></a>
<h3 class="section">5.11 Enabling and Disabling the Debugger</h3>

<a name="index-debugger_002c-enabling"></a>
<a name="index-debugger_002c-disabling"></a>
<a name="index-disabling-debugger"></a>
<a name="index-ldb_002c-enabling"></a>
<a name="index-ldb_002c-disabling-1"></a>
<a name="index-disabling-ldb-1"></a>

<p>In certain contexts (e.g., non-interactive applications), it may be
desirable to turn off the SBCL debugger (and possibly re-enable it).
The functions here control the debugger.
</p>
<a name="Function-sb_002dext_003adisable_002ddebugger"></a><dl>
<dt><a name="index-disable_002ddebugger"></a>Function: <strong>disable-debugger</strong> <em>[sb-ext]</em></dt>
<dd><p>When invoked, this function will turn off both the <code>sbcl</code> debugger
and <code>ldb</code> (the low-level debugger).  See also <code>enable-debugger</code>.
</p></dd></dl>

<a name="Function-sb_002dext_003aenable_002ddebugger"></a><dl>
<dt><a name="index-enable_002ddebugger"></a>Function: <strong>enable-debugger</strong> <em>[sb-ext]</em></dt>
<dd><p>Restore the debugger if it has been turned off by <code>disable-debugger</code>.
</p></dd></dl>
<hr>
<a name="Efficiency"></a>
<div class="header">
<p>
Next: <a href="#Beyond-the-ANSI-Standard" accesskey="n" rel="next">Beyond the ANSI Standard</a>, Previous: <a href="#Debugger" accesskey="p" rel="prev">Debugger</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Efficiency-1"></a>
<h2 class="chapter">6 Efficiency</h2>
<a name="index-Efficiency"></a>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Slot-access" accesskey="1">Slot access</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Dynamic_002dextent-allocation" accesskey="2">Dynamic-extent allocation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Modular-arithmetic" accesskey="3">Modular arithmetic</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Global-and-Always_002dBound-variables" accesskey="4">Global and Always-Bound variables</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Miscellaneous-Efficiency-Issues" accesskey="5">Miscellaneous Efficiency Issues</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Slot-access"></a>
<div class="header">
<p>
Next: <a href="#Dynamic_002dextent-allocation" accesskey="n" rel="next">Dynamic-extent allocation</a>, Up: <a href="#Efficiency" accesskey="u" rel="up">Efficiency</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Slot-access-1"></a>
<h3 class="section">6.1 Slot access</h3>
<a name="index-Slot-access"></a>

<a name="Structure-object-slot-access"></a>
<h4 class="subsection">6.1.1 Structure object slot access</h4>

<p>Structure slot accessors are efficient only if the compiler is able to
open code them: compiling a call to a structure slot accessor before
the structure is defined, declaring one <code>notinline</code>, or passing
it as a functional argument to another function causes severe
performance degradation.
</p>
<a name="Standard-object-slot-access"></a>
<h4 class="subsection">6.1.2 Standard object slot access</h4>

<p>The most efficient way to access a slot of a <code>standard-object</code> is
by using <code>slot-value</code> with a constant slot name argument inside a
<code>defmethod</code> body, where the variable holding the instance is a
specializer parameter of the method and is never assigned to. The cost
is roughly 1.6 times that of an open coded structure slot accessor.
</p>
<p>Second most efficient way is to use a CLOS slot accessor, or
<code>slot-value</code> with a constant slot name argument, but in
circumstances other than specified above. This may be up to 3 times as
slow as the method described above.
</p>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">(defclass foo () ((bar)))

;; Fast: specializer and never assigned to
(defmethod quux ((foo foo) new)
  (let ((old (slot-value foo 'bar)))
    (setf (slot-value foo 'bar) new)
    old))

;; Slow: not a specializer
(defmethod quux ((foo foo) new)
  (let* ((temp foo)
         (old (slot-value temp 'bar)))
    (setf (slot-value temp 'bar) new)
    old))

;; Slow: assignment to FOO
(defmethod quux ((foo foo) new)
  (let ((old (slot-value foo 'bar)))
    (setf (slot-value foo 'bar) new)
    (setf foo new)
    old))
</pre></div>

<p>Note that when profiling code such as this, the first few calls to the
generic function are not representative, as the dispatch mechanism is
lazily set up during those calls.
</p>
<hr>
<a name="Dynamic_002dextent-allocation"></a>
<div class="header">
<p>
Next: <a href="#Modular-arithmetic" accesskey="n" rel="next">Modular arithmetic</a>, Previous: <a href="#Slot-access" accesskey="p" rel="prev">Slot access</a>, Up: <a href="#Efficiency" accesskey="u" rel="up">Efficiency</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Dynamic_002dextent-allocation-1"></a>
<h3 class="section">6.2 Dynamic-extent allocation</h3>
<a name="index-dynamic_002dextent-declaration"></a>
<a name="index-declaration_002c-dynamic_002dextent"></a>

<p>SBCL has fairly extensive support for performing allocation on the
stack when a variable is declared <code>dynamic-extent</code>. The
<code>dynamic-extent</code> declarations are not verified, but are simply
trusted as long as <code>sb-ext:*stack-allocate-dynamic-extent*</code> is
true.
</p>
<a name="Variable-sb_002dext_003a_002astack_002dallocate_002ddynamic_002dextent_002a"></a><dl>
<dt><a name="index-_002astack_002dallocate_002ddynamic_002dextent_002a"></a>Variable: <strong>*stack-allocate-dynamic-extent*</strong> <em>[sb-ext]</em></dt>
<dd><p>If true (the default), the compiler respects <code>dynamic-extent</code> declarations
and stack allocates otherwise inaccessible parts of the object whenever
possible. Potentially long (over one page in size) vectors are, however, not
stack allocated except in zero <code>safety</code> code, as such a vector could overflow
the stack without triggering overflow protection.
</p></dd></dl>

<p>If dynamic extent constraints specified in the Common Lisp standard
are violated, the best that can happen is for the program to have
garbage in variables and return values; more commonly, the system will
crash.
</p>
<p>In particular, it is important to realize that dynamic extend is
contagious:
</p>
<div class="lisp">
<pre class="lisp">(let* ((a (list 1 2 3))
       (b (cons a a)))
   (declare (dynamic-extent b))
   ;; Unless A is accessed elsewhere as well, SBCL will consider
   ;; it to be otherwise inaccessible -- it can only be accessed
   ;; through B, after all -- and stack allocate it as well.
   ;;
   ;; Hence returning (CAR B) here is unsafe.
   ...)
</pre></div>

<p>This allows stack allocation of complex structures. As a notable
exception to this, SBCL does not as of 1.0.48.21 propagate
dynamic-extentness through <code>&amp;rest</code> arguments &ndash; but another
conforming implementation might, so portable code should not rely on
this.
</p>
<div class="lisp">
<pre class="lisp">(declaim (inline foo))
(defun foo (fun &amp;rest arguments)
  (declare (dynamic-extent arguments))
  (apply fun arguments))

(defun bar (a)
  ;; SBCL will heap allocate the result of (LIST A), and stack allocate
  ;; only the spine of the &amp;rest list -- so this is safe, but unportable.
  ;;
  ;; Another implementation, including earlier versions of SBCL might consider
  ;; (LIST A) to be otherwise inaccessible and stack-allocate it as well!
  (foo #'car (list a)))
</pre></div>

<p>There are many cases when <code>dynamic-extent</code> declarations could be
useful. At present, SBCL implements stack allocation for
</p>
<ul>
<li> <code>&amp;rest</code> lists, when these are declared <code>dynamic-extent</code>.

</li><li> <a name="index-cons-_005bcl_005d"></a>
<a name="index-list-_005bcl_005d"></a>
<a name="index-list_002a-_005bcl_005d"></a>
<a name="index-vector-_005bcl_005d"></a>
<code>cons</code>, <code>list</code>, <code>list*</code>, and <code>vector</code> when the
result is bound to a variable declared <code>dynamic-extent</code>.

</li><li> <a name="index-make_002darray-_005bcl_005d"></a>
simple forms of <code>make-array</code>, whose result is bound to a variable
declared <code>dynamic-extent</code>: stack allocation is possible only if
the resulting array is known to be both simple and one-dimensional,
and has a constant <code>:element-type</code>.

<a name="index-Safety-optimization-quality-1"></a>
<p><strong>Note</strong>: stack space is limited, so allocation of a large vector
may cause stack overflow. For this reason potentially large vectors,
which might circumvent stack overflow detection, are stack allocated
only in zero <code>safety</code> policies.
</p>
</li><li> <a name="index-flet-_005bcl_005d"></a>
<a name="index-labels-_005bcl_005d"></a>
<a name="index-safety-optimization-quality"></a>
<a name="index-optimization-quality_002c-safety"></a>
closures defined with <code>flet</code> or <code>labels</code>, with a bound
<code>dynamic-extent</code> declaration. Blocks and tags are also allocated
on the heap, unless all non-local control transfers to them are
compiled with zero <code>safety</code>.

</li><li> user-defined structures when the structure constructor defined using
<code>defstruct</code> has been declared <code>inline</code> and the result of the
call to the constructor is bound to a variable declared
<code>dynamic-extent</code>.

<p><strong>Note</strong>: structures with &ldquo;raw&rdquo; slots can currently be
stack-allocated only on x86 and x86-64.
</p>
</li><li> all of the above when they appear as initial parts of another
stack-allocated object.

</li></ul>

<p>Examples:
</p>
<div class="lisp">
<pre class="lisp">;;; Declaiming a structure constructor inline before definition makes
;;; stack allocation possible.
(declaim (inline make-thing))
(defstruct thing obj next)

;;; Stack allocation of various objects bound to DYNAMIC-EXTENT
;;; variables.
(let* ((list (list 1 2 3))
       (nested (cons (list 1 2) (list* 3 4 (list 5))))
       (vector (make-array 3 :element-type 'single-float))
       (thing (make-thing :obj list
                          :next (make-thing :obj (make-array 3)))))
  (declare (dynamic-extent list nested vector thing))
  ...)

;;; Stack allocation of arguments to a local function is equivalent
;;; to stack allocation of local variable values.
(flet ((f (x)
         (declare (dynamic-extent x))
         ...))
  ...
  (f (list 1 2 3))
  (f (cons (cons 1 2) (cons 3 4)))
  ...)

;;; Stack allocation of &amp;REST lists
(defun foo (&amp;rest args)
  (declare (dynamic-extent args))
  ...)
</pre></div>

<p>Future plans include
</p>
<ul>
<li> Automatic detection of the common idiom of calling quantifiers with a
closure, even when the closure is not declared <code>dynamic-extent</code>.

</li></ul>

<hr>
<a name="Modular-arithmetic"></a>
<div class="header">
<p>
Next: <a href="#Global-and-Always_002dBound-variables" accesskey="n" rel="next">Global and Always-Bound variables</a>, Previous: <a href="#Dynamic_002dextent-allocation" accesskey="p" rel="prev">Dynamic-extent allocation</a>, Up: <a href="#Efficiency" accesskey="u" rel="up">Efficiency</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Modular-arithmetic-1"></a>
<h3 class="section">6.3 Modular arithmetic</h3>
<a name="index-Modular-arithmetic"></a>
<a name="index-Arithmetic_002c-modular"></a>
<a name="index-Arithmetic_002c-hardware"></a>
<a name="index-logand-_005bcl_005d"></a>
<p>Some numeric functions have a property: <var>N</var> lower bits of the
result depend only on <var>N</var> lower bits of (all or some)
arguments. If the compiler sees an expression of form <code>(logand
<var>exp</var> <var>mask</var>)</code>, where <var>exp</var> is a tree of such &ldquo;good&rdquo;
functions and <var>mask</var> is known to be of type <code>(unsigned-byte
<var>w</var>)</code>, where <var>w</var> is a &ldquo;good&rdquo; width, all intermediate results
will be cut to <var>w</var> bits (but it is not done for variables and
constants!). This often results in an ability to use simple machine
instructions for the functions.
</p>
<p>Consider an example.
</p>
<div class="lisp">
<pre class="lisp">(defun i (x y)
  (declare (type (unsigned-byte 32) x y))
  (ldb (byte 32 0) (logxor x (lognot y))))
</pre></div>

<p>The result of <code>(lognot y)</code> will be negative and of type
<code>(signed-byte 33)</code>, so a naive implementation on a 32-bit
platform is unable to use 32-bit arithmetic here. But modular
arithmetic optimizer is able to do it: because the result is cut down
to 32 bits, the compiler will replace <code>logxor</code> and <code>lognot</code>
with versions cutting results to 32 bits, and because terminals
(here&mdash;expressions <code>x</code> and <code>y</code>) are also of type
<code>(unsigned-byte 32)</code>, 32-bit machine arithmetic can be used.
</p>
<p>As of SBCL 0.8.5 &ldquo;good&rdquo; functions are <code>+</code>, <code>-</code>;
<code>logand</code>, <code>logior</code>, <code>logxor</code>, <code>lognot</code> and their
combinations; and <code>ash</code> with the positive second
argument. &ldquo;Good&rdquo; widths are 32 on HPPA, MIPS, PPC, Sparc and x86 and
64 on Alpha.  While it is possible to support smaller widths as well,
currently this is not implemented.
</p>
<hr>
<a name="Global-and-Always_002dBound-variables"></a>
<div class="header">
<p>
Next: <a href="#Miscellaneous-Efficiency-Issues" accesskey="n" rel="next">Miscellaneous Efficiency Issues</a>, Previous: <a href="#Modular-arithmetic" accesskey="p" rel="prev">Modular arithmetic</a>, Up: <a href="#Efficiency" accesskey="u" rel="up">Efficiency</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Global-and-Always_002dBound-variables-1"></a>
<h3 class="section">6.4 Global and Always-Bound variables</h3>

<a name="Macro-sb_002dext_003adefglobal"></a><dl>
<dt><a name="index-defglobal"></a>Macro: <strong>defglobal</strong> <em>[sb-ext] name value &amp;optional doc</em></dt>
<dd><p>Defines <code>name</code> as a global variable that is always bound. <code>value</code> is evaluated
and assigned to <code>name</code> both at compile- and load-time, but only if <code>name</code> is not
already bound.
</p>
<p>Global variables share their values between all threads, and cannot be
locally bound, declared special, defined as constants, and neither bound
nor defined as symbol macros.
</p>
<p>See also the declarations <code>sb-ext:global</code> and <code>sb-ext:always-bound</code>.
</p></dd></dl>

<dl>
<dt><a name="index-global"></a>Declaration: <strong>global</strong> <em>[sb-ext]</em></dt>
<dd>
<p>Syntax: <code>(sb-ext:global symbol*)</code>
</p>
<p>Only valid as a global proclamation.
</p>
<p>Specifies that the named symbols cannot be proclaimed or locally
declared <code>special</code>. Proclaiming an already special or constant
variable name as <code>global</code> signal an error. Allows more efficient
value lookup in threaded environments in addition to expressing
programmer intention.
</p></dd></dl>

<dl>
<dt><a name="index-always_002dbound"></a>Declaration: <strong>always-bound</strong> <em>[sb-ext]</em></dt>
<dd>
<p>Syntax: <code>(sb-ext:always-bound symbol*)</code>
</p>
<p>Only valid as a global proclamation.
</p>
<p>Specifies that the named symbols are always bound. Inhibits
<code>makunbound</code> of the named symbols. Proclaiming an unbound symbol
as <code>always-bound</code> signals an error. Allows the compiler to elide
boundness checks from value lookups.
</p></dd></dl>

<hr>
<a name="Miscellaneous-Efficiency-Issues"></a>
<div class="header">
<p>
Previous: <a href="#Global-and-Always_002dBound-variables" accesskey="p" rel="prev">Global and Always-Bound variables</a>, Up: <a href="#Efficiency" accesskey="u" rel="up">Efficiency</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Miscellaneous-Efficiency-Issues-1"></a>
<h3 class="section">6.5 Miscellaneous Efficiency Issues</h3>

<p>FIXME: The material in the CMUCL manual about getting good
performance from the compiler should be reviewed, reformatted in
Texinfo, lightly edited for SBCL, and substituted into this
manual. In the meantime, the original CMUCL manual is still 95+%
correct for the SBCL version of the Python compiler. See the
sections
</p>
<ul>
<li> Advanced Compiler Use and Efficiency Hints
</li><li> Advanced Compiler Introduction
</li><li> More About Types in Python
</li><li> Type Inference
</li><li> Source Optimization
</li><li> Tail Recursion
</li><li> Local Call
</li><li> Block Compilation
</li><li> Inline Expansion
</li><li> Object Representation
</li><li> Numbers
</li><li> General Efficiency Hints
</li><li> Efficiency Notes
</li></ul>

<p>Besides this information from the CMUCL manual, there are a few other
points to keep in mind.
</p>
<ul>
<li> <a name="index-let-_005bcl_005d"></a>
<a name="index-let_002a-_005bcl_005d"></a>
<a name="index-setq-_005bcl_005d"></a>
<a name="index-setf-_005bcl_005d"></a>
The CMUCL manual doesn&rsquo;t seem to state it explicitly, but Python has a
mental block about type inference when assignment is involved. Python
is very aggressive and clever about inferring the types of values
bound with <code>let</code>, <code>let*</code>, inline function call, and so
forth. However, it&rsquo;s much more passive and dumb about inferring the
types of values assigned with <code>setq</code>, <code>setf</code>, and
friends. It would be nice to fix this, but in the meantime don&rsquo;t
expect that just because it&rsquo;s very smart about types in most respects
it will be smart about types involved in assignments.  (This doesn&rsquo;t
affect its ability to benefit from explicit type declarations
involving the assigned variables, only its ability to get by without
explicit type declarations.)


</li><li> Since the time the CMUCL manual was written, CMUCL (and thus SBCL) has
gotten a generational garbage collector. This means that there are
some efficiency implications of various patterns of memory usage which
aren&rsquo;t discussed in the CMUCL manual. (Some new material should be
written about this.)

</li><li> SBCL has some important known efficiency problems.  Perhaps the most
important are

<ul class="no-bullet">
<li>- The garbage collector is not particularly efficient, at least on
platforms without the generational collector (as of SBCL 0.8.9, all
except x86).

</li><li>- Various aspects of the PCL implementation of CLOS are more inefficient
than necessary.

</li></ul>

</li></ul>

<p>Finally, note that Common Lisp defines many constructs which, in
the infamous phrase, &ldquo;could be compiled efficiently by a
sufficiently smart compiler&rdquo;. The phrase is infamous because
making a compiler which actually is sufficiently smart to find all
these optimizations systematically is well beyond the state of the art
of current compiler technology. Instead, they&rsquo;re optimized on a
case-by-case basis by hand-written code, or not optimized at all if
the appropriate case hasn&rsquo;t been hand-coded. Some cases where no such
hand-coding has been done as of SBCL version 0.6.3 include
</p>
<ul>
<li> <code>(reduce #'f x)</code> where the type of <code>x</code> is known at compile
time

</li><li> various bit vector operations, e.g.  <code>(position 0
some-bit-vector)</code>

</li><li> specialized sequence idioms, e.g.  <code>(remove item list :count 1)</code>

</li><li> cases where local compilation policy does not require excessive type
checking, e.g.  <code>(locally (declare (safety 1)) (assoc item
list))</code> (which currently performs safe <code>endp</code> checking internal
to assoc).

</li></ul>

<p>If your system&rsquo;s performance is suffering because of some construct
which could in principle be compiled efficiently, but which the SBCL
compiler can&rsquo;t in practice compile efficiently, consider writing a
patch to the compiler and submitting it for inclusion in the main
sources. Such code is often reasonably straightforward to write;
search the sources for the string &ldquo;<code>deftransform</code>&rdquo; to find many
examples (some straightforward, some less so).
</p><hr>
<a name="Beyond-the-ANSI-Standard"></a>
<div class="header">
<p>
Next: <a href="#Foreign-Function-Interface" accesskey="n" rel="next">Foreign Function Interface</a>, Previous: <a href="#Efficiency" accesskey="p" rel="prev">Efficiency</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Beyond-the-ANSI-Standard-1"></a>
<h2 class="chapter">7 Beyond the ANSI Standard</h2>

<p>SBCL is derived from CMUCL, which implements many extensions to the
ANSI standard. SBCL doesn&rsquo;t support as many extensions as CMUCL, but
it still has quite a few.  See <a href="#Contributed-Modules">Contributed Modules</a>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Reader-Extensions" accesskey="1">Reader Extensions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Package_002dLocal-Nicknames" accesskey="2">Package-Local Nicknames</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Package-Variance" accesskey="3">Package Variance</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Garbage-Collection" accesskey="4">Garbage Collection</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Metaobject-Protocol" accesskey="5">Metaobject Protocol</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Extensible-Sequences" accesskey="6">Extensible Sequences</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Support-For-Unix" accesskey="7">Support For Unix</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Unicode-Support" accesskey="8">Unicode Support</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Customization-Hooks-for-Users" accesskey="9">Customization Hooks for Users</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Tools-To-Help-Developers">Tools To Help Developers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Resolution-of-Name-Conflicts">Resolution of Name Conflicts</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Hash-Table-Extensions">Hash Table Extensions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Random-Number-Generation">Random Number Generation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Timeouts-and-Deadlines">Timeouts and Deadlines</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Miscellaneous-Extensions">Miscellaneous Extensions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Stale-Extensions">Stale Extensions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Efficiency-Hacks">Efficiency Hacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Reader-Extensions"></a>
<div class="header">
<p>
Next: <a href="#Package_002dLocal-Nicknames" accesskey="n" rel="next">Package-Local Nicknames</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Reader-Extensions-1"></a>
<h3 class="section">7.1 Reader Extensions</h3>
<a name="index-Reader-Extensions"></a>

<p>SBCL supports extended package prefix syntax, which allows specifying
an alternate package instead of <code>*package*</code> for the reader to use
as the default package for interning symbols:
</p>
<div class="lisp">
<pre class="lisp"><var>package-name</var>::<var>form-with-interning-into-package</var>
</pre></div>

<p>Example:
</p>
<div class="lisp">
<pre class="lisp">  'foo::(bar quux zot) == '(foo::bar foo::quux foo::zot)
</pre></div>

<p>Doesn&rsquo;t alter <code>*package*</code>: if <code>foo::bar</code> would cause a
read-time package lock violation, so does <code>foo::(bar)</code>.
</p>
<p>SBCL also extends the reader to normalize all symbols to Normalization
Form KC in builds with Unicode enabled. Whether symbols are normalized
is controlled by
</p>
<a name="Function-sb_002dext_003areadtable_002dnormalization"></a><dl>
<dt><a name="index-readtable_002dnormalization"></a>Function: <strong>readtable-normalization</strong> <em>[sb-ext] readtable</em></dt>
<dd><p>Returns <code>t</code> if <code>readtable</code> normalizes strings to <code>nfkc</code>, and <code>nil</code> otherwise.
The <code>readtable-normalization</code> of the standard readtable is <code>t</code>.
</p></dd></dl>

<p>Symbols created by
<a name="index-intern-_005bcl_005d"></a>
<code>intern</code> and similar functions are not affected by this setting. If
<code>sb-ext:readtable-normalization</code> is <code>t</code>, symbols that are not
normalized are escaped during printing.
</p>
<hr>
<a name="Package_002dLocal-Nicknames"></a>
<div class="header">
<p>
Next: <a href="#Package-Variance" accesskey="n" rel="next">Package Variance</a>, Previous: <a href="#Reader-Extensions" accesskey="p" rel="prev">Reader Extensions</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Package_002dLocal-Nicknames-1"></a>
<h3 class="section">7.2 Package-Local Nicknames</h3>
<a name="index-Package_002dLocal-Nicknames"></a>

<p>SBCL allows giving packages local nicknames: they allow short and
easy-to-use names to be used without fear of name conflict associated
with normal nicknames.
</p>
<p>A local nickname is valid only when inside the package for which it
has been specified. Different packages can use same local nickname for
different global names, or different local nickname for same global
name.
</p>
<p>Symbol <code>:package-local-nicknames</code> in <code>*features*</code> denotes the
support for this feature.
</p>
<a name="index-defpackage-_005bcl_005d"></a>
<dl>
<dt><a name="index-defpackage"></a>Macro: <strong>defpackage</strong> <em>[cl] name [[option]]* &rArr; package</em></dt>
<dd>
<p>Options are extended to include
</p>
<ul>
<li> <code>:local-nicknames (<var>local-nickname</var> <var>actual-package-name</var>)*</code>

<p>The package has the specified local nicknames for the corresponding
actual packages.
</p></li></ul>

<p>Example:
</p>
<div class="lisp">
<pre class="lisp">(defpackage :bar (:intern &quot;X&quot;))
(defpackage :foo (:intern &quot;X&quot;))
(defpackage :quux (:use :cl) (:local-nicknames (:bar :foo) (:foo :bar)))
(find-symbol &quot;X&quot; :foo) ; =&gt; FOO::X
(find-symbol &quot;X&quot; :bar) ; =&gt; BAR::X
(let ((*package* (find-package :quux)))
  (find-symbol &quot;X&quot; :foo))               ; =&gt; BAR::X
(let ((*package* (find-package :quux)))
  (find-symbol &quot;X&quot; :bar))               ; =&gt; FOO::X
</pre></div>
</dd></dl>

<a name="Function-sb_002dext_003apackage_002dlocal_002dnicknames"></a><dl>
<dt><a name="index-package_002dlocal_002dnicknames"></a>Function: <strong>package-local-nicknames</strong> <em>[sb-ext] package-designator</em></dt>
<dd><p>Returns an alist of (local-nickname . actual-package) describing the
nicknames local to the designated package.
</p>
<p>When in the designated package, calls to <code>find-package</code> with the any of the
local-nicknames will return the corresponding actual-package instead. This
also affects all implied calls to <code>find-package</code>, including those performed by
the reader.
</p>
<p>When printing a package prefix for a symbol with a package local nickname, the
local nickname is used instead of the real name in order to preserve
print-read consistency.
</p>
<p>See also: <code>add-package-local-nickname</code>, <code>package-locally-nicknamed-by-list</code>,
<code>remove-package-local-nickname</code>, and the <code>defpackage</code> option <code>:local-nicknames</code>.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003apackage_002dlocally_002dnicknamed_002dby_002dlist"></a><dl>
<dt><a name="index-package_002dlocally_002dnicknamed_002dby_002dlist"></a>Function: <strong>package-locally-nicknamed-by-list</strong> <em>[sb-ext] package-designator</em></dt>
<dd><p>Returns a list of packages which have a local nickname for the designated
package.
</p>
<p>See also: <code>add-package-local-nickname</code>, <code>package-local-nicknames</code>,
<code>remove-package-local-nickname</code>, and the <code>defpackage</code> option <code>:local-nicknames</code>.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003aadd_002dpackage_002dlocal_002dnickname"></a><dl>
<dt><a name="index-add_002dpackage_002dlocal_002dnickname"></a>Function: <strong>add-package-local-nickname</strong> <em>[sb-ext] local-nickname actual-package &amp;optional package-designator</em></dt>
<dd><p>Adds <code>local-nickname</code> for <code>actual-package</code> in the designated package, defaulting
to current package. <code>local-nickname</code> must be a string designator, and
<code>actual-package</code> must be a package designator.
</p>
<p>Returns the designated package.
</p>
<p>Signals a continuable error if <code>local-nickname</code> is already a package local
nickname for a different package, or if <code>local-nickname</code> is one of &quot;CL&quot;,
&quot;COMMON-LISP&quot;, or, &quot;KEYWORD&quot;, or if <code>local-nickname</code> is a global name or
nickname for the package to which the nickname would be added.
</p>
<p>When in the designated package, calls to <code>find-package</code> with the <code>local-nickname</code>
will return the package the designated <code>actual-package</code> instead. This also
affects all implied calls to <code>find-package</code>, including those performed by the
reader.
</p>
<p>When printing a package prefix for a symbol with a package local nickname,
local nickname is used instead of the real name in order to preserve
print-read consistency.
</p>
<p>See also: <code>package-local-nicknames</code>, <code>package-locally-nicknamed-by-list</code>,
<code>remove-package-local-nickname</code>, and the <code>defpackage</code> option <code>:local-nicknames</code>.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003aremove_002dpackage_002dlocal_002dnickname"></a><dl>
<dt><a name="index-remove_002dpackage_002dlocal_002dnickname"></a>Function: <strong>remove-package-local-nickname</strong> <em>[sb-ext] old-nickname &amp;optional package-designator</em></dt>
<dd><p>If the designated package had <code>old-nickname</code> as a local nickname for
another package, it is removed. Returns true if the nickname existed and was
removed, and <code>nil</code> otherwise.
</p>
<p>See also: <code>add-package-local-nickname</code>, <code>package-local-nicknames</code>,
<code>package-locally-nicknamed-by-list</code>, and the <code>defpackage</code> option <code>:local-nicknames</code>.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>

<hr>
<a name="Package-Variance"></a>
<div class="header">
<p>
Next: <a href="#Garbage-Collection" accesskey="n" rel="next">Garbage Collection</a>, Previous: <a href="#Package_002dLocal-Nicknames" accesskey="p" rel="prev">Package-Local Nicknames</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Package-Variance-1"></a>
<h3 class="section">7.3 Package Variance</h3>

<p>Common Lisp standard specifies that &ldquo;If the new definition is at
variance with the current state of that package, the consequences are
undefined;&rdquo; SBCL by default signals a full warning and retains as
much of the package state as possible.
</p>
<p>This can be adjusted using <code>sb-ext:*on-package-variance*</code>:
</p>
<a name="Variable-sb_002dext_003a_002aon_002dpackage_002dvariance_002a"></a><dl>
<dt><a name="index-_002aon_002dpackage_002dvariance_002a"></a>Variable: <strong>*on-package-variance*</strong> <em>[sb-ext]</em></dt>
<dd><p>Specifies behavior when redefining a package using <code>defpackage</code> and the
definition is in variance with the current state of the package.
</p>
<p>The value should be of the form:
</p>
<div class="lisp">
<pre class="lisp">  (:WARN [T | packages-names] :ERROR [T | package-names])
</pre></div>

<p>specifying which packages get which behaviour <code>--</code> with <code>t</code> signifying the default unless
otherwise specified. If default is not specified, <code>:warn</code> is used.
</p>
<p><code>:warn</code> keeps as much state as possible and causes <code>sbcl</code> to signal a full warning.
</p>
<p><code>:error</code> causes <code>sbcl</code> to signal an error when the variant <code>defpackage</code> form is executed,
with restarts provided for user to specify what action should be taken.
</p>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">  (setf *on-package-variance* '(:warn (:swank :swank-backend) :error t))
</pre></div>

<p>specifies to signal a warning if <code>swank</code> package is in variance, and an error otherwise.
</p></dd></dl>

<hr>
<a name="Garbage-Collection"></a>
<div class="header">
<p>
Next: <a href="#Metaobject-Protocol" accesskey="n" rel="next">Metaobject Protocol</a>, Previous: <a href="#Package-Variance" accesskey="p" rel="prev">Package Variance</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Garbage-Collection-1"></a>
<h3 class="section">7.4 Garbage Collection</h3>
<a name="index-Garbage-collection"></a>

<p>SBCL provides additional garbage collection functionality not
specified by ANSI.
</p>
<a name="Variable-sb_002dext_003a_002aafter_002dgc_002dhooks_002a"></a><dl>
<dt><a name="index-_002aafter_002dgc_002dhooks_002a"></a>Variable: <strong>*after-gc-hooks*</strong> <em>[sb-ext]</em></dt>
<dd><p>Called after each garbage collection, except for garbage collections
triggered during thread exits. In a multithreaded environment these hooks may
run in any thread.
</p></dd></dl>
<a name="Function-sb_002dext_003agc"></a><dl>
<dt><a name="index-gc"></a>Function: <strong>gc</strong> <em>[sb-ext] &amp;key full gen &amp;allow-other-keys</em></dt>
<dd><p>Initiate a garbage collection.
</p>
<p>The default is to initiate a nursery collection, which may in turn
trigger a collection of one or more older generations as well. If <code>full</code>
is true, all generations are collected. If <code>gen</code> is provided, it can be
used to specify the oldest generation guaranteed to be collected.
</p>
<p>On CheneyGC platforms arguments <code>full</code> and <code>gen</code> take no effect: a full
collection is always performed.
</p></dd></dl>

<a name="Finalization"></a>
<h4 class="subsection">7.4.1 Finalization</h4>
<a name="index-Finalization"></a>

<p>Finalization allows code to be executed after an object has been
garbage collected. This is useful for example for releasing foreign
memory associated with a Lisp object.
</p>
<a name="Function-sb_002dext_003afinalize"></a><dl>
<dt><a name="index-finalize"></a>Function: <strong>finalize</strong> <em>[sb-ext] object function &amp;key dont-save</em></dt>
<dd><p>Arrange for the designated <code>function</code> to be called when there
are no more references to <code>object</code>, including references in
<code>function</code> itself.
</p>
<p>If <code>dont-save</code> is true, the finalizer will be cancelled when
<code>save-lisp-and-die</code> is called: this is useful for finalizers
deallocating system memory, which might otherwise be called
with addresses from the old image.
</p>
<p>In a multithreaded environment <code>function</code> may be called in any
thread. In both single and multithreaded environments <code>function</code>
may be called in any dynamic scope: consequences are unspecified
if <code>function</code> is not fully re-entrant.
</p>
<p>Errors from <code>function</code> are handled and cause a <code>warning</code> to be
signalled in whichever thread the <code>function</code> was called in.
</p>
<p>Examples:
</p>
<div class="lisp">
<pre class="lisp">  ;;; GOOD, assuming RELEASE-HANDLE is re-entrant.
  (let* ((handle (get-handle))
         (object (make-object handle)))
   (finalize object (lambda () (release-handle handle)))
   object)

  ;;; BAD, finalizer refers to object being finalized, causing
  ;;; it to be retained indefinitely!
  (let* ((handle (get-handle))
         (object (make-object handle)))
    (finalize object
              (lambda ()
                (release-handle (object-handle object)))))

  ;;; BAD, not re-entrant!
  (defvar *rec* nil)

  (defun oops ()
   (when *rec*
     (error &quot;recursive OOPS&quot;))
   (let ((*rec* t))
     (gc))) ; or just cons enough to cause one

  (progn
    (finalize &quot;oops&quot; #'oops)
    (oops)) ; GC causes re-entry to #'oops due to the finalizer
            ; -&gt; ERROR, caught, WARNING signalled
</pre></div>
</dd></dl>
<a name="Function-sb_002dext_003acancel_002dfinalization"></a><dl>
<dt><a name="index-cancel_002dfinalization"></a>Function: <strong>cancel-finalization</strong> <em>[sb-ext] object</em></dt>
<dd><p>Cancel all finalizations for <code>object</code>.
</p></dd></dl>

<a name="Weak-Pointers"></a>
<h4 class="subsection">7.4.2 Weak Pointers</h4>
<a name="index-Weak-pointers"></a>

<p>Weak pointers allow references to objects to be maintained without
keeping them from being garbage collected: useful for building caches
among other things.
</p>
<p>Hash tables can also have weak keys and values: see <a href="#Hash-Table-Extensions">Hash Table Extensions</a>.
</p>
<a name="Function-sb_002dext_003amake_002dweak_002dpointer"></a><dl>
<dt><a name="index-make_002dweak_002dpointer"></a>Function: <strong>make-weak-pointer</strong> <em>[sb-ext] object</em></dt>
<dd><p>Allocate and return a weak pointer which points to <code>object</code>.
</p></dd></dl>
<a name="Function-sb_002dext_003aweak_002dpointer_002dvalue"></a><dl>
<dt><a name="index-weak_002dpointer_002dvalue"></a>Function: <strong>weak-pointer-value</strong> <em>[sb-ext] weak-pointer</em></dt>
<dd><p>If <code>weak-pointer</code> is valid, return the value of <code>weak-pointer</code> and <code>t</code>.
If the referent of <code>weak-pointer</code> has been garbage collected,
returns the values <code>nil</code> and <code>nil</code>.
</p></dd></dl>

<a name="Introspection-and-Tuning"></a>
<h4 class="subsection">7.4.3 Introspection and Tuning</h4>

<a name="Variable-sb_002dext_003a_002agc_002drun_002dtime_002a"></a><dl>
<dt><a name="index-_002agc_002drun_002dtime_002a"></a>Variable: <strong>*gc-run-time*</strong> <em>[sb-ext]</em></dt>
<dd><p>Total <code>cpu</code> time spent doing garbage collection (as reported by
<code>get-internal-run-time</code>.) Initialized to zero on startup. It is safe to bind
this to zero in order to measure <code>gc</code> time inside a certain section of code, but
doing so may interfere with results reported by eg. <code>time</code>.
</p></dd></dl>
<a name="Function-sb_002dext_003abytes_002dconsed_002dbetween_002dgcs"></a><dl>
<dt><a name="index-bytes_002dconsed_002dbetween_002dgcs"></a>Function: <strong>bytes-consed-between-gcs</strong> <em>[sb-ext]</em></dt>
<dd><p>The amount of memory that will be allocated before the next garbage
collection is initiated. This can be set with <code>setf</code>.
</p>
<p>On <code>gencgc</code> platforms this is the nursery size, and defaults to 5% of dynamic
space size.
</p>
<p>Note: currently changes to this value are lost when saving core.
</p></dd></dl>
<a name="Function-sb_002dext_003adynamic_002dspace_002dsize"></a><dl>
<dt><a name="index-dynamic_002dspace_002dsize"></a>Function: <strong>dynamic-space-size</strong> <em>[sb-ext]</em></dt>
<dd><p>Size of the dynamic space in bytes.
</p></dd></dl>
<a name="Function-sb_002dext_003aget_002dbytes_002dconsed"></a><dl>
<dt><a name="index-get_002dbytes_002dconsed"></a>Function: <strong>get-bytes-consed</strong> <em>[sb-ext]</em></dt>
<dd><p>Return the number of bytes consed since the program began. Typically
this result will be a consed bignum, so if you have an application (e.g.
profiling) which can&rsquo;t tolerate the overhead of consing bignums, you&rsquo;ll
probably want either to hack in at a lower level (as the code in the
<code>sb-profile</code> package does), or to design a more microefficient interface
and submit it as a patch.
</p></dd></dl>
<a name="Function-sb_002dext_003agc_002dlogfile"></a><dl>
<dt><a name="index-gc_002dlogfile"></a>Function: <strong>gc-logfile</strong> <em>[sb-ext]</em></dt>
<dd><p>Return the pathname used to log garbage collections. Can be <code>setf</code>.
Default is <code>nil</code>, meaning collections are not logged. If non-null, the
designated file is opened before and after each collection, and generation
statistics are appended to it.
</p></dd></dl>
<a name="Function-sb_002dext_003ageneration_002daverage_002dage"></a><dl>
<dt><a name="index-generation_002daverage_002dage"></a>Function: <strong>generation-average-age</strong> <em>[sb-ext] generation</em></dt>
<dd><p>Average age of memory allocated to <code>generation:</code> average number of times
objects allocated to the generation have seen younger objects promoted to it.
Available on <code>gencgc</code> platforms only.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003ageneration_002dbytes_002dallocated"></a><dl>
<dt><a name="index-generation_002dbytes_002dallocated"></a>Function: <strong>generation-bytes-allocated</strong> <em>[sb-ext] generation</em></dt>
<dd><p>Number of bytes allocated to <code>generation</code> currently. Available on <code>gencgc</code>
platforms only.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003ageneration_002dbytes_002dconsed_002dbetween_002dgcs"></a><dl>
<dt><a name="index-generation_002dbytes_002dconsed_002dbetween_002dgcs"></a>Function: <strong>generation-bytes-consed-between-gcs</strong> <em>[sb-ext] generation</em></dt>
<dd><p>Number of bytes that can be allocated to <code>generation</code> before that
generation is considered for garbage collection. This value is meaningless for
generation 0 (the nursery): see <code>bytes-consed-between-gcs</code> instead. Default is
5% of the dynamic space size divided by the number of non-nursery generations.
Can be assigned to using <code>setf</code>. Available on <code>gencgc</code> platforms only.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003ageneration_002dminimum_002dage_002dbefore_002dgc"></a><dl>
<dt><a name="index-generation_002dminimum_002dage_002dbefore_002dgc"></a>Function: <strong>generation-minimum-age-before-gc</strong> <em>[sb-ext] generation</em></dt>
<dd><p>Minimum average age of objects allocated to <code>generation</code> before that
generation is may be garbage collected. Default is 0.75. See also
<code>generation-average-age</code>. Can be assigned to using <code>setf</code>. Available on <code>gencgc</code>
platforms only.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003ageneration_002dnumber_002dof_002dgcs_002dbefore_002dpromotion"></a><dl>
<dt><a name="index-generation_002dnumber_002dof_002dgcs_002dbefore_002dpromotion"></a>Function: <strong>generation-number-of-gcs-before-promotion</strong> <em>[sb-ext] generation</em></dt>
<dd><p>Number of times garbage collection is done on <code>generation</code> before
automatic promotion to the next generation is triggered. Default is 1. Can be
assigned to using <code>setf</code>. Available on <code>gencgc</code> platforms only.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003ageneration_002dnumber_002dof_002dgcs"></a><dl>
<dt><a name="index-generation_002dnumber_002dof_002dgcs"></a>Function: <strong>generation-number-of-gcs</strong> <em>[sb-ext] generation</em></dt>
<dd><p>Number of times garbage collection has been done on <code>generation</code> without
promotion. Available on <code>gencgc</code> platforms only.
</p>
<p>Experimental: interface subject to change.
</p></dd></dl>

<hr>
<a name="Metaobject-Protocol"></a>
<div class="header">
<p>
Next: <a href="#Extensible-Sequences" accesskey="n" rel="next">Extensible Sequences</a>, Previous: <a href="#Garbage-Collection" accesskey="p" rel="prev">Garbage Collection</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Metaobject-Protocol-1"></a>
<h3 class="section">7.5 Metaobject Protocol</h3>

<a name="AMOP-Compatibility-of-Metaobject-Protocol"></a>
<h4 class="subsection">7.5.1 AMOP Compatibility of Metaobject Protocol</h4>

<p>SBCL supports a metaobject protocol which is intended to be compatible
with AMOP; present exceptions to this (as distinct from current bugs)
are:
</p>
<ul>
<li> <a name="index-compute_002deffective_002dmethod-_005bsb_002dmop_005d"></a>
<code>compute-effective-method</code> only returns one value, not two.

<p>There is no record of what the second return value was meant to
indicate, and apparently no clients for it.
</p>
</li><li> <a name="index-generic_002dfunction-_005bcl_005d"></a>
<a name="index-standard_002dgeneric_002dfunction-_005bcl_005d"></a>
<a name="index-funcallable_002dstandard_002dobject-_005bsb_002dmop_005d"></a>
<a name="index-standard_002dobject-_005bcl_005d"></a>
<a name="index-function-_005bcl_005d"></a>
The direct superclasses of <code>funcallable-standard-object</code> are
<code>(function standard-object)</code>, not <code>(standard-object function)</code>.

<p>This is to ensure that the <code>standard-object</code> class is the last of
the standardized classes before <code>t</code> appearing in the class
precedence list of <code>generic-function</code> and
<code>standard-generic-function</code>, as required by section 1.4.4.5 of the
ANSI specification.
</p>
</li><li> <a name="index-ensure_002dgeneric_002dfunction-_005bcl_005d"></a>
<a name="index-generic_002dfunction_002ddeclarations-_005bsb_002dmop_005d"></a>
the arguments <code>:declare</code> and <code>:declarations</code> to
<code>ensure-generic-function</code> are both accepted, with the leftmost
argument defining the declarations to be stored and returned by
<code>generic-function-declarations</code>.

<p>Where AMOP specifies <code>:declarations</code> as the keyword argument to
<code>ensure-generic-function</code>, the Common Lisp standard specifies
<code>:declare</code>.  Portable code should use <code>:declare</code>.
</p>
</li><li> <a name="index-validate_002dsuperclass-_005bsb_002dmop_005d"></a>
<a name="index-finalize_002dinheritance-_005bsb_002dmop_005d"></a>
<a name="index-standard_002dclass-_005bcl_005d"></a>
<a name="index-funcallable_002dstandard_002dclass-_005bsb_002dmop_005d"></a>
<a name="index-function-_005bcl_005d-1"></a>
<a name="index-class_002dprototype-_005bsb_002dmop_005d"></a>
although SBCL obeys the requirement in AMOP that
<code>validate-superclass</code> should treat <code>standard-class</code> and
<code>funcallable-standard-class</code> as compatible metaclasses, we
impose an additional requirement at class finalization time: a class
of metaclass <code>funcallable-standard-class</code> must have
<code>function</code> in its superclasses, and a class of metaclass
<code>standard-class</code> must not.

<a name="index-typep-_005bcl_005d"></a>
<a name="index-class_002dof-_005bcl_005d"></a>
<a name="index-subtypep-_005bcl_005d"></a>
<p>After a class has been finalized, it is associated with a class
prototype which is accessible by a standard mop function
<code>class-prototype</code>.  The user can then ask whether this object is a
<code>function</code> or not in several different ways: whether it is a
function according to <code>typep</code>; whether its <code>class-of</code> is
<code>subtypep</code> <code>function</code>, or whether <code>function</code> appears in
the superclasses of the class.  The additional consistency requirement
comes from the desire to make all of these answers the same.
</p>
<p>The following class definitions are bad, and will lead to errors
either immediately or if an instance is created:
</p><div class="lisp">
<pre class="lisp">(defclass bad-object (funcallable-standard-object)
  ()
  (:metaclass standard-class))
</pre></div>
<div class="lisp">
<pre class="lisp">(defclass bad-funcallable-object (standard-object)
  ()
  (:metaclass funcallable-standard-class))
</pre></div>
<p>The following definition is acceptable:
</p><div class="lisp">
<pre class="lisp">(defclass mixin ()
  ((slot :initarg slot)))
(defclass funcallable-object (funcallable-standard-object mixin)
  ()
  (:metaclass funcallable-standard-class))
</pre></div>
<p>and leads to a class whose instances are funcallable and have one slot.
</p>
<a name="index-funcallable_002dstandard_002dobject-_005bsb_002dmop_005d-1"></a>
<p>Note that this requirement also applies to the class
<code>funcallable-standard-object</code>, which has metaclass
<code>funcallable-standard-class</code> rather than
<code>standard-class</code> as AMOP specifies.
</p>
</li><li> the requirement that &ldquo;No portable class <em>C_p</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
<code>common-lisp-user</code> package or exported by any package defined in
the ANSI Common Lisp standard.&rdquo; is interpreted to mean that the
standardized classes themselves should not have slots named by external
symbols of public packages.

<p>The rationale behind the restriction is likely to be similar to the ANSI
Common Lisp restriction on defining functions, variables and types named
by symbols in the Common Lisp package: preventing two independent pieces
of software from colliding with each other.
</p>
</li><li> <a name="index-slot_002dvalue_002dusing_002dclass-_005bsb_002dmop_005d"></a>
<a name="index-_0028setf-slot_002dvalue_002dusing_002dclass-_005bsb_002dmop_005d_0029"></a>
<a name="index-slot_002dboundp_002dusing_002dclass-_005bsb_002dmop_005d"></a>
specializations of the <code>new-value</code> argument to <code>(setf
slot-value-using-class)</code> are not allowed: all user-defined methods must
have a specializer of the class <code>t</code>.

<p>This prohibition is motivated by a separation of layers: the
<code>slot-value-using-class</code> family of functions is intended for use in
implementing different and new slot allocation strategies, rather than
in performing application-level dispatching.  Additionally, with this
requirement, there is a one-to-one mapping between metaclass, class and
slot-definition-class tuples and effective methods of <code>(setf
slot-value-using-class)</code>, which permits optimization of <code>(setf
slot-value-using-class)</code>&rsquo;s discriminating function in the same manner as
for <code>slot-value-using-class</code> and <code>slot-boundp-using-class</code>.
</p>
<p>Note that application code may specialize on the <code>new-value</code>
argument of slot accessors.
</p>
</li><li> <a name="index-defclass-_005bcl_005d"></a>
<a name="index-ensure_002dclass-_005bsb_002dmop_005d"></a>
<a name="index-ensure_002dclass_002dusing_002dclass-_005bsb_002dmop_005d"></a>
<a name="index-find_002dclass-_005bcl_005d"></a>
<a name="index-class_002dname-_005bcl_005d"></a>
the class named by the <code>name</code> argument to <code>ensure-class</code>, if
any, is only redefined if it is the proper name of that class;
otherwise, a new class is created.

<p>This is consistent with the description of <code>ensure-class</code> in AMOP
as the functional version of <code>defclass</code>, which has this behaviour;
however, it is not consistent with the weaker requirement in AMOP, which
states that any class found by <code>find-class</code>, no matter what its
<code>class-name</code>, is redefined.
</p>
</li><li> <a name="index-slot_002ddefinition_002dname-_005bsb_002dmop_005d"></a>
<a name="index-structure_002dclass-_005bcl_005d"></a>
<a name="index-defstruct-_005bcl_005d"></a>
an error is not signaled in the case of the <code>:name</code> initialization
argument for <code>slot-definition</code> objects being a constant, when the
slot definition is of type <code>structure-slot-definition</code> (i.e. it is
associated with a class of type <code>structure-class</code>).

<p>This allows code which uses constant names for structure slots to
continue working as specified in ANSI, while enforcing the constraint
for all other types of slot.
</p>
</li><li> <a name="index-t-_005bcl_005d"></a>
<a name="index-built_002din_002dclass-_005bcl_005d"></a>
<a name="index-validate_002dsuperclass-_005bsb_002dmop_005d-1"></a>
<a name="index-defclass-_005bcl_005d-1"></a>
the class named <code>t</code> is not an instance of the <code>built-in-class</code>
metaclass.

<p>AMOP specifies, in the &ldquo;Inheritance Structure of Metaobject Classes&rdquo;
section, that the class named <code>t</code> should be an instance of
<code>built-in-class</code>.  However, it also specifies that
<code>validate-superclass</code> should return true (indicating that a direct
superclass relationship is permissible) if the second argument is the
class named <code>t</code>.  Also, ANSI specifies that classes with metaclass
<code>built-in-class</code> may not be subclassed using <code>defclass</code>, and
also that the class named <code>t</code> is the universal superclass,
inconsistent with it being a <code>built-in-class</code>.
</p>
</li></ul>

<a name="Metaobject-Protocol-Extensions"></a>
<h4 class="subsection">7.5.2 Metaobject Protocol Extensions</h4>

<p>In addition, SBCL supports extensions to the Metaobject protocol from
AMOP; at present, they are:
</p>
<ul>
<li> <a name="index-defmethod-_005bcl_005d"></a>
<a name="index-find_002dclass-_005bcl_005d-1"></a>
<a name="index-intern_002deql_002dspecializer-_005bsb_002dmop_005d"></a>
<a name="index-make_002dmethod_002dspecializers_002dform-_005bsb_002dpcl_005d"></a>
<a name="index-make_002dmethod_002dlambda-_005bsb_002dmop_005d"></a>
compile-time support for generating specializer metaobjects from
specializer names in <code>defmethod</code> forms is provided by the
<code>make-method-specializers-form</code> function, which returns a form
which, when evaluated in the lexical environment of the
<code>defmethod</code>, returns a list of specializer metaobjects.  This
operator suffers from similar restrictions to those affecting
<code>make-method-lambda</code>, namely that the generic function must be
defined when the <code>defmethod</code> form is expanded, so that the
correct method of <code>make-method-specializers-form</code> is invoked.
The system-provided method on <code>make-method-specializers-form</code>
generates a call to <code>find-class</code> for each symbol specializer
name, and a call to <code>intern-eql-specializer</code> for each <code>(eql
<var>x</var>)</code> specializer name.

</li><li> <a name="index-find_002dmethod-_005bcl_005d"></a>
<a name="index-parse_002dspecializer_002dusing_002dclass-_005bsb_002dpcl_005d"></a>
<a name="index-unparse_002dspecializer_002dusing_002dclass-_005bsb_002dpcl_005d"></a>
run-time support for converting between specializer names and
specializer metaobjects, mostly for the purposes of
<code>find-method</code>, is provided by
<code>parse-specializer-using-class</code> and
<code>unparse-specializer-using-class</code>, which dispatch on their first
argument, the generic function associated with a method with the given
specializer.  The system-provided methods on those methods convert
between classes and proper names and between lists of the form
<code>(eql <var>x</var>)</code> and interned eql specializer objects.

</li><li> <a name="index-_002bslot_002dunbound_002b-_005bsb_002dpcl_005d"></a>
<a name="index-standard_002dinstance_002daccess-_005bsb_002dmop_005d"></a>
<a name="index-funcallable_002dstandard_002dinstance_002daccess-_005bsb_002dmop_005d"></a>
distinguishing unbound instance allocated slots from bound ones when
using <code>standard-instance-access</code> and
<code>funcallable-standard-instance-access</code> is possible by comparison
to the symbol-macro <code>+slot-unbound+</code>.

</li></ul>

<hr>
<a name="Extensible-Sequences"></a>
<div class="header">
<p>
Next: <a href="#Support-For-Unix" accesskey="n" rel="next">Support For Unix</a>, Previous: <a href="#Metaobject-Protocol" accesskey="p" rel="prev">Metaobject Protocol</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Extensible-Sequences-1"></a>
<h3 class="section">7.6 Extensible Sequences</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Iterator-Protocol" accesskey="1">Iterator Protocol</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Simple-Iterator-Protocol" accesskey="2">Simple Iterator Protocol</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<p>ANSI Common Lisp has a class <code>sequence</code> with subclasses <code>list</code> and
<code>vector</code> on which the &ldquo;sequence functions&rdquo; like <code>find</code>,
<code>subseq</code>, etc. operate. As an extension to the ANSI specification,
SBCL allows additional subclasses of <code>sequence</code> to be defined
<a name="DOCF6" href="#FOOT6"><sup>6</sup></a>.
<a name="index-sequence-_005bcl_005d"></a>
<a name="index-vector-_005bcl_005d-1"></a>
<a name="index-find-_005bcl_005d"></a>
<a name="index-subseq-_005bcl_005d"></a>
</p>
<p>Users of this extension just make instances of <code>sequence</code> subclasses
and transparently operate on them using sequence functions:
</p><div class="lisp">
<pre class="lisp">(coerce (subseq (make-instance 'my-sequence) 5 10) 'list)
</pre></div>
<p>From this perspective, no distinction between builtin and user-defined
<code>sequence</code> subclasses should be necessary.
<a name="index-coerce-_005bcl_005d"></a>
<a name="index-subseq-_005bcl_005d-1"></a>
<a name="index-make_002dinstance-_005bcl_005d"></a>
<a name="index-list-_005bcl_005d-1"></a>
</p>
<p>Providers of the extension, that is of user-defined <code>sequence</code>
subclasses, have to adhere to a &ldquo;sequence protocol&rdquo; which consists of
a set of generic functions in the <code>sequence</code> package.
</p>
<p>A minimal <code>sequence</code> subclass has to specify <code>standard-object</code> and
<code>sequence</code> as its superclasses and has to be the specializer of the
<code>sequence</code> parameter of methods on at least the following generic
functions:
<a name="index-sequence-_005bcl_005d-1"></a>
<a name="index-standard_002dobject-_005bcl_005d-1"></a>
</p>
<a name="Generic_002dFunction-sb_002dsequence_003alength"></a><dl>
<dt><a name="index-length"></a>Generic Function: <strong>length</strong> <em>[sb-sequence] sequence</em></dt>
<dd><p>Returns the length of <code>sequence</code> or signals a <code>protocol-unimplemented</code>
   error if the sequence protocol is not implemented for the class of
   <code>sequence</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dsequence_003aelt"></a><dl>
<dt><a name="index-elt"></a>Generic Function: <strong>elt</strong> <em>[sb-sequence] sequence index</em></dt>
<dd><p>Returns the element at position <code>index</code> of <code>sequence</code> or signals a
   <code>protocol-unimplemented</code> error if the sequence protocol is not
   implemented for the class of <code>sequence</code>.
</p></dd></dl>
<a name="Generic_002dFunction-_0028setf-sb_002dsequence_003aelt_0029"></a><dl>
<dt><a name="index-_0028setf"></a>Generic Function: <strong>(setf</strong> <em>elt [sb-sequence])</em></dt>
<dd><p>Replaces the element at position <code>index</code> of <code>sequence</code> with <code>new-value</code>
   and returns <code>new-value</code> or signals a <code>protocol-unimplemented</code> error if
   the sequence protocol is not implemented for the class of
   <code>sequence</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dsequence_003aadjust_002dsequence"></a><dl>
<dt><a name="index-adjust_002dsequence"></a>Generic Function: <strong>adjust-sequence</strong> <em>[sb-sequence] sequence length &amp;key initial-element initial-contents</em></dt>
<dd><p>Return destructively modified <code>sequence</code> or a freshly allocated
   sequence of the same class as <code>sequence</code> of length <code>length</code>. Elements
   of the returned sequence are initialized to <code>initial-element</code>, if
   supplied, initialized to <code>initial-contents</code> if supplied, or identical
   to the elements of <code>sequence</code> if neither is supplied. Signals a
   <code>protocol-unimplemented</code> error if the sequence protocol is not
   implemented for the class of <code>sequence</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dsequence_003amake_002dsequence_002dlike"></a><dl>
<dt><a name="index-make_002dsequence_002dlike"></a>Generic Function: <strong>make-sequence-like</strong> <em>[sb-sequence] sequence length &amp;key initial-element initial-contents</em></dt>
<dd><p>Returns a freshly allocated sequence of length <code>length</code> and of the
   same class as <code>sequence</code>. Elements of the new sequence are
   initialized to <code>initial-element</code>, if supplied, initialized to
   <code>initial-contents</code> if supplied, or identical to the elements of
   <code>sequence</code> if neither is supplied. Signals a <code>protocol-unimplemented</code>
   error if the sequence protocol is not implemented for the class of
   <code>sequence</code>.
</p></dd></dl>

<p><code>make-sequence-like</code> is needed for functions returning
freshly-allocated sequences such as <code>subseq</code> or
<code>copy-seq</code>. <code>adjust-sequence</code> is needed for functions which
destructively modify their arguments such as <code>delete</code>. In fact, all
other sequence functions can be implemented in terms of the above
functions and actually are, if no additional methods are
defined. However, relying on these generic implementations, in
particular not implementing the iterator protocol can incur a high
performance penalty See <a href="#Iterator-Protocol">Iterator Protocol</a>.
<a name="index-sequence-_005bcl_005d-2"></a>
<a name="index-make_002dsequence_002dlike-_005bsb_002dsequence_005d"></a>
<a name="index-subseq-_005bcl_005d-2"></a>
<a name="index-copy_002dseq-_005bcl_005d"></a>
<a name="index-adjust_002dsequence-_005bsb_002dsequence_005d"></a>
</p>
<p>When the sequence protocol is only partially implemented for a given
<code>sequence</code> subclass, an attempt to apply one of the missing
operations to instances of that class signals the following condition:
</p>
<a name="Condition-sb_002dsequence_003aprotocol_002dunimplemented"></a><dl>
<dt><a name="index-protocol_002dunimplemented"></a>Condition: <strong>protocol-unimplemented</strong> <em>[sb-sequence]</em></dt>
<dd><p>Class precedence list: <code>protocol-unimplemented, type-error, error, serious-condition, condition, t</code>
</p>
<p>This error is signaled if a sequence operation is applied to an
   instance of a sequence class that does not support the
   operation.
</p></dd></dl>

<p>In addition to the mandatory functions above, methods on the sequence
functions listed below can be defined.
</p>
<p>There are two noteworthy irregularities:
</p><ul>
<li> The function <code>sb-sequence:emptyp</code> does not have a counterpart in
the <code>cl</code> package. It is intended to be used instead of
<code>length</code> when working with lazy or infinite sequences.

</li><li> The functions <code>map</code>, <code>concatenate</code> and <code>merge</code> receive a
type designator specifying the type of the constructed sequence as their
first argument. However, the corresponding generic functions
<code>sb-sequence:map</code>, <code>sb-sequence:concatenate</code> and
<code>sb-sequence:merge</code> receive a prototype instance of the requested
<code>sequence</code> subclass instead.
</li></ul>

<a name="Generic_002dFunction-sb_002dsequence_003aemptyp"></a><dl>
<dt><a name="index-emptyp"></a>Generic Function: <strong>emptyp</strong> <em>[sb-sequence] sequence</em></dt>
<dd><p>Returns <code>t</code> if <code>sequence</code> is an empty sequence and <code>nil</code>
   otherwise. Signals an error if <code>sequence</code> is not a sequence.
</p></dd></dl>

<ul>
<li> <code>sb-sequence:count</code>, <code>sb-sequence:count-if</code>, <code>sb-sequence:count-if-not</code>

</li><li> <code>sb-sequence:find</code>, <code>sb-sequence:find-if</code>, <code>sb-sequence:find-if-not</code>

</li><li> <code>sb-sequence:position</code>, <code>sb-sequence:position-if</code>, <code>sb-sequence:position-if-not</code>

</li><li> <code>sb-sequence:subseq</code>

</li><li> <code>sb-sequence:copy-seq</code>

</li><li> <code>sb-sequence:fill</code>

</li><li> <a name="Generic_002dFunction-sb_002dsequence_003amap"></a><dl>
<dt><a name="index-map"></a>Generic Function: <strong>map</strong> <em>[sb-sequence] result-prototype function sequence &amp;rest sequences</em></dt>
<dd><p>Implements <code>cl:map</code> for extended sequences.
</p>
<p><code>result-prototype</code> corresponds to the <code>result-type</code> of <code>cl:map</code> but
    receives a prototype instance of an extended sequence class
    instead of a type specifier. By dispatching on <code>result-prototype</code>,
    methods on this generic function specify how extended sequence
    classes act when they are specified as the result type in a <code>cl:map</code>
    call. <code>result-prototype</code> may not be fully initialized and thus
    should only be used for dispatch and to determine its class.
</p>
<p>Another difference to <code>cl:map</code> is that <code>function</code> is a function, not a
    function designator.
</p></dd></dl>

</li><li> <code>sb-sequence:nsubstitute</code>, <code>sb-sequence:nsubstitute-if</code>,
<code>sb-sequence:nsubstitute-if-not</code>, <code>sb-sequence:substitute</code>,
<code>sb-sequence:substitute-if</code>, <code>sb-sequence:substitute-if-not</code>

</li><li> <code>sb-sequence:replace</code>

</li><li> <code>sb-sequence:nreverse</code>, <code>sb-sequence:reverse</code>

</li><li> <a name="Generic_002dFunction-sb_002dsequence_003aconcatenate"></a><dl>
<dt><a name="index-concatenate"></a>Generic Function: <strong>concatenate</strong> <em>[sb-sequence] result-prototype &amp;rest sequences</em></dt>
<dd><p>Implements <code>cl:concatenate</code> for extended sequences.
</p>
<p><code>result-prototype</code> corresponds to the <code>result-type</code> of <code>cl:concatenate</code>
    but receives a prototype instance of an extended sequence class
    instead of a type specifier. By dispatching on <code>result-prototype</code>,
    methods on this generic function specify how extended sequence
    classes act when they are specified as the result type in a
    <code>cl:concatenate</code> call. <code>result-prototype</code> may not be fully initialized
    and thus should only be used for dispatch and to determine its
    class.
</p></dd></dl>

</li><li> <code>sb-sequence:reduce</code>

</li><li> <code>sb-sequence:mismatch</code>

</li><li> <code>sb-sequence:search</code>

</li><li> <code>sb-sequence:delete</code>, <code>sb-sequence:delete-if</code>, <code>sb-sequence:delete-if-not</code>,
<code>sb-sequence:remove</code>, <code>sb-sequence:remove-if</code>, <code>sb-sequence:remove-if-not</code>,

</li><li> <code>sb-sequence:delete-duplicates</code>, <code>sb-sequence:remove-duplicates</code>

</li><li> <code>sb-sequence:sort</code>, <code>sb-sequence:stable-sort</code>

</li><li> <a name="Generic_002dFunction-sb_002dsequence_003amerge"></a><dl>
<dt><a name="index-merge"></a>Generic Function: <strong>merge</strong> <em>[sb-sequence] result-prototype sequence1 sequence2 predicate &amp;key key</em></dt>
<dd><p>Implements <code>cl:merge</code> for extended sequences.
</p>
<p><code>result-prototype</code> corresponds to the <code>result-type</code> of <code>cl:merge</code> but
    receives a prototype instance of an extended sequence class
    instead of a type specifier. By dispatching on <code>result-prototype</code>,
    methods on this generic function specify how extended sequence
    classes act when they are specified as the result type in a
    <code>cl:merge</code> call. <code>result-prototype</code> may not be fully initialized and
    thus should only be used for dispatch and to determine its class.
</p>
<p>Another difference to <code>cl:merge</code> is that <code>predicate</code> is a function,
    not a function designator.
</p></dd></dl>
</li></ul>

<p>In the spirit of <code>dolist</code>, generic sequences can be traversed using
the macro
<a name="index-dolist-_005bcl_005d"></a>
</p>
<a name="Macro-sb_002dsequence_003adosequence"></a><dl>
<dt><a name="index-dosequence"></a>Macro: <strong>dosequence</strong> <em>[sb-sequence] (element sequence &amp;optional return) &amp;body body</em></dt>
<dd><p>Executes <code>body</code> with <code>element</code> subsequently bound to each element of
  <code>sequence</code>, then returns <code>return</code>.
</p></dd></dl>

<hr>
<a name="Iterator-Protocol"></a>
<div class="header">
<p>
Next: <a href="#Simple-Iterator-Protocol" accesskey="n" rel="next">Simple Iterator Protocol</a>, Up: <a href="#Extensible-Sequences" accesskey="u" rel="up">Extensible Sequences</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Iterator-Protocol-1"></a>
<h4 class="subsection">7.6.1 Iterator Protocol</h4>

<p>The iterator protocol allows subsequently accessing some or all elements
of a sequence in forward or reverse direction. Users first call
<code>make-sequence-iterator</code> to create an iteration state and
receive functions to query and mutate it. These functions allow, among
other things, moving to, retrieving or modifying elements of the
sequence. An iteration state consists of a state object, a limit object,
a from-end indicator and the following six functions to query or mutate
this state:
<a name="index-make_002dsequence_002diterator-_005bsb_002dsequence_005d"></a>
</p><dl>
<dt><a name="index-step-function"></a>Function: <strong><code>step function</code></strong> <em>sequence iterator from-end</em></dt>
<dd><p>Moves the iterator one position forward or backward in the associated
sequence depending on the iteration direction.
</p></dd></dl>
<dl>
<dt><a name="index-endp-function"></a>Function: <strong><code>endp function</code></strong> <em>sequence iterator limit from-end</em></dt>
<dd><p>Returns non-<code>nil</code> when the iterator has reached the end of the
associated sequence with respect to the iteration direction.
</p></dd></dl>
<dl>
<dt><a name="index-element-function"></a>Function: <strong><code>element function</code></strong> <em>sequence iterator</em></dt>
<dd><p>Returns the sequence element associated to the current position of the
iteration.
</p></dd></dl>
<dl>
<dt><a name="index-setf-element-function"></a>Function: <strong><code>setf element function</code></strong> <em>new-value sequence iterator</em></dt>
<dd><p>Destructively modifies the associates sequence by replacing the sequence
element associated to the current iteration position with a new value.
</p></dd></dl>
<dl>
<dt><a name="index-index-function"></a>Function: <strong><code>index function</code></strong> <em>sequence iterator</em></dt>
<dd><p>Returns the position of the iteration in the associated sequence.
</p></dd></dl>
<dl>
<dt><a name="index-copy-function"></a>Function: <strong><code>copy function</code></strong> <em>sequence iterator</em></dt>
<dd><p>Returns a copy of the iteration state which can be mutated independently
of the copied iteration state.
</p></dd></dl>

<p>An iterator is created by calling:
</p>
<a name="Generic_002dFunction-sb_002dsequence_003amake_002dsequence_002diterator"></a><dl>
<dt><a name="index-make_002dsequence_002diterator"></a>Generic Function: <strong>make-sequence-iterator</strong> <em>[sb-sequence] sequence &amp;key from-end start end</em></dt>
<dd><p>Returns a sequence iterator for <code>sequence</code> or, if <code>start</code> and/or <code>end</code>
   are supplied, the subsequence bounded by <code>start</code> and <code>end</code> as nine
   values:
</p>
<p>1. iterator state
   2. limit
   3. from-end
   4. step function
   5. endp function
   6. element function
   7. setf element function
   8. index function
   9. copy state function
</p>
<p>If <code>from-end</code> is <code>nil</code>, the constructed iterator visits the specified
   elements in the order in which they appear in <code>sequence</code>. Otherwise,
   the elements are visited in the opposite order.
</p></dd></dl>

<p>Note that <code>make-sequence-iterator</code> calls
<code>make-simple-sequence-iterator</code> when there is no specialized
method for a particular <code>sequence</code> subclass. See <a href="#Simple-Iterator-Protocol">Simple Iterator Protocol</a>.
<a name="index-make_002dsequence_002diterator-_005bsb_002dsequence_005d-1"></a>
<a name="index-make_002dsimple_002dsequence_002diterator-_005bsb_002dsequence_005d"></a>
<a name="index-sequence-_005bcl_005d-3"></a>
</p>
<p>The following convenience macros simplify traversing sequences using
iterators:
</p>
<a name="Macro-sb_002dsequence_003awith_002dsequence_002diterator"></a><dl>
<dt><a name="index-with_002dsequence_002diterator"></a>Macro: <strong>with-sequence-iterator</strong> <em>[sb-sequence] (&amp;optional iterator limit from-end-p step endp element set-element index copy) (sequence &amp;key from-end start end) &amp;body body</em></dt>
<dd><p>Executes <code>body</code> with the elements of <code>vars</code> bound to the iteration
  state returned by <code>make-sequence-iterator</code> for <code>sequence</code> and
  <code>args</code>. Elements of <code>vars</code> may be <code>nil</code> in which case the corresponding
  value returned by <code>make-sequence-iterator</code> is ignored.
</p></dd></dl>
<a name="Macro-sb_002dsequence_003awith_002dsequence_002diterator_002dfunctions"></a><dl>
<dt><a name="index-with_002dsequence_002diterator_002dfunctions"></a>Macro: <strong>with-sequence-iterator-functions</strong> <em>[sb-sequence] (step endp elt setf index copy) (sequence &amp;rest args &amp;key from-end start end) &amp;body body</em></dt>
<dd><p>Executes <code>body</code> with the names <code>step</code>, <code>endp</code>, <code>elt</code>, <code>setf</code>, <code>index</code> and <code>copy</code>
  bound to local functions which execute the iteration state query and
  mutation functions returned by <code>make-sequence-iterator</code> for <code>sequence</code>
  and <code>args</code>. <code>step</code>, <code>endp</code>, <code>elt</code>, <code>setf</code>, <code>index</code> and <code>copy</code> have dynamic
  extent.
</p></dd></dl>

<hr>
<a name="Simple-Iterator-Protocol"></a>
<div class="header">
<p>
Previous: <a href="#Iterator-Protocol" accesskey="p" rel="prev">Iterator Protocol</a>, Up: <a href="#Extensible-Sequences" accesskey="u" rel="up">Extensible Sequences</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Simple-Iterator-Protocol-1"></a>
<h4 class="subsection">7.6.2 Simple Iterator Protocol</h4>

<p>For cases in which the full flexibility and performance of the general
sequence iterator protocol is not required, there is a simplified
sequence iterator protocol consisting of a few generic functions which
can be specialized for iterator classes:
</p>
<a name="Generic_002dFunction-sb_002dsequence_003aiterator_002dstep"></a><dl>
<dt><a name="index-iterator_002dstep"></a>Generic Function: <strong>iterator-step</strong> <em>[sb-sequence] sequence iterator from-end</em></dt>
<dd><p>Moves <code>iterator</code> one position forward or backward in <code>sequence</code>
   depending on the iteration direction encoded in <code>from-end</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dsequence_003aiterator_002dendp"></a><dl>
<dt><a name="index-iterator_002dendp"></a>Generic Function: <strong>iterator-endp</strong> <em>[sb-sequence] sequence iterator limit from-end</em></dt>
<dd><p>Returns non-NIL when <code>iterator</code> has reached <code>limit</code> (which may
   correspond to the end of SEQUENCE) with respect to the iteration
   direction encoded in <code>from-end</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dsequence_003aiterator_002delement"></a><dl>
<dt><a name="index-iterator_002delement"></a>Generic Function: <strong>iterator-element</strong> <em>[sb-sequence] sequence iterator</em></dt>
<dd><p>Returns the element of <code>sequence</code> associated to the position of
   <code>iterator</code>.
</p></dd></dl>
<a name="Generic_002dFunction-_0028setf-sb_002dsequence_003aiterator_002delement_0029"></a><dl>
<dt><a name="index-_0028setf-1"></a>Generic Function: <strong>(setf</strong> <em>iterator-element [sb-sequence])</em></dt>
<dd><p>Destructively modifies <code>sequence</code> by replacing the sequence element
   associated to position of <code>iterator</code> with <code>new-value</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dsequence_003aiterator_002dindex"></a><dl>
<dt><a name="index-iterator_002dindex"></a>Generic Function: <strong>iterator-index</strong> <em>[sb-sequence] sequence iterator</em></dt>
<dd><p>Returns the position of <code>iterator</code> in <code>sequence</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dsequence_003aiterator_002dcopy"></a><dl>
<dt><a name="index-iterator_002dcopy"></a>Generic Function: <strong>iterator-copy</strong> <em>[sb-sequence] sequence iterator</em></dt>
<dd><p>Returns a copy of <code>iterator</code> which also traverses <code>sequence</code> but can
   be mutated independently of <code>iterator</code>.
</p></dd></dl>

<p>Iterator objects implementing the above simple iteration protocol are
created by calling the following generic function:
</p>
<a name="Generic_002dFunction-sb_002dsequence_003amake_002dsimple_002dsequence_002diterator"></a><dl>
<dt><a name="index-make_002dsimple_002dsequence_002diterator"></a>Generic Function: <strong>make-simple-sequence-iterator</strong> <em>[sb-sequence] sequence &amp;key from-end start end</em></dt>
<dd><p>Returns a sequence iterator for <code>sequence</code>, <code>start</code>, <code>end</code> and <code>from-end</code>
   as three values:
</p>
<p>1. iterator state
   2. limit
   3. from-end
</p>
<p>The returned iterator can be used with the generic iterator
   functions <code>iterator-step</code>, <code>iterator-endp</code>, <code>iterator-element</code>, (SETF
   ITERATOR-ELEMENT), <code>iterator-index</code> and <code>iterator-copy</code>.
</p></dd></dl>

<hr>
<a name="Support-For-Unix"></a>
<div class="header">
<p>
Next: <a href="#Unicode-Support" accesskey="n" rel="next">Unicode Support</a>, Previous: <a href="#Extensible-Sequences" accesskey="p" rel="prev">Extensible Sequences</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Support-For-Unix-1"></a>
<h3 class="section">7.7 Support For Unix</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Command_002dline-arguments" accesskey="1">Command-line arguments</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Querying-the-process-environment" accesskey="2">Querying the process environment</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Running-external-programs" accesskey="3">Running external programs</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Command_002dline-arguments"></a>
<div class="header">
<p>
Next: <a href="#Querying-the-process-environment" accesskey="n" rel="next">Querying the process environment</a>, Up: <a href="#Support-For-Unix" accesskey="u" rel="up">Support For Unix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Command_002dline-arguments-1"></a>
<h4 class="subsection">7.7.1 Command-line arguments</h4>
<a name="index-_002aposix_002dargv_002a-_005bsb_002dext_005d-1"></a>

<p>The UNIX command line can be read from the variable
<code>sb-ext:*posix-argv*</code>.
</p>
<hr>
<a name="Querying-the-process-environment"></a>
<div class="header">
<p>
Next: <a href="#Running-external-programs" accesskey="n" rel="next">Running external programs</a>, Previous: <a href="#Command_002dline-arguments" accesskey="p" rel="prev">Command-line arguments</a>, Up: <a href="#Support-For-Unix" accesskey="u" rel="up">Support For Unix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Querying-the-process-environment-1"></a>
<h4 class="subsection">7.7.2 Querying the process environment</h4>

<p>The UNIX environment can be queried with the
<code>sb-ext:posix-getenv</code> function.
</p>
<a name="Function-sb_002dext_003aposix_002dgetenv"></a><dl>
<dt><a name="index-posix_002dgetenv"></a>Function: <strong>posix-getenv</strong> <em>[sb-ext] name</em></dt>
<dd><p>Return the &quot;value&quot; part of the environment string &quot;name=value&quot; which
corresponds to <code>name</code>, or <code>nil</code> if there is none.
</p></dd></dl>

<hr>
<a name="Running-external-programs"></a>
<div class="header">
<p>
Previous: <a href="#Querying-the-process-environment" accesskey="p" rel="prev">Querying the process environment</a>, Up: <a href="#Support-For-Unix" accesskey="u" rel="up">Support For Unix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Running-external-programs-1"></a>
<h4 class="subsection">7.7.3 Running external programs</h4>

<p>External programs can be run with <code>sb-ext:run-program</code>.
<a name="DOCF7" href="#FOOT7"><sup>7</sup></a>
</p>
<a name="Function-sb_002dext_003arun_002dprogram"></a><dl>
<dt><a name="index-run_002dprogram"></a>Function: <strong>run-program</strong> <em>[sb-ext] program args &amp;key env environment wait search pty input if-input-does-not-exist output if-output-exists error if-error-exists status-hook external-format directory</em></dt>
<dd><p><code>run-program</code> creates a new process specified by <code>program</code>.
<code>args</code> are passed as the arguments to the program.
</p>
<p>The program arguments and the environment are encoded using the
default external format for streams.
</p>
<p><code>run-program</code> will return a <code>process</code> structure. See the <code>cmu</code> Common Lisp
Users Manual for details about the <code>process</code> structure.
</p>
<p>Notes about Unix environments (as in the <code>:environment</code> and <code>:env</code> args):
</p>
<ul>
<li> The <code>sbcl</code> implementation of <code>run-program</code>, like Perl and many other
     programs, but unlike the original <code>cmu</code> <code>cl</code> implementation, copies
     the Unix environment by default.
</li><li> Running Unix programs from a setuid process, or in any other
     situation where the Unix environment is under the control of someone
     else, is a mother lode of security problems. If you are contemplating
     doing this, read about it first. (The Perl community has a lot of good
     documentation about this and other security issues in script-like
     programs.)

</li></ul>

<dl compact="compact">
<dt><em>The <code>&amp;key</code> arguments have the following meanings:</em></dt>
<dt><em><code>:environment</code></em></dt>
<dd><p>a list of STRINGs describing the new Unix environment
      (as in &quot;man environ&quot;). The default is to copy the environment of
      the current process.
</p>
</dd>
<dt><em><code>:env</code></em></dt>
<dd><p>an alternative lossy representation of the new Unix environment,
      for compatibility with <code>cmu</code> <code>cl</code>
</p>
</dd>
<dt><em><code>:search</code></em></dt>
<dd><p>Look for <code>program</code> in each of the directories in the child&rsquo;s $PATH
      environment variable.  Otherwise an absolute pathname is required.
</p>
</dd>
<dt><em><code>:wait</code></em></dt>
<dd><p>If non-NIL (default), wait until the created process finishes.  If
      <code>nil</code>, continue running Lisp until the program finishes.
</p>
</dd>
<dt><em><code>:pty</code> (not supported on win32)</em></dt>
<dd><p>Either <code>t</code>, <code>nil</code>, or a stream.  Unless <code>nil</code>, the subprocess is established
      under a <code>pty</code>.  If :pty is a stream, all output to this pty is sent to
      this stream, otherwise the <code>process-pty</code> slot is filled in with a stream
      connected to pty that can read output and write input.
</p>
</dd>
<dt><em><code>:input</code></em></dt>
<dd><p>Either <code>t</code>, <code>nil</code>, a pathname, a stream, or <code>:stream</code>.
      <code>t:</code> the standard input for the current process is inherited.
      <code>nil:</code> /dev/null (nul on win32) is used.
      pathname: the specified file is used.
      stream: all the input is read from that stream and sent to the
      subprocess.
      <code>:stream:</code> the <code>process-input</code> slot is filled in with a stream that sends
      its output to the process.
      Defaults to <code>nil</code>.
</p>
</dd>
<dt><em><code>:if-input-does-not-exist</code> (when <code>:input</code> is the name of a file)</em></dt>
<dd><p>can be one of:
         <code>:error</code> to generate an error
         <code>:create</code> to create an empty file
         <code>nil</code> (the default) to return <code>nil</code> from <code>run-program</code>
</p>
</dd>
<dt><em><code>:output</code></em></dt>
<dd><p>Either <code>t</code>, <code>nil</code>, a pathname, a stream, or <code>:stream</code>.
      <code>t:</code> the standard output for the current process is inherited.
      <code>nil:</code> /dev/null (nul on win32) is used.
      pathname: the specified file is used.
      stream: all the output from the process is written to this stream.
      <code>:stream:</code> the <code>process-output</code> slot is filled in with a stream that can be
      read to get the output.
      Defaults to <code>nil</code>.
</p>
</dd>
<dt><em><code>:error</code></em></dt>
<dd><p>Same as <code>:output</code>, additionally accepts <code>:output</code>, making all error
      output routed to the same place as normal output.
      Defaults to <code>:output</code>.
</p>
</dd>
<dt><em><code>:if-output-exists</code> (when <code>:output</code> is the name of a file)</em></dt>
<dd><p>can be one of:
         <code>:error</code> (the default) to generate an error
         <code>:supersede</code> to supersede the file with output from the program
         <code>:append</code> to append output from the program to the file
         <code>nil</code> to return <code>nil</code> from <code>run-program</code>, without doing anything
</p>
</dd>
<dt><em><code>:if-error-exists</code></em></dt>
<dd><p>Same as <code>:if-output-exists</code>, controlling <code>:error</code> output to files.
      Ignored when <code>:error</code> <code>:output</code>.
      Defaults to <code>:error</code>.
</p>
</dd>
<dt><em><code>:status-hook</code></em></dt>
<dd><p>This is a function the system calls whenever the status of the
      process changes.  The function takes the process as an argument.
</p>
</dd>
<dt><em><code>:external-format</code></em></dt>
<dd><p>The external-format to use for <code>:input</code>, <code>:output</code>, and <code>:error</code> :STREAMs.
</p>
</dd>
<dt><em><code>:directory</code></em></dt>
<dd><p>Specifies the directory in which the program should be run.
      <code>nil</code> (the default) means the directory is unchanged.
</p>

</dd>
<dt><em>Windows specific options:</em></dt>
<dt><em><code>:escape-arguments</code> (default T)</em></dt>
<dd><p>Controls escaping of the arguments passed to CreateProcess.
</p></dd>
</dl>

</dd></dl>

<p>When <code>sb-ext:run-program</code> is called with <code>wait</code> equal to
NIL, an instance of class <var>sb-ext:process</var> is returned.  The
following functions are available for use with processes:
</p>
<a name="Function-sb_002dext_003aprocess_002dp"></a><dl>
<dt><a name="index-process_002dp"></a>Function: <strong>process-p</strong> <em>[sb-ext] object</em></dt>
<dd><p><code>t</code> if <code>object</code> is a <code>process</code>, <code>nil</code> otherwise.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002dinput"></a><dl>
<dt><a name="index-process_002dinput"></a>Function: <strong>process-input</strong> <em>[sb-ext] instance</em></dt>
<dd><p>The input stream of the process or <code>nil</code>.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002doutput"></a><dl>
<dt><a name="index-process_002doutput"></a>Function: <strong>process-output</strong> <em>[sb-ext] instance</em></dt>
<dd><p>The output stream of the process or <code>nil</code>.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002derror"></a><dl>
<dt><a name="index-process_002derror"></a>Function: <strong>process-error</strong> <em>[sb-ext] instance</em></dt>
<dd><p>The error stream of the process or <code>nil</code>.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002dalive_002dp"></a><dl>
<dt><a name="index-process_002dalive_002dp"></a>Function: <strong>process-alive-p</strong> <em>[sb-ext] process</em></dt>
<dd><p>Return <code>t</code> if <code>process</code> is still alive, <code>nil</code> otherwise.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002dstatus"></a><dl>
<dt><a name="index-process_002dstatus"></a>Function: <strong>process-status</strong> <em>[sb-ext] process</em></dt>
<dd><p>Return the current status of <code>process</code>.  The result is one of <code>:running</code>,
   <code>:stopped</code>, <code>:exited</code>, or <code>:signaled</code>.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002dwait"></a><dl>
<dt><a name="index-process_002dwait"></a>Function: <strong>process-wait</strong> <em>[sb-ext] process &amp;optional check-for-stopped</em></dt>
<dd><p>Wait for <code>process</code> to quit running for some reason. When
<code>check-for-stopped</code> is <code>t</code>, also returns when <code>process</code> is stopped. Returns
<code>process</code>.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002dexit_002dcode"></a><dl>
<dt><a name="index-process_002dexit_002dcode"></a>Function: <strong>process-exit-code</strong> <em>[sb-ext] process</em></dt>
<dd><p>The exit code or the signal of a stopped process.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002dcore_002ddumped"></a><dl>
<dt><a name="index-process_002dcore_002ddumped"></a>Function: <strong>process-core-dumped</strong> <em>[sb-ext] instance</em></dt>
<dd><p><code>t</code> if a core image was dumped by the process.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002dclose"></a><dl>
<dt><a name="index-process_002dclose"></a>Function: <strong>process-close</strong> <em>[sb-ext] process</em></dt>
<dd><p>Close all streams connected to <code>process</code> and stop maintaining the
status slot.
</p></dd></dl>

<a name="Function-sb_002dext_003aprocess_002dkill"></a><dl>
<dt><a name="index-process_002dkill"></a>Function: <strong>process-kill</strong> <em>[sb-ext] process signal &amp;optional whom</em></dt>
<dd><p>Hand <code>signal</code> to <code>process</code>. If <code>whom</code> is <code>:pid</code>, use the kill Unix system call. If
   <code>whom</code> is <code>:process-group</code>, use the killpg Unix system call. If <code>whom</code> is
   <code>:pty-process-group</code> deliver the signal to whichever process group is
   currently in the foreground.
</p></dd></dl>

<hr>
<a name="Unicode-Support"></a>
<div class="header">
<p>
Next: <a href="#Customization-Hooks-for-Users" accesskey="n" rel="next">Customization Hooks for Users</a>, Previous: <a href="#Support-For-Unix" accesskey="p" rel="prev">Support For Unix</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Unicode-Support-1"></a>
<h3 class="section">7.8 Unicode Support</h3>

<p>SBCL provides support for working with Unicode text and querying the
standard Unicode database for information about individual codepoints.
Unicode-related functions are located in the <code>sb-unicode</code> package.
</p>
<p>SBCL also extends ANSI character literal syntax to support Unicode
codepoints. You can either specify a character by its Unicode name, with
spaces replaced by underscores, if a unique name exists <a name="DOCF8" href="#FOOT8"><sup>8</sup></a> or
by giving its hexadecimal codepoint preceded by a &ldquo;U&rdquo;, an optional
&ldquo;+&rdquo;, and an arbitrary number of leading zeros. You may also input the
character directly into your source code if it can be encoded in your
file. If a character had an assigned name in Unicode 1.0 that was
distinct from its current name, you may also use that name (with spaces
replaced by underscores) to specify the character, unless the name is
already associated with a codepoint in the latest Unicode standard (such
as &ldquo;BELL&rdquo;).
</p>
<p>For example, you can specify the codepoint U+00E1 (&ldquo;Latin
Small Letter A With Acute&rdquo;) as
</p><ul>
<li> <code>#\LATIN_SMALL_LETTER_A_WITH_ACUTE</code>
</li><li> <code>#\LATIN_SMALL_LETTER_A_ACUTE</code>
</li><li> <code>#\á</code> assuming a Unicode source file
</li><li> <code>#\U00E1</code>
</li><li> <code>#\UE1</code>
</li><li> <code>#\U+00E1</code>
</li></ul>

<a name="Unicode-property-access"></a>
<h4 class="subsection">7.8.1 Unicode property access</h4>

<p>The following functions can be used to find information about a Unicode
codepoint.
</p>
<a name="Function-sb_002dunicode_003ageneral_002dcategory"></a><dl>
<dt><a name="index-general_002dcategory"></a>Function: <strong>general-category</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the general category of <code>character</code> as it appears in UnicodeData.txt
</p></dd></dl>

<a name="Function-sb_002dunicode_003abidi_002dclass"></a><dl>
<dt><a name="index-bidi_002dclass"></a>Function: <strong>bidi-class</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the bidirectional class of <code>character</code>
</p></dd></dl>

<a name="Function-sb_002dunicode_003acombining_002dclass"></a><dl>
<dt><a name="index-combining_002dclass"></a>Function: <strong>combining-class</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the canonical combining class (CCC) of <code>character</code>
</p></dd></dl>

<a name="Function-sb_002dunicode_003adecimal_002dvalue"></a><dl>
<dt><a name="index-decimal_002dvalue"></a>Function: <strong>decimal-value</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the decimal digit value associated with <code>character</code> or <code>nil</code> if
there is no such value.
</p>
<p>The only characters in Unicode with a decimal digit value are those
that are part of a range of characters that encode the digits 0-9.
Because of this, &lsquo;(decimal-digit c) &lt;=&gt; (digit-char-p c 10)&lsquo; in
#+sb-unicode builds
</p></dd></dl>

<a name="Function-sb_002dunicode_003adigit_002dvalue"></a><dl>
<dt><a name="index-digit_002dvalue"></a>Function: <strong>digit-value</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the Unicode digit value of <code>character</code> or <code>nil</code> if it doesn&rsquo;t exist.
</p>
<p>Digit values are guaranteed to be integers between 0 and 9 inclusive.
All characters with decimal digit values have the same digit value,
but there are characters (such as digits of number systems without a 0 value)
that have a digit value but no decimal digit value
</p></dd></dl>

<a name="Function-sb_002dunicode_003anumeric_002dvalue"></a><dl>
<dt><a name="index-numeric_002dvalue"></a>Function: <strong>numeric-value</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the numeric value of <code>character</code> or <code>nil</code> if there is no such value.
Numeric value is the most general of the Unicode numeric properties.
The only constraint on the numeric value is that it be a rational number.
</p></dd></dl>

<a name="Function-sb_002dunicode_003amirrored_002dp"></a><dl>
<dt><a name="index-mirrored_002dp"></a>Function: <strong>mirrored-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> needs to be mirrored in bidirectional text.
Otherwise, returns <code>nil</code>.
</p></dd></dl>

<a name="Function-sb_002dunicode_003abidi_002dmirroring_002dglyph"></a><dl>
<dt><a name="index-bidi_002dmirroring_002dglyph"></a>Function: <strong>bidi-mirroring-glyph</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the mirror image of <code>character</code> if it exists.
Otherwise, returns <code>nil</code>.
</p></dd></dl>

<a name="Function-sb_002dunicode_003aage"></a><dl>
<dt><a name="index-age"></a>Function: <strong>age</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the version of Unicode in which <code>character</code> was assigned as a pair
of values, both integers, representing the major and minor version respectively.
If <code>character</code> is not assigned in Unicode, returns <code>nil</code> for both values.
</p></dd></dl>

<a name="Function-sb_002dunicode_003ahangul_002dsyllable_002dtype"></a><dl>
<dt><a name="index-hangul_002dsyllable_002dtype"></a>Function: <strong>hangul-syllable-type</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the Hangul syllable type of <code>character</code>.
The syllable type can be one of <code>:l</code>, <code>:v</code>, <code>:t</code>, <code>:lv</code>, or <code>:lvt</code>.
If the character is not a Hangul syllable or Jamo, returns <code>nil</code>
</p></dd></dl>

<a name="Function-sb_002dunicode_003aeast_002dasian_002dwidth"></a><dl>
<dt><a name="index-east_002dasian_002dwidth"></a>Function: <strong>east-asian-width</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the East Asian Width property of <code>character</code> as
one of the keywords <code>:n</code> (Narrow), <code>:a</code> (Ambiguous), <code>:h</code> (Halfwidth),
<code>:w</code> (Wide), <code>:f</code> (Fullwidth), or <code>:na</code> (Not applicable)
</p></dd></dl>

<a name="Function-sb_002dunicode_003ascript"></a><dl>
<dt><a name="index-script"></a>Function: <strong>script</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the Script property of <code>character</code> as a keyword.
If <code>character</code> does not have a known script, returns <code>:unknown</code>
</p></dd></dl>

<a name="Function-sb_002dunicode_003achar_002dblock"></a><dl>
<dt><a name="index-char_002dblock"></a>Function: <strong>char-block</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the Unicode block in which <code>character</code> resides as a keyword.
If <code>character</code> does not have a known block, returns <code>:no-block</code>
</p></dd></dl>

<a name="Function-sb_002dunicode_003aunicode_002d1_002dname"></a><dl>
<dt><a name="index-unicode_002d1_002dname"></a>Function: <strong>unicode-1-name</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns the name assigned to <code>character</code> in Unicode 1.0 if it is distinct
from the name currently assigned to <code>character</code>. Otherwise, returns <code>nil</code>.
This property has been officially obsoleted by the Unicode standard, and
is only included for backwards compatibility.
</p></dd></dl>

<a name="Function-sb_002dunicode_003aproplist_002dp"></a><dl>
<dt><a name="index-proplist_002dp"></a>Function: <strong>proplist-p</strong> <em>[sb-unicode] character property</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> has the specified <code>property</code>.
<code>property</code> is a keyword representing one of the properties from PropList.txt,
with underscores replaced by dashes.
</p></dd></dl>

<a name="Function-sb_002dunicode_003auppercase_002dp"></a><dl>
<dt><a name="index-uppercase_002dp"></a>Function: <strong>uppercase-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> has the Unicode property Uppercase and <code>nil</code> otherwise
</p></dd></dl>

<a name="Function-sb_002dunicode_003alowercase_002dp"></a><dl>
<dt><a name="index-lowercase_002dp"></a>Function: <strong>lowercase-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> has the Unicode property Lowercase and <code>nil</code> otherwise
</p></dd></dl>

<a name="Function-sb_002dunicode_003acased_002dp"></a><dl>
<dt><a name="index-cased_002dp"></a>Function: <strong>cased-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> has a (Unicode) case, and <code>nil</code> otherwise
</p></dd></dl>

<a name="Function-sb_002dunicode_003acase_002dignorable_002dp"></a><dl>
<dt><a name="index-case_002dignorable_002dp"></a>Function: <strong>case-ignorable-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> is Case Ignorable as defined in Unicode 6.3, Chapter
3
</p></dd></dl>

<a name="Function-sb_002dunicode_003aalphabetic_002dp"></a><dl>
<dt><a name="index-alphabetic_002dp"></a>Function: <strong>alphabetic-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> is Alphabetic according to the Unicode standard
and <code>nil</code> otherwise
</p></dd></dl>

<a name="Function-sb_002dunicode_003aideographic_002dp"></a><dl>
<dt><a name="index-ideographic_002dp"></a>Function: <strong>ideographic-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> has the Unicode property Ideographic,
which loosely corresponds to the set of &quot;Chinese characters&quot;
</p></dd></dl>

<a name="Function-sb_002dunicode_003amath_002dp"></a><dl>
<dt><a name="index-math_002dp"></a>Function: <strong>math-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> is a mathematical symbol according to Unicode and
<code>nil</code> otherwise
</p></dd></dl>

<a name="Function-sb_002dunicode_003awhitespace_002dp"></a><dl>
<dt><a name="index-whitespace_002dp"></a>Function: <strong>whitespace-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> is whitespace according to Unicode
and <code>nil</code> otherwise
</p></dd></dl>

<a name="Function-sb_002dunicode_003asoft_002ddotted_002dp"></a><dl>
<dt><a name="index-soft_002ddotted_002dp"></a>Function: <strong>soft-dotted-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> has a soft dot (such as the dots on i and j) which
disappears when accents are placed on top of it. and <code>nil</code> otherwise
</p></dd></dl>

<a name="Function-sb_002dunicode_003ahex_002ddigit_002dp"></a><dl>
<dt><a name="index-hex_002ddigit_002dp"></a>Function: <strong>hex-digit-p</strong> <em>[sb-unicode] character &amp;key ascii</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> is a hexadecimal digit and <code>nil</code> otherwise.
If <code>:ascii</code> is non-NIL, fullwidth equivalents of the Latin letters A through <code>f</code>
are excluded.
</p></dd></dl>

<a name="Function-sb_002dunicode_003adefault_002dignorable_002dp"></a><dl>
<dt><a name="index-default_002dignorable_002dp"></a>Function: <strong>default-ignorable-p</strong> <em>[sb-unicode] character</em></dt>
<dd><p>Returns <code>t</code> if <code>character</code> is a Default_Ignorable_Code_Point
</p></dd></dl>

<a name="Function-sb_002dunicode_003agrapheme_002dbreak_002dclass"></a><dl>
<dt><a name="index-grapheme_002dbreak_002dclass"></a>Function: <strong>grapheme-break-class</strong> <em>[sb-unicode] char</em></dt>
<dd><p>Returns the grapheme breaking class of <code>character</code>, as specified in <code>uax</code> #29.
</p></dd></dl>

<a name="Function-sb_002dunicode_003aword_002dbreak_002dclass"></a><dl>
<dt><a name="index-word_002dbreak_002dclass"></a>Function: <strong>word-break-class</strong> <em>[sb-unicode] char</em></dt>
<dd><p>Returns the word breaking class of <code>character</code>, as specified in <code>uax</code> #29.
</p></dd></dl>

<a name="Function-sb_002dunicode_003asentence_002dbreak_002dclass"></a><dl>
<dt><a name="index-sentence_002dbreak_002dclass"></a>Function: <strong>sentence-break-class</strong> <em>[sb-unicode] char</em></dt>
<dd><p>Returns the sentence breaking class of <code>character</code>, as specified in <code>uax</code> #29.
</p></dd></dl>

<a name="Function-sb_002dunicode_003aline_002dbreak_002dclass"></a><dl>
<dt><a name="index-line_002dbreak_002dclass"></a>Function: <strong>line-break-class</strong> <em>[sb-unicode] character &amp;key resolve</em></dt>
<dd><p>Returns the line breaking class of <code>character</code>, as specified in <code>uax</code> #14.
If <code>:resolve</code> is <code>nil</code>, returns the character class found in the property file.
If <code>:resolve</code> is non-NIL, centain line-breaking classes will be mapped to othec
classes as specified in the applicable standards. Addinionally, if <code>:resolve</code>
is <code>:east-asian</code>, Ambigious (class :AI) characters will be mapped to the
Ideographic (:ID) class instead of Alphabetic (:AL).
</p></dd></dl>

<a name="String-operations"></a>
<h4 class="subsection">7.8.2 String operations</h4>

<p>SBCL can normalize strings using:
</p>
<a name="Function-sb_002dunicode_003anormalize_002dstring"></a><dl>
<dt><a name="index-normalize_002dstring"></a>Function: <strong>normalize-string</strong> <em>[sb-unicode] string &amp;optional form filter</em></dt>
<dd><p>Normalize <code>string</code> to the Unicode normalization form form.
Acceptable values for form are <code>:nfd</code>, <code>:nfc</code>, <code>:nfkd</code>, and <code>:nfkc</code>.
If <code>filter</code> is a function it is called on each decomposed character and
only characters for which it returns <code>t</code> are collected.
</p></dd></dl>

<a name="Function-sb_002dunicode_003anormalized_002dp"></a><dl>
<dt><a name="index-normalized_002dp"></a>Function: <strong>normalized-p</strong> <em>[sb-unicode] string &amp;optional form</em></dt>
<dd><p>Tests if <code>string</code> is normalized to <code>form</code>
</p></dd></dl>

<p>SBCL implements the full range of Unicode case operations with the
functions
</p>
<a name="Function-sb_002dunicode_003auppercase"></a><dl>
<dt><a name="index-uppercase"></a>Function: <strong>uppercase</strong> <em>[sb-unicode] string &amp;key locale</em></dt>
<dd><p>Returns the full uppercase of <code>string</code> according to the Unicode standard.
The result is not guaranteed to have the same length as the input. If <code>:locale</code>
is <code>nil</code>, no language-specific case transformations are applied. If <code>:locale</code> is a
keyword representing a two-letter <code>iso</code> country code, the case transforms of that
locale are used. If <code>:locale</code> is <code>t</code>, the user&rsquo;s current locale is used (Unix and
Win32 only).
</p></dd></dl>

<a name="Function-sb_002dunicode_003alowercase"></a><dl>
<dt><a name="index-lowercase"></a>Function: <strong>lowercase</strong> <em>[sb-unicode] string &amp;key locale</em></dt>
<dd><p>Returns the full lowercase of <code>string</code> according to the Unicode standard.
The result is not guaranteed to have the same length as the input.
<code>:locale</code> has the same semantics as the <code>:locale</code> argument to <code>uppercase</code>.
</p></dd></dl>

<a name="Function-sb_002dunicode_003atitlecase"></a><dl>
<dt><a name="index-titlecase"></a>Function: <strong>titlecase</strong> <em>[sb-unicode] string &amp;key locale</em></dt>
<dd><p>Returns the titlecase of <code>string</code>. The resulting string can
be longer than the input.
<code>:locale</code> has the same semantics as the <code>:locale</code> argument to <code>uppercase</code>.
</p></dd></dl>

<a name="Function-sb_002dunicode_003acasefold"></a><dl>
<dt><a name="index-casefold"></a>Function: <strong>casefold</strong> <em>[sb-unicode] string</em></dt>
<dd><p>Returns the full casefolding of <code>string</code> according to the Unicode standard.
Casefolding removes case information in a way that allows the results to be used
for case-insensitive comparisons.
The result is not guaranteed to have the same length as the input.
</p></dd></dl>

<p>It also extends standard Common Lisp case functions such as
<a name="index-string_002dupcase-_005bcl_005d"></a>
<code>string-upcase</code> and
<a name="index-char_002ddowncase-_005bcl_005d"></a>
<code>string-downcase</code> to support a subset of Unicode&rsquo;s casing behavior.
Specifically, a character is
<a name="index-both_002dcase_002dp-_005bcl_005d"></a>
<code>both-case-p</code> if its case mapping in Unicode is one-to-one and
invertable.
</p>
<p>The <code>sb-unicode</code> package also provides functions for
collating/sorting strings according to the Unicode Collation Algorithm.
</p>
<a name="Function-sb_002dunicode_003aunicode_003c"></a><dl>
<dt><a name="index-unicode_003c"></a>Function: <strong>unicode&lt;</strong> <em>[sb-unicode] string1 string2 &amp;key start1 end1 start2 end2</em></dt>
<dd><p>Determines whether STRING1 sorts before STRING2 using the Unicode Collation
Algorithm, The function uses an untailored Default Unicode Collation Element Table
to produce the sort keys. The function uses the Shifted method for dealing
with variable-weight characters, as described in <code>uts</code> #10
</p></dd></dl>

<a name="Function-sb_002dunicode_003aunicode_003d"></a><dl>
<dt><a name="index-unicode_003d"></a>Function: <strong>unicode=</strong> <em>[sb-unicode] string1 string2 &amp;key start1 end1 start2 end2 strict</em></dt>
<dd><p>Determines whether STRING1 and STRING2 are canonically equivalent according
to Unicode. The <code>start</code> and <code>end</code> arguments behave like the arguments to STRING=.
If <code>:strict</code> is <code>nil</code>, UNICODE= tests compatibility equavalence instead.
</p></dd></dl>

<a name="Function-sb_002dunicode_003aunicode_002dequal"></a><dl>
<dt><a name="index-unicode_002dequal"></a>Function: <strong>unicode-equal</strong> <em>[sb-unicode] string1 string2 &amp;key start1 end1 start2 end2 strict</em></dt>
<dd><p>Determines whether STRING1 and STRING2 are canonically equivalent after
casefoldin8 (that is, ignoring case differences) according to Unicode. The
<code>start</code> and <code>end</code> arguments behave like the arguments to STRING=. If <code>:strict</code> is
<code>nil</code>, UNICODE= tests compatibility equavalence instead.
</p></dd></dl>

<a name="Function-sb_002dunicode_003aunicode_003c_003d"></a><dl>
<dt><a name="index-unicode_003c_003d"></a>Function: <strong>unicode&lt;=</strong> <em>[sb-unicode] string1 string2 &amp;key start1 end1 start2 end2</em></dt>
<dd><p>Tests if STRING1 and STRING2 are either UNICODE&lt; or UNICODE=
</p></dd></dl>

<a name="Function-sb_002dunicode_003aunicode_003e"></a><dl>
<dt><a name="index-unicode_003e"></a>Function: <strong>unicode&gt;</strong> <em>[sb-unicode] string1 string2 &amp;key start1 end1 start2 end2</em></dt>
<dd><p>Tests if STRING2 is UNICODE&lt; STRING1.
</p></dd></dl>

<a name="Function-sb_002dunicode_003aunicode_003e_003d"></a><dl>
<dt><a name="index-unicode_003e_003d"></a>Function: <strong>unicode&gt;=</strong> <em>[sb-unicode] string1 string2 &amp;key start1 end1 start2 end2</em></dt>
<dd><p>Tests if STRING1 and STRING2 are either UNICODE= or UNICODE&gt;
</p></dd></dl>

<p>The following functions are provided for detecting visually confusable strings:
</p>
<a name="Function-sb_002dunicode_003aconfusable_002dp"></a><dl>
<dt><a name="index-confusable_002dp"></a>Function: <strong>confusable-p</strong> <em>[sb-unicode] string1 string2 &amp;key start1 end1 start2 end2</em></dt>
<dd><p>Determines whether STRING1 and STRING2 could be visually confusable
according to the <code>idna</code> confusableSummary.txt table
</p></dd></dl>

<a name="Breaking-strings"></a>
<h4 class="subsection">7.8.3 Breaking strings</h4>

<p>The <code>sb-unicode</code> package includes several functions for breaking a
Unicode string into useful parts.
</p>
<a name="Function-sb_002dunicode_003agraphemes"></a><dl>
<dt><a name="index-graphemes"></a>Function: <strong>graphemes</strong> <em>[sb-unicode] string</em></dt>
<dd><p>Breaks <code>string</code> into graphemes acording to the default
grapheme breaking rules specified in <code>uax</code> #29, returning a list of strings.
</p></dd></dl>

<a name="Function-sb_002dunicode_003awords"></a><dl>
<dt><a name="index-words"></a>Function: <strong>words</strong> <em>[sb-unicode] string</em></dt>
<dd><p>Breaks <code>string</code> into words acording to the default
word breaking rules specified in <code>uax</code> #29. Returns a list of strings
</p></dd></dl>

<a name="Function-sb_002dunicode_003asentences"></a><dl>
<dt><a name="index-sentences"></a>Function: <strong>sentences</strong> <em>[sb-unicode] string</em></dt>
<dd><p>Breaks <code>string</code> into sentences acording to the default
sentence breaking rules specified in <code>uax</code> #29
</p></dd></dl>

<a name="Function-sb_002dunicode_003alines"></a><dl>
<dt><a name="index-lines"></a>Function: <strong>lines</strong> <em>[sb-unicode] string &amp;key margin</em></dt>
<dd><p>Breaks <code>string</code> into lines that are no wider than <code>:margin</code> according to the
line breaking rules outlined in <code>uax</code> #14. Combining marks will always be kept
together with their base characters, and spaces (but not other types of
whitespace) will be removed from the end of lines. If <code>:margin</code> is unspecified,
it defaults to 80 characters
</p></dd></dl>

<hr>
<a name="Customization-Hooks-for-Users"></a>
<div class="header">
<p>
Next: <a href="#Tools-To-Help-Developers" accesskey="n" rel="next">Tools To Help Developers</a>, Previous: <a href="#Unicode-Support" accesskey="p" rel="prev">Unicode Support</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Customization-Hooks-for-Users-1"></a>
<h3 class="section">7.9 Customization Hooks for Users</h3>

<p>The toplevel repl prompt may be customized, and the function
that reads user input may be replaced completely.
</p>
<p>The behaviour of <code>require</code> when called with only one argument is
implementation-defined.  In SBCL, <code>require</code> behaves in the
following way:
</p>
<a name="Function-common_002dlisp_003arequire"></a><dl>
<dt><a name="index-require"></a>Function: <strong>require</strong> <em>[cl] module-name &amp;optional pathnames</em></dt>
<dd><p>Loads a module, unless it already has been loaded. <code>pathnames</code>, if supplied,
   is a designator for a list of pathnames to be loaded if the module
   needs to be. If <code>pathnames</code> is not supplied, functions from the list
   <code>*module-provider-functions*</code> are called in order with <code>module-name</code>
   as an argument, until one of them returns non-NIL.  User code is
   responsible for calling <code>provide</code> to indicate a successful load of the
   module.
</p></dd></dl>
<a name="Variable-sb_002dext_003a_002amodule_002dprovider_002dfunctions_002a"></a><dl>
<dt><a name="index-_002amodule_002dprovider_002dfunctions_002a"></a>Variable: <strong>*module-provider-functions*</strong> <em>[sb-ext]</em></dt>
<dd><p>See function documentation for <code>require</code>.
</p></dd></dl>

<p>Although SBCL does not provide a resident editor, the <code>ed</code>
function can be customized to hook into user-provided editing
mechanisms as follows:
</p>
<a name="Function-common_002dlisp_003aed"></a><dl>
<dt><a name="index-ed"></a>Function: <strong>ed</strong> <em>[cl] &amp;optional x</em></dt>
<dd><p>Starts the editor (on a file or a function if named).  Functions
from the list <code>*ed-functions*</code> are called in order with <code>x</code> as an argument
until one of them returns non-NIL; these functions are responsible for
signalling a <code>file-error</code> to indicate failure to perform an operation on
the file system.
</p></dd></dl>
<a name="Variable-sb_002dext_003a_002aed_002dfunctions_002a"></a><dl>
<dt><a name="index-_002aed_002dfunctions_002a"></a>Variable: <strong>*ed-functions*</strong> <em>[sb-ext]</em></dt>
<dd><p>See function documentation for <code>ed</code>.
</p></dd></dl>

<p>Conditions of type <code>warning</code> and <code>style-warning</code> are
sometimes signaled at runtime, especially during execution of Common
Lisp defining forms such as <code>defun</code>, <code>defmethod</code>, etc.  To
muffle these warnings at runtime, SBCL provides a variable
<code>sb-ext:*muffled-warnings*</code>:
</p>
<a name="Variable-sb_002dext_003a_002amuffled_002dwarnings_002a"></a><dl>
<dt><a name="index-_002amuffled_002dwarnings_002a"></a>Variable: <strong>*muffled-warnings*</strong> <em>[sb-ext]</em></dt>
<dd><p>A type that ought to specify a subtype of <code>warning</code>.  Whenever a
warning is signaled, if the warning is of this type and is not
handled by any other handler, it will be muffled.
</p></dd></dl>

<hr>
<a name="Tools-To-Help-Developers"></a>
<div class="header">
<p>
Next: <a href="#Resolution-of-Name-Conflicts" accesskey="n" rel="next">Resolution of Name Conflicts</a>, Previous: <a href="#Customization-Hooks-for-Users" accesskey="p" rel="prev">Customization Hooks for Users</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Tools-To-Help-Developers-1"></a>
<h3 class="section">7.10 Tools To Help Developers</h3>
<a name="index-trace-_005bcl_005d"></a>
<a name="index-inspect-_005bcl_005d"></a>

<p>SBCL provides a profiler and other extensions to the ANSI <code>trace</code>
facility.  For more information, see <a href="#Macro-common_002dlisp_003atrace">Macro common-lisp:trace</a>.
</p>
<p>The debugger supports a number of options. Its documentation is
accessed by typing <kbd>help</kbd> at the debugger prompt. See <a href="#Debugger">Debugger</a>.
</p>
<p>Documentation for <code>inspect</code> is accessed by typing <kbd>help</kbd> at
the <code>inspect</code> prompt.
</p>
<hr>
<a name="Resolution-of-Name-Conflicts"></a>
<div class="header">
<p>
Next: <a href="#Hash-Table-Extensions" accesskey="n" rel="next">Hash Table Extensions</a>, Previous: <a href="#Tools-To-Help-Developers" accesskey="p" rel="prev">Tools To Help Developers</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Resolution-of-Name-Conflicts-1"></a>
<h3 class="section">7.11 Resolution of Name Conflicts</h3>
<a name="index-name_002dconflict-_005bsb_002dext_005d"></a>
<a name="index-name_002dconflict_002dsymbols-_005bsb_002dext_005d"></a>

<p>The ANSI standard (section 11.1.1.2.5) requires that name conflicts in
packages be resolvable in favour of any of the conflicting symbols.  In
the interactive debugger, this is achieved by prompting for the symbol
in whose favour the conflict should be resolved; for programmatic use,
the <code>sb-ext:resolve-conflict</code> restart should be invoked with one
argument, which should be a member of the list returned by the condition
accessor <code>sb-ext:name-conflict-symbols</code>.
</p>
<hr>
<a name="Hash-Table-Extensions"></a>
<div class="header">
<p>
Next: <a href="#Random-Number-Generation" accesskey="n" rel="next">Random Number Generation</a>, Previous: <a href="#Resolution-of-Name-Conflicts" accesskey="p" rel="prev">Resolution of Name Conflicts</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Hash-Table-Extensions-1"></a>
<h3 class="section">7.12 Hash Table Extensions</h3>
<a name="index-Hash-tables"></a>

<p>Hash table extensions supported by SBCL are all controlled by keyword
arguments to <code>make-hash-table</code>.
</p>
<a name="Function-common_002dlisp_003amake_002dhash_002dtable"></a><dl>
<dt><a name="index-make_002dhash_002dtable"></a>Function: <strong>make-hash-table</strong> <em>[cl] &amp;key test size rehash-size rehash-threshold hash-function weakness synchronized</em></dt>
<dd><p>Create and return a new hash table. The keywords are as follows:
</p>

<dl compact="compact">
<dt><em><code>:test</code></em></dt>
<dd><p>Determines how keys are compared. Must a designator for one of the
    standard hash table tests, or a hash table test defined using
    <code>sb-ext:define-hash-table-test</code>. Additionally, when an explicit
    <code>hash-function</code> is provided (see below), any two argument equivalence
    predicate can be used as the <code>test</code>.
</p>

</dd>
<dt><em><code>:size</code></em></dt>
<dd><p>A hint as to how many elements will be put in this hash table.
</p>

</dd>
<dt><em><code>:rehash-size</code></em></dt>
<dd><p>Indicates how to expand the table when it fills up. If an integer, add
    space for that many elements. If a floating point number (which must be
    greater than 1.0), multiply the size by that amount.
</p>

</dd>
<dt><em><code>:rehash-threshold</code></em></dt>
<dd><p>Indicates how dense the table can become before forcing a rehash. Can be
    any positive number &lt;=1, with density approaching zero as the threshold
    approaches 0. Density 1 means an average of one entry per bucket.
</p>

</dd>
<dt><em><code>:hash-function</code></em></dt>
<dd><p>If <code>nil</code> (the default), a hash function based on the <code>test</code> argument is used,
    which then must be one of the standardized hash table test functions, or
    one for which a default hash function has been defined using
    <code>sb-ext:define-hash-table-test</code>. If <code>hash-function</code> is specified, the <code>test</code>
    argument can be any two argument predicate consistent with it. The
    <code>hash-function</code> is expected to return a non-negative fixnum hash code.
</p>

</dd>
<dt><em><code>:weakness</code></em></dt>
<dd><p>When <code>:weakness</code> is not <code>nil</code>, garbage collection may remove entries from the
    hash table. The value of <code>:weakness</code> specifies how the presence of a key or
    value in the hash table preserves their entries from garbage collection.
</p>
<p>Valid values are:
</p>
<p><code>:key</code> means that the key of an entry must be live to guarantee that the
        entry is preserved.
</p>
<p><code>:value</code> means that the value of an entry must be live to guarantee that
        the entry is preserved.
</p>
<p><code>:key-and-value</code> means that both the key and the value must be live to
        guarantee that the entry is preserved.
</p>
<p><code>:key-or-value</code> means that either the key or the value must be live to
        guarantee that the entry is preserved.
</p>
<p><code>nil</code> (the default) means that entries are always preserved.
</p>

</dd>
<dt><em><code>:synchronized</code></em></dt>
<dd><p>If <code>nil</code> (the default), the hash-table may have multiple concurrent readers,
    but results are undefined if a thread writes to the hash-table
    concurrently with another reader or writer. If <code>t</code>, all concurrent accesses
    are safe, but note that <code>clhs</code> 3.6 (Traversal Rules and Side Effects)
    remains in force. See also: <code>sb-ext:with-locked-hash-table</code>. This keyword
    argument is experimental, and may change incompatibly or be removed in the
    future.
</p></dd>
</dl>

</dd></dl>

<a name="Macro-sb_002dext_003adefine_002dhash_002dtable_002dtest"></a><dl>
<dt><a name="index-define_002dhash_002dtable_002dtest"></a>Macro: <strong>define-hash-table-test</strong> <em>[sb-ext] name hash-function</em></dt>
<dd><p>Defines <code>name</code> as a new kind of hash table test for use with the <code>:test</code>
argument to <code>make-hash-table</code>, and associates a default <code>hash-function</code> with it.
</p>
<p><code>name</code> must be a symbol naming a global two argument equivalence predicate.
Afterwards both <code>'name</code> and <code>#'name</code> can be used with <code>:test</code> argument. In both
cases <code>hash-table-test</code> will return the symbol <code>name</code>.
</p>
<p><code>hash-function</code> must be a symbol naming a global hash function consistent with
the predicate, or be a <code>lambda</code> form implementing one in the current lexical
environment. The hash function must compute the same hash code for any two
objects for which <code>name</code> returns true, and subsequent calls with already hashed
objects must always return the same hash code.
</p>
<p>Note: The <code>:hash-function</code> keyword argument to <code>make-hash-table</code> can be used to
override the specified default hash-function.
</p>
<p>Attempting to define <code>name</code> in a locked package as hash-table test causes a
package lock violation.
</p>
<p>Examples:
</p>
<div class="lisp">
<pre class="lisp">  ;;; 1.

  ;; We want to use objects of type FOO as keys (by their
  ;; names.) EQUALP would work, but would make the names
  ;; case-insensitive -- which we don't want.
  (defstruct foo (name nil :type (or null string)))

  ;; Define an equivalence test function and a hash function.
  (defun foo-name= (f1 f2) (equal (foo-name f1) (foo-name f2)))
  (defun sxhash-foo-name (f) (sxhash (foo-name f)))

  (define-hash-table-test foo-name= sxhash-foo-name)

  ;; #'foo-name would work too.
  (defun make-foo-table () (make-hash-table :test 'foo-name=))

  ;;; 2.

  (defun == (x y) (= x y))

  (define-hash-table-test ==
    (lambda (x)
      ;; Hash codes must be consistent with test, so
      ;; not (SXHASH X), since
      ;;   (= 1 1.0)                   =&gt; T
      ;;   (= (SXHASH 1) (SXHASH 1.0)) =&gt; NIL
      ;; Note: this doesn't deal with complex numbers or
      ;; bignums too large to represent as double floats.
      (sxhash (coerce x 'double-float))))

  ;; #'== would work too
  (defun make-number-table () (make-hash-table :test '==))
</pre></div>
</dd></dl>

<a name="Macro-sb_002dext_003awith_002dlocked_002dhash_002dtable"></a><dl>
<dt><a name="index-with_002dlocked_002dhash_002dtable"></a>Macro: <strong>with-locked-hash-table</strong> <em>[sb-ext] (hash-table) &amp;body body</em></dt>
<dd><p>Limits concurrent accesses to <code>hash-table</code> for the duration of <code>body</code>.
If <code>hash-table</code> is synchronized, <code>body</code> will execute with exclusive
ownership of the table. If <code>hash-table</code> is not synchronized, <code>body</code> will
execute with other <code>with-locked-hash-table</code> bodies excluded <code>--</code> exclusion
of hash-table accesses not surrounded by <code>with-locked-hash-table</code> is
unspecified.
</p></dd></dl>

<a name="Function-sb_002dext_003ahash_002dtable_002dsynchronized_002dp"></a><dl>
<dt><a name="index-hash_002dtable_002dsynchronized_002dp"></a>Function: <strong>hash-table-synchronized-p</strong> <em>[sb-ext] ht</em></dt>
<dd><p>Returns <code>t</code> if <code>hash-table</code> is synchronized.
</p></dd></dl>

<a name="Function-sb_002dext_003ahash_002dtable_002dweakness"></a><dl>
<dt><a name="index-hash_002dtable_002dweakness"></a>Function: <strong>hash-table-weakness</strong> <em>[sb-ext] ht</em></dt>
<dd><p>Return the <code>weakness</code> of <code>hash-table</code> which is one of <code>nil</code>, <code>:key</code>,
<code>:value</code>, <code>:key-and-value</code>, <code>:key-or-value</code>.
</p></dd></dl>

<hr>
<a name="Random-Number-Generation"></a>
<div class="header">
<p>
Next: <a href="#Timeouts-and-Deadlines" accesskey="n" rel="next">Timeouts and Deadlines</a>, Previous: <a href="#Hash-Table-Extensions" accesskey="p" rel="prev">Hash Table Extensions</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Random-Number-Generation-1"></a>
<h3 class="section">7.13 Random Number Generation</h3>
<a name="index-Random-Number-Generation"></a>

<p>The initial value of <code>*random-state*</code> is the same each time SBCL
is started. This makes it possible for user code to obtain repeatable
pseudo random numbers using only standard-provided functionality. See
<code>seed-random-state</code> below for an SBCL extension that allows to
seed the random number generator from given data for an additional
possibility to achieve this. Non-repeatable random numbers can always
be obtained using <code>(make-random-state t)</code>.
</p>
<p>The sequence of numbers produced by repeated calls to <code>random</code>
starting with the same random state and using the same sequence of
<code>limit</code> arguments is guaranteed to be reproducible only in the
same version of SBCL on the same platform, using the same code under
the same evaluator mode and compiler optimization qualities. Just two
examples of differences that may occur otherwise: calls to
<code>random</code> can be compiled differently depending on how much is
known about the <code>limit</code> argument at compile time, yielding
different results even if called with the same argument at run time,
and the results can differ depending on the machine&rsquo;s word size, for
example for limits that are fixnums under 64-bit word size but bignums
under 32-bit word size.
</p>
<a name="Function-sb_002dext_003aseed_002drandom_002dstate"></a><dl>
<dt><a name="index-seed_002drandom_002dstate"></a>Function: <strong>seed-random-state</strong> <em>[sb-ext] &amp;optional state</em></dt>
<dd><p>Make a random state object. The optional <code>state</code> argument specifies a seed
for deterministic pseudo-random number generation.
</p>
<p>As per the Common Lisp standard for <code>make-random-state</code>,
</p><ul>
<li> If <code>state</code> is <code>nil</code> or not supplied, return a copy of the default
  <code>*random-state*</code>.
</li><li> If <code>state</code> is a random state, return a copy of it.
</li><li> If <code>state</code> is <code>t</code>, return a randomly initialized state (using operating-system
  provided randomness where available, otherwise a poor substitute based on
  internal time and pid).

</li></ul>
<p>As a supported <code>sbcl</code> extension, we also support receiving as a seed an object
of the following types:
</p><ul>
<li> <code>(simple-array (unsigned-byte 8) (*))</code>
</li><li> <code>unsigned-byte</code>
</li></ul>
<p>While we support arguments of any size and will mix the provided bits into
the random state, it is probably overkill to provide more than 256 bits worth
of actual information.
</p>
<p>This particular <code>sbcl</code> version also accepts an argument of the following type:
<code>(simple-array (unsigned-byte 32) (*))</code>
</p>
<p>This particular <code>sbcl</code> version uses the popular MT19937 <code>prng</code> algorithm, and its
internal state only effectively contains about 19937 bits of information.
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
</p></dd></dl>

<p>Some notes on random floats: The standard doesn&rsquo;t prescribe a specific
method of generating random floats. The following paragraph describes
SBCL&rsquo;s current implementation and should be taken purely informational,
that is, user code should not depend on any of its specific properties.
The method used has been chosen because it is common, conceptually
simple and fast.
</p>
<p>To generate random floats, SBCL evaluates code that has an equivalent
effect as
</p><div class="lisp">
<pre class="lisp">(* limit
   (float (/ (random (expt 2 23)) (expt 2 23)) 1.0f0))
</pre></div>
<p>(for single-floats) and correspondingly (with <code>52</code> and
<code>1.0d0</code> instead of <code>23</code> and <code>1.0f0</code>) for double-floats.
Note especially that this means that zero is a possible return value
occurring with probability <code>(expt 2 -23)</code> respectively
<code>(expt 2 -52)</code>. Also note that there exist twice as many
equidistant floats between 0 and 1 as are generated. For example, the
largest number that <code>(random 1.0f0)</code> ever returns is
<code>(float (/ (1- (expt 2 23)) (expt 2 23)) 1.0f0)</code> while
<code>(float (/ (1- (expt 2 24)) (expt 2 24)) 1.0f0)</code> is the
largest single-float less than 1. This is a side effect of the fact
that the implementation uses the fastest possible conversion from bits
to floats.
</p>
<p>SBCL currently uses the Mersenne Twister as its random number
generator, specifically the 32-bit version under both 32- and 64-bit
word size. The seeding algorithm has been improved several times by
the authors of the Mersenne Twister; SBCL uses the third version
(from 2002) which is still the most recent as of June 2012. The
implementation has been tested to provide output identical to the
recommended C implementation.
</p>
<p>While the Mersenne Twister generates random numbers of much better
statistical quality than other widely used generators, it uses only
linear operations modulo 2 and thus fails some statistical
tests<a name="DOCF9" href="#FOOT9"><sup>9</sup></a>.
For example, the distribution of ranks of (sufficiently large) random
binary matrices is much distorted compared to the theoretically
expected one when the matrices are generated by the Mersenne Twister.
Thus, applications that are sensitive to this aspect should use a
different type of generator.
</p>
<hr>
<a name="Timeouts-and-Deadlines"></a>
<div class="header">
<p>
Next: <a href="#Miscellaneous-Extensions" accesskey="n" rel="next">Miscellaneous Extensions</a>, Previous: <a href="#Random-Number-Generation" accesskey="p" rel="prev">Random Number Generation</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Timeouts-and-Deadlines-1"></a>
<h3 class="section">7.14 Timeouts and Deadlines</h3>

<p>SBCL supports three different ways of restricting the execution time
available to individual operations or parts of computations:
</p>
<dl compact="compact">
<dt><strong>Timeout Parameters</strong></dt>
<dd><p>Some operations such as thread synchronization primitives accept a
<code>:timeout</code> parameter. See <a href="#Timeout-Parameters">Timeout Parameters</a>.
</p>
</dd>
<dt><strong>Synchronous Timeouts (Deadlines)</strong></dt>
<dd><p>Certain operations that may suspend execution for extended periods of
time such as <code>cl:sleep</code>, thread synchronization primitives, IO and
waiting for external processes respect deadlines established for a part
of a computation. See <a href="#Synchronous-Timeouts-_0028Deadlines_0029">Synchronous Timeouts (Deadlines)</a>.
</p>
</dd>
<dt><strong>Asynchronous Timeouts</strong></dt>
<dd><p>Asynchronous timeouts can interrupt most computations at (almost) any
point. Thus, this kind of timeouts is the most versatile but it is also
somewhat unsafe. See <a href="#Asynchronous-Timeouts">Asynchronous Timeouts</a>.
</p>
</dd>
</dl>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Timeout-Parameters" accesskey="1">Timeout Parameters</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Synchronous-Timeouts-_0028Deadlines_0029" accesskey="2">Synchronous Timeouts (Deadlines)</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Asynchronous-Timeouts" accesskey="3">Asynchronous Timeouts</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Operations-Supporting-Timeouts-and-Deadlines" accesskey="4">Operations Supporting Timeouts and Deadlines</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Timeout-Parameters"></a>
<div class="header">
<p>
Next: <a href="#Synchronous-Timeouts-_0028Deadlines_0029" accesskey="n" rel="next">Synchronous Timeouts (Deadlines)</a>, Up: <a href="#Timeouts-and-Deadlines" accesskey="u" rel="up">Timeouts and Deadlines</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Timeout-Parameters-1"></a>
<h4 class="subsection">7.14.1 Timeout Parameters</h4>
<a name="index-Timeout"></a>

<p>Certain operations accept <code>:timeout</code> keyword arguments. These only
affect the specific operation and must be specified at each call site by
passing a <code>:timeout</code> keyword argument and a corresponding timeout
value to the respective operation. Expiration of the timeout before the
operation completes results in either a normal return with a return
value indicating the timeout or in the signaling of a specialized
condition such as
<a name="index-join_002dthread_002derror-_005bsb_002dthread_005d"></a>
<code>sb-thread:join-thread-error</code>.
</p>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">(defun join-thread-within-5-seconds (thread)
  (multiple-value-bind (value result)
      (sb-thread:join-thread thread :default nil :timeout 5)
    (when (eq result :timeout)
      (error &quot;Could not join ~A within 5 seconds&quot; thread))
    value))
</pre></div>

<p>The above code attempts to join the specified thread for up to five
seconds, returning its value in case of success. If the thread is still
running after the five seconds have elapsed,
<a name="index-join_002dthread-_005bsb_002dthread_005d"></a>
<code>sb-thread:join-thread</code> indicates the timeout in its second return
value. If a <code>:default</code> value was not provided,
<code>sb-thread:join-thread</code> would signal a
<code>sb-thread:join-thread-error</code> instead.
</p>
<p>To wait for an arbitrary condition, optionally with a timeout, the
<code>sb-ext:wait-for</code> macro can be used:
</p>
<a name="Macro-sb_002dext_003await_002dfor"></a><dl>
<dt><a name="index-wait_002dfor"></a>Macro: <strong>wait-for</strong> <em>[sb-ext] test-form &amp;key timeout</em></dt>
<dd><p>Wait until <code>test-form</code> evaluates to true, then return its primary value.
If <code>timeout</code> is provided, waits at most approximately <code>timeout</code> seconds before
returning <code>nil</code>.
</p>
<p>If <code>with-deadline</code> has been used to provide a global deadline, signals a
<code>deadline-timeout</code> if <code>test-form</code> doesn&rsquo;t evaluate to true before the
deadline.
</p>
<p>Experimental: subject to change without prior notice.
</p></dd></dl>


<hr>
<a name="Synchronous-Timeouts-_0028Deadlines_0029"></a>
<div class="header">
<p>
Next: <a href="#Asynchronous-Timeouts" accesskey="n" rel="next">Asynchronous Timeouts</a>, Previous: <a href="#Timeout-Parameters" accesskey="p" rel="prev">Timeout Parameters</a>, Up: <a href="#Timeouts-and-Deadlines" accesskey="u" rel="up">Timeouts and Deadlines</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Synchronous-Timeouts-_0028Deadlines_0029-1"></a>
<h4 class="subsection">7.14.2 Synchronous Timeouts (Deadlines)</h4>
<a name="index-Timeout-1"></a>
<a name="index-Synchronous-Timeout"></a>
<a name="index-Deadline"></a>

<p>Deadlines, in contrast to timeout parameters, are established for a
dynamic scope using the <code>sb-sys:with-deadline</code> macro and indirectly
affect operations within that scope. In case of nested uses, the
effective deadline is the one that expires first unless an inner use
explicitly overrides outer deadlines.
</p>
<a name="Macro-sb_002dsys_003awith_002ddeadline"></a><dl>
<dt><a name="index-with_002ddeadline"></a>Macro: <strong>with-deadline</strong> <em>[sb-sys] (&amp;key seconds override) &amp;body body</em></dt>
<dd><p>Arranges for a <code>timeout</code> condition to be signalled if an operation
respecting deadlines occurs either after the deadline has passed, or
would take longer than the time left to complete.
</p>
<p>Currently only <code>sleep</code>, blocking <code>io</code> operations, <code>get-mutex</code>, and
<code>condition-wait</code> respect deadlines, but this includes their implicit
uses inside <code>sbcl</code> itself.
</p>
<p>Unless <code>override</code> is true, existing deadlines can only be restricted,
not extended. Deadlines are per thread: children are unaffected by
their parent&rsquo;s deadlines.
</p>
<p>Experimental.
</p></dd></dl>

<p>Expiration of deadlines set up this way only has an effect when it
happens before or during the execution of a deadline-aware operation
(see <a href="#Operations-Supporting-Timeouts-and-Deadlines">Operations Supporting Timeouts and Deadlines</a>). In this case, a
<code>sb-sys:deadline-timeout</code> is signaled. A handler for this condition
type may use the <code>sb-sys:defer-deadline</code> or
<code>sb-sys:cancel-deadline</code> restarts to defer or cancel the deadline
respectively and resume execution of the interrupted operation.
</p>
<a name="Condition-sb_002dsys_003adeadline_002dtimeout"></a><dl>
<dt><a name="index-deadline_002dtimeout"></a>Condition: <strong>deadline-timeout</strong> <em>[sb-sys]</em></dt>
<dd><p>Class precedence list: <code>deadline-timeout, timeout, serious-condition, condition, t</code>
</p>
<p>Signaled when an operation in the context of a deadline takes
longer than permitted by the deadline.
</p></dd></dl>

<p>When a thread is executing the debugger, signaling of
<code>sb-sys:deadline-timeout</code> conditions for that thread is deferred
until it exits the debugger.
</p>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">(defun read-input ()
  (list (read-line) (read-line)))

(defun do-it ()
  (sb-sys:with-deadline (:seconds 5))
    (read-input)
    (sleep 2)
    (sb-ext:run-program &quot;my-program&quot;))
</pre></div>

<p>The above code establishes a deadline of five seconds within which the
body of the <code>do-it</code> function should execute. All calls of
deadline-aware functions in the dynamic scope, in this case two
<code>read-line</code> calls, a <code>sleep</code> call and a
<code>sb-ext:run-program</code> call, are affected by the deadline. If, for
example, the first <code>read-line</code> call completes in one second and the
second <code>read-line</code> call completes in three seconds, a
<code>sb-sys:deadline-timeout</code> condition will be signaled after the
<code>sleep</code> call has been executing for one second.
</p>
<hr>
<a name="Asynchronous-Timeouts"></a>
<div class="header">
<p>
Next: <a href="#Operations-Supporting-Timeouts-and-Deadlines" accesskey="n" rel="next">Operations Supporting Timeouts and Deadlines</a>, Previous: <a href="#Synchronous-Timeouts-_0028Deadlines_0029" accesskey="p" rel="prev">Synchronous Timeouts (Deadlines)</a>, Up: <a href="#Timeouts-and-Deadlines" accesskey="u" rel="up">Timeouts and Deadlines</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Asynchronous-Timeouts-1"></a>
<h4 class="subsection">7.14.3 Asynchronous Timeouts</h4>
<a name="index-Timeout-2"></a>
<a name="index-Asynchronous-Timeout"></a>

<p>Asynchronous timeouts are established for a dynamic scope using the
<code>sb-sys:with-timeout</code> macro:
</p>
<a name="Macro-sb_002dext_003awith_002dtimeout"></a><dl>
<dt><a name="index-with_002dtimeout"></a>Macro: <strong>with-timeout</strong> <em>[sb-ext] expires &amp;body body</em></dt>
<dd><p>Execute the body, asynchronously interrupting it and signalling a <code>timeout</code>
condition after at least <code>expires</code> seconds have passed.
</p>
<p>Note that it is never safe to unwind from an asynchronous condition. Consider:
</p>
<div class="lisp">
<pre class="lisp">  (defun call-with-foo (function)
    (let (foo)
      (unwind-protect
         (progn
           (setf foo (get-foo))
           (funcall function foo))
       (when foo
         (release-foo foo)))))
</pre></div>

<p>If <code>timeout</code> occurs after <code>get-foo</code> has executed, but before the assignment, then
<code>release-foo</code> will be missed. While individual sites like this can be made proof
against asynchronous unwinds, this doesn&rsquo;t solve the fundamental issue, as all
the frames potentially unwound through need to be proofed, which includes both
system and application code <code>--</code> and in essence proofing everything will make
the system uninterruptible.
</p></dd></dl>

<p>Expiration of the timeout will cause the operation being executed at
that moment to be interrupted by an asynchronously signaled
<code>sb-ext:timeout</code> condition, (almost) irregardless of the operation
and its context.
</p>
<a name="Condition-sb_002dext_003atimeout"></a><dl>
<dt><a name="index-timeout"></a>Condition: <strong>timeout</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>timeout, serious-condition, condition, t</code>
</p>
<p>Signaled when an operation does not complete within an allotted time budget.
</p></dd></dl>

<hr>
<a name="Operations-Supporting-Timeouts-and-Deadlines"></a>
<div class="header">
<p>
Previous: <a href="#Asynchronous-Timeouts" accesskey="p" rel="prev">Asynchronous Timeouts</a>, Up: <a href="#Timeouts-and-Deadlines" accesskey="u" rel="up">Timeouts and Deadlines</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Operations-Supporting-Timeouts-and-Deadlines-1"></a>
<h4 class="subsection">7.14.4 Operations Supporting Timeouts and Deadlines</h4>

<table>
<thead><tr><th width="50%">Operation</th><th width="25%">Timeout Parameter</th><th width="25%">Affected by Deadlines</th></tr></thead>
<tr><td width="50%"><code>cl:sleep</code></td><td width="25%">-</td><td width="25%">since SBCL 1.4.3</td></tr>
<tr><td width="50%"><code>cl:read-line</code>, etc.</td><td width="25%">no</td><td width="25%">yes</td></tr>
<tr><td width="50%"><a href="#Macro-sb_002dext_003await_002dfor">Macro sb-ext:wait-for</a></td><td width="25%">yes</td><td width="25%">yes</td></tr>
<tr><td width="50%"><a href="#Function-sb_002dext_003aprocess_002dwait">Function sb-ext:process-wait</a></td><td width="25%">no</td><td width="25%">yes</td></tr>
<tr><td width="50%"><a href="#Function-sb_002dthread_003agrab_002dmutex">Function sb-thread:grab-mutex</a></td><td width="25%">yes</td><td width="25%">yes</td></tr>
<tr><td width="50%"><a href="#Function-sb_002dthread_003acondition_002dwait">Function sb-thread:condition-wait</a></td><td width="25%">yes</td><td width="25%">yes</td></tr>
<tr><td width="50%"><a href="#Function-sb_002dthread_003await_002don_002dsemaphore">Function sb-thread:wait-on-semaphore</a></td><td width="25%">yes</td><td width="25%">yes</td></tr>
<tr><td width="50%"><a href="#Function-sb_002dthread_003ajoin_002dthread">Function sb-thread:join-thread</a></td><td width="25%">yes</td><td width="25%">yes</td></tr>
<tr><td width="50%"><a href="#Function-sb_002dconcurrency_003areceive_002dmessage">Function sb-concurrency:receive-message</a></td><td width="25%">yes</td><td width="25%">yes?</td></tr>
<tr><td width="50%"><a href="#Function-sb_002dconcurrency_003await_002don_002dgate">Function sb-concurrency:wait-on-gate</a></td><td width="25%">yes</td><td width="25%">yes?</td></tr>
<tr><td width="50%"><a href="#Macro-sb_002dconcurrency_003afrlock_002dwrite">Macro sb-concurrency:frlock-write</a></td><td width="25%">yes</td><td width="25%">yes?</td></tr>
<tr><td width="50%"><a href="#Function-sb_002dconcurrency_003agrab_002dfrlock_002dwrite_002dlock">Function sb-concurrency:grab-frlock-write-lock</a></td><td width="25%">yes</td><td width="25%">yes?</td></tr>
</table>

<hr>
<a name="Miscellaneous-Extensions"></a>
<div class="header">
<p>
Next: <a href="#Stale-Extensions" accesskey="n" rel="next">Stale Extensions</a>, Previous: <a href="#Timeouts-and-Deadlines" accesskey="p" rel="prev">Timeouts and Deadlines</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Miscellaneous-Extensions-1"></a>
<h3 class="section">7.15 Miscellaneous Extensions</h3>

<a name="Function-sb_002dext_003aarray_002dstorage_002dvector"></a><dl>
<dt><a name="index-array_002dstorage_002dvector"></a>Function: <strong>array-storage-vector</strong> <em>[sb-ext] array</em></dt>
<dd><p>Returns the underlying storage vector of <code>array</code>, which must be a non-displaced array.
</p>
<p>In <code>sbcl</code>, if <code>array</code> is a of type <code>(simple-array * (*))</code>, it is its own storage
vector. Multidimensional arrays, arrays with fill pointers, and adjustable
arrays have an underlying storage vector with the same <code>array-element-type</code> as
<code>array</code>, which this function returns.
</p>
<p>Important note: the underlying vector is an implementation detail. Even though
this function exposes it, changes in the implementation may cause this
function to be removed without further warning.
</p></dd></dl>
<a name="Function-sb_002dext_003adelete_002ddirectory"></a><dl>
<dt><a name="index-delete_002ddirectory"></a>Function: <strong>delete-directory</strong> <em>[sb-ext] pathspec &amp;key recursive</em></dt>
<dd><p>Deletes the directory designated by <code>pathspec</code> (a pathname designator).
Returns the truename of the directory deleted.
</p>
<p>If <code>recursive</code> is false (the default), signals an error unless the directory is
empty. If <code>recursive</code> is true, first deletes all files and subdirectories. If
<code>recursive</code> is true and the directory contains symbolic links, the links are
deleted, not the files and directories they point to.
</p>
<p>Signals an error if <code>pathspec</code> designates a file or a symbolic link instead of a
directory, or if the directory could not be deleted for any reason.
</p>
<p>Both
</p>
<div class="lisp">
<pre class="lisp">   (DELETE-DIRECTORY &quot;/tmp/foo&quot;)
   (DELETE-DIRECTORY &quot;/tmp/foo/&quot;)
</pre></div>

<p>delete the &quot;foo&quot; subdirectory of &quot;/tmp&quot;, or signal an error if it does not
exist or if is a file or a symbolic link.
</p></dd></dl>
<a name="Function-sb_002dext_003aget_002dtime_002dof_002dday"></a><dl>
<dt><a name="index-get_002dtime_002dof_002dday"></a>Function: <strong>get-time-of-day</strong> <em>[sb-ext]</em></dt>
<dd><p>Return the number of seconds and microseconds since the beginning of
the <code>unix</code> epoch (January 1st 1970.)
</p></dd></dl>
<a name="Function-sb_002dext_003aassert_002dversion_002d_003e_003d"></a><dl>
<dt><a name="index-assert_002dversion_002d_003e_003d"></a>Function: <strong>assert-version-&gt;=</strong> <em>[sb-ext] &amp;rest subversions</em></dt>
<dd><p>Asserts that the current <code>sbcl</code> is of version equal to or greater than
the version specified in the arguments.  A continuable error is signaled
otherwise.
</p>
<p>The arguments specify a sequence of subversion numbers in big endian order.
They are compared lexicographically with the runtime version, and versions
are treated as though trailed by an unbounded number of 0s.
</p>
<p>For example, (assert-version-&gt;= 1 1 4) asserts that the current <code>sbcl</code> is
version 1.1.4[.0.0...] or greater, and (assert-version-&gt;= 1) that it is
version 1[.0.0...] or greater.
</p></dd></dl>

<hr>
<a name="Stale-Extensions"></a>
<div class="header">
<p>
Next: <a href="#Efficiency-Hacks" accesskey="n" rel="next">Efficiency Hacks</a>, Previous: <a href="#Miscellaneous-Extensions" accesskey="p" rel="prev">Miscellaneous Extensions</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Stale-Extensions-1"></a>
<h3 class="section">7.16 Stale Extensions</h3>

<p>SBCL has inherited from CMUCL various hooks to allow the user to
tweak and monitor the garbage collection process. These are somewhat
stale code, and their interface might need to be cleaned up. If you
have urgent need of them, look at the code in <samp>src/code/gc.lisp</samp>
and bring it up on the developers&rsquo; mailing list.
</p>
<p>SBCL has various hooks inherited from CMUCL, like
<code>sb-ext:float-denormalized-p</code>, to allow a program to take
advantage of IEEE floating point arithmetic properties which aren&rsquo;t
conveniently or efficiently expressible using the ANSI standard. These
look good, and their interface looks good, but IEEE support is
slightly broken due to a stupid decision to remove some support for
infinities (because it wasn&rsquo;t in the ANSI spec and it didn&rsquo;t occur to
me that it was in the IEEE spec). If you need this stuff, take a look
at the code and bring it up on the developers&rsquo; mailing
list.
</p>

<hr>
<a name="Efficiency-Hacks"></a>
<div class="header">
<p>
Previous: <a href="#Stale-Extensions" accesskey="p" rel="prev">Stale Extensions</a>, Up: <a href="#Beyond-the-ANSI-Standard" accesskey="u" rel="up">Beyond the ANSI Standard</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Efficiency-Hacks-1"></a>
<h3 class="section">7.17 Efficiency Hacks</h3>

<p>The <code>sb-ext:purify</code> function causes SBCL first to collect all
garbage, then to mark all uncollected objects as permanent, never again
attempting to collect them as garbage. This can cause a large increase
in efficiency when using a primitive garbage collector, or a more
moderate increase in efficiency when using a more sophisticated garbage
collector which is well suited to the program&rsquo;s memory usage pattern. It
also allows permanent code to be frozen at fixed addresses, a
precondition for using copy-on-write to share code between multiple Lisp
processes.  This is less important with modern generational garbage
collectors, but not all SBCL platforms use such a garbage collector.
</p>

<p>The <code>sb-ext:truly-the</code> special form declares the type of the
result of the operations, producing its argument; the declaration is
not checked. In short: don&rsquo;t use it.
</p>
<a name="Special_002dOperator-sb_002dext_003atruly_002dthe"></a><dl>
<dt><a name="index-truly_002dthe"></a>Special Operator: <strong>truly-the</strong> <em>[sb-ext] value-type form</em></dt>
<dd><p>Specifies that the values returned by <code>form</code> conform to the
<code>value-type</code>, and causes the compiler to trust this information
unconditionally.
</p>
<p>Consequences are undefined if any result is not of the declared type
<code>--</code> typical symptoms including memory corruptions. Use with great
care.
</p></dd></dl>

<p>The <code>sb-ext:freeze-type</code> declaration declares that a
type will never change, which can make type testing
(<code>typep</code>, etc.) more efficient for structure types.
</p><hr>
<a name="Foreign-Function-Interface"></a>
<div class="header">
<p>
Next: <a href="#Pathnames" accesskey="n" rel="next">Pathnames</a>, Previous: <a href="#Beyond-the-ANSI-Standard" accesskey="p" rel="prev">Beyond the ANSI Standard</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-Function-Interface-1"></a>
<h2 class="chapter">8 Foreign Function Interface</h2>

<p>This chapter describes SBCL&rsquo;s interface to C programs and
libraries (and, since C interfaces are a sort of <em>lingua
franca</em> of the Unix world, to other programs and libraries in
general.)
</p>
<blockquote>
<p>Note: In the modern Lisp world, the usual term for this functionality
is Foreign Function Interface, or <acronym>FFI</acronym>, where despite the
mention of &ldquo;function&rdquo; in this term, <acronym>FFI</acronym> also
refers to direct manipulation of C data structures as well as
functions. The traditional CMUCL terminology is Alien Interface, and
while that older terminology is no longer used much in the system
documentation, it still reflected in names in the implementation,
notably in the name of the <code>SB-ALIEN</code> package.
</p></blockquote>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Introduction-to-the-Foreign-Function-Interface" accesskey="1">Introduction to the Foreign Function Interface</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-Types" accesskey="2">Foreign Types</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Operations-On-Foreign-Values" accesskey="3">Operations On Foreign Values</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-Variables" accesskey="4">Foreign Variables</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-Data-Structure-Examples" accesskey="5">Foreign Data Structure Examples</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Loading-Shared-Object-Files" accesskey="6">Loading Shared Object Files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-Function-Calls" accesskey="7">Foreign Function Calls</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Step_002dBy_002dStep-Example-of-the-Foreign-Function-Interface" accesskey="8">Step-By-Step Example of the Foreign Function Interface</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Introduction-to-the-Foreign-Function-Interface"></a>
<div class="header">
<p>
Next: <a href="#Foreign-Types" accesskey="n" rel="next">Foreign Types</a>, Up: <a href="#Foreign-Function-Interface" accesskey="u" rel="up">Foreign Function Interface</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Introduction-to-the-Foreign-Function-Interface-1"></a>
<h3 class="section">8.1 Introduction to the Foreign Function Interface</h3>

<p>Because of Lisp&rsquo;s emphasis on dynamic memory allocation and garbage
collection, Lisp implementations use non-C-like memory representations
for objects.  This representation mismatch creates friction when a Lisp
program must share objects with programs which expect C data.  There
are three common approaches to establishing communication:
</p>
<ul>
<li> The burden can be placed on the foreign program (and programmer) by
requiring the knowledge and use of the representations used internally
by the Lisp implementation.  This can require a considerable amount of
&ldquo;glue&rdquo; code on the C side, and that code tends to be sensitively
dependent on the internal implementation details of the Lisp system.

</li><li> The Lisp system can automatically convert objects back and forth between
the Lisp and foreign representations.  This is convenient, but
translation becomes prohibitively slow when large or complex data
structures must be shared. This approach is supported by the SBCL
<acronym>FFI</acronym>, and used automatically when passing integers and strings.

</li><li> The Lisp program can directly manipulate foreign objects through the
use of extensions to the Lisp language.

</li></ul>

<p>SBCL, like CMUCL before it, relies primarily on the automatic
conversion and direct manipulation approaches. The <code>SB-ALIEN</code>
package provides a facility wherein foreign values of simple scalar
types are automatically converted and complex types are directly
manipulated in their foreign representation.  Additionally the
lower-level System Area Pointers (or <acronym>SAP</acronym>s) can be used where
necessary to provide untyped access to foreign memory.
</p>
<p>Any foreign objects that can&rsquo;t automatically be converted into Lisp
values are represented by objects of type <code>alien-value</code>.  Since
Lisp is a dynamically typed language, even foreign objects must have a
run-time type; this type information is provided by encapsulating the
raw pointer to the foreign data within an <code>alien-value</code> object.
</p>
<p>The type language and operations on foreign types are
intentionally similar to those of the C language.
</p>
<hr>
<a name="Foreign-Types"></a>
<div class="header">
<p>
Next: <a href="#Operations-On-Foreign-Values" accesskey="n" rel="next">Operations On Foreign Values</a>, Previous: <a href="#Introduction-to-the-Foreign-Function-Interface" accesskey="p" rel="prev">Introduction to the Foreign Function Interface</a>, Up: <a href="#Foreign-Function-Interface" accesskey="u" rel="up">Foreign Function Interface</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-Types-1"></a>
<h3 class="section">8.2 Foreign Types</h3>

<p>Alien types have a description language based on nested list
structure. For example the C type
</p>
<div class="example">
<pre class="example">struct foo {
    int a;
    struct foo *b[100];
};
</pre></div>

<p>has the corresponding SBCL <acronym>FFI</acronym> type
</p>
<div class="lisp">
<pre class="lisp">(struct foo
  (a int)
  (b (array (* (struct foo)) 100)))
</pre></div>


<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Defining-Foreign-Types" accesskey="1">Defining Foreign Types</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-Types-and-Lisp-Types" accesskey="2">Foreign Types and Lisp Types</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-Type-Specifiers" accesskey="3">Foreign Type Specifiers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Defining-Foreign-Types"></a>
<div class="header">
<p>
Next: <a href="#Foreign-Types-and-Lisp-Types" accesskey="n" rel="next">Foreign Types and Lisp Types</a>, Up: <a href="#Foreign-Types" accesskey="u" rel="up">Foreign Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Defining-Foreign-Types-1"></a>
<h4 class="subsection">8.2.1 Defining Foreign Types</h4>

<p>Types may be either named or anonymous.  With structure and union
types, the name is part of the type specifier, allowing recursively
defined types such as:
</p>
<div class="lisp">
<pre class="lisp">(struct foo (a (* (struct foo))))
</pre></div>

<p>An anonymous structure or union type is specified by using the name
<code>nil</code>.  The <code>with-alien</code> macro defines a local scope which
&ldquo;captures&rdquo; any named type definitions.  Other types are not
inherently named, but can be given named abbreviations using the
<code>define-alien-type</code> macro.
</p>
<hr>
<a name="Foreign-Types-and-Lisp-Types"></a>
<div class="header">
<p>
Next: <a href="#Foreign-Type-Specifiers" accesskey="n" rel="next">Foreign Type Specifiers</a>, Previous: <a href="#Defining-Foreign-Types" accesskey="p" rel="prev">Defining Foreign Types</a>, Up: <a href="#Foreign-Types" accesskey="u" rel="up">Foreign Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-Types-and-Lisp-Types-1"></a>
<h4 class="subsection">8.2.2 Foreign Types and Lisp Types</h4>

<p>The foreign types form a subsystem of the SBCL type system.  An
<code>alien</code> type specifier provides a way to use any foreign type as a
Lisp type specifier.  For example,
</p>
<div class="lisp">
<pre class="lisp">(typep <var>foo</var> '(alien (* int)))
</pre></div>

<p>can be used to determine whether <var>foo</var> is a pointer to a foreign
<code>int</code>. <code>alien</code> type specifiers can be used in the same ways
as ordinary Lisp type specifiers (like <code>string</code>.) Alien type
declarations are subject to the same precise type checking as any
other declaration.  See <a href="#Precise-Type-Checking">Precise Type Checking</a>.
</p>
<p>Note that the type identifiers used in the foreign type system overlap
with native Lisp type specifiers in some cases.  For example, the type
specifier <code>(alien single-float)</code> is identical to
<code>single-float</code>, since foreign floats are automatically converted
to Lisp floats.  When <code>type-of</code> is called on an alien value that
is not automatically converted to a Lisp value, then it will return an
<code>alien</code> type specifier.
</p>
<hr>
<a name="Foreign-Type-Specifiers"></a>
<div class="header">
<p>
Previous: <a href="#Foreign-Types-and-Lisp-Types" accesskey="p" rel="prev">Foreign Types and Lisp Types</a>, Up: <a href="#Foreign-Types" accesskey="u" rel="up">Foreign Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-Type-Specifiers-1"></a>
<h4 class="subsection">8.2.3 Foreign Type Specifiers</h4>

<p>Note: All foreign type names are exported from the <code>sb-alien</code>
package. Some foreign type names are also symbols in
the <code>common-lisp</code> package, in which case they are
reexported from the <code>sb-alien</code> package, so that
e.g. it is legal to refer to <code>sb-alien:single-float</code>.
</p>
<p>These are the basic foreign type specifiers:
</p>
<ul>
<li> The foreign type specifier <code>(* <var>foo</var>)</code> describes a pointer to
an object of type <var>foo</var>.  A pointed-to type <var>foo</var> of <code>t</code>
indicates a pointer to anything, similar to <code>void *</code> in
ANSI C. A null alien pointer can be detected with the
<code>sb-alien:null-alien</code> function.

</li><li> The foreign type specifier <code>(array <var>foo</var> &amp;rest
dimensions)</code> describes array of the specified <code>dimensions</code>,
holding elements of type <var>foo</var>. Note that (unlike in C) <code>(*
<var>foo</var>)</code> and <code>(array <var>foo</var>)</code> are considered to be
different types when type checking is done. If equivalence of pointer
and array types is desired, it may be explicitly coerced using
<code>sb-alien:cast</code>.

<p>Arrays are accessed using <code>sb-alien:deref</code>, passing the indices
as additional arguments.  Elements are stored in column-major order
(as in C), so the first dimension determines only the size of the
memory block, and not the layout of the higher dimensions.  An array
whose first dimension is variable may be specified by using <code>nil</code>
as the first dimension.  Fixed-size arrays can be allocated as array
elements, structure slots or <code>sb-alien:with-alien</code>
variables. Dynamic arrays can only be allocated using
<code>sb-alien:make-alien</code>.
</p>
</li><li> The foreign type specifier <code>(sb-alien:struct <var>name</var> &amp;rest
<var>fields</var>)</code> describes a structure type with the specified
<var>name</var> and <var>fields</var>. Fields are allocated at the same offsets
used by the implementation&rsquo;s C compiler, as guessed by the SBCL
internals. An optional <code>:alignment</code> keyword argument can be
specified for each field to explicitly control the alignment of a
field. If <var>name</var> is <code>nil</code> then the structure is anonymous.

<p>If a named foreign <code>struct</code> specifier is passed to
<code>define-alien-type</code> or <code>with-alien</code>, then this defines,
respectively, a new global or local foreign structure type.  If no
<var>fields</var> are specified, then the fields are taken
from the current (local or global) alien structure type definition of
<var>name</var>.
</p>
</li><li> The foreign type specifier <code>(sb-alien:union <var>name</var> &amp;rest
<var>fields</var>)</code> is similar to <code>sb-alien:struct</code>, but describes a
union type.  All fields are allocated at the same offset, and the size
of the union is the size of the largest field.  The programmer must
determine which field is active from context.

</li><li> The foreign type specifier <code>(sb-alien:enum <var>name</var> &amp;rest
<var>specs</var>)</code> describes an enumeration type that maps between integer
values and symbols. If <var>name</var> is <code>nil</code>, then the type is
anonymous.  Each element of the <var>specs</var> list is either a Lisp
symbol, or a list <code>(<var>symbol</var> <var>value</var>)</code>.  <var>value</var> is
an integer. If <var>value</var> is not supplied, then it defaults to one
greater than the value for the preceding spec (or to zero if it is the
first spec).

</li><li> The foreign type specifier <code>(sb-alien:signed &amp;optional
<var>bits</var>)</code> specifies a signed integer with the specified number of
<var>bits</var> precision. The upper limit on integer
precision is determined by the machine&rsquo;s word size. If
<var>bits</var> is not specified, the maximum size will be
used.

</li><li> The foreign type specifier <code>(integer &amp;optional <var>bits</var>)</code>
is equivalent to the corresponding type specifier using
<code>sb-alien:signed</code> instead of <code>integer</code>.

</li><li> The foreign type specifier <code>(sb-alien:unsigned &amp;optional
<var>bits</var>)</code> is like corresponding type specifier using
<code>sb-alien:signed</code> except that the variable is treated as an
unsigned integer.

</li><li> The foreign type specifier <code>(boolean &amp;optional <var>bits</var>)</code> is
similar to an enumeration type, but maps from Lisp <code>nil</code> and
<code>t</code> to C <code>0</code> and <code>1</code> respectively. <var>bits</var>
determines the amount of storage allocated to hold the truth value.

</li><li> The foreign type specifier <code>single-float</code> describes a
floating-point number in IEEE single-precision format.

</li><li> The foreign type specifier <code>double-float</code> describes a
floating-point number in IEEE double-precision format.

</li><li> The foreign type specifier <code>(function <var>result-type</var> &amp;rest
<var>arg-types</var>)</code> describes a foreign function that takes arguments of
the specified <var>arg-types</var> and returns a result of type
<var>result-type</var>.  Note that the only context where a foreign
<code>function</code> type is directly specified is in the argument to
<code>sb-alien:alien-funcall</code>.  In all other contexts, foreign
functions are represented by foreign function pointer types: <code>(*
(function &hellip;))</code>.

</li><li> The foreign type specifier <code>sb-alien:system-area-pointer</code>
describes a pointer which is represented in Lisp as a
<code>system-area-pointer</code> object.  SBCL exports this type from
<code>sb-alien</code> because CMUCL did, but tentatively (as of the first
draft of this section of the manual, SBCL 0.7.6) it is deprecated,
since it doesn&rsquo;t seem to be required by user code.

</li><li> The foreign type specifier <code>sb-alien:void</code> is used in function
types to declare that no useful value is returned.  Using
<code>alien-funcall</code> to call a <code>void</code> foreign function will
return zero values.

</li><li> <a name="index-External-formats"></a>
The foreign type specifier <code>(sb-alien:c-string &amp;key
external-format element-type not-null)</code> is similar to
<code>(* char)</code>, but is interpreted as a null-terminated string, and
is automatically converted into a Lisp string when accessed; or if the
pointer is C <code>NULL</code> or <code>0</code>, then accessing it gives Lisp
<code>nil</code> unless <code>not-null</code> is true, in which case a type-error
is signalled.

<p>External format conversion is automatically done when Lisp strings are
passed to foreign code, or when foreign strings are passed to Lisp code.
If the type specifier has an explicit <code>external-format</code>, that
external format will be used. Otherwise a default external format that
has been determined at SBCL startup time based on the current locale
settings will be used. For example, when the following alien routine is
called, the Lisp string given as argument is converted to an
<code>ebcdic</code> octet representation.
</p>
<div class="lisp">
<pre class="lisp">(define-alien-routine test int (str (c-string :external-format :ebcdic-us)))
</pre></div>

<p>Lisp strings of type <code>base-string</code> are stored with a trailing NUL
termination, so no copying (either by the user or the implementation) is
necessary when passing them to foreign code, assuming that the
<code>external-format</code> and <code>element-type</code> of the <code>c-string</code>
type are compatible with the internal representation of the string. For
an SBCL built with Unicode support that means an <code>external-format</code>
of <code>:ascii</code> and an <code>element-type</code> of <code>base-char</code>. Without
Unicode support the <code>external-format</code> can also be
<code>:iso-8859-1</code>, and the <code>element-type</code> can also be
<code>character</code>. If the <code>external-format</code> or <code>element-type</code>
is not compatible, or the string is a <code>(simple-array character
(*))</code>, this data is copied by the implementation as required.
</p>
<p>Assigning a Lisp string to a <code>c-string</code> structure field or
variable stores the contents of the string to the memory already
pointed to by that variable.  When a foreign object of type <code>(*
char)</code> is assigned to a <code>c-string</code>, then the
<code>c-string</code> pointer is assigned to.  This allows
<code>c-string</code> pointers to be initialized.  For example:
</p>
<div class="lisp">
<pre class="lisp">(cl:in-package &quot;CL-USER&quot;) ; which USEs package &quot;SB-ALIEN&quot;

(define-alien-type nil (struct foo (str c-string)))

(defun make-foo (str)
  (let ((my-foo (make-alien (struct foo))))
    (setf (slot my-foo 'str) (make-alien char (length str))
          (slot my-foo 'str) str)
    my-foo))
</pre></div>

<p>Storing Lisp <code>NIL</code> in a <code>c-string</code> writes C <code>NULL</code> to
the variable.
</p>
</li><li> <code>sb-alien</code> also exports translations of these C type
specifiers as foreign type specifiers:
<code>char</code>,
<code>short</code>,
<code>int</code>,
<code>long</code>,
<code>unsigned-char</code>,
<code>unsigned-short</code>,
<code>unsigned-int</code>,
<code>unsigned-long</code>,
<code>float</code>, <code>double</code>,
<code>size-t</code>, and <code>off-t</code>.

</li></ul>

<hr>
<a name="Operations-On-Foreign-Values"></a>
<div class="header">
<p>
Next: <a href="#Foreign-Variables" accesskey="n" rel="next">Foreign Variables</a>, Previous: <a href="#Foreign-Types" accesskey="p" rel="prev">Foreign Types</a>, Up: <a href="#Foreign-Function-Interface" accesskey="u" rel="up">Foreign Function Interface</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Operations-On-Foreign-Values-1"></a>
<h3 class="section">8.3 Operations On Foreign Values</h3>

<p>This section describes how to read foreign values as Lisp values, how
to coerce foreign values to different kinds of foreign values, and how
to dynamically allocate and free foreign variables.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Accessing-Foreign-Values" accesskey="1">Accessing Foreign Values</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Coercing-Foreign-Values" accesskey="2">Coercing Foreign Values</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-Dynamic-Allocation" accesskey="3">Foreign Dynamic Allocation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Accessing-Foreign-Values"></a>
<div class="header">
<p>
Next: <a href="#Coercing-Foreign-Values" accesskey="n" rel="next">Coercing Foreign Values</a>, Up: <a href="#Operations-On-Foreign-Values" accesskey="u" rel="up">Operations On Foreign Values</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Accessing-Foreign-Values-1"></a>
<h4 class="subsection">8.3.1 Accessing Foreign Values</h4>

<dl>
<dt><a name="index-deref"></a>Function: <strong>deref</strong> <em>[sb-alien] <var>pointer-or-array</var> &amp;rest <var>indices</var></em></dt>
<dd>
<p>The <code>sb-alien:deref</code> function returns the value pointed to by a
foreign pointer, or the value of a foreign array element. When
dereferencing a pointer, an optional single index can be specified to
give the equivalent of C pointer arithmetic; this index is scaled by
the size of the type pointed to. When dereferencing an array, the
number of indices must be the same as the number of dimensions in the
array type. <code>deref</code> can be set with <code>setf</code> to assign a new
value.
</p></dd></dl>

<dl>
<dt><a name="index-slot"></a>Function: <strong>slot</strong> <em>[sb-alien] <var>struct-or-union</var> <var>slot-name</var></em></dt>
<dd>
<p>The <code>sb-alien:slot</code> function extracts the value of the slot named
<var>slot-name</var> from a foreign <code>struct</code> or <code>union</code>. If
<var>struct-or-union</var> is a pointer to a structure or union, then it is
automatically dereferenced.  <code>sb-alien:slot</code> can be set with
<code>setf</code> to assign a new value. Note that <var>slot-name</var> is
evaluated, and need not be a compile-time constant (but only constant
slot accesses are efficiently compiled).
</p></dd></dl>


<a name="Untyped-memory"></a>
<h4 class="subsubsection">8.3.1.1 Untyped memory</h4>

<p>As noted at the beginning of the chapter, the System Area Pointer
facilities allow untyped access to foreign memory.  <acronym>SAP</acronym>s can
be converted to and from the usual typed foreign values using
<code>sap-alien</code> and <code>alien-sap</code> (described elsewhere), and also
to and from integers - raw machine addresses.  They should thus be
used with caution; corrupting the Lisp heap or other memory with
<acronym>SAP</acronym>s is trivial.
</p>
<dl>
<dt><a name="index-int_002dsap"></a>Function: <strong>int-sap</strong> <em>[sb-sys] <var>machine-address</var></em></dt>
<dd>
<p>Creates a <acronym>SAP</acronym> pointing at the virtual address
<var>machine-address</var>.
</p></dd></dl>

<dl>
<dt><a name="index-sap_002dref_002d32"></a>Function: <strong>sap-ref-32</strong> <em>[sb-sys] <var>sap</var> <var>offset</var></em></dt>
<dd>
<p>Access the value of the memory location at <var>offset</var> bytes from
<var>sap</var>.  This form may also be used with <code>setf</code> to alter the
memory at that location.
</p></dd></dl>

<dl>
<dt><a name="index-sap_003d"></a>Function: <strong>sap=</strong> <em>[sb-sys] <var>sap1</var> <var>sap2</var></em></dt>
<dd>
<p>Compare <var>sap1</var> and <var>sap2</var> for equality.
</p></dd></dl>

<p>Similarly named functions exist for accessing other sizes of word,
other comparisons, and other conversions.  The reader is invited to
use <code>apropos</code> and <code>describe</code> for more details
</p>
<div class="lisp">
<pre class="lisp">(apropos &quot;sap&quot; :sb-sys)
</pre></div>


<hr>
<a name="Coercing-Foreign-Values"></a>
<div class="header">
<p>
Next: <a href="#Foreign-Dynamic-Allocation" accesskey="n" rel="next">Foreign Dynamic Allocation</a>, Previous: <a href="#Accessing-Foreign-Values" accesskey="p" rel="prev">Accessing Foreign Values</a>, Up: <a href="#Operations-On-Foreign-Values" accesskey="u" rel="up">Operations On Foreign Values</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Coercing-Foreign-Values-1"></a>
<h4 class="subsection">8.3.2 Coercing Foreign Values</h4>

<dl>
<dt><a name="index-addr"></a>Macro: <strong>addr</strong> <em>[sb-alien] <var>alien-expr</var></em></dt>
<dd>
<p>The <code>sb-alien:addr</code> macro returns a pointer to the location
specified by <var>alien-expr</var>, which must be either a foreign
variable, a use of <code>sb-alien:deref</code>, a use of
<code>sb-alien:slot</code>, or a use of <code>sb-alien:extern-alien</code>.
</p></dd></dl>

<dl>
<dt><a name="index-cast"></a>Macro: <strong>cast</strong> <em>[sb-alien] <var>foreign-value</var> <var>new-type</var></em></dt>
<dd>
<p>The <code>sb-alien:cast</code> macro converts <var>foreign-value</var> to a new
foreign value with the specified <var>new-type</var>. Both types, old and
new, must be foreign pointer, array or function types.  Note that the
resulting Lisp foreign variable object is not <code>eq</code> to the
argument, but it does refer to the same foreign data bits.
</p></dd></dl>

<dl>
<dt><a name="index-sap_002dalien"></a>Macro: <strong>sap-alien</strong> <em>[sb-alien] <var>sap</var> <var>type</var></em></dt>
<dd>
<p>The <code>sb-alien:sap-alien</code> macro converts <var>sap</var> (a system
area pointer) to a foreign value with the specified
<var>type</var>. <var>type</var> is not evaluated.
</p>
<p>The <var>type</var> must be some foreign pointer, array, or record type.
</p></dd></dl>

<dl>
<dt><a name="index-alien_002dsap"></a>Function: <strong>alien-sap</strong> <em>[sb-alien] <var>foreign-value</var></em></dt>
<dd>
<p>The <code>sb-alien:alien-sap</code> function returns the <acronym>SAP</acronym> which
points to <var>alien-value</var>&rsquo;s data.
</p>
<p>The <var>foreign-value</var> must be of some foreign pointer, array, or
record type.
</p></dd></dl>


<hr>
<a name="Foreign-Dynamic-Allocation"></a>
<div class="header">
<p>
Previous: <a href="#Coercing-Foreign-Values" accesskey="p" rel="prev">Coercing Foreign Values</a>, Up: <a href="#Operations-On-Foreign-Values" accesskey="u" rel="up">Operations On Foreign Values</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-Dynamic-Allocation-1"></a>
<h4 class="subsection">8.3.3 Foreign Dynamic Allocation</h4>

<p>Lisp code can call the C standard library functions <code>malloc</code> and
<code>free</code> to dynamically allocate and deallocate foreign variables.
The Lisp code shares the same allocator with foreign C code, so it&rsquo;s
OK for foreign code to call <code>free</code> on the result of Lisp
<code>sb-alien:make-alien</code>, or for Lisp code to call
<code>sb-alien:free-alien</code> on foreign objects allocated by C code.
</p>
<a name="Macro-sb_002dalien_003amake_002dalien"></a><dl>
<dt><a name="index-make_002dalien"></a>Macro: <strong>make-alien</strong> <em>[sb-alien] type &amp;optional size</em></dt>
<dd><p>Allocate an alien of type <code>type</code> in foreign heap, and return an alien
pointer to it. The allocated memory is not initialized, and may
contain garbage. The memory is allocated using malloc(3), so it can be
passed to foreign functions which use free(3), or released using
<code>free-alien</code>.
</p>
<p>For alien stack allocation, see macro <code>with-alien</code>.
</p>
<p>The <code>type</code> argument is not evaluated. If <code>size</code> is supplied, how it is
interpreted depends on <code>type:</code>
</p>
<ul>
<li> When <code>type</code> is a foreign array type, an array of that type is
    allocated, and a pointer to it is returned. Note that you
    must use <code>deref</code> to first access the array through the pointer.

<p>If supplied, <code>size</code> is used as the first dimension for the array.
</p>
</li><li> When <code>type</code> is any other foreign type, then an object for that
    type is allocated, and a pointer to it is returned. So
    (make-alien int) returns a <code>(* int)</code>.

<p>If <code>size</code> is specified, then a block of that many objects is
    allocated, with the result pointing to the first one.
</p>
</li></ul>
<p>Examples:
</p>
<div class="lisp">
<pre class="lisp">  (defvar *foo* (make-alien (array char 10)))
  (type-of *foo*)                 ; =&gt; (alien (* (array (signed 8) 10)))
  (setf (deref (deref foo) 0) 10) ; =&gt; 10

  (make-alien char 12)            ; =&gt; (alien (* (signed 8)))
</pre></div>
</dd></dl>
<a name="Function-sb_002dalien_003amake_002dalien_002dstring"></a><dl>
<dt><a name="index-make_002dalien_002dstring"></a>Function: <strong>make-alien-string</strong> <em>[sb-alien] string &amp;rest rest &amp;key start end external-format null-terminate</em></dt>
<dd><p>Copy part of <code>string</code> delimited by <code>start</code> and <code>end</code> into freshly
allocated foreign memory, freeable using free(3) or <code>free-alien</code>.
Returns the allocated string as a <code>(* char) </code>alien, and the number of
bytes allocated as secondary value.
</p>
<p>The string is encoded using <code>external-format</code>. If <code>null-terminate</code> is
true (the default), the alien string is terminated by an additional
null byte.
</p></dd></dl>
<a name="Function-sb_002dalien_003afree_002dalien"></a><dl>
<dt><a name="index-free_002dalien"></a>Function: <strong>free-alien</strong> <em>[sb-alien] alien</em></dt>
<dd><p>Dispose of the storage pointed to by <code>alien</code>. The <code>alien</code> must have been
allocated by <code>make-alien</code>, <code>make-alien-string</code> or malloc(3).
</p></dd></dl>

<hr>
<a name="Foreign-Variables"></a>
<div class="header">
<p>
Next: <a href="#Foreign-Data-Structure-Examples" accesskey="n" rel="next">Foreign Data Structure Examples</a>, Previous: <a href="#Operations-On-Foreign-Values" accesskey="p" rel="prev">Operations On Foreign Values</a>, Up: <a href="#Foreign-Function-Interface" accesskey="u" rel="up">Foreign Function Interface</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-Variables-1"></a>
<h3 class="section">8.4 Foreign Variables</h3>

<p>Both local (stack allocated) and external (C global) foreign variables
are supported.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Local-Foreign-Variables" accesskey="1">Local Foreign Variables</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#External-Foreign-Variables" accesskey="2">External Foreign Variables</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Local-Foreign-Variables"></a>
<div class="header">
<p>
Next: <a href="#External-Foreign-Variables" accesskey="n" rel="next">External Foreign Variables</a>, Up: <a href="#Foreign-Variables" accesskey="u" rel="up">Foreign Variables</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Local-Foreign-Variables-1"></a>
<h4 class="subsection">8.4.1 Local Foreign Variables</h4>

<dl>
<dt><a name="index-with_002dalien"></a>Macro: <strong>with-alien</strong> <em>[sb-alien] <var>var-definitions</var> &amp;body <var>body</var></em></dt>
<dd>
<p>The <code>with-alien</code> macro establishes local foreign variables with
the specified alien types and names.  This form is analogous to
defining a local variable in C: additional storage is allocated, and
the initial value is copied.  This form is less analogous to
<code>LET</code>-allocated Lisp variables, since the variables can&rsquo;t be
captured in closures: they live only for the dynamic extent of the
body, and referring to them outside is a gruesome error.
</p>
<p>The <var>var-definitions</var> argument is a list of
variable definitions, each of the form
</p><div class="lisp">
<pre class="lisp">(<var>name</var> <var>type</var> &amp;optional <var>initial-value</var>)
</pre></div>

<p>The names of the variables are established as symbol-macros; the
bindings have lexical scope, and may be assigned with <code>setq</code> or
<code>setf</code>.
</p>
<p>The <code>with-alien</code> macro also establishes a new scope for named
structures and unions.  Any <var>type</var> specified for a variable may
contain named structure or union types with the slots specified.
Within the lexical scope of the binding specifiers and body, a locally
defined foreign structure type <var>foo</var> can be referenced by its name
using <code>(struct <var>foo</var>)</code>.
</p></dd></dl>

<hr>
<a name="External-Foreign-Variables"></a>
<div class="header">
<p>
Previous: <a href="#Local-Foreign-Variables" accesskey="p" rel="prev">Local Foreign Variables</a>, Up: <a href="#Foreign-Variables" accesskey="u" rel="up">Foreign Variables</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="External-Foreign-Variables-1"></a>
<h4 class="subsection">8.4.2 External Foreign Variables</h4>

<p>External foreign names are strings, and Lisp names are symbols. When
an external foreign value is represented using a Lisp variable, there
must be a way to convert from one name syntax into the other. The
macros <code>extern-alien</code>, <code>define-alien-variable</code> and
<code>define-alien-routine</code> use this conversion heuristic:
</p>
<ul>
<li> Alien names are converted to Lisp names by uppercasing and replacing
underscores with hyphens.

</li><li> Conversely, Lisp names are converted to alien names by lowercasing and
replacing hyphens with underscores.

</li><li> Both the Lisp symbol and alien string names may be separately
specified by using a list of the form

<div class="lisp">
<pre class="lisp">(alien-string lisp-symbol)
</pre></div>

</li></ul>

<dl>
<dt><a name="index-define_002dalien_002dvariable"></a>Macro: <strong>define-alien-variable</strong> <em>[sb-alien] <var>name</var> <var>type</var></em></dt>
<dd>
<p>The <code>define-alien-variable</code> macro defines <var>name</var> as an
external foreign variable of the specified foreign <code>type</code>.
<var>name</var> and <code>type</code> are not evaluated.  The Lisp name of the
variable (see above) becomes a global alien variable.  Global alien
variables are effectively &ldquo;global symbol macros&rdquo;; a reference to the
variable fetches the contents of the external variable.  Similarly,
setting the variable stores new contents &ndash; the new contents must be
of the declared <code>type</code>. Someday, they may well be implemented
using the <acronym>ANSI</acronym> <code>define-symbol-macro</code> mechanism, but as
of SBCL 0.7.5, they are still implemented using an older more-or-less
parallel mechanism inherited from CMUCL.
</p>
<p>For example, to access a C-level counter <var>foo</var>, one could write
</p>
<div class="lisp">
<pre class="lisp">(define-alien-variable &quot;foo&quot; int)
;; Now it is possible to get the value of the C variable foo simply by
;; referencing that Lisp variable:
(print foo)
(setf foo 14)
(incf foo)
</pre></div>
</dd></dl>

<dl>
<dt><a name="index-get_002derrno"></a>Function: <strong>get-errno</strong> <em>[sb-alien]</em></dt>
<dd>
<p>Since in modern C libraries, the <code>errno</code> &ldquo;variable&rdquo; is typically
no longer a variable, but some bizarre artificial construct
which behaves superficially like a variable within a given thread,
it can no longer reliably be accessed through the ordinary
<code>define-alien-variable</code> mechanism. Instead, SBCL provides
the operator <code>sb-alien:get-errno</code> to allow Lisp code to read it.
</p></dd></dl>

<dl>
<dt><a name="index-extern_002dalien"></a>Macro: <strong>extern-alien</strong> <em>[sb-alien] <var>name</var> <var>type</var></em></dt>
<dd>
<p>The <code>extern-alien</code> macro returns an alien with the specified
<var>type</var> which points to an externally defined value.  <var>name</var> is
not evaluated, and may be either a string or a symbol.  <var>type</var> is
an unevaluated alien type specifier.
</p></dd></dl>

<hr>
<a name="Foreign-Data-Structure-Examples"></a>
<div class="header">
<p>
Next: <a href="#Loading-Shared-Object-Files" accesskey="n" rel="next">Loading Shared Object Files</a>, Previous: <a href="#Foreign-Variables" accesskey="p" rel="prev">Foreign Variables</a>, Up: <a href="#Foreign-Function-Interface" accesskey="u" rel="up">Foreign Function Interface</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-Data-Structure-Examples-1"></a>
<h3 class="section">8.5 Foreign Data Structure Examples</h3>

<p>Now that we have alien types, operations and variables, we can
manipulate foreign data structures.  This C declaration
</p>
<div class="example">
<pre class="example">struct foo {
    int a;
    struct foo *b[100];
};
</pre></div>

<p>can be translated into the following alien type:
</p>
<div class="lisp">
<pre class="lisp">(define-alien-type nil
  (struct foo
    (a int)
    (b (array (* (struct foo)) 100))))
</pre></div>

<p>Once the <code>foo</code> alien type has been defined as above, the C
expression
</p>
<div class="example">
<pre class="example">struct foo f;
f.b[7].a;
</pre></div>

<p>can be translated in this way:
</p>
<div class="lisp">
<pre class="lisp">(with-alien ((f (struct foo)))
  (slot (deref (slot f 'b) 7) 'a)
  ;;
  ;; Do something with f...
  )
</pre></div>

<p>Or consider this example of an external C variable and some accesses:
</p>
<div class="example">
<pre class="example">struct c_struct {
        short x, y;
        char a, b;
        int z;
        c_struct *n;
};
extern struct c_struct *my_struct;
my_struct-&gt;x++;
my_struct-&gt;a = 5;
my_struct = my_struct-&gt;n;
</pre></div>

<p>which can be manipulated in Lisp like this:
</p>
<div class="lisp">
<pre class="lisp">(define-alien-type nil
  (struct c-struct
          (x short)
          (y short)
          (a char)
          (b char)
          (z int)
          (n (* c-struct))))
(define-alien-variable &quot;my_struct&quot; (* c-struct))
(incf (slot my-struct 'x))
(setf (slot my-struct 'a) 5)
(setq my-struct (slot my-struct 'n))
</pre></div>

<hr>
<a name="Loading-Shared-Object-Files"></a>
<div class="header">
<p>
Next: <a href="#Foreign-Function-Calls" accesskey="n" rel="next">Foreign Function Calls</a>, Previous: <a href="#Foreign-Data-Structure-Examples" accesskey="p" rel="prev">Foreign Data Structure Examples</a>, Up: <a href="#Foreign-Function-Interface" accesskey="u" rel="up">Foreign Function Interface</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Loading-Shared-Object-Files-1"></a>
<h3 class="section">8.6 Loading Shared Object Files</h3>

<p>Foreign object files can be loaded into the running Lisp process by
calling <code>load-shared-object</code>.
</p>
<a name="Function-sb_002dalien_003aload_002dshared_002dobject"></a><dl>
<dt><a name="index-load_002dshared_002dobject"></a>Function: <strong>load-shared-object</strong> <em>[sb-alien] pathname &amp;key dont-save</em></dt>
<dd><p>Load a shared library / dynamic shared object file / similar foreign
container specified by designated <code>pathname</code>, such as a .so on an <code>elf</code> platform.
</p>
<p>Locating the shared object follows standard rules of the platform, consult the
manual page for dlopen(3) for details. Typically paths specified by
environment variables such as LD_LIBRARY_PATH are searched if the <code>pathname</code> has
no directory, but on some systems (eg. Mac <code>os</code> X) search may happen even if
<code>pathname</code> is absolute. (On Windows LoadLibrary is used instead of dlopen(3).)
</p>
<p>On non-Windows platforms calling <code>load-shared-object</code> again with a <code>pathname</code>
<code>equal</code> to the designated pathname of a previous call will replace the old
definitions; if a symbol was previously referenced through the object and
is not present in the reloaded version an error will be signalled. Reloading
may not work as expected if user or library-code has called dlopen(3) on the
same shared object.
</p>
<p><code>load-shared-object</code> interacts with <code>sb-ext:save-lisp-and-die:</code>
</p>
<p>1. If <code>dont-save</code> is true (default is NIL), the shared object will be dropped
when <code>save-lisp-and-die</code> is called <code>--</code> otherwise shared objects are reloaded
automatically when a saved core starts up. Specifying <code>dont-save</code> can be useful
when the location of the shared object on startup is uncertain.
</p>
<p>2. On most platforms references in compiled code to foreign symbols in shared
objects (such as those generated by DEFINE-ALIEN-ROUTINE) remain valid across
<code>save-lisp-and-die</code>. On those platforms where this is not supported, a <code>warning</code>
will be signalled when the core is saved <code>--</code> this is orthogonal from <code>dont-save</code>.
</p></dd></dl>

<a name="Function-sb_002dalien_003aunload_002dshared_002dobject"></a><dl>
<dt><a name="index-unload_002dshared_002dobject"></a>Function: <strong>unload-shared-object</strong> <em>[sb-alien] pathname</em></dt>
<dd><p>Unloads the shared object loaded earlier using the designated <code>pathname</code> with
<code>load-shared-object</code>, to the degree supported on the platform.
</p>
<p>Experimental.
</p></dd></dl>

<hr>
<a name="Foreign-Function-Calls"></a>
<div class="header">
<p>
Next: <a href="#Step_002dBy_002dStep-Example-of-the-Foreign-Function-Interface" accesskey="n" rel="next">Step-By-Step Example of the Foreign Function Interface</a>, Previous: <a href="#Loading-Shared-Object-Files" accesskey="p" rel="prev">Loading Shared Object Files</a>, Up: <a href="#Foreign-Function-Interface" accesskey="u" rel="up">Foreign Function Interface</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-Function-Calls-1"></a>
<h3 class="section">8.7 Foreign Function Calls</h3>

<p>The foreign function call interface allows a Lisp program to call
many functions written in languages that use the C calling convention.
</p>
<p>Lisp sets up various signal handling routines and other environment
information when it first starts up, and expects these to be in place
at all times. The C functions called by Lisp should not change the
environment, especially the signal handlers: the signal handlers
installed by Lisp typically have interesting flags set (e.g to request
machine context information, or for signal delivery on an alternate
stack) which the Lisp runtime relies on for correct operation.
Precise details of how this works may change without notice between
versions; the source, or the brain of a friendly SBCL developer, is
the only documentation.  Users of a Lisp built with the
<code>:sb-thread</code> feature should also read the section about threads,
<a href="#Threading">Threading</a>.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#The-alien_002dfuncall-Primitive" accesskey="1">The alien-funcall Primitive</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-define_002dalien_002droutine-Macro" accesskey="2">The define-alien-routine Macro</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#define_002dalien_002droutine-Example" accesskey="3">define-alien-routine Example</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Calling-Lisp-From-C" accesskey="4">Calling Lisp From C</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="The-alien_002dfuncall-Primitive"></a>
<div class="header">
<p>
Next: <a href="#The-define_002dalien_002droutine-Macro" accesskey="n" rel="next">The define-alien-routine Macro</a>, Up: <a href="#Foreign-Function-Calls" accesskey="u" rel="up">Foreign Function Calls</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-alien_002dfuncall-Primitive-1"></a>
<h4 class="subsection">8.7.1 The <code>alien-funcall</code> Primitive</h4>

<dl>
<dt><a name="index-alien_002dfuncall"></a>Function: <strong>alien-funcall</strong> <em>[sb-alien] <var>alien-function</var> &amp;rest <var>arguments</var></em></dt>
<dd>
<p>The <code>alien-funcall</code> function is the foreign function call
primitive: <var>alien-function</var> is called with the supplied
<var>arguments</var> and its C return value is returned as a Lisp value.
The <var>alien-function</var> is an arbitrary run-time expression; to refer
to a constant function, use <code>extern-alien</code> or a value defined by
<code>define-alien-routine</code>.
</p>
<p>The type of <code>alien-function</code> must be <code>(alien (function
...))</code>  or <code>(alien (* (function ...)))</code>.  The function type is
used to determine how to call the function (as though it was declared
with a prototype.)  The type need not be known at compile time, but
only known-type calls are efficiently compiled.  Limitations:
</p>
<ul>
<li> Structure type return values are not implemented.

</li><li> Passing of structures by value is not implemented.

</li></ul>

</dd></dl>

<p>Here is an example which allocates a <code>(struct foo)</code>, calls a
foreign function to initialize it, then returns a Lisp vector of all
the <code>(* (struct foo))</code> objects filled in by the foreign call:
</p>
<div class="lisp">
<pre class="lisp">;; Allocate a foo on the stack.
(with-alien ((f (struct foo)))
  ;; Call some C function to fill in foo fields.
  (alien-funcall (extern-alien &quot;mangle_foo&quot; (function void (* foo)))
                 (addr f))
  ;; Find how many foos to use by getting the A field.
  (let* ((num (slot f 'a))
         (result (make-array num)))
    ;; Get a pointer to the array so that we don't have to keep extracting it:
    (with-alien ((a (* (array (* (struct foo)) 100)) (addr (slot f 'b))))
      ;; Loop over the first N elements and stash them in the result vector.
      (dotimes (i num)
        (setf (svref result i) (deref (deref a) i)))
      ;; Voila.
      result)))
</pre></div>

<hr>
<a name="The-define_002dalien_002droutine-Macro"></a>
<div class="header">
<p>
Next: <a href="#define_002dalien_002droutine-Example" accesskey="n" rel="next">define-alien-routine Example</a>, Previous: <a href="#The-alien_002dfuncall-Primitive" accesskey="p" rel="prev">The alien-funcall Primitive</a>, Up: <a href="#Foreign-Function-Calls" accesskey="u" rel="up">Foreign Function Calls</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-define_002dalien_002droutine-Macro-1"></a>
<h4 class="subsection">8.7.2 The <code>define-alien-routine</code> Macro</h4>

<dl>
<dt><a name="index-define_002dalien_002droutine"></a>Macro: <strong>define-alien-routine</strong> <em>[sb-alien] <var>name</var> <var>result-type</var> &amp;rest <var>arg-specifiers</var></em></dt>
<dd>
<p>The <code>define-alien-routine</code> macro is a convenience for
automatically generating Lisp interfaces to simple foreign functions.
The primary feature is the parameter style specification, which
translates the C pass-by-reference idiom into additional return
values.
</p>
<p><var>name</var> is usually a string external symbol, but may also be a
symbol Lisp name or a list of the foreign name and the Lisp name.  If
only one name is specified, the other is automatically derived as for
<code>extern-alien</code>.  <var>result-type</var> is the alien type of the
return value.
</p>
<p>Each element of the <var>arg-specifiers</var> list
specifies an argument to the foreign function, and is
of the form
</p><div class="lisp">
<pre class="lisp">(aname atype &amp;amp;optional style)
</pre></div>

<p><var>aname</var> is the symbol name of the argument to the constructed
function (for documentation). <var>atype</var> is the alien type of
corresponding foreign argument.  The semantics of the actual call are
the same as for <code>alien-funcall</code>. <var>style</var> specifies how this
argument should be handled at call and return time, and should be one
of the following:
</p>
<ul>
<li> <code>:in</code> specifies that the argument is passed by value. This is the
default. <code>:in</code> arguments have no corresponding return value from
the Lisp function.

</li><li> <code>:copy</code> is similar to <code>:in</code>, but the argument is copied to a
pre-allocated object and a pointer to this object is passed to the
foreign routine.

</li><li> <code>:out</code> specifies a pass-by-reference output value.  The type of
the argument must be a pointer to a fixed-sized object (such as an
integer or pointer).  <code>:out</code> and <code>:in-out</code> style cannot be
used with pointers to arrays, records or functions.  An object of the
correct size is allocated on the stack, and its address is passed to
the foreign function.  When the function returns, the contents of this
location are returned as one of the values of the Lisp function (and
the location is automatically deallocated).

</li><li> <code>:in-out</code> is a combination of <code>:copy</code> and <code>:out</code>.  The
argument is copied to a pre-allocated object and a pointer to this
object is passed to the foreign routine.  On return, the contents of
this location is returned as an additional value.

</li></ul>

<blockquote>
<p>Note: Any efficiency-critical foreign interface function should be inline
expanded, which can be done by preceding the
<code>define-alien-routine</code> call with:
</p>
<div class="lisp">
<pre class="lisp">(declaim (inline lisp-name))
</pre></div>

<p>In addition to avoiding the Lisp call overhead, this allows
pointers, word-integers and floats to be passed using non-descriptor
representations, avoiding consing.)
</p></blockquote>

</dd></dl>

<hr>
<a name="define_002dalien_002droutine-Example"></a>
<div class="header">
<p>
Next: <a href="#Calling-Lisp-From-C" accesskey="n" rel="next">Calling Lisp From C</a>, Previous: <a href="#The-define_002dalien_002droutine-Macro" accesskey="p" rel="prev">The define-alien-routine Macro</a>, Up: <a href="#Foreign-Function-Calls" accesskey="u" rel="up">Foreign Function Calls</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="define_002dalien_002droutine-Example-1"></a>
<h4 class="subsection">8.7.3 <code>define-alien-routine</code> Example</h4>

<p>Consider the C function <code>cfoo</code> with the following calling
convention:
</p>
<div class="example">
<pre class="example">void
cfoo (str, a, i)
    char *str;
    char *a; /* update */
    int *i; /* out */
{
  /* body of cfoo(...) */
}
</pre></div>

<p>This can be described by the following call to
<code>define-alien-routine</code>:
</p>
<div class="lisp">
<pre class="lisp">(define-alien-routine &quot;cfoo&quot; void
  (str c-string)
  (a char :in-out)
  (i int :out))
</pre></div>

<p>The Lisp function <code>cfoo</code> will have two arguments (<var>str</var> and
<var>a</var>) and two return values (<var>a</var> and <var>i</var>).
</p>
<hr>
<a name="Calling-Lisp-From-C"></a>
<div class="header">
<p>
Previous: <a href="#define_002dalien_002droutine-Example" accesskey="p" rel="prev">define-alien-routine Example</a>, Up: <a href="#Foreign-Function-Calls" accesskey="u" rel="up">Foreign Function Calls</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Calling-Lisp-From-C-1"></a>
<h4 class="subsection">8.7.4 Calling Lisp From C</h4>

<p>Calling Lisp functions from C is sometimes possible, but is extremely
hackish and poorly supported as of SBCL 0.7.5.  See <code>funcall0</code>
&hellip; <code>funcall3</code> in the runtime system. The arguments must be
valid SBCL object descriptors (so that e.g. fixnums must be
left-shifted by 2.) As of SBCL 0.7.5, the format of object descriptors
is documented only by the source code and, in parts, by the old CMUCL
<samp>INTERNALS</samp> documentation.
</p>
<p>Note that the garbage collector moves objects, and won&rsquo;t be
able to fix up any references in C variables.  There are three
mechanisms for coping with this:
</p>
<ol>
<li> The <code>sb-ext:purify</code> moves all live Lisp
data into static or read-only areas such that it will never be moved
(or freed) again in the life of the Lisp session

</li><li> <code>sb-sys:with-pinned-objects</code> is a macro which arranges for some
set of objects to be pinned in memory for the dynamic extent of its
body forms.  On ports which use the generational garbage collector (as
of SBCL 0.8.3, only the x86) this has a page granularity - i.e. the
entire 4k page or pages containing the objects will be locked down. On
other ports it is implemented by turning off GC for the duration (so
could be said to have a whole-world granularity).

</li><li> Disable GC, using the <code>without-gcing</code> macro.
</li></ol>






<hr>
<a name="Step_002dBy_002dStep-Example-of-the-Foreign-Function-Interface"></a>
<div class="header">
<p>
Previous: <a href="#Foreign-Function-Calls" accesskey="p" rel="prev">Foreign Function Calls</a>, Up: <a href="#Foreign-Function-Interface" accesskey="u" rel="up">Foreign Function Interface</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Step_002dBy_002dStep-Example-of-the-Foreign-Function-Interface-1"></a>
<h3 class="section">8.8 Step-By-Step Example of the Foreign Function Interface</h3>

<p>This section presents a complete example of an interface to a somewhat
complicated C function.
</p>
<p>Suppose you have the following C function which you want to be able to
call from Lisp in the file <samp>test.c</samp>
</p>
<div class="example">
<pre class="example">struct c_struct
{
  int x;
  char *s;
};

struct c_struct *c_function (i, s, r, a)
    int i;
    char *s;
    struct c_struct *r;
    int a[10];
{
  int j;
  struct c_struct *r2;

  printf(&quot;i = %d\n&quot;, i);
  printf(&quot;s = %s\n&quot;, s);
  printf(&quot;r-&gt;x = %d\n&quot;, r-&gt;x);
  printf(&quot;r-&gt;s = %s\n&quot;, r-&gt;s);
  for (j = 0; j &lt; 10; j++) printf(&quot;a[%d] = %d.\n&quot;, j, a[j]);
  r2 = (struct c_struct *) malloc (sizeof(struct c_struct));
  r2-&gt;x = i + 5;
  r2-&gt;s = &quot;a C string&quot;;
  return(r2);
};
</pre></div>

<p>It is possible to call this C function from Lisp using the file
<samp>test.lisp</samp> containing
</p>
<div class="lisp">
<pre class="lisp">(cl:defpackage &quot;TEST-C-CALL&quot; (:use &quot;CL&quot; &quot;SB-ALIEN&quot; &quot;SB-C-CALL&quot;))
(cl:in-package &quot;TEST-C-CALL&quot;)

;;; Define the record C-STRUCT in Lisp.
(define-alien-type nil
    (struct c-struct
            (x int)
            (s c-string)))

;;; Define the Lisp function interface to the C routine.  It returns a
;;; pointer to a record of type C-STRUCT.  It accepts four parameters:
;;; I, an int; S, a pointer to a string; R, a pointer to a C-STRUCT
;;; record; and A, a pointer to the array of 10 ints.
;;;
;;; The INLINE declaration eliminates some efficiency notes about heap
;;; allocation of alien values.
(declaim (inline c-function))
(define-alien-routine c-function
    (* (struct c-struct))
  (i int)
  (s c-string)
  (r (* (struct c-struct)))
  (a (array int 10)))

;;; a function which sets up the parameters to the C function and
;;; actually calls it
(defun call-cfun ()
  (with-alien ((ar (array int 10))
               (c-struct (struct c-struct)))
    (dotimes (i 10)                     ; Fill array.
      (setf (deref ar i) i))
    (setf (slot c-struct 'x) 20)
    (setf (slot c-struct 's) &quot;a Lisp string&quot;)

    (with-alien ((res (* (struct c-struct))
                      (c-function 5 &quot;another Lisp string&quot; (addr c-struct) ar)))
      (format t &quot;~&amp;amp;back from C function~%&quot;)
      (multiple-value-prog1
          (values (slot res 'x)
                  (slot res 's))

        ;; Deallocate result. (after we are done referring to it:
        ;; &quot;Pillage, *then* burn.&quot;)
        (free-alien res)))))
</pre></div>

<p>To execute the above example, it is necessary to compile the C
routine, e.g.: &lsquo;<samp>cc -c test.c &amp;&amp; ld -shared -o test.so test.o</samp>&rsquo; (In
order to enable incremental loading with some linkers, you may need to
say &lsquo;<samp>cc -G 0 -c test.c</samp>&rsquo;)
</p>
<p>Once the C code has been compiled, you can start up Lisp and load it in:
&lsquo;<samp>sbcl</samp>&rsquo;.  Lisp should start up with its normal prompt.
</p>
<p>Within Lisp, compile the Lisp file. (This step can be done
separately. You don&rsquo;t have to recompile every time.)
&lsquo;<samp>(compile-file &quot;test.lisp&quot;)</samp>&rsquo;
</p>
<p>Within Lisp, load the foreign object file to define the necessary
symbols: &lsquo;<samp>(load-shared-object &quot;test.so&quot;)</samp>&rsquo;.
</p>
<p>Now you can load the compiled Lisp (&ldquo;fasl&rdquo;) file into Lisp:
&lsquo;<samp>(load &quot;test.fasl&quot;)</samp>&rsquo;
And once the Lisp file is loaded, you can call the
Lisp routine that sets up the parameters and calls the C
function:
&lsquo;<samp>(test-c-call::call-cfun)</samp>&rsquo;
</p>
<p>The C routine should print the following information to standard output:
</p>
<div class="example">
<pre class="example">i = 5
s = another Lisp string
r-&gt;x = 20
r-&gt;s = a 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.
</pre></div>

<p>After return from the C function,
the Lisp wrapper function should print the following output:
</p>
<div class="example">
<pre class="example">back from C function
</pre></div>

<p>And upon return from the Lisp wrapper function,
before the next prompt is printed, the
Lisp read-eval-print loop should print the following return values:
</p>
<div class="example">
<pre class="example">10
&quot;a C string&quot;
</pre></div>
<hr>
<a name="Pathnames"></a>
<div class="header">
<p>
Next: <a href="#Streams" accesskey="n" rel="next">Streams</a>, Previous: <a href="#Foreign-Function-Interface" accesskey="p" rel="prev">Foreign Function Interface</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Pathnames-1"></a>
<h2 class="chapter">9 Pathnames</h2>

<a name="index-Pathnames"></a>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Lisp-Pathnames" accesskey="1">Lisp Pathnames</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Native-Filenames" accesskey="2">Native Filenames</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Lisp-Pathnames"></a>
<div class="header">
<p>
Next: <a href="#Native-Filenames" accesskey="n" rel="next">Native Filenames</a>, Up: <a href="#Pathnames" accesskey="u" rel="up">Pathnames</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Lisp-Pathnames-1"></a>
<h3 class="section">9.1 Lisp Pathnames</h3>

<p>There are many aspects of ANSI Common Lisp&rsquo;s pathname support which are
implementation-defined and so need documentation.
</p>

<a name="Home-Directory-Specifiers"></a>
<h4 class="subsection">9.1.1 Home Directory Specifiers</h4>

<p>SBCL accepts the keyword <code>:home</code> and a list of the form
<code>(:home &quot;username&quot;)</code> as a directory component immediately
following <code>:absolute</code>.
</p>
<p><code>:home</code> is represented in namestrings by <code>~/</code> and
<code>(:home &quot;username&quot;</code> by <code>~username/</code> at the start of the
namestring. Tilde-characters elsewhere in namestrings represent
themselves.
</p>
<p>Home directory specifiers are resolved to home directory of the
current or specified user by <code>native-namestring</code>, which is used
by the implementation to translate pathnames before passing them on to
operating system specific routines.
</p>
<p>Using <code>(:home &quot;user&quot;)</code> form on Windows signals an error.
</p>
<a name="The-SYS-Logical-Pathname-Host"></a>
<h4 class="subsection">9.1.2 The SYS Logical Pathname Host</h4>

<a name="index-Logical-pathnames"></a>
<a name="index-Pathnames_002c-logical"></a>
<a name="index-logical_002dpathname_002dtranslations-_005bcl_005d"></a>
<a name="index-_0028setf-logical_002dpathname_002dtranslations-_005bcl_005d_0029"></a>


<p>The logical pathname host named by <code>&quot;SYS&quot;</code> exists in SBCL.  Its
<code>logical-pathname-translations</code> may be set by the site or the user
applicable to point to the locations of the system&rsquo;s sources; in
particular, the core system&rsquo;s source files match the logical pathname
<code>&quot;SYS:SRC;**;*.*.*&quot;</code>, and the contributed modules&rsquo; source files
match <code>&quot;SYS:CONTRIB;**;*.*.*&quot;</code>.
</p>
<a name="Function-sb_002dext_003aset_002dsbcl_002dsource_002dlocation"></a><dl>
<dt><a name="index-set_002dsbcl_002dsource_002dlocation"></a>Function: <strong>set-sbcl-source-location</strong> <em>[sb-ext] pathname</em></dt>
<dd><p>Initialize the <code>sys</code> logical host based on <code>pathname</code>, which should be
the top-level directory of the <code>sbcl</code> sources. This will replace any
existing translations for &quot;SYS:SRC;&quot;, &quot;SYS:CONTRIB;&quot;, and
&quot;SYS:OUTPUT;&quot;. Other &quot;SYS:&quot; translations are preserved.
</p></dd></dl>

<hr>
<a name="Native-Filenames"></a>
<div class="header">
<p>
Previous: <a href="#Lisp-Pathnames" accesskey="p" rel="prev">Lisp Pathnames</a>, Up: <a href="#Pathnames" accesskey="u" rel="up">Pathnames</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Native-Filenames-1"></a>
<h3 class="section">9.2 Native Filenames</h3>

<p>In some circumstances, what is wanted is a Lisp pathname object which
corresponds to a string produced by the Operating System.  In this case,
some of the default parsing rules are inappropriate: most filesystems do
not have a native understanding of wild pathnames; such functionality is
often provided by shells above the OS, often in mutually-incompatible
ways.
</p>
<p>To allow the user to deal with this, the following functions are
provided: <code>parse-native-namestring</code> and <code>native-pathname</code>
return the closest equivalent Lisp pathname to a given string
(appropriate for the Operating System), while <code>native-namestring</code>
converts a non-wild pathname designator to the equivalent native
namestring, if possible.  Some Lisp pathname concepts (such as the
<code>:back</code> directory component) have no direct equivalents in most
Operating Systems; the behaviour of <code>native-namestring</code> is
unspecified if an inappropriate pathname designator is passed to it.
Additionally, note that conversion from pathname to native filename
and back to pathname should not be expected to preserve equivalence
under <code>equal</code>.
</p>
<a name="Function-sb_002dext_003aparse_002dnative_002dnamestring"></a><dl>
<dt><a name="index-parse_002dnative_002dnamestring"></a>Function: <strong>parse-native-namestring</strong> <em>[sb-ext] thing &amp;optional host defaults &amp;key start end junk-allowed as-directory</em></dt>
<dd><p>Convert <code>thing</code> into a pathname, using the native conventions
appropriate for the pathname host <code>host</code>, or if not specified the
host of <code>defaults</code>.  If <code>thing</code> is a string, the parse is bounded by
<code>start</code> and <code>end</code>, and error behaviour is controlled by <code>junk-allowed</code>,
as with <code>parse-namestring</code>.  For file systems whose native
conventions allow directories to be indicated as files, if
<code>as-directory</code> is true, return a pathname denoting <code>thing</code> as a
directory.
</p></dd></dl>
<a name="Function-sb_002dext_003anative_002dpathname"></a><dl>
<dt><a name="index-native_002dpathname"></a>Function: <strong>native-pathname</strong> <em>[sb-ext] pathspec</em></dt>
<dd><p>Convert <code>pathspec</code> (a pathname designator) into a pathname, assuming
the operating system native pathname conventions.
</p></dd></dl>
<a name="Function-sb_002dext_003anative_002dnamestring"></a><dl>
<dt><a name="index-native_002dnamestring"></a>Function: <strong>native-namestring</strong> <em>[sb-ext] pathname &amp;key as-file</em></dt>
<dd><p>Construct the full native (name)string form of <code>pathname</code>.  For
file systems whose native conventions allow directories to be
indicated as files, if <code>as-file</code> is true and the name, type, and
version components of <code>pathname</code> are all <code>nil</code> or <code>:unspecific</code>,
construct a string that names the directory according to the file
system&rsquo;s syntax for files.
</p></dd></dl>

<p>Because some file systems permit the names of directories to be
expressed in multiple ways, it is occasionally necessary to parse a
native file name &ldquo;as a directory name&rdquo; or to produce a native file
name that names a directory &ldquo;as a file&rdquo;.  For these cases,
<code>parse-native-namestring</code> accepts the keyword argument
<code>as-directory</code> to force a filename to parse as a directory, and
<code>native-namestring</code> accepts the keyword argument <code>as-file</code>
to force a pathname to unparse as a file.  For example,
</p>
<div class="lisp">
<pre class="lisp">; On Unix, the directory &quot;/tmp/&quot; can be denoted by &quot;/tmp/&quot; or &quot;/tmp&quot;.
; Under the default rules for native filenames, these parse and
; unparse differently.
(defvar *p*)
(setf *p* (parse-native-namestring &quot;/tmp/&quot;)) &rArr; #P&quot;/tmp/&quot;
(pathname-name *p*) &rArr; NIL
(pathname-directory *p*) &rArr; (:ABSOLUTE &quot;tmp&quot;)
(native-namestring *p*) &rArr; &quot;/tmp/&quot;

(setf *p* (parse-native-namestring &quot;/tmp&quot;)) &rArr; #P&quot;/tmp&quot;
(pathname-name *p*) &rArr; &quot;tmp&quot;
(pathname-directory *p*) &rArr; (:ABSOLUTE)
(native-namestring *p*) &rArr; &quot;/tmp&quot;

; A non-NIL AS-DIRECTORY argument to PARSE-NATIVE-NAMESTRING forces
; both the second string to parse the way the first does.
(setf *p* (parse-native-namestring &quot;/tmp&quot;
                                   nil *default-pathname-defaults*
                                   :as-directory t)) &rArr; #P&quot;/tmp/&quot;
(pathname-name *p*) &rArr; NIL
(pathname-directory *p*) &rArr; (:ABSOLUTE &quot;tmp&quot;)

; A non-NIL AS-FILE argument to NATIVE-NAMESTRING forces the pathname
; parsed from the first string to unparse as the second string.
(setf *p* (parse-native-namestring &quot;/tmp/&quot;)) &rArr; #P&quot;/tmp/&quot;
(native-namestring *p* :as-file t) &rArr; &quot;/tmp&quot;
</pre></div>
<hr>
<a name="Streams"></a>
<div class="header">
<p>
Next: <a href="#Package-Locks" accesskey="n" rel="next">Package Locks</a>, Previous: <a href="#Pathnames" accesskey="p" rel="prev">Pathnames</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Streams-1"></a>
<h2 class="chapter">10 Streams</h2>

<p>Streams which read or write Lisp character data from or to the outside
world &ndash; files, sockets or other external entities &ndash; require the
specification of a conversion between the external, binary data and the
Lisp characters.  In ANSI Common Lisp, this is done by specifying the
<code>:external-format</code> argument when the stream is created.  The major
information required is an <em>encoding</em>, specified by a keyword
naming that encoding; however, it is also possible to specify
refinements to that encoding as additional options to the external
format designator.
</p>
<p>In addition, SBCL supports various extensions of ANSI Common Lisp
streams:
</p>
<dl compact="compact">
<dt><strong>Bivalent Streams</strong></dt>
<dd><p>A type of stream that can read and write both <code>character</code> and
<code>(unsigned-byte 8)</code> values.
</p>
</dd>
<dt><strong>Gray Streams</strong></dt>
<dd><p>User-overloadable CLOS classes whose instances can be used as Lisp
streams (e.g. passed as the first argument to <code>format</code>).
</p>
</dd>
<dt><strong>Simple Streams</strong></dt>
<dd><p>The bundled contrib module <em>sb-simple-streams</em> implements a subset
of the Franz Allegro simple-streams proposal.
</p>
</dd>
</dl>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#External-Formats" accesskey="1">External Formats</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Bivalent-Streams" accesskey="2">Bivalent Streams</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Gray-Streams" accesskey="3">Gray Streams</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Simple-Streams" accesskey="4">Simple Streams</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="External-Formats"></a>
<div class="header">
<p>
Next: <a href="#Bivalent-Streams" accesskey="n" rel="next">Bivalent Streams</a>, Up: <a href="#Streams" accesskey="u" rel="up">Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="External-Formats-1"></a>
<h3 class="section">10.1 External Formats</h3>
<a name="index-External-formats-1"></a>

<a name="index-stream_002dexternal_002dformat-_005bcl_005d"></a>
<p>The encodings supported by SBCL as external formats are named by
keyword.  Each encoding has a canonical name, which will be encoding
returned by <code>stream-external-format</code>, and a number of aliases for
convenience, as shown in the table below:
</p>
<dl compact="compact">
<dt><code>:ASCII</code></dt>
<dd><p><code>:US-ASCII</code>, <code>:ANSI_X3.4-1968</code>, <code>:ISO-646</code>, <code>:ISO-646-US</code>, <code>:|646|</code>
</p>
</dd>
<dt><code>:CP1250</code></dt>
<dd><p><code>:|cp1250|</code>, <code>:WINDOWS-1250</code>, <code>:|windows-1250|</code>
</p>
</dd>
<dt><code>:CP1251</code></dt>
<dd><p><code>:|cp1251|</code>, <code>:WINDOWS-1251</code>, <code>:|windows-1251|</code>
</p>
</dd>
<dt><code>:CP1252</code></dt>
<dd><p><code>:|cp1252|</code>, <code>:WINDOWS-1252</code>, <code>:|windows-1252|</code>
</p>
</dd>
<dt><code>:CP1253</code></dt>
<dd><p><code>:|cp1253|</code>, <code>:WINDOWS-1253</code>, <code>:|windows-1253|</code>
</p>
</dd>
<dt><code>:CP1254</code></dt>
<dd><p><code>:|cp1254|</code>
</p>
</dd>
<dt><code>:CP1255</code></dt>
<dd><p><code>:|cp1255|</code>, <code>:WINDOWS-1255</code>, <code>:|windows-1255|</code>
</p>
</dd>
<dt><code>:CP1256</code></dt>
<dd><p><code>:|cp1256|</code>, <code>:WINDOWS-1256</code>, <code>:|windows-1256|</code>
</p>
</dd>
<dt><code>:CP1257</code></dt>
<dd><p><code>:|cp1257|</code>, <code>:WINDOWS-1257</code>, <code>:|windows-1257|</code>
</p>
</dd>
<dt><code>:CP1258</code></dt>
<dd><p><code>:|cp1258|</code>, <code>:WINDOWS-1258</code>, <code>:|windows-1258|</code>
</p>
</dd>
<dt><code>:CP437</code></dt>
<dd><p><code>:|cp437|</code>
</p>
</dd>
<dt><code>:CP850</code></dt>
<dd><p><code>:|cp850|</code>
</p>
</dd>
<dt><code>:CP852</code></dt>
<dd><p><code>:|cp852|</code>
</p>
</dd>
<dt><code>:CP855</code></dt>
<dd><p><code>:|cp855|</code>
</p>
</dd>
<dt><code>:CP857</code></dt>
<dd><p><code>:|cp857|</code>
</p>
</dd>
<dt><code>:CP860</code></dt>
<dd><p><code>:|cp860|</code>
</p>
</dd>
<dt><code>:CP861</code></dt>
<dd><p><code>:|cp861|</code>
</p>
</dd>
<dt><code>:CP862</code></dt>
<dd><p><code>:|cp862|</code>
</p>
</dd>
<dt><code>:CP863</code></dt>
<dd><p><code>:|cp863|</code>
</p>
</dd>
<dt><code>:CP864</code></dt>
<dd><p><code>:|cp864|</code>
</p>
</dd>
<dt><code>:CP865</code></dt>
<dd><p><code>:|cp865|</code>
</p>
</dd>
<dt><code>:CP866</code></dt>
<dd><p><code>:|cp866|</code>
</p>
</dd>
<dt><code>:CP869</code></dt>
<dd><p><code>:|cp869|</code>
</p>
</dd>
<dt><code>:CP874</code></dt>
<dd><p><code>:|cp874|</code>
</p>
</dd>
<dt><code>:EBCDIC-US</code></dt>
<dd><p><code>:CP037</code>, <code>:|cp037|</code>, <code>:IBM-037</code>, <code>:IBM037</code>
</p>
</dd>
<dt><code>:EUC-JP</code></dt>
<dd><p><code>:EUCJP</code>, <code>:|eucJP|</code>
</p>
</dd>
<dt><code>:GBK</code></dt>
<dd><p><code>:CP936</code>
</p>
</dd>
<dt><code>:ISO-8859-10</code></dt>
<dd><p><code>:|iso-8859-10|</code>, <code>:LATIN-6</code>, <code>:|latin-6|</code>
</p>
</dd>
<dt><code>:ISO-8859-11</code></dt>
<dd><p><code>:|iso-8859-11|</code>
</p>
</dd>
<dt><code>:ISO-8859-13</code></dt>
<dd><p><code>:|iso-8859-13|</code>, <code>:LATIN-7</code>, <code>:|latin-7|</code>
</p>
</dd>
<dt><code>:ISO-8859-14</code></dt>
<dd><p><code>:|iso-8859-14|</code>, <code>:LATIN-8</code>, <code>:|latin-8|</code>
</p>
</dd>
<dt><code>:ISO-8859-2</code></dt>
<dd><p><code>:|iso-8859-2|</code>, <code>:LATIN-2</code>, <code>:|latin-2|</code>
</p>
</dd>
<dt><code>:ISO-8859-3</code></dt>
<dd><p><code>:|iso-8859-3|</code>, <code>:LATIN-3</code>, <code>:|latin-3|</code>
</p>
</dd>
<dt><code>:ISO-8859-4</code></dt>
<dd><p><code>:|iso-8859-4|</code>, <code>:LATIN-4</code>, <code>:|latin-4|</code>
</p>
</dd>
<dt><code>:ISO-8859-5</code></dt>
<dd><p><code>:|iso-8859-5|</code>
</p>
</dd>
<dt><code>:ISO-8859-6</code></dt>
<dd><p><code>:|iso-8859-6|</code>
</p>
</dd>
<dt><code>:ISO-8859-7</code></dt>
<dd><p><code>:|iso-8859-7|</code>
</p>
</dd>
<dt><code>:ISO-8859-8</code></dt>
<dd><p><code>:|iso-8859-8|</code>
</p>
</dd>
<dt><code>:ISO-8859-9</code></dt>
<dd><p><code>:|iso-8859-9|</code>, <code>:LATIN-5</code>, <code>:|latin-5|</code>
</p>
</dd>
<dt><code>:KOI8-R</code></dt>
<dd><p><code>:|koi8-r|</code>
</p>
</dd>
<dt><code>:KOI8-U</code></dt>
<dd><p><code>:|koi8-u|</code>
</p>
</dd>
<dt><code>:LATIN-1</code></dt>
<dd><p><code>:LATIN1</code>, <code>:ISO-8859-1</code>, <code>:ISO8859-1</code>
</p>
</dd>
<dt><code>:LATIN-9</code></dt>
<dd><p><code>:LATIN9</code>, <code>:ISO-8859-15</code>, <code>:ISO8859-15</code>
</p>
</dd>
<dt><code>:MAC-ROMAN</code></dt>
<dd><p><code>:|mac-roman|</code>, <code>:|MacRoman|</code>, <code>:MAC</code>, <code>:|mac|</code>, <code>:MACINTOSH</code>, <code>:|macintosh|</code>
</p>
</dd>
<dt><code>:SHIFT_JIS</code></dt>
<dd><p><code>:SJIS</code>, <code>:|Shift_JIS|</code>, <code>:CP932</code>
</p>
</dd>
<dt><code>:UCS-2BE</code></dt>
<dd><p><code>:UCS2BE</code>
</p>
</dd>
<dt><code>:UCS-2LE</code></dt>
<dd><p><code>:UCS2LE</code>
</p>
</dd>
<dt><code>:UCS-4BE</code></dt>
<dd><p><code>:UCS4BE</code>
</p>
</dd>
<dt><code>:UCS-4LE</code></dt>
<dd><p><code>:UCS4LE</code>
</p>
</dd>
<dt><code>:UTF-16BE</code></dt>
<dd><p><code>:UTF16BE</code>
</p>
</dd>
<dt><code>:UTF-16LE</code></dt>
<dd><p><code>:UTF16LE</code>
</p>
</dd>
<dt><code>:UTF-32BE</code></dt>
<dd><p><code>:UTF32BE</code>
</p>
</dd>
<dt><code>:UTF-32LE</code></dt>
<dd><p><code>:UTF32LE</code>
</p>
</dd>
<dt><code>:UTF-8</code></dt>
<dd><p><code>:UTF8</code>
</p>
</dd>
<dt><code>:X-MAC-CYRILLIC</code></dt>
<dd><p><code>:|x-mac-cyrillic|</code>
</p>
</dd>
</dl>

<a name="index-open-_005bcl_005d"></a>
<a name="index-with_002dopen_002dfile-_005bcl_005d"></a>
<p>In situations where an external file format designator is required, such
as the <code>:external-format</code> argument in calls to <code>open</code> or
<code>with-open-file</code>, users may supply the name of an encoding to
denote the external format which is applying that encoding to Lisp
characters.
</p>
<p>In addition to the basic encoding for an external format, options
controlling various special cases may be passed, by using a list (whose
first element must be an encoding name and whose rest is a plist) as an
external file format designator.  At present, the only supported key in
the plist is <code>:replacement</code>, where the corresponding value is a
string designator which is used as a replacement when an encoding or
decoding error happens, handling those errors without user intervention;
for example:
</p><div class="lisp">
<pre class="lisp">(with-open-file (i pathname :external-format '(:utf-8 :replacement #\?))
  (read-line i))
</pre></div>
<p>will read the first line of <var>pathname</var>, replacing any invalid utf-8
sequences with question marks.
</p>
<hr>
<a name="Bivalent-Streams"></a>
<div class="header">
<p>
Next: <a href="#Gray-Streams" accesskey="n" rel="next">Gray Streams</a>, Previous: <a href="#External-Formats" accesskey="p" rel="prev">External Formats</a>, Up: <a href="#Streams" accesskey="u" rel="up">Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Bivalent-Streams-1"></a>
<h3 class="section">10.2 Bivalent Streams</h3>

<p>A <em>bivalent stream</em> can be used to read and write both
<code>character</code> and <code>(unsigned-byte 8)</code> values.  A bivalent
stream is created by calling <code>open</code> with the argument <code>:element-type
:default</code>.  On such a stream, both binary and character data can be
read and written with the usual input and output functions.
</p>
<blockquote>
<p>Streams are <em>not</em> created bivalent by default for performance
reasons.  Bivalent streams are incompatible with
<code>fast-read-char</code>, an internal optimization in SBCL&rsquo;s stream
machinery that bulk-converts octets to characters and implements a
fast path through <code>read-char</code>.
</p></blockquote>

<hr>
<a name="Gray-Streams"></a>
<div class="header">
<p>
Next: <a href="#Simple-Streams" accesskey="n" rel="next">Simple Streams</a>, Previous: <a href="#Bivalent-Streams" accesskey="p" rel="prev">Bivalent Streams</a>, Up: <a href="#Streams" accesskey="u" rel="up">Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Gray-Streams-1"></a>
<h3 class="section">10.3 Gray Streams</h3>


<p>The Gray Streams interface is a widely supported extension that
provides for definition of CLOS-extensible stream classes.  Gray
stream classes are implemented by adding methods to generic functions
analogous to Common Lisp&rsquo;s standard I/O functions.  Instances of Gray
stream classes may be used with any I/O operation where a non-Gray
stream can, provided that all required methods have been implemented
suitably.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Gray-Streams-classes" accesskey="1">Gray Streams classes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Methods-common-to-all-streams" accesskey="2">Methods common to all streams</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Input-stream-methods" accesskey="3">Input stream methods</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Character-input-stream-methods" accesskey="4">Character input stream methods</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Output-stream-methods" accesskey="5">Output stream methods</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Character-output-stream-methods" accesskey="6">Character output stream methods</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Binary-stream-methods" accesskey="7">Binary stream methods</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Gray-Streams-examples" accesskey="8">Gray Streams examples</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Gray-Streams-classes"></a>
<div class="header">
<p>
Next: <a href="#Methods-common-to-all-streams" accesskey="n" rel="next">Methods common to all streams</a>, Up: <a href="#Gray-Streams" accesskey="u" rel="up">Gray Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Gray-Streams-classes-1"></a>
<h4 class="subsection">10.3.1 Gray Streams classes</h4>

<p>The defined Gray Stream classes are these:
</p>
<a name="Class-sb_002dgray_003afundamental_002dstream"></a><dl>
<dt><a name="index-fundamental_002dstream"></a>Class: <strong>fundamental-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-stream, standard-object, stream, t</code>
</p>
<p>Base class for all Gray streams.
</p></dd></dl>
<a name="Class-sb_002dgray_003afundamental_002dinput_002dstream"></a><dl>
<dt><a name="index-fundamental_002dinput_002dstream"></a>Class: <strong>fundamental-input-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-input-stream, fundamental-stream, standard-object, stream, t</code>
</p>
<p>Superclass of all Gray input streams.
</p></dd></dl>

<p>The function input-stream-p will return true of any generalized
instance of fundamental-input-stream.
</p>
<a name="Class-sb_002dgray_003afundamental_002doutput_002dstream"></a><dl>
<dt><a name="index-fundamental_002doutput_002dstream"></a>Class: <strong>fundamental-output-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-output-stream, fundamental-stream, standard-object, stream, t</code>
</p>
<p>Superclass of all Gray output streams.
</p></dd></dl>

<p>The function output-stream-p will return true of any generalized
instance of fundamental-output-stream.
</p>
<a name="Class-sb_002dgray_003afundamental_002dbinary_002dstream"></a><dl>
<dt><a name="index-fundamental_002dbinary_002dstream"></a>Class: <strong>fundamental-binary-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-binary-stream, fundamental-stream, standard-object, stream, t</code>
</p>
<p>Superclass of all Gray streams whose element-type
is a subtype of unsigned-byte or signed-byte.
</p></dd></dl>

<p>Note that instantiable subclasses of fundamental-binary-stream should
provide (or inherit) an applicable method for the generic function
stream-element-type.
</p>
<a name="Class-sb_002dgray_003afundamental_002dcharacter_002dstream"></a><dl>
<dt><a name="index-fundamental_002dcharacter_002dstream"></a>Class: <strong>fundamental-character-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-character-stream, fundamental-stream, standard-object, stream, t</code>
</p>
<p>Superclass of all Gray streams whose element-type is a subtype of character.
</p></dd></dl>
<a name="Class-sb_002dgray_003afundamental_002dbinary_002dinput_002dstream"></a><dl>
<dt><a name="index-fundamental_002dbinary_002dinput_002dstream"></a>Class: <strong>fundamental-binary-input-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-binary-input-stream, fundamental-input-stream, fundamental-binary-stream, fundamental-stream, standard-object, stream, t</code>
</p>
<p>Superclass of all Gray input streams whose element-type
is a subtype of unsigned-byte or signed-byte.
</p></dd></dl>
<a name="Class-sb_002dgray_003afundamental_002dbinary_002doutput_002dstream"></a><dl>
<dt><a name="index-fundamental_002dbinary_002doutput_002dstream"></a>Class: <strong>fundamental-binary-output-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-binary-output-stream, fundamental-output-stream, fundamental-binary-stream, fundamental-stream, standard-object, stream, t</code>
</p>
<p>Superclass of all Gray output streams whose element-type
is a subtype of unsigned-byte or signed-byte.
</p></dd></dl>
<a name="Class-sb_002dgray_003afundamental_002dcharacter_002dinput_002dstream"></a><dl>
<dt><a name="index-fundamental_002dcharacter_002dinput_002dstream"></a>Class: <strong>fundamental-character-input-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-character-input-stream, fundamental-input-stream, fundamental-character-stream, fundamental-stream, standard-object, stream, t</code>
</p>
<p>Superclass of all Gray input streams whose element-type
is a subtype of character.
</p></dd></dl>
<a name="Class-sb_002dgray_003afundamental_002dcharacter_002doutput_002dstream"></a><dl>
<dt><a name="index-fundamental_002dcharacter_002doutput_002dstream"></a>Class: <strong>fundamental-character-output-stream</strong> <em>[sb-gray]</em></dt>
<dd><p>Class precedence list: <code>fundamental-character-output-stream, fundamental-output-stream, fundamental-character-stream, fundamental-stream, standard-object, stream, t</code>
</p>
<p>Superclass of all Gray output streams whose element-type
is a subtype of character.
</p></dd></dl>

<hr>
<a name="Methods-common-to-all-streams"></a>
<div class="header">
<p>
Next: <a href="#Input-stream-methods" accesskey="n" rel="next">Input stream methods</a>, Previous: <a href="#Gray-Streams-classes" accesskey="p" rel="prev">Gray Streams classes</a>, Up: <a href="#Gray-Streams" accesskey="u" rel="up">Gray Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Methods-common-to-all-streams-1"></a>
<h4 class="subsection">10.3.2 Methods common to all streams</h4>

<p>These generic functions can be specialized on any generalized instance
of fundamental-stream.
</p>
<a name="Generic_002dFunction-common_002dlisp_003astream_002delement_002dtype"></a><dl>
<dt><a name="index-stream_002delement_002dtype"></a>Generic Function: <strong>stream-element-type</strong> <em>[cl] stream</em></dt>
<dd><p>Return a type specifier for the kind of object returned by the
  <code>stream</code>. The class <code>fundamental-character-stream</code> provides a default method
  which returns <code>character</code>.
</p></dd></dl>
<a name="Generic_002dFunction-common_002dlisp_003aclose"></a><dl>
<dt><a name="index-close"></a>Generic Function: <strong>close</strong> <em>[cl] stream &amp;key abort</em></dt>
<dd><p>Close the given <code>stream</code>. No more I/O may be performed, but
  inquiries may still be made. If <code>:abort</code> is true, an attempt is made
  to clean up the side effects of having created the stream.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dfile_002dposition"></a><dl>
<dt><a name="index-stream_002dfile_002dposition"></a>Generic Function: <strong>stream-file-position</strong> <em>[sb-gray] stream &amp;optional position-spec</em></dt>
<dd><p>Used by <code>file-position</code>. Returns or changes the current position within <code>stream</code>.
</p></dd></dl>



<hr>
<a name="Input-stream-methods"></a>
<div class="header">
<p>
Next: <a href="#Character-input-stream-methods" accesskey="n" rel="next">Character input stream methods</a>, Previous: <a href="#Methods-common-to-all-streams" accesskey="p" rel="prev">Methods common to all streams</a>, Up: <a href="#Gray-Streams" accesskey="u" rel="up">Gray Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Input-stream-methods-1"></a>
<h4 class="subsection">10.3.3 Input stream methods</h4>

<p>These generic functions may be specialized on any generalized instance
of fundamental-input-stream.
</p>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dclear_002dinput"></a><dl>
<dt><a name="index-stream_002dclear_002dinput"></a>Generic Function: <strong>stream-clear-input</strong> <em>[sb-gray] stream</em></dt>
<dd><p>This is like <code>cl:clear-input</code>, but for Gray streams, returning <code>nil</code>.
  The default method does nothing.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dread_002dsequence"></a><dl>
<dt><a name="index-stream_002dread_002dsequence"></a>Generic Function: <strong>stream-read-sequence</strong> <em>[sb-gray] stream seq &amp;optional start end</em></dt>
<dd><p>This is like <code>cl:read-sequence</code>, but for Gray streams.
</p></dd></dl>

<hr>
<a name="Character-input-stream-methods"></a>
<div class="header">
<p>
Next: <a href="#Output-stream-methods" accesskey="n" rel="next">Output stream methods</a>, Previous: <a href="#Input-stream-methods" accesskey="p" rel="prev">Input stream methods</a>, Up: <a href="#Gray-Streams" accesskey="u" rel="up">Gray Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Character-input-stream-methods-1"></a>
<h4 class="subsection">10.3.4 Character input stream methods</h4>

<p>These generic functions are used to implement subclasses of
fundamental-input-stream:
</p>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dpeek_002dchar"></a><dl>
<dt><a name="index-stream_002dpeek_002dchar"></a>Generic Function: <strong>stream-peek-char</strong> <em>[sb-gray] stream</em></dt>
<dd><p>This is used to implement <code>peek-char</code>; this corresponds to <code>peek-type</code> of <code>nil</code>.
  It returns either a character or <code>:eof</code>. The default method calls
  <code>stream-read-char</code> and <code>stream-unread-char</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dread_002dchar_002dno_002dhang"></a><dl>
<dt><a name="index-stream_002dread_002dchar_002dno_002dhang"></a>Generic Function: <strong>stream-read-char-no-hang</strong> <em>[sb-gray] stream</em></dt>
<dd><p>This is used to implement <code>read-char-no-hang</code>. It returns either a
  character, or <code>nil</code> if no input is currently available, or <code>:eof</code> if
  end-of-file is reached. The default method provided by
  <code>fundamental-character-input-stream</code> simply calls <code>stream-read-char</code>; this
  is sufficient for file streams, but interactive streams should define
  their own method.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dread_002dchar"></a><dl>
<dt><a name="index-stream_002dread_002dchar"></a>Generic Function: <strong>stream-read-char</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Read one character from the stream. Return either a
  character object, or the symbol <code>:eof</code> if the stream is at end-of-file.
  Every subclass of <code>fundamental-character-input-stream</code> must define a
  method for this function.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dread_002dline"></a><dl>
<dt><a name="index-stream_002dread_002dline"></a>Generic Function: <strong>stream-read-line</strong> <em>[sb-gray] stream</em></dt>
<dd><p>This is used by <code>read-line</code>. A string is returned as the first value. The
  second value is true if the string was terminated by end-of-file
  instead of the end of a line. The default method uses repeated
  calls to <code>stream-read-char</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dlisten"></a><dl>
<dt><a name="index-stream_002dlisten"></a>Generic Function: <strong>stream-listen</strong> <em>[sb-gray] stream</em></dt>
<dd><p>This is used by <code>listen</code>. It returns true or false. The default method uses
  <code>stream-read-char-no-hang</code> and <code>stream-unread-char</code>. Most streams should
  define their own method since it will usually be trivial and will
  always be more efficient than the default method.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dunread_002dchar"></a><dl>
<dt><a name="index-stream_002dunread_002dchar"></a>Generic Function: <strong>stream-unread-char</strong> <em>[sb-gray] stream character</em></dt>
<dd><p>Undo the last call to <code>stream-read-char</code>, as in <code>unread-char</code>.
  Return <code>nil</code>. Every subclass of <code>fundamental-character-input-stream</code>
  must define a method for this function.
</p></dd></dl>

<hr>
<a name="Output-stream-methods"></a>
<div class="header">
<p>
Next: <a href="#Character-output-stream-methods" accesskey="n" rel="next">Character output stream methods</a>, Previous: <a href="#Character-input-stream-methods" accesskey="p" rel="prev">Character input stream methods</a>, Up: <a href="#Gray-Streams" accesskey="u" rel="up">Gray Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Output-stream-methods-1"></a>
<h4 class="subsection">10.3.5 Output stream methods</h4>

<p>These generic functions are used to implement subclasses of
fundamental-output-stream:
</p>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dclear_002doutput"></a><dl>
<dt><a name="index-stream_002dclear_002doutput"></a>Generic Function: <strong>stream-clear-output</strong> <em>[sb-gray] stream</em></dt>
<dd><p>This is like <code>cl:clear-output</code>, but for Gray streams: clear the given
  output <code>stream</code>. The default method does nothing.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dfinish_002doutput"></a><dl>
<dt><a name="index-stream_002dfinish_002doutput"></a>Generic Function: <strong>stream-finish-output</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Attempts to ensure that all output sent to the Stream has reached
  its destination, and only then returns false. Implements
  <code>finish-output</code>. The default method does nothing.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dforce_002doutput"></a><dl>
<dt><a name="index-stream_002dforce_002doutput"></a>Generic Function: <strong>stream-force-output</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Attempts to force any buffered output to be sent. Implements
  <code>force-output</code>. The default method does nothing.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dwrite_002dsequence"></a><dl>
<dt><a name="index-stream_002dwrite_002dsequence"></a>Generic Function: <strong>stream-write-sequence</strong> <em>[sb-gray] stream seq &amp;optional start end</em></dt>
<dd><p>This is like <code>cl:write-sequence</code>, but for Gray streams.
</p></dd></dl>

<hr>
<a name="Character-output-stream-methods"></a>
<div class="header">
<p>
Next: <a href="#Binary-stream-methods" accesskey="n" rel="next">Binary stream methods</a>, Previous: <a href="#Output-stream-methods" accesskey="p" rel="prev">Output stream methods</a>, Up: <a href="#Gray-Streams" accesskey="u" rel="up">Gray Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Character-output-stream-methods-1"></a>
<h4 class="subsection">10.3.6 Character output stream methods</h4>

<p>These generic functions are used to implement subclasses of
fundamental-character-output-stream:
</p>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dadvance_002dto_002dcolumn"></a><dl>
<dt><a name="index-stream_002dadvance_002dto_002dcolumn"></a>Generic Function: <strong>stream-advance-to-column</strong> <em>[sb-gray] stream column</em></dt>
<dd><p>Write enough blank space so that the next character will be
  written at the specified column. Returns true if the operation is
  successful, or <code>nil</code> if it is not supported for this stream. This is
  intended for use by by <code>pprint</code> and <code>format</code> ~T. The default method uses
  <code>stream-line-column</code> and repeated calls to <code>stream-write-char</code> with a
  <code>#space</code> character; it returns <code>nil</code> if <code>stream-line-column</code> returns <code>nil</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dfresh_002dline"></a><dl>
<dt><a name="index-stream_002dfresh_002dline"></a>Generic Function: <strong>stream-fresh-line</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Outputs a new line to the Stream if it is not positioned at the
  beginning of a line. Returns <code>t</code> if it output a new line, nil
  otherwise. Used by <code>fresh-line</code>. The default method uses
  <code>stream-start-line-p</code> and <code>stream-terpri</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dline_002dcolumn"></a><dl>
<dt><a name="index-stream_002dline_002dcolumn"></a>Generic Function: <strong>stream-line-column</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Return the column number where the next character
  will be written, or <code>nil</code> if that is not meaningful for this stream.
  The first column on a line is numbered 0. This function is used in
  the implementation of <code>pprint</code> and the <code>format</code> ~T directive. For every
  character output stream class that is defined, a method must be
  defined for this function, although it is permissible for it to
  always return <code>nil</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dline_002dlength"></a><dl>
<dt><a name="index-stream_002dline_002dlength"></a>Generic Function: <strong>stream-line-length</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Return the stream line length or <code>nil</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dstart_002dline_002dp"></a><dl>
<dt><a name="index-stream_002dstart_002dline_002dp"></a>Generic Function: <strong>stream-start-line-p</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Is <code>stream</code> known to be positioned at the beginning of a line?
  It is permissible for an implementation to always return
  <code>nil</code>. This is used in the implementation of <code>fresh-line</code>. Note that
  while a value of 0 from <code>stream-line-column</code> also indicates the
  beginning of a line, there are cases where <code>stream-start-line-p</code> can be
  meaningfully implemented although <code>stream-line-column</code> can&rsquo;t be. For
  example, for a window using variable-width characters, the column
  number isn&rsquo;t very meaningful, but the beginning of the line does have
  a clear meaning. The default method for <code>stream-start-line-p</code> on class
  <code>fundamental-character-output-stream</code> uses <code>stream-line-column</code>, so if
  that is defined to return <code>nil</code>, then a method should be provided for
  either <code>stream-start-line-p</code> or <code>stream-fresh-line</code>.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dterpri"></a><dl>
<dt><a name="index-stream_002dterpri"></a>Generic Function: <strong>stream-terpri</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Writes an end of line, as for <code>terpri</code>. Returns <code>nil</code>. The default
  method does (<code>stream-write-char</code> stream #NEWLINE).
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dwrite_002dchar"></a><dl>
<dt><a name="index-stream_002dwrite_002dchar"></a>Generic Function: <strong>stream-write-char</strong> <em>[sb-gray] stream character</em></dt>
<dd><p>Write <code>character</code> to <code>stream</code> and return <code>character</code>. Every
  subclass of <code>fundamental-character-output-stream</code> must have a method
  defined for this function.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dwrite_002dstring"></a><dl>
<dt><a name="index-stream_002dwrite_002dstring"></a>Generic Function: <strong>stream-write-string</strong> <em>[sb-gray] stream string &amp;optional start end</em></dt>
<dd><p>This is used by <code>write-string</code>. It writes the string to the stream,
  optionally delimited by start and end, which default to 0 and <code>nil</code>.
  The string argument is returned. The default method provided by
  <code>fundamental-character-output-stream</code> uses repeated calls to
  <code>stream-write-char</code>.
</p></dd></dl>

<hr>
<a name="Binary-stream-methods"></a>
<div class="header">
<p>
Next: <a href="#Gray-Streams-examples" accesskey="n" rel="next">Gray Streams examples</a>, Previous: <a href="#Character-output-stream-methods" accesskey="p" rel="prev">Character output stream methods</a>, Up: <a href="#Gray-Streams" accesskey="u" rel="up">Gray Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Binary-stream-methods-1"></a>
<h4 class="subsection">10.3.7 Binary stream methods</h4>

<p>The following generic functions are available for subclasses of
fundamental-binary-stream:
</p>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dread_002dbyte"></a><dl>
<dt><a name="index-stream_002dread_002dbyte"></a>Generic Function: <strong>stream-read-byte</strong> <em>[sb-gray] stream</em></dt>
<dd><p>Used by <code>read-byte</code>; returns either an integer, or the symbol <code>:eof</code>
  if the stream is at end-of-file.
</p></dd></dl>
<a name="Generic_002dFunction-sb_002dgray_003astream_002dwrite_002dbyte"></a><dl>
<dt><a name="index-stream_002dwrite_002dbyte"></a>Generic Function: <strong>stream-write-byte</strong> <em>[sb-gray] stream integer</em></dt>
<dd><p>Implements <code>write-byte</code>; writes the integer to the stream and
  returns the integer as the result.
</p></dd></dl>

<hr>
<a name="Gray-Streams-examples"></a>
<div class="header">
<p>
Previous: <a href="#Binary-stream-methods" accesskey="p" rel="prev">Binary stream methods</a>, Up: <a href="#Gray-Streams" accesskey="u" rel="up">Gray Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Gray-Streams-examples-1"></a>
<h4 class="subsection">10.3.8 Gray Streams examples</h4>


<p>Below are two classes of stream that can be conveniently defined as
wrappers for Common Lisp streams.  These are meant to serve as
examples of minimal implementations of the protocols that must be
followed when defining Gray streams.  Realistic uses of the Gray
Streams API would implement the various methods that can do I/O in
batches, such as <code><span class="nolinebreak">stream-read-line</span><!-- /@w --></code>, <code><span class="nolinebreak">stream-write-string</span><!-- /@w --></code>,
<code><span class="nolinebreak">stream-read-sequence</span><!-- /@w --></code>, and <code><span class="nolinebreak">stream-write-sequence</span><!-- /@w --></code>.
</p>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Character-counting-input-stream" accesskey="1">Character counting input stream</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Output-prefixing-character-stream" accesskey="2">Output prefixing character stream</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Character-counting-input-stream"></a>
<div class="header">
<p>
Next: <a href="#Output-prefixing-character-stream" accesskey="n" rel="next">Output prefixing character stream</a>, Up: <a href="#Gray-Streams-examples" accesskey="u" rel="up">Gray Streams examples</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Character-counting-input-stream-1"></a>
<h4 class="subsubsection">10.3.8.1 Character counting input stream</h4>

<p>It is occasionally handy for programs that process input files to
count the number of characters and lines seen so far, and the number
of characters seen on the current line, so that useful messages may be
reported in case of parsing errors, etc.  Here is a character input
stream class that keeps track of these counts.  Note that all
character input streams must implement <code><span class="nolinebreak">stream-read-char</span><!-- /@w --></code> and
<code><span class="nolinebreak">stream-unread-char</span><!-- /@w --></code>.
</p>
<div class="lisp">
<pre class="lisp">(defclass wrapped-stream (fundamental-stream)
  ((stream :initarg :stream :reader stream-of)))
</pre><pre class="lisp">(defmethod stream-element-type ((stream wrapped-stream))
  (stream-element-type (stream-of stream)))
</pre><pre class="lisp">(defmethod close ((stream wrapped-stream) &amp;key abort)
  (close (stream-of stream) :abort abort))
</pre><pre class="lisp">(defclass wrapped-character-input-stream
    (wrapped-stream fundamental-character-input-stream)
  ())
</pre><pre class="lisp">(defmethod stream-read-char ((stream wrapped-character-input-stream))
  (read-char (stream-of stream) nil :eof))
</pre><pre class="lisp">(defmethod stream-unread-char ((stream wrapped-character-input-stream)
                               char)
  (unread-char char (stream-of stream)))
</pre><pre class="lisp">(defclass counting-character-input-stream
    (wrapped-character-input-stream)
  ((char-count :initform 1 :accessor char-count-of)
   (line-count :initform 1 :accessor line-count-of)
   (col-count :initform 1 :accessor col-count-of)
   (prev-col-count :initform 1 :accessor prev-col-count-of)))
</pre><pre class="lisp">(defmethod stream-read-char ((stream counting-character-input-stream))
  (with-accessors ((inner-stream stream-of) (chars char-count-of)
                   (lines line-count-of) (cols col-count-of)
                   (prev prev-col-count-of)) stream
      (let ((char (call-next-method)))
        (cond ((eql char :eof)
               :eof)
              ((char= char #\Newline)
               (incf lines)
               (incf chars)
               (setf prev cols)
               (setf cols 1)
               char)
              (t
               (incf chars)
               (incf cols)
               char)))))
</pre><pre class="lisp">(defmethod stream-unread-char ((stream counting-character-input-stream)
                               char)
  (with-accessors ((inner-stream stream-of) (chars char-count-of)
                   (lines line-count-of) (cols col-count-of)
                   (prev prev-col-count-of)) stream
      (cond ((char= char #\Newline)
             (decf lines)
             (decf chars)
             (setf cols prev))
            (t
             (decf chars)
             (decf cols)
             char))
      (call-next-method)))
</pre></div>

<p>The default methods for <code><span class="nolinebreak">stream-read-char-no-hang</span><!-- /@w --></code>,
<code><span class="nolinebreak">stream-peek-char</span><!-- /@w --></code>, <code><span class="nolinebreak">stream-listen</span><!-- /@w --></code>,
<code><span class="nolinebreak">stream-clear-input</span><!-- /@w --></code>, <code><span class="nolinebreak">stream-read-line</span><!-- /@w --></code>, and
<code><span class="nolinebreak">stream-read-sequence</span><!-- /@w --></code> should be sufficient (though the last two
will probably be slower than methods that forwarded directly).
</p>
<p>Here&rsquo;s a sample use of this class:
</p>
<div class="lisp">
<pre class="lisp">(with-input-from-string (input &quot;1 2
 3 :foo  &quot;)
  (let ((counted-stream (make-instance 'counting-character-input-stream
                         :stream input)))
    (loop for thing = (read counted-stream) while thing
       unless (numberp thing) do
         (error &quot;Non-number ~S (line ~D, column ~D)&quot; thing
                (line-count-of counted-stream)
                (- (col-count-of counted-stream)
                   (length (format nil &quot;~S&quot; thing))))
       end
       do (print thing))))
</pre><pre class="verbatim">1
2
3
Non-number :FOO (line 2, column 5)
  [Condition of type SIMPLE-ERROR]
</pre></div>

<hr>
<a name="Output-prefixing-character-stream"></a>
<div class="header">
<p>
Previous: <a href="#Character-counting-input-stream" accesskey="p" rel="prev">Character counting input stream</a>, Up: <a href="#Gray-Streams-examples" accesskey="u" rel="up">Gray Streams examples</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Output-prefixing-character-stream-1"></a>
<h4 class="subsubsection">10.3.8.2 Output prefixing character stream</h4>

<p>One use for a wrapped output stream might be to prefix each line of
text with a timestamp, e.g., for a logging stream.  Here&rsquo;s a simple
stream that does this, though without any fancy line-wrapping.  Note
that all character output stream classes must implement
<code><span class="nolinebreak">stream-write-char</span><!-- /@w --></code> and <code><span class="nolinebreak">stream-line-column</span><!-- /@w --></code>.
</p>
<div class="lisp">
<pre class="lisp">(defclass wrapped-stream (fundamental-stream)
  ((stream :initarg :stream :reader stream-of)))
</pre><pre class="lisp">(defmethod stream-element-type ((stream wrapped-stream))
  (stream-element-type (stream-of stream)))
</pre><pre class="lisp">(defmethod close ((stream wrapped-stream) &amp;key abort)
  (close (stream-of stream) :abort abort))
</pre><pre class="lisp">(defclass wrapped-character-output-stream
    (wrapped-stream fundamental-character-output-stream)
  ((col-index :initform 0 :accessor col-index-of)))
</pre><pre class="lisp">(defmethod stream-line-column ((stream wrapped-character-output-stream))
  (col-index-of stream))
</pre><pre class="lisp">(defmethod stream-write-char ((stream wrapped-character-output-stream)
                              char)
  (with-accessors ((inner-stream stream-of) (cols col-index-of)) stream
    (write-char char inner-stream)
    (if (char= char #\Newline)
        (setf cols 0)
        (incf cols))))
</pre><pre class="lisp">(defclass prefixed-character-output-stream
    (wrapped-character-output-stream)
  ((prefix :initarg :prefix :reader prefix-of)))
</pre><pre class="lisp">(defgeneric write-prefix (prefix stream)
  (:method ((prefix string) stream) (write-string prefix stream))
  (:method ((prefix function) stream) (funcall prefix stream)))
</pre><pre class="lisp">(defmethod stream-write-char ((stream prefixed-character-output-stream)
                              char)
  (with-accessors ((inner-stream stream-of) (cols col-index-of)
                   (prefix prefix-of)) stream
    (when (zerop cols)
      (write-prefix prefix inner-stream))
    (call-next-method)))
</pre></div>

<p>As with the example input stream, this implements only the minimal
protocol.  A production implementation should also provide methods for
at least <code><span class="nolinebreak">stream-write-line</span><!-- /@w --></code>, <code><span class="nolinebreak">stream-write-sequence</span><!-- /@w --></code>.
</p>
<p>And here&rsquo;s a sample use of this class:
</p>
<div class="lisp">
<pre class="lisp">(flet ((format-timestamp (stream)
         (apply #'format stream &quot;[~2@*~2,' D:~1@*~2,'0D:~0@*~2,'0D] &quot;
                (multiple-value-list (get-decoded-time)))))
  (let ((output (make-instance 'prefixed-character-output-stream
                               :stream *standard-output*
                               :prefix #'format-timestamp)))
    (loop for string in '(&quot;abc&quot; &quot;def&quot; &quot;ghi&quot;) do
         (write-line string output)
         (sleep 1))))
</pre><pre class="verbatim">[ 0:30:05] abc
[ 0:30:06] def
[ 0:30:07] ghi
NIL
</pre></div>

<hr>
<a name="Simple-Streams"></a>
<div class="header">
<p>
Previous: <a href="#Gray-Streams" accesskey="p" rel="prev">Gray Streams</a>, Up: <a href="#Streams" accesskey="u" rel="up">Streams</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Simple-Streams-1"></a>
<h3 class="section">10.4 Simple Streams</h3>
<p>Simple streams are an extensible streams protocol that avoids some
problems with Gray streams.
</p>
<p>Documentation about simple streams is available at:
</p>
<p><a href="http://www.franz.com/support/documentation/6.2/doc/streams.htm">http://www.franz.com/support/documentation/6.2/doc/streams.htm</a>
</p>
<p>The implementation should be considered Alpha-quality; the basic
framework is there, but many classes are just stubs at the moment.
</p>
<p>See <samp>SYS:CONTRIB;SB-SIMPLE-STREAMS;SIMPLE-STREAM-TEST.LISP</samp> for
things that should work.
</p>
<p>Known differences to the ACL behaviour:
</p>
<ul>
<li> <code>open</code> not return a simple-stream by default. This can be
adjusted; see default-open-class in the file cl.lisp

</li><li> <code>write-vector</code> is unimplemented.

</li></ul>
<hr>
<a name="Package-Locks"></a>
<div class="header">
<p>
Next: <a href="#Threading" accesskey="n" rel="next">Threading</a>, Previous: <a href="#Streams" accesskey="p" rel="prev">Streams</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Package-Locks-1"></a>
<h2 class="chapter">11 Package Locks</h2>
<a name="index-Packages_002c-locked"></a>

<p>None of the following sections apply to SBCL built without package
locking support.
</p>
<blockquote>
<p><b>warning:</b> The interface described here is experimental: incompatible changes in
future SBCL releases are possible, even expected: the concept of
&ldquo;implementation packages&rdquo; and the associated operators may be renamed;
more operations (such as naming restarts or catch tags) may be added to
the list of operations violating package locks.
</p></blockquote>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Package-Lock-Concepts" accesskey="1">Package Lock Concepts</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Package-Lock-Dictionary" accesskey="2">Package Lock Dictionary</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Package-Lock-Concepts"></a>
<div class="header">
<p>
Next: <a href="#Package-Lock-Dictionary" accesskey="n" rel="next">Package Lock Dictionary</a>, Up: <a href="#Package-Locks" accesskey="u" rel="up">Package Locks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Package-Lock-Concepts-1"></a>
<h3 class="section">11.1 Package Lock Concepts</h3>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Package-Lock-Overview" accesskey="1">Package Lock Overview</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Implementation-Packages" accesskey="2">Implementation Packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Package-Lock-Violations" accesskey="3">Package Lock Violations</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Package-Locks-in-Compiled-Code" accesskey="4">Package Locks in Compiled Code</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Operations-Violating-Package-Locks" accesskey="5">Operations Violating Package Locks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Package-Lock-Overview"></a>
<div class="header">
<p>
Next: <a href="#Implementation-Packages" accesskey="n" rel="next">Implementation Packages</a>, Up: <a href="#Package-Lock-Concepts" accesskey="u" rel="up">Package Lock Concepts</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Package-Locking-Overview"></a>
<h4 class="subsection">11.1.1 Package Locking Overview</h4>

<p>Package locks protect against unintentional modifications of a package:
they provide similar protection to user packages as is mandated to
<code>common-lisp</code> package by the ANSI specification. They are not, and
should not be used as, a security measure.
</p>
<p>Newly created packages are by default unlocked (see the <code>:lock</code>
option to <code>defpackage</code>).
</p>
<p>The package <code>common-lisp</code> and SBCL internal implementation
packages are locked by default, including <code>sb-ext</code>.
</p>
<p>It may be beneficial to lock <code>common-lisp-user</code> as well, to
ensure that various libraries don&rsquo;t pollute it without asking,
but this is not currently done by default.
</p>
<hr>
<a name="Implementation-Packages"></a>
<div class="header">
<p>
Next: <a href="#Package-Lock-Violations" accesskey="n" rel="next">Package Lock Violations</a>, Previous: <a href="#Package-Lock-Overview" accesskey="p" rel="prev">Package Lock Overview</a>, Up: <a href="#Package-Lock-Concepts" accesskey="u" rel="up">Package Lock Concepts</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Implementation-Packages-1"></a>
<h4 class="subsection">11.1.2 Implementation Packages</h4>
<a name="index-_002apackage_002a-_005bcl_005d"></a>
<a name="index-defpackage-_005bcl_005d-1"></a>

<p>Each package has a list of associated implementation packages. A
locked package, and the symbols whose home package it is, can be
modified without violating package locks only when <code>*package*</code> is
bound to one of the implementation packages of the locked package.
</p>
<p>Unless explicitly altered by <code>defpackage</code>,
<code>sb-ext:add-implementation-package</code>, or
<code>sb-ext:remove-implementation-package</code> each package is its own
(only) implementation package.
</p>
<hr>
<a name="Package-Lock-Violations"></a>
<div class="header">
<p>
Next: <a href="#Package-Locks-in-Compiled-Code" accesskey="n" rel="next">Package Locks in Compiled Code</a>, Previous: <a href="#Implementation-Packages" accesskey="p" rel="prev">Implementation Packages</a>, Up: <a href="#Package-Lock-Concepts" accesskey="u" rel="up">Package Lock Concepts</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Package-Lock-Violations-1"></a>
<h4 class="subsection">11.1.3 Package Lock Violations</h4>
<a name="index-package_002dlock_002dviolation-_005bsb_002dext_005d"></a>
<a name="index-package_002dlocked_002derror-_005bsb_002dext_005d"></a>
<a name="index-symbol_002dpackage_002dlocked_002derror-_005bsb_002dext_005d"></a>
<a name="index-package_002derror-_005bcl_005d"></a>

<a name="Lexical-Bindings-and-Declarations"></a>
<h4 class="subsubsection">11.1.3.1 Lexical Bindings and Declarations</h4>
<a name="index-let-_005bcl_005d-1"></a>
<a name="index-let_002a-_005bcl_005d-1"></a>
<a name="index-flet-_005bcl_005d-1"></a>
<a name="index-labels-_005bcl_005d-1"></a>
<a name="index-macrolet-_005bcl_005d"></a>
<a name="index-symbol_002dmacrolet-_005bcl_005d"></a>
<a name="index-declare-_005bcl_005d"></a>
<a name="index-Declarations"></a>
<a name="index-disable_002dpackage_002dlocks-_005bsb_002dext_005d"></a>
<a name="index-enable_002dpackage_002dlocks-_005bsb_002dext_005d"></a>

<p>Lexical bindings or declarations that violate package locks cause a
compile-time warning, and a runtime <code>program-error</code> when the form
that violates package locks would be executed.
</p>
<p>A complete listing of operators affect by this is: <code>let</code>,
<code>let*</code>, <code>flet</code>, <code>labels</code>, <code>macrolet</code>, and
<code>symbol-macrolet</code>, <code>declare</code>.
</p>
<p>Package locks affecting both lexical bindings and declarations can be
disabled locally with <code>sb-ext:disable-package-locks</code> declaration,
and re-enabled with <code>sb-ext:enable-package-locks</code> declaration.
</p>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">(in-package :locked)

(defun foo () ...)

(defmacro with-foo (&amp;body body)
  `(locally (declare (disable-package-locks locked:foo))
     (flet ((foo () ...))
       (declare (enable-package-locks locked:foo)) ; re-enable for body
       ,@body)))
</pre></div>

<a name="Other-Operations"></a>
<h4 class="subsubsection">11.1.3.2 Other Operations</h4>

<p>If an non-lexical operation violates a package lock, a continuable
error that is of a subtype of <code>sb-ext:package-lock-violation</code>
(subtype of <code>package-error</code>) is signalled when the operation is
attempted.
</p>
<p>Additional restarts may be established for continuable package lock
violations for interactive use.
</p>
<p>The actual type of the error depends on circumstances that caused the
violation: operations on packages signal errors of type
<code>sb-ext:package-locked-error</code>, and operations on symbols signal
errors of type <code>sb-ext:symbol-package-locked-error</code>.
</p>

<hr>
<a name="Package-Locks-in-Compiled-Code"></a>
<div class="header">
<p>
Next: <a href="#Operations-Violating-Package-Locks" accesskey="n" rel="next">Operations Violating Package Locks</a>, Previous: <a href="#Package-Lock-Violations" accesskey="p" rel="prev">Package Lock Violations</a>, Up: <a href="#Package-Lock-Concepts" accesskey="u" rel="up">Package Lock Concepts</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Package-Locks-in-Compiled-Code-1"></a>
<h4 class="subsection">11.1.4 Package Locks in Compiled Code</h4>

<a name="Interned-Symbols"></a>
<h4 class="subsubsection">11.1.4.1 Interned Symbols</h4>

<p>If file-compiled code contains interned symbols, then loading that code
into an image without the said symbols will not cause a package lock
violation, even if the packages in question are locked.
</p>
<a name="Other-Limitations-on-Compiled-Code"></a>
<h4 class="subsubsection">11.1.4.2 Other Limitations on Compiled Code</h4>

<p>With the exception of interned symbols, behaviour is unspecified if
package locks affecting compiled code are not the same during loading
of the code or execution.
</p>
<p>Specifically, code compiled with packages unlocked may or may not fail
to signal package-lock-violations even if the packages are locked at
runtime, and code compiled with packages locked may or may not signal
spurious package-lock-violations at runtime even if the packages are
unlocked.
</p>
<p>In practice all this means that package-locks have a negligible
performance penalty in compiled code as long as they are not violated.
</p>
<hr>
<a name="Operations-Violating-Package-Locks"></a>
<div class="header">
<p>
Previous: <a href="#Package-Locks-in-Compiled-Code" accesskey="p" rel="prev">Package Locks in Compiled Code</a>, Up: <a href="#Package-Lock-Concepts" accesskey="u" rel="up">Package Lock Concepts</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Operations-Violating-Package-Locks-1"></a>
<h4 class="subsection">11.1.5 Operations Violating Package Locks</h4>

<a name="Operations-on-Packages"></a>
<h4 class="subsubsection">11.1.5.1 Operations on Packages</h4>

<p>The following actions cause a package lock violation if the package
operated on is locked, and <code>*package*</code> is not an implementation
package of that package, and the action would cause a change in the
state of the package (so e.g. exporting already external symbols is
never a violation). Package lock violations caused by these operations
signal errors of type <code>sb-ext:package-locked-error</code>.
</p>
<ol>
<li> Shadowing a symbol in a package.

</li><li> Importing a symbol to a package.

</li><li> Uninterning a symbol from a package.

</li><li> Exporting a symbol from a package.

</li><li> Unexporting a symbol from a package.

</li><li> Changing the packages used by a package.

</li><li> Renaming a package.

</li><li> Deleting a package.

</li><li> Adding a new package local nickname to a package.

</li><li> Removing an existing package local nickname to a package.

</li></ol>

<a name="Operations-on-Symbols"></a>
<h4 class="subsubsection">11.1.5.2 Operations on Symbols</h4>

<p>Following actions cause a package lock violation if the home package
of the symbol operated on is locked, and <code>*package*</code> is not an
implementation package of that package. Package lock violations caused
by these action signal errors of type
<code>sb-ext:symbol-package-locked-error</code>.
</p>
<p>These actions cause only one package lock violation per lexically
apparent violated package.
</p>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">;;; Packages FOO and BAR are locked.
;;;
;;; Two lexically apparent violated packages: exactly two
;;; package-locked-errors will be signalled.

(defclass foo:point ()
  ((x :accessor bar:x)
   (y :accessor bar:y)))
</pre></div>

<ol>
<li> Binding or altering its value lexically or dynamically, or
establishing it as a symbol-macro.

<p>Exceptions:
</p>
<ul class="no-bullet">
<li>- If the symbol is not defined as a constant, global symbol-macro or a
global dynamic variable, it may be lexically bound or established as a
local symbol macro.

</li><li>- If the symbol is defined as a global dynamic variable, it may be
assigned or bound.

</li></ul>

</li><li> Defining, undefining, or binding it, or its setf name as a function.

<p>Exceptions:
</p>
<ul class="no-bullet">
<li>- If the symbol is not defined as a function, macro, or special operator
it and its setf name may be lexically bound as a function.

</li></ul>

</li><li> Defining, undefining, or binding it as a macro or compiler macro.

<p>Exceptions:
</p>
<ul class="no-bullet">
<li>- If the symbol is not defined as a function, macro, or special operator
it may be lexically bound as a macro.

</li></ul>

</li><li> Defining it as a type specifier or structure.

</li><li> Defining it as a declaration with a declaration proclamation.

</li><li> Declaring or proclaiming it special.

</li><li> Declaring or proclaiming its type or ftype.

<p>Exceptions:
</p>
<ul class="no-bullet">
<li>- If the symbol may be lexically bound, the type of that binding may be
declared.

</li><li>- If the symbol may be lexically bound as a function, the ftype of that
binding may be declared.

</li></ul>

</li><li> Defining a setf expander for it.

</li><li> Defining it as a method combination type.

</li><li> Using it as the class-name argument to setf of find-class.

</li><li> Defining it as a hash table test using <code>sb-ext:define-hash-table-test</code>.

</li></ol>

<hr>
<a name="Package-Lock-Dictionary"></a>
<div class="header">
<p>
Previous: <a href="#Package-Lock-Concepts" accesskey="p" rel="prev">Package Lock Concepts</a>, Up: <a href="#Package-Locks" accesskey="u" rel="up">Package Locks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Package-Lock-Dictionary-1"></a>
<h3 class="section">11.2 Package Lock Dictionary</h3>

<dl>
<dt><a name="index-disable_002dpackage_002dlocks"></a>Declaration: <strong>disable-package-locks</strong> <em>[sb-ext]</em></dt>
<dd>
<p>Syntax: <code>(sb-ext:disable-package-locks symbol*)</code>
</p>
<p>Disables package locks affecting the named symbols during compilation
in the lexical scope of the declaration. Disabling locks on symbols
whose home package is unlocked, or disabling an already disabled lock,
has no effect.
</p></dd></dl>

<dl>
<dt><a name="index-enable_002dpackage_002dlocks"></a>Declaration: <strong>enable-package-locks</strong> <em>[sb-ext]</em></dt>
<dd>
<p>Syntax: <code>(sb-ext:enable-package-locks symbol*)</code>
</p>
<p>Re-enables package locks affecting the named symbols during compilation
in the lexical scope of the declaration. Enabling locks that were not
first disabled with <code>sb-ext:disable-package-locks</code> declaration, or
enabling locks that are already enabled has no effect.
</p></dd></dl>

<a name="Condition-sb_002dext_003apackage_002dlock_002dviolation"></a><dl>
<dt><a name="index-package_002dlock_002dviolation"></a>Condition: <strong>package-lock-violation</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>package-lock-violation, package-error, error, serious-condition, condition, t</code>
</p>
<p>Subtype of <code>cl:package-error</code>. A subtype of this error is signalled
when a package-lock is violated.
</p></dd></dl>
<a name="Condition-sb_002dext_003apackage_002dlocked_002derror"></a><dl>
<dt><a name="index-package_002dlocked_002derror"></a>Condition: <strong>package-locked-error</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>package-locked-error, package-lock-violation, package-error, error, serious-condition, condition, t</code>
</p>
<p>Subtype of <code>sb-ext:package-lock-violation</code>. An error of this type is
signalled when an operation on a package violates a package lock.
</p></dd></dl>
<a name="Condition-sb_002dext_003asymbol_002dpackage_002dlocked_002derror"></a><dl>
<dt><a name="index-symbol_002dpackage_002dlocked_002derror"></a>Condition: <strong>symbol-package-locked-error</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>symbol-package-locked-error, package-lock-violation, package-error, error, serious-condition, condition, t</code>
</p>
<p>Subtype of <code>sb-ext:package-lock-violation</code>. An error of this type is
signalled when an operation on a symbol violates a package lock. The
symbol that caused the violation is accessed by the function
<code>sb-ext:package-locked-error-symbol</code>.
</p></dd></dl>

<dl>
<dt><a name="index-package_002dlocked_002derror_002dsymbol"></a>Function: <strong>package-locked-error-symbol</strong> <em>[sb-ext] symbol-package-locked-error</em></dt>
<dd>
<p>Returns the symbol that caused the <code>symbol-package-locked-error</code>
condition.
</p></dd></dl>

<a name="Function-sb_002dext_003apackage_002dlocked_002dp"></a><dl>
<dt><a name="index-package_002dlocked_002dp"></a>Function: <strong>package-locked-p</strong> <em>[sb-ext] package</em></dt>
<dd><p>Returns <code>t</code> when <code>package</code> is locked, <code>nil</code> otherwise. Signals an error
if <code>package</code> doesn&rsquo;t designate a valid package.
</p></dd></dl>
<a name="Function-sb_002dext_003alock_002dpackage"></a><dl>
<dt><a name="index-lock_002dpackage"></a>Function: <strong>lock-package</strong> <em>[sb-ext] package</em></dt>
<dd><p>Locks <code>package</code> and returns <code>t</code>. Has no effect if <code>package</code> was already
locked. Signals an error if <code>package</code> is not a valid package designator
</p></dd></dl>
<a name="Function-sb_002dext_003aunlock_002dpackage"></a><dl>
<dt><a name="index-unlock_002dpackage"></a>Function: <strong>unlock-package</strong> <em>[sb-ext] package</em></dt>
<dd><p>Unlocks <code>package</code> and returns <code>t</code>. Has no effect if <code>package</code> was already
unlocked. Signals an error if <code>package</code> is not a valid package designator.
</p></dd></dl>
<a name="Function-sb_002dext_003apackage_002dimplemented_002dby_002dlist"></a><dl>
<dt><a name="index-package_002dimplemented_002dby_002dlist"></a>Function: <strong>package-implemented-by-list</strong> <em>[sb-ext] package</em></dt>
<dd><p>Returns a list containing the implementation packages of
<code>package</code>. Signals an error if <code>package</code> is not a valid package designator.
</p></dd></dl>
<a name="Function-sb_002dext_003apackage_002dimplements_002dlist"></a><dl>
<dt><a name="index-package_002dimplements_002dlist"></a>Function: <strong>package-implements-list</strong> <em>[sb-ext] package</em></dt>
<dd><p>Returns the packages that <code>package</code> is an implementation package
of. Signals an error if <code>package</code> is not a valid package designator.
</p></dd></dl>
<a name="Function-sb_002dext_003aadd_002dimplementation_002dpackage"></a><dl>
<dt><a name="index-add_002dimplementation_002dpackage"></a>Function: <strong>add-implementation-package</strong> <em>[sb-ext] packages-to-add &amp;optional package</em></dt>
<dd><p>Adds <code>packages-to-add</code> as implementation packages of <code>package</code>. Signals
an error if <code>package</code> or any of the <code>packages-to-add</code> is not a valid
package designator.
</p></dd></dl>
<a name="Function-sb_002dext_003aremove_002dimplementation_002dpackage"></a><dl>
<dt><a name="index-remove_002dimplementation_002dpackage"></a>Function: <strong>remove-implementation-package</strong> <em>[sb-ext] packages-to-remove &amp;optional package</em></dt>
<dd><p>Removes <code>packages-to-remove</code> from the implementation packages of
<code>package</code>. Signals an error if <code>package</code> or any of the <code>packages-to-remove</code>
is not a valid package designator.
</p></dd></dl>
<a name="Macro-sb_002dext_003awithout_002dpackage_002dlocks"></a><dl>
<dt><a name="index-without_002dpackage_002dlocks"></a>Macro: <strong>without-package-locks</strong> <em>[sb-ext] &amp;body body</em></dt>
<dd><p>Ignores all runtime package lock violations during the execution of
body. Body can begin with declarations.
</p></dd></dl>
<a name="Macro-sb_002dext_003awith_002dunlocked_002dpackages"></a><dl>
<dt><a name="index-with_002dunlocked_002dpackages"></a>Macro: <strong>with-unlocked-packages</strong> <em>[sb-ext] (&amp;rest packages) &amp;body forms</em></dt>
<dd><p>Unlocks <code>packages</code> for the dynamic scope of the body. Signals an
error if any of <code>packages</code> is not a valid package designator.
</p></dd></dl>

<dl>
<dt><a name="index-defpackage-1"></a>Macro: <strong>defpackage</strong> <em>[cl] name [[option]]* &rArr; package</em></dt>
<dd>
<p>Options are extended to include the following:
</p>
<ul>
<li> <code>:lock</code> <var>boolean</var>

<p>If the argument to <code>:lock</code> is <code>t</code>, the package is initially
locked.  If <code>:lock</code> is not provided it defaults to <code>nil</code>.
</p>
</li><li> <code>:implement</code> <var>package-designator</var>*

<p>The package is added as an implementation package to the packages
named. If <code>:implement</code> is not provided, it defaults to the
package itself.
</p></li></ul>

<p>Example:
</p>
<div class="lisp">
<pre class="lisp">(defpackage &quot;FOO&quot; (:export &quot;BAR&quot;) (:lock t) (:implement))
(defpackage &quot;FOO-INT&quot; (:use &quot;FOO&quot;) (:implement &quot;FOO&quot; &quot;FOO-INT&quot;))

;;; is equivalent to

(defpackage &quot;FOO&quot;) (:export &quot;BAR&quot;))
(lock-package &quot;FOO&quot;)
(remove-implementation-package &quot;FOO&quot; &quot;FOO&quot;)
(defpackage &quot;FOO-INT&quot; (:use &quot;BAR&quot;))
(add-implementation-package &quot;FOO-INT&quot; &quot;FOO&quot;)
</pre></div>
</dd></dl>
<hr>
<a name="Threading"></a>
<div class="header">
<p>
Next: <a href="#Timers" accesskey="n" rel="next">Timers</a>, Previous: <a href="#Package-Locks" accesskey="p" rel="prev">Package Locks</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Threading-1"></a>
<h2 class="chapter">12 Threading</h2>

<p>SBCL supports a fairly low-level threading interface that maps onto
the host operating system&rsquo;s concept of threads or lightweight
processes.  This means that threads may take advantage of hardware
multiprocessing on machines that have more than one CPU, but it does
not allow Lisp control of the scheduler.  This is found in the
SB-THREAD package.
</p>
<p>Threads are part of the default build on x86[-64]/ARM64 Linux and Windows.
</p>
<p>They are also supported on: x86[-64] Darwin (Mac OS X), x86[-64]
FreeBSD, x86 SunOS (Solaris), PPC Linux, ARM64 Linux. On these
platforms threads must be explicitly enabled at build-time, see
<samp>INSTALL</samp> for directions.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Threading-basics" accesskey="1">Threading basics</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Special-Variables" accesskey="2">Special Variables</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Atomic-Operations" accesskey="3">Atomic Operations</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Mutex-Support" accesskey="4">Mutex Support</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Semaphores" accesskey="5">Semaphores</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Waitqueue_002fcondition-variables" accesskey="6">Waitqueue/condition variables</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Barriers" accesskey="7">Barriers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Sessions_002fDebugging" accesskey="8">Sessions/Debugging</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Foreign-threads" accesskey="9">Foreign threads</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Implementation-_0028Linux-x86_002fx86_002d64_0029">Implementation (Linux x86/x86-64)</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Threading-basics"></a>
<div class="header">
<p>
Next: <a href="#Special-Variables" accesskey="n" rel="next">Special Variables</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Threading-basics-1"></a>
<h3 class="section">12.1 Threading basics</h3>

<div class="lisp">
<pre class="lisp">(make-thread (lambda () (write-line &quot;Hello, world&quot;)))
</pre></div>

<a name="Thread-Objects"></a>
<h4 class="subsection">12.1.1 Thread Objects</h4>

<a name="Structure-sb_002dthread_003athread"></a><dl>
<dt><a name="index-thread"></a>Structure: <strong>thread</strong> <em>[sb-thread]</em></dt>
<dd><p>Class precedence list: <code>thread, structure-object, t</code>
</p>
<p>Thread type. Do not rely on threads being structs as it may change
in future versions.
</p></dd></dl>
<a name="Variable-sb_002dthread_003a_002acurrent_002dthread_002a"></a><dl>
<dt><a name="index-_002acurrent_002dthread_002a"></a>Variable: <strong>*current-thread*</strong> <em>[sb-thread]</em></dt>
<dd><p>Bound in each thread to the thread itself.
</p></dd></dl>
<a name="Function-sb_002dthread_003alist_002dall_002dthreads"></a><dl>
<dt><a name="index-list_002dall_002dthreads"></a>Function: <strong>list-all-threads</strong> <em>[sb-thread]</em></dt>
<dd><p>Return a list of the live threads. Note that the return value is
potentially stale even before the function returns, as new threads may be
created and old ones may exit at any time.
</p></dd></dl>
<a name="Function-sb_002dthread_003athread_002dalive_002dp"></a><dl>
<dt><a name="index-thread_002dalive_002dp"></a>Function: <strong>thread-alive-p</strong> <em>[sb-thread] thread</em></dt>
<dd><p>Return <code>t</code> if <code>thread</code> is still alive. Note that the return value is
potentially stale even before the function returns, as the thread may exit at
any time.
</p></dd></dl>
<a name="Function-sb_002dthread_003athread_002dname"></a><dl>
<dt><a name="index-thread_002dname"></a>Function: <strong>thread-name</strong> <em>[sb-thread] instance</em></dt>
<dd><p>Name of the thread. Can be assigned to using <code>setf</code>. Thread names can be
arbitrary printable objects, and need not be unique.
</p></dd></dl>
<a name="Function-sb_002dthread_003amain_002dthread_002dp"></a><dl>
<dt><a name="index-main_002dthread_002dp"></a>Function: <strong>main-thread-p</strong> <em>[sb-thread] &amp;optional thread</em></dt>
<dd><p>True if <code>thread</code>, defaulting to current thread, is the main thread of the process.
</p></dd></dl>
<a name="Function-sb_002dthread_003amain_002dthread"></a><dl>
<dt><a name="index-main_002dthread"></a>Function: <strong>main-thread</strong> <em>[sb-thread]</em></dt>
<dd><p>Returns the main thread of the process.
</p></dd></dl>

<a name="Making_002c-Returning-From_002c-Joining_002c-and-Yielding-Threads"></a>
<h4 class="subsection">12.1.2 Making, Returning From, Joining, and Yielding Threads</h4>

<a name="Function-sb_002dthread_003amake_002dthread"></a><dl>
<dt><a name="index-make_002dthread"></a>Function: <strong>make-thread</strong> <em>[sb-thread] function &amp;key name arguments ephemeral</em></dt>
<dd><p>Create a new thread of <code>name</code> that runs <code>function</code> with the argument
list designator provided (defaults to no argument). Thread exits when
the function returns. The return values of <code>function</code> are kept around
and can be retrieved by <code>join-thread</code>.
</p>
<p>Invoking the initial <code>abort</code> restart established by <code>make-thread</code>
terminates the thread.
</p>
<p>See also: <code>return-from-thread</code>, <code>abort-thread</code>.
</p></dd></dl>
<a name="Macro-sb_002dthread_003areturn_002dfrom_002dthread"></a><dl>
<dt><a name="index-return_002dfrom_002dthread"></a>Macro: <strong>return-from-thread</strong> <em>[sb-thread] values-form &amp;key allow-exit</em></dt>
<dd><p>Unwinds from and terminates the current thread, with values from
<code>values-form</code> as the results visible to <code>join-thread</code>.
</p>
<p>If current thread is the main thread of the process (see
MAIN-THREAD-P), signals an error unless <code>allow-exit</code> is true, as
terminating the main thread would terminate the entire process. If
<code>allow-exit</code> is true, returning from the main thread is equivalent to
calling <code>sb-ext:exit</code> with <code>:code</code> 0 and <code>:abort</code> <code>nil</code>.
</p>
<p>See also: <code>abort-thread</code> and <code>sb-ext:exit</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003aabort_002dthread"></a><dl>
<dt><a name="index-abort_002dthread"></a>Function: <strong>abort-thread</strong> <em>[sb-thread] &amp;key allow-exit</em></dt>
<dd><p>Unwinds from and terminates the current thread abnormally, causing
<code>join-thread</code> on current thread to signal an error unless a
default-value is provided.
</p>
<p>If current thread is the main thread of the process (see
MAIN-THREAD-P), signals an error unless <code>allow-exit</code> is true, as
terminating the main thread would terminate the entire process. If
<code>allow-exit</code> is true, aborting the main thread is equivalent to calling
<code>sb-ext:exit</code> code 1 and <code>:abort</code> <code>nil</code>.
</p>
<p>Invoking the initial <code>abort</code> restart established by <code>make-thread</code> is
equivalent to calling <code>abort-thread</code> in other than main threads.
However, whereas <code>abort</code> restart may be rebound, <code>abort-thread</code> always
unwinds the entire thread. (Behaviour of the initial <code>abort</code> restart for
main thread depends on the <code>:toplevel</code> argument to
<code>sb-ext:save-lisp-and-die</code>.)
</p>
<p>See also: <code>return-from-thread</code> and <code>sb-ext:exit</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003ajoin_002dthread"></a><dl>
<dt><a name="index-join_002dthread"></a>Function: <strong>join-thread</strong> <em>[sb-thread] thread &amp;key default timeout</em></dt>
<dd><p>Suspend current thread until <code>thread</code> exits. Return the result values
of the thread function.
</p>
<p>If <code>thread</code> does not exit within <code>timeout</code> seconds and <code>default</code> is
supplied, return two values: 1) <code>default</code> 2) <code>:timeout</code>. If <code>default</code> is not
supplied, signal a <code>join-thread-error</code> with <code>join-thread-problem</code> equal
to <code>:timeout</code>.
</p>
<p>If <code>thread</code> does not exit normally (i.e. aborted) and <code>default</code> is
supplied, return two values: 1) <code>default</code> 2) <code>:abort</code>. If <code>default</code> is not
supplied, signal a <code>join-thread-error</code> with <code>join-thread-problem</code> equal
to <code>:abort</code>.
</p>
<p>If <code>thread</code> is the current thread, signal a <code>join-thread-error</code> with
<code>join-thread-problem</code> equal to <code>:self-join</code>.
</p>
<p>Trying to join the main thread causes <code>join-thread</code> to block until
<code>timeout</code> occurs or the process exits: when the main thread exits, the
entire process exits.
</p>
<p><code>note:</code> Return convention in case of a timeout is experimental and
subject to change.
</p></dd></dl>
<a name="Function-sb_002dthread_003athread_002dyield"></a><dl>
<dt><a name="index-thread_002dyield"></a>Function: <strong>thread-yield</strong> <em>[sb-thread]</em></dt>
<dd><p>Yield the processor to other threads.
</p></dd></dl>

<a name="Asynchronous-Operations"></a>
<h4 class="subsection">12.1.3 Asynchronous Operations</h4>

<a name="Function-sb_002dthread_003ainterrupt_002dthread"></a><dl>
<dt><a name="index-interrupt_002dthread"></a>Function: <strong>interrupt-thread</strong> <em>[sb-thread] thread function</em></dt>
<dd><p>Interrupt <code>thread</code> and make it run <code>function</code>.
</p>
<p>The interrupt is asynchronous, and can occur anywhere with the exception of
sections protected using <code>sb-sys:without-interrupts</code>.
</p>
<p><code>function</code> is called with interrupts disabled, under
<code>sb-sys:allow-with-interrupts</code>. Since functions such as <code>grab-mutex</code> may try to
enable interrupts internally, in most cases <code>function</code> should either enter
<code>sb-sys:with-interrupts</code> to allow nested interrupts, or
<code>sb-sys:without-interrupts</code> to prevent them completely.
</p>
<p>When a thread receives multiple interrupts, they are executed in the order
they were sent <code>--</code> first in, first out.
</p>
<p>This means that a great degree of care is required to use <code>interrupt-thread</code>
safely and sanely in a production environment. The general recommendation is
to limit uses of <code>interrupt-thread</code> for interactive debugging, banning it
entirely from production environments <code>--</code> it is simply exceedingly hard to use
correctly.
</p>
<p>With those caveats in mind, what you need to know when using it:
</p>
<ul>
<li> If calling <code>function</code> causes a non-local transfer of control (ie. an
   unwind), all normal cleanup forms will be executed.

<p>However, if the interrupt occurs during cleanup forms of an <code>unwind-protect</code>,
   it is just as if that had happened due to a regular <code>go</code>, <code>throw</code>, or
   <code>return-from:</code> the interrupted cleanup form and those following it in the
   same <code>unwind-protect</code> do not get executed.
</p>
<p><code>sbcl</code> tries to keep its own internals asynch-unwind-safe, but this is
   frankly an unreasonable expectation for third party libraries, especially
   given that asynch-unwind-safety does not compose: a function calling
   only asynch-unwind-safe function isn&rsquo;t automatically asynch-unwind-safe.
</p>
<p>This means that in order for an asynch unwind to be safe, the entire
   callstack at the point of interruption needs to be asynch-unwind-safe.
</p>
</li><li> In addition to asynch-unwind-safety you must consider the issue of
   reentrancy. <code>interrupt-thread</code> can cause function that are never normally
   called recursively to be re-entered during their dynamic contour,
   which may cause them to misbehave. (Consider binding of special variables,
   values of global variables, etc.)

</li></ul>
<p>Taken together, these two restrict the &quot;safe&quot; things to do using
<code>interrupt-thread</code> to a fairly minimal set. One useful one <code>--</code> exclusively for
interactive development use is using it to force entry to debugger to inspect
the state of a thread:
</p>
<div class="lisp">
<pre class="lisp">  (interrupt-thread thread #'break)
</pre></div>

<p>Short version: be careful out there.
</p></dd></dl>
<a name="Function-sb_002dthread_003aterminate_002dthread"></a><dl>
<dt><a name="index-terminate_002dthread"></a>Function: <strong>terminate-thread</strong> <em>[sb-thread] thread</em></dt>
<dd><p>Terminate the thread identified by <code>thread</code>, by interrupting it and
causing it to call <code>sb-ext:abort-thread</code> with <code>:allow-exit</code> <code>t</code>.
</p>
<p>The unwind caused by <code>terminate-thread</code> is asynchronous, meaning that
eg. thread executing
</p>
<div class="lisp">
<pre class="lisp">  (let (foo)
     (unwind-protect
         (progn
            (setf foo (get-foo))
            (work-on-foo foo))
       (when foo
         ;; An interrupt occurring inside the cleanup clause
         ;; will cause cleanups from the current UNWIND-PROTECT
         ;; to be dropped.
         (release-foo foo))))
</pre></div>

<p>might miss calling <code>release-foo</code> despite <code>get-foo</code> having returned true if
the interrupt occurs inside the cleanup clause, eg. during execution
of <code>release-foo</code>.
</p>
<p>Thus, in order to write an asynch unwind safe <code>unwind-protect</code> you need
to use <code>without-interrupts:</code>
</p>
<div class="lisp">
<pre class="lisp">  (let (foo)
    (sb-sys:without-interrupts
      (unwind-protect
          (progn
            (setf foo (sb-sys:allow-with-interrupts
                        (get-foo)))
            (sb-sys:with-local-interrupts
              (work-on-foo foo)))
       (when foo
         (release-foo foo)))))
</pre></div>

<p>Since most libraries using <code>unwind-protect</code> do not do this, you should never
assume that unknown code can safely be terminated using <code>terminate-thread</code>.
</p></dd></dl>

<a name="Miscellaneous-Operations"></a>
<h4 class="subsection">12.1.4 Miscellaneous Operations</h4>

<a name="Function-sb_002dthread_003asymbol_002dvalue_002din_002dthread"></a><dl>
<dt><a name="index-symbol_002dvalue_002din_002dthread"></a>Function: <strong>symbol-value-in-thread</strong> <em>[sb-thread] symbol thread &amp;optional errorp</em></dt>
<dd><p>Return the local value of <code>symbol</code> in <code>thread</code>, and a secondary value of <code>t</code>
on success.
</p>
<p>If the value cannot be retrieved (because the thread has exited or because it
has no local binding for NAME) and <code>errorp</code> is true signals an error of type
<code>symbol-value-in-thread-error</code>; if <code>errorp</code> is false returns a primary value of
<code>nil</code>, and a secondary value of <code>nil</code>.
</p>
<p>Can also be used with <code>setf</code> to change the thread-local value of <code>symbol</code>.
</p>
<p><code>symbol-value-in-thread</code> is primarily intended as a debugging tool, and not as a
mechanism for inter-thread communication.
</p></dd></dl>

<a name="Error-Conditions"></a>
<h4 class="subsection">12.1.5 Error Conditions</h4>

<a name="Condition-sb_002dthread_003athread_002derror"></a><dl>
<dt><a name="index-thread_002derror"></a>Condition: <strong>thread-error</strong> <em>[sb-thread]</em></dt>
<dd><p>Class precedence list: <code>thread-error, error, serious-condition, condition, t</code>
</p>
<p>Conditions of type <code>thread-error</code> are signalled when thread operations fail.
The offending thread is initialized by the <code>:thread</code> initialization argument and
read by the function <code>thread-error-thread</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003athread_002derror_002dthread"></a><dl>
<dt><a name="index-thread_002derror_002dthread"></a>Function: <strong>thread-error-thread</strong> <em>[sb-thread] condition</em></dt>
<dd><p>Return the offending thread that the <code>thread-error</code> pertains to.
</p></dd></dl>

<a name="Condition-sb_002dthread_003ainterrupt_002dthread_002derror"></a><dl>
<dt><a name="index-interrupt_002dthread_002derror"></a>Condition: <strong>interrupt-thread-error</strong> <em>[sb-thread]</em></dt>
<dd><p>Class precedence list: <code>interrupt-thread-error, thread-error, error, serious-condition, condition, t</code>
</p>
<p>Signalled when interrupting a thread fails because the thread has already
exited. The offending thread can be accessed using <code>thread-error-thread</code>.
</p></dd></dl>
<a name="Condition-sb_002dthread_003ajoin_002dthread_002derror"></a><dl>
<dt><a name="index-join_002dthread_002derror"></a>Condition: <strong>join-thread-error</strong> <em>[sb-thread]</em></dt>
<dd><p>Class precedence list: <code>join-thread-error, thread-error, error, serious-condition, condition, t</code>
</p>
<p>Signalled when joining a thread fails due to abnormal exit of the thread
to be joined. The offending thread can be accessed using
<code>thread-error-thread</code>.
</p></dd></dl>

<hr>
<a name="Special-Variables"></a>
<div class="header">
<p>
Next: <a href="#Atomic-Operations" accesskey="n" rel="next">Atomic Operations</a>, Previous: <a href="#Threading-basics" accesskey="p" rel="prev">Threading basics</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Special-Variables-1"></a>
<h3 class="section">12.2 Special Variables</h3>

<p>The interaction of special variables with multiple threads is mostly
as one would expect, with behaviour very similar to other
implementations.
</p>
<ul>
<li> global special values are visible across all threads;
</li><li> bindings (e.g. using LET) are local to the thread;
</li><li> threads do not inherit dynamic bindings from the parent thread
</li></ul>

<p>The last point means that
</p>
<div class="lisp">
<pre class="lisp">(defparameter *x* 0)
(let ((*x* 1))
  (sb-thread:make-thread (lambda () (print *x*))))
</pre></div>

<p>prints <code>0</code> and not <code>1</code> as of 0.9.6.
</p>
<hr>
<a name="Atomic-Operations"></a>
<div class="header">
<p>
Next: <a href="#Mutex-Support" accesskey="n" rel="next">Mutex Support</a>, Previous: <a href="#Special-Variables" accesskey="p" rel="prev">Special Variables</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Atomic-Operations-1"></a>
<h3 class="section">12.3 Atomic Operations</h3>

<p>Following atomic operations are particularly useful for implementing
lockless algorithms.
</p>
<a name="Macro-sb_002dext_003aatomic_002ddecf"></a><dl>
<dt><a name="index-atomic_002ddecf"></a>Macro: <strong>atomic-decf</strong> <em>[sb-ext] place &amp;optional diff</em></dt>
<dd><p>Atomically decrements <code>place</code> by <code>diff</code>, and returns the value of <code>place</code> before
the decrement.
</p>
<p><code>place</code> must access one of the following:
</p><ul>
<li> a <code>defstruct</code> slot with declared type <code>(unsigned-byte 64)</code>
   or <code>aref</code> of a <code>(simple-array (unsigned-byte 64) (*))</code>
   The type <code>sb-ext:word</code> can be used for these purposes.
</li><li> <code>car</code> or <code>cdr</code> (respectively <code>first</code> or REST) of a <code>cons</code>.
</li><li> a variable defined using <code>defglobal</code> with a proclaimed type of <code>fixnum</code>.
</li></ul>
<p>Macroexpansion is performed on <code>place</code> before expanding <code>atomic-decf</code>.
</p>
<p>Decrementing is done using modular arithmetic,
which is well-defined over two different domains:
</p><ul>
<li> For structures and arrays, the operation accepts and produces
   an <code>(unsigned-byte 64)</code>, and <code>diff</code> must be of type <code>(signed-byte 64)</code>.
   <code>atomic-decf</code> of #x0 by one results in #xFFFFFFFFFFFFFFFF being stored in <code>place</code>.
</li><li> For other places, the domain is <code>fixnum</code>, and <code>diff</code> must be a <code>fixnum</code>.
   <code>atomic-decf</code> of #x-4000000000000000 by one results in #x3FFFFFFFFFFFFFFF
   being stored in <code>place</code>.

</li></ul>
<p><code>diff</code> defaults to 1.
</p>
<p><code>experimental:</code> Interface subject to change.
</p></dd></dl>
<a name="Macro-sb_002dext_003aatomic_002dincf"></a><dl>
<dt><a name="index-atomic_002dincf"></a>Macro: <strong>atomic-incf</strong> <em>[sb-ext] place &amp;optional diff</em></dt>
<dd><p>Atomically increments <code>place</code> by <code>diff</code>, and returns the value of <code>place</code> before
the increment.
</p>
<p><code>place</code> must access one of the following:
</p><ul>
<li> a <code>defstruct</code> slot with declared type <code>(unsigned-byte 64)</code>
   or <code>aref</code> of a <code>(simple-array (unsigned-byte 64) (*))</code>
   The type <code>sb-ext:word</code> can be used for these purposes.
</li><li> <code>car</code> or <code>cdr</code> (respectively <code>first</code> or REST) of a <code>cons</code>.
</li><li> a variable defined using <code>defglobal</code> with a proclaimed type of <code>fixnum</code>.
</li></ul>
<p>Macroexpansion is performed on <code>place</code> before expanding <code>atomic-incf</code>.
</p>
<p>Incrementing is done using modular arithmetic,
which is well-defined over two different domains:
</p><ul>
<li> For structures and arrays, the operation accepts and produces
   an <code>(unsigned-byte 64)</code>, and <code>diff</code> must be of type <code>(signed-byte 64)</code>.
   <code>atomic-incf</code> of #xFFFFFFFFFFFFFFFF by one results in #x0 being stored in <code>place</code>.
</li><li> For other places, the domain is <code>fixnum</code>, and <code>diff</code> must be a <code>fixnum</code>.
   <code>atomic-incf</code> of #x3FFFFFFFFFFFFFFF by one results in #x-4000000000000000
   being stored in <code>place</code>.

</li></ul>
<p><code>diff</code> defaults to 1.
</p>
<p><code>experimental:</code> Interface subject to change.
</p></dd></dl>
<a name="Macro-sb_002dext_003aatomic_002dpop"></a><dl>
<dt><a name="index-atomic_002dpop"></a>Macro: <strong>atomic-pop</strong> <em>[sb-ext] place</em></dt>
<dd><p>Like <code>pop</code>, but atomic. <code>place</code> may be read multiple times before
the operation completes <code>--</code> the write does not occur until such time
that no other thread modified <code>place</code> between the read and the write.
</p>
<p>Works on all CASable places.
</p></dd></dl>
<a name="Macro-sb_002dext_003aatomic_002dpush"></a><dl>
<dt><a name="index-atomic_002dpush"></a>Macro: <strong>atomic-push</strong> <em>[sb-ext] obj place</em></dt>
<dd><p>Like <code>push</code>, but atomic. <code>place</code> may be read multiple times before
the operation completes <code>--</code> the write does not occur until such time
that no other thread modified <code>place</code> between the read and the write.
</p>
<p>Works on all CASable places.
</p></dd></dl>
<a name="Macro-sb_002dext_003aatomic_002dupdate"></a><dl>
<dt><a name="index-atomic_002dupdate"></a>Macro: <strong>atomic-update</strong> <em>[sb-ext] place update-fn &amp;rest arguments</em></dt>
<dd><p>Updates <code>place</code> atomically to the value returned by calling function
designated by <code>update-fn</code> with <code>arguments</code> and the previous value of <code>place</code>.
</p>
<p><code>place</code> may be read and <code>update-fn</code> evaluated and called multiple times before the
update succeeds: atomicity in this context means that the value of <code>place</code> did
not change between the time it was read, and the time it was replaced with the
computed value.
</p>
<p><code>place</code> can be any place supported by <code>sb-ext:compare-and-swap</code>.
</p>
<p>Examples:
</p>
<div class="lisp">
<pre class="lisp">  ;;; Conses T to the head of FOO-LIST.
  (defstruct foo list)
  (defvar *foo* (make-foo))
  (atomic-update (foo-list *foo*) #'cons t)

  (let ((x (cons :count 0)))
     (mapc #'sb-thread:join-thread
           (loop repeat 1000
                 collect (sb-thread:make-thread
                          (lambda ()
                            (loop repeat 1000
                                  do (atomic-update (cdr x) #'1+)
                                     (sleep 0.00001))))))
     ;; Guaranteed to be (:COUNT . 1000000) -- if you replace
     ;; atomic update with (INCF (CDR X)) above, the result becomes
     ;; unpredictable.
     x)
</pre></div>
</dd></dl>
<a name="Macro-sb_002dext_003acompare_002dand_002dswap"></a><dl>
<dt><a name="index-compare_002dand_002dswap"></a>Macro: <strong>compare-and-swap</strong> <em>[sb-ext] place old new</em></dt>
<dd><p>Atomically stores <code>new</code> in <code>place</code> if <code>old</code> matches the current value of <code>place</code>.
Two values are considered to match if they are <code>eq</code>. Returns the previous value
of <code>place:</code> if the returned value is <code>eq</code> to <code>old</code>, the swap was carried out.
</p>
<p><code>place</code> must be an CAS-able place. Built-in CAS-able places are accessor forms
whose <code>car</code> is one of the following:
</p>
<p><code>car</code>, <code>cdr</code>, <code>first</code>, <code>rest</code>, <code>svref</code>, <code>symbol-plist</code>, <code>symbol-value</code>, <code>svref</code>, <code>slot-value</code>
 <code>sb-mop:standard-instance-access</code>, <code>sb-mop:funcallable-standard-instance-access</code>,
</p>
<p>or the name of a <code>defstruct</code> created accessor for a slot whose declared type is
either <code>fixnum</code> or <code>t</code>. Results are unspecified if the slot has a declared type
other than <code>fixnum</code> or <code>t</code>.
</p>
<p>In case of <code>slot-value</code>, if the slot is unbound, <code>slot-unbound</code> is called unless
<code>old</code> is <code>eq</code> to <code>sb-pcl:+slot-unbound+</code> in which case <code>sb-pcl:+slot-unbound+</code> is
returned and <code>new</code> is assigned to the slot. Additionally, the results are
unspecified if there is an applicable method on either
<code>sb-mop:slot-value-using-class</code>, <code>(setf sb-mop:slot-value-using-class)</code>, or
<code>sb-mop:slot-boundp-using-class</code>.
</p>
<p>Additionally, the <code>place</code> can be a anything for which a CAS-expansion has been
specified using <code>defcas</code>, <code>define-cas-expander</code>, or for which a CAS-function has
been defined. (See <code>sb-ext:cas</code> for more information.)
</p></dd></dl>

<a name="CAS-Protocol"></a>
<h4 class="unnumberedsubsec">CAS Protocol</h4>

<p>Our <code>compare-and-swap</code> is user-extensible using a protocol
similar to <code>setf</code>, allowing users to add CAS support to new
places via e.g. <code>defcas</code>.
</p>
<p>At the same time, new atomic operations can be built on top of CAS
using <code>get-cas-expansion</code>. See <code>atomic-update</code>,
<code>atomic-push</code>, and <code>atomic-pop</code> for examples of how to do
this.
</p>
<a name="Macro-sb_002dext_003acas"></a><dl>
<dt><a name="index-cas"></a>Macro: <strong>cas</strong> <em>[sb-ext] place old new</em></dt>
<dd><p>Synonym for <code>compare-and-swap</code>.
</p>
<p>Additionally <code>defun</code>, <code>defgeneric</code>, <code>defmethod</code>, <code>flet</code>, and <code>labels</code> can be also used to
define CAS-functions analogously to SETF-functions:
</p>
<div class="lisp">
<pre class="lisp">  (defvar *foo* nil)

  (defun (cas foo) (old new)
    (cas (symbol-value '*foo*) old new))
</pre></div>

<p>First argument of a <code>cas</code> function is the expected old value, and the second
argument of is the new value. Note that the system provides no automatic
atomicity for <code>cas</code> functions, nor can it verify that they are atomic: it is up
to the implementor of a <code>cas</code> function to ensure its atomicity.
</p>
<p><code>experimental:</code> Interface subject to change.
</p></dd></dl>
<a name="Macro-sb_002dext_003adefine_002dcas_002dexpander"></a><dl>
<dt><a name="index-define_002dcas_002dexpander"></a>Macro: <strong>define-cas-expander</strong> <em>[sb-ext] accessor lambda-list &amp;body body</em></dt>
<dd><p>Analogous to <code>define-setf-expander</code>. Defines a CAS-expansion for <code>accessor</code>.
<code>body</code> must return six values as specified in <code>get-cas-expansion</code>.
</p>
<p>Note that the system provides no automatic atomicity for <code>cas</code> expansion, nor
can it verify that they are atomic: it is up to the implementor of a <code>cas</code>
expansion to ensure its atomicity.
</p>
<p><code>experimental:</code> Interface subject to change.
</p></dd></dl>
<a name="Macro-sb_002dext_003adefcas"></a><dl>
<dt><a name="index-defcas"></a>Macro: <strong>defcas</strong> <em>[sb-ext] accessor lambda-list function &amp;optional docstring</em></dt>
<dd><p>Analogous to short-form <code>defsetf</code>. Defines <code>function</code> as responsible
for compare-and-swap on places accessed using <code>accessor</code>. <code>lambda-list</code>
must correspond to the lambda-list of the accessor.
</p>
<p>Note that the system provides no automatic atomicity for <code>cas</code> expansions
resulting from <code>defcas</code>, nor can it verify that they are atomic: it is up to the
user of <code>defcas</code> to ensure that the function specified is atomic.
</p>
<p><code>experimental:</code> Interface subject to change.
</p></dd></dl>
<a name="Function-sb_002dext_003aget_002dcas_002dexpansion"></a><dl>
<dt><a name="index-get_002dcas_002dexpansion"></a>Function: <strong>get-cas-expansion</strong> <em>[sb-ext] place &amp;optional environment</em></dt>
<dd><p>Analogous to <code>get-setf-expansion</code>. Returns the following six values:
</p>
<ul>
<li> list of temporary variables

</li><li> list of value-forms whose results those variable must be bound

</li><li> temporary variable for the old value of <code>place</code>

</li><li> temporary variable for the new value of <code>place</code>

</li><li> form using the aforementioned temporaries which performs the
   compare-and-swap operation on <code>place</code>

</li><li> form using the aforementioned temporaries with which to perform a volatile
   read of <code>place</code>

</li></ul>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">  (get-cas-expansion '(car x))
  ; =&gt; (#:CONS871), (X), #:OLD872, #:NEW873,
  ;    (SB-KERNEL:%COMPARE-AND-SWAP-CAR #:CONS871 #:OLD872 :NEW873).
  ;    (CAR #:CONS871)

  (defmacro my-atomic-incf (place &amp;optional (delta 1) &amp;environment env)
    (multiple-value-bind (vars vals old new cas-form read-form)
        (get-cas-expansion place env)
     (let ((delta-value (gensym &quot;DELTA&quot;)))
       `(let* (,@(mapcar 'list vars vals)
               (,old ,read-form)
               (,delta-value ,delta)
               (,new (+ ,old ,delta-value)))
          (loop until (eq ,old (setf ,old ,cas-form))
                do (setf ,new (+ ,old ,delta-value)))
          ,new))))
</pre></div>

<p><code>experimental:</code> Interface subject to change.
</p></dd></dl>

<hr>
<a name="Mutex-Support"></a>
<div class="header">
<p>
Next: <a href="#Semaphores" accesskey="n" rel="next">Semaphores</a>, Previous: <a href="#Atomic-Operations" accesskey="p" rel="prev">Atomic Operations</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Mutex-Support-1"></a>
<h3 class="section">12.4 Mutex Support</h3>

<p>Mutexes are used for controlling access to a shared resource. One
thread is allowed to hold the mutex, others which attempt to take it
will be made to wait until it&rsquo;s free. Threads are woken in the order
that they go to sleep.
</p>
<div class="lisp">
<pre class="lisp">(defpackage :demo (:use &quot;CL&quot; &quot;SB-THREAD&quot; &quot;SB-EXT&quot;))

(in-package :demo)

(defvar *a-mutex* (make-mutex :name &quot;my lock&quot;))

(defun thread-fn ()
  (format t &quot;Thread ~A running ~%&quot; *current-thread*)
  (with-mutex (*a-mutex*)
    (format t &quot;Thread ~A got the lock~%&quot; *current-thread*)
    (sleep (random 5)))
  (format t &quot;Thread ~A dropped lock, dying now~%&quot; *current-thread*))

(make-thread #'thread-fn)
(make-thread #'thread-fn)
</pre></div>

<a name="Structure-sb_002dthread_003amutex"></a><dl>
<dt><a name="index-mutex"></a>Structure: <strong>mutex</strong> <em>[sb-thread]</em></dt>
<dd><p>Class precedence list: <code>mutex, structure-object, t</code>
</p>
<p>Mutex type.
</p></dd></dl>

<a name="Macro-sb_002dthread_003awith_002dmutex"></a><dl>
<dt><a name="index-with_002dmutex"></a>Macro: <strong>with-mutex</strong> <em>[sb-thread] (mutex &amp;key wait-p timeout value) &amp;body body</em></dt>
<dd><p>Acquire <code>mutex</code> for the dynamic scope of <code>body</code>. If <code>wait-p</code> is true (the default),
and the <code>mutex</code> is not immediately available, sleep until it is available.
</p>
<p>If <code>timeout</code> is given, it specifies a relative timeout, in seconds, on how long
the system should try to acquire the lock in the contested case.
</p>
<p>If the mutex isn&rsquo;t acquired successfully due to either <code>wait-p</code> or <code>timeout</code>, the
body is not executed, and <code>with-mutex</code> returns <code>nil</code>.
</p>
<p>Otherwise body is executed with the mutex held by current thread, and
<code>with-mutex</code> returns the values of <code>body</code>.
</p>
<p>Historically <code>with-mutex</code> also accepted a <code>value</code> argument, which when provided
was used as the new owner of the mutex instead of the current thread. This is
no longer supported: if <code>value</code> is provided, it must be either <code>nil</code> or the
current thread.
</p></dd></dl>
<a name="Macro-sb_002dthread_003awith_002drecursive_002dlock"></a><dl>
<dt><a name="index-with_002drecursive_002dlock"></a>Macro: <strong>with-recursive-lock</strong> <em>[sb-thread] (mutex &amp;key wait-p timeout) &amp;body body</em></dt>
<dd><p>Acquire <code>mutex</code> for the dynamic scope of <code>body</code>.
</p>
<p>If <code>wait-p</code> is true (the default), and the <code>mutex</code> is not immediately available or
held by the current thread, sleep until it is available.
</p>
<p>If <code>timeout</code> is given, it specifies a relative timeout, in seconds, on how long
the system should try to acquire the lock in the contested case.
</p>
<p>If the mutex isn&rsquo;t acquired successfully due to either <code>wait-p</code> or <code>timeout</code>, the
body is not executed, and <code>with-recursive-lock</code> returns <code>nil</code>.
</p>
<p>Otherwise body is executed with the mutex held by current thread, and
<code>with-recursive-lock</code> returns the values of <code>body</code>.
</p>
<p>Unlike <code>with-mutex</code>, which signals an error on attempt to re-acquire an already
held mutex, <code>with-recursive-lock</code> allows recursive lock attempts to succeed.
</p></dd></dl>

<a name="Function-sb_002dthread_003amake_002dmutex"></a><dl>
<dt><a name="index-make_002dmutex"></a>Function: <strong>make-mutex</strong> <em>[sb-thread] &amp;key name</em></dt>
<dd><p>Create a mutex.
</p></dd></dl>
<a name="Function-sb_002dthread_003amutex_002dname"></a><dl>
<dt><a name="index-mutex_002dname"></a>Function: <strong>mutex-name</strong> <em>[sb-thread] instance</em></dt>
<dd><p>The name of the mutex. Setfable.
</p></dd></dl>
<a name="Function-sb_002dthread_003amutex_002downer"></a><dl>
<dt><a name="index-mutex_002downer"></a>Function: <strong>mutex-owner</strong> <em>[sb-thread] mutex</em></dt>
<dd><p>Current owner of the mutex, <code>nil</code> if the mutex is free. Naturally,
this is racy by design (another thread may acquire the mutex after
this function returns), it is intended for informative purposes. For
testing whether the current thread is holding a mutex see
<code>holding-mutex-p</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003amutex_002dvalue"></a><dl>
<dt><a name="index-mutex_002dvalue"></a>Function: <strong>mutex-value</strong> <em>[sb-thread] mutex</em></dt>
<dd><p>Current owner of the mutex, <code>nil</code> if the mutex is free. May return a
stale value, use <code>mutex-owner</code> instead.
</p></dd></dl>
<a name="Function-sb_002dthread_003agrab_002dmutex"></a><dl>
<dt><a name="index-grab_002dmutex"></a>Function: <strong>grab-mutex</strong> <em>[sb-thread] mutex &amp;key waitp timeout</em></dt>
<dd><p>Acquire <code>mutex</code> for the current thread. If <code>waitp</code> is true (the default) and
the mutex is not immediately available, sleep until it is available.
</p>
<p>If <code>timeout</code> is given, it specifies a relative timeout, in seconds, on how long
<code>grab-mutex</code> should try to acquire the lock in the contested case.
</p>
<p>If <code>grab-mutex</code> returns <code>t</code>, the lock acquisition was successful. In case of <code>waitp</code>
being <code>nil</code>, or an expired <code>timeout</code>, <code>grab-mutex</code> may also return <code>nil</code> which denotes
that <code>grab-mutex</code> did -not- acquire the lock.
</p>
<p>Notes:
</p>
<ul>
<li> <code>grab-mutex</code> is not interrupt safe. The correct way to call it is:

<p>(WITHOUT-INTERRUPTS
        ...
        (<code>allow-with-interrupts</code> (<code>grab-mutex</code> ...))
        ...)
</p>
<p><code>without-interrupts</code> is necessary to avoid an interrupt unwinding the call
    while the mutex is in an inconsistent state while <code>allow-with-interrupts</code>
    allows the call to be interrupted from sleep.
</p>
</li><li> <code>(grab-mutex &lt;mutex&gt; :timeout 0.0) </code>differs from
    <code>(grab-mutex &lt;mutex&gt; :waitp nil) </code>in that the former may signal a
    <code>deadline-timeout</code> if the global deadline was due already on entering
    <code>grab-mutex</code>.

<p>The exact interplay of <code>grab-mutex</code> and deadlines are reserved to change in
    future versions.
</p>
</li><li> It is recommended that you use <code>with-mutex</code> instead of calling <code>grab-mutex</code>
    directly.
</li></ul>
</dd></dl>
<a name="Function-sb_002dthread_003arelease_002dmutex"></a><dl>
<dt><a name="index-release_002dmutex"></a>Function: <strong>release-mutex</strong> <em>[sb-thread] mutex &amp;key if-not-owner</em></dt>
<dd><p>Release <code>mutex</code> by setting it to <code>nil</code>. Wake up threads waiting for
this mutex.
</p>
<p><code>release-mutex</code> is not interrupt safe: interrupts should be disabled
around calls to it.
</p>
<p>If the current thread is not the owner of the mutex then it silently
returns without doing anything (if <code>if-not-owner</code> is :PUNT), signals a
<code>warning</code> (if <code>if-not-owner</code> is :WARN), or releases the mutex anyway (if
<code>if-not-owner</code> is :FORCE).
</p></dd></dl>

<hr>
<a name="Semaphores"></a>
<div class="header">
<p>
Next: <a href="#Waitqueue_002fcondition-variables" accesskey="n" rel="next">Waitqueue/condition variables</a>, Previous: <a href="#Mutex-Support" accesskey="p" rel="prev">Mutex Support</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Semaphores-1"></a>
<h3 class="section">12.5 Semaphores</h3>

<p>Semaphores are among other things useful for keeping track of a
countable resource, e.g. messages in a queue, and sleep when the
resource is exhausted.
</p>
<a name="Structure-sb_002dthread_003asemaphore"></a><dl>
<dt><a name="index-semaphore"></a>Structure: <strong>semaphore</strong> <em>[sb-thread]</em></dt>
<dd><p>Class precedence list: <code>semaphore, structure-object, t</code>
</p>
<p>Semaphore type. The fact that a <code>semaphore</code> is a <code>structure-object</code>
should be considered an implementation detail, and may change in the
future.
</p></dd></dl>
<a name="Function-sb_002dthread_003amake_002dsemaphore"></a><dl>
<dt><a name="index-make_002dsemaphore"></a>Function: <strong>make-semaphore</strong> <em>[sb-thread] &amp;key name count</em></dt>
<dd><p>Create a semaphore with the supplied <code>count</code> and <code>name</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003asignal_002dsemaphore"></a><dl>
<dt><a name="index-signal_002dsemaphore"></a>Function: <strong>signal-semaphore</strong> <em>[sb-thread] semaphore &amp;optional n</em></dt>
<dd><p>Increment the count of <code>semaphore</code> by <code>n</code>. If there are threads waiting
on this semaphore, then <code>n</code> of them is woken up.
</p></dd></dl>
<a name="Function-sb_002dthread_003await_002don_002dsemaphore"></a><dl>
<dt><a name="index-wait_002don_002dsemaphore"></a>Function: <strong>wait-on-semaphore</strong> <em>[sb-thread] semaphore &amp;key n timeout notification</em></dt>
<dd><p>Decrement the count of <code>semaphore</code> by <code>n</code> if the count would not be negative.
</p>
<p>Else blocks until the semaphore can be decremented. Returns the new count of
<code>semaphore</code> on success.
</p>
<p>If <code>timeout</code> is given, it is the maximum number of seconds to wait. If the count
cannot be decremented in that time, returns <code>nil</code> without decrementing the
count.
</p>
<p>If <code>notification</code> is given, it must be a <code>semaphore-notification</code> object whose
<code>semaphore-notification-status</code> is <code>nil</code>. If <code>wait-on-semaphore</code> succeeds and
decrements the count, the status is set to <code>t</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003atry_002dsemaphore"></a><dl>
<dt><a name="index-try_002dsemaphore"></a>Function: <strong>try-semaphore</strong> <em>[sb-thread] semaphore &amp;optional n notification</em></dt>
<dd><p>Try to decrement the count of <code>semaphore</code> by <code>n</code>. If the count were to
become negative, punt and return <code>nil</code>, otherwise return the new count of
<code>semaphore</code>.
</p>
<p>If <code>notification</code> is given it must be a semaphore notification object
with <code>semaphore-notification-status</code> of <code>nil</code>. If the count is decremented,
the status is set to <code>t</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003asemaphore_002dcount"></a><dl>
<dt><a name="index-semaphore_002dcount"></a>Function: <strong>semaphore-count</strong> <em>[sb-thread] instance</em></dt>
<dd><p>Returns the current count of the semaphore <code>instance</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003asemaphore_002dname"></a><dl>
<dt><a name="index-semaphore_002dname"></a>Function: <strong>semaphore-name</strong> <em>[sb-thread] instance</em></dt>
<dd><p>The name of the semaphore <code>instance</code>. Setfable.
</p></dd></dl>

<a name="Structure-sb_002dthread_003asemaphore_002dnotification"></a><dl>
<dt><a name="index-semaphore_002dnotification"></a>Structure: <strong>semaphore-notification</strong> <em>[sb-thread]</em></dt>
<dd><p>Class precedence list: <code>semaphore-notification, structure-object, t</code>
</p>
<p>Semaphore notification object. Can be passed to <code>wait-on-semaphore</code> and
<code>try-semaphore</code> as the <code>:notification</code> argument. Consequences are undefined if
multiple threads are using the same notification object in parallel.
</p></dd></dl>
<a name="Function-sb_002dthread_003amake_002dsemaphore_002dnotification"></a><dl>
<dt><a name="index-make_002dsemaphore_002dnotification"></a>Function: <strong>make-semaphore-notification</strong> <em>[sb-thread]</em></dt>
<dd><p>Constructor for <code>semaphore-notification</code> objects. <code>semaphore-notification-status</code>
is initially <code>nil</code>.
</p></dd></dl>
<a name="Function-sb_002dthread_003asemaphore_002dnotification_002dstatus"></a><dl>
<dt><a name="index-semaphore_002dnotification_002dstatus"></a>Function: <strong>semaphore-notification-status</strong> <em>[sb-thread] semaphore-notification</em></dt>
<dd><p>Returns <code>t</code> if a <code>wait-on-semaphore</code> or <code>try-semaphore</code> using
<code>semaphore-notification</code> has succeeded since the notification object was created
or cleared.
</p></dd></dl>
<a name="Function-sb_002dthread_003aclear_002dsemaphore_002dnotification"></a><dl>
<dt><a name="index-clear_002dsemaphore_002dnotification"></a>Function: <strong>clear-semaphore-notification</strong> <em>[sb-thread] semaphore-notification</em></dt>
<dd><p>Resets the <code>semaphore-notification</code> object for use with another call to
<code>wait-on-semaphore</code> or <code>try-semaphore</code>.
</p></dd></dl>

<hr>
<a name="Waitqueue_002fcondition-variables"></a>
<div class="header">
<p>
Next: <a href="#Barriers" accesskey="n" rel="next">Barriers</a>, Previous: <a href="#Semaphores" accesskey="p" rel="prev">Semaphores</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Waitqueue_002fcondition-variables-1"></a>
<h3 class="section">12.6 Waitqueue/condition variables</h3>

<p>These are based on the POSIX condition variable design, hence the
annoyingly CL-conflicting name. For use when you want to check a
condition and sleep until it&rsquo;s true. For example: you have a shared
queue, a writer process checking &ldquo;queue is empty&rdquo; and one or more
readers that need to know when &ldquo;queue is not empty&rdquo;. It sounds
simple, but is astonishingly easy to deadlock if another process runs
when you weren&rsquo;t expecting it to.
</p>
<p>There are three components:
</p>
<ul>
<li> the condition itself (not represented in code)

</li><li> the condition variable (a.k.a. waitqueue) which proxies for it

</li><li> a lock to hold while testing the condition
</li></ul>

<p>Important stuff to be aware of:
</p>
<ul>
<li> when calling condition-wait, you must hold the mutex. condition-wait
will drop the mutex while it waits, and obtain it again before
returning for whatever reason;

</li><li> likewise, you must be holding the mutex around calls to
condition-notify;

</li><li> a process may return from condition-wait in several circumstances: it
is not guaranteed that the underlying condition has become true. You
must check that the resource is ready for whatever you want to do to
it.

</li></ul>

<div class="lisp">
<pre class="lisp">(defvar *buffer-queue* (make-waitqueue))
(defvar *buffer-lock* (make-mutex :name &quot;buffer lock&quot;))

(defvar *buffer* (list nil))

(defun reader ()
  (with-mutex (*buffer-lock*)
    (loop
     (condition-wait *buffer-queue* *buffer-lock*)
     (loop
      (unless *buffer* (return))
      (let ((head (car *buffer*)))
        (setf *buffer* (cdr *buffer*))
        (format t &quot;reader ~A woke, read ~A~%&quot;
                *current-thread* head))))))

(defun writer ()
  (loop
   (sleep (random 5))
   (with-mutex (*buffer-lock*)
     (let ((el (intern
                (string (code-char
                         (+ (char-code #\A) (random 26)))))))
       (setf *buffer* (cons el *buffer*)))
     (condition-notify *buffer-queue*))))

(make-thread #'writer)
(make-thread #'reader)
(make-thread #'reader)
</pre></div>

<a name="Structure-sb_002dthread_003awaitqueue"></a><dl>
<dt><a name="index-waitqueue"></a>Structure: <strong>waitqueue</strong> <em>[sb-thread]</em></dt>
<dd><p>Class precedence list: <code>waitqueue, structure-object, t</code>
</p>
<p>Waitqueue type.
</p></dd></dl>
<a name="Function-sb_002dthread_003amake_002dwaitqueue"></a><dl>
<dt><a name="index-make_002dwaitqueue"></a>Function: <strong>make-waitqueue</strong> <em>[sb-thread] &amp;key name</em></dt>
<dd><p>Create a waitqueue.
</p></dd></dl>
<a name="Function-sb_002dthread_003awaitqueue_002dname"></a><dl>
<dt><a name="index-waitqueue_002dname"></a>Function: <strong>waitqueue-name</strong> <em>[sb-thread] instance</em></dt>
<dd><p>The name of the waitqueue. Setfable.
</p></dd></dl>
<a name="Function-sb_002dthread_003acondition_002dwait"></a><dl>
<dt><a name="index-condition_002dwait"></a>Function: <strong>condition-wait</strong> <em>[sb-thread] queue mutex &amp;key timeout</em></dt>
<dd><p>Atomically release <code>mutex</code> and start waiting on <code>queue</code> until another thread
wakes us up using either <code>condition-notify</code> or <code>condition-broadcast</code> on
<code>queue</code>, at which point we re-acquire <code>mutex</code> and return <code>t</code>.
</p>
<p>Spurious wakeups are possible.
</p>
<p>If <code>timeout</code> is given, it is the maximum number of seconds to wait,
including both waiting for the wakeup and the time to re-acquire
<code>mutex</code>. When neither a wakeup nor a re-acquisition occurs within the
given time, returns <code>nil</code> without re-acquiring <code>mutex</code>.
</p>
<p>If <code>condition-wait</code> unwinds, it may do so with or without <code>mutex</code> being
held.
</p>
<p>Important: Since <code>condition-wait</code> may return without <code>condition-notify</code> or
<code>condition-broadcast</code> having occurred, the correct way to write code
that uses <code>condition-wait</code> is to loop around the call, checking the
associated data:
</p>
<div class="lisp">
<pre class="lisp">  (defvar *data* nil)
  (defvar *queue* (make-waitqueue))
  (defvar *lock* (make-mutex))

  ;; Consumer
  (defun pop-data (&amp;optional timeout)
    (with-mutex (*lock*)
      (loop until *data*
            do (or (condition-wait *queue* *lock* :timeout timeout)
                   ;; Lock not held, must unwind without touching *data*.
                   (return-from pop-data nil)))
      (pop *data*)))

  ;; Producer
  (defun push-data (data)
    (with-mutex (*lock*)
      (push data *data*)
      (condition-notify *queue*)))
</pre></div>
</dd></dl>
<a name="Function-sb_002dthread_003acondition_002dnotify"></a><dl>
<dt><a name="index-condition_002dnotify"></a>Function: <strong>condition-notify</strong> <em>[sb-thread] queue &amp;optional n</em></dt>
<dd><p>Notify <code>n</code> threads waiting on <code>queue</code>.
</p>
<p><code>important:</code> The same mutex that is used in the corresponding <code>condition-wait</code>
must be held by this thread during this call.
</p></dd></dl>
<a name="Function-sb_002dthread_003acondition_002dbroadcast"></a><dl>
<dt><a name="index-condition_002dbroadcast"></a>Function: <strong>condition-broadcast</strong> <em>[sb-thread] queue</em></dt>
<dd><p>Notify all threads waiting on <code>queue</code>.
</p>
<p><code>important:</code> The same mutex that is used in the corresponding <code>condition-wait</code>
must be held by this thread during this call.
</p></dd></dl>

<hr>
<a name="Barriers"></a>
<div class="header">
<p>
Next: <a href="#Sessions_002fDebugging" accesskey="n" rel="next">Sessions/Debugging</a>, Previous: <a href="#Waitqueue_002fcondition-variables" accesskey="p" rel="prev">Waitqueue/condition variables</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Barriers-1"></a>
<h3 class="section">12.7 Barriers</h3>

<p>These are based on the Linux kernel barrier design, which is in turn
based on the Alpha CPU memory model. They are presently implemented
for x86, x86-64, PPC, and ARM64 systems, and behave as compiler
barriers on all other CPUs.
</p>
<p>In addition to explicit use of the <code>sb-thread:barrier</code> macro, the
following functions and macros also serve as <code>:memory</code> barriers:
</p>
<ul>
<li> <code>sb-ext:atomic-decf</code>, <code>sb-ext:atomic-incf</code>, <code>sb-ext:atomic-push</code>,
and <code>sb-ext:atomic-pop</code>.
</li><li> <code>sb-ext:compare-and-swap</code>.
</li><li> <code>sb-thread:grab-mutex</code>, <code>sb-thread:release-mutex</code>,
<code>sb-thread:with-mutex</code> and <code>sb-thread:with-recursive-lock</code>.
</li><li> <code>sb-thread:signal-semaphore</code>, <code>sb-thread:try-semaphore</code> and
<code>sb-thread:wait-on-semaphore</code>.
</li><li> <code>sb-thread:condition-wait</code>, <code>sb-thread:condition-notify</code> and
<code>sb-thread:condition-broadcast</code>.
</li></ul>

<a name="Macro-sb_002dthread_003abarrier"></a><dl>
<dt><a name="index-barrier"></a>Macro: <strong>barrier</strong> <em>[sb-thread] (kind) &amp;body forms</em></dt>
<dd><p>Insert a barrier in the code stream, preventing some sort of
reordering.
</p>
<p><code>kind</code> should be one of:
</p>

<dl compact="compact">
<dt><em><code>:compiler</code></em></dt>
<dd><p>Prevent the compiler from reordering memory access across the
    barrier.
</p>
</dd>
<dt><em><code>:memory</code></em></dt>
<dd><p>Prevent the cpu from reordering any memory access across the
    barrier.
</p>
</dd>
<dt><em><code>:read</code></em></dt>
<dd><p>Prevent the cpu from reordering any read access across the
    barrier.
</p>
</dd>
<dt><em><code>:write</code></em></dt>
<dd><p>Prevent the cpu from reordering any write access across the
    barrier.
</p>
</dd>
<dt><em><code>:data-dependency</code></em></dt>
<dd><p>Prevent the cpu from reordering dependent memory reads across the
    barrier (requiring reads before the barrier to complete before any
    reads after the barrier that depend on them).  This is a weaker
    form of the <code>:read</code> barrier.
</p>
</dd>
</dl>

<p><code>forms</code> is an implicit <code>progn</code>, evaluated before the barrier.  <code>barrier</code>
returns the values of the last form in <code>forms</code>.
</p>
<p>The file &quot;memory-barriers.txt&quot; in the Linux kernel documentation is
highly recommended reading for anyone programming at this level.
</p></dd></dl>

<hr>
<a name="Sessions_002fDebugging"></a>
<div class="header">
<p>
Next: <a href="#Foreign-threads" accesskey="n" rel="next">Foreign threads</a>, Previous: <a href="#Barriers" accesskey="p" rel="prev">Barriers</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Sessions_002fDebugging-1"></a>
<h3 class="section">12.8 Sessions/Debugging</h3>

<p>If the user has multiple views onto the same Lisp image (for example,
using multiple terminals, or a windowing system, or network access)
they are typically set up as multiple <em>sessions</em> such that each
view has its own collection of foreground/background/stopped threads.
A thread which wishes to create a new session can use
<code>sb-thread:with-new-session</code> to remove itself from the current
session (which it shares with its parent and siblings) and create a
fresh one.
# See also <code>sb-thread:make-listener-thread</code>.
</p>
<p>Within a single session, threads arbitrate between themselves for the
user&rsquo;s attention.  A thread may be in one of three notional states:
foreground, background, or stopped.  When a background process
attempts to print a repl prompt or to enter the debugger, it will stop
and print a message saying that it has stopped.  The user at his
leisure may switch to that thread to find out what it needs.  If a
background thread enters the debugger, selecting any restart will put
it back into the background before it resumes.  Arbitration for the
input stream is managed by calls to <code>sb-thread:get-foreground</code>
(which may block) and <code>sb-thread:release-foreground</code>.
</p>
<hr>
<a name="Foreign-threads"></a>
<div class="header">
<p>
Next: <a href="#Implementation-_0028Linux-x86_002fx86_002d64_0029" accesskey="n" rel="next">Implementation (Linux x86/x86-64)</a>, Previous: <a href="#Sessions_002fDebugging" accesskey="p" rel="prev">Sessions/Debugging</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Foreign-threads-1"></a>
<h3 class="section">12.9 Foreign threads</h3>

<p>Direct calls to <code>pthread_create</code> (instead of <code>MAKE-THREAD</code>)
create threads that SBCL is not aware of, these are called foreign
threads. Currently, it is not possible to run Lisp code in such
threads. This means that the Lisp side signal handlers cannot work.
The best solution is to start foreign threads with signals blocked,
but since third party libraries may create threads, it is not always
feasible to do so. As a workaround, upon receiving a signal in a
foreign thread, SBCL changes the thread&rsquo;s sigmask to block all signals
that it wants to handle and resends the signal to the current process
which should land in a thread that does not block it, that is, a Lisp
thread.
</p>
<p>The resignalling trick cannot work for synchronously triggered signals
(SIGSEGV and co), take care not to trigger any. Resignalling for
synchronously triggered signals in foreign threads is subject to
<code>--lose-on-corruption</code>, see <a href="#Runtime-Options">Runtime Options</a>.
</p>
<hr>
<a name="Implementation-_0028Linux-x86_002fx86_002d64_0029"></a>
<div class="header">
<p>
Previous: <a href="#Foreign-threads" accesskey="p" rel="prev">Foreign threads</a>, Up: <a href="#Threading" accesskey="u" rel="up">Threading</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Implementation-_0028Linux-x86_002fx86_002d64_0029-1"></a>
<h3 class="section">12.10 Implementation (Linux x86/x86-64)</h3>

<p>Threading is implemented using pthreads and some Linux specific bits
like futexes.
</p>
<p>On x86 the per-thread local bindings for special variables is achieved
using the %fs segment register to point to a per-thread storage area.
This may cause interesting results if you link to foreign code that
expects threading or creates new threads, and the thread library in
question uses %fs in an incompatible way. On x86-64 the r12 register
has a similar role.
</p>
<p>Queues require the <code>sys_futex()</code> system call to be available:
this is the reason for the NPTL requirement.  We test at runtime that
this system call exists.
</p>
<p>Garbage collection is done with the existing Conservative Generational
GC.  Allocation is done in small (typically 8k) regions: each thread
has its own region so this involves no stopping. However, when a
region fills, a lock must be obtained while another is allocated, and
when a collection is required, all processes are stopped.  This is
achieved by sending them signals, which may make for interesting
behaviour if they are interrupted in system calls.  The streams
interface is believed to handle the required system call restarting
correctly, but this may be a consideration when making other blocking
calls e.g. from foreign library code.
</p>
<p>Large amounts of the SBCL library have not been inspected for
thread-safety.  Some of the obviously unsafe areas have large locks
around them, so compilation and fasl loading, for example, cannot be
parallelized.  Work is ongoing in this area.
</p>
<p>A new thread by default is created in the same POSIX process group and
session as the thread it was created by.  This has an impact on
keyboard interrupt handling: pressing your terminal&rsquo;s intr key
(typically <kbd>Control-C</kbd>) will interrupt all processes in the
foreground process group, including Lisp threads that SBCL considers
to be notionally &lsquo;background&rsquo;.  This is undesirable, so background
threads are set to ignore the SIGINT signal.
</p>
<p><code>sb-thread:make-listener-thread</code> in addition to creating a new
Lisp session makes a new POSIX session, so that pressing
<kbd>Control-C</kbd> in one window will not interrupt another listener -
this has been found to be embarrassing.
</p><hr>
<a name="Timers"></a>
<div class="header">
<p>
Next: <a href="#Networking" accesskey="n" rel="next">Networking</a>, Previous: <a href="#Threading" accesskey="p" rel="prev">Threading</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Timers-1"></a>
<h2 class="chapter">13 Timers</h2>

<p>SBCL supports a system-wide event scheduler implemented on top of
<code>setitimer</code> that also works with threads but does not require a
separate scheduler thread.
</p>
<p>The following example schedules a timer that writes &ldquo;Hello, word&rdquo; after
two seconds.
</p>
<div class="lisp">
<pre class="lisp">(schedule-timer (make-timer (lambda ()
                              (write-line &quot;Hello, world&quot;)
                              (force-output)))
                2)
</pre></div>

<p>It should be noted that writing timer functions requires special care,
as the dynamic environment in which they run is unpredictable: dynamic
variable bindings, locks held, etc, all depend on whatever code was
running when the timer fired. The following example should serve as
a cautionary tale:
</p>
<div class="lisp">
<pre class="lisp">(defvar *foo* nil)

(defun show-foo ()
  (format t &quot;~&amp;foo=~S~%&quot; *foo*)
  (force-output t))

(defun demo ()
  (schedule-timer (make-timer #'show-foo) 0.5)
  (schedule-timer (make-timer #'show-foo) 1.5)
  (let ((*foo* t))
    (sleep 1.0))
  (let ((*foo* :surprise!))
    (sleep 2.0)))
</pre></div>

<a name="Timer-Dictionary"></a>
<h3 class="section">13.1 Timer Dictionary</h3>

<a name="Structure-sb_002dext_003atimer"></a><dl>
<dt><a name="index-timer"></a>Structure: <strong>timer</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>timer, structure-object, t</code>
</p>
<p>Timer type. Do not rely on timers being structs as it may change in
future versions.
</p></dd></dl>
<a name="Function-sb_002dext_003amake_002dtimer"></a><dl>
<dt><a name="index-make_002dtimer"></a>Function: <strong>make-timer</strong> <em>[sb-ext] function &amp;key name thread</em></dt>
<dd><p>Create a timer that runs <code>function</code> when triggered.
</p>
<p>If a <code>thread</code> is supplied, <code>function</code> is run in that thread. If <code>thread</code> is
<code>t</code>, a new thread is created for <code>function</code> each time the timer is
triggered. If <code>thread</code> is <code>nil</code>, <code>function</code> is run in an unspecified thread.
</p>
<p>When <code>thread</code> is not <code>t</code>, <code>interrupt-thread</code> is used to run <code>function</code> and the
ordering guarantees of <code>interrupt-thread</code> apply. In that case, <code>function</code>
runs with interrupts disabled but <code>with-interrupts</code> is allowed.
</p></dd></dl>
<a name="Function-sb_002dext_003atimer_002dname"></a><dl>
<dt><a name="index-timer_002dname"></a>Function: <strong>timer-name</strong> <em>[sb-ext] timer</em></dt>
<dd><p>Return the name of <code>timer</code>.
</p></dd></dl>
<a name="Function-sb_002dext_003atimer_002dscheduled_002dp"></a><dl>
<dt><a name="index-timer_002dscheduled_002dp"></a>Function: <strong>timer-scheduled-p</strong> <em>[sb-ext] timer &amp;key delta</em></dt>
<dd><p>See if <code>timer</code> will still need to be triggered after <code>delta</code> seconds
from now. For timers with a repeat interval it returns true.
</p></dd></dl>
<a name="Function-sb_002dext_003aschedule_002dtimer"></a><dl>
<dt><a name="index-schedule_002dtimer"></a>Function: <strong>schedule-timer</strong> <em>[sb-ext] timer time &amp;key repeat-interval absolute-p catch-up</em></dt>
<dd><p>Schedule <code>timer</code> to be triggered at <code>time</code>. If <code>absolute-p</code> then <code>time</code> is
universal time, but non-integral values are also allowed, else <code>time</code> is
measured as the number of seconds from the current time.
</p>
<p>If <code>repeat-interval</code> is given, <code>timer</code> is automatically rescheduled upon
expiry.
</p>
<p>If <code>repeat-interval</code> is non-NIL, the Boolean <code>catch-up</code> controls whether
<code>timer</code> will &quot;catch up&quot; by repeatedly calling its function without
delay in case calls are missed because of a clock discontinuity such
as a suspend and resume cycle of the computer. The default is <code>nil</code>,
i.e. do not catch up.
</p></dd></dl>
<a name="Function-sb_002dext_003aunschedule_002dtimer"></a><dl>
<dt><a name="index-unschedule_002dtimer"></a>Function: <strong>unschedule-timer</strong> <em>[sb-ext] timer</em></dt>
<dd><p>Cancel <code>timer</code>. Once this function returns it is guaranteed that
<code>timer</code> shall not be triggered again and there are no unfinished
triggers.
</p></dd></dl>
<a name="Function-sb_002dext_003alist_002dall_002dtimers"></a><dl>
<dt><a name="index-list_002dall_002dtimers"></a>Function: <strong>list-all-timers</strong> <em>[sb-ext]</em></dt>
<dd><p>Return a list of all timers in the system.
</p></dd></dl>
<hr>
<a name="Networking"></a>
<div class="header">
<p>
Next: <a href="#Profiling" accesskey="n" rel="next">Profiling</a>, Previous: <a href="#Timers" accesskey="p" rel="prev">Timers</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Networking-1"></a>
<h2 class="chapter">14 Networking</h2>
<a name="index-Sockets_002c-Networking"></a>

<p>The <code>sb-bsd-sockets</code> module provides a thinly disguised BSD
socket API for SBCL. Ideas have been stolen from the BSD socket API
for C and Graham Barr&rsquo;s IO::Socket classes for Perl.
</p>
<p>Sockets are represented as CLOS objects, and the API naming
conventions attempt to balance between the BSD names and good lisp style.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Sockets-Overview" accesskey="1">Sockets Overview</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#General-Sockets" accesskey="2">General Sockets</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Methods applicable to all sockets
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Socket-Options" accesskey="3">Socket Options</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#INET-Domain-Sockets" accesskey="4">INET Domain Sockets</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Local-_0028Unix_0029-Domain-Sockets" accesskey="5">Local (Unix) Domain Sockets</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Name-Service" accesskey="6">Name Service</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Sockets-Overview"></a>
<div class="header">
<p>
Next: <a href="#General-Sockets" accesskey="n" rel="next">General Sockets</a>, Up: <a href="#Networking" accesskey="u" rel="up">Networking</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Sockets-Overview-1"></a>
<h3 class="section">14.1 Sockets Overview</h3>

<p>Most of the functions are modelled on the BSD socket API.  BSD sockets
are widely supported, portably <em>(&ldquo;portable&rdquo; by Unix standards, at least)</em>
available on a variety of systems, and documented.  There are some
differences in approach where we have taken advantage of some of the
more useful features of Common Lisp - briefly:
</p>
<ul>
<li> Where the C API would typically return -1 and set <code>errno</code>,
<code>sb-bsd-sockets</code> signals an error. All the errors are subclasses
of <code>sb-bsd-sockets:socket-condition</code> and generally correspond one
for one with possible <code>errno</code> values.

</li><li> We use multiple return values in many places where the C API would use
pass-by-reference values.

</li><li> We can often avoid supplying an explicit <em>length</em> argument to
functions because we already know how long the argument is.

</li><li> IP addresses and ports are represented in slightly friendlier fashion
than &quot;network-endian integers&quot;.

</li></ul>

<hr>
<a name="General-Sockets"></a>
<div class="header">
<p>
Next: <a href="#Socket-Options" accesskey="n" rel="next">Socket Options</a>, Previous: <a href="#Sockets-Overview" accesskey="p" rel="prev">Sockets Overview</a>, Up: <a href="#Networking" accesskey="u" rel="up">Networking</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="General-Sockets-1"></a>
<h3 class="section">14.2 General Sockets</h3>

<a name="Class-sb_002dbsd_002dsockets_003asocket"></a><dl>
<dt><a name="index-socket"></a>Class: <strong>socket</strong> <em>[sb-bsd-sockets]</em></dt>
<dd><p>Class precedence list: <code>socket, standard-object, t</code>
</p>
<p>Slots:
</p><ul>
<li> <code>protocol</code> &mdash; initarg: <code>:protocol<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-bsd-sockets:socket-protocol</span><!-- /@w --></code>

<p>Protocol used by the socket. If a
keyword, the symbol-name of the keyword will be passed to
<code>get-protocol-by-name</code> downcased, and the returned value used as
protocol. Other values are used as-is.
</p></li><li> <code>type</code> &mdash; initarg: <code>:type<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-bsd-sockets:socket-type</span><!-- /@w --></code>

<p>Type of the socket: <code>:stream</code> or <code>:datagram</code>.
</p></li></ul>

<p>Common superclass of all sockets, not meant to be
directly instantiated.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dbind"></a><dl>
<dt><a name="index-socket_002dbind"></a>Generic Function: <strong>socket-bind</strong> <em>[sb-bsd-sockets] socket &amp;rest address</em></dt>
<dd><p>Bind <code>socket</code> to <code>address</code>, which may vary according to socket family.
For the <code>inet</code> family, pass <code>address</code> and <code>port</code> as two arguments; for <code>file</code>
address family sockets, pass the filename string.  See also bind(2)
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002daccept"></a><dl>
<dt><a name="index-socket_002daccept"></a>Generic Function: <strong>socket-accept</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Perform the accept(2) call, returning a newly-created connected
socket and the peer address as multiple values
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dconnect"></a><dl>
<dt><a name="index-socket_002dconnect"></a>Generic Function: <strong>socket-connect</strong> <em>[sb-bsd-sockets] socket &amp;rest address</em></dt>
<dd><p>Perform the connect(2) call to connect <code>socket</code> to a remote <code>peer</code>.
No useful return value.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dpeername"></a><dl>
<dt><a name="index-socket_002dpeername"></a>Generic Function: <strong>socket-peername</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return SOCKET&rsquo;s peer; depending on the address family this may
return multiple values
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dname"></a><dl>
<dt><a name="index-socket_002dname"></a>Generic Function: <strong>socket-name</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the address (as vector of bytes) and port that <code>socket</code> is
bound to, as multiple values.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dreceive"></a><dl>
<dt><a name="index-socket_002dreceive"></a>Generic Function: <strong>socket-receive</strong> <em>[sb-bsd-sockets] socket buffer length &amp;key oob peek waitall dontwait element-type</em></dt>
<dd><p>Read <code>length</code> octets from <code>socket</code> into <code>buffer</code> (or a freshly-consed
buffer if NIL), using recvfrom(2). If <code>length</code> is <code>nil</code>, the length of
<code>buffer</code> is used, so at least one of these two arguments must be
non-NIL. If <code>buffer</code> is supplied, it had better be of an element type
one octet wide. Returns the buffer, its length, and the address of the
peer that sent it, as multiple values. On datagram sockets, sets
MSG_TRUNC so that the actual packet length is returned even if the
buffer was too small.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dsend"></a><dl>
<dt><a name="index-socket_002dsend"></a>Generic Function: <strong>socket-send</strong> <em>[sb-bsd-sockets] socket buffer length &amp;key address external-format oob eor dontroute dontwait nosignal confirm more</em></dt>
<dd><p>Send <code>length</code> octets from <code>buffer</code> into <code>socket</code>, using sendto(2). If
<code>buffer</code> is a string, it will converted to octets according to
<code>external-format</code>. If <code>length</code> is <code>nil</code>, the length of the octet buffer is
used. The format of <code>address</code> depends on the socket type (for example
for <code>inet</code> domain sockets it would be a list of an <code>ip</code> address and a
port). If no socket address is provided, send(2) will be called
instead. Returns the number of octets written.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dlisten"></a><dl>
<dt><a name="index-socket_002dlisten"></a>Generic Function: <strong>socket-listen</strong> <em>[sb-bsd-sockets] socket backlog</em></dt>
<dd><p>Mark <code>socket</code> as willing to accept incoming connections.  The
integer <code>backlog</code> defines the maximum length that the queue of pending
connections may grow to before new connection attempts are refused.
See also listen(2)
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dopen_002dp"></a><dl>
<dt><a name="index-socket_002dopen_002dp"></a>Generic Function: <strong>socket-open-p</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return true if <code>socket</code> is open; otherwise, return false.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dclose"></a><dl>
<dt><a name="index-socket_002dclose"></a>Generic Function: <strong>socket-close</strong> <em>[sb-bsd-sockets] socket &amp;key abort</em></dt>
<dd><p>Close <code>socket</code>, unless it was already closed.
</p>
<p>If <code>socket-make-stream</code> has been called, calls <code>close</code> using <code>abort</code> on that
stream.  Otherwise closes the socket file descriptor using
close(2).
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dshutdown"></a><dl>
<dt><a name="index-socket_002dshutdown"></a>Generic Function: <strong>socket-shutdown</strong> <em>[sb-bsd-sockets] socket &amp;key direction</em></dt>
<dd><p>Indicate that no communication in <code>direction</code> will be performed on
<code>socket</code>.
</p>
<p><code>direction</code> has to be one of <code>:input</code>, <code>:output</code> or <code>:io</code>.
</p>
<p>After a shutdown, no input and/or output of the indicated <code>direction</code>
can be performed on <code>socket</code>.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003asocket_002dmake_002dstream"></a><dl>
<dt><a name="index-socket_002dmake_002dstream"></a>Generic Function: <strong>socket-make-stream</strong> <em>[sb-bsd-sockets] socket &amp;key input output element-type external-format buffering timeout auto-close serve-events</em></dt>
<dd><p>Find or create a <code>stream</code> that can be used for <code>io</code> on <code>socket</code> (which
must be connected).  Specify whether the stream is for <code>input</code>, <code>output</code>,
or both (it is an error to specify neither).
</p>
<p><code>element-type</code> and <code>external-format</code> are as per <code>open</code>.
</p>
<p><code>timeout</code> specifies a read timeout for the stream.
</p></dd></dl>
<a name="Method-sb_002dbsd_002dsockets_003asocket_002dmake_002dstream-_0028_0028socket-socket_0029-_0026key-input-output--_0028element_002dtype-_0027character_0029-_0028buffering-full_0029--_0028external_002dformat-default_0029-timeout-auto_002dclose--serve_002devents_0029"></a><dl>
<dt><a name="index-socket_002dmake_002dstream-1"></a>Method: <strong>socket-make-stream</strong> <em>[sb-bsd-sockets] (socket socket) &amp;key input output (element-type (quote character)) (buffering full) (external-format default) timeout auto-close serve-events</em></dt>
<dd><p>Default method for <code>socket</code> objects.
</p>
<p><code>element-type</code> defaults to <code>character</code>, to construct a bivalent stream,
capable of both binary and character <code>io</code> use <code>:default</code>.
</p>
<p>Acceptable values for <code>buffering</code> are <code>:full</code>, <code>:line</code> and <code>:none</code>, default
is <code>:full</code>, ie. output is buffered till it is explicitly flushed using
<code>close</code> or <code>finish-output</code>. (<code>force-output</code> forces some output to be
flushed: to ensure all buffered output is flused use <code>finish-output</code>.)
</p>
<p>Streams have no <code>timeout</code> by default. If one is provided, it is the
number of seconds the system will at most wait for input to appear on
the socket stream when trying to read from it.
</p>
<p>If <code>auto-close</code> is true, the underlying <code>os</code> socket is automatically
closed after the stream and the socket have been garbage collected.
Default is false.
</p>
<p>If <code>serve-events</code> is true, blocking <code>io</code> on the socket will dispatch to
the recursive event loop. Default is false.
</p>
<p>The stream for <code>socket</code> will be cached, and a second invocation of this
method will return the same stream. This may lead to oddities if this
function is invoked with inconsistent arguments (e.g., one might
request an input stream and get an output stream in response).
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asocket_002derror"></a><dl>
<dt><a name="index-socket_002derror"></a>Function: <strong>socket-error</strong> <em>[sb-bsd-sockets] where &amp;optional errno</em></dt>
<dd><p>Signal an appropriate error for syscall <code>where</code> and <code>errno</code>.
</p>
<p><code>where</code> should be a string naming the failed function.
</p>
<p>When supplied, <code>errno</code> should be the <code>unix</code> error number associated to the
failed call. The default behavior is to use the current value of the
errno variable.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003anon_002dblocking_002dmode"></a><dl>
<dt><a name="index-non_002dblocking_002dmode"></a>Generic Function: <strong>non-blocking-mode</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Is <code>socket</code> in non-blocking mode?
</p></dd></dl>

<hr>
<a name="Socket-Options"></a>
<div class="header">
<p>
Next: <a href="#INET-Domain-Sockets" accesskey="n" rel="next">INET Domain Sockets</a>, Previous: <a href="#General-Sockets" accesskey="p" rel="prev">General Sockets</a>, Up: <a href="#Networking" accesskey="u" rel="up">Networking</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Socket-Options-1"></a>
<h3 class="section">14.3 Socket Options</h3>

<p>A subset of socket options are supported, using a fairly general
framework which should make it simple to add more as required - see
<samp>SYS:CONTRIB;SB-BSD-SOCKETS:SOCKOPT.LISP</samp> for details. The name
mapping from C is fairly straightforward: <code>SO_RCVLOWAT</code> becomes
<code>sockopt-receive-low-water</code> and <code>(setf
sockopt-receive-low-water)</code>.
</p>
<a name="Function-sb_002dbsd_002dsockets_003asockopt_002dreuse_002daddress"></a><dl>
<dt><a name="index-sockopt_002dreuse_002daddress"></a>Function: <strong>sockopt-reuse-address</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>so-reuseaddr</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. 
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asockopt_002dkeep_002dalive"></a><dl>
<dt><a name="index-sockopt_002dkeep_002dalive"></a>Function: <strong>sockopt-keep-alive</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>so-keepalive</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. 
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asockopt_002doob_002dinline"></a><dl>
<dt><a name="index-sockopt_002doob_002dinline"></a>Function: <strong>sockopt-oob-inline</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>so-oobinline</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. 
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asockopt_002dbsd_002dcompatible"></a><dl>
<dt><a name="index-sockopt_002dbsd_002dcompatible"></a>Function: <strong>sockopt-bsd-compatible</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>so-bsdcompat</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. Available only on Linux.
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asockopt_002dpass_002dcredentials"></a><dl>
<dt><a name="index-sockopt_002dpass_002dcredentials"></a>Function: <strong>sockopt-pass-credentials</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>so-passcred</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. Available only on Linux.
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asockopt_002ddebug"></a><dl>
<dt><a name="index-sockopt_002ddebug"></a>Function: <strong>sockopt-debug</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>so-debug</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. 
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asockopt_002ddont_002droute"></a><dl>
<dt><a name="index-sockopt_002ddont_002droute"></a>Function: <strong>sockopt-dont-route</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>so-dontroute</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. 
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asockopt_002dbroadcast"></a><dl>
<dt><a name="index-sockopt_002dbroadcast"></a>Function: <strong>sockopt-broadcast</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>so-broadcast</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. 
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003asockopt_002dtcp_002dnodelay"></a><dl>
<dt><a name="index-sockopt_002dtcp_002dnodelay"></a>Function: <strong>sockopt-tcp-nodelay</strong> <em>[sb-bsd-sockets] socket</em></dt>
<dd><p>Return the value of the <code>tcp-nodelay</code> socket option for <code>socket</code>. This can also be
updated with <code>setf</code>. 
</p></dd></dl>

<hr>
<a name="INET-Domain-Sockets"></a>
<div class="header">
<p>
Next: <a href="#Local-_0028Unix_0029-Domain-Sockets" accesskey="n" rel="next">Local (Unix) Domain Sockets</a>, Previous: <a href="#Socket-Options" accesskey="p" rel="prev">Socket Options</a>, Up: <a href="#Networking" accesskey="u" rel="up">Networking</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="INET-Domain-Sockets-1"></a>
<h3 class="section">14.4 INET Domain Sockets</h3>

<p>The TCP and UDP sockets that you know and love. Some representation
issues:
</p>
<ul>
<li> IPv4 Internet addresses are represented by vectors of
<code>(unsigned-byte 8)</code> - viz. <code>#(127 0 0 1)</code>. Ports are just
integers: 6010. No conversion between network- and host-order data is
needed from the user of this package.

</li><li> IPv6 Internet addresses are represented by vectors of 16
<code>(unsigned-byte 8)</code> - viz. <code>#(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1)</code>. Ports are just integers. As for IPv4 addresses, no conversion
between network- and host-order data is needed from the user of this
package.

</li><li> Socket addresses are represented by the two values for address and port,
so for example, <code>(socket-connect socket #(192 168 1 1) 80)</code> for
IPv4 and <code>(socket-connect socket #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1)
80)</code> for IPv6.

</li></ul>

<a name="Class-sb_002dbsd_002dsockets_003ainet_002dsocket"></a><dl>
<dt><a name="index-inet_002dsocket"></a>Class: <strong>inet-socket</strong> <em>[sb-bsd-sockets]</em></dt>
<dd><p>Class precedence list: <code>inet-socket, socket, standard-object, t</code>
</p>
<p>Class representing <code>tcp</code> and <code>udp</code> over IPv4 sockets.
</p>
<p>Examples:
</p>
<div class="lisp">
<pre class="lisp"> (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp)

 (make-instance 'sb-bsd-sockets:inet-socket :type :datagram :protocol :udp)
</pre></div>
</dd></dl>

<a name="Class-sb_002dbsd_002dsockets_003ainet6_002dsocket"></a><dl>
<dt><a name="index-inet6_002dsocket"></a>Class: <strong>inet6-socket</strong> <em>[sb-bsd-sockets]</em></dt>
<dd><p>Class precedence list: <code>inet6-socket, socket, standard-object, t</code>
</p>
<p>Class representing <code>tcp</code> and <code>udp</code> over IPv6 sockets.
</p>
<p>Examples:
</p>
<div class="lisp">
<pre class="lisp"> (make-instance 'sb-bsd-sockets:inet6-socket :type :stream :protocol :tcp)

 (make-instance 'sb-bsd-sockets:inet6-socket :type :datagram :protocol :udp)
</pre></div>
</dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003amake_002dinet_002daddress"></a><dl>
<dt><a name="index-make_002dinet_002daddress"></a>Function: <strong>make-inet-address</strong> <em>[sb-bsd-sockets] dotted-quads</em></dt>
<dd><p>Return a vector of octets given a string <code>dotted-quads</code> in the format
&quot;127.0.0.1&quot;. Signals an error if the string is malformed.
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003amake_002dinet6_002daddress"></a><dl>
<dt><a name="index-make_002dinet6_002daddress"></a>Function: <strong>make-inet6-address</strong> <em>[sb-bsd-sockets] colon-separated-integers</em></dt>
<dd><p>Return a vector of octets given a string representation of an IPv6
address <code>colon-separated-integers</code>. Signal an error if the string is
malformed.
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003aget_002dprotocol_002dby_002dname"></a><dl>
<dt><a name="index-get_002dprotocol_002dby_002dname"></a>Function: <strong>get-protocol-by-name</strong> <em>[sb-bsd-sockets] name</em></dt>
<dd><p>Given a protocol name, return the protocol number, the protocol name, and
a list of protocol aliases
</p></dd></dl>

<hr>
<a name="Local-_0028Unix_0029-Domain-Sockets"></a>
<div class="header">
<p>
Next: <a href="#Name-Service" accesskey="n" rel="next">Name Service</a>, Previous: <a href="#INET-Domain-Sockets" accesskey="p" rel="prev">INET Domain Sockets</a>, Up: <a href="#Networking" accesskey="u" rel="up">Networking</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Local-_0028Unix_0029-Domain-Sockets-1"></a>
<h3 class="section">14.5 Local (Unix) Domain Sockets</h3>

<p>Local domain (<code>AF_LOCAL</code>) sockets are also known as Unix-domain
sockets, but were renamed by POSIX presumably on the basis that they
may be available on other systems too.
</p>
<p>A local socket address is a string, which is used to create a node in
the local filesystem. This means of course that they cannot be used
across a network.
</p>
<a name="Class-sb_002dbsd_002dsockets_003alocal_002dsocket"></a><dl>
<dt><a name="index-local_002dsocket"></a>Class: <strong>local-socket</strong> <em>[sb-bsd-sockets]</em></dt>
<dd><p>Class precedence list: <code>local-socket, socket, standard-object, t</code>
</p>
<p>Class representing local domain (AF_LOCAL) sockets,
also known as unix-domain sockets.
</p></dd></dl>

<p>A local abstract socket address is also a string the scope of which is
the local machine. However, in contrast to a local socket address, there
is no corresponding filesystem node.
</p>
<a name="Class-sb_002dbsd_002dsockets_003alocal_002dabstract_002dsocket"></a><dl>
<dt><a name="index-local_002dabstract_002dsocket"></a>Class: <strong>local-abstract-socket</strong> <em>[sb-bsd-sockets]</em></dt>
<dd><p>Class precedence list: <code>local-abstract-socket, local-socket, socket, standard-object, t</code>
</p>
<p>Class representing local domain (AF_LOCAL) sockets with addresses
in the abstract namespace.
</p></dd></dl>

<hr>
<a name="Name-Service"></a>
<div class="header">
<p>
Previous: <a href="#Local-_0028Unix_0029-Domain-Sockets" accesskey="p" rel="prev">Local (Unix) Domain Sockets</a>, Up: <a href="#Networking" accesskey="u" rel="up">Networking</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Name-Service-1"></a>
<h3 class="section">14.6 Name Service</h3>

<p>Presently name service is implemented by calling out to the
<code>getaddrinfo(3)</code> and <code>gethostinfo(3)</code>, or to
<code>gethostbyname(3)</code> <code>gethostbyaddr(3)</code> on platforms where
the preferred functions are not available. The exact details of
the name resolving process (for example the choice of whether
DNS or a hosts file is used for lookup) are platform dependent.
</p>

<a name="Class-sb_002dbsd_002dsockets_003ahost_002dent"></a><dl>
<dt><a name="index-host_002dent"></a>Class: <strong>host-ent</strong> <em>[sb-bsd-sockets]</em></dt>
<dd><p>Class precedence list: <code>host-ent, standard-object, t</code>
</p>
<p>Slots:
</p><ul>
<li> <code>name</code> &mdash; initarg: <code>:name<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-bsd-sockets:host-ent-name</span><!-- /@w --></code>

<p>The name of the host
</p></li><li> <code>addresses</code> &mdash; initarg: <code>:addresses<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-bsd-sockets:host-ent-addresses</span><!-- /@w --></code>

<p>A list of addresses for this host.
</p></li></ul>

<p>This class represents the results of an address lookup.
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003aget_002dhost_002dby_002dname"></a><dl>
<dt><a name="index-get_002dhost_002dby_002dname"></a>Function: <strong>get-host-by-name</strong> <em>[sb-bsd-sockets] node</em></dt>
<dd><p>Returns a <code>host-ent</code> instance for <code>node</code> or signals a <code>name-service-error</code>.
</p>
<p>Another <code>host-ent</code> instance containing zero, one or more IPv6 addresses
may be returned as a second return value.
</p>
<p><code>node</code> may also be an <code>ip</code> address in dotted quad notation or some other
weird stuff <code>-</code> see getaddrinfo(3) for the details.
</p></dd></dl>

<a name="Function-sb_002dbsd_002dsockets_003aget_002dhost_002dby_002daddress"></a><dl>
<dt><a name="index-get_002dhost_002dby_002daddress"></a>Function: <strong>get-host-by-address</strong> <em>[sb-bsd-sockets] address</em></dt>
<dd><p>Returns a <code>host-ent</code> instance for <code>address</code>, which should be a vector of
(integer 0 255) with 4 elements in case of an IPv4 address and 16
elements in case of an IPv6 address, or signals a <code>name-service-error</code>.
See gethostbyaddr(3) for details.
</p></dd></dl>

<a name="Generic_002dFunction-sb_002dbsd_002dsockets_003ahost_002dent_002daddress"></a><dl>
<dt><a name="index-host_002dent_002daddress"></a>Generic Function: <strong>host-ent-address</strong> <em>[sb-bsd-sockets] host-ent</em></dt>
<dd><p>Return some valid address for <code>host-ent</code>.
</p></dd></dl>
<hr>
<a name="Profiling"></a>
<div class="header">
<p>
Next: <a href="#Contributed-Modules" accesskey="n" rel="next">Contributed Modules</a>, Previous: <a href="#Networking" accesskey="p" rel="prev">Networking</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Profiling-1"></a>
<h2 class="chapter">15 Profiling</h2>
<a name="index-Profiling"></a>

<p>SBCL includes both a deterministic profiler, that can collect statistics
on individual functions, and a more &ldquo;modern&rdquo; statistical profiler.
</p>
<p>Inlined functions do not appear in the results reported by either.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Deterministic-Profiler" accesskey="1">Deterministic Profiler</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Statistical-Profiler" accesskey="2">Statistical Profiler</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Deterministic-Profiler"></a>
<div class="header">
<p>
Next: <a href="#Statistical-Profiler" accesskey="n" rel="next">Statistical Profiler</a>, Up: <a href="#Profiling" accesskey="u" rel="up">Profiling</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Deterministic-Profiler-1"></a>
<h3 class="section">15.1 Deterministic Profiler</h3>
<a name="index-Profiling_002c-deterministic"></a>

<p>The package <code>sb-profile</code> provides a classic, per-function-call
profiler.
</p>
<blockquote>
<p><b>note:</b> When profiling code executed by multiple threads in parallel, the
consing attributed to each function is inaccurate.
</p></blockquote>

<a name="Macro-sb_002dprofile_003aprofile"></a><dl>
<dt><a name="index-profile"></a>Macro: <strong>profile</strong> <em>[sb-profile] &amp;rest names</em></dt>
<dd><p><code>profile</code> Name*
</p>
<p>If no names are supplied, return the list of profiled functions.
</p>
<p>If names are supplied, wrap profiling code around the named functions.
   As in <code>trace</code>, the names are not evaluated. A symbol names a function.
   A string names all the functions named by symbols in the named
   package. If a function is already profiled, then unprofile and
   reprofile (useful to notice function redefinition.)  If a name is
   undefined, then we give a warning and ignore it. See also
   <code>unprofile</code>, <code>report</code> and <code>reset</code>.
</p></dd></dl>
<a name="Macro-sb_002dprofile_003aunprofile"></a><dl>
<dt><a name="index-unprofile"></a>Macro: <strong>unprofile</strong> <em>[sb-profile] &amp;rest names</em></dt>
<dd><p>Unwrap any profiling code around the named functions, or if no names
  are given, unprofile all profiled functions. A symbol names
  a function. A string names all the functions named by symbols in the
  named package. <code>names</code> defaults to the list of names of all currently
  profiled functions.
</p></dd></dl>
<a name="Function-sb_002dprofile_003areport"></a><dl>
<dt><a name="index-report"></a>Function: <strong>report</strong> <em>[sb-profile] &amp;key limit print-no-call-list</em></dt>
<dd><p>Report results from profiling. The results are approximately
adjusted for profiling overhead. The compensation may be rather
inaccurate when bignums are involved in runtime calculation, as in a
very-long-running Lisp process.
</p>
<p>If <code>limit</code> is set to an integer, only the top <code>limit</code> results are
reported. If <code>print-no-call-list</code> is <code>t</code> (the default) then a list of
uncalled profiled functions are listed.
</p></dd></dl>
<a name="Function-sb_002dprofile_003areset"></a><dl>
<dt><a name="index-reset"></a>Function: <strong>reset</strong> <em>[sb-profile]</em></dt>
<dd><p>Reset the counters for all profiled functions.
</p></dd></dl>

<hr>
<a name="Statistical-Profiler"></a>
<div class="header">
<p>
Previous: <a href="#Deterministic-Profiler" accesskey="p" rel="prev">Deterministic Profiler</a>, Up: <a href="#Profiling" accesskey="u" rel="up">Profiling</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Statistical-Profiler-1"></a>
<h3 class="section">15.2 Statistical Profiler</h3>
<a name="index-Profiling_002c-statistical"></a>

<p>The <code>sb-sprof</code> module, loadable by
</p><div class="lisp">
<pre class="lisp">(require :sb-sprof)
</pre></div>
<p>provides an alternate profiler which works by taking samples of the
program execution at regular intervals, instead of instrumenting
functions like <code>sb-profile:profile</code> does. You might find
<code>sb-sprof</code> more useful than the deterministic profiler when profiling
functions in the <code>common-lisp</code>-package, SBCL internals, or code
where the instrumenting overhead is excessive.
</p>
<p>Additionally <code>sb-sprof</code> includes a limited deterministic profiler
which can be used for reporting the amounts of calls to some functions
during
</p>
<a name="Example-Usage"></a>
<h4 class="subsection">15.2.1 Example Usage</h4>

<div class="lisp">
<pre class="lisp">(in-package :cl-user)

(require :sb-sprof)

(declaim (optimize speed))

(defun cpu-test-inner (a i)
  (logxor a
          (* i 5)
          (+ a i)))

(defun cpu-test (n)
  (let ((a 0))
    (dotimes (i (expt 2 n) a)
      (setf a (cpu-test-inner a i)))))

;;;; CPU profiling

;;; Take up to 1000 samples of running (CPU-TEST 26), and give a flat
;;; table report at the end. Profiling will end one the body has been
;;; evaluated once, whether or not 1000 samples have been taken.
(sb-sprof:with-profiling (:max-samples 1000
                          :report :flat
                          :loop nil)
  (cpu-test 26))

;;; Record call counts for functions defined on symbols in the CL-USER
;;; package.
(sb-sprof:profile-call-counts &quot;CL-USER&quot;)

;;; Take 1000 samples of running (CPU-TEST 24), and give a flat
;;; table report at the end. The body will be re-evaluated in a loop
;;; until 1000 samples have been taken. A sample count will be printed
;;; after each iteration.
(sb-sprof:with-profiling (:max-samples 1000
                          :report :flat
                          :loop t
                          :show-progress t)
  (cpu-test 24))

;;;; Allocation profiling

(defun foo (&amp;rest args)
  (mapcar (lambda (x) (float x 1d0)) args))

(defun bar (n)
  (declare (fixnum n))
  (apply #'foo (loop repeat n collect n)))

(sb-sprof:with-profiling (:max-samples 10000
                          :mode :alloc
                          :report :flat)
  (bar 1000))
</pre></div>

<a name="Output"></a>
<h4 class="subsection">15.2.2 Output</h4>

<p>The flat report format will show a table of all functions that the
profiler encountered on the call stack during sampling, ordered by the
number of samples taken while executing that function.
</p>
<div class="lisp">
<pre class="lisp">           Self        Total        Cumul
  Nr  Count     %  Count     %  Count     %    Calls  Function
------------------------------------------------------------------------
   1     69  24.4     97  34.3     69  24.4 67108864  CPU-TEST-INNER
   2     64  22.6     64  22.6    133  47.0        -  SB-VM::GENERIC-+
   3     39  13.8    256  90.5    172  60.8        1  CPU-TEST
   4     31  11.0     31  11.0    203  71.7        -  SB-KERNEL:TWO-ARG-XOR
</pre></div>

<p>For each function, the table will show three absolute and relative
sample counts. The Self column shows samples taken while directly
executing that function. The Total column shows samples taken while
executing that function or functions called from it (sampled to a
platform-specific depth). The Cumul column shows the sum of all
Self columns up to and including that line in the table.
</p>
<p>Additionally the Calls column will record the amount of calls that were
made to the function during the profiling run. This value will only
be reported for functions that have been explicitly marked for call counting
with <code>profile-call-counts</code>.
</p>
<p>The profiler also hooks into the disassembler such that instructions which
have been sampled are annotated with their relative frequency of
sampling.  This information is not stored across different sampling
runs.
</p>
<div class="lisp">
<pre class="lisp">;      6CF:       702E             JO L4              ; 6/242 samples
;      6D1:       D1E3             SHL EBX, 1
;      6D3:       702A             JO L4
;      6D5: L2:   F6C303           TEST BL, 3         ; 2/242 samples
;      6D8:       756D             JNE L8
;      6DA:       8BC3             MOV EAX, EBX       ; 5/242 samples
;      6DC: L3:   83F900           CMP ECX, 0         ; 4/242 samples
</pre></div>

<a name="Platform-support"></a>
<h4 class="subsection">15.2.3 Platform support</h4>

<p>This module is known not to work consistently on the Alpha platform,
for technical reasons related to the implementation of a machine
language idiom for marking sections of code to be treated as atomic by
the garbage collector;  However, it should work on other platforms,
and the deficiency on the Alpha will eventually be rectified.
</p>
<p>Allocation profiling is only supported on SBCL builds that use
the generational garbage collector. Tracking of call stacks at a
depth of more than two levels is only supported on x86 and x86-64.
</p>
<a name="Macros"></a>
<h4 class="subsection">15.2.4 Macros</h4>

<a name="Macro-sb_002dsprof_003awith_002dprofiling"></a><dl>
<dt><a name="index-with_002dprofiling"></a>Macro: <strong>with-profiling</strong> <em>[sb-sprof] (&amp;key sample-interval alloc-interval max-samples reset mode loop max-depth show-progress threads report) &amp;body body</em></dt>
<dd><p>Evaluate <code>body</code> with statistical profiling turned on. If <code>loop</code> is true,
loop around the <code>body</code> until a sufficient number of samples has been collected.
Returns the values from the last evaluation of <code>body</code>.
</p>
<p>In multithreaded operation, only the thread in which <code>with-profiling</code> was
evaluated will be profiled by default. If you want to profile multiple
threads, invoke the profiler with <code>start-profiling</code>.
</p>
<p>The following keyword args are recognized:
</p>

<dl compact="compact">
<dt><em><code>:sample-interval</code> &lt;n&gt;</em></dt>
<dd><p>Take a sample every &lt;n&gt; seconds. Default is <code>*sample-interval*</code>.
</p>

</dd>
<dt><em><code>:alloc-interval</code> &lt;n&gt;</em></dt>
<dd><p>Take a sample every time &lt;n&gt; allocation regions (approximately
   8kB) have been allocated since the last sample. Default is
   <code>*alloc-interval*</code>.
</p>

</dd>
<dt><em><code>:mode</code> &lt;mode&gt;</em></dt>
<dd><p>If <code>:cpu</code>, run the profiler in <code>cpu</code> profiling mode. If <code>:alloc</code>, run the
   profiler in allocation profiling mode. If <code>:time</code>, run the profiler
   in wallclock profiling mode.
</p>

</dd>
<dt><em><code>:max-samples</code> &lt;max&gt;</em></dt>
<dd><p>Repeat evaluating body until &lt;max&gt; samples are taken.
   Default is <code>*max-samples*</code>.
</p>

</dd>
<dt><em><code>:max-depth</code> &lt;max&gt;</em></dt>
<dd><p>Maximum call stack depth that the profiler should consider. Only
   has an effect on x86 and x86-64.
</p>

</dd>
<dt><em><code>:report</code> &lt;type&gt;</em></dt>
<dd><p>If specified, call <code>report</code> with <code>:type</code> &lt;type&gt; at the end.
</p>

</dd>
<dt><em><code>:reset</code> &lt;bool&gt;</em></dt>
<dd><p>It true, call <code>reset</code> at the beginning.
</p>

</dd>
<dt><em><code>:threads</code> &lt;list-form&gt;</em></dt>
<dd><p>Form that evaluates to the list threads to profile, or <code>:all</code> to indicate
   that all threads should be profiled. Defaults to the current
   thread. (Note: <code>start-profiling</code> defaults to all threads.)
</p>
<p><code>:threads</code> has no effect on call-counting at the moment.
</p>
<p>On some platforms (eg. Darwin) the signals used by the profiler are
   not properly delivered to threads in proportion to their <code>cpu</code> usage
   when doing <code>:cpu</code> profiling. If you see empty call graphs, or are obviously
   missing several samples from certain threads, you may be falling afoul
   of this. In this case using <code>:mode</code> <code>:time</code> is likely to work better.
</p>

</dd>
<dt><em><code>:loop</code> &lt;bool&gt;</em></dt>
<dd><p>If false (the default), evaluate <code>body</code> only once. If true repeatedly
   evaluate <code>body</code>.
</p></dd>
</dl>

</dd></dl>
<a name="Macro-sb_002dsprof_003awith_002dsampling"></a><dl>
<dt><a name="index-with_002dsampling"></a>Macro: <strong>with-sampling</strong> <em>[sb-sprof] (&amp;optional on) &amp;body body</em></dt>
<dd><p>Evaluate body with statistical sampling turned on or off.
</p></dd></dl>

<a name="Functions"></a>
<h4 class="subsection">15.2.5 Functions</h4>

<a name="Function-sb_002dsprof_003areport"></a><dl>
<dt><a name="index-report-1"></a>Function: <strong>report</strong> <em>[sb-sprof] &amp;key type max min-percent call-graph sort-by sort-order stream show-progress</em></dt>
<dd><p>Report statistical profiling results.  The following keyword
   args are recognized:
</p>

<dl compact="compact">
<dt><em><code>:type</code> &lt;type&gt;</em></dt>
<dd><p>Specifies the type of report to generate.  If <code>:flat</code>, show
      flat report, if <code>:graph</code> show a call graph and a flat report.
      If nil, don&rsquo;t print out a report.
</p>

</dd>
<dt><em><code>:stream</code> &lt;stream&gt;</em></dt>
<dd><p>Specify a stream to print the report on.  Default is
      <code>*standard-output*</code>.
</p>

</dd>
<dt><em><code>:max</code> &lt;max&gt;</em></dt>
<dd><p>Don&rsquo;t show more than &lt;max&gt; entries in the flat report.
</p>

</dd>
<dt><em><code>:min-percent</code> &lt;min-percent&gt;</em></dt>
<dd><p>Don&rsquo;t show functions taking less than &lt;min-percent&gt; of the
      total time in the flat report.
</p>

</dd>
<dt><em><code>:sort-by</code> &lt;column&gt;</em></dt>
<dd><p>If <code>:samples</code>, sort flat report by number of samples taken.
      If <code>:cumulative-samples</code>, sort flat report by cumulative number of samples
      taken (shows how much time each function spent on stack.) Default
      is <code>*report-sort-by*</code>.
</p>

</dd>
<dt><em><code>:sort-order</code> &lt;order&gt;</em></dt>
<dd><p>If <code>:descending</code>, sort flat report in descending order. If <code>:ascending</code>,
      sort flat report in ascending order. Default is <code>*report-sort-order*</code>.
</p>

</dd>
<dt><em><code>:show-progress</code> &lt;bool&gt;</em></dt>
<dd><p>If true, print progress messages while generating the call graph.
</p>

</dd>
<dt><em><code>:call-graph</code> &lt;graph&gt;</em></dt>
<dd><p>Print a report from &lt;graph&gt; instead of the latest profiling
     results.
</p>
</dd>
</dl>

<p>Value of this function is a <code>call-graph</code> object representing the
resulting call-graph, or <code>nil</code> if there are no samples (eg. right after
calling <code>reset</code>.)
</p>
<p>Profiling is stopped before the call graph is generated.
</p></dd></dl>

<a name="Function-sb_002dsprof_003areset"></a><dl>
<dt><a name="index-reset-1"></a>Function: <strong>reset</strong> <em>[sb-sprof]</em></dt>
<dd><p>Reset the profiler.
</p></dd></dl>

<a name="Function-sb_002dsprof_003astart_002dprofiling"></a><dl>
<dt><a name="index-start_002dprofiling"></a>Function: <strong>start-profiling</strong> <em>[sb-sprof] &amp;key max-samples mode sample-interval alloc-interval max-depth threads sampling</em></dt>
<dd><p>Start profiling statistically in the current thread if not already profiling.
The following keyword args are recognized:
</p>

<dl compact="compact">
<dt><em><code>:sample-interval</code> &lt;n&gt;</em></dt>
<dd><p>Take a sample every &lt;n&gt; seconds.  Default is <code>*sample-interval*</code>.
</p>

</dd>
<dt><em><code>:alloc-interval</code> &lt;n&gt;</em></dt>
<dd><p>Take a sample every time &lt;n&gt; allocation regions (approximately
     8kB) have been allocated since the last sample. Default is
     <code>*alloc-interval*</code>.
</p>

</dd>
<dt><em><code>:mode</code> &lt;mode&gt;</em></dt>
<dd><p>If <code>:cpu</code>, run the profiler in <code>cpu</code> profiling mode. If <code>:alloc</code>, run
     the profiler in allocation profiling mode. If <code>:time</code>, run the profiler
     in wallclock profiling mode.
</p>

</dd>
<dt><em><code>:max-samples</code> &lt;max&gt;</em></dt>
<dd><p>Maximum number of samples.  Default is <code>*max-samples*</code>.
</p>

</dd>
<dt><em><code>:max-depth</code> &lt;max&gt;</em></dt>
<dd><p>Maximum call stack depth that the profiler should consider. Only
     has an effect on x86 and x86-64.
</p>

</dd>
<dt><em><code>:threads</code> &lt;list&gt;</em></dt>
<dd><p>List threads to profile, or <code>:all</code> to indicate that all threads should be
     profiled. Defaults to <code>:all</code>. (Note: <code>with-profiling</code> defaults to the current
     thread.)
</p>
<p><code>:threads</code> has no effect on call-counting at the moment.
</p>
<p>On some platforms (eg. Darwin) the signals used by the profiler are
     not properly delivered to threads in proportion to their <code>cpu</code> usage
     when doing <code>:cpu</code> profiling. If you see empty call graphs, or are obviously
     missing several samples from certain threads, you may be falling afoul
     of this.
</p>

</dd>
<dt><em><code>:sampling</code> &lt;bool&gt;</em></dt>
<dd><p>If true, the default, start sampling right away.
     If false, <code>start-sampling</code> can be used to turn sampling on.
</p></dd>
</dl>

</dd></dl>

<a name="Function-sb_002dsprof_003astop_002dprofiling"></a><dl>
<dt><a name="index-stop_002dprofiling"></a>Function: <strong>stop-profiling</strong> <em>[sb-sprof]</em></dt>
<dd><p>Stop profiling if profiling.
</p></dd></dl>

<a name="Function-sb_002dsprof_003aprofile_002dcall_002dcounts"></a><dl>
<dt><a name="index-profile_002dcall_002dcounts"></a>Function: <strong>profile-call-counts</strong> <em>[sb-sprof] &amp;rest names</em></dt>
<dd><p>Mark the functions named by <code>names</code> as being subject to call counting
during statistical profiling. If a string is used as a name, it will
be interpreted as a package name. In this case call counting will be
done for all functions with names like <code>x</code> or <code>(setf x)</code>, where <code>x</code> is a symbol
with the package as its home package.
</p></dd></dl>

<a name="Function-sb_002dsprof_003aunprofile_002dcall_002dcounts"></a><dl>
<dt><a name="index-unprofile_002dcall_002dcounts"></a>Function: <strong>unprofile-call-counts</strong> <em>[sb-sprof]</em></dt>
<dd><p>Clear all call counting information. Call counting will be done for no
functions during statistical profiling.
</p></dd></dl>

<a name="Variables"></a>
<h4 class="subsection">15.2.6 Variables</h4>

<a name="Variable-sb_002dsprof_003a_002amax_002dsamples_002a"></a><dl>
<dt><a name="index-_002amax_002dsamples_002a"></a>Variable: <strong>*max-samples*</strong> <em>[sb-sprof]</em></dt>
<dd><p>Default number of traces taken. This variable is somewhat misnamed:
each trace may actually consist of an arbitrary number of samples, depending
on the depth of the call stack.
</p></dd></dl>

<a name="Variable-sb_002dsprof_003a_002asample_002dinterval_002a"></a><dl>
<dt><a name="index-_002asample_002dinterval_002a"></a>Variable: <strong>*sample-interval*</strong> <em>[sb-sprof]</em></dt>
<dd><p>Default number of seconds between samples.
</p></dd></dl>

<a name="Credits"></a>
<h4 class="subsection">15.2.7 Credits</h4>

<p><code>sb-sprof</code> is an SBCL port, with enhancements, of Gerd
Moellmann&rsquo;s statistical profiler for CMUCL.
</p><hr>
<a name="Contributed-Modules"></a>
<div class="header">
<p>
Next: <a href="#Deprecation" accesskey="n" rel="next">Deprecation</a>, Previous: <a href="#Profiling" accesskey="p" rel="prev">Profiling</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Contributed-Modules-1"></a>
<h2 class="chapter">16 Contributed Modules</h2>

<p>SBCL comes with a number of modules that are not part of the core
system.  These are loaded via <code>(require :<var>modulename</var>)</code>
(see <a href="#Customization-Hooks-for-Users">Customization Hooks for Users</a>).  This section contains
documentation (or pointers to documentation) for some of the
contributed modules.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#sb_002daclrepl" accesskey="1">sb-aclrepl</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#sb_002dconcurrency" accesskey="2">sb-concurrency</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#sb_002dcover" accesskey="3">sb-cover</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#sb_002dgrovel" accesskey="4">sb-grovel</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#sb_002dmd5" accesskey="5">sb-md5</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#sb_002dposix" accesskey="6">sb-posix</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#sb_002dqueue" accesskey="7">sb-queue</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#sb_002drotate_002dbyte" accesskey="8">sb-rotate-byte</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="sb_002daclrepl"></a>
<div class="header">
<p>
Next: <a href="#sb_002dconcurrency" accesskey="n" rel="next">sb-concurrency</a>, Up: <a href="#Contributed-Modules" accesskey="u" rel="up">Contributed Modules</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sb_002daclrepl-1"></a>
<h3 class="section">16.1 sb-aclrepl</h3>
<a name="index-Read_002dEval_002dPrint-Loop"></a>
<a name="index-REPL"></a>

<p>The <code>sb-aclrepl</code> module offers an Allegro CL-style
Read-Eval-Print Loop for SBCL, with integrated inspector.  Adding a
debugger interface is planned.
</p>
<a name="Usage"></a>
<h4 class="subsection">16.1.1 Usage</h4>

<p>To start <code>sb-aclrepl</code> as your read-eval-print loop, put the form
</p><div class="lisp">
<pre class="lisp">(require 'sb-aclrepl)
</pre></div>

<p>in your <samp>~/.sbclrc</samp> initialization file.
</p>
<a name="Customization"></a>
<h4 class="subsection">16.1.2 Customization</h4>

<p>The following customization variables are available:
</p>
<a name="Variable-sb_002daclrepl_003a_002acommand_002dchar_002a"></a><dl>
<dt><a name="index-_002acommand_002dchar_002a"></a>Variable: <strong>*command-char*</strong> <em>[sb-aclrepl]</em></dt>
<dd><p>Prefix character for a top-level command
</p></dd></dl>
<a name="Variable-sb_002daclrepl_003a_002aprompt_002a"></a><dl>
<dt><a name="index-_002aprompt_002a"></a>Variable: <strong>*prompt*</strong> <em>[sb-aclrepl]</em></dt>
<dd><p>The current prompt string or formatter function.
</p></dd></dl>
<a name="Variable-sb_002daclrepl_003a_002aexit_002don_002deof_002a"></a><dl>
<dt><a name="index-_002aexit_002don_002deof_002a"></a>Variable: <strong>*exit-on-eof*</strong> <em>[sb-aclrepl]</em></dt>
<dd><p>If <code>t</code>, then exit when the <code>eof</code> character is entered.
</p></dd></dl>
<a name="Variable-sb_002daclrepl_003a_002ause_002dshort_002dpackage_002dname_002a"></a><dl>
<dt><a name="index-_002ause_002dshort_002dpackage_002dname_002a"></a>Variable: <strong>*use-short-package-name*</strong> <em>[sb-aclrepl]</em></dt>
<dd><p>when <code>t</code>, use the shortnest package nickname in a prompt
</p></dd></dl>
<a name="Variable-sb_002daclrepl_003a_002amax_002dhistory_002a"></a><dl>
<dt><a name="index-_002amax_002dhistory_002a"></a>Variable: <strong>*max-history*</strong> <em>[sb-aclrepl]</em></dt>
<dd><p>Maximum number of history commands to remember
</p></dd></dl>

<a name="Example-Initialization"></a>
<h4 class="subsection">16.1.3 Example Initialization</h4>

<p>Here&rsquo;s a longer example of a <samp>~/.sbclrc</samp> file that shows off
some of the features of <code>sb-aclrepl</code>:
</p>
<div class="lisp">
<pre class="lisp">(ignore-errors (require 'sb-aclrepl))

(when (find-package 'sb-aclrepl)
  (push :aclrepl cl:*features*))
#+aclrepl
(progn
  (setq sb-aclrepl:*max-history* 100)
  (setf (sb-aclrepl:alias &quot;asdc&quot;)
       #'(lambda (sys) (asdf:operate 'asdf:compile-op sys)))
  (sb-aclrepl:alias &quot;l&quot; (sys) (asdf:operate 'asdf:load-op sys))
  (sb-aclrepl:alias &quot;t&quot; (sys) (asdf:operate 'asdf:test-op sys))
  ;; The 1 below means that two characaters (&quot;up&quot;) are required
  (sb-aclrepl:alias (&quot;up&quot; 1 &quot;Use package&quot;) (package) (use-package package))
  ;; The 0 below means only the first letter (&quot;r&quot;) is required,
  ;; such as &quot;:r base64&quot;
  (sb-aclrepl:alias (&quot;require&quot; 0 &quot;Require module&quot;) (sys) (require sys))
  (setq cl:*features* (delete :aclrepl cl:*features*)))
</pre></div>

<p>Questions, comments, or bug reports should be sent to Kevin Rosenberg
(<a href="mailto:kevin@rosenberg.net">kevin@rosenberg.net</a>).
</p>
<a name="Credits-1"></a>
<h4 class="subsection">16.1.4 Credits</h4>

<p>Allegro CL is a registered trademark of Franz Inc.
</p>
<hr>
<a name="sb_002dconcurrency"></a>
<div class="header">
<p>
Next: <a href="#sb_002dcover" accesskey="n" rel="next">sb-cover</a>, Previous: <a href="#sb_002daclrepl" accesskey="p" rel="prev">sb-aclrepl</a>, Up: <a href="#Contributed-Modules" accesskey="u" rel="up">Contributed Modules</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sb_002dconcurrency-1"></a>
<h3 class="section">16.2 sb-concurrency</h3>
<a name="index-Concurrency"></a>
<a name="index-Sb_002dconcurrency"></a>

<p>Additional data structures, synchronization primitives and tools for
concurrent programming. Similiar to Java&rsquo;s <code>java.util.concurrent</code>
package.
</p>
<a name="Section-sb_002dconcurrency_003aqueue"></a><a name="Queue"></a>
<h4 class="subsection">16.2.1 Queue</h4>
<a name="index-Queue_002c-lock_002dfree"></a>

<p><code>sb-concurrency:queue</code> is a lock-free, thread-safe FIFO queue
datatype.
<br><br>
The implementation is based on <cite>An Optimistic Approach to
Lock-Free FIFO Queues</cite> by Edya Ladan-Mozes and Nir Shavit.
<br><br>
Before SBCL 1.0.38, this implementation resided in its own contrib
(see <a href="#sb_002dqueue">sb-queue</a>) which is still provided for backwards-compatibility
but which has since been deprecated.
</p>
<a name="Structure-sb_002dconcurrency_003aqueue"></a><dl>
<dt><a name="index-queue"></a>Structure: <strong>queue</strong> <em>[sb-concurrency]</em></dt>
<dd><p>Class precedence list: <code>queue, structure-object, t</code>
</p>
<p>Lock-free thread safe <code>fifo</code> queue.
</p>
<p>Use <code>enqueue</code> to add objects to the queue, and <code>dequeue</code> to remove them.
</p></dd></dl>

<a name="Function-sb_002dconcurrency_003adequeue"></a><dl>
<dt><a name="index-dequeue"></a>Function: <strong>dequeue</strong> <em>[sb-concurrency] queue</em></dt>
<dd><p>Retrieves the oldest value in <code>queue</code> and returns it as the primary value,
and <code>t</code> as secondary value. If the queue is empty, returns <code>nil</code> as both primary
and secondary value.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003aenqueue"></a><dl>
<dt><a name="index-enqueue"></a>Function: <strong>enqueue</strong> <em>[sb-concurrency] value queue</em></dt>
<dd><p>Adds <code>value</code> to the end of <code>queue</code>. Returns <code>value</code>.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003alist_002dqueue_002dcontents"></a><dl>
<dt><a name="index-list_002dqueue_002dcontents"></a>Function: <strong>list-queue-contents</strong> <em>[sb-concurrency] queue</em></dt>
<dd><p>Returns the contents of <code>queue</code> as a list without removing them from the
<code>queue</code>. Mainly useful for manual examination of queue state, as the list may be
out of date by the time it is returned, and concurrent dequeue operations may
in the worse case force the queue-traversal to be restarted several times.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003amake_002dqueue"></a><dl>
<dt><a name="index-make_002dqueue"></a>Function: <strong>make-queue</strong> <em>[sb-concurrency] &amp;key name initial-contents</em></dt>
<dd><p>Returns a new <code>queue</code> with <code>name</code> and contents of the <code>initial-contents</code>
sequence enqueued.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003aqueue_002dcount"></a><dl>
<dt><a name="index-queue_002dcount"></a>Function: <strong>queue-count</strong> <em>[sb-concurrency] queue</em></dt>
<dd><p>Returns the number of objects in <code>queue</code>. Mainly useful for manual
examination of queue state, and in <code>print-object</code> methods: inefficient as it
must walk the entire queue.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003aqueue_002dempty_002dp"></a><dl>
<dt><a name="index-queue_002dempty_002dp"></a>Function: <strong>queue-empty-p</strong> <em>[sb-concurrency] queue</em></dt>
<dd><p>Returns <code>t</code> if <code>queue</code> is empty, <code>nil</code> otherwise.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003aqueue_002dname"></a><dl>
<dt><a name="index-queue_002dname"></a>Function: <strong>queue-name</strong> <em>[sb-concurrency] instance</em></dt>
<dd><p>Name of a <code>queue</code>. Can be assigned to using <code>setf</code>. Queue names
can be arbitrary printable objects, and need not be unique.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003aqueuep"></a><dl>
<dt><a name="index-queuep"></a>Function: <strong>queuep</strong> <em>[sb-concurrency] object</em></dt>
<dd><p>Returns true if argument is a <code>queue</code>, <code>nil</code> otherwise.
</p></dd></dl>

<a name="Mailbox-_0028lock_002dfree_0029"></a>
<h4 class="subsection">16.2.2 Mailbox (lock-free)</h4>
<a name="index-Mailbox_002c-lock_002dfree"></a>

<p><code>sb-concurrency:mailbox</code> is a lock-free message queue where one
or multiple ends can send messages to one or multiple receivers. The
difference to <a href="#Section-sb_002dconcurrency_003aqueue">queues</a> is that the receiving
end may block until a message arrives.
<br><br>
Built on top of the <a href="#Structure-sb_002dconcurrency_003aqueue">queue</a> implementation.
</p>
<a name="Structure-sb_002dconcurrency_003amailbox"></a><dl>
<dt><a name="index-mailbox"></a>Structure: <strong>mailbox</strong> <em>[sb-concurrency]</em></dt>
<dd><p>Class precedence list: <code>mailbox, structure-object, t</code>
</p>
<p>Mailbox aka message queue.
</p>
<p><code>send-message</code> adds a message to the mailbox, <code>receive-message</code> waits till
a message becomes available, whereas <code>receive-message-no-hang</code> is a non-blocking
variant, and <code>receive-pending-messages</code> empties the entire mailbox in one go.
</p>
<p>Messages can be arbitrary objects
</p></dd></dl>

<a name="Function-sb_002dconcurrency_003alist_002dmailbox_002dmessages"></a><dl>
<dt><a name="index-list_002dmailbox_002dmessages"></a>Function: <strong>list-mailbox-messages</strong> <em>[sb-concurrency] mailbox</em></dt>
<dd><p>Returns a fresh list containing all the messages in the
mailbox. Does not remove messages from the mailbox.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003amailbox_002dcount"></a><dl>
<dt><a name="index-mailbox_002dcount"></a>Function: <strong>mailbox-count</strong> <em>[sb-concurrency] mailbox</em></dt>
<dd><p>Returns the number of messages currently in the mailbox.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003amailbox_002dempty_002dp"></a><dl>
<dt><a name="index-mailbox_002dempty_002dp"></a>Function: <strong>mailbox-empty-p</strong> <em>[sb-concurrency] mailbox</em></dt>
<dd><p>Returns true if <code>mailbox</code> is currently empty, <code>nil</code> otherwise.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003amailbox_002dname"></a><dl>
<dt><a name="index-mailbox_002dname"></a>Function: <strong>mailbox-name</strong> <em>[sb-concurrency] instance</em></dt>
<dd><p>Name of a <code>mailbox</code>. SETFable.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003amailboxp"></a><dl>
<dt><a name="index-mailboxp"></a>Function: <strong>mailboxp</strong> <em>[sb-concurrency] object</em></dt>
<dd><p>Returns true if argument is a <code>mailbox</code>, <code>nil</code> otherwise.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003amake_002dmailbox"></a><dl>
<dt><a name="index-make_002dmailbox"></a>Function: <strong>make-mailbox</strong> <em>[sb-concurrency] &amp;key name initial-contents</em></dt>
<dd><p>Returns a new <code>mailbox</code> with messages in <code>initial-contents</code> enqueued.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003areceive_002dmessage"></a><dl>
<dt><a name="index-receive_002dmessage"></a>Function: <strong>receive-message</strong> <em>[sb-concurrency] mailbox &amp;key timeout</em></dt>
<dd><p>Removes the oldest message from <code>mailbox</code> and returns it as the primary
value, and a secondary value of <code>t</code>. If <code>mailbox</code> is empty waits until a message
arrives.
</p>
<p>If <code>timeout</code> is provided, and no message arrives within the specified interval,
returns primary and secondary value of <code>nil</code>.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003areceive_002dmessage_002dno_002dhang"></a><dl>
<dt><a name="index-receive_002dmessage_002dno_002dhang"></a>Function: <strong>receive-message-no-hang</strong> <em>[sb-concurrency] mailbox</em></dt>
<dd><p>The non-blocking variant of <code>receive-message</code>. Returns two values,
the message removed from <code>mailbox</code>, and a flag specifying whether a
message could be received.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003areceive_002dpending_002dmessages"></a><dl>
<dt><a name="index-receive_002dpending_002dmessages"></a>Function: <strong>receive-pending-messages</strong> <em>[sb-concurrency] mailbox &amp;optional n</em></dt>
<dd><p>Removes and returns all (or at most N) currently pending messages
from <code>mailbox</code>, or returns <code>nil</code> if no messages are pending.
</p>
<p>Note: Concurrent threads may be snarfing messages during the run of
this function, so even though <code>x</code>,<code>y</code> appear right next to each other in
the result, does not necessarily mean that <code>y</code> was the message sent
right after <code>x</code>.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003asend_002dmessage"></a><dl>
<dt><a name="index-send_002dmessage"></a>Function: <strong>send-message</strong> <em>[sb-concurrency] mailbox message</em></dt>
<dd><p>Adds a <code>message</code> to <code>mailbox</code>. Message can be any object.
</p></dd></dl>

<a name="Section-sb_002dconcurrency_003agate"></a><a name="Gates"></a>
<h4 class="subsection">16.2.3 Gates</h4>
<a name="index-Gate"></a>

<p><code>sb-concurrency:gate</code> is a synchronization object suitable for when
multiple threads must wait for a single event before proceeding.
</p>
<a name="Structure-sb_002dconcurrency_003agate"></a><dl>
<dt><a name="index-gate"></a>Structure: <strong>gate</strong> <em>[sb-concurrency]</em></dt>
<dd><p>Class precedence list: <code>gate, structure-object, t</code>
</p>
<p><code>gate</code> type. Gates are synchronization constructs suitable for making
multiple threads wait for single event before proceeding.
</p>
<p>Use <code>wait-on-gate</code> to wait for a gate to open, <code>open-gate</code> to open one,
and <code>close-gate</code> to close an open gate. <code>gate-open-p</code> can be used to test
the state of a gate without blocking.
</p></dd></dl>

<a name="Function-sb_002dconcurrency_003aclose_002dgate"></a><dl>
<dt><a name="index-close_002dgate"></a>Function: <strong>close-gate</strong> <em>[sb-concurrency] gate</em></dt>
<dd><p>Closes <code>gate</code>. Returns <code>t</code> if the gate was previously open, and <code>nil</code>
if the gate was already closed.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003agate_002dname"></a><dl>
<dt><a name="index-gate_002dname"></a>Function: <strong>gate-name</strong> <em>[sb-concurrency] instance</em></dt>
<dd><p>Name of a <code>gate</code>. SETFable.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003agate_002dopen_002dp"></a><dl>
<dt><a name="index-gate_002dopen_002dp"></a>Function: <strong>gate-open-p</strong> <em>[sb-concurrency] gate</em></dt>
<dd><p>Returns true if <code>gate</code> is open.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003agatep"></a><dl>
<dt><a name="index-gatep"></a>Function: <strong>gatep</strong> <em>[sb-concurrency] object</em></dt>
<dd><p>Returns true if the argument is a <code>gate</code>.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003amake_002dgate"></a><dl>
<dt><a name="index-make_002dgate"></a>Function: <strong>make-gate</strong> <em>[sb-concurrency] &amp;key name open</em></dt>
<dd><p>Makes a new gate. Gate will be initially open if <code>open</code> is true, and closed if <code>open</code>
is <code>nil</code> (the default.) <code>name</code>, if provided, is the name of the gate, used when printing
the gate.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003aopen_002dgate"></a><dl>
<dt><a name="index-open_002dgate"></a>Function: <strong>open-gate</strong> <em>[sb-concurrency] gate</em></dt>
<dd><p>Opens <code>gate</code>. Returns <code>t</code> if the gate was previously closed, and <code>nil</code>
if the gate was already open.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003await_002don_002dgate"></a><dl>
<dt><a name="index-wait_002don_002dgate"></a>Function: <strong>wait-on-gate</strong> <em>[sb-concurrency] gate &amp;key timeout</em></dt>
<dd><p>Waits for <code>gate</code> to open, or <code>timeout</code> seconds to pass. Returns <code>t</code>
if the gate was opened in time, and <code>nil</code> otherwise.
</p></dd></dl>

<a name="Section-sb_002dconcurrency_003afrlock"></a><a name="Frlocks_002c-aka-Fast-Read-Locks"></a>
<h4 class="subsection">16.2.4 Frlocks, aka Fast Read Locks</h4>
<a name="index-Frlock"></a>
<a name="index-Fast-Read-Lock"></a>

<a name="Structure-sb_002dconcurrency_003afrlock"></a><dl>
<dt><a name="index-frlock"></a>Structure: <strong>frlock</strong> <em>[sb-concurrency]</em></dt>
<dd><p>Class precedence list: <code>frlock, structure-object, t</code>
</p>
<p>FRlock, aka Fast Read Lock.
</p>
<p>Fast Read Locks allow multiple readers and one potential writer to operate in
parallel while providing for consistency for readers and mutual exclusion for
writers.
</p>
<p>Readers gain entry to protected regions without waiting, but need to retry if
a writer operated inside the region while they were reading. This makes frlocks
very efficient when readers are much more common than writers.
</p>
<p>FRlocks are <code>not</code> suitable when it is not safe at all for readers and writers to
operate on the same data in parallel: they provide consistency, not exclusion
between readers and writers. Hence using an frlock to eg. protect an <code>sbcl</code>
hash-table is unsafe. If multiple readers operating in parallel with a writer
would be safe but inconsistent without a lock, frlocks are suitable.
</p>
<p>The recommended interface to use is <code>frlock-read</code> and <code>frlock-write</code>, but those
needing it can also use a lower-level interface.
</p>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">  ;; Values returned by FOO are always consistent so that
  ;; the third value is the sum of the two first ones.
  (let ((a 0)
        (b 0)
        (c 0)
        (lk (make-frlock)))
    (defun foo ()
       (frlock-read (lk) a b c))
    (defun bar (x y)
       (frlock-write (lk)
         (setf a x
               b y
               c (+ x y)))))
</pre></div>
</dd></dl>

<a name="Macro-sb_002dconcurrency_003afrlock_002dread"></a><dl>
<dt><a name="index-frlock_002dread"></a>Macro: <strong>frlock-read</strong> <em>[sb-concurrency] (frlock) &amp;body value-forms</em></dt>
<dd><p>Evaluates <code>value-forms</code> under <code>frlock</code> till it obtains a consistent
set, and returns that as multiple values.
</p></dd></dl>
<a name="Macro-sb_002dconcurrency_003afrlock_002dwrite"></a><dl>
<dt><a name="index-frlock_002dwrite"></a>Macro: <strong>frlock-write</strong> <em>[sb-concurrency] (frlock &amp;key wait-p timeout) &amp;body body</em></dt>
<dd><p>Executes <code>body</code> while holding <code>frlock</code> for writing.
</p></dd></dl>

<a name="Function-sb_002dconcurrency_003amake_002dfrlock"></a><dl>
<dt><a name="index-make_002dfrlock"></a>Function: <strong>make-frlock</strong> <em>[sb-concurrency] &amp;key name</em></dt>
<dd><p>Returns a new <code>frlock</code> with <code>name</code>.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003afrlock_002dname"></a><dl>
<dt><a name="index-frlock_002dname"></a>Function: <strong>frlock-name</strong> <em>[sb-concurrency] instance</em></dt>
<dd><p>Name of an <code>frlock</code>. SETFable.
</p></dd></dl>

<a name="Function-sb_002dconcurrency_003afrlock_002dread_002dbegin"></a><dl>
<dt><a name="index-frlock_002dread_002dbegin"></a>Function: <strong>frlock-read-begin</strong> <em>[sb-concurrency] frlock</em></dt>
<dd><p>Start a read sequence on <code>frlock</code>. Returns a read-token and an epoch to be
validated later.
</p>
<p>Using <code>frlock-read</code> instead is recommended.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003afrlock_002dread_002dend"></a><dl>
<dt><a name="index-frlock_002dread_002dend"></a>Function: <strong>frlock-read-end</strong> <em>[sb-concurrency] frlock</em></dt>
<dd><p>Ends a read sequence on <code>frlock</code>. Returns a token and an epoch. If the token
and epoch are <code>eql</code> to the read-token and epoch returned by <code>frlock-read-begin</code>,
the values read under the <code>frlock</code> are consistent and can be used: if the values
differ, the values are inconsistent and the read must be restated.
</p>
<p>Using <code>frlock-read</code> instead is recommended.
</p>
<p>Example:
</p>
<div class="lisp">
<pre class="lisp">  (multiple-value-bind (t0 e0) (frlock-read-begin *fr*)
    (let ((a (get-a))
          (b (get-b)))
      (multiple-value-bind (t1 e1) (frlock-read-end *fr*)
        (if (and (eql t0 t1) (eql e0 e1))
            (list :a a :b b)
            :aborted))))
</pre></div>
</dd></dl>
<a name="Function-sb_002dconcurrency_003agrab_002dfrlock_002dwrite_002dlock"></a><dl>
<dt><a name="index-grab_002dfrlock_002dwrite_002dlock"></a>Function: <strong>grab-frlock-write-lock</strong> <em>[sb-concurrency] frlock &amp;key wait-p timeout</em></dt>
<dd><p>Acquires <code>frlock</code> for writing, invalidating existing and future read-tokens
for the duration. Returns <code>t</code> on success, and <code>nil</code> if the lock wasn&rsquo;t acquired
due to eg. a timeout. Using <code>frlock-write</code> instead is recommended.
</p></dd></dl>
<a name="Function-sb_002dconcurrency_003arelease_002dfrlock_002dwrite_002dlock"></a><dl>
<dt><a name="index-release_002dfrlock_002dwrite_002dlock"></a>Function: <strong>release-frlock-write-lock</strong> <em>[sb-concurrency] frlock</em></dt>
<dd><p>Releases <code>frlock</code> after writing, allowing valid read-tokens to be acquired again.
Signals an error if the current thread doesn&rsquo;t hold <code>frlock</code> for writing. Using <code>frlock-write</code>
instead is recommended.
</p></dd></dl>

<hr>
<a name="sb_002dcover"></a>
<div class="header">
<p>
Next: <a href="#sb_002dgrovel" accesskey="n" rel="next">sb-grovel</a>, Previous: <a href="#sb_002dconcurrency" accesskey="p" rel="prev">sb-concurrency</a>, Up: <a href="#Contributed-Modules" accesskey="u" rel="up">Contributed Modules</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sb_002dcover-1"></a>
<h3 class="section">16.3 sb-cover</h3>
<a name="index-Code-Coverage"></a>

<p>The <code>sb-cover</code> module provides a code coverage tool for SBCL. The
tool has support for expression coverage, and for some branch coverage.
Coverage reports are only generated for code compiled using
<code>compile-file</code> with the value of the
<code>sb-cover:store-coverage-data</code> optimization quality set to 3.
</p>
<p>As of SBCL 1.0.6 <code>sb-cover</code> is still experimental, and the
interfaces documented here might change in later versions.
</p>
<a name="Example-Usage-1"></a>
<h4 class="subsection">16.3.1 Example Usage</h4>

<div class="lisp">
<pre class="lisp">;;; Load SB-COVER
(require :sb-cover)

;;; Turn on generation of code coverage instrumentation in the compiler
(declaim (optimize sb-cover:store-coverage-data))

;;; Load some code, ensuring that it's recompiled with the new optimization
;;; policy.
(asdf:oos 'asdf:load-op :cl-ppcre-test :force t)

;;; Run the test suite.
(cl-ppcre-test:test)

;;; Produce a coverage report
(sb-cover:report &quot;/tmp/report/&quot;)

;;; Turn off instrumentation
(declaim (optimize (sb-cover:store-coverage-data 0)))
</pre></div>


<a name="Functions-1"></a>
<h4 class="subsection">16.3.2 Functions</h4>

<a name="Function-sb_002dcover_003areport"></a><dl>
<dt><a name="index-report-2"></a>Function: <strong>report</strong> <em>[sb-cover] directory &amp;key form-mode external-format</em></dt>
<dd><p>Print a code coverage report of all instrumented files into <code>directory</code>.
If <code>directory</code> does not exist, it will be created. The main report will be
printed to the file cover-index.html. The external format of the source
files can be specified with the <code>external-format</code> parameter.
</p>
<p>If the keyword argument <code>form-mode</code> has the value <code>:car</code>, the annotations in
the coverage report will be placed on the CARs of any cons-forms, while if
it has the value <code>:whole</code> the whole form will be annotated (the default).
The former mode shows explicitly which forms were instrumented, while the
latter mode is generally easier to read.
</p></dd></dl>

<a name="Function-sb_002dcover_003areset_002dcoverage"></a><dl>
<dt><a name="index-reset_002dcoverage"></a>Function: <strong>reset-coverage</strong> <em>[sb-cover]</em></dt>
<dd><p>Reset all coverage data back to the &lsquo;Not executed&lsquo; state.
</p></dd></dl>

<a name="Function-sb_002dcover_003aclear_002dcoverage"></a><dl>
<dt><a name="index-clear_002dcoverage"></a>Function: <strong>clear-coverage</strong> <em>[sb-cover]</em></dt>
<dd><p>Clear all files from the coverage database. The files will be re-entered
into the database when the <code>fasl</code> files (produced by compiling
<code>store-coverage-data</code> optimization policy set to 3) are loaded again into the
image.
</p></dd></dl>

<a name="Function-sb_002dcover_003asave_002dcoverage"></a><dl>
<dt><a name="index-save_002dcoverage"></a>Function: <strong>save-coverage</strong> <em>[sb-cover]</em></dt>
<dd><p>Returns an opaque representation of the current code coverage state.
The only operation that may be done on the state is passing it to
<code>restore-coverage</code>. The representation is guaranteed to be readably printable.
A representation that has been printed and read back will work identically
in <code>restore-coverage</code>.
</p></dd></dl>

<a name="Function-sb_002dcover_003asave_002dcoverage_002din_002dfile"></a><dl>
<dt><a name="index-save_002dcoverage_002din_002dfile"></a>Function: <strong>save-coverage-in-file</strong> <em>[sb-cover] pathname</em></dt>
<dd><p>Call <code>save-coverage</code> and write the results of that operation into the
file designated by <code>pathname</code>.
</p></dd></dl>

<a name="Function-sb_002dcover_003arestore_002dcoverage"></a><dl>
<dt><a name="index-restore_002dcoverage"></a>Function: <strong>restore-coverage</strong> <em>[sb-cover] coverage-state</em></dt>
<dd><p>Restore the code coverage data back to an earlier state produced by
<code>save-coverage</code>.
</p></dd></dl>

<a name="Function-sb_002dcover_003arestore_002dcoverage_002dfrom_002dfile"></a><dl>
<dt><a name="index-restore_002dcoverage_002dfrom_002dfile"></a>Function: <strong>restore-coverage-from-file</strong> <em>[sb-cover] pathname</em></dt>
<dd><p><code>read</code> the contents of the file designated by <code>pathname</code> and pass the
result to <code>restore-coverage</code>.
</p></dd></dl>


<hr>
<a name="sb_002dgrovel"></a>
<div class="header">
<p>
Next: <a href="#sb_002dmd5" accesskey="n" rel="next">sb-md5</a>, Previous: <a href="#sb_002dcover" accesskey="p" rel="prev">sb-cover</a>, Up: <a href="#Contributed-Modules" accesskey="u" rel="up">Contributed Modules</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sb_002dgrovel-1"></a>
<h3 class="section">16.4 sb-grovel</h3>
<a name="index-Foreign-Function-Interface_002c-generation"></a>

<p>The <code>sb-grovel</code> module helps in generation of foreign function
interfaces. It aids in extracting constants&rsquo; values from the C
compiler and in generating SB-ALIEN structure and union types,
see <a href="#Defining-Foreign-Types">Defining Foreign Types</a>.
</p>
<p>The ASDF(<a href="http://www.cliki.net/ASDF">http://www.cliki.net/ASDF</a>) component type
GROVEL-CONSTANTS-FILE has its PERFORM
operation defined to write out a C source file, compile it, and run
it.  The output from this program is Lisp, which is then itself
compiled and loaded.
</p>
<p>sb-grovel is used in a few contributed modules, and it is currently
compatible only to SBCL. However, if you want to use it, here are a
few directions.
</p>
<a name="Using-sb_002dgrovel-in-your-own-ASDF-system"></a>
<h4 class="subsection">16.4.1 Using sb-grovel in your own ASDF system</h4>

<ol>
<li> Create a Lisp package for the foreign constants/functions to go into.

</li><li> Make your system depend on the &rsquo;sb-grovel system.

</li><li> Create a grovel-constants data file - for an example, see
example-constants.lisp in the contrib/sb-grovel/ directory in the SBCL
source distribution.

</li><li> Add it as a component in your system. e.g.

<div class="lisp">
<pre class="lisp">(eval-when (:compile-toplevel :load-toplevel :execute)
  (require :sb-grovel))

(defpackage :example-package.system
            (:use :cl :asdf :sb-grovel :sb-alien))

(in-package :example-package.system)

(defsystem example-system
    :depends-on (sb-grovel)
    :components
    ((:module &quot;sbcl&quot;
              :components
              ((:file &quot;defpackage&quot;)
               (grovel-constants-file &quot;example-constants&quot;
                                      :package :example-package)))))
</pre></div>

<p>Make sure to specify the package you chose in step 1
</p>
</li><li> Build stuff.

</li></ol>

<a name="Contents-of-a-grovel_002dconstants_002dfile"></a>
<h4 class="subsection">16.4.2 Contents of a grovel-constants-file</h4>

<p>The grovel-constants-file, typically named <code>constants.lisp</code>,
comprises lisp expressions describing the foreign things that you want
to grovel for. A <code>constants.lisp</code> file contains two sections:
</p>
<ul>
<li> a list of headers to include in the C program, for example:
<div class="lisp">
<pre class="lisp">(&quot;sys/types.h&quot; &quot;sys/socket.h&quot; &quot;sys/stat.h&quot; &quot;unistd.h&quot; &quot;sys/un.h&quot;
 &quot;netinet/in.h&quot; &quot;netinet/in_systm.h&quot; &quot;netinet/ip.h&quot; &quot;net/if.h&quot;
 &quot;netdb.h&quot; &quot;errno.h&quot; &quot;netinet/tcp.h&quot; &quot;fcntl.h&quot; &quot;signal.h&quot; )
</pre></div>

</li><li> A list of sb-grovel clauses describing the things you want to grovel
from the C compiler, for example:
<div class="lisp">
<pre class="lisp">((:integer af-local
           #+(or sunos solaris) &quot;AF_UNIX&quot;
           #-(or sunos solaris) &quot;AF_LOCAL&quot;
           &quot;Local to host (pipes and file-domain).&quot;)
 (:structure stat (&quot;struct stat&quot;
                   (integer dev &quot;dev_t&quot; &quot;st_dev&quot;)
                   (integer atime &quot;time_t&quot; &quot;st_atime&quot;)))
 (:function getpid (&quot;getpid&quot; int )))
</pre></div>
</li></ul>

<p>There are two types of things that sb-grovel can sensibly extract from
the C compiler: constant integers and structure layouts. It is also
possible to define foreign functions in the constants.lisp file, but
these definitions don&rsquo;t use any information from the C program; they
expand directly to <code>sb-alien:define-alien-routine</code>
(see <a href="#The-define_002dalien_002droutine-Macro">The define-alien-routine Macro</a>) forms.
</p>
<p>Here&rsquo;s how to use the grovel clauses:
</p>
<ul>
<li> <code>:integer</code> - constant expressions in C. Used in this form:
<div class="lisp">
<pre class="lisp"> (:integer lisp-variable-name &quot;C expression&quot; &amp;optional doc export)
</pre></div>

<p><code>&quot;C expression&quot;</code> will be typically be the name of a constant. But
other forms are possible.
</p>
</li><li> <code>:enum</code>
<div class="lisp">
<pre class="lisp"> (:enum lisp-type-name ((lisp-enumerated-name c-enumerated-name) ...)))
</pre></div>

<p>An <code>sb-alien:enum</code> type with name <code>lisp-type-name</code> will be defined.
The symbols are the <code>lisp-enumerated-name</code>s, and the values
are grovelled from the <code>c-enumerated-name</code>s.
</p>
</li><li> <code>:structure</code> - alien structure definitions look like this:
<div class="lisp">
<pre class="lisp"> (:structure lisp-struct-name (&quot;struct c_structure&quot;
                               (type-designator lisp-element-name
                                &quot;c_element_type&quot; &quot;c_element_name&quot;
                                :distrust-length nil)
                               ; ...
                               ))
</pre></div>

<p><code>type-designator</code> is a reference to a type whose size (and type
constraints) will be groveled for. sb-grovel accepts a form of type
designator that doesn&rsquo;t quite conform to either lisp nor sb-alien&rsquo;s
type specifiers. Here&rsquo;s a list of type designators that sb-grovel
currently accepts:
</p><ul>
<li> <code>integer</code> - a C integral type; sb-grovel will infer the exact
type from size information extracted from the C program. All common C
integer types can be grovelled for with this type designator, but it
is not possible to grovel for bit fields yet.

</li><li> <code>(unsigned n)</code> - an unsigned integer variable that is <code>n</code>
bytes long. No size information from the C program will be used.
</li><li> <code>(signed n)</code> - an signed integer variable that is <code>n</code> bytes
long. No size information from the C program will be used.

</li><li> <code>c-string</code> - an array of <code>char</code> in the structure. sb-grovel
will use the array&rsquo;s length from the C program, unless you pass it the
<code>:distrust-length</code> keyword argument with non-<code>nil</code> value
(this might be required for structures such as solaris&rsquo;s <code>struct
dirent</code>).

</li><li> <code>c-string-pointer</code> - a pointer to a C string, corresponding to
the <code>sb-alien:c-string</code> type (see <a href="#Foreign-Type-Specifiers">Foreign Type Specifiers</a>).
</li><li> <code>(array alien-type)</code> - An array of the previously-declared alien
type. The array&rsquo;s size will be determined from the output of the C
program and the alien type&rsquo;s size.
</li><li> <code>(array alien-type n)</code> - An array of the previously-declared alien
type. The array&rsquo;s size will be assumed as being <code>n</code>.
</li></ul>


<p>Note that <code>c-string</code> and <code>c-string-pointer</code> do not have the
same meaning. If you declare that an element is of type
<code>c-string</code>, it will be treated as if the string is a part of the
structure, whereas if you declare that the element is of type
<code>c-string-pointer</code>, a <em>pointer to a string</em> will be the
structure member.
</p>
</li><li> <code>:function</code> - alien function definitions are similar to
<code>define-alien-routine</code> definitions, because they expand to such
forms when the lisp program is loaded. See <a href="#Foreign-Function-Calls">Foreign Function Calls</a>.

<div class="lisp">
<pre class="lisp">(:function lisp-function-name (&quot;alien_function_name&quot; alien-return-type
                                                     (argument alien-type)
                                                     (argument2 alien-type)))
</pre></div>
</li></ul>


<a name="Programming-with-sb_002dgrovel_0027s-structure-types"></a>
<h4 class="subsection">16.4.3 Programming with sb-grovel&rsquo;s structure types</h4>

<p>Let us assume that you have a grovelled structure definition:
</p><div class="lisp">
<pre class="lisp"> (:structure mystruct (&quot;struct my_structure&quot;
                       (integer myint &quot;int&quot; &quot;st_int&quot;)
                       (c-string mystring &quot;char[]&quot; &quot;st_str&quot;)))
</pre></div>

<p>What can you do with it? Here&rsquo;s a short interface document:
</p>
<ul>
<li> Creating and destroying objects:
<ul>
<li> Function <code>(allocate-mystruct)</code> - allocates an object of type <code>mystruct</code>and
returns a system area pointer to it.
</li><li> Function <code>(free-mystruct var)</code> - frees the alien object pointed to by
<var>var</var>.
</li><li> Macro <code>(with-mystruct var ((member init) [...]) &amp;body body)</code> -
allocates an object of type <code>mystruct</code> that is valid in
<var>body</var>. If <var>body</var> terminates or control unwinds out of
<var>body</var>, the object pointed to by <var>var</var> will be deallocated.
</li></ul>

</li><li> Accessing structure members:
<ul>
<li> <code>(mystruct-myint var)</code> and <code>(mystruct-mystring var)</code> return
the value of the respective fields in <code>mystruct</code>.
</li><li> <code>(setf (mystruct-myint var) new-val)</code> and
<code>(setf (mystruct-mystring var) new-val)</code> sets the value of the respective
structure member to the value of <var>new-val</var>. Notice that in
<code>(setf (mystruct-mystring var) new-val)</code>&rsquo;s case, new-val is a lisp
string.
</li></ul>
</li></ul>

<a name="Traps-and-Pitfalls"></a>
<h4 class="subsubsection">16.4.3.1 Traps and Pitfalls</h4>
<p>Basically, you can treat functions and data structure definitions that
sb-grovel spits out as if they were alien routines and types. This has
a few implications that might not be immediately obvious (especially
if you have programmed in a previous version of sb-grovel that didn&rsquo;t
use alien types):
</p>
<ul>
<li> You must take care of grovel-allocated structures yourself. They are
alien types, so the garbage collector will not collect them when you
drop the last reference.

</li><li> If you use the <code>with-mystruct</code> macro, be sure that no references
to the variable thus allocated leaks out. It will be deallocated when
the block exits.
</li></ul>

<hr>
<a name="sb_002dmd5"></a>
<div class="header">
<p>
Next: <a href="#sb_002dposix" accesskey="n" rel="next">sb-posix</a>, Previous: <a href="#sb_002dgrovel" accesskey="p" rel="prev">sb-grovel</a>, Up: <a href="#Contributed-Modules" accesskey="u" rel="up">Contributed Modules</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sb_002dmd5-1"></a>
<h3 class="section">16.5 sb-md5</h3>
<a name="index-Hashing_002c-cryptographic"></a>

<p>The <code>sb-md5</code> module implements the RFC1321 MD5 Message Digest
Algorithm. [FIXME cite]
</p>
<a name="Function-sb_002dmd5_003amd5sum_002dfile"></a><dl>
<dt><a name="index-md5sum_002dfile"></a>Function: <strong>md5sum-file</strong> <em>[sb-md5] pathname</em></dt>
<dd><p>Calculate the MD5 message-digest of the file specified by &lsquo;pathname&rsquo;.
</p></dd></dl>

<a name="Function-sb_002dmd5_003amd5sum_002dsequence"></a><dl>
<dt><a name="index-md5sum_002dsequence"></a>Function: <strong>md5sum-sequence</strong> <em>[sb-md5] sequence &amp;key start end</em></dt>
<dd><p>Calculate the MD5 message-digest of data in &lsquo;sequence&rsquo;, which should
be a 1d simple-array with element type (unsigned-byte 8).  On <code>cmu</code> <code>cl</code>
and <code>sbcl</code> non-simple and non-1d arrays with this element-type are also
supported.  Use with strings is <code>deprecated</code>, since this will not work
correctly on implementations with &lsquo;char-code-limit&rsquo; &gt; 256 and ignores
character-coding issues.  Use md5sum-string instead, or convert to the
required (unsigned-byte 8) format through other means before-hand.
</p></dd></dl>

<a name="Function-sb_002dmd5_003amd5sum_002dstream"></a><dl>
<dt><a name="index-md5sum_002dstream"></a>Function: <strong>md5sum-stream</strong> <em>[sb-md5] stream</em></dt>
<dd><p>Calculate an MD5 message-digest of the contents of &lsquo;stream&rsquo;.  Its
element-type has to be (unsigned-byte 8). Use on character streams is
<code>deprecated</code>, as this will not work correctly on implementations with
&lsquo;char-code-limit&rsquo; &gt; 256 and ignores character coding issues.
</p></dd></dl>

<a name="Function-sb_002dmd5_003amd5sum_002dstring"></a><dl>
<dt><a name="index-md5sum_002dstring"></a>Function: <strong>md5sum-string</strong> <em>[sb-md5] string &amp;key external-format start end</em></dt>
<dd><p>Calculate the MD5 message-digest of the binary representation of
&lsquo;string&rsquo; (as octets) in the external format specified by
&lsquo;external-format&rsquo;. The boundaries &lsquo;start&rsquo; and &lsquo;end&rsquo; refer to character
positions in the string, not to octets in the resulting binary
representation.  The permissible external format specifiers are
determined by the underlying implementation.
</p></dd></dl>

<a name="Credits-2"></a>
<h4 class="subsection">16.5.1 Credits</h4>

<p>The implementation for CMUCL was largely done by Pierre Mai, with help
from members of the <code>cmucl-help</code> mailing list.  Since CMUCL and
SBCL are similar in many respects, it was not too difficult to extend
the low-level implementation optimizations for CMUCL to SBCL.
Following this, SBCL&rsquo;s compiler was extended to implement efficient
compilation of modular arithmetic (see <a href="#Modular-arithmetic">Modular arithmetic</a>), which
enabled the implementation to be expressed in portable arithmetical
terms, apart from the use of <code>rotate-byte</code> for bitwise rotation.
<a name="index-rotate_002dbyte-_005bsb_002drotate_002dbyte_005d"></a>
</p>

<hr>
<a name="sb_002dposix"></a>
<div class="header">
<p>
Next: <a href="#sb_002dqueue" accesskey="n" rel="next">sb-queue</a>, Previous: <a href="#sb_002dmd5" accesskey="p" rel="prev">sb-md5</a>, Up: <a href="#Contributed-Modules" accesskey="u" rel="up">Contributed Modules</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sb_002dposix-1"></a>
<h3 class="section">16.6 sb-posix</h3>
<a name="index-Operating-System-Interface"></a>
<a name="index-System-Calls"></a>
<a name="index-Posix"></a>

<p>Sb-posix is the supported interface for calling out to the operating
system.<a name="DOCF10" href="#FOOT10"><sup>10</sup></a>
</p>
<p>The scope of this interface is &ldquo;operating system calls on a typical
Unixlike platform&rdquo;.  This is section 2 of the Unix manual, plus section
3 calls that are (a) typically found in libc, but (b) not part of the C
standard.  For example, we intend to provide support for
<code>opendir()</code> and <code>readdir()</code>, but not for <code>printf()</code>.
That said, if your favourite system call is not included yet, you are
encouraged to submit a patch to the SBCL mailing list.
</p>
<p>Some facilities are omitted where they offer absolutely no additional
use over some portable function, or would be actively dangerous to the
consistency of Lisp.  Not all functions are available on all
platforms.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Lisp-names-for-C-names" accesskey="1">Lisp names for C names</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Types" accesskey="2">Types</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Function-Parameters" accesskey="3">Function Parameters</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Function-Return-Values" accesskey="4">Function Return Values</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Lisp-objects-and-C-structures" accesskey="5">Lisp objects and C structures</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Functions-with-idiosyncratic-bindings" accesskey="6">Functions with idiosyncratic bindings</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>


<hr>
<a name="Lisp-names-for-C-names"></a>
<div class="header">
<p>
Next: <a href="#Types" accesskey="n" rel="next">Types</a>, Up: <a href="#sb_002dposix" accesskey="u" rel="up">sb-posix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Lisp-names-for-C-names-1"></a>
<h4 class="subsection">16.6.1 Lisp names for C names</h4>

<p>All symbols are in the <code>SB-POSIX</code> package.  This package contains a
Lisp function for each supported Unix system call or function, a
variable or constant for each supported Unix constant, an object type
for each supported Unix structure type, and a slot name for each
supported Unix structure member.  A symbol name is derived from the C
binding&rsquo;s name, by (a) uppercasing, then (b) removing leading
underscores (<code>#\_</code>) then replacing remaining underscore characters
with the hyphen (<code>#\-</code>). The requirement to uppercase is so that in
a standard upcasing reader the user may write <code>sb-posix:creat</code>
instead of <code>sb-posix:|creat|</code> as would otherise be required.
</p>
<p>No other changes to &ldquo;Lispify&rdquo; symbol names are made, so <code>creat()</code>
becomes <code>CREAT</code>, not <code>CREATE</code>.
</p>
<p>The user is encouraged not to <code>(USE-PACKAGE :SB-POSIX)</code> but instead
to use the <code>SB-POSIX:</code> prefix on all references, as some of the
symbols symbols contained in the SB-POSIX package have the same name as
CL symbols (<code>OPEN</code>, <code>CLOSE</code>, <code>SIGNAL</code> etc).
</p>
<hr>
<a name="Types"></a>
<div class="header">
<p>
Next: <a href="#Function-Parameters" accesskey="n" rel="next">Function Parameters</a>, Previous: <a href="#Lisp-names-for-C-names" accesskey="p" rel="prev">Lisp names for C names</a>, Up: <a href="#sb_002dposix" accesskey="u" rel="up">sb-posix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Types-1"></a>
<h4 class="subsection">16.6.2 Types</h4>

<p>Generally, marshalling between Lisp and C data types is done using
SBCL&rsquo;s FFI. See <a href="#Foreign-Function-Interface">Foreign Function Interface</a>.
</p>
<p>Some functions accept objects such as filenames or file descriptors.  In
the C binding to POSIX these are represented as strings and small
integers respectively. For the Lisp programmer&rsquo;s convenience we
introduce designators such that CL pathnames or open streams can be
passed to these functions.  For example, <code>rename</code> accepts both
pathnames and strings as its arguments.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#File_002ddescriptors" accesskey="1">File-descriptors</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Filenames" accesskey="2">Filenames</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="File_002ddescriptors"></a>
<div class="header">
<p>
Next: <a href="#Filenames" accesskey="n" rel="next">Filenames</a>, Up: <a href="#Types" accesskey="u" rel="up">Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="File_002ddescriptors-1"></a>
<h4 class="subsubsection">16.6.2.1 File-descriptors</h4>

<a name="Type-sb_002dposix_003afile_002ddescriptor"></a><dl>
<dt><a name="index-file_002ddescriptor-1"></a>Type: <strong>file-descriptor</strong> <em>[sb-posix]</em></dt>
<dd><p>A <code>fixnum</code> designating a native file descriptor.
</p>
<p><code>sb-sys:make-fd-stream</code> can be used to construct a <code>file-stream</code> associated with a
native file descriptor.
</p>
<p>Note that mixing I/O operations on a <code>file-stream</code> with operations directly on its
descriptor may produce unexpected results if the stream is buffered.
</p></dd></dl>
<a name="Type-sb_002dposix_003afile_002ddescriptor_002ddesignator"></a><dl>
<dt><a name="index-file_002ddescriptor_002ddesignator"></a>Type: <strong>file-descriptor-designator</strong> <em>[sb-posix]</em></dt>
<dd><p>Designator for a <code>file-descriptor:</code> either a fixnum designating itself, or
a <code>file-stream</code> designating the underlying file-descriptor.
</p></dd></dl>
<a name="Function-sb_002dposix_003afile_002ddescriptor"></a><dl>
<dt><a name="index-file_002ddescriptor"></a>Function: <strong>file-descriptor</strong> <em>[sb-posix] file-descriptor</em></dt>
<dd><p>Converts <code>file-descriptor-designator</code> into a <code>file-descriptor</code>.
</p></dd></dl>

<hr>
<a name="Filenames"></a>
<div class="header">
<p>
Previous: <a href="#File_002ddescriptors" accesskey="p" rel="prev">File-descriptors</a>, Up: <a href="#Types" accesskey="u" rel="up">Types</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Filenames-1"></a>
<h4 class="subsubsection">16.6.2.2 Filenames</h4>

<a name="Type-sb_002dposix_003afilename"></a><dl>
<dt><a name="index-filename-1"></a>Type: <strong>filename</strong> <em>[sb-posix]</em></dt>
<dd><p>A <code>string</code> designating a filename in native namestring syntax.
</p>
<p>Note that native namestring syntax is distinct from Lisp namestring syntax:
</p>
<div class="lisp">
<pre class="lisp">  (pathname &quot;/foo*/bar&quot;)
</pre></div>

<p>is a wild pathname with a pattern-matching directory component.
<code>sb-ext:parse-native-namestring</code> may be used to construct Lisp pathnames that
denote <code>posix</code> filenames as understood by system calls, and
<code>sb-ext:native-namestring</code> can be used to coerce them into strings in the native
namestring syntax.
</p>
<p>Note also that <code>posix</code> filename syntax does not distinguish the names of files
from the names of directories: in order to parse the name of a directory in
<code>posix</code> filename syntax into a pathname <code>my-defaults</code> for which
</p>
<div class="lisp">
<pre class="lisp">  (merge-pathnames (make-pathname :name &quot;FOO&quot; :case :common)
                    my-defaults)
</pre></div>

<p>returns a pathname that denotes a file in the directory, supply a true
<code>:as-directory</code> argument to <code>sb-ext:parse-native-namestring</code>. Likewise, to supply
the name of a directory to a <code>posix</code> function in non-directory syntax, supply a
true <code>:as-file</code> argument to <code>sb-ext:native-namestring</code>.
</p></dd></dl>
<a name="Type-sb_002dposix_003afilename_002ddesignator"></a><dl>
<dt><a name="index-filename_002ddesignator"></a>Type: <strong>filename-designator</strong> <em>[sb-posix]</em></dt>
<dd><p>Designator for a <code>filename:</code> a <code>string</code> designating itself, or a
designator for a <code>pathname</code> designating the corresponding native namestring.
</p></dd></dl>
<a name="Function-sb_002dposix_003afilename"></a><dl>
<dt><a name="index-filename"></a>Function: <strong>filename</strong> <em>[sb-posix] filename</em></dt>
<dd><p>Converts <code>filename-designator</code> into a <code>filename</code>.
</p></dd></dl>

<hr>
<a name="Function-Parameters"></a>
<div class="header">
<p>
Next: <a href="#Function-Return-Values" accesskey="n" rel="next">Function Return Values</a>, Previous: <a href="#Types" accesskey="p" rel="prev">Types</a>, Up: <a href="#sb_002dposix" accesskey="u" rel="up">sb-posix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Function-Parameters-1"></a>
<h4 class="subsection">16.6.3 Function Parameters</h4>

<p>The calling convention is modelled after that of CMUCL&rsquo;s <code>UNIX</code>
package: in particular, it&rsquo;s like the C interface except that:
</p>
<ol type="a" start="1">
<li> Length arguments are omitted or optional where the sensible value
is obvious.  For example, <code>read</code> would be defined this way:

<div class="lisp">
<pre class="lisp">(read fd buffer &amp;optional (length (length buffer))) =&gt; bytes-read
</pre></div>

</li><li> Where C simulates &ldquo;out&rdquo; parameters using pointers (for instance, in
<code>pipe()</code> or <code>socketpair()</code>) these may be optional or omitted
in the Lisp interface: if not provided, appropriate objects will be
allocated and returned (using multiple return values if necessary).

</li><li> Some functions accept objects such as filenames or file descriptors.
Wherever these are specified as such in the C bindings, the Lisp
interface accepts designators for them as specified in the &rsquo;Types&rsquo;
section above.

</li><li> A few functions have been included in sb-posix that do not correspond
exactly with their C counterparts.  These are described in
See <a href="#Functions-with-idiosyncratic-bindings">Functions with idiosyncratic bindings</a>.

</li></ol>

<hr>
<a name="Function-Return-Values"></a>
<div class="header">
<p>
Next: <a href="#Lisp-objects-and-C-structures" accesskey="n" rel="next">Lisp objects and C structures</a>, Previous: <a href="#Function-Parameters" accesskey="p" rel="prev">Function Parameters</a>, Up: <a href="#sb_002dposix" accesskey="u" rel="up">sb-posix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Function-Return-Values-1"></a>
<h4 class="subsection">16.6.4 Function Return Values</h4>

<p>The return value is usually the same as for the C binding, except in
error cases: where the C function is defined as returning some sentinel
value and setting <code>errno</code> on error, we instead signal an error of
type <code>SYSCALL-ERROR</code>.  The actual error value (<code>errno</code>) is
stored in this condition and can be accessed with <code>SYSCALL-ERRNO</code>.
</p>
<p>We do not automatically translate the returned value into &ldquo;Lispy&rdquo;
objects &ndash; for example, <code>SB-POSIX:OPEN</code> returns a small integer,
not a stream.  Exception: boolean-returning functions (or, more
commonly, macros) do not return a C integer, but instead a Lisp
boolean.
</p>
<hr>
<a name="Lisp-objects-and-C-structures"></a>
<div class="header">
<p>
Next: <a href="#Functions-with-idiosyncratic-bindings" accesskey="n" rel="next">Functions with idiosyncratic bindings</a>, Previous: <a href="#Function-Return-Values" accesskey="p" rel="prev">Function Return Values</a>, Up: <a href="#sb_002dposix" accesskey="u" rel="up">sb-posix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Lisp-objects-and-C-structures-1"></a>
<h4 class="subsection">16.6.5 Lisp objects and C structures</h4>

<p>Sb-posix provides various Lisp object types to stand in for C
structures in the POSIX library.  Lisp bindings to C functions that
accept, manipulate, or return C structures accept, manipulate, or
return instances of these Lisp types instead of instances of alien
types.
</p>
<p>The names of the Lisp types are chosen according to the general rules
described above.  For example Lisp objects of type <code>STAT</code> stand
in for C structures of type <code>struct stat</code>.
</p>
<p>Accessors are provided for each standard field in the structure. These
are named <code><var>structure-name</var>-<var>field-name</var></code> where the two
components are chosen according to the general name conversion rules,
with the exception that in cases where all fields in a given structure
have a common prefix, that prefix is omitted. For example,
<code>stat.st_dev</code> in C becomes <code>STAT-DEV</code> in Lisp.
</p>


<p>Because sb-posix might not support all semi-standard or
implementation-dependent members of all structure types on your system
(patches welcome), here is an enumeration of all supported Lisp
objects corresponding to supported POSIX structures, and the supported
slots for those structures.
</p>
<ul>
<li> flock
<a name="Class-sb_002dposix_003aflock"></a><dl>
<dt><a name="index-flock"></a>Class: <strong>flock</strong> <em>[sb-posix]</em></dt>
<dd><p>Class precedence list: <code>flock, standard-object, t</code>
</p>
<p>Slots:
</p><ul>
<li> <code>type</code> &mdash; initarg: <code>:type<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:flock-type</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:flock-type)</span><!-- /@w --></code>

<p>Type of lock; F_RDLCK, F_WRLCK, F_UNLCK.
</p></li><li> <code>whence</code> &mdash; initarg: <code>:whence<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:flock-whence</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:flock-whence)</span><!-- /@w --></code>

<p>Flag for starting offset.
</p></li><li> <code>start</code> &mdash; initarg: <code>:start<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:flock-start</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:flock-start)</span><!-- /@w --></code>

<p>Relative offset in bytes.
</p></li><li> <code>len</code> &mdash; initarg: <code>:len<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:flock-len</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:flock-len)</span><!-- /@w --></code>

<p>Size; if 0 then until <code>eof</code>.
</p></li><li> <code>pid</code> &mdash; reader: <code><span class="nolinebreak">sb-posix:flock-pid</span><!-- /@w --></code>

<p>Process <code>id</code> of the process holding the lock; returned with F_GETLK.
</p></li></ul>

<p>Class representing locks used in fcntl(2).
</p></dd></dl>

</li><li> passwd
<a name="Class-sb_002dposix_003apasswd"></a><dl>
<dt><a name="index-passwd"></a>Class: <strong>passwd</strong> <em>[sb-posix]</em></dt>
<dd><p>Class precedence list: <code>passwd, standard-object, t</code>
</p>
<p>Slots:
</p><ul>
<li> <code>name</code> &mdash; initarg: <code>:name<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:passwd-name</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:passwd-name)</span><!-- /@w --></code>

<p>User&rsquo;s login name.
</p></li><li> <code>passwd</code> &mdash; initarg: <code>:passwd<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:passwd-passwd</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:passwd-passwd)</span><!-- /@w --></code>

<p>The account&rsquo;s encrypted password.
</p></li><li> <code>uid</code> &mdash; initarg: <code>:uid<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:passwd-uid</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:passwd-uid)</span><!-- /@w --></code>

<p>Numerical user <code>id</code>.
</p></li><li> <code>gid</code> &mdash; initarg: <code>:gid<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:passwd-gid</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:passwd-gid)</span><!-- /@w --></code>

<p>Numerical group <code>id</code>.
</p></li><li> <code>gecos</code> &mdash; initarg: <code>:gecos<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:passwd-gecos</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:passwd-gecos)</span><!-- /@w --></code>

<p>User&rsquo;s name or comment field.
</p></li><li> <code>dir</code> &mdash; initarg: <code>:dir<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:passwd-dir</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:passwd-dir)</span><!-- /@w --></code>

<p>Initial working directory.
</p></li><li> <code>shell</code> &mdash; initarg: <code>:shell<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:passwd-shell</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:passwd-shell)</span><!-- /@w --></code>

<p>Program to use as shell.
</p></li></ul>

<p>Instances of this class represent entries in the system&rsquo;s user database.
</p></dd></dl>

</li><li> stat
<a name="Class-sb_002dposix_003astat"></a><dl>
<dt><a name="index-stat"></a>Class: <strong>stat</strong> <em>[sb-posix]</em></dt>
<dd><p>Class precedence list: <code>stat, standard-object, t</code>
</p>
<p>Slots:
</p><ul>
<li> <code>mode</code> &mdash; initarg: <code>:mode<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-mode</span><!-- /@w --></code>

<p>Mode of file.
</p></li><li> <code>ino</code> &mdash; initarg: <code>:ino<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-ino</span><!-- /@w --></code>

<p>File serial number.
</p></li><li> <code>dev</code> &mdash; initarg: <code>:dev<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-dev</span><!-- /@w --></code>

<p>Device <code>id</code> of device containing file.
</p></li><li> <code>nlink</code> &mdash; initarg: <code>:nlink<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-nlink</span><!-- /@w --></code>

<p>Number of hard links to the file.
</p></li><li> <code>uid</code> &mdash; initarg: <code>:uid<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-uid</span><!-- /@w --></code>

<p>User <code>id</code> of file.
</p></li><li> <code>gid</code> &mdash; initarg: <code>:gid<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-gid</span><!-- /@w --></code>

<p>Group <code>id</code> of file.
</p></li><li> <code>size</code> &mdash; initarg: <code>:size<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-size</span><!-- /@w --></code>

<p>For regular files, the file size in
                         bytes.  For symbolic links, the length
                         in bytes of the filename contained in
                         the symbolic link.
</p></li><li> <code>rdev</code> &mdash; initarg: <code>:rdev<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-rdev</span><!-- /@w --></code>

<p>For devices the device number.
</p></li><li> <code>atime</code> &mdash; initarg: <code>:atime<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-atime</span><!-- /@w --></code>

<p>Time of last access.
</p></li><li> <code>mtime</code> &mdash; initarg: <code>:mtime<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-mtime</span><!-- /@w --></code>

<p>Time of last data modification.
</p></li><li> <code>ctime</code> &mdash; initarg: <code>:ctime<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:stat-ctime</span><!-- /@w --></code>

<p>Time of last status change.
</p></li></ul>

<p>Instances of this class represent <code>posix</code> file metadata.
</p></dd></dl>

</li><li> termios
<a name="Class-sb_002dposix_003atermios"></a><dl>
<dt><a name="index-termios"></a>Class: <strong>termios</strong> <em>[sb-posix]</em></dt>
<dd><p>Class precedence list: <code>termios, standard-object, t</code>
</p>
<p>Slots:
</p><ul>
<li> <code>iflag</code> &mdash; initarg: <code>:iflag<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:termios-iflag</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:termios-iflag)</span><!-- /@w --></code>

<p>Input modes.
</p></li><li> <code>oflag</code> &mdash; initarg: <code>:oflag<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:termios-oflag</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:termios-oflag)</span><!-- /@w --></code>

<p>Output modes.
</p></li><li> <code>cflag</code> &mdash; initarg: <code>:cflag<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:termios-cflag</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:termios-cflag)</span><!-- /@w --></code>

<p>Control modes.
</p></li><li> <code>lflag</code> &mdash; initarg: <code>:lflag<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:termios-lflag</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:termios-lflag)</span><!-- /@w --></code>

<p>Local modes.
</p></li><li> <code>cc</code> &mdash; initarg: <code>:cc<!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:termios-cc</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:termios-cc)</span><!-- /@w --></code>

<p>Control characters.
</p></li></ul>

<p>Instances of this class represent I/O characteristics of the terminal.
</p></dd></dl>

</li><li> timeval
<a name="Class-sb_002dposix_003atimeval"></a><dl>
<dt><a name="index-timeval"></a>Class: <strong>timeval</strong> <em>[sb-posix]</em></dt>
<dd><p>Class precedence list: <code>timeval, standard-object, t</code>
</p>
<p>Slots:
</p><ul>
<li> <code>sec</code> &mdash; initarg: <code><span class="nolinebreak">:tv-sec</span><!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:timeval-sec</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:timeval-sec)</span><!-- /@w --></code>

<p>Seconds.
</p></li><li> <code>usec</code> &mdash; initarg: <code><span class="nolinebreak">:tv-usec</span><!-- /@w --></code>; reader: <code><span class="nolinebreak">sb-posix:timeval-usec</span><!-- /@w --></code>; writer: <code>(setf&nbsp;<span class="nolinebreak">sb-posix:timeval-usec)</span><!-- /@w --></code>

<p>Microseconds.
</p></li></ul>

<p>Instances of this class represent time values.
</p></dd></dl>
</li></ul>

<hr>
<a name="Functions-with-idiosyncratic-bindings"></a>
<div class="header">
<p>
Previous: <a href="#Lisp-objects-and-C-structures" accesskey="p" rel="prev">Lisp objects and C structures</a>, Up: <a href="#sb_002dposix" accesskey="u" rel="up">sb-posix</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Functions-with-idiosyncratic-bindings-1"></a>
<h4 class="subsection">16.6.6 Functions with idiosyncratic bindings</h4>

<p>A few functions in sb-posix don&rsquo;t correspond directly to their C
counterparts.
</p>
<ul>
<li> getcwd
<a name="Function-sb_002dposix_003agetcwd"></a><dl>
<dt><a name="index-getcwd"></a>Function: <strong>getcwd</strong> <em>[sb-posix]</em></dt>
<dd><p>Returns the process&rsquo;s current working directory as a string.
</p></dd></dl>
</li><li> readlink
<a name="Function-sb_002dposix_003areadlink"></a><dl>
<dt><a name="index-readlink"></a>Function: <strong>readlink</strong> <em>[sb-posix] pathspec</em></dt>
<dd><p>Returns the resolved target of a symbolic link as a string.
</p></dd></dl>
</li><li> syslog
<a name="Function-sb_002dposix_003asyslog"></a><dl>
<dt><a name="index-syslog"></a>Function: <strong>syslog</strong> <em>[sb-posix] priority format &amp;rest args</em></dt>
<dd><p>Send a message to the syslog facility, with severity level
<code>priority</code>.  The message will be formatted as by <code>cl:format</code> (rather
than C&rsquo;s printf) with format string <code>format</code> and arguments <code>args</code>.
</p></dd></dl>
</li></ul>

<hr>
<a name="sb_002dqueue"></a>
<div class="header">
<p>
Next: <a href="#sb_002drotate_002dbyte" accesskey="n" rel="next">sb-rotate-byte</a>, Previous: <a href="#sb_002dposix" accesskey="p" rel="prev">sb-posix</a>, Up: <a href="#Contributed-Modules" accesskey="u" rel="up">Contributed Modules</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sb_002dqueue-1"></a>
<h3 class="section">16.7 sb-queue</h3>
<a name="index-Queue_002c-FIFO"></a>

<p>Since SBCL 1.0.38, the <code>sb-queue</code> module has been merged into the
<code>sb-concurrency</code> module (see <a href="#sb_002dconcurrency">sb-concurrency</a>.)
</p>
<hr>
<a name="sb_002drotate_002dbyte"></a>
<div class="header">
<p>
Previous: <a href="#sb_002dqueue" accesskey="p" rel="prev">sb-queue</a>, Up: <a href="#Contributed-Modules" accesskey="u" rel="up">Contributed Modules</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="sb_002drotate_002dbyte-1"></a>
<h3 class="section">16.8 sb-rotate-byte</h3>
<a name="index-Modular-arithmetic-1"></a>
<a name="index-Arithmetic_002c-modular-1"></a>
<a name="index-Arithmetic_002c-hardware-1"></a>

<p>The <code>sb-rotate-byte</code> module offers an interface to bitwise
rotation, with an efficient implementation for operations which can be
performed directly using the platform&rsquo;s arithmetic routines.  It
implements the specification at
<a href="http://www.cliki.net/ROTATE-BYTE">http://www.cliki.net/ROTATE-BYTE</a>.
</p>
<p>Bitwise rotation is a component of various cryptographic or hashing
algorithms: MD5, SHA-1, etc.; often these algorithms are specified on
32-bit rings.  [FIXME cite cite cite].
</p>
<a name="Function-sb_002drotate_002dbyte_003arotate_002dbyte"></a><dl>
<dt><a name="index-rotate_002dbyte"></a>Function: <strong>rotate-byte</strong> <em>[sb-rotate-byte] count bytespec integer</em></dt>
<dd><p>Rotates a field of bits within <code>integer</code>; specifically, returns an
integer that contains the bits of <code>integer</code> rotated <code>count</code> times
leftwards within the byte specified by <code>bytespec</code>, and elsewhere
contains the bits of <code>integer</code>.
</p></dd></dl>


<hr>
<a name="Deprecation"></a>
<div class="header">
<p>
Next: <a href="#Concept-Index" accesskey="n" rel="next">Concept Index</a>, Previous: <a href="#Contributed-Modules" accesskey="p" rel="prev">Contributed Modules</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Deprecation-1"></a>
<h2 class="chapter">17 Deprecation</h2>

<p>In order to support evolution of interfaces in SBCL as well as in user
code, SBCL allows declaring functions, variables and types as
deprecated. Users of deprecated things are notified by means of warnings
while the deprecated thing in question is still available.
</p>
<p>This chapter documents the interfaces for being notified when using
deprecated thing and declaring things as deprecated, the deprecation
process used for SBCL interfaces, and lists legacy interfaces in various
stages of deprecation.
</p>
<p><em>Deprecation</em> in this context should not be confused with those
things the ANSI Common Lisp standard calls <em>deprecated</em>: the
entirety of ANSI CL is supported by SBCL, and none of those interfaces
are subject to censure.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="#Why-Deprecate_003f" accesskey="1">Why Deprecate?</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#The-Deprecation-Pipeline" accesskey="2">The Deprecation Pipeline</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Deprecation-Conditions" accesskey="3">Deprecation Conditions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Introspecting-Deprecation-Information" accesskey="4">Introspecting Deprecation Information</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Deprecation-Declaration" accesskey="5">Deprecation Declaration</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Deprecation-Examples" accesskey="6">Deprecation Examples</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="#Deprecated-Interfaces-in-SBCL" accesskey="7">Deprecated Interfaces in SBCL</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<a name="Why-Deprecate_003f"></a>
<div class="header">
<p>
Next: <a href="#The-Deprecation-Pipeline" accesskey="n" rel="next">The Deprecation Pipeline</a>, Up: <a href="#Deprecation" accesskey="u" rel="up">Deprecation</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Why-Deprecate_003f-1"></a>
<h3 class="section">17.1 Why Deprecate?</h3>
<a name="index-Why-Deprecate_003f"></a>

<p>While generally speaking we try to keep SBCL changes as backwards
compatible as feasible, there are situations when existing interfaces
are deprecated:
</p>
<ul>
<li> <strong>Broken Interfaces</strong>

<p>Sometimes it turns out that an interface is sufficiently misdesigned
that fixing it would be worse than deprecating it and replacing it
with another.
</p>
<p>This is typically the case when fixing the interface would change its
semantics in ways that could break user code subtly: in such cases we
may end up considering the obvious breakage caused by deprecation to
be preferable.
</p>
<p>Another example are functions or macros whose current signature makes
them hard or impossible to extend in the future: backwards compatible
extensions would either make the interface intolerably hairy, or are
sometimes outright impossible.
</p>
</li><li> <strong>Internal Interfaces</strong>

<p>SBCL has several internal interfaces that were never meant to be used
in user code &ndash; or at least never meant to be used in user code
unwilling to track changes to SBCL internals.
</p>
<p>Ideally we&rsquo;d like to be free to refactor our own internals as we
please, without even going through the hassle of deprecating things.
Sometimes, however, it turns out that our internal interfaces have
several external users who aren&rsquo;t using them advisedly, but due to
misunderstandings regarding their status or stability.
</p>
<p>Consider a deprecated internal interface a reminder for SBCL
maintainers not to delete the thing just yet, even though it is seems
unused &ndash; because it has external users.
</p>
<p>When internal interfaces are deprecated we try our best to provide
supported alternatives.
</p>
</li><li> <strong>Aesthetics &amp; Ease of Maintenance</strong>

<p>Sometimes an interface isn&rsquo;t broken or internal, but just inconsistent
somehow.
</p>
<p>This mostly happens only with historical interfaces inherited from
CMUCL which often haven&rsquo;t been officially supported in SBCL before, or
with new extensions to SBCL that haven&rsquo;t been around for very long in
the first place.
</p>
<p>The alternative would be to keep the suboptimal version around
forever, possibly alongside an improved version. Sometimes we may do
just that, but because every line of code comes with a maintenance
cost, sometimes we opt to deprecate the suboptimal version instead:
SBCL doesn&rsquo;t have infinite developer resources.
</p>
<p>We also believe that sometimes cleaning out legacy interfaces helps
keep the whole system more comprehensible to users, and makes
introspective tools such as <code>apropos</code> more useful.
</p>
</li></ul>

<hr>
<a name="The-Deprecation-Pipeline"></a>
<div class="header">
<p>
Next: <a href="#Deprecation-Conditions" accesskey="n" rel="next">Deprecation Conditions</a>, Previous: <a href="#Why-Deprecate_003f" accesskey="p" rel="prev">Why Deprecate?</a>, Up: <a href="#Deprecation" accesskey="u" rel="up">Deprecation</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="The-Deprecation-Pipeline-1"></a>
<h3 class="section">17.2 The Deprecation Pipeline</h3>
<a name="index-The-Deprecation-Pipeline"></a>

<p>SBCL uses a <em>deprecation pipeline</em> with multiple stages: as time
goes by, deprecated things move from earlier stages of deprecation to
later stages before finally being removed. The intention is making users
aware of necessary changes early but allowing a migration to new
interfaces at a reasonable pace.
</p>
<p>Deprecation proceeds in three stages, each lasting approximately a
year. In some cases it might move slower or faster, but one year per
stage is what we aim at in general. During each stage warnings (and
errors) of increasing severity are signaled, which note that the
interface is deprecated, and point users towards any replacements when
applicable.
</p>
<ol>
<li> <strong>Early Deprecation</strong>

<p>During early deprecation the interface is kept in working
condition. However, when a thing in this deprecation stage is used, an
early-deprecation-warning [sb-ext], which is a style-warning [cl], is
signaled at compile-time.
</p>
<p>The internals may change at this stage: typically because the interface
is re-implemented on top of its successor. While we try to keep things
as backwards-compatible as feasible (taking maintenance costs into account),
sometimes semantics change slightly.
</p>
<p>For example, when the spinlock API was deprecated, spinlock objects ceased
to exist, and the whole spinlock API became a synonym for the mutex
API &ndash; so code using the spinlock API continued working, but silently
switched to mutexes instead. However, if someone relied on
</p>
<p><code>(typep lock 'spinlock)</code>
</p>
<p>returning <code>NIL</code> for a mutexes, trouble could ensue.
</p>
</li><li> <strong>Late Deprecation</strong>

<p>During late deprecation the interface remains as it was during early
deprecation, but the compile-time warning is upgraded: when a thing in
this deprecation stage is used, a late-deprecation-warning [sb-ext],
which is a full warning [cl], is signaled at compile-time.
</p>
</li><li> <strong>Final Deprecation</strong>

<p>During final deprecation the symbols still exist. However, when a thing
in this deprecation stage is used, a final-deprecation-warning [sb-ext],
which is a full warning [cl], is signaled at compile-time and an
error [cl] is signaled at run-time.
</p>
</li><li> <strong>After Final Deprecation</strong>

<p>The interface is deleted entirely.
</p>
</li></ol>

<hr>
<a name="Deprecation-Conditions"></a>
<div class="header">
<p>
Next: <a href="#Introspecting-Deprecation-Information" accesskey="n" rel="next">Introspecting Deprecation Information</a>, Previous: <a href="#The-Deprecation-Pipeline" accesskey="p" rel="prev">The Deprecation Pipeline</a>, Up: <a href="#Deprecation" accesskey="u" rel="up">Deprecation</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Deprecation-Conditions-1"></a>
<h3 class="section">17.3 Deprecation Conditions</h3>
<a name="index-Deprecation-Conditions"></a>

<p>deprecation-condition [sb-ext] is the superclass of all
deprecation-related warning and error conditions. All common slots and
readers are defined in this condition class.
</p>
<a name="Condition-sb_002dext_003adeprecation_002dcondition"></a><dl>
<dt><a name="index-deprecation_002dcondition"></a>Condition: <strong>deprecation-condition</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>deprecation-condition, condition, t</code>
</p>
<p>Superclass for deprecation-related error and warning
conditions.
</p></dd></dl>

<a name="Condition-sb_002dext_003aearly_002ddeprecation_002dwarning"></a><dl>
<dt><a name="index-early_002ddeprecation_002dwarning"></a>Condition: <strong>early-deprecation-warning</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>early-deprecation-warning, style-warning, warning, deprecation-condition, condition, t</code>
</p>
<p>This warning is signaled when the use of a variable,
function, type, etc. in <code>:early</code> deprecation is detected at
compile-time. The use will work at run-time with no warning or
error.
</p></dd></dl>

<a name="Condition-sb_002dext_003alate_002ddeprecation_002dwarning"></a><dl>
<dt><a name="index-late_002ddeprecation_002dwarning"></a>Condition: <strong>late-deprecation-warning</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>late-deprecation-warning, warning, deprecation-condition, condition, t</code>
</p>
<p>This warning is signaled when the use of a variable,
function, type, etc. in <code>:late</code> deprecation is detected at
compile-time. The use will work at run-time with no warning or
error.
</p></dd></dl>

<a name="Condition-sb_002dext_003afinal_002ddeprecation_002dwarning"></a><dl>
<dt><a name="index-final_002ddeprecation_002dwarning"></a>Condition: <strong>final-deprecation-warning</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>final-deprecation-warning, warning, deprecation-condition, condition, t</code>
</p>
<p>This warning is signaled when the use of a variable,
function, type, etc. in <code>:final</code> deprecation is detected at
compile-time. An error will be signaled at run-time.
</p></dd></dl>

<a name="Condition-sb_002dext_003adeprecation_002derror"></a><dl>
<dt><a name="index-deprecation_002derror"></a>Condition: <strong>deprecation-error</strong> <em>[sb-ext]</em></dt>
<dd><p>Class precedence list: <code>deprecation-error, error, serious-condition, deprecation-condition, condition, t</code>
</p>
<p>This error is signaled at run-time when an attempt is made to use
a thing that is in <code>:final</code> deprecation, i.e. call a function or access
a variable.
</p></dd></dl>

<hr>
<a name="Introspecting-Deprecation-Information"></a>
<div class="header">
<p>
Next: <a href="#Deprecation-Declaration" accesskey="n" rel="next">Deprecation Declaration</a>, Previous: <a href="#Deprecation-Conditions" accesskey="p" rel="prev">Deprecation Conditions</a>, Up: <a href="#Deprecation" accesskey="u" rel="up">Deprecation</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Introspecting-Deprecation-Information-1"></a>
<h3 class="section">17.4 Introspecting Deprecation Information</h3>
<a name="index-Introspecting-Deprecation-Information"></a>

<p>The deprecation status of functions and variables can be inspected using
the <code>sb-cltl2:function-information</code> and
<code>sb-cltl2:variable-information</code> functions provided by the
<code>sb-cltl2</code> contributed module.
</p>
<hr>
<a name="Deprecation-Declaration"></a>
<div class="header">
<p>
Next: <a href="#Deprecation-Examples" accesskey="n" rel="next">Deprecation Examples</a>, Previous: <a href="#Introspecting-Deprecation-Information" accesskey="p" rel="prev">Introspecting Deprecation Information</a>, Up: <a href="#Deprecation" accesskey="u" rel="up">Deprecation</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Deprecation-Declaration-1"></a>
<h3 class="section">17.5 Deprecation Declaration</h3>
<a name="index-Deprecation-Declaration"></a>
<a name="index-deprecated-_005bsb_002dext_005d"></a>

<p>The <code>sb-ext:deprecated</code> declaration can be used to declare objects
in various namespaces<a name="DOCF11" href="#FOOT11"><sup>11</sup></a> as deprecated.
</p>
<dl>
<dt><a name="index-deprecated"></a>Declaration: <strong>deprecated</strong> <em>[sb-ext]</em></dt>
<dd>
<p>Syntax:
</p><div class="example">
<pre class="example"><code>sb-ext:deprecated</code> stage since {object-clause}*

stage ::= {:early | :late | :final}

since ::= {<var>version</var> | (<var>software</var> <var>version</var>)}

object-clause ::= (namespace <var>name</var> [:replacement <var>replacement</var>])

namespace ::= {cl:variable | cl:function | cl:type}
</pre></div>

<p>were <var>name</var> is the name of the deprecated thing,
<var>version</var> and <var>software</var> are strings describing the version in
which the thing has been deprecated and <var>replacement</var> is a name or a
list of names designating things that should be used instead of the
deprecated thing.
</p>
<p>Currently the following namespaces are supported:
</p>
<dl compact="compact">
<dt><code>cl:function</code></dt>
<dd><p>Declare functions, compiler-macros or macros as deprecated.
</p>
<blockquote>
<p><b>note:</b> When declaring a function to be in <code>:final</code> deprecation, there
should be no actual definition of the function as the declaration emits
a stub function that signals a deprecation-error [sb-ext] at run-time
when called.
</p></blockquote>

</dd>
<dt><code>cl:variable</code></dt>
<dd><p>Declare special and global variables, constants and symbol-macros as
deprecated.
</p>
<blockquote>
<p><b>note:</b> When declaring a variable to be in <code>:final</code> deprecation, there
should be no actual definition of the variable as the declaration emits
a symbol-macro that signals a <code>sb-ext:deprecation-error</code> at
run-time when accessed.
</p></blockquote>

</dd>
<dt><code>cl:type</code></dt>
<dd><p>Declare named types (i.e. defined via <code>deftype</code>), standard classes,
structure classes and condition classes as deprecated.
</p>
</dd>
</dl>
</dd></dl>

<hr>
<a name="Deprecation-Examples"></a>
<div class="header">
<p>
Next: <a href="#Deprecated-Interfaces-in-SBCL" accesskey="n" rel="next">Deprecated Interfaces in SBCL</a>, Previous: <a href="#Deprecation-Declaration" accesskey="p" rel="prev">Deprecation Declaration</a>, Up: <a href="#Deprecation" accesskey="u" rel="up">Deprecation</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Deprecation-Examples-1"></a>
<h3 class="section">17.6 Deprecation Examples</h3>
<a name="index-Deprecation-Examples"></a>

<p>Marking functions as deprecated:
</p><div class="lisp">
<pre class="lisp">(defun foo ())
(defun bar ())
(declaim (deprecated :early (&quot;my-system&quot; &quot;1.2.3&quot;)
                     (function foo :replacement bar)))

;; Remember: do not define the actual function or variable in case of
;; :final deprecation:
(declaim (deprecated :final (&quot;my-system&quot; &quot;1.2.3&quot;)
                     (function fez :replacement whoop)))
</pre></div>

<p>Attempting to use the deprecated functions:
</p><div class="lisp">
<pre class="lisp">(defun baz ()
  (foo))
| STYLE-WARNING: The function CL-USER::FOO has been deprecated...
=&gt; BAZ
(baz)
=&gt; NIL ; no error

(defun danger ()
  (fez))
| WARNING: The function CL-USER::FEZ has been deprecated...
=&gt; DANGER
(danger)
|- ERROR: The function CL-USER::FEZ has been deprecated...
</pre></div>

<hr>
<a name="Deprecated-Interfaces-in-SBCL"></a>
<div class="header">
<p>
Previous: <a href="#Deprecation-Examples" accesskey="p" rel="prev">Deprecation Examples</a>, Up: <a href="#Deprecation" accesskey="u" rel="up">Deprecation</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Deprecated-Interfaces-in-SBCL-1"></a>
<h3 class="section">17.7 Deprecated Interfaces in SBCL</h3>

<p>This sections lists legacy interfaces in various stages of deprecation.
</p>
<a name="List-of-Deprecated-Interfaces"></a>
<h4 class="subsection">17.7.1 List of Deprecated Interfaces</h4>

<a name="Early-Deprecation"></a>
<h4 class="subsubsection">17.7.1.1 Early Deprecation</h4>

<ul>
<li> <strong>SOCKINT::WIN32-*</strong>

<p>Deprecated in favor of the corresponding prefix-less functions
(e.g. <code>sockint::bind</code> replaces <code>sockint::win32-bind</code>) as of
1.2.10 in March 2015. Expected to move into late deprecation in August
2015.
</p>
<br>
</li><li> <strong>SB-UNIX:UNIX-EXIT</strong>

<p>Deprecated as of 1.0.56.55 in May 2012. Expected to move into late
deprecation in May 2013.
</p>
<p>When the SBCL process termination was refactored as part of changes that
led to <code>sb-ext:quit</code> being deprecated, <code>sb-unix:unix-exit</code>
ceased to be used internally. Since <code>SB-UNIX</code> is an internal package
not intended for user code to use, and since we&rsquo;re slowly in the process
of refactoring things to be less Unix-oriented, <code>sb-unix:unix-exit</code>
was initially deleted as it was no longer used. Unfortunately it became
apparent that it was used by several external users, so it was re-instated
in deprecated form.
</p>
<p>While the cost of keeping <code>sb-unix:unix-exit</code> indefinitely is
trivial, the ability to refactor our internals is important, so its
deprecation was taken as an opportunity to highlight that
<code>SB-UNIX</code> is an internal package and <code>SB-POSIX</code> should be
used by user-programs instead &ndash; or alternatively calling the foreign
function directly if the desired interface doesn&rsquo;t for some reason
exist in <code>SB-POSIX</code>.
</p>
<p><strong>Remedy</strong>
</p>
<p>For code needing to work with legacy SBCLs, use e.g. <code>system-exit</code>
as show above in remedies for <code>sb-ext:quit</code>. In modern SBCLs
simply call either <code>sb-posix:exit</code> or <code>sb-ext:exit</code> with
appropriate arguments.
</p>
<br>
</li><li> <strong>SB-C::MERGE-TAIL-CALLS Compiler Policy</strong>

<p>Deprecated as of 1.0.53.74 in November 2011. Expected to move into
late deprecation in November 2012.
</p>
<p>This compiler policy was never functional: SBCL has always merged tail
calls when it could, regardless of this policy setting. (It was also
never officially supported, but several code-bases have historically
used it.)
</p>
<p><strong>Remedy</strong>
</p>
<p>Simply remove the policy declarations. They were never necessary: SBCL
always merged tail-calls when possible. To disable tail merging,
structure the code to avoid the tail position instead.
</p>
<br>
</li><li> <strong>Spinlock API</strong>

<p>Deprecated as of 1.0.53.11 in August 2011. Expected to move into late
deprecation in August 2012.
</p>
<p>Spinlocks were an internal interface, but had a number of external users
and were hence deprecated instead of being simply deleted.
</p>
<p>Affected symbols: <code>sb-thread::spinlock</code>,
<code>sb-thread::make-spinlock</code>, <code>sb-thread::with-spinlock</code>,
<code>sb-thread::with-recursive-spinlock</code>,
<code>sb-thread::get-spinlock</code>, <code>sb-thread::release-spinlock</code>,
<code>sb-thread::spinlock-value</code>, and <code>sb-thread::spinlock-name</code>.
</p>
<p><strong>Remedy</strong>
</p>
<p>Use the mutex API instead, or implement spinlocks suiting your needs
on top of <code>sb-ext:compare-and-swap</code>,
<code>sb-ext:spin-loop-hint</code>, etc.
</p>
</li><li> <strong>SOCKINT::HANDLE-&gt;FD</strong>, <strong>SOCKINT::FD-&gt;HANDLE</strong>

<p>Internally deprecated in 2012. Declared deprecated as of 1.2.10 in March
2015. Expected to move into final deprecation in August 2015.
</p>
</li></ul>

<a name="Late-Deprecation"></a>
<h4 class="subsubsection">17.7.1.2 Late Deprecation</h4>

<ul>
<li> <strong>SB-THREAD:JOIN-THREAD-ERROR-THREAD and SB-THREAD:INTERRUPT-THREAD-ERROR-THREAD</strong>

<p>Deprecated in favor of <code>sb-thread:thread-error-thread</code> as of
1.0.29.17 in June 2009. Expected to move into final deprecation in
June 2012.
</p>
<p><strong>Remedy</strong>
</p>
<p>For code that needs to support legacy SBCLs, use e.g.:
</p>
<br>
<div class="lisp">
<pre class="lisp">(defun get-thread-error-thread (condition)
  #+#.(cl:if (cl:find-symbol &quot;THREAD-ERROR-THREAD&quot; :sb-thread)
             '(and) '(or))
  (sb-thread:thread-error-thread condition)
  #-#.(cl:if (cl:find-symbol &quot;THREAD-ERROR-THREAD&quot; :sb-thread)
             '(and) '(or))
  (etypecase condition
   (sb-thread:join-thread-error
    (sb-thread:join-thread-error-thread condition))
   (sb-thread:interrupt-thread-error
    (sb-thread:interrupt-thread-error-thread condition))))
</pre></div>
<br>

<br>
</li><li> <strong>SB-INTROSPECT:FUNCTION-ARGLIST</strong>

<p>Deprecated in favor of <code>sb-introspect:function-lambda-list</code> as of
1.0.24.5 in January 2009. Expected to move into final deprecation in
January 2012.
</p>
<p>Renamed for consistency and aesthetics. Functions have lambda-lists,
not arglists.
</p>
<p><strong>Remedy</strong>
</p>
<p>For code that needs to support legacy SBCLs, use e.g.:
</p>
<br>
<div class="lisp">
<pre class="lisp">(defun get-function-lambda-list (function)
  #+#.(cl:if (cl:find-symbol &quot;FUNCTION-LAMBDA-LIST&quot; :sb-introspect)
             '(and) '(or))
  (sb-introspect:function-lambda-list function)
  #-#.(cl:if (cl:find-symbol &quot;FUNCTION-LAMBDA-LIST&quot; :sb-introspect)
             '(and) '(or))
  (sb-introspect:function-arglist function))
</pre></div>
<br>

<br>
</li><li> <strong>Stack Allocation Policies</strong>

<p>Deprecated in favor of <code>sb-ext:*stack-allocate-dynamic-extent*</code>
as of 1.0.19.7 in August 2008, and are expected to be removed in
August 2012.
</p>
<p>Affected symbols: <code>sb-c::stack-allocate-dynamic-extent</code>,
<code>sb-c::stack-allocate-vector</code>, and
<code>sb-c::stack-allocate-value-cells</code>.
</p>
<p>These compiler policies were never officially supported, and turned
out the be a flawed design.
</p>
<p><strong>Remedy</strong>
</p>
<p>For code that needs stack-allocation in legacy SBCLs, conditionalize
using:
</p>
<br>
<div class="lisp">
<pre class="lisp">#-#.(cl:if (cl:find-symbol &quot;*STACK-ALLOCATE-DYNAMIC-EXTENT*&quot; :sb-ext)
           '(and) '(or))
(declare (optimize sb-c::stack-allocate-dynamic-extent))
</pre></div>
<br>

<p>However, unless stack allocation is essential, we recommend simply
removing these declarations. Refer to documentation on
<code>sb-ext:*stack-allocate-dynamic*</code> for details on stack allocation
control in modern SBCLs.
</p>
<br>
</li><li> <strong>SB-SYS:OUTPUT-RAW-BYTES</strong>

<p>Deprecated as of 1.0.8.16 in June 2007. Expected to move into final
deprecation in June 2012.
</p>
<p>Internal interface with some external users. Never officially
supported, deemed unnecessary in presence of <code>write-sequence</code> and
bivalent streams.
</p>
<p><strong>Remedy</strong>
</p>
<p>Use streams with element-type <code>(unsigned-byte 8)</code>
or <code>:default</code> &ndash; the latter allowing both binary and
character IO &ndash; in conjunction with <code>write-sequence</code>.
</p>
</li></ul>

<a name="Final-Deprecation"></a>
<h4 class="subsubsection">17.7.1.3 Final Deprecation</h4>

<p>No interfaces are currently in final deprecation.
</p>
<a name="Historical-Interfaces"></a>
<h4 class="subsection">17.7.2 Historical Interfaces</h4>

<p>The following is a partial list of interfaces present in historical
versions of SBCL, which have since then been deleted.
</p>
<ul>
<li> <strong>SB-KERNEL:INSTANCE-LAMBDA</strong>

<p>Historically needed for CLOS code. Deprecated as of 0.9.3.32 in August
2005. Deleted as of 1.0.47.8 in April 2011. Plain <code>lambda</code> can be
used where <code>sb-kernel:instance-lambda</code> used to be needed.
</p>
<br>
</li><li> <strong>SB-ALIEN:DEF-ALIEN-ROUTINE, SB-ALIEN:DEF-ALIEN-VARIABLE, SB-ALIEN:DEF-ALIEN-TYPE</strong>

<p>Inherited from CMUCL, naming convention not consistent with preferred
SBCL style. Deprecated as of 0.pre7.90 in December 2001. Deleted as of
1.0.9.17 in September 2007. Replaced by
<code>sb-alien:define-alien-routine</code>,
<code>sb-alien:define-alien-variable</code>, and
<code>sb-alien:define-alien-type</code>.
</p>
</li></ul>
<hr>
<a name="Concept-Index"></a>
<div class="header">
<p>
Next: <a href="#Function-Index" accesskey="n" rel="next">Function Index</a>, Previous: <a href="#Deprecation" accesskey="p" rel="prev">Deprecation</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Concept-Index-1"></a>
<h2 class="appendix">Appendix A Concept Index</h2>

<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Concept-Index_cp_letter-A"><b>A</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-B"><b>B</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-D"><b>D</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-F"><b>F</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-O"><b>O</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-P"><b>P</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-Q"><b>Q</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-R"><b>R</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-S"><b>S</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-T"><b>T</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-U"><b>U</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-V"><b>V</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-W"><b>W</b></a>
 &nbsp; 
</td></tr></table>
<table class="index-cp" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Actual-Source">Actual Source</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Parts-of-a-Compiler-Diagnostic">The Parts of a Compiler Diagnostic</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Actual-Source-1">Actual Source</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Original-and-Actual-Source">The Original and Actual Source</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Arithmetic_002c-hardware">Arithmetic, hardware</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Modular-arithmetic">Modular arithmetic</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Arithmetic_002c-hardware-1">Arithmetic, hardware</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002drotate_002dbyte">sb-rotate-byte</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Arithmetic_002c-modular">Arithmetic, modular</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Modular-arithmetic">Modular arithmetic</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Arithmetic_002c-modular-1">Arithmetic, modular</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002drotate_002dbyte">sb-rotate-byte</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Asynchronous-Timeout">Asynchronous Timeout</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Asynchronous-Timeouts">Asynchronous Timeouts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Availability-of-debug-variables">Availability of debug variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Variable-Value-Availability">Variable Value Availability</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Block-compilation_002c-debugger-implications">Block compilation, debugger implications</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Entry-Point-Details">Entry Point Details</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Block_002c-basic">Block, basic</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Source-Location-Availability">Source Location Availability</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Block_002c-start-location">Block, start location</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Source-Location-Availability">Source Location Availability</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Cleanup_002c-stack-frame-kind">Cleanup, stack frame kind</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Entry-Point-Details">Entry Point Details</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Code-Coverage">Code Coverage</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dcover">sb-cover</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Compatibility-with-other-Lisps">Compatibility with other Lisps</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Getting-Existing-Programs-to-Run">Getting Existing Programs to Run</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Compile-time-type-errors">Compile time type errors</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Type-Errors-at-Compile-Time">Type Errors at Compile Time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Compiler-Diagnostic-Severity">Compiler Diagnostic Severity</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Compiler-messages">Compiler messages</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Messages">Diagnostic Messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Concurrency">Concurrency</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Deadline">Deadline</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Synchronous-Timeouts-_0028Deadlines_0029">Synchronous Timeouts (Deadlines)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Debug-optimization-quality">Debug optimization quality</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Variable-Value-Availability">Variable Value Availability</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Debug-optimization-quality-1">Debug optimization quality</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Source-Location-Availability">Source Location Availability</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Debug-optimization-quality-2">Debug optimization quality</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debugger-Policy-Control">Debugger Policy Control</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Debug-variables">Debug variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Variable-Access">Variable Access</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Debugger">Debugger</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debugger">Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debugger_002c-disabling">debugger, disabling</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-debugger_002c-enabling">debugger, enabling</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-declaration_002c-dynamic_002dextent">declaration, <code>dynamic-extent</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Declarations">Declarations</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Deprecation-Conditions">Deprecation Conditions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Conditions">Deprecation Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Deprecation-Declaration">Deprecation Declaration</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Declaration">Deprecation Declaration</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Deprecation-Examples">Deprecation Examples</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Examples">Deprecation Examples</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disabling-debugger">disabling debugger</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disabling-ldb">disabling ldb</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Runtime-Options">Runtime Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disabling-ldb-1">disabling ldb</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-dynamic_002dextent-declaration"><code>dynamic-extent</code> declaration</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Efficiency">Efficiency</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Efficiency">Efficiency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Entry-points_002c-external">Entry points, external</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Entry-Point-Details">Entry Point Details</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Errors_002c-run_002dtime">Errors, run-time</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unknown-Locations-and-Interrupts">Unknown Locations and Interrupts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Existing-programs_002c-to-run">Existing programs, to run</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Getting-Existing-Programs-to-Run">Getting Existing Programs to Run</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-External-entry-points">External entry points</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Entry-Point-Details">Entry Point Details</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-External-formats">External formats</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Foreign-Type-Specifiers">Foreign Type Specifiers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-External-formats-1">External formats</a>:</td><td>&nbsp;</td><td valign="top"><a href="#External-Formats">External Formats</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-External_002c-stack-frame-kind">External, stack frame kind</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Entry-Point-Details">Entry Point Details</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Fast-Read-Lock">Fast Read Lock</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Finalization">Finalization</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Foreign-Function-Interface_002c-generation">Foreign Function Interface, generation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dgrovel">sb-grovel</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Frlock">Frlock</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Function_002c-tracing">Function, tracing</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Function-Tracing">Function Tracing</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Garbage-collection">Garbage collection</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Garbage-Collection_002c-conservative">Garbage Collection, conservative</a>:</td><td>&nbsp;</td><td valign="top"><a href="#History-and-Implementation-of-SBCL">History and Implementation of SBCL</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Garbage-Collection_002c-generational">Garbage Collection, generational</a>:</td><td>&nbsp;</td><td valign="top"><a href="#History-and-Implementation-of-SBCL">History and Implementation of SBCL</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Gate">Gate</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Hash-tables">Hash tables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Hash-Table-Extensions">Hash Table Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Hashing_002c-cryptographic">Hashing, cryptographic</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dmd5">sb-md5</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Inline-expansion">Inline expansion</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Open-Coding-and-Inline-Expansion">Open Coding and Inline Expansion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Inline-expansion-1">Inline expansion</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debugger-Policy-Control">Debugger Policy Control</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Interpreter">Interpreter</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Interpreter">Interpreter</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Interrupts">Interrupts</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unknown-Locations-and-Interrupts">Unknown Locations and Interrupts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Introspecting-Deprecation-Information">Introspecting Deprecation Information</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Introspecting-Deprecation-Information">Introspecting Deprecation Information</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-ldb">ldb</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Reporting-Bugs">Reporting Bugs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ldb-1">ldb</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Runtime-Options">Runtime Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ldb-2">ldb</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Runtime-Options">Runtime Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ldb_002c-disabling">ldb, disabling</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Runtime-Options">Runtime Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ldb_002c-disabling-1">ldb, disabling</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ldb_002c-enabling">ldb, enabling</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Locations_002c-unknown">Locations, unknown</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unknown-Locations-and-Interrupts">Unknown Locations and Interrupts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Logical-pathnames">Logical pathnames</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-Pathnames">Lisp Pathnames</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Macroexpansion">Macroexpansion</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Processing-Path">The Processing Path</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Macroexpansion_002c-errors-during">Macroexpansion, errors during</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Errors-During-Macroexpansion">Errors During Macroexpansion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Mailbox_002c-lock_002dfree">Mailbox, lock-free</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Messages_002c-Compiler">Messages, Compiler</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Messages">Diagnostic Messages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Modular-arithmetic">Modular arithmetic</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Modular-arithmetic">Modular arithmetic</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Modular-arithmetic-1">Modular arithmetic</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002drotate_002dbyte">sb-rotate-byte</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Open_002dcoding">Open-coding</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Open-Coding-and-Inline-Expansion">Open Coding and Inline Expansion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Operating-System-Interface">Operating System Interface</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dposix">sb-posix</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-optimization-quality_002c-safety">optimization quality, <code>safety</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Optimize-declaration">Optimize declaration</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debugger-Policy-Control">Debugger Policy Control</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Optional_002c-stack-frame-kind">Optional, stack frame kind</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Entry-Point-Details">Entry Point Details</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Original-Source">Original Source</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Parts-of-a-Compiler-Diagnostic">The Parts of a Compiler Diagnostic</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Original-Source-1">Original Source</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Original-and-Actual-Source">The Original and Actual Source</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Package_002dLocal-Nicknames">Package-Local Nicknames</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package_002dLocal-Nicknames">Package-Local Nicknames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Packages_002c-locked">Packages, locked</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Locks">Package Locks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Pathnames">Pathnames</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Pathnames">Pathnames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Pathnames_002c-logical">Pathnames, logical</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-Pathnames">Lisp Pathnames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Policy_002c-debugger">Policy, debugger</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debugger-Policy-Control">Debugger Policy Control</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Posix">Posix</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dposix">sb-posix</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Precise-type-checking">Precise type checking</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Precise-Type-Checking">Precise Type Checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Processing-Path">Processing Path</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Parts-of-a-Compiler-Diagnostic">The Parts of a Compiler Diagnostic</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Processing-Path-1">Processing Path</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Processing-Path">The Processing Path</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Profiling">Profiling</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Profiling">Profiling</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Profiling_002c-deterministic">Profiling, deterministic</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deterministic-Profiler">Deterministic Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Profiling_002c-statistical">Profiling, statistical</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-Q">Q</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Queue_002c-FIFO">Queue, FIFO</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dqueue">sb-queue</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Queue_002c-lock_002dfree">Queue, lock-free</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Random-Number-Generation">Random Number Generation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Random-Number-Generation">Random Number Generation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Read-errors_002c-compiler">Read errors, compiler</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Read-Errors">Read Errors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Read_002dEval_002dPrint-Loop">Read-Eval-Print Loop</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002daclrepl">sb-aclrepl</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Reader-Extensions">Reader Extensions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Reader-Extensions">Reader Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Recursion_002c-tail">Recursion, tail</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debug-Tail-Recursion">Debug Tail Recursion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-REPL">REPL</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002daclrepl">sb-aclrepl</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Safety-optimization-quality">Safety optimization quality</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Declarations-as-Assertions">Declarations as Assertions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Safety-optimization-quality-1">Safety optimization quality</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-safety-optimization-quality"><code>safety</code> optimization quality</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Sb_002dconcurrency">Sb-concurrency</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Semi_002dinline-expansion">Semi-inline expansion</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debugger-Policy-Control">Debugger Policy Control</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Severity-of-compiler-messages">Severity of compiler messages</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Single-Stepping">Single Stepping</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Single-Stepping">Single Stepping</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Slot-access">Slot access</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Slot-access">Slot access</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Sockets_002c-Networking">Sockets, Networking</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Networking">Networking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Source-location-printing_002c-debugger">Source location printing, debugger</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Source-Location-Printing">Source Location Printing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Source_002dto_002dsource-transformation">Source-to-source transformation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Processing-Path">The Processing Path</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Stack-frames">Stack frames</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Stack-Frames">Stack Frames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Static-functions">Static functions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Open-Coding-and-Inline-Expansion">Open Coding and Inline Expansion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Stepper">Stepper</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Single-Stepping">Single Stepping</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Synchronous-Timeout">Synchronous Timeout</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Synchronous-Timeouts-_0028Deadlines_0029">Synchronous Timeouts (Deadlines)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-System-Calls">System Calls</a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dposix">sb-posix</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Tail-recursion">Tail recursion</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debug-Tail-Recursion">Debug Tail Recursion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-The-Deprecation-Pipeline">The Deprecation Pipeline</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Deprecation-Pipeline">The Deprecation Pipeline</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Timeout">Timeout</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timeout-Parameters">Timeout Parameters</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Timeout-1">Timeout</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Synchronous-Timeouts-_0028Deadlines_0029">Synchronous Timeouts (Deadlines)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Timeout-2">Timeout</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Asynchronous-Timeouts">Asynchronous Timeouts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Tracing">Tracing</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Function-Tracing">Function Tracing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Type-checking_002c-at-compile-time">Type checking, at compile time</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Type-Errors-at-Compile-Time">Type Errors at Compile Time</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Type-checking_002c-precise">Type checking, precise</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Precise-Type-Checking">Precise Type Checking</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Types_002c-portability">Types, portability</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Getting-Existing-Programs-to-Run">Getting Existing Programs to Run</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Unknown-code-locations">Unknown code locations</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unknown-Locations-and-Interrupts">Unknown Locations and Interrupts</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Validity-of-debug-variables">Validity of debug variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Variable-Value-Availability">Variable Value Availability</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Variables_002c-debugger-access">Variables, debugger access</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Variable-Access">Variable Access</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Concept-Index_cp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-Weak-pointers">Weak pointers</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-Why-Deprecate_003f">Why Deprecate?</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Why-Deprecate_003f">Why Deprecate?</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Concept-Index_cp_letter-A"><b>A</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-B"><b>B</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-D"><b>D</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-F"><b>F</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-O"><b>O</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-P"><b>P</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-Q"><b>Q</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-R"><b>R</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-S"><b>S</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-T"><b>T</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-U"><b>U</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-V"><b>V</b></a>
 &nbsp; 
<a class="summary-letter" href="#Concept-Index_cp_letter-W"><b>W</b></a>
 &nbsp; 
</td></tr></table>

<hr>
<a name="Function-Index"></a>
<div class="header">
<p>
Next: <a href="#Variable-Index" accesskey="n" rel="next">Variable Index</a>, Previous: <a href="#Concept-Index" accesskey="p" rel="prev">Concept Index</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Function-Index-1"></a>
<h2 class="appendix">Appendix B Function Index</h2>

<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Function-Index_fn_symbol-1"><b>(</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_symbol-2"><b>?</b></a>
 &nbsp; 
<br>
<a class="summary-letter" href="#Function-Index_fn_letter-A"><b>A</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-B"><b>B</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-D"><b>D</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-F"><b>F</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-J"><b>J</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-N"><b>N</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-O"><b>O</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-P"><b>P</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-Q"><b>Q</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-R"><b>R</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-S"><b>S</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-T"><b>T</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-U"><b>U</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-V"><b>V</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-W"><b>W</b></a>
 &nbsp; 
</td></tr></table>
<table class="index-fn" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_symbol-1">(</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0028setf"><code>(setf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0028setf-1"><code>(setf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-Iterator-Protocol">Simple Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0028setf-logical_002dpathname_002dtranslations-_005bcl_005d_0029"><code>(setf logical-pathname-translations [cl])</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-Pathnames">Lisp Pathnames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_0028setf-slot_002dvalue_002dusing_002dclass-_005bsb_002dmop_005d_0029"><code>(setf slot-value-using-class [sb-mop])</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_symbol-2">?</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_003f"><code>?</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Information-Commands">Information Commands</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-A">A</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-abort"><code>abort</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exiting-Commands">Exiting Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-abort_002dthread"><code>abort-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-add_002dimplementation_002dpackage"><code>add-implementation-package</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-add_002dpackage_002dlocal_002dnickname"><code>add-package-local-nickname</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package_002dLocal-Nicknames">Package-Local Nicknames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-addr"><code>addr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Coercing-Foreign-Values">Coercing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-adjust_002dsequence"><code>adjust-sequence</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-adjust_002dsequence-_005bsb_002dsequence_005d"><code>adjust-sequence [sb-sequence]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-age"><code>age</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-alien_002dfuncall"><code>alien-funcall</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-alien_002dfuncall-Primitive">The alien-funcall Primitive</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-alien_002dsap"><code>alien-sap</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Coercing-Foreign-Values">Coercing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-alphabetic_002dp"><code>alphabetic-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-always_002dbound"><code>always-bound</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Global-and-Always_002dBound-variables">Global and Always-Bound variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-array_002dstorage_002dvector"><code>array-storage-vector</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Miscellaneous-Extensions">Miscellaneous Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-assert_002dversion_002d_003e_003d"><code>assert-version-&gt;=</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Miscellaneous-Extensions">Miscellaneous Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atomic_002ddecf"><code>atomic-decf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atomic_002dincf"><code>atomic-incf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atomic_002dpop"><code>atomic-pop</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atomic_002dpush"><code>atomic-push</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-atomic_002dupdate"><code>atomic-update</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-backtrace"><code>backtrace</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Information-Commands">Information Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-barrier"><code>barrier</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Barriers">Barriers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bidi_002dclass"><code>bidi-class</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bidi_002dmirroring_002dglyph"><code>bidi-mirroring-glyph</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-both_002dcase_002dp-_005bcl_005d"><code>both-case-p [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bottom"><code>bottom</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Stack-Motion">Stack Motion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-bytes_002dconsed_002dbetween_002dgcs"><code>bytes-consed-between-gcs</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-cancel_002dfinalization"><code>cancel-finalization</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cas"><code>cas</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-case_002dignorable_002dp"><code>case-ignorable-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cased_002dp"><code>cased-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-casefold"><code>casefold</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cast"><code>cast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Coercing-Foreign-Values">Coercing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002dblock"><code>char-block</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-char_002ddowncase-_005bcl_005d"><code>char-downcase [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-class_002dname-_005bcl_005d"><code>class-name [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-class_002dof-_005bcl_005d"><code>class-of [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-class_002dprototype-_005bsb_002dmop_005d"><code>class-prototype [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-clear_002dcoverage"><code>clear-coverage</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dcover">sb-cover</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-clear_002dsemaphore_002dnotification"><code>clear-semaphore-notification</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-close"><code>close</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Methods-common-to-all-streams">Methods common to all streams</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-close_002dgate"><code>close-gate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-coerce-_005bcl_005d"><code>coerce [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-combining_002dclass"><code>combining-class</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compare_002dand_002dswap"><code>compare-and-swap</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compute_002deffective_002dmethod-_005bsb_002dmop_005d"><code>compute-effective-method [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-concatenate"><code>concatenate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dbroadcast"><code>condition-broadcast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Waitqueue_002fcondition-variables">Waitqueue/condition variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dnotify"><code>condition-notify</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Waitqueue_002fcondition-variables">Waitqueue/condition variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-condition_002dwait"><code>condition-wait</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Waitqueue_002fcondition-variables">Waitqueue/condition variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-confusable_002dp"><code>confusable-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-cons-_005bcl_005d"><code>cons [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-continue"><code>continue</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exiting-Commands">Exiting Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-copy-function"><code><code>copy function</code></code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-copy_002dseq-_005bcl_005d"><code>copy-seq [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-decimal_002dvalue"><code>decimal-value</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-declare-_005bcl_005d"><code>declare [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-default_002dignorable_002dp"><code>default-ignorable-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defcas"><code>defcas</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defclass-_005bcl_005d"><code>defclass [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defclass-_005bcl_005d-1"><code>defclass [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defconstant-_005bcl_005d"><code>defconstant [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Defining-Constants">Defining Constants</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defglobal"><code>defglobal</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Global-and-Always_002dBound-variables">Global and Always-Bound variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dalien_002droutine"><code>define-alien-routine</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-define_002dalien_002droutine-Macro">The define-alien-routine Macro</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dalien_002dvariable"><code>define-alien-variable</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#External-Foreign-Variables">External Foreign Variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dcas_002dexpander"><code>define-cas-expander</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-define_002dhash_002dtable_002dtest"><code>define-hash-table-test</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Hash-Table-Extensions">Hash Table Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defmethod-_005bcl_005d"><code>defmethod [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defpackage"><code>defpackage</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package_002dLocal-Nicknames">Package-Local Nicknames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defpackage-1"><code>defpackage</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defpackage-_005bcl_005d"><code>defpackage [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package_002dLocal-Nicknames">Package-Local Nicknames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defpackage-_005bcl_005d-1"><code>defpackage [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Implementation-Packages">Implementation Packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-defstruct-_005bcl_005d"><code>defstruct [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-delete_002ddirectory"><code>delete-directory</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Miscellaneous-Extensions">Miscellaneous Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deprecated"><code>deprecated</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Declaration">Deprecation Declaration</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deprecated-_005bsb_002dext_005d"><code>deprecated [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Declaration">Deprecation Declaration</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-dequeue"><code>dequeue</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deref"><code>deref</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Accessing-Foreign-Values">Accessing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-describe"><code>describe</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Information-Commands">Information Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-describe_002dcompiler_002dpolicy"><code>describe-compiler-policy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Compiler-Policy">Compiler Policy</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-digit_002dvalue"><code>digit-value</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disable_002ddebugger"><code>disable-debugger</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disable_002dpackage_002dlocks"><code>disable-package-locks</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-disable_002dpackage_002dlocks-_005bsb_002dext_005d"><code>disable-package-locks [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-dolist-_005bcl_005d"><code>dolist [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-dosequence"><code>dosequence</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-down"><code>down</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Stack-Motion">Stack Motion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-dynamic_002dspace_002dsize"><code>dynamic-space-size</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-east_002dasian_002dwidth"><code>east-asian-width</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ed"><code>ed</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Customization-Hooks-for-Users">Customization Hooks for Users</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-element-function"><code><code>element function</code></code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-elt"><code>elt</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-emptyp"><code>emptyp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-enable_002ddebugger"><code>enable-debugger</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Enabling-and-Disabling-the-Debugger">Enabling and Disabling the Debugger</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-enable_002dpackage_002dlocks"><code>enable-package-locks</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-enable_002dpackage_002dlocks-_005bsb_002dext_005d"><code>enable-package-locks [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-endp-function"><code><code>endp function</code></code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-enqueue"><code>enqueue</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ensure_002dclass-_005bsb_002dmop_005d"><code>ensure-class [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ensure_002dclass_002dusing_002dclass-_005bsb_002dmop_005d"><code>ensure-class-using-class [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-ensure_002dgeneric_002dfunction-_005bcl_005d"><code>ensure-generic-function [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error"><code>error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Information-Commands">Information Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-eval-_005bcl_005d"><code>eval [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Interpreter">Interpreter</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-exit"><code>exit</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exit">Exit</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-extern_002dalien"><code>extern-alien</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#External-Foreign-Variables">External Foreign Variables</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002ddescriptor"><code>file-descriptor</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#File_002ddescriptors">File-descriptors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-filename"><code>filename</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Filenames">Filenames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-finalize"><code>finalize</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-finalize_002dinheritance-_005bsb_002dmop_005d"><code>finalize-inheritance [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-find-_005bcl_005d"><code>find [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-find_002dclass-_005bcl_005d"><code>find-class [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-find_002dclass-_005bcl_005d-1"><code>find-class [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-find_002dmethod-_005bcl_005d"><code>find-method [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flet-_005bcl_005d"><code>flet [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flet-_005bcl_005d-1"><code>flet [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frame"><code>frame</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Stack-Motion">Stack Motion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-free_002dalien"><code>free-alien</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Foreign-Dynamic-Allocation">Foreign Dynamic Allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frlock_002dname"><code>frlock-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frlock_002dread"><code>frlock-read</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frlock_002dread_002dbegin"><code>frlock-read-begin</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frlock_002dread_002dend"><code>frlock-read-end</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frlock_002dwrite"><code>frlock-write</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-funcallable_002dstandard_002dinstance_002daccess-_005bsb_002dmop_005d"><code>funcallable-standard-instance-access [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-gate_002dname"><code>gate-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gate_002dopen_002dp"><code>gate-open-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gatep"><code>gatep</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gc"><code>gc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-gc_002dlogfile"><code>gc-logfile</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-general_002dcategory"><code>general-category</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generation_002daverage_002dage"><code>generation-average-age</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generation_002dbytes_002dallocated"><code>generation-bytes-allocated</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generation_002dbytes_002dconsed_002dbetween_002dgcs"><code>generation-bytes-consed-between-gcs</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generation_002dminimum_002dage_002dbefore_002dgc"><code>generation-minimum-age-before-gc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generation_002dnumber_002dof_002dgcs"><code>generation-number-of-gcs</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generation_002dnumber_002dof_002dgcs_002dbefore_002dpromotion"><code>generation-number-of-gcs-before-promotion</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generic_002dfunction_002ddeclarations-_005bsb_002dmop_005d"><code>generic-function-declarations [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002dbytes_002dconsed"><code>get-bytes-consed</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002dcas_002dexpansion"><code>get-cas-expansion</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Atomic-Operations">Atomic Operations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002derrno"><code>get-errno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#External-Foreign-Variables">External Foreign Variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002dhost_002dby_002daddress"><code>get-host-by-address</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Name-Service">Name Service</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002dhost_002dby_002dname"><code>get-host-by-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Name-Service">Name Service</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002dprotocol_002dby_002dname"><code>get-protocol-by-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#INET-Domain-Sockets">INET Domain Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-get_002dtime_002dof_002dday"><code>get-time-of-day</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Miscellaneous-Extensions">Miscellaneous Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-getcwd"><code>getcwd</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions-with-idiosyncratic-bindings">Functions with idiosyncratic bindings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-global"><code>global</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Global-and-Always_002dBound-variables">Global and Always-Bound variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-grab_002dfrlock_002dwrite_002dlock"><code>grab-frlock-write-lock</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-grab_002dmutex"><code>grab-mutex</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-grapheme_002dbreak_002dclass"><code>grapheme-break-class</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-graphemes"><code>graphemes</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-hangul_002dsyllable_002dtype"><code>hangul-syllable-type</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-hash_002dtable_002dsynchronized_002dp"><code>hash-table-synchronized-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Hash-Table-Extensions">Hash Table Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-hash_002dtable_002dweakness"><code>hash-table-weakness</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Hash-Table-Extensions">Hash Table Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-help"><code>help</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Information-Commands">Information Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-hex_002ddigit_002dp"><code>hex-digit-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-host_002dent_002daddress"><code>host-ent-address</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Name-Service">Name Service</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-ideographic_002dp"><code>ideographic-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-index-function"><code><code>index function</code></code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-inspect-_005bcl_005d"><code>inspect [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Tools-To-Help-Developers">Tools To Help Developers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-int_002dsap"><code>int-sap</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Accessing-Foreign-Values">Accessing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-intern-_005bcl_005d"><code>intern [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Reader-Extensions">Reader Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-intern_002deql_002dspecializer-_005bsb_002dmop_005d"><code>intern-eql-specializer [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-interrupt_002dthread"><code>interrupt-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-iterator_002dcopy"><code>iterator-copy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-Iterator-Protocol">Simple Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-iterator_002delement"><code>iterator-element</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-Iterator-Protocol">Simple Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-iterator_002dendp"><code>iterator-endp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-Iterator-Protocol">Simple Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-iterator_002dindex"><code>iterator-index</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-Iterator-Protocol">Simple Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-iterator_002dstep"><code>iterator-step</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-Iterator-Protocol">Simple Iterator Protocol</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-J">J</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-join_002dthread"><code>join-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-join_002dthread-_005bsb_002dthread_005d"><code>join-thread [sb-thread]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timeout-Parameters">Timeout Parameters</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-labels-_005bcl_005d"><code>labels [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-labels-_005bcl_005d-1"><code>labels [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-length"><code>length</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-let-_005bcl_005d"><code>let [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Miscellaneous-Efficiency-Issues">Miscellaneous Efficiency Issues</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-let-_005bcl_005d-1"><code>let [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-let_002a-_005bcl_005d"><code>let* [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Miscellaneous-Efficiency-Issues">Miscellaneous Efficiency Issues</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-let_002a-_005bcl_005d-1"><code>let* [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-line_002dbreak_002dclass"><code>line-break-class</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lines"><code>lines</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list-_005bcl_005d"><code>list [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002a-_005bcl_005d"><code>list* [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dall_002dthreads"><code>list-all-threads</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dall_002dtimers"><code>list-all-timers</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timers">Timers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dlocals"><code>list-locals</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Variable-Access">Variable Access</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dmailbox_002dmessages"><code>list-mailbox-messages</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list_002dqueue_002dcontents"><code>list-queue-contents</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-load_002dshared_002dobject"><code>load-shared-object</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Loading-Shared-Object-Files">Loading Shared Object Files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lock_002dpackage"><code>lock-package</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logand-_005bcl_005d"><code>logand [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Modular-arithmetic">Modular arithmetic</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-logical_002dpathname_002dtranslations-_005bcl_005d"><code>logical-pathname-translations [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-Pathnames">Lisp Pathnames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lowercase"><code>lowercase</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-lowercase_002dp"><code>lowercase-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-macrolet-_005bcl_005d"><code>macrolet [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailbox_002dcount"><code>mailbox-count</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailbox_002dempty_002dp"><code>mailbox-empty-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailbox_002dname"><code>mailbox-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailboxp"><code>mailboxp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-main_002dthread"><code>main-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-main_002dthread_002dp"><code>main-thread-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dalien"><code>make-alien</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Foreign-Dynamic-Allocation">Foreign Dynamic Allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dalien_002dstring"><code>make-alien-string</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Foreign-Dynamic-Allocation">Foreign Dynamic Allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002darray-_005bcl_005d"><code>make-array [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dfrlock"><code>make-frlock</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dgate"><code>make-gate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dhash_002dtable"><code>make-hash-table</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Hash-Table-Extensions">Hash Table Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dinet_002daddress"><code>make-inet-address</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#INET-Domain-Sockets">INET Domain Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dinet6_002daddress"><code>make-inet6-address</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#INET-Domain-Sockets">INET Domain Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dinstance-_005bcl_005d"><code>make-instance [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dmailbox"><code>make-mailbox</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dmethod_002dlambda-_005bsb_002dmop_005d"><code>make-method-lambda [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dmethod_002dspecializers_002dform-_005bsb_002dpcl_005d"><code>make-method-specializers-form [sb-pcl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dmutex"><code>make-mutex</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dqueue"><code>make-queue</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsemaphore"><code>make-semaphore</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsemaphore_002dnotification"><code>make-semaphore-notification</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsequence_002diterator"><code>make-sequence-iterator</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsequence_002diterator-_005bsb_002dsequence_005d"><code>make-sequence-iterator [sb-sequence]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsequence_002diterator-_005bsb_002dsequence_005d-1"><code>make-sequence-iterator [sb-sequence]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsequence_002dlike"><code>make-sequence-like</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsequence_002dlike-_005bsb_002dsequence_005d"><code>make-sequence-like [sb-sequence]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsimple_002dsequence_002diterator"><code>make-simple-sequence-iterator</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Simple-Iterator-Protocol">Simple Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dsimple_002dsequence_002diterator-_005bsb_002dsequence_005d"><code>make-simple-sequence-iterator [sb-sequence]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dthread"><code>make-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dtimer"><code>make-timer</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timers">Timers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dwaitqueue"><code>make-waitqueue</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Waitqueue_002fcondition-variables">Waitqueue/condition variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-make_002dweak_002dpointer"><code>make-weak-pointer</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-map"><code>map</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-math_002dp"><code>math-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-md5sum_002dfile"><code>md5sum-file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dmd5">sb-md5</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-md5sum_002dsequence"><code>md5sum-sequence</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dmd5">sb-md5</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-md5sum_002dstream"><code>md5sum-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dmd5">sb-md5</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-md5sum_002dstring"><code>md5sum-string</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dmd5">sb-md5</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-merge"><code>merge</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mirrored_002dp"><code>mirrored-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-muffle_002dconditions"><code>muffle-conditions</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Controlling-Verbosity">Controlling Verbosity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002dname"><code>mutex-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002downer"><code>mutex-owner</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex_002dvalue"><code>mutex-value</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-N">N</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-name_002dconflict_002dsymbols-_005bsb_002dext_005d"><code>name-conflict-symbols [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Resolution-of-Name-Conflicts">Resolution of Name Conflicts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-native_002dnamestring"><code>native-namestring</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Native-Filenames">Native Filenames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-native_002dpathname"><code>native-pathname</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Native-Filenames">Native Filenames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-next"><code>next</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Single-Stepping">Single Stepping</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-non_002dblocking_002dmode"><code>non-blocking-mode</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-normalize_002dstring"><code>normalize-string</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-normalized_002dp"><code>normalized-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-numeric_002dvalue"><code>numeric-value</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-O">O</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-open-_005bcl_005d"><code>open [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#External-Formats">External Formats</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-open_002dgate"><code>open-gate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-out"><code>out</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Single-Stepping">Single Stepping</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dimplemented_002dby_002dlist"><code>package-implemented-by-list</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dimplements_002dlist"><code>package-implements-list</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dlocal_002dnicknames"><code>package-local-nicknames</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package_002dLocal-Nicknames">Package-Local Nicknames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dlocally_002dnicknamed_002dby_002dlist"><code>package-locally-nicknamed-by-list</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package_002dLocal-Nicknames">Package-Local Nicknames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dlocked_002derror_002dsymbol"><code>package-locked-error-symbol</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dlocked_002dp"><code>package-locked-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-parse_002dnative_002dnamestring"><code>parse-native-namestring</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Native-Filenames">Native Filenames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-parse_002dspecializer_002dusing_002dclass-_005bsb_002dpcl_005d"><code>parse-specializer-using-class [sb-pcl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-posix_002dgetenv"><code>posix-getenv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Querying-the-process-environment">Querying the process environment</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-print"><code>print</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Information-Commands">Information Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dalive_002dp"><code>process-alive-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dclose"><code>process-close</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dcore_002ddumped"><code>process-core-dumped</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002derror"><code>process-error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dexit_002dcode"><code>process-exit-code</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dinput"><code>process-input</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dkill"><code>process-kill</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002doutput"><code>process-output</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dp"><code>process-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dstatus"><code>process-status</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-process_002dwait"><code>process-wait</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-profile"><code>profile</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deterministic-Profiler">Deterministic Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-profile_002dcall_002dcounts"><code>profile-call-counts</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-proplist_002dp"><code>proplist-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-Q">Q</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-queue_002dcount"><code>queue-count</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-queue_002dempty_002dp"><code>queue-empty-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-queue_002dname"><code>queue-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-queuep"><code>queuep</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-R">R</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-readlink"><code>readlink</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions-with-idiosyncratic-bindings">Functions with idiosyncratic bindings</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-readtable_002dnormalization"><code>readtable-normalization</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Reader-Extensions">Reader Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-receive_002dmessage"><code>receive-message</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-receive_002dmessage_002dno_002dhang"><code>receive-message-no-hang</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-receive_002dpending_002dmessages"><code>receive-pending-messages</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-release_002dfrlock_002dwrite_002dlock"><code>release-frlock-write-lock</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-release_002dmutex"><code>release-mutex</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-remove_002dimplementation_002dpackage"><code>remove-implementation-package</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-remove_002dpackage_002dlocal_002dnickname"><code>remove-package-local-nickname</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package_002dLocal-Nicknames">Package-Local Nicknames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-report"><code>report</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deterministic-Profiler">Deterministic Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-report-1"><code>report</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-report-2"><code>report</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dcover">sb-cover</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-require"><code>require</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Customization-Hooks-for-Users">Customization Hooks for Users</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reset"><code>reset</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deterministic-Profiler">Deterministic Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reset-1"><code>reset</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-reset_002dcoverage"><code>reset-coverage</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dcover">sb-cover</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-restart"><code>restart</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exiting-Commands">Exiting Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-restart_002dframe"><code>restart-frame</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exiting-Commands">Exiting Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-restore_002dcoverage"><code>restore-coverage</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dcover">sb-cover</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-restore_002dcoverage_002dfrom_002dfile"><code>restore-coverage-from-file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dcover">sb-cover</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-restrict_002dcompiler_002dpolicy"><code>restrict-compiler-policy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Compiler-Policy">Compiler Policy</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-return"><code>return</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exiting-Commands">Exiting Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-return_002dfrom_002dthread"><code>return-from-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rotate_002dbyte"><code>rotate-byte</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002drotate_002dbyte">sb-rotate-byte</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-rotate_002dbyte-_005bsb_002drotate_002dbyte_005d"><code>rotate-byte [sb-rotate-byte]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dmd5">sb-md5</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-run_002dprogram"><code>run-program</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Running-external-programs">Running external programs</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-sap_002dalien"><code>sap-alien</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Coercing-Foreign-Values">Coercing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sap_002dref_002d32"><code>sap-ref-32</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Accessing-Foreign-Values">Accessing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sap_003d"><code>sap=</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Accessing-Foreign-Values">Accessing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-satisfies-_005bcl_005d"><code>satisfies [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Handling-of-Types">Handling of Types</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-save_002dcoverage"><code>save-coverage</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dcover">sb-cover</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-save_002dcoverage_002din_002dfile"><code>save-coverage-in-file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dcover">sb-cover</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-save_002dlisp_002dand_002ddie"><code>save-lisp-and-die</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Saving-a-Core-Image">Saving a Core Image</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-schedule_002dtimer"><code>schedule-timer</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timers">Timers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-script"><code>script</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-seed_002drandom_002dstate"><code>seed-random-state</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Random-Number-Generation">Random Number Generation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-semaphore_002dcount"><code>semaphore-count</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-semaphore_002dname"><code>semaphore-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-semaphore_002dnotification_002dstatus"><code>semaphore-notification-status</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-send_002dmessage"><code>send-message</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sentence_002dbreak_002dclass"><code>sentence-break-class</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sentences"><code>sentences</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-set_002dsbcl_002dsource_002dlocation"><code>set-sbcl-source-location</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-Pathnames">Lisp Pathnames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-setf-element-function"><code><code>setf element function</code></code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-setf-_005bcl_005d"><code>setf [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Miscellaneous-Efficiency-Issues">Miscellaneous Efficiency Issues</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-setq-_005bcl_005d"><code>setq [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Miscellaneous-Efficiency-Issues">Miscellaneous Efficiency Issues</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-signal_002dsemaphore"><code>signal-semaphore</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-slot"><code>slot</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Accessing-Foreign-Values">Accessing Foreign Values</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-slot_002dboundp_002dusing_002dclass-_005bsb_002dmop_005d"><code>slot-boundp-using-class [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-slot_002ddefinition_002dname-_005bsb_002dmop_005d"><code>slot-definition-name [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-slot_002dvalue_002dusing_002dclass-_005bsb_002dmop_005d"><code>slot-value-using-class [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002daccept"><code>socket-accept</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dbind"><code>socket-bind</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dclose"><code>socket-close</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dconnect"><code>socket-connect</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002derror"><code>socket-error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dlisten"><code>socket-listen</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dmake_002dstream"><code>socket-make-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dmake_002dstream-1"><code>socket-make-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dname"><code>socket-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dopen_002dp"><code>socket-open-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dpeername"><code>socket-peername</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dreceive"><code>socket-receive</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dsend"><code>socket-send</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket_002dshutdown"><code>socket-shutdown</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002dbroadcast"><code>sockopt-broadcast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002dbsd_002dcompatible"><code>sockopt-bsd-compatible</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002ddebug"><code>sockopt-debug</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002ddont_002droute"><code>sockopt-dont-route</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002dkeep_002dalive"><code>sockopt-keep-alive</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002doob_002dinline"><code>sockopt-oob-inline</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002dpass_002dcredentials"><code>sockopt-pass-credentials</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002dreuse_002daddress"><code>sockopt-reuse-address</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sockopt_002dtcp_002dnodelay"><code>sockopt-tcp-nodelay</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Socket-Options">Socket Options</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-soft_002ddotted_002dp"><code>soft-dotted-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-source"><code>source</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Source-Location-Printing">Source Location Printing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-standard_002dinstance_002daccess-_005bsb_002dmop_005d"><code>standard-instance-access [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-start"><code>start</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Single-Stepping">Single Stepping</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-start_002dprofiling"><code>start-profiling</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-step"><code>step</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Single-Stepping">Single Stepping</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-step-1"><code>step</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Single-Stepping">Single Stepping</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-step-function"><code><code>step function</code></code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stop"><code>stop</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Single-Stepping">Single Stepping</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stop_002dprofiling"><code>stop-profiling</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dadvance_002dto_002dcolumn"><code>stream-advance-to-column</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-output-stream-methods">Character output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dclear_002dinput"><code>stream-clear-input</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Input-stream-methods">Input stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dclear_002doutput"><code>stream-clear-output</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Output-stream-methods">Output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002delement_002dtype"><code>stream-element-type</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Methods-common-to-all-streams">Methods common to all streams</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dexternal_002dformat-_005bcl_005d"><code>stream-external-format [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#External-Formats">External Formats</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dfile_002dposition"><code>stream-file-position</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Methods-common-to-all-streams">Methods common to all streams</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dfinish_002doutput"><code>stream-finish-output</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Output-stream-methods">Output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dforce_002doutput"><code>stream-force-output</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Output-stream-methods">Output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dfresh_002dline"><code>stream-fresh-line</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-output-stream-methods">Character output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dline_002dcolumn"><code>stream-line-column</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-output-stream-methods">Character output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dline_002dlength"><code>stream-line-length</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-output-stream-methods">Character output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dlisten"><code>stream-listen</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-input-stream-methods">Character input stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dpeek_002dchar"><code>stream-peek-char</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-input-stream-methods">Character input stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dread_002dbyte"><code>stream-read-byte</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Binary-stream-methods">Binary stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dread_002dchar"><code>stream-read-char</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-input-stream-methods">Character input stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dread_002dchar_002dno_002dhang"><code>stream-read-char-no-hang</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-input-stream-methods">Character input stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dread_002dline"><code>stream-read-line</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-input-stream-methods">Character input stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dread_002dsequence"><code>stream-read-sequence</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Input-stream-methods">Input stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dstart_002dline_002dp"><code>stream-start-line-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-output-stream-methods">Character output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dterpri"><code>stream-terpri</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-output-stream-methods">Character output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dunread_002dchar"><code>stream-unread-char</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-input-stream-methods">Character input stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dwrite_002dbyte"><code>stream-write-byte</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Binary-stream-methods">Binary stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dwrite_002dchar"><code>stream-write-char</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-output-stream-methods">Character output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dwrite_002dsequence"><code>stream-write-sequence</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Output-stream-methods">Output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stream_002dwrite_002dstring"><code>stream-write-string</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Character-output-stream-methods">Character output stream methods</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-string_002dupcase-_005bcl_005d"><code>string-upcase [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subseq-_005bcl_005d"><code>subseq [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subseq-_005bcl_005d-1"><code>subseq [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subseq-_005bcl_005d-2"><code>subseq [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-subtypep-_005bcl_005d"><code>subtypep [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-symbol_002dmacrolet-_005bcl_005d"><code>symbol-macrolet [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-symbol_002dvalue_002din_002dthread"><code>symbol-value-in-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-syslog"><code>syslog</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions-with-idiosyncratic-bindings">Functions with idiosyncratic bindings</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-terminate_002dthread"><code>terminate-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dalive_002dp"><code>thread-alive-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002derror_002dthread"><code>thread-error-thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dname"><code>thread-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002dyield"><code>thread-yield</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-timer_002dname"><code>timer-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timers">Timers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-timer_002dscheduled_002dp"><code>timer-scheduled-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timers">Timers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-titlecase"><code>titlecase</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-top"><code>top</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Stack-Motion">Stack Motion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-toplevel"><code>toplevel</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exiting-Commands">Exiting Commands</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-trace"><code>trace</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Function-Tracing">Function Tracing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-trace-_005bcl_005d"><code>trace [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Tools-To-Help-Developers">Tools To Help Developers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-truly_002dthe"><code>truly-the</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Efficiency-Hacks">Efficiency Hacks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-try_002dsemaphore"><code>try-semaphore</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-typep-_005bcl_005d"><code>typep [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-U">U</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-unicode_002d1_002dname"><code>unicode-1-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unicode_002dequal"><code>unicode-equal</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unicode_003c"><code>unicode&lt;</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unicode_003c_003d"><code>unicode&lt;=</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unicode_003d"><code>unicode=</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unicode_003e"><code>unicode&gt;</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unicode_003e_003d"><code>unicode&gt;=</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unload_002dshared_002dobject"><code>unload-shared-object</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Loading-Shared-Object-Files">Loading Shared Object Files</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unlock_002dpackage"><code>unlock-package</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unmuffle_002dconditions"><code>unmuffle-conditions</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Controlling-Verbosity">Controlling Verbosity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unparse_002dspecializer_002dusing_002dclass-_005bsb_002dpcl_005d"><code>unparse-specializer-using-class [sb-pcl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unprofile"><code>unprofile</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deterministic-Profiler">Deterministic Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unprofile_002dcall_002dcounts"><code>unprofile-call-counts</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-unschedule_002dtimer"><code>unschedule-timer</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timers">Timers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-untrace"><code>untrace</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Function-Tracing">Function Tracing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-up"><code>up</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Stack-Motion">Stack Motion</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uppercase"><code>uppercase</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-uppercase_002dp"><code>uppercase-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-validate_002dsuperclass-_005bsb_002dmop_005d"><code>validate-superclass [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-validate_002dsuperclass-_005bsb_002dmop_005d-1"><code>validate-superclass [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-var"><code>var</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Variable-Access">Variable Access</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-vector-_005bcl_005d"><code>vector [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Function-Index_fn_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-wait_002dfor"><code>wait-for</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timeout-Parameters">Timeout Parameters</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-wait_002don_002dgate"><code>wait-on-gate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-wait_002don_002dsemaphore"><code>wait-on-semaphore</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-waitqueue_002dname"><code>waitqueue-name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Waitqueue_002fcondition-variables">Waitqueue/condition variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-weak_002dpointer_002dvalue"><code>weak-pointer-value</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-whitespace_002dp"><code>whitespace-p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dalien"><code>with-alien</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Local-Foreign-Variables">Local Foreign Variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dcompilation_002dunit"><code>with-compilation-unit</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Compiler-Policy">Compiler Policy</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dcompilation_002dunit-_005bcl_005d"><code>with-compilation-unit [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-Parts-of-a-Compiler-Diagnostic">The Parts of a Compiler Diagnostic</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002ddeadline"><code>with-deadline</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Synchronous-Timeouts-_0028Deadlines_0029">Synchronous Timeouts (Deadlines)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dlocked_002dhash_002dtable"><code>with-locked-hash-table</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Hash-Table-Extensions">Hash Table Extensions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dmutex"><code>with-mutex</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dopen_002dfile-_005bcl_005d"><code>with-open-file [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#External-Formats">External Formats</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dprofiling"><code>with-profiling</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002drecursive_002dlock"><code>with-recursive-lock</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dsampling"><code>with-sampling</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dsequence_002diterator"><code>with-sequence-iterator</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dsequence_002diterator_002dfunctions"><code>with-sequence-iterator-functions</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dtimeout"><code>with-timeout</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Asynchronous-Timeouts">Asynchronous Timeouts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-with_002dunlocked_002dpackages"><code>with-unlocked-packages</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-without_002dpackage_002dlocks"><code>without-package-locks</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-word_002dbreak_002dclass"><code>word-break-class</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-words"><code>words</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Unicode-Support">Unicode Support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Function-Index_fn_symbol-1"><b>(</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_symbol-2"><b>?</b></a>
 &nbsp; 
<br>
<a class="summary-letter" href="#Function-Index_fn_letter-A"><b>A</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-B"><b>B</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-D"><b>D</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-F"><b>F</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-J"><b>J</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-N"><b>N</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-O"><b>O</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-P"><b>P</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-Q"><b>Q</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-R"><b>R</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-S"><b>S</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-T"><b>T</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-U"><b>U</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-V"><b>V</b></a>
 &nbsp; 
<a class="summary-letter" href="#Function-Index_fn_letter-W"><b>W</b></a>
 &nbsp; 
</td></tr></table>

<hr>
<a name="Variable-Index"></a>
<div class="header">
<p>
Next: <a href="#Type-Index" accesskey="n" rel="next">Type Index</a>, Previous: <a href="#Function-Index" accesskey="p" rel="prev">Function Index</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Variable-Index-1"></a>
<h2 class="appendix">Appendix C Variable Index</h2>

<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Variable-Index_vr_symbol-1"><b>*</b></a>
 &nbsp; 
<a class="summary-letter" href="#Variable-Index_vr_symbol-2"><b>+</b></a>
</td></tr></table>
<table class="index-vr" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Variable-Index_vr_symbol-1">*</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aafter_002dgc_002dhooks_002a"><code>*after-gc-hooks*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002acommand_002dchar_002a"><code>*command-char*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002daclrepl">sb-aclrepl</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002acompiler_002dprint_002dvariable_002dalist_002a"><code>*compiler-print-variable-alist*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Controlling-Verbosity">Controlling Verbosity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002acore_002dpathname_002a"><code>*core-pathname*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Saving-a-Core-Image">Saving a Core Image</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002acurrent_002dthread_002a"><code>*current-thread*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002adebug_002dprint_002dvariable_002dalist_002a"><code>*debug-print-variable-alist*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debugger-Command-Loop">Debugger Command Loop</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aed_002dfunctions_002a"><code>*ed-functions*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Customization-Hooks-for-Users">Customization Hooks for Users</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aevaluator_002dmode_002a"><code>*evaluator-mode*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Interpreter">Interpreter</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aevaluator_002dmode_002a-_005bsb_002dext_005d"><code>*evaluator-mode* [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Interpreter">Interpreter</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aexit_002dhooks_002a"><code>*exit-hooks*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Initialization-and-Exit-Hooks">Initialization and Exit Hooks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aexit_002don_002deof_002a"><code>*exit-on-eof*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002daclrepl">sb-aclrepl</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002agc_002drun_002dtime_002a"><code>*gc-run-time*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Garbage-Collection">Garbage Collection</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ainit_002dhooks_002a"><code>*init-hooks*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Initialization-and-Exit-Hooks">Initialization and Exit Hooks</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ainvoke_002ddebugger_002dhook_002a"><code>*invoke-debugger-hook*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Debugger-Invocation">Debugger Invocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002amax_002dhistory_002a"><code>*max-history*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002daclrepl">sb-aclrepl</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002amax_002dsamples_002a"><code>*max-samples*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002amax_002dtrace_002dindentation_002a"><code>*max-trace-indentation*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Function-Tracing">Function Tracing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002amodule_002dprovider_002dfunctions_002a"><code>*module-provider-functions*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Customization-Hooks-for-Users">Customization Hooks for Users</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002amuffled_002dwarnings_002a"><code>*muffled-warnings*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Customization-Hooks-for-Users">Customization Hooks for Users</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aon_002dpackage_002dvariance_002a"><code>*on-package-variance*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Variance">Package Variance</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002apackage_002a-_005bcl_005d"><code>*package* [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Implementation-Packages">Implementation Packages</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aposix_002dargv_002a-_005bsb_002dext_005d"><code>*posix-argv* [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Shebang-Scripts">Shebang Scripts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aposix_002dargv_002a-_005bsb_002dext_005d-1"><code>*posix-argv* [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Command_002dline-arguments">Command-line arguments</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002aprompt_002a"><code>*prompt*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002daclrepl">sb-aclrepl</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002asample_002dinterval_002a"><code>*sample-interval*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Statistical-Profiler">Statistical Profiler</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002asave_002dhooks_002a"><code>*save-hooks*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Saving-a-Core-Image">Saving a Core Image</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002astack_002dallocate_002ddynamic_002dextent_002a"><code>*stack-allocate-dynamic-extent*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Dynamic_002dextent-allocation">Dynamic-extent allocation</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002asysinit_002dpathname_002dfunction_002a"><code>*sysinit-pathname-function*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Saving-a-Core-Image">Saving a Core Image</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002atrace_002dencapsulate_002ddefault_002a"><code>*trace-encapsulate-default*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Function-Tracing">Function Tracing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002atrace_002dindentation_002dstep_002a"><code>*trace-indentation-step*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Function-Tracing">Function Tracing</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002ause_002dshort_002dpackage_002dname_002a"><code>*use-short-package-name*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002daclrepl">sb-aclrepl</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002auserinit_002dpathname_002dfunction_002a"><code>*userinit-pathname-function*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Saving-a-Core-Image">Saving a Core Image</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Variable-Index_vr_symbol-2">+</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-_002bslot_002dunbound_002b-_005bsb_002dpcl_005d"><code>+slot-unbound+ [sb-pcl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Variable-Index_vr_symbol-1"><b>*</b></a>
 &nbsp; 
<a class="summary-letter" href="#Variable-Index_vr_symbol-2"><b>+</b></a>
</td></tr></table>

<hr>
<a name="Type-Index"></a>
<div class="header">
<p>
Next: <a href="#Colophon" accesskey="n" rel="next">Colophon</a>, Previous: <a href="#Variable-Index" accesskey="p" rel="prev">Variable Index</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Type-Index-1"></a>
<h2 class="appendix">Appendix D Type Index</h2>

<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Type-Index_tp_letter-B"><b>B</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-D"><b>D</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-F"><b>F</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-J"><b>J</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-N"><b>N</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-P"><b>P</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-Q"><b>Q</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-S"><b>S</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-T"><b>T</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-V"><b>V</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-W"><b>W</b></a>
 &nbsp; 
</td></tr></table>
<table class="index-tp" border="0">
<tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-B">B</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-built_002din_002dclass-_005bcl_005d"><code>built-in-class [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-C">C</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-code_002ddeletion_002dnote"><code>code-deletion-note</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-code_002ddeletion_002dnote-_005bsb_002dext_005d"><code>code-deletion-note [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compiler_002dnote"><code>compiler-note</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-compiler_002dnote-_005bsb_002dext_005d"><code>compiler-note [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-D">D</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-deadline_002dtimeout"><code>deadline-timeout</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Synchronous-Timeouts-_0028Deadlines_0029">Synchronous Timeouts (Deadlines)</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deprecation_002dcondition"><code>deprecation-condition</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Conditions">Deprecation Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-deprecation_002derror"><code>deprecation-error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Conditions">Deprecation Conditions</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-E">E</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-early_002ddeprecation_002dwarning"><code>early-deprecation-warning</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Conditions">Deprecation Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-error-_005bcl_005d"><code>error [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-F">F</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002ddescriptor-1"><code>file-descriptor</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#File_002ddescriptors">File-descriptors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-file_002ddescriptor_002ddesignator"><code>file-descriptor-designator</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#File_002ddescriptors">File-descriptors</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-filename-1"><code>filename</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Filenames">Filenames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-filename_002ddesignator"><code>filename-designator</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Filenames">Filenames</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-final_002ddeprecation_002dwarning"><code>final-deprecation-warning</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Conditions">Deprecation Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-flock"><code>flock</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-objects-and-C-structures">Lisp objects and C structures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-frlock"><code>frlock</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-funcallable_002dstandard_002dclass-_005bsb_002dmop_005d"><code>funcallable-standard-class [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-funcallable_002dstandard_002dobject-_005bsb_002dmop_005d"><code>funcallable-standard-object [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-funcallable_002dstandard_002dobject-_005bsb_002dmop_005d-1"><code>funcallable-standard-object [sb-mop]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-function-_005bcl_005d"><code>function [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-function-_005bcl_005d-1"><code>function [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002dbinary_002dinput_002dstream"><code>fundamental-binary-input-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002dbinary_002doutput_002dstream"><code>fundamental-binary-output-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002dbinary_002dstream"><code>fundamental-binary-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002dcharacter_002dinput_002dstream"><code>fundamental-character-input-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002dcharacter_002doutput_002dstream"><code>fundamental-character-output-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002dcharacter_002dstream"><code>fundamental-character-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002dinput_002dstream"><code>fundamental-input-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002doutput_002dstream"><code>fundamental-output-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-fundamental_002dstream"><code>fundamental-stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Gray-Streams-classes">Gray Streams classes</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-G">G</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-gate"><code>gate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-generic_002dfunction-_005bcl_005d"><code>generic-function [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-H">H</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-host_002dent"><code>host-ent</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Name-Service">Name Service</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-I">I</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-inet_002dsocket"><code>inet-socket</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#INET-Domain-Sockets">INET Domain Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-inet6_002dsocket"><code>inet6-socket</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#INET-Domain-Sockets">INET Domain Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-interrupt_002dthread_002derror"><code>interrupt-thread-error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-J">J</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-join_002dthread_002derror"><code>join-thread-error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-join_002dthread_002derror-_005bsb_002dthread_005d"><code>join-thread-error [sb-thread]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timeout-Parameters">Timeout Parameters</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-L">L</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-late_002ddeprecation_002dwarning"><code>late-deprecation-warning</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Deprecation-Conditions">Deprecation Conditions</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-list-_005bcl_005d-1"><code>list [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-local_002dabstract_002dsocket"><code>local-abstract-socket</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Local-_0028Unix_0029-Domain-Sockets">Local (Unix) Domain Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-local_002dsocket"><code>local-socket</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Local-_0028Unix_0029-Domain-Sockets">Local (Unix) Domain Sockets</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-M">M</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-mailbox"><code>mailbox</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-mutex"><code>mutex</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Mutex-Support">Mutex Support</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-N">N</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-name_002dconflict-_005bsb_002dext_005d"><code>name-conflict [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Resolution-of-Name-Conflicts">Resolution of Name Conflicts</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-P">P</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002derror-_005bcl_005d"><code>package-error [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dlock_002dviolation"><code>package-lock-violation</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dlock_002dviolation-_005bsb_002dext_005d"><code>package-lock-violation [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dlocked_002derror"><code>package-locked-error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-package_002dlocked_002derror-_005bsb_002dext_005d"><code>package-locked-error [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-passwd"><code>passwd</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-objects-and-C-structures">Lisp objects and C structures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-protocol_002dunimplemented"><code>protocol-unimplemented</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-Q">Q</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-queue"><code>queue</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#sb_002dconcurrency">sb-concurrency</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-S">S</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-semaphore"><code>semaphore</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-semaphore_002dnotification"><code>semaphore-notification</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Semaphores">Semaphores</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sequence-_005bcl_005d"><code>sequence [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sequence-_005bcl_005d-1"><code>sequence [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sequence-_005bcl_005d-2"><code>sequence [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-sequence-_005bcl_005d-3"><code>sequence [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Iterator-Protocol">Iterator Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-socket"><code>socket</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#General-Sockets">General Sockets</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-standard_002dclass-_005bcl_005d"><code>standard-class [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-standard_002dgeneric_002dfunction-_005bcl_005d"><code>standard-generic-function [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-standard_002dobject-_005bcl_005d"><code>standard-object [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-standard_002dobject-_005bcl_005d-1"><code>standard-object [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-stat"><code>stat</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-objects-and-C-structures">Lisp objects and C structures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-structure_002dclass-_005bcl_005d"><code>structure-class [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-style_002dwarning-_005bcl_005d"><code>style-warning [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-symbol_002dpackage_002dlocked_002derror"><code>symbol-package-locked-error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Dictionary">Package Lock Dictionary</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-symbol_002dpackage_002dlocked_002derror-_005bsb_002dext_005d"><code>symbol-package-locked-error [sb-ext]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Package-Lock-Violations">Package Lock Violations</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-T">T</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-t-_005bcl_005d"><code>t [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Metaobject-Protocol">Metaobject Protocol</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-termios"><code>termios</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-objects-and-C-structures">Lisp objects and C structures</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread"><code>thread</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-thread_002derror"><code>thread-error</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Threading-basics">Threading basics</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-timeout"><code>timeout</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Asynchronous-Timeouts">Asynchronous Timeouts</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-timer"><code>timer</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Timers">Timers</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-timeval"><code>timeval</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Lisp-objects-and-C-structures">Lisp objects and C structures</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-V">V</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-vector-_005bcl_005d-1"><code>vector [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensible-Sequences">Extensible Sequences</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
<tr><th><a name="Type-Index_tp_letter-W">W</a></th><td></td><td></td></tr>
<tr><td></td><td valign="top"><a href="#index-waitqueue"><code>waitqueue</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Waitqueue_002fcondition-variables">Waitqueue/condition variables</a></td></tr>
<tr><td></td><td valign="top"><a href="#index-warning-_005bcl_005d"><code>warning [cl]</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Diagnostic-Severity">Diagnostic Severity</a></td></tr>
<tr><td colspan="4"> <hr></td></tr>
</table>
<table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Type-Index_tp_letter-B"><b>B</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-D"><b>D</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-F"><b>F</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-J"><b>J</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-N"><b>N</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-P"><b>P</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-Q"><b>Q</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-S"><b>S</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-T"><b>T</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-V"><b>V</b></a>
 &nbsp; 
<a class="summary-letter" href="#Type-Index_tp_letter-W"><b>W</b></a>
 &nbsp; 
</td></tr></table>

<hr>
<a name="Colophon"></a>
<div class="header">
<p>
Previous: <a href="#Type-Index" accesskey="p" rel="prev">Type Index</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Colophon-1"></a>
<h2 class="unnumbered">Colophon</h2>

<p>This manual is maintained in Texinfo, and automatically translated
into other forms (e.g. HTML or pdf). If you&rsquo;re <em>reading</em> this
manual in one of these non-Texinfo translated forms, that&rsquo;s fine, but
if you want to <em>modify</em> this manual, you are strongly advised to
seek out a Texinfo version and modify that instead of modifying a
translated version. Even better might be to seek out <em>the</em>
Texinfo version (maintained at the time of this writing as part of the
SBCL project at <a href="http://sbcl.sourceforge.net/">http://sbcl.sourceforge.net/</a>) and submit a
patch.
</p>
<div class="footnote">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>

<h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
<p>Historically, the ILISP package at
<a href="http://ilisp.cons.org/">http://ilisp.cons.org/</a> provided similar functionality, but it
does not support modern SBCL versions.</p>
<h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
<p>Actually, this declaration is unnecessary in
SBCL, since it already knows that <code>position</code> returns a
non-negative <code>fixnum</code> or <code>nil</code>.</p>
<h3><a name="FOOT3" href="#DOCF3">(3)</a></h3>
<p>A deprecated
extension <code>sb-ext:inhibit-warnings</code> is still supported, but
liable to go away at any time.</p>
<h3><a name="FOOT4" href="#DOCF4">(4)</a></h3>
<p>Since the location of an interrupt or hardware
error will always be an unknown location, non-argument variable values
will never be available in the interrupted frame.  See <a href="#Unknown-Locations-and-Interrupts">Unknown Locations and Interrupts</a>.</p>
<h3><a name="FOOT5" href="#DOCF5">(5)</a></h3>
<p>The variable bindings are actually created
using the Lisp <code>symbol-macrolet</code> special form.</p>
<h3><a name="FOOT6" href="#DOCF6">(6)</a></h3>
<p>A motivation, rationale and additional examples for the design
of this extension can be found in the paper <cite>Rhodes, Christophe
(2007): User-extensible sequences in Common Lisp</cite> available for download
at
<a href="http://www.doc.gold.ac.uk/~mas01cr/papers/ilc2007/sequences-20070301.pdf">http://www.doc.gold.ac.uk/~mas01cr/papers/ilc2007/sequences-20070301.pdf</a>.</p>
<h3><a name="FOOT7" href="#DOCF7">(7)</a></h3>
<p>In SBCL versions prior to 1.0.13, <code>sb-ext:run-program</code>
searched for executables in a manner somewhat incompatible with other
languages.  As of this version, SBCL uses the system library routine
<code>execvp(3)</code>, and no longer contains the function,
<code>find-executable-in-search-path</code>, which implemented the old
search.  Users who need this function may find it
in <samp>run-program.lisp</samp> versions 1.67 and earlier in SBCL&rsquo;s CVS
repository here
<a href="http://sbcl.cvs.sourceforge.net/sbcl/sbcl/src/code/run-program.lisp?view=log">http://sbcl.cvs.sourceforge.net/sbcl/sbcl/src/code/run-program.lisp?view=log</a>. However,
we caution such users that this search routine finds executables that
system library routines do not.</p>
<h3><a name="FOOT8" href="#DOCF8">(8)</a></h3>
<p>Please
note that the codepoint U+1F5CF (PAGE) introduced in Unicode 7.0 is
named <code>UNICODE_PAGE</code>, since the name &ldquo;Page&rdquo; is required to be
assigned to form-feed (U+0C) by the ANSI standard.</p>
<h3><a name="FOOT9" href="#DOCF9">(9)</a></h3>
<p>See chapter 7 &quot;Testing widely used RNGs&quot; in
<cite>TestU01: A C Library for Empirical Testing of Random Number
Generators</cite> by Pierre L&rsquo;Ecuyer and Richard Simard, ACM Transactions on
Mathematical Software, Vol. 33, article 22, 2007.</p>
<h3><a name="FOOT10" href="#DOCF10">(10)</a></h3>
<p>The functionality contained in the package
<code>SB-UNIX</code> is for SBCL internal use only; its contents are likely to
change from version to version.</p>
<h3><a name="FOOT11" href="#DOCF11">(11)</a></h3>
<p>See &ldquo;namespace&rdquo; entry in the glossary
of the Common Lisp Hyperspec.</p>
</div>
<hr>



</body>
</html>