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
|
@comment{ $Source: e:\\cvsroot/ARM/Source/pre_strings.mss,v $ }
@comment{ $Revision: 1.52 $ $Date: 2006/10/19 06:40:33 $ $Author: Randy $ }
@Part(predefstrings, Root="ada.mss")
@Comment{$Date: 2006/10/19 06:40:33 $}
@LabeledClause{String Handling}
@begin{Intro}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
This clause presents the specifications of the package Strings and
several child packages, which provide facilities for dealing with
string data. Fixed-length,
bounded-length, and unbounded-length strings are supported, for @Chg{Version=[2],New=[],Old=[both]}
String@Chg{Version=[2],New=[,],Old=[ and]} Wide_String@Chg{Version=[2],New=[,
and Wide_Wide_String],Old=[]}.
The string-handling subprograms include searches for pattern strings
and for characters in program-specified sets,
translation (via a character-to-character mapping), and transformation
(replacing, inserting, overwriting, and deleting of substrings).
@end{Intro}
@begin{Extend83}
@Defn{extensions to Ada 83}
This clause is new to Ada 95.
@end{Extend83}
@begin{Diffword95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
@ChgAdded{Version=[2],Text=[Included Wide_Wide_String in this description;
the individual changes are documented as extensions as needed.]}
@end{Diffword95}
@LabeledSubClause{The Package Strings}
@begin{Intro}
The package Strings provides declarations
common to the string handling packages.
@end{Intro}
@begin{StaticSem}
@Leading@;The library package Strings has the following declaration:
@begin{example}
@ChildUnit{Parent=[Ada],Child=[Strings]}@key[package] Ada.Strings @key[is]
@key[pragma] Pure(Strings);
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]}
@AdaObjDefn{Space} : @key[constant] Character := ' ';
@AdaObjDefn{Wide_Space} : @key[constant] Wide_Character := ' ';@Chg{Version=[2],New=[
@AdaObjDefn{Wide_Wide_Space} : @key[constant] Wide_Wide_Character := ' ';],Old=[]}
@AdaExcDefn{Length_Error}, @AdaExcDefn{Pattern_Error}, @AdaExcDefn{Index_Error}, @AdaExcDefn{Translation_Error} : @key[exception];
@key[type] @AdaTypeDefn{Alignment} @key[is] (Left, Right, Center);
@key[type] @AdaTypeDefn{Truncation} @key[is] (Left, Right, Error);
@key[type] @AdaTypeDefn{Membership} @key[is] (Inside, Outside);
@key[type] @AdaTypeDefn{Direction} @key[is] (Forward, Backward);
@key[type] @AdaTypeDefn{Trim_End} @key[is] (Left, Right, Both);
@key[end] Ada.Strings;
@end{example}
@end{StaticSem}
@begin{Incompatible95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95}
Constant Wide_Wide_Space is newly added to Ada.Strings. If Ada.Strings is
referenced in a @nt{use_clause}, and an entity @i<E> with a
@nt{defining_identifier} of Wide_Wide_Space is defined in a package that is
also referenced in a @nt{use_clause}, the entity @i<E> may no longer be
use-visible, resulting in errors. This should be rare and is easily fixed if
it does occur.]}
@end{Incompatible95}
@Comment{@RmNewPage Insert page break so printed Ada 95 w/ Corr RM looks better.}
@LabeledSubClause{The Package Strings.Maps}
@begin{Intro}
The package Strings.Maps defines the types, operations, and other
entities needed for character sets and character-to-character mappings.
@end{Intro}
@begin{StaticSem}
@Leading@;The library package Strings.Maps has the following declaration:
@begin{example}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00362-01]}
@ChildUnit{Parent=[Ada.Strings],Child=[Maps]}@key[package] Ada.Strings.Maps @key[is]
@key[pragma] @Chg{Version=[2],New=[Pure],Old=[Preelaborate]}(Maps);
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]}
--@RI{ Representation for a set of character values:}
@key[type] @AdaTypeDefn{Character_Set} @key[is] @key[private];@Chg{Version=[2],New=[
@key[pragma] Preelaborable_Initialization(Character_Set);],Old=[]}
@AdaObjDefn{Null_Set} : @key[constant] Character_Set;
@key[type] @AdaTypeDefn{Character_Range} @key[is]
@Key[record]
Low : Character;
High : Character;
@key[end] @key[record];
-- @RI[Represents Character range Low..High]
@key[type] @AdaTypeDefn{Character_Ranges} @key[is] @key[array] (Positive @key[range] <>) @key[of] Character_Range;
@key[function] @AdaSubDefn{To_Set} (Ranges : @key[in] Character_Ranges)@key[return] Character_Set;
@key[function] @AdaSubDefn{To_Set} (Span : @key[in] Character_Range)@key[return] Character_Set;
@key[function] @AdaSubDefn{To_Ranges} (Set : @key[in] Character_Set) @key[return] Character_Ranges;
@key[function] "=" (Left, Right : @key[in] Character_Set) @key[return] Boolean;
@key[function] "@key[not]" (Right : @key[in] Character_Set) @key[return] Character_Set;
@key[function] "@key[and]" (Left, Right : @key[in] Character_Set) @key[return] Character_Set;
@key[function] "@key[or]" (Left, Right : @key[in] Character_Set) @key[return] Character_Set;
@key[function] "@key[xor]" (Left, Right : @key[in] Character_Set) @key[return] Character_Set;
@key[function] "-" (Left, Right : @key[in] Character_Set) @key[return] Character_Set;
@key[function] @AdaSubDefn{Is_In} (Element : @key[in] Character;
Set : @key[in] Character_Set)
@key[return] Boolean;
@key[function] @AdaSubDefn{Is_Subset} (Elements : @key[in] Character_Set;
Set : @key[in] Character_Set)
@key[return] Boolean;
@key[function] "<=" (Left : @key[in] Character_Set;
Right : @key[in] Character_Set)
@key[return] Boolean @key[renames] Is_Subset;
--@RI{ Alternative representation for a set of character values:}
@key[subtype] @AdaSubtypeDefn{Name=[Character_Sequence],Of=[String]} @key[is] String;
@key[function] @AdaSubDefn{To_Set} (Sequence : @key[in] Character_Sequence)@key[return] Character_Set;
@key[function] @AdaSubDefn{To_Set} (Singleton : @key[in] Character) @key[return] Character_Set;
@key[function] @AdaSubDefn{To_Sequence} (Set : @key[in] Character_Set) @key[return] Character_Sequence;
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]}
--@RI{ Representation for a character to character mapping:}
@key[type] @AdaTypeDefn{Character_Mapping} @key[is] @key[private];@Chg{Version=[2],New=[
@key[pragma] Preelaborable_Initialization(Character_Mapping);],Old=[]}
@key[function] @AdaSubDefn{Value} (Map : @key[in] Character_Mapping;
Element : @key[in] Character)
@key[return] Character;
@AdaObjDefn{Identity} : @key[constant] Character_Mapping;
@key[function] @AdaSubDefn{To_Mapping} (From, To : @key[in] Character_Sequence)
@key[return] Character_Mapping;
@key[function] @AdaSubDefn{To_Domain} (Map : @key[in] Character_Mapping)
@key[return] Character_Sequence;
@key[function] @AdaSubDefn{To_Range} (Map : @key[in] Character_Mapping)
@key[return] Character_Sequence;
@key{type} @AdaTypeDefn{Character_Mapping_Function} @key{is}
@key{access} @key{function} (From : @key{in} Character) @key{return} Character;
@key[private]
... -- @RI{not specified by the language}
@key[end] Ada.Strings.Maps;
@end{example}
An object of type Character_Set represents a set of characters.
Null_Set represents the set containing no characters.
An object Obj of type Character_Range represents the set of characters
in the range Obj.Low .. Obj.High.
An object Obj of type Character_Ranges represents the
union of the sets corresponding to Obj(I) for I in Obj'Range.
@begin{DescribeCode}
@begin{Example}@Keepnext
@key[function] To_Set (Ranges : @key[in] Character_Ranges) @key[return] Character_Set;
@end{Example}
@Trailing@;If Ranges'Length=0 then Null_Set is returned;
otherwise the returned value represents the set corresponding to Ranges.
@begin{Example}@Keepnext
@key[function] To_Set (Span : @key[in] Character_Range) @key[return] Character_Set;
@end{Example}
The returned value represents the set containing each character in Span.
@begin{Example}@Keepnext
@key[function] To_Ranges (Set : @key[in] Character_Set) @key[return] Character_Ranges;
@end{Example}
@Trailing@;If Set = Null_Set then an empty Character_Ranges array is returned;
otherwise the shortest array of contiguous ranges of Character
values in Set, in increasing order of Low, is returned.
@begin{Example}@Keepnext
@key[function] "=" (Left, Right : @key[in] Character_Set) @key[return] Boolean;
@end{Example}
@Trailing@;The function "=" returns True if Left and Right represent identical sets,
and False otherwise.
@end{DescribeCode}
@Trailing@;Each of the logical operators "@key[not]", "@key[and]", "@key[or]",
and "@key[xor]" returns
a Character_Set value that represents the set obtained by applying
the corresponding operation to the set(s) represented by the parameter(s)
of the operator.
"@en"(Left, Right) is equivalent to "and"(Left, "not"(Right)).
@begin{reason}
The set minus operator is provided for efficiency.@end{reason}
@begin{DescribeCode}
@begin{Example}@Keepnext
@key[function] Is_In (Element : @key[in] Character;
Set : @key[in] Character_Set);
@key[return] Boolean;
@end{Example}
@Trailing@;Is_In returns True if Element is in Set, and False otherwise.
@begin{Example}@Keepnext
@key[function] Is_Subset (Elements : @key[in] Character_Set;
Set : @key[in] Character_Set)
@key[return] Boolean;
@end{Example}
@Trailing@;Is_Subset returns True if
Elements is a subset of Set, and False otherwise.
@begin{Example}@Keepnext
@key[subtype] Character_Sequence @key[is] String;
@end{Example}
@Trailing@;The Character_Sequence subtype is used to portray a set of character
values and also to identify the domain and range of a character
mapping.
@begin{reason}
Although a named subtype is redundant @em the predefined type String
could have been used for the parameter to To_Set and To_Mapping
below @em the use of a differently named subtype identifies the intended
purpose of the parameter.
@end{reason}
@begin{Example}@Keepnext
@key[function] To_Set (Sequence : @key[in] Character_Sequence) @key[return] Character_Set;@*
@key[function] To_Set (Singleton : @key[in] Character) @key[return] Character_Set;
@end{Example}
@Trailing@;Sequence portrays the set of character values that it explicitly
contains (ignoring duplicates).
Singleton portrays the set comprising a single Character.
Each of the To_Set functions
returns a Character_Set value that represents
the set portrayed by Sequence or Singleton.
@begin{Example}@Keepnext
@key[function] To_Sequence (Set : @key[in] Character_Set) @key[return] Character_Sequence;
@end{Example}
@Trailing@;The function To_Sequence returns a Character_Sequence value
containing each of the characters in the set represented by Set, in
ascending order with no duplicates.
@begin{Example}@Keepnext
@key[type] Character_Mapping @key[is] @key[private];
@end{Example}
@Trailing@;An object of type Character_Mapping represents a
Character-to-Character mapping.
@begin{Example}@Keepnext
@key[function] Value (Map : @key[in] Character_Mapping;
Element : @key[in] Character)
@key[return] Character;
@end{Example}
@Trailing@;The function Value returns the Character value to which Element maps
with respect to the mapping represented by Map.
@end{DescribeCode}
@Defn2{Term=[match], Sec=(a character to a pattern character)}
A character C @i{matches} a pattern character P
with respect to a given Character_Mapping value Map if
Value(Map, C) = P.
@Defn2{Term=[match], Sec=(a string to a pattern string)}
A string S @i{matches} a pattern string P with respect to a
given Character_Mapping if their lengths are the same
and if each character in S matches its corresponding character in
the pattern string P.
@begin{Discussion}
In an earlier version of the string handling packages,
the definition of matching was symmetrical, namely
C matches P if Value(Map,C) = Value(Map,P).
However, applying the mapping
to the pattern was confusing according to some reviewers.
Furthermore, if the symmetrical version is needed, it can
be achieved by applying the mapping to the pattern (via translation) prior to
passing it as a parameter.
@end{Discussion}
String handling subprograms that deal with character mappings have
parameters whose type is Character_Mapping.
@begin{DescribeCode}
@begin{Example}@Keepnext
Identity : @key[constant] Character_Mapping;
@end{Example}
@Trailing@;Identity maps each Character to itself.
@begin{Example}@Keepnext
@key[function] To_Mapping (From, To : @key[in] Character_Sequence)
@key[return] Character_Mapping;
@end{Example}
@Trailing@;To_Mapping produces a Character_Mapping such that
each element of From maps to the corresponding element of To,
and each other character maps to itself.
If From'Length /= To'Length, or
if some character is repeated in From, then Translation_Error
is propagated.
@begin{Example}@Keepnext
@key[function] To_Domain (Map : @key[in] Character_Mapping) @key[return] Character_Sequence;
@end{Example}
@Trailing@;To_Domain returns the shortest Character_Sequence value D such that
each character not in D maps to itself, and such that
the characters in D are in ascending order.
The lower bound of D is 1.
@begin{Example}@Keepnext
@key[function] To_Range (Map : @key[in] Character_Mapping) @key[return] Character_Sequence;
@end{Example}
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0048],ARef=[AI95-00151-01]}
@Trailing@;To_Range returns the Character_Sequence value R,
@Chg{New=[],Old=[with lower bound 1 and upper bound Map'Length,]}
such that if D = To_Domain(Map)@Chg{New=[, then R has the same bounds as D,
and],Old=[ then]} D(I) maps to R(I) for each I in D'Range.
@end{DescribeCode}
An object F of type Character_Mapping_Function maps a Character
value C to the Character value F.@key{all}(C), which is said to
@i{match} C with respect to mapping function F.
@Defn2[term=<match>,sec=<a character to a pattern character, with
respect to a character mapping function>]
@end{StaticSem}
@begin{Notes}
Character_Mapping and Character_Mapping_Function
are used both for character equivalence
mappings in the search subprograms (such as for case insensitivity) and
as transformational mappings in the Translate subprograms.
To_Domain(Identity) and To_Range(Identity) each returns the null string.
@begin{Reason}
Package Strings.Maps is not pure, since it declares an
access-to-subprogram type.
@end{Reason}
@end{Notes}
@begin{Examples}
To_Mapping("ABCD", "ZZAB") returns a Character_Mapping that maps 'A'
and 'B' to 'Z', 'C' to 'A', 'D' to 'B', and each other Character to
itself.
@end{Examples}
@begin{Extend95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00161-01]}
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
@b[Amendment Correction:] Added @nt{pragma} Preelaborable_Initialization to
types Character_Set and Character_Mapping, so that they can be used
to declare default-initialized objects in preelaborated units.]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00362-01]}
@ChgAdded{Version=[2],Text=[Strings.Maps is now Pure,
so it can be used in pure units.]}
@end{Extend95}
@begin{DiffWord95}
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0048],ARef=[AI95-00151-01]}
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the definition of
the range of the result of To_Range, since the Ada 95 definition makes no
sense.]}
@end{DiffWord95}
@LabeledSubClause{Fixed-Length String Handling}
@begin{Intro}
The language-defined package Strings.Fixed provides string-handling subprograms
for fixed-length strings;
that is, for values of type Standard.String.
Several of these subprograms are procedures that modify the contents of
a String that is passed as an @key[out] or an @key[in] @key[out] parameter;
each has additional
parameters to control the effect when the logical length of the result
differs from the parameter's length.
For each function that returns a String, the lower bound of the returned
value is 1.
@begin{Discussion}
@Chgref{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
Most operations that @Chg{Version=[2],New=[yield],Old=[yields]} a String
are provided both as a
function and as a procedure. The functional form is possibly a more aesthetic
style but may introduce overhead due to extra copying or dynamic memory
usage in some implementations. Thus a procedural form, with an @key[in]
@key[out] parameter so that all copying is done `in place', is also
supplied.@end{discussion}
The basic model embodied in the package is that a fixed-length string
comprises significant characters and possibly padding
(with space characters)
on either or both
ends. When a shorter string is copied to a longer string, padding
is inserted, and when a longer string is copied to a shorter one,
padding is stripped. The Move procedure in Strings.Fixed, which takes a
String as an @key[out] parameter, allows the programmer to control these
effects. Similar control is provided by the string transformation
procedures.
@end{Intro}
@begin{StaticSem}
@Leading@keepnext
@Leading@;The library package Strings.Fixed has the following declaration:
@begin{example}
@key[with] Ada.Strings.Maps;
@ChildUnit{Parent=[Ada.Strings],Child=[Fixed]}@key[package] Ada.Strings.Fixed @key[is]
@key[pragma] Preelaborate(Fixed);
--@RI{ "Copy" procedure for strings of possibly different lengths}
@key[procedure] @AdaSubDefn{Move} (Source : @key[in] String;
Target : @key[out] String;
Drop : @key[in] Truncation := Error;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
--@RI{ Search subprograms}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] String;
Pattern : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping := Maps.Identity)
@key[return] Natural;]}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] String;
Pattern : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index} (Source : @key[in] String;
Pattern : @key[in] String;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping
:= Maps.Identity)
@key[return] Natural;
@key[function] @AdaSubDefn{Index} (Source : @key[in] String;
Pattern : @key[in] String;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] String;
Set : @key[in] Maps.Character_Set;
From : @key[in] Positive;
Test : @key[in] Membership := Inside;
Going : @key[in] Direction := Forward)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index} (Source : @key[in] String;
Set : @key[in] Maps.Character_Set;
Test : @key[in] Membership := Inside;
Going : @key[in] Direction := Forward)
@key[return] Natural;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] String;
Going : @key[in] Direction := Forward)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] String;
Pattern : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping
:= Maps.Identity)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] String;
Pattern : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] String;
Set : @key[in] Maps.Character_Set)
@key[return] Natural;
@key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] String;
Set : @key[in] Maps.Character_Set;
Test : @key[in] Membership;
First : @key[out] Positive;
Last : @key[out] Natural);
@Keepnext@;--@RI{ String translation subprograms}
@key[function] @AdaSubDefn{Translate} (Source : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping)
@key[return] String;
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] String;
Mapping : @key[in] Maps.Character_Mapping);
@key[function] @AdaSubDefn{Translate} (Source : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] String;
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] String;
Mapping : @key[in] Maps.Character_Mapping_Function);
@Keepnext@;--@RI{ String transformation subprograms}
@key[function] @AdaSubDefn{Replace_Slice} (Source : @key[in] String;
Low : @key[in] Positive;
High : @key[in] Natural;
By : @key[in] String)
@key[return] String;
@key[procedure] @AdaSubDefn{Replace_Slice} (Source : @key[in] @key[out] String;
Low : @key[in] Positive;
High : @key[in] Natural;
By : @key[in] String;
Drop : @key[in] Truncation := Error;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@key[function] @AdaSubDefn{Insert} (Source : @key[in] String;
Before : @key[in] Positive;
New_Item : @key[in] String)
@key[return] String;
@key[procedure] @AdaSubDefn{Insert} (Source : @key[in] @key[out] String;
Before : @key[in] Positive;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Error);
@key[function] @AdaSubDefn{Overwrite} (Source : @key[in] String;
Position : @key[in] Positive;
New_Item : @key[in] String)
@key[return] String;
@key[procedure] @AdaSubDefn{Overwrite} (Source : @key[in] @key[out] String;
Position : @key[in] Positive;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Right);
@key[function] @AdaSubDefn{Delete} (Source : @key[in] String;
From : @key[in] Positive;
Through : @key[in] Natural)
@key[return] String;
@key[procedure] @AdaSubDefn{Delete} (Source : @key[in] @key[out] String;
From : @key[in] Positive;
Through : @key[in] Natural;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
--@RI{String selector subprograms}
@key[function] @AdaSubDefn{Trim} (Source : @key[in] String;
Side : @key[in] Trim_End)
@key[return] String;
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] String;
Side : @key[in] Trim_End;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@key[function] @AdaSubDefn{Trim} (Source : @key[in] String;
Left : @key[in] Maps.Character_Set;
Right : @key[in] Maps.Character_Set)
@key[return] String;
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] String;
Left : @key[in] Maps.Character_Set;
Right : @key[in] Maps.Character_Set;
Justify : @key[in] Alignment := Strings.Left;
Pad : @key[in] Character := Space);
@key[function] @AdaSubDefn{Head} (Source : @key[in] String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space)
@key[return] String;
@key[procedure] @AdaSubDefn{Head} (Source : @key[in] @key[out] String;
Count : @key[in] Natural;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@key[function] @AdaSubDefn{Tail} (Source : @key[in] String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space)
@key[return] String;
@key[procedure] @AdaSubDefn{Tail} (Source : @key[in] @key[out] String;
Count : @key[in] Natural;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@keepnext@;--@RI{String constructor functions}
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] Character) @key[return] String;
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] String) @key[return] String;
@key[end] Ada.Strings.Fixed;
@end{example}
The effects of the above subprograms are as follows.
@begin{DescribeCode}
@begin{Example}@Keepnext
@key[procedure] Move (Source : @key[in] String;
Target : @key[out] String;
Drop : @key[in] Truncation := Error;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@end{Example}
@Leading@;The Move procedure copies characters from Source to Target.
If Source has the same length as Target, then the effect is
to assign Source to Target.
If Source is shorter than Target then:
@begin{itemize}
If Justify=Left, then Source is copied into the first Source'Length
characters of Target.
If Justify=Right, then Source is copied into the last Source'Length
characters of Target.
If Justify=Center, then Source is copied into
the middle Source'Length characters of Target.
In this case, if the difference in length between
Target and Source is odd, then the extra Pad character
is on the right.
Pad is copied to each Target character not otherwise assigned.
@end{itemize}
If Source is longer than Target, then the effect is based on
Drop.
@begin{itemize}
If Drop=Left, then the rightmost Target'Length characters
of Source are copied into Target.
If Drop=Right, then the leftmost Target'Length characters
of Source are copied into Target.
@Leading@;If Drop=Error, then the effect depends on the value of the Justify
parameter and also on whether any characters in Source other than
Pad would fail to be copied:
@begin{inneritemize}
If Justify=Left, and if each of the rightmost Source'Length-Target'Length
characters in Source is Pad, then the leftmost Target'Length characters
of Source are copied to Target.
If Justify=Right, and if each of the leftmost Source'Length-Target'Length
characters in Source is Pad, then the rightmost Target'Length characters
of Source are copied to Target.
@Trailing@;Otherwise, Length_Error is propagated.
@end{inneritemize}
@end{itemize}
@begin{ramification}
The Move procedure will work even if Source and Target
overlap.@end{ramification}
@begin{reason}
The order of parameters (Source before Target) corresponds to
the order in COBOL's MOVE verb.@end{reason}
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Text=[@key[function] Index (Source : @key[in] String;
Pattern : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping := Maps.Identity)
@key[return] Natural;@*
@key[function] Index (Source : @key[in] String;
Pattern : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;]}
@end{Example}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Each Index function searches, starting from From, for a slice of
Source, with length Pattern'Length, that matches Pattern with respect to
Mapping; the parameter Going indicates the direction of the lookup. If
From is not in Source'Range, then Index_Error is propagated. If Going =
Forward, then Index returns the smallest index I which is greater than or equal
to From such that the slice of Source starting at I matches Pattern. If Going =
Backward, then Index returns the largest index I such that the slice of Source
starting at I matches Pattern and has an upper bound less than or equal to
From. If there is no such slice, then 0 is returned. If Pattern is the null
string, then Pattern_Error is propagated.]}
@begin{Discussion}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[There is no default parameter for From; the
default value would need to depend on other parameters (the bounds of Source
and the direction Going). It is better to use overloaded functions rather
than a special value to represent the default.]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[There is no default value for the Mapping
parameter that is a Character_Mapping_Function; if there were, a call would
be ambiguous since there is also a default for the Mapping parameter that is
a Character_Mapping.]}
@end{Discussion}
@begin{Example}@Keepnext
@key[function] Index (Source : @key[in] String;
Pattern : @key[in] String;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping
:= Maps.Identity)
@key[return] Natural;@*
@key[function] Index (Source : @key[in] String;
Pattern : @key[in] String;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;
@end{Example}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00301-01]}
@Comment{@ChgDeleted{Version=[2],Type=[Trailing],Text=[]}@Comment{Fake to hold conditional format.}Can't have both.}
@ChgAdded{Version=[2],Type=[Leading],Text=[]}@Comment{Fake to hold conditional format.}
@Chg{Version=[2],New=[If Going = Forward, returns],
Old=[Each Index function searches for a slice of Source, with length
Pattern'Length, that matches Pattern
with respect to Mapping;
the parameter Going indicates the direction of the lookup.
If Going = Forward, then Index
returns the smallest index I such that
the slice of Source starting at I matches Pattern.
If Going = Backward, then Index
returns the largest index I such that
the slice of Source starting at I matches Pattern.
If there is no such slice, then 0 is returned.
If Pattern is the null string then Pattern_Error is propagated.]}
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Text=[ Index (Source, Pattern, Source'First, Forward, Mapping);]}
@end{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Type=[Leading],Text=[otherwise returns]}
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[ Index (Source, Pattern, Source'Last, Backward, Mapping);]}
@end{Example}
@begin{discussion}
@ChgRef{Version=[2],Kind=[Deleted]}@ChgNote{Moved up}
@ChgAdded{Version=[2],Text=[There is no default value for the Mapping
parameter that is a Character_Mapping_Function; if there were, a call would
be ambiguous since there is also a default for the Mapping parameter that is
a Character_Mapping.]}
@end{discussion}
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Text=[@key[function] Index (Source : @key[in] String;
Set : @key[in] Maps.Character_Set;
From : @key[in] Positive;
Test : @key[in] Membership := Inside;
Going : @key[in] Direction := Forward)
@key[return] Natural;]}
@end{Example}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Index searches for the first or
last occurrence of any of a set of characters (when Test=Inside), or any of the
complement of a set of characters (when Test=Outside). If From is not in
Source'Range, then Index_Error is propagated. Otherwise, it returns the
smallest index I >= From (if Going=Forward) or the largest index I <= From (if
Going=Backward) such that Source(I) satisfies the Test condition with respect
to Set; it returns 0 if there is no such Character in Source.]}
@begin{Example}@Keepnext
@key[function] Index (Source : @key[in] String;
Set : @key[in] Maps.Character_Set;
Test : @key[in] Membership := Inside;
Going : @key[in] Direction := Forward)
@key[return] Natural;
@end{Example}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00301-01]}
@Comment{@ChgDeleted{Version=[2],Type=[Trailing],Text=[]}@Comment{Fake to hold conditional format.}Can't have both.}
@ChgAdded{Version=[2],Type=[Leading],Text=[]}@Comment{Fake to hold conditional format.}
@Chg{Version=[2],New=[If Going = Forward, returns],
Old=[Index searches for the first or last occurrence of any of a set of
characters (when Test=Inside),
or any of the complement of a set of characters (when Test=Outside).
It returns the smallest index I (if Going=Forward) or the largest index I
(if Going=Backward) such that
Source(I) satisfies the Test condition with respect to Set;
it returns 0 if there is no such Character in Source.]}
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Text=[ Index (Source, Set, Source'First, Test, Forward);]}
@end{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Type=[Leading],Text=[otherwise returns]}
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[ Index (Source, Set, Source'Last, Test, Backward);]}
@end{Example}
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],Text=[@key[function] Index_Non_Blank (Source : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward)
@key[return] Natural;]}
@end{Example}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns Index (Source, Maps.To_Set(Space), From, Outside, Going);]}
@begin{Example}@Keepnext
@key[function] Index_Non_Blank (Source : @key[in] String;
Going : @key[in] Direction := Forward)
@key[return] Natural;
@end{Example}
@Trailing@;Returns Index(Source, Maps.To_Set(Space), Outside, Going)
@begin{Example}@Keepnext
@key[function] Count (Source : @key[in] String;
Pattern : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping
:= Maps.Identity)
@key[return] Natural;@*
@key[function] Count (Source : @key[in] String;
Pattern : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;
@end{Example}
@Trailing@;Returns the maximum number of nonoverlapping slices of Source that
match Pattern with respect to Mapping.
If Pattern is the null string then Pattern_Error is propagated.
@begin{reason}
We say `maximum number' because it is possible to slice a source
string in different ways yielding different numbers of matches. For
example if Source is "ABABABA" and Pattern is "ABA", then Count yields
2, although there is a partitioning of Source that yields just 1 match,
for the middle slice. Saying `maximum number' is equivalent to saying
that the pattern match starts either at the low index or the high index
position.
@end{reason}
@begin{Example}@Keepnext
@key[function] Count (Source : @key[in] String;
Set : @key[in] Maps.Character_Set)
@key[return] Natural;
@end{Example}
@Trailing@;Returns the number of occurrences in Source of characters that
are in Set.
@begin{Example}@Keepnext
@key[procedure] Find_Token (Source : @key[in] String;
Set : @key[in] Maps.Character_Set;
Test : @key[in] Membership;
First : @key[out] Positive;
Last : @key[out] Natural);
@end{Example}
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]}
@Trailing@;Find_Token returns in First and Last the indices of the beginning
and end of the first slice of Source all of whose elements
satisfy the Test condition, and such that the elements
(if any) immediately before and after the slice do not
satisfy the Test condition.
If no such slice exists, then the value returned for Last is zero, and
the value returned for First is Source'First@Chg{New=[; however, if
Source'First is not in Positive then Constraint_Error
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of run-time check)}
is raised],Old=[]}.
@begin{Example}@Keepnext
@key[function] Translate (Source : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping)
@key[return] String;@*
@key[function] Translate (Source : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] String;
@end{Example}
@Trailing@;Returns the string S whose length is Source'Length and such
that S(I) is the character to which Mapping maps the corresponding
element of Source, for I in 1..Source'Length.
@begin{Example}@Keepnext
@key[procedure] Translate (Source : @key[in] @key[out] String;
Mapping : @key[in] Maps.Character_Mapping);@*
@key[procedure] Translate (Source : @key[in] @key[out] String;
Mapping : @key[in] Maps.Character_Mapping_Function);
@end{Example}
@Trailing@;Equivalent to Source := Translate(Source, Mapping).
@begin{Example}@Keepnext
@key[function] Replace_Slice (Source : @key[in] String;
Low : @key[in] Positive;
High : @key[in] Natural;
By : @key[in] String)
@key[return] String;
@end{Example}
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]}
@Chg{New=[@Leading],Old=[@Trailing]}If Low > Source'Last+1, or
High < Source'First@en@;1, then Index_Error is propagated.
Otherwise@Chg{New=[:],Old=[, if High >= Low then the returned string
comprises Source(Source'First..Low@en@;1) & By & Source(High+1..Source'Last),
and if High < Low then the returned string is
Insert(Source, Before=>Low, New_Item=>By).]}
@begin{Itemize}
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0049],ARef=[AI95-00128-01]}
@ChgAdded{Version=[1],Text=[If High >= Low, then the returned string comprises
Source(Source'First..Low@en@;1) & By & Source(High+1..Source'Last), but with
lower bound 1.@Trailing]}
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0049],ARef=[AI95-00128-01]}
@ChgAdded{Version=[1],Text=[If High < Low, then the returned string is
Insert(Source, Before=>Low, New_Item=>By).]}
@end{Itemize}
@begin{Example}@Keepnext
@key[procedure] Replace_Slice (Source : @key[in] @key[out] String;
Low : @key[in] Positive;
High : @key[in] Natural;
By : @key[in] String;
Drop : @key[in] Truncation := Error;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@end{Example}
@Trailing@;Equivalent to Move(Replace_Slice(Source, Low, High,
By), Source, Drop, Justify, Pad).
@begin{Example}@Keepnext
@key[function] Insert (Source : @key[in] String;
Before : @key[in] Positive;
New_Item : @key[in] String)
@key[return] String;
@end{Example}
@Trailing@;Propagates Index_Error if Before is not in Source'First .. Source'Last+1;
otherwise
returns Source(Source'First..Before@en@;1) & New_Item &
Source(Before..Source'Last), but with lower bound 1.
@begin{Example}@Keepnext
@key[procedure] Insert (Source : @key[in] @key[out] String;
Before : @key[in] Positive;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Error);
@end{Example}
@Trailing@;Equivalent to Move(Insert(Source, Before, New_Item), Source, Drop).
@begin{Example}@Keepnext
@key[function] Overwrite (Source : @key[in] String;
Position : @key[in] Positive;
New_Item : @key[in] String)
@key[return] String;
@end{Example}
@Trailing@;Propagates Index_Error if Position is not in Source'First .. Source'Last+1;
otherwise
returns the string obtained from Source by consecutively replacing
characters starting at Position with corresponding characters from
New_Item. If the end of Source is reached before the characters in
New_Item are exhausted, the remaining characters from New_Item are
appended to the string.
@begin{Example}@Keepnext
@key[procedure] Overwrite (Source : @key[in] @key[out] String;
Position : @key[in] Positive;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Right);
@end{Example}
@Trailing@;Equivalent to Move(Overwrite(Source, Position,
New_Item), Source, Drop).
@begin{Example}@Keepnext
@key[function] Delete (Source : @key[in] String;
From : @key[in] Positive;
Through : @key[in] Natural)
@key[return] String;
@end{Example}
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]}
@Trailing@;If From <= Through, the returned string is Replace_Slice(Source, From,
Through, ""), otherwise it is Source@Chg{New=[ with lower bound 1],Old=[]}.
@begin{Example}@Keepnext
@key[procedure] Delete (Source : @key[in] @key[out] String;
From : @key[in] Positive;
Through : @key[in] Natural;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@end{Example}
@Trailing@;Equivalent to Move(Delete(Source, From, Through),
Source, Justify => Justify, Pad => Pad).
@begin{Example}@Keepnext
@key[function] Trim (Source : @key[in] String;
Side : @key[in] Trim_End)
@key[return] String;
@end{Example}
@Trailing@;Returns the string obtained by removing from Source all leading
Space characters (if Side = Left), all trailing Space characters
(if Side = Right), or all leading and trailing Space characters
(if Side = Both).
@begin{Example}@Keepnext
@key[procedure] Trim (Source : @key[in] @key[out] String;
Side : @key[in] Trim_End;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@end{Example}
@Trailing@;Equivalent to Move(Trim(Source, Side), Source, Justify=>Justify, Pad=>Pad).
@begin{Example}@Keepnext
@key[function] Trim (Source : @key[in] String;
Left : @key[in] Maps.Character_Set;
Right : @key[in] Maps.Character_Set)
@key[return] String;
@end{Example}
@Trailing@;Returns the string obtained by removing from Source all leading
characters in Left and all trailing characters in Right.
@begin{Example}@Keepnext
@key[procedure] Trim (Source : @key[in] @key[out] String;
Left : @key[in] Maps.Character_Set;
Right : @key[in] Maps.Character_Set;
Justify : @key[in] Alignment := Strings.Left;
Pad : @key[in] Character := Space);
@end{Example}
@Trailing@;Equivalent to Move(Trim(Source, Left, Right), Source,
Justify => Justify, Pad=>Pad).
@begin{Example}@Keepnext
@key[function] Head (Source : @key[in] String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space)
@key[return] String;
@end{Example}
@Trailing@;Returns a string of length Count. If Count <= Source'Length, the
string comprises the first Count characters of Source. Otherwise its contents
are Source concatenated with Count@en@;Source'Length Pad characters.
@begin{Example}@Keepnext
@key[procedure] Head (Source : @key[in] @key[out] String;
Count : @key[in] Natural;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@end{Example}
@Trailing@;Equivalent to Move(Head(Source, Count, Pad), Source, Drop=>Error,
Justify=>Justify, Pad=>Pad).
@begin{Example}@Keepnext
@key[function] Tail (Source : @key[in] String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space)
@key[return] String;
@end{Example}
@Trailing@;Returns a string of length Count. If Count <= Source'Length, the
string comprises the last Count characters of Source. Otherwise its contents
are Count-Source'Length Pad characters concatenated with Source.
@begin{Example}@Keepnext
@key[procedure] Tail (Source : @key[in] @key[out] String;
Count : @key[in] Natural;
Justify : @key[in] Alignment := Left;
Pad : @key[in] Character := Space);
@end{Example}
@Trailing@;Equivalent to Move(Tail(Source, Count, Pad), Source, Drop=>Error,
Justify=>Justify, Pad=>Pad).
@begin{Example}@Keepnext
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] Character) @key[return] String;@*
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] String) @key[return] String;
@end{Example}
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]}
These functions replicate a character or string a specified number
of times. The first function returns a string whose length is Left and each
of whose elements is Right. The second function returns a string whose
length is Left*Right'Length and whose value is the null
string if Left = 0 and @Chg{New=[otherwise ],Old=[]}is
(Left@en@;1)*Right & Right @Chg{New=[with lower bound 1],Old=[otherwise]}.
@end{DescribeCode}
@end{StaticSem}
@begin{Notes}
In the Index and Count functions taking Pattern and Mapping parameters,
the actual String parameter passed to Pattern should comprise characters
occurring as target characters of the mapping. Otherwise the pattern
will not match.
In the Insert subprograms, inserting at the end of a string is obtained
by passing Source'Last+1 as the Before parameter.
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of run-time check)}
If a null Character_Mapping_Function is passed to any of the
string handling subprograms, Constraint_Error is propagated.
@end{Notes}
@begin{Incompatible95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95}
Overloaded versions of Index and Index_Non_Blank are newly added to
Strings.Fixed. If Strings.Fixed is referenced in a @nt{use_clause}, and an
entity @i<E> with a @nt{defining_identifier} of Index or Index_Non_Blank is
defined in a package that is also referenced in a @nt{use_clause}, the entity
@i<E> may no longer be use-visible, resulting in errors. This should be rare
and is easily fixed if it does occur.]}
@end{Incompatible95}
@begin{DiffWord95}
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0049],ARef=[AI95-00128-01]}
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that Find_Token
may raise Constraint_Error if Source'First is not in Positive (which is
only possible for a null string).]}
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0049],ARef=[AI95-00128-01]}
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that Replace_Slice,
Delete, and "*" always return a string with lower bound 1.]}
@end{DiffWord95}
@LabeledSubClause{Bounded-Length String Handling}
@begin{Intro}
The language-defined package Strings.Bounded provides a generic package
each of whose instances yields a private type Bounded_String and a
set of operations. An object of a particular Bounded_String type
represents a String whose low bound is 1 and whose length
can vary conceptually
between 0 and a maximum size established at the
generic instantiation.
The subprograms for fixed-length string handling
are either overloaded directly for Bounded_String, or are modified as
needed to reflect the variability in length. Additionally, since the
Bounded_String type is private, appropriate constructor and selector
operations are provided.
@begin{reason}
Strings.Bounded declares an inner generic package, versus itself
being directly a generic child of Strings, in order to retain
compatibility with a version of the string-handling packages that
is generic with respect to the character and string types.@end{reason}
@begin{reason}
The bound of a bounded-length string is specified as a parameter
to a generic, versus as the value for a discriminant, because of the
inappropriateness of assignment and equality of discriminated types for
the copying and comparison of bounded strings.@end{reason}
@end{Intro}
@begin{StaticSem}
@Leading@Keepnext@;The library package Strings.Bounded has the following declaration:
@begin{example}
@key[with] Ada.Strings.Maps;
@ChildUnit{Parent=[Ada.Strings],Child=[Bounded]}@key[package] Ada.Strings.Bounded @key[is]
@key[pragma] Preelaborate(Bounded);
@key[generic]
Max : Positive; --@RI{ Maximum length of a Bounded_String}
@key[package] @AdaPackDefn{Generic_Bounded_Length} @key[is]
@AdaObjDefn{Max_Length} : @key[constant] Positive := Max;
@key[type] @AdaTypeDefn{Bounded_String} @key[is] @key[private];
@AdaObjDefn{Null_Bounded_String} : @key[constant] Bounded_String;
@key[subtype] @AdaSubtypeDefn{Name=[Length_Range],Of=[Natural]} @key[is] Natural @key[range] 0 .. Max_Length;
@key[function] @AdaSubDefn{Length} (Source : @key[in] Bounded_String) @key[return] Length_Range;
--@RI{ Conversion, Concatenation, and Selection functions}
@key[function] @AdaSubDefn{To_Bounded_String} (Source : @key[in] String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{To_String} (Source : @key[in] Bounded_String) @key[return] String;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[procedure] @AdaSubDefn{Set_Bounded_String}
(Target : @key[out] Bounded_String;
Source : @key[in] String;
Drop : @key[in] Truncation := Error);]}
@key[function] @AdaSubDefn{Append} (Left, Right : @key[in] Bounded_String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{Append} (Left : @key[in] Bounded_String;
Right : @key[in] String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{Append} (Left : @key[in] String;
Right : @key[in] Bounded_String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{Append} (Left : @key[in] Bounded_String;
Right : @key[in] Character;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{Append} (Left : @key[in] Character;
Right : @key[in] Bounded_String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Bounded_String;
New_Item : @key[in] Bounded_String;
Drop : @key[in] Truncation := Error);
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Bounded_String;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Error);
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Bounded_String;
New_Item : @key[in] Character;
Drop : @key[in] Truncation := Error);
@key[function] "&" (Left, Right : @key[in] Bounded_String)
@key[return] Bounded_String;
@key[function] "&" (Left : @key[in] Bounded_String; Right : @key[in] String)
@key[return] Bounded_String;
@key[function] "&" (Left : @key[in] String; Right : @key[in] Bounded_String)
@key[return] Bounded_String;
@key[function] "&" (Left : @key[in] Bounded_String; Right : @key[in] Character)
@key[return] Bounded_String;
@key[function] "&" (Left : @key[in] Character; Right : @key[in] Bounded_String)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{Element} (Source : @key[in] Bounded_String;
Index : @key[in] Positive)
@key[return] Character;
@key[procedure] @AdaSubDefn{Replace_Element} (Source : @key[in] @key[out] Bounded_String;
Index : @key[in] Positive;
By : @key[in] Character);
@key[function] @AdaSubDefn{Slice} (Source : @key[in] Bounded_String;
Low : @key[in] Positive;
High : @key[in] Natural)
@key[return] String;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Bounded_Slice}
(Source : @key[in] Bounded_String;
Low : @key[in] Positive;
High : @key[in] Natural)
@key[return] Bounded_String;]}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[procedure] @AdaSubDefn{Bounded_Slice}
(Source : @key[in] Bounded_String;
Target : @key[out] Bounded_String;
Low : @key[in] Positive;
High : @key[in] Natural);]}
@key[function] "=" (Left, Right : @key[in] Bounded_String) @key[return] Boolean;
@key[function] "=" (Left : @key[in] Bounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] "=" (Left : @key[in] String; Right : @key[in] Bounded_String)
@key[return] Boolean;
@key[function] "<" (Left, Right : @key[in] Bounded_String) @key[return] Boolean;
@key[function] "<" (Left : @key[in] Bounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] "<" (Left : @key[in] String; Right : @key[in] Bounded_String)
@key[return] Boolean;
@key[function] "<=" (Left, Right : @key[in] Bounded_String) @key[return] Boolean;
@key[function] "<=" (Left : @key[in] Bounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] "<=" (Left : @key[in] String; Right : @key[in] Bounded_String)
@key[return] Boolean;
@key[function] ">" (Left, Right : @key[in] Bounded_String) @key[return] Boolean;
@key[function] ">" (Left : @key[in] Bounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] ">" (Left : @key[in] String; Right : @key[in] Bounded_String)
@key[return] Boolean;
@key[function] ">=" (Left, Right : @key[in] Bounded_String) @key[return] Boolean;
@key[function] ">=" (Left : @key[in] Bounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] ">=" (Left : @key[in] String; Right : @key[in] Bounded_String)
@key[return] Boolean;
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00301-01]}
--@RI{ Search @Chg{Version=[2],New=[subprograms],Old=[functions]}}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String;
Pattern : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping := Maps.Identity)
@key[return] Natural;]}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String;
Pattern : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String;
Pattern : @key[in] String;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping
:= Maps.Identity)
@key[return] Natural;
@key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String;
Pattern : @key[in] String;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String;
Set : @key[in] Maps.Character_Set;
From : @key[in] Positive;
Test : @key[in] Membership := Inside;
Going : @key[in] Direction := Forward)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index} (Source : @key[in] Bounded_String;
Set : @key[in] Maps.Character_Set;
Test : @key[in] Membership := Inside;
Going : @key[in] Direction := Forward)
@key[return] Natural;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] Bounded_String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] Bounded_String;
Going : @key[in] Direction := Forward)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] Bounded_String;
Pattern : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping
:= Maps.Identity)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] Bounded_String;
Pattern : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] Bounded_String;
Set : @key[in] Maps.Character_Set)
@key[return] Natural;
@key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] Bounded_String;
Set : @key[in] Maps.Character_Set;
Test : @key[in] Membership;
First : @key[out] Positive;
Last : @key[out] Natural);
@Keepnext@; --@RI{ String translation subprograms}
@key[function] @AdaSubDefn{Translate} (Source : @key[in] Bounded_String;
Mapping : @key[in] Maps.Character_Mapping)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] Bounded_String;
Mapping : @key[in] Maps.Character_Mapping);
@key[function] @AdaSubDefn{Translate} (Source : @key[in] Bounded_String;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] Bounded_String;
Mapping : @key[in] Maps.Character_Mapping_Function);
@Keepnext@; --@RI{ String transformation subprograms}
@key[function] @AdaSubDefn{Replace_Slice} (Source : @key[in] Bounded_String;
Low : @key[in] Positive;
High : @key[in] Natural;
By : @key[in] String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Replace_Slice} (Source : @key[in] @key[out] Bounded_String;
Low : @key[in] Positive;
High : @key[in] Natural;
By : @key[in] String;
Drop : @key[in] Truncation := Error);
@key[function] @AdaSubDefn{Insert} (Source : @key[in] Bounded_String;
Before : @key[in] Positive;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Insert} (Source : @key[in] @key[out] Bounded_String;
Before : @key[in] Positive;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Error);
@key[function] @AdaSubDefn{Overwrite} (Source : @key[in] Bounded_String;
Position : @key[in] Positive;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Overwrite} (Source : @key[in] @key[out] Bounded_String;
Position : @key[in] Positive;
New_Item : @key[in] String;
Drop : @key[in] Truncation := Error);
@key[function] @AdaSubDefn{Delete} (Source : @key[in] Bounded_String;
From : @key[in] Positive;
Through : @key[in] Natural)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Delete} (Source : @key[in] @key[out] Bounded_String;
From : @key[in] Positive;
Through : @key[in] Natural);
--@RI{String selector subprograms}
@key[function] @AdaSubDefn{Trim} (Source : @key[in] Bounded_String;
Side : @key[in] Trim_End)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] Bounded_String;
Side : @key[in] Trim_End);
@key[function] @AdaSubDefn{Trim} (Source : @key[in] Bounded_String;
Left : @key[in] Maps.Character_Set;
Right : @key[in] Maps.Character_Set)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] Bounded_String;
Left : @key[in] Maps.Character_Set;
Right : @key[in] Maps.Character_Set);
@key[function] @AdaSubDefn{Head} (Source : @key[in] Bounded_String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Head} (Source : @key[in] @key[out] Bounded_String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space;
Drop : @key[in] Truncation := Error);
@key[function] @AdaSubDefn{Tail} (Source : @key[in] Bounded_String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[procedure] @AdaSubDefn{Tail} (Source : @key[in] @key[out] Bounded_String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space;
Drop : @key[in] Truncation := Error);
--@RI{String constructor subprograms}
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] Character)
@key[return] Bounded_String;
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] String)
@key[return] Bounded_String;
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] Bounded_String)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{Replicate} (Count : @key[in] Natural;
Item : @key[in] Character;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{Replicate} (Count : @key[in] Natural;
Item : @key[in] String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[function] @AdaSubDefn{Replicate} (Count : @key[in] Natural;
Item : @key[in] Bounded_String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@key[private]
... -- @RI{not specified by the language}
@key[end] Generic_Bounded_Length;
@key[end] Ada.Strings.Bounded;
@end{example}
@begin{ImplNote}
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0097],ARef=[AI95-00115-01]}
@ChgRef{Version=[2],Kind=[DeletedAdded],ARef=[AI95-00344-01]}
@ChgDeleted{Version=[2],Text=[@Chg{Version=[1],New=[Bounded_String cannot be
implemented as a (directly) controlled type,
as Ada.Strings.Bounded.Generic_Bounded_Length can be instantiated at any
nesting depth. Bounded_String could have
a component of a controlled type, as long as that type is declared in some
other (non-generic) package (including directly in Ada.Strings.Bounded).],Old=[]}]}
@ChgNote{AI-344 allows controlled types to be declared at
any nesting depth, so this note is obsolete.}
@end{ImplNote}
Null_Bounded_String represents the null string.
If an object of type Bounded_String is not otherwise initialized, it
will be initialized to the same value as Null_Bounded_String.
@begin{DescribeCode}
@begin{Example}@Keepnext
@key[function] Length (Source : @key[in] Bounded_String) @key[return] Length_Range;
@end{Example}
@Trailing@;The Length function returns the length of the string represented by
Source.
@begin{Example}@Keepnext
@key[function] To_Bounded_String (Source : @key[in] String;
Drop : @key[in] Truncation := Error)
@key[return] Bounded_String;
@end{Example}
@Leading@;If Source'Length <= Max_Length then this function
returns a Bounded_String that represents Source.
Otherwise the effect depends on the value of Drop:
@begin{itemize}
If Drop=Left, then
the result is a Bounded_String that represents the string comprising
the rightmost Max_Length characters of Source.
If Drop=Right, then
the result is a Bounded_String that represents the string comprising
the leftmost Max_Length characters of Source.
@Trailing@;If Drop=Error, then Strings.Length_Error is propagated.
@end{itemize}
@begin{Example}@Keepnext
@key[function] To_String (Source : @key[in] Bounded_String) @key[return] String;
@end{Example}
@Trailing@;To_String returns the String value with lower bound 1 represented by
Source. If B is a Bounded_String, then B = To_Bounded_String(To_String(B)).
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key[procedure] Set_Bounded_String
(Target : @key[out] Bounded_String;
Source : @key[in] String;
Drop : @key[in] Truncation := Error);]}
@end{Example}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Equivalent to Target := To_Bounded_String (Source, Drop);]}
@end{DescribeCode}
Each of the Append functions returns a Bounded_String obtained by concatenating
the string or character given or represented by one of the parameters,
with the string or character given or represented by the other parameter,
and applying To_Bounded_String to the concatenation result string,
with Drop as provided to the Append function.
Each of the procedures Append(Source, New_Item, Drop) has the same
effect as the corresponding assignment Source :=
Append(Source, New_Item, Drop).
Each of the "&" functions has the same effect as the corresponding
Append function, with Error as the Drop parameter.
@begin{DescribeCode}
@begin{Example}@Keepnext
@key[function] Element (Source : @key[in] Bounded_String;
Index : @key[in] Positive)
@key[return] Character;
@end{Example}
@Trailing@;Returns the character at position Index in the string represented
by Source; propagates Index_Error if Index > Length(Source).
@begin{Example}@Keepnext
@key[procedure] Replace_Element (Source : @key[in] @key[out] Bounded_String;
Index : @key[in] Positive;
By : @key[in] Character);
@end{Example}
@Trailing@;Updates Source such that the character at position Index in the
string represented by Source is By;
propagates Index_Error if Index > Length(Source).
@begin{Example}@Keepnext
@key[function] Slice (Source : @key[in] Bounded_String;
Low : @key[in] Positive;
High : @key[in] Natural)
@key[return] String;
@end{Example}
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]}
@ChgRef{Version=[1],Kind=[Revised],ARef=[AI95-00238-01]}
@Trailing@;Returns the slice at positions Low through High in the string
represented by Source; propagates Index_Error if
Low > Length(Source)+1@Chg{New=[ or High > Length(Source)],Old=[]}.@Chg{Version=[2],
New=[ The bounds of the returned string are Low and High.],Old=[]}.
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key[function] Bounded_Slice
(Source : @key[in] Bounded_String;
Low : @key[in] Positive;
High : @key[in] Natural)
@key[return] Bounded_String;]}
@end{Example}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the slice at positions Low
through High in the string represented by Source as a bounded string;
propagates Index_Error if Low > Length(Source)+1 or High > Length(Source).]}
@begin{Example}
@ChgRef{Version=[2],Kind=[Added]}
@ChgAdded{Version=[2],KeepNext=[T],Text=[@key[procedure] Bounded_Slice
(Source : @key[in] Bounded_String;
Target : @key[out] Bounded_String;
Low : @key[in] Positive;
High : @key[in] Natural);]}
@end{Example}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Equivalent to Target := Bounded_Slice (Source, Low, High);]}
@end{DescribeCode}
Each of the functions "=", "<", ">", "<=", and ">="
returns the same result as the corresponding String
operation applied to the String values given or represented by
the two parameters.
Each of the search subprograms (Index, Index_Non_Blank,
Count, Find_Token) has the
same effect as the corresponding subprogram in Strings.Fixed applied
to the string represented by the Bounded_String parameter.
Each of the Translate subprograms, when applied to a Bounded_String, has
an analogous effect to the corresponding subprogram in Strings.Fixed.
For the Translate function,
the translation is applied to the string represented by the Bounded_String
parameter, and the result is converted (via To_Bounded_String) to a
Bounded_String.
For the Translate procedure, the string represented by the Bounded_String
parameter after the translation is given by the Translate function for
fixed-length strings applied to the string represented by the
original value of the parameter.
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0049],ARef=[AI95-00128-01]}
Each of the transformation subprograms (Replace_Slice, Insert,
Overwrite, Delete), selector subprograms (Trim, Head, Tail),
and constructor functions ("*") has an effect based on its
corresponding subprogram in Strings.Fixed, and Replicate is based on
Fixed."*". @Chg{New=[In the case of a function],
Old=[For each of these subprograms]}, the corresponding
fixed-length string subprogram is applied to the string represented by
the Bounded_String parameter. To_Bounded_String is applied the result
string, with Drop (or Error in the case of Generic_Bounded_Length."*")
determining the effect when the string length exceeds Max_Length.
@Chg{New=[In the case of a procedure, the corresponding function in
Strings.@!Bounded.@!Generic_@!Bounded_@!Length is applied, with the result
assigned into the Source parameter.],Old=[]}
@begin{Ramification}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00114-01]}
The "/=" operations between Bounded_String and String, and between String
and Bounded_String, are automatically defined based on the @Chg{Version=[2],
New=[corresponding],Old=[corrsponding]}
"=" operations.
@end{Ramification}
@end{StaticSem}
@begin{ImplAdvice}
Bounded string objects should not be implemented by implicit
pointers and dynamic allocation.
@ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2],
Text=[Bounded string objects should not be implemented by implicit
pointers and dynamic allocation.]}]}
@begin{ImplNote}
@Leading@;The following is a possible implementation of the private part
of the package:
@begin{example}
@key[type] Bounded_String_Internals (Length : Length_Range := 0) @key[is]
@key[record]
Data : String(1..Length);
@key[end] @key[record];
@key[type] Bounded_String @key[is]
@key[record]
Data : Bounded_String_Internals; --@RI{ Unconstrained}
@key[end] @key[record];
Null_Bounded_String : @key[constant] Bounded_String :=
(Data => (Length => 0,
Data => (1..0 => ' ')));
@end{example}
@end{ImplNote}
@end{ImplAdvice}
@begin{Inconsistent95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00238-01]}
@ChgAdded{Version=[2],Text=[@Defn{inconsistencies with Ada 95}
@B[Amendment Correction:] The bounds of the string returned from
Slice are now defined. This is technically an inconsistency; if a program
depended on some other lower bound for the string returned from Slice,
it could fail when compiled with Ada 2005. Such code is not portable even
between Ada 95 implementations, so it should be very rare.]}
@end{Inconsistent95}
@begin{Incompatible95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95}
Procedure Set_Bounded_String, two Bounded_Slice subprograms, and overloaded
versions of Index and Index_Non_Blank are newly added to Strings.Bounded.
If Strings.Bounded is
referenced in a @nt{use_clause}, and an entity @i<E> with the same
@nt{defining_identifier} as a new entity in Strings.Bounded is defined in a
package that is also referenced in a @nt{use_clause}, the entity @i<E> may no
longer be use-visible, resulting in errors. This should be rare and is easily
fixed if it does occur.]}
@end{Incompatible95}
@begin{DiffWord95}
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0049],ARef=[AI95-00128-01]}
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the conditions for
which Slice raises Index_Error.]}
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0049],ARef=[AI95-00128-01]}
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified the meaning of
transformation, selector, and constructor subprograms by describing the
effects of procedures and functions separately.]}
@end{DiffWord95}
@LabeledSubClause{Unbounded-Length String Handling}
@begin{Intro}
The language-defined package Strings.Unbounded provides a
private type Unbounded_String and a
set of operations. An object of type Unbounded_String represents a String
whose low bound is 1 and whose length
can vary conceptually between 0 and Natural'Last.
The subprograms for fixed-length string handling
are either overloaded directly for Unbounded_String, or are modified as
needed to reflect the flexibility in length. Since the
Unbounded_String type is private, relevant constructor and selector
operations are provided.
@begin{reason}
The transformation operations for fixed- and bounded-length strings that
are not necessarily length preserving are supplied for Unbounded_String
as procedures as well as functions.
This allows an implementation to do an initial allocation for
an unbounded string and to avoid further allocations as long
as the length does not exceed the allocated length.
@end{reason}
@end{Intro}
@begin{StaticSem}
@Leading@;The library package Strings.Unbounded has the following declaration:
@begin{example}
@key[with] Ada.Strings.Maps;
@ChildUnit{Parent=[Ada.Strings],Child=[Unbounded]}@key[package] Ada.Strings.Unbounded @key[is]
@key[pragma] Preelaborate(Unbounded);
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]}
@key[type] @AdaTypeDefn{Unbounded_String} @key[is] @key[private];@Chg{Version=[2],New=[
@key[pragma] Preelaborable_Initialization(Unbounded_String);],Old=[]}
@AdaObjDefn{Null_Unbounded_String} : @key[constant] Unbounded_String;
@key[function] @AdaSubDefn{Length} (Source : @key[in] Unbounded_String) @key[return] Natural;
@key[type] @AdaTypeDefn{String_Access} @key[is] @key[access] @key[all] String;
@key[procedure] @AdaSubDefn{Free} (X : @key[in] @key[out] String_Access);
--@RI{ Conversion, Concatenation, and Selection functions}
@key[function] @AdaSubDefn{To_Unbounded_String} (Source : @key[in] String)
@key[return] Unbounded_String;
@key[function] @AdaSubDefn{To_Unbounded_String} (Length : @key[in] Natural)
@key[return] Unbounded_String;
@key[function] @AdaSubDefn{To_String} (Source : @key[in] Unbounded_String) @key[return] String;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[procedure] @AdaSubDefn{Set_Unbounded_String}
(Target : @key[out] Unbounded_String;
Source : @key[in] String);]}
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Unbounded_String;
New_Item : @key[in] Unbounded_String);
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Unbounded_String;
New_Item : @key[in] String);
@key[procedure] @AdaSubDefn{Append} (Source : @key[in out] Unbounded_String;
New_Item : @key[in] Character);
@key[function] "&" (Left, Right : @key[in] Unbounded_String)
@key[return] Unbounded_String;
@key[function] "&" (Left : @key[in] Unbounded_String; Right : @key[in] String)
@key[return] Unbounded_String;
@key[function] "&" (Left : @key[in] String; Right : @key[in] Unbounded_String)
@key[return] Unbounded_String;
@key[function] "&" (Left : @key[in] Unbounded_String; Right : @key[in] Character)
@key[return] Unbounded_String;
@key[function] "&" (Left : @key[in] Character; Right : @key[in] Unbounded_String)
@key[return] Unbounded_String;
@key[function] @AdaSubDefn{Element} (Source : @key[in] Unbounded_String;
Index : @key[in] Positive)
@key[return] Character;
@key[procedure] @AdaSubDefn{Replace_Element} (Source : @key[in] @key[out] Unbounded_String;
Index : @key[in] Positive;
By : @key[in] Character);
@key[function] @AdaSubDefn{Slice} (Source : @key[in] Unbounded_String;
Low : @key[in] Positive;
High : @key[in] Natural)
@key[return] String;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Unbounded_Slice}
(Source : @key[in] Unbounded_String;
Low : @key[in] Positive;
High : @key[in] Natural)
@key[return] Unbounded_String;]}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[procedure] @AdaSubDefn{Unbounded_Slice}
(Source : @key[in] Unbounded_String;
Target : @key[out] Unbounded_String;
Low : @key[in] Positive;
High : @key[in] Natural);]}
@key[function] "=" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean;
@key[function] "=" (Left : @key[in] Unbounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] "=" (Left : @key[in] String; Right : @key[in] Unbounded_String)
@key[return] Boolean;
@key[function] "<" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean;
@key[function] "<" (Left : @key[in] Unbounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] "<" (Left : @key[in] String; Right : @key[in] Unbounded_String)
@key[return] Boolean;
@key[function] "<=" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean;
@key[function] "<=" (Left : @key[in] Unbounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] "<=" (Left : @key[in] String; Right : @key[in] Unbounded_String)
@key[return] Boolean;
@key[function] ">" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean;
@key[function] ">" (Left : @key[in] Unbounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] ">" (Left : @key[in] String; Right : @key[in] Unbounded_String)
@key[return] Boolean;
@key[function] ">=" (Left, Right : @key[in] Unbounded_String) @key[return] Boolean;
@key[function] ">=" (Left : @key[in] Unbounded_String; Right : @key[in] String)
@key[return] Boolean;
@key[function] ">=" (Left : @key[in] String; Right : @key[in] Unbounded_String)
@key[return] Boolean;
--@RI{ Search subprograms}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String;
Pattern : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping := Maps.Identity)
@key[return] Natural;]}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String;
Pattern : @key[in] String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String;
Pattern : @key[in] String;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping
:= Maps.Identity)
@key[return] Natural;
@key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String;
Pattern : @key[in] String;
Going : @key[in] Direction := Forward;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String;
Set : @key[in] Maps.Character_Set;
From : @key[in] Positive;
Test : @key[in] Membership := Inside;
Going : @key[in] Direction := Forward)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index} (Source : @key[in] Unbounded_String;
Set : @key[in] Maps.Character_Set;
Test : @key[in] Membership := Inside;
Going : @key[in] Direction := Forward) @key[return] Natural;
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[ @key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] Unbounded_String;
From : @key[in] Positive;
Going : @key[in] Direction := Forward)
@key[return] Natural;]}
@key[function] @AdaSubDefn{Index_Non_Blank} (Source : @key[in] Unbounded_String;
Going : @key[in] Direction := Forward)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] Unbounded_String;
Pattern : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping
:= Maps.Identity)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] Unbounded_String;
Pattern : @key[in] String;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Natural;
@key[function] @AdaSubDefn{Count} (Source : @key[in] Unbounded_String;
Set : @key[in] Maps.Character_Set)
@key[return] Natural;
@key[procedure] @AdaSubDefn{Find_Token} (Source : @key[in] Unbounded_String;
Set : @key[in] Maps.Character_Set;
Test : @key[in] Membership;
First : @key[out] Positive;
Last : @key[out] Natural);
@Keepnext@;--@RI{ String translation subprograms}
@key[function] @AdaSubDefn{Translate} (Source : @key[in] Unbounded_String;
Mapping : @key[in] Maps.Character_Mapping)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] Unbounded_String;
Mapping : @key[in] Maps.Character_Mapping);
@key[function] @AdaSubDefn{Translate} (Source : @key[in] Unbounded_String;
Mapping : @key[in] Maps.Character_Mapping_Function)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Translate} (Source : @key[in] @key[out] Unbounded_String;
Mapping : @key[in] Maps.Character_Mapping_Function);
@Keepnext@;--@RI{ String transformation subprograms}
@key[function] @AdaSubDefn{Replace_Slice} (Source : @key[in] Unbounded_String;
Low : @key[in] Positive;
High : @key[in] Natural;
By : @key[in] String)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Replace_Slice} (Source : @key[in] @key[out] Unbounded_String;
Low : @key[in] Positive;
High : @key[in] Natural;
By : @key[in] String);
@key[function] @AdaSubDefn{Insert} (Source : @key[in] Unbounded_String;
Before : @key[in] Positive;
New_Item : @key[in] String)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Insert} (Source : @key[in] @key[out] Unbounded_String;
Before : @key[in] Positive;
New_Item : @key[in] String);
@key[function] @AdaSubDefn{Overwrite} (Source : @key[in] Unbounded_String;
Position : @key[in] Positive;
New_Item : @key[in] String)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Overwrite} (Source : @key[in] @key[out] Unbounded_String;
Position : @key[in] Positive;
New_Item : @key[in] String);
@key[function] @AdaSubDefn{Delete} (Source : @key[in] Unbounded_String;
From : @key[in] Positive;
Through : @key[in] Natural)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Delete} (Source : @key[in] @key[out] Unbounded_String;
From : @key[in] Positive;
Through : @key[in] Natural);
@key[function] @AdaSubDefn{Trim} (Source : @key[in] Unbounded_String;
Side : @key[in] Trim_End)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] Unbounded_String;
Side : @key[in] Trim_End);
@key[function] @AdaSubDefn{Trim} (Source : @key[in] Unbounded_String;
Left : @key[in] Maps.Character_Set;
Right : @key[in] Maps.Character_Set)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Trim} (Source : @key[in] @key[out] Unbounded_String;
Left : @key[in] Maps.Character_Set;
Right : @key[in] Maps.Character_Set);
@key[function] @AdaSubDefn{Head} (Source : @key[in] Unbounded_String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Head} (Source : @key[in] @key[out] Unbounded_String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space);
@key[function] @AdaSubDefn{Tail} (Source : @key[in] Unbounded_String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space)
@key[return] Unbounded_String;
@key[procedure] @AdaSubDefn{Tail} (Source : @key[in] @key[out] Unbounded_String;
Count : @key[in] Natural;
Pad : @key[in] Character := Space);
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] Character)
@key[return] Unbounded_String;
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] String)
@key[return] Unbounded_String;
@key[function] "*" (Left : @key[in] Natural;
Right : @key[in] Unbounded_String)
@key[return] Unbounded_String;
@key[private]
... -- @RI{not specified by the language}
@key[end] Ada.Strings.Unbounded;
@end{example}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00360-01]}
@ChgAdded{Version=[2],Text=[The type Unbounded_String needs finalization
(see @RefSecNum{User-Defined Assignment and Finalization}).]}
Null_Unbounded_String represents the null String.
If an object of type Unbounded_String is not otherwise initialized, it
will be initialized to the same value as Null_Unbounded_String.
The function Length returns the length of the String represented by Source.
The type String_Access provides a (non-private) access type for explicit
processing of unbounded-length strings. The procedure Free performs
an unchecked deallocation of an object of type String_Access.
The function To_Unbounded_String(Source : in String)
returns an Unbounded_String that represents Source.
The function To_Unbounded_String(Length : in Natural)
returns an Unbounded_String that represents an uninitialized String
whose length is Length.
@Leading@;The function To_String returns the String with lower bound 1
represented by Source. To_String and To_Unbounded_String are related as follows:
@begin{itemize}
If S is a String, then To_String(To_Unbounded_String(S)) = S.
If U is an Unbounded_String, then To_Unbounded_String(To_String(U)) = U.
@end{itemize}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[The procedure Set_Unbounded_String sets Target to an Unbounded_String that
represents Source.]}
For each of the Append procedures,
the resulting string represented by the Source parameter is given
by the concatenation of the original value of Source and the value
of New_Item.
Each of the "&" functions returns an Unbounded_String obtained by concatenating
the string or character given or represented by one of the parameters,
with the string or character given or represented by the other parameter,
and applying To_Unbounded_String to the concatenation result string.
The Element, Replace_Element, and Slice subprograms have the same effect
as the corresponding bounded-length string subprograms.
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[The function Unbounded_Slice returns the slice at
positions Low through High in the string represented by Source as an
Unbounded_String. The procedure Unbounded_Slice sets Target to the
Unbounded_String representing the slice at positions Low through High in the
string represented by Source. Both routines propagate Index_Error if Low >
Length(Source)+1 or High > Length(Source).]}
Each of the functions "=", "<", ">", "<=", and ">="
returns the same result as the corresponding String
operation applied to the String values given or represented by Left and Right.
Each of the search subprograms (Index, Index_Non_Blank, Count, Find_Token)
has the same effect as the corresponding subprogram in Strings.Fixed applied
to the string represented by the Unbounded_String parameter.
The Translate function has
an analogous effect to the corresponding subprogram in Strings.Fixed.
The translation is applied to the string represented by the Unbounded_String
parameter, and the result is converted (via To_Unbounded_String) to an
Unbounded_String.
Each of the transformation functions (Replace_Slice, Insert, Overwrite,
Delete), selector functions (Trim, Head, Tail), and constructor functions
("*") is likewise analogous to its corresponding
subprogram in Strings.Fixed. For each of the subprograms,
the corresponding fixed-length string subprogram is applied to the string
represented by the Unbounded_String parameter, and
To_Unbounded_String is applied the result string.
For each of the procedures Translate,
Replace_Slice, Insert, Overwrite, Delete,
Trim, Head, and Tail, the resulting string represented by the Source parameter
is given by the corresponding function for fixed-length strings applied to
the string represented by Source's original value.
@end{StaticSem}
@begin{ImplReq}
No storage associated
with an Unbounded_String object shall be
lost upon assignment or scope exit.
@begin{ImplNote}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00301-01]}
A sample implementation of the private part of
the package and several of the subprograms appears in the @Chg{Version=[2],
New=[Ada 95 ],Old=[]}Rationale.
@end{ImplNote}
@end{ImplReq}
@begin{Incompatible95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00360-01]}
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95}
@b[Amendment Correction:] Type Unbounded_String is defined to need
finalization. If the restriction No_Nested_Finalization (see
@RefSecNum{Tasking Restrictions}) applies to the partition, and
Unbounded_String does not have a controlled part, it will not be allowed in
local objects in Ada 2005 whereas it would be allowed in original Ada 95.
Such code is not portable, as most Ada compilers have a controlled part in
Unbounded_String, and thus would be illegal.]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[
Procedure Set_Unbounded_String, two Unbounded_Slice subprograms, and overloaded
versions of Index and Index_Non_Blank are newly added to Strings.Unbounded.
If Strings.Unbounded is
referenced in a @nt{use_clause}, and an entity @i<E> with the same
@nt{defining_identifier} as a new entity in Strings.Unbounded is defined in a
package that is also referenced in a @nt{use_clause}, the entity @i<E> may no
longer be use-visible, resulting in errors. This should be rare and is easily
fixed if it does occur.]}
@end{Incompatible95}
@begin{Extend95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00161-01]}
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
@b[Amendment Correction:] Added a @nt{pragma} Preelaborable_Initialization to
type Unbounded_String, so that it can be used to declare default-initialized
objects in preelaborated units.]}
@end{Extend95}
@LabeledSubClause{String-Handling Sets and Mappings}
@begin{Intro}
The language-defined package Strings.Maps.Constants declares
Character_Set
and Character_Mapping
constants corresponding to classification and conversion functions
in package Characters.Handling.
@begin{discussion}
The Constants package is a child of Strings.Maps since it needs
visibility of the private part of Strings.Maps in order to
initialize the constants
in a preelaborable way (i.e. via aggregates versus function calls).
@end{discussion}
@end{Intro}
@begin{StaticSem}
@Leading@;The library package Strings.Maps.Constants has the following declaration:
@begin{example}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00362-01]}
@ChildUnit{Parent=[Ada.Strings.Maps],Child=[Constants]}@key[package] Ada.Strings.Maps.Constants @key[is]
@key[pragma] @Chg{Version=[2],New=[Pure],Old=[Preelaborate]}(Constants);
@AdaObjDefn{Control_Set} : @key[constant] Character_Set;
@AdaObjDefn{Graphic_Set} : @key[constant] Character_Set;
@AdaObjDefn{Letter_Set} : @key[constant] Character_Set;
@AdaObjDefn{Lower_Set} : @key[constant] Character_Set;
@AdaObjDefn{Upper_Set} : @key[constant] Character_Set;
@AdaObjDefn{Basic_Set} : @key[constant] Character_Set;
@AdaObjDefn{Decimal_Digit_Set} : @key[constant] Character_Set;
@AdaObjDefn{Hexadecimal_Digit_Set} : @key[constant] Character_Set;
@AdaObjDefn{Alphanumeric_Set} : @key[constant] Character_Set;
@AdaObjDefn{Special_Set} : @key[constant] Character_Set;
@AdaObjDefn{ISO_646_Set} : @key[constant] Character_Set;
@AdaObjDefn{Lower_Case_Map} : @key[constant] Character_Mapping;
--@RI{Maps to lower case for letters, else identity}
@AdaObjDefn{Upper_Case_Map} : @key[constant] Character_Mapping;
--@RI{Maps to upper case for letters, else identity}
@AdaObjDefn{Basic_Map} : @key[constant] Character_Mapping;
--@RI{Maps to basic letter for letters, else identity}
@key[private]
... -- @RI{not specified by the language}
@key[end] Ada.Strings.Maps.Constants;
@end{example}
Each of these constants represents a correspondingly named
set of characters or
character mapping in Characters.Handling
(see @refsecnum(The Package Characters.Handling)).
@end{StaticSem}
@begin{Extend95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00362-01]}
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
Strings.Maps.Constants is now Pure,
so it can be used in pure units.]}
@end{Extend95}
@LabeledSubClause{Wide_String Handling}
@begin{Intro}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00302-03]}
Facilities for handling strings of Wide_Character elements are
found in the packages Strings.@!Wide_Maps, Strings.@!Wide_Fixed,
Strings.@!Wide_@!Bounded, Strings.@!Wide_@!Unbounded,
and Strings.@!Wide_Maps.@!Wide_@!Constants@Chg{Version=[2],New=[, and in the
functions Strings.@!Wide_Hash, Strings.@!Wide_Fixed.@!Wide_Hash,
Strings.@!Wide_Bounded.@!Wide_Hash, and Strings.@!Wide_Unbounded.@!Wide_Hash],Old=[]}.
They provide the same string-handling operations
as the corresponding packages@Chg{Version=[2],New=[ and functions],Old=[]}
for strings of Character elements.
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Fixed]}
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Bounded]}
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Unbounded]}
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Hash]}
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Fixed],Child=[Wide_@!Hash]}
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Bounded],Child=[Wide_@!Hash]}
@SubChildUnit{Parent=[Ada.Strings.Wide_@!Unbounded],Child=[Wide_@!Hash]}
@ChildUnit{Parent=[Ada.Strings.Wide_@!Maps],Child=[Wide_@!Constants]}
@end{Intro}
@begin{StaticSem}
The package Strings.Wide_Maps has the following declaration.
@begin{example}
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_@!Maps]}@key[package] Ada.Strings.Wide_Maps @key[is]
@key[pragma] Preelaborate(Wide_Maps);
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]}
--@RI{ Representation for a set of Wide_Character values:}
@key[type] @AdaTypeDefn{Wide_Character_Set} @key[is] @key[private];@Chg{Version=[2],New=[
@key[pragma] Preelaborable_Initialization(Wide_Character_Set);],Old=[]}
@AdaObjDefn{Null_Set} : @key[constant] Wide_Character_Set;
@key[type] @AdaTypeDefn{Wide_Character_Range} @key[is]
@key[record]
Low : Wide_Character;
High : Wide_Character;
@key[end] @key[record];
-- @RI{Represents Wide_Character range Low..High}
@key[type] @AdaTypeDefn{Wide_Character_Ranges} @key[is] @key[array] (Positive @key[range] <>)
@key[of] Wide_Character_Range;
@key[function] @AdaSubDefn{To_Set} (Ranges : @key[in] Wide_Character_Ranges)
@key[return] Wide_Character_Set;
@key[function] @AdaSubDefn{To_Set} (Span : @key[in] Wide_Character_Range)
@key[return] Wide_Character_Set;
@key[function] @AdaSubDefn{To_Ranges} (Set : @key[in] Wide_Character_Set)
@key[return] Wide_Character_Ranges;
@key[function] "=" (Left, Right : @key[in] Wide_Character_Set) @key[return] Boolean;
@key[function] "@key[not]" (Right : @key[in] Wide_Character_Set)
@key[return] Wide_Character_Set;
@key[function] "@key[and]" (Left, Right : @key[in] Wide_Character_Set)
@key[return] Wide_Character_Set;
@key[function] "@key[or]" (Left, Right : @key[in] Wide_Character_Set)
@key[return] Wide_Character_Set;
@key[function] "@key[xor]" (Left, Right : @key[in] Wide_Character_Set)
@key[return] Wide_Character_Set;
@key[function] "-" (Left, Right : @key[in] Wide_Character_Set)
@key[return] Wide_Character_Set;
@key[function] @AdaSubDefn{Is_In} (Element : @key[in] Wide_Character;
Set : @key[in] Wide_Character_Set)
@key[return] Boolean;
@key[function] @AdaSubDefn{Is_Subset} (Elements : @key[in] Wide_Character_Set;
Set : @key[in] Wide_Character_Set)
@key[return] Boolean;
@key[function] "<=" (Left : @key[in] Wide_Character_Set;
Right : @key[in] Wide_Character_Set)
@key[return] Boolean @key[renames] Is_Subset;
--@RI{ Alternative representation for a set of Wide_Character values:}
@key[subtype] @AdaSubtypeDefn{Name=[Wide_Character_Sequence],Of=[Wide_String]} @key[is] Wide_String;
@key[function] @AdaSubDefn{To_Set} (Sequence : @key[in] Wide_Character_Sequence)
@key[return] Wide_Character_Set;
@key[function] @AdaSubDefn{To_Set} (Singleton : @key[in] Wide_Character)
@key[return] Wide_Character_Set;
@key[function] @AdaSubDefn{To_Sequence} (Set : @key[in] Wide_Character_Set)
@key[return] Wide_Character_Sequence;
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00161-01]}
--@RI{ Representation for a Wide_Character to Wide_Character mapping:}
@key[type] @AdaTypeDefn{Wide_Character_Mapping} @key[is] @key[private];@Chg{Version=[2],New=[
@key[pragma] Preelaborable_Initialization(Wide_Character_Mapping);],Old=[]}
@key[function] @AdaSubDefn{Value} (Map : @key[in] Wide_Character_Mapping;
Element : @key[in] Wide_Character)
@key[return] Wide_Character;
@AdaObjDefn{Identity} : @key[constant] Wide_Character_Mapping;
@key[function] @AdaSubDefn{To_Mapping} (From, To : @key[in] Wide_Character_Sequence)
@key[return] Wide_Character_Mapping;
@key[function] @AdaSubDefn{To_Domain} (Map : @key[in] Wide_Character_Mapping)
@key[return] Wide_Character_Sequence;
@key[function] @AdaSubDefn{To_Range} (Map : @key[in] Wide_Character_Mapping)
@key[return] Wide_Character_Sequence;
@key{type} @AdaTypeDefn{Wide_Character_Mapping_Function} @key{is}
@key{access} @key{function} (From : @key{in} Wide_Character) @key{return} Wide_Character;
@key[private]
... -- @RI{not specified by the language}
@key[end] Ada.Strings.Wide_Maps;
@end{example}
The context clause for each of the packages Strings.Wide_Fixed,
Strings.Wide_Bounded, and Strings.Wide_Unbounded
identifies Strings.Wide_Maps instead of Strings.Maps.
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00302-03]}
@Leading@;For each of the packages Strings.Fixed, Strings.Bounded,
Strings.Unbounded, and Strings.Maps.Constants@Chg{Version=[2],New=[, and
for functions Strings.Hash, Strings.Fixed.Hash, Strings.Bounded.Hash,
and Strings.Unbounded.Hash,],Old=[]}
the corresponding wide string package has the same contents except that
@begin{itemize}
Wide_Space replaces Space
Wide_Character replaces Character
Wide_String replaces String
Wide_Character_Set replaces Character_Set
Wide_Character_Mapping replaces Character_Mapping
Wide_Character_Mapping_Function replaces Character_Mapping_Function
Wide_Maps replaces Maps
Bounded_Wide_String replaces Bounded_String
Null_Bounded_Wide_String replaces Null_Bounded_String
To_Bounded_Wide_String replaces To_Bounded_String
To_Wide_String replaces To_String
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[Set_Bounded_Wide_String replaces Set_Bounded_String]}
Unbounded_Wide_String replaces Unbounded_String
Null_Unbounded_Wide_String replaces Null_Unbounded_String
Wide_String_Access replaces String_Access
To_Unbounded_Wide_String replaces To_Unbounded_String
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[Set_Unbounded_Wide_String replaces Set_Unbounded_String]}
@end{Itemize}
@Leading@keepnext@;The following additional declaration is present in
Strings.Wide_Maps.Wide_Constants:
@begin{example}
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
@AdaObjDefn{Character_Set} : @key[constant] Wide_Maps.Wide_Character_Set;
--@RI{Contains each Wide_Character value WC such that}@Chg{Version=[2],New=[
--],Old=[]}@RI{Characters.@Chg{Version=[2],New=[Conversions.],Old=[]}Is_Character(WC) is True}
@end{example}
@end{StaticSem}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00395-01]}
@ChgAdded{Version=[2],Text=[Each Wide_Character_Set constant in the package
Strings.Wide_Maps.Wide_Constants contains no values outside the Character
portion of Wide_Character. Similarly, each Wide_Character_Mapping constant in
this package is the identity mapping when applied to any element outside the
Character portion of Wide_Character.]}
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00362-01]}
@ChgAdded{Version=[2],Text=[@nt{Pragma} Pure is replaced by
@nt{pragma} Preelaborate in Strings.Wide_Maps.Wide_Constants.]}
@begin{Notes}
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of run-time check)}
If a null Wide_Character_Mapping_Function is passed to any of the
Wide_String handling subprograms, Constraint_Error is propagated.
@ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00395-01]}
@ChgDeleted{Version=[2],Text=[Each Wide_Character_Set constant in the package
Strings.Wide_Maps.Wide_Constants contains no values outside the Character
portion of Wide_Character. Similarly, each Wide_Character_Mapping
constant in this package is the identity mapping when applied to
any element outside the Character portion of Wide_Character.]}
@end{Notes}
@begin{Incompatible95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95}
Various new operations are added to Strings.Wide_Fixed, Strings.Wide_Bounded,
and Strings.Wide_Unbounded. If one of these packages is referenced in a
@nt{use_clause}, and an entity @i<E> with the same @nt{defining_identifier}
as a new entity is defined in a package that is also referenced in a
@nt{use_clause}, the entity @i<E> may no longer be use-visible, resulting in
errors. This should be rare and is easily fixed if it does occur.]}
@end{Incompatible95}
@begin{Extend95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00161-01]}
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
@b[Amendment Correction:] Added @nt{pragma} Preelaborable_Initialization to
types Wide_Character_Set and Wide_Character_Mapping, so that they can be
used to declare default-initialized objects in preelaborated units.]}
@end{Extend95}
@begin{DiffWord95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
@ChgAdded{Version=[2],Text=[Corrected the description of Character_Set.]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]}
@ChgAdded{Version=[2],Text=[Added wide versions of Strings.Hash and
Strings.Unbounded.Hash.]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00362-01]}
@ChgAdded{Version=[2],Text=[Added wording so that
Strings.Wide_Maps.Wide_Constants does not change to Pure.]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00395-01]}
@ChgAdded{Version=[2],Text=[The second Note is now normative text, since
there is no way to derive it from the other rules. It's a little
weird given the use of Unicode character classifications in Ada 2005;
but changing it would be inconsistent with Ada 95 and a one-to-one
mapping isn't necessarily correct anyway.]}
@end{DiffWord95}
@LabeledAddedSubClause{Version=[2],Name=[Wide_Wide_String Handling]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
@ChgAdded{Version=[2],Text=[Facilities for handling strings of
Wide_Wide_Character elements are found in
the packages Strings.@!Wide_Wide_@!Maps, Strings.@!Wide_Wide_@!Fixed,
Strings.@!Wide_Wide_@!Bounded, Strings.@!Wide_Wide_@!Unbounded, and
Strings.@!Wide_Wide_@!Maps.@!Wide_Wide_@!Constants, and in the
functions Strings.@!Wide_Wide_@!Hash, Strings.@!Wide_Wide_@!Fixed.@!Wide_Wide_@!Hash,
Strings.@!Wide_Wide_@!Bounded.@!Wide_@!Wide_@!Hash, and
Strings.@!Wide_Wide_@!Unbounded.@!Wide_@!Wide_@!Hash.
They provide the same
string-handling operations as the corresponding packages and functions
for strings of Character elements.
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_Fixed]}
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_Bounded]}
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_Unbounded]}
@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_@!Hash]}
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Fixed],Child=[Wide_Wide_@!Hash]}
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Bounded],Child=[Wide_Wide_@!Hash]}
@SubChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Unbounded],Child=[Wide_Wide_@!Hash]}
@ChildUnit{Parent=[Ada.Strings.Wide_Wide_@!Maps],Child=[Wide_Wide_@!Constants]}]}
@begin{StaticSem}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
@ChgAdded{Version=[2],Type=[Leading],Text=[The library package Strings.Wide_Wide_Maps has the following declaration.]}
@begin{Example}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[@key<package> Ada.Strings.Wide_Wide_Maps @key<is>@ChildUnit{Parent=[Ada.Strings],Child=[Wide_Wide_Maps]}
@key<pragma> Preelaborate(Wide_Wide_Maps);]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ -- @RI[Representation for a set of Wide_Wide_Character values:]
@key<type> @AdaTypeDefn{Wide_Wide_Character_Set} @key<is private>;
@key<pragma> Preelaborable_Initialization(Wide_Wide_Character_Set);]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @AdaObjDefn{Null_Set} : @key<constant> Wide_Wide_Character_Set;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<type> @AdaTypeDefn{Wide_Wide_Character_Range} @key<is>
@key<record>
Low : Wide_Wide_Character;
High : Wide_Wide_Character;
@key<end record>;
-- @RI[Represents Wide_Wide_Character range Low..High]]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<type> @AdaTypeDefn{Wide_Wide_Character_Ranges} @key<is array> (Positive @key<range> <>)
@key<of> Wide_Wide_Character_Range;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Set} (Ranges : @key<in> Wide_Wide_Character_Ranges)
@key<return> Wide_Wide_Character_Set;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Set} (Span : @key<in> Wide_Wide_Character_Range)
@key<return> Wide_Wide_Character_Set;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Ranges} (Set : @key<in> Wide_Wide_Character_Set)
@key<return> Wide_Wide_Character_Ranges;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> "=" (Left, Right : @key<in> Wide_Wide_Character_Set) @key<return> Boolean;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> "@key<not>" (Right : @key<in> Wide_Wide_Character_Set)
@key<return> Wide_Wide_Character_Set;
@key<function> "@key<and>" (Left, Right : @key<in> Wide_Wide_Character_Set)
@key<return> Wide_Wide_Character_Set;
@key<function> "@key<or>" (Left, Right : @key<in> Wide_Wide_Character_Set)
@key<return> Wide_Wide_Character_Set;
@key<function> "@key<xor>" (Left, Right : @key<in> Wide_Wide_Character_Set)
@key<return> Wide_Wide_Character_Set;
@key<function> "-" (Left, Right : @key<in> Wide_Wide_Character_Set)
@key<return> Wide_Wide_Character_Set;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{Is_In} (Element : @key<in> Wide_Wide_Character;
Set : @key<in> Wide_Wide_Character_Set)
@key<return> Boolean;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{Is_Subset} (Elements : @key<in> Wide_Wide_Character_Set;
Set : @key<in> Wide_Wide_Character_Set)
@key<return> Boolean;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> "<=" (Left : @key<in> Wide_Wide_Character_Set;
Right : @key<in> Wide_Wide_Character_Set)
@key<return> Boolean @key<renames> Is_Subset;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ -- @RI[Alternative representation for a set of Wide_Wide_Character values:]
@key<subtype> @AdaSubtypeDefn{Name=[Wide_Wide_Character_Sequence],Of=[Wide_Wide_String]} @key<is> Wide_Wide_String;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Set} (Sequence : @key<in> Wide_Wide_Character_Sequence)
@key<return> Wide_Wide_Character_Set;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Set} (Singleton : @key<in> Wide_Wide_Character)
@key<return> Wide_Wide_Character_Set;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Sequence} (Set : @key<in> Wide_Wide_Character_Set)
@key<return> Wide_Wide_Character_Sequence;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ -- @RI[Representation for a Wide_Wide_Character to Wide_Wide_Character]
-- @RI[mapping:]
@key<type> @AdaTypeDefn{Wide_Wide_Character_Mapping} @key<is private>;
@key<pragma> Preelaborable_Initialization(Wide_Wide_Character_Mapping);]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{Value} (Map : @key<in> Wide_Wide_Character_Mapping;
Element : @key<in> Wide_Wide_Character)
@key<return> Wide_Wide_Character;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @AdaObjDefn{Identity} : @key<constant> Wide_Wide_Character_Mapping;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Mapping} (From, To : @key<in> Wide_Wide_Character_Sequence)
@key<return> Wide_Wide_Character_Mapping;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Domain} (Map : @key<in> Wide_Wide_Character_Mapping)
@key<return> Wide_Wide_Character_Sequence;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<function> @AdaSubDefn{To_Range} (Map : @key<in> Wide_Wide_Character_Mapping)
@key<return> Wide_Wide_Character_Sequence;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[ @key<type> @AdaTypeDefn{Wide_Wide_Character_Mapping_Function} @key<is>
@key<access function> (From : @key<in> Wide_Wide_Character)
@key<return> Wide_Wide_Character;]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[@key<private>
... -- @RI[not specified by the language]
@key<end> Ada.Strings.Wide_Wide_Maps;]}
@end{Example}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
@ChgAdded{Version=[2],Text=[@ChildUnit{Parent=[Ada.Strings.Wide_@!Maps],Child=[Wide_@!Constants]}
The context clause for each of the packages Strings.Wide_Wide_Fixed,
Strings.Wide_Wide_Bounded, and Strings.Wide_Wide_Unbounded identifies
Strings.Wide_Wide_Maps instead of Strings.Maps.]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
@ChgAdded{Version=[2],Type=[Leading],Text=[For each of the packages
Strings.@!Fixed, Strings.@!Bounded, Strings.@!Unbounded, and Strings.@!Maps.Constants,
and for functions Strings.@!Hash, Strings.@!Fixed.Hash, Strings.@!Bounded.Hash,
and Strings.@!Unbounded.Hash,
the corresponding wide wide string package or function has the same contents
except that]}
@begin{Itemize}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Wide_Wide_Space replaces Space]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Wide_Wide_Character replaces Character]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Wide_Wide_String replaces String]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Wide_Wide_Character_Set replaces Character_Set]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Wide_Wide_Character_Mapping replaces Character_Mapping]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Wide_Wide_Character_Mapping_Function replaces Character_Mapping_Function]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Wide_Wide_Maps replaces Maps]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Bounded_Wide_Wide_String replaces Bounded_String]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Null_Bounded_Wide_Wide_String replaces Null_Bounded_String]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[To_Bounded_Wide_Wide_String replaces To_Bounded_String]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[To_Wide_Wide_String replaces To_String]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[Set_Bounded_Wide_Wide_String replaces Set_Bounded_String]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Unbounded_Wide_Wide_String replaces Unbounded_String]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Null_Unbounded_Wide_Wide_String replaces Null_Unbounded_String]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[Wide_Wide_String_Access replaces String_Access]}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[To_Unbounded_Wide_Wide_String replaces To_Unbounded_String]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00301-01]}
@ChgAdded{Version=[2],Text=[Set_Unbounded_Wide_Wide_String replaces Set_Unbounded_String]}
@end{Itemize}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
@ChgAdded{Version=[2],Type=[Leading],Keepnext=[T],Text=[The following
additional declarations are present in
Strings.Wide_Wide_Maps.Wide_Wide_Constants:]}
@begin{Example}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[@AdaObjDefn{Character_Set} : @key<constant> Wide_Wide_Maps.Wide_Wide_Character_Set;
-- @RI[Contains each Wide_Wide_Character value WWC such that]
-- @RI[Characters.Conversions.Is_Character(WWC) is True]
@AdaObjDefn{Wide_Character_Set} : @key<constant> Wide_Wide_Maps.Wide_Wide_Character_Set;
-- @RI[Contains each Wide_Wide_Character value WWC such that]
-- @RI[Characters.Conversions.Is_Wide_Character(WWC) is True]]}
@end{Example}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00395-01]}
@ChgAdded{Version=[2],Text=[Each Wide_Wide_Character_Set constant in the package
Strings.@!Wide_Wide_@!Maps.@!Wide_Wide_@!Constants contains no values outside the Character
portion of Wide_Wide_@!Character. Similarly, each Wide_Wide_@!Character_@!Mapping constant in
this package is the identity mapping when applied to any element outside the
Character portion of Wide_Wide_Character.]}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00395-01]}
@ChgAdded{Version=[2],Text=[@nt{Pragma} Pure is replaced by
@nt{pragma} Preelaborate in Strings.Wide_Wide_Maps.Wide_Wide_Constants.]}
@end{StaticSem}
@begin{Notes}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]}
@ChgAdded{Version=[2],Text=[@Defn2{Term=[Constraint_Error],Sec=(raised by failure of run-time check)}
If a null Wide_Wide_Character_Mapping_Function is passed to any of the
Wide_Wide_String handling subprograms, Constraint_Error is propagated.]}
@end{Notes}
@begin{Extend95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00395-01]}
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
The double-wide string-handling packages (Strings.Wide_Wide_Maps,
Strings.Wide_Wide_Fixed, Strings.Wide_Wide_Bounded,
Strings.Wide_Wide_Unbounded, and Strings.Wide_Wide_Maps.Wide_Wide_Constants),
and functions Strings.Wide_Wide_Hash and
Strings.Wide_Wide_Unbounded.Wide_Wide_Hash are new.]}
@end{Extend95}
@LabeledAddedSubClause{Version=[2],Name=[String Hashing]}
@begin{StaticSem}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]}
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library
function Strings.Hash has the following declaration:]}
@begin{Example}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[@key<with> Ada.Containers;
@key<function> Ada.Strings.Hash (Key : String) @key<return> Containers.Hash_Type;@SubChildUnit{Parent=[Ada.Strings],Child=[Hash]}
@key<pragma> Pure(Hash);]}
@end{Example}
@begin{DescribeCode}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns an implementation-defined
value which is a function of the value of Key. If @i<A> and @i<B> are strings
such that @i<A> equals @i<B>, Hash(@i<A>) equals Hash(@i<B>).]}
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
Text=[The values returned by Strings.Hash.]}]}
@end{DescribeCode}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]}
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library
function Strings.Fixed.Hash has the following declaration:]}
@begin{Example}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[@key<with> Ada.Containers, Ada.Strings.Hash;
@key<function> Ada.Strings.Fixed.Hash (Key : String) @key<return> Containers.Hash_Type
@key<renames> Ada.Strings.Hash;
@key<pragma> Pure(Hash);]}
@end{Example}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]}
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The generic library
function Strings.Bounded.Hash has the following declaration:]}
@begin{Example}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[@key<with> Ada.Containers;
@key<generic>@SubChildUnit{Parent=[Ada.Strings.Bounded],Child=[Hash]}
@key<with package> Bounded @key<is>
@key<new> Ada.Strings.Bounded.Generic_Bounded_Length (<>);
@key<function> Ada.Strings.Bounded.Hash (Key : Bounded.Bounded_String)
@key<return> Containers.Hash_Type;
@key<pragma> Preelaborate(Hash);]}
@end{Example}
@begin{DescribeCode}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Strings.Bounded.Hash is
equivalent to the function call
Strings.Hash (Bounded.To_String (Key));]}
@end{DescribeCode}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]}
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library
function Strings.Unbounded.Hash has the following declaration:]}
@begin{Example}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[@key<with> Ada.Containers;
@key<function> Ada.Strings.Unbounded.Hash (Key : Unbounded_String)@SubChildUnit{Parent=[Ada.Strings.Unbounded],Child=[Hash]}
@key<return> Containers.Hash_Type;
@key<pragma> Preelaborate(Hash);]}
@end{Example}
@begin{DescribeCode}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Type=[Trailing],Text=[Strings.Unbounded.Hash is
equivalent to the function call Strings.Hash (To_String (Key));]}
@end{DescribeCode}
@end{StaticSem}
@begin{ImplAdvice}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]}
@ChgAdded{Version=[2],Text=[The Hash functions should be good hash
functions, returning a wide spread of values for different string values. It
should be unlikely for similar strings to return the same value.]}
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],
Text=[Strings.Hash should be good a hash
function, returning a wide spread of values for different string values,
and similar strings should rarely return the same value.]}]}
@begin{Ramification}
@ChgRef{Version=[2],Kind=[AddedNormal]}
@ChgAdded{Version=[2],Text=[The other functions are defined in terms of
Strings.Hash, so they don't need separate advice in the Annex.]}
@end{Ramification}
@end{ImplAdvice}
@begin{Extend95}
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00302-03]}
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95}
The Strings.Hash, Strings.Fixed.Hash, Strings.Bounded.Hash, and
Strings.Unbounded.Hash functions are new.]}
@end{Extend95}
|