1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755
|
with -- ARM_Output,
-- ARM_Contents,
-- Ada.Text_IO,
Ada.Exceptions,
Ada.Strings.Maps.Constants,
Ada.Strings.Fixed,
Ada.Unchecked_Deallocation;
package body ARM_HTML is
--
-- Ada reference manual formatter (ARM_Form).
--
-- This package defines the HTML output object.
-- Output objects are responsible for implementing the details of
-- a particular format.
--
-- ---------------------------------------
-- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-- 2008, 2009, 2011, 2012, 2013, 2016
-- AXE Consultants. All rights reserved.
-- P.O. Box 1512, Madison WI 53701
-- E-Mail: randy@rrsoftware.com
--
-- ARM_Form is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License version 3
-- as published by the Free Software Foundation.
--
-- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS"
-- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY,
-- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL.
-- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL,
-- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES,
-- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-- DAMAGES.
--
-- A copy of the GNU General Public License is available in the file
-- gpl-3-0.txt in the standard distribution of the ARM_Form tool.
-- Otherwise, see <http://www.gnu.org/licenses/>.
--
-- If the GPLv3 license is not satisfactory for your needs, a commercial
-- use license is available for this tool. Contact Randy at AXE Consultants
-- for more information.
--
-- ---------------------------------------
--
-- Edit History:
--
-- 4/19/00 - RLB - Created base package.
-- 4/21/00 - RLB - Added line break and hard space routines.
-- 4/24/00 - RLB - Added DR references and Insert/Delete text formats.
-- 4/25/00 - RLB - Added size to format.
-- 4/26/00 - RLB - Added paragraph formats.
-- 4/29/00 - RLB - Added more paragraph formats.
-- 5/10/00 - RLB - Added even more formats.
-- - RLB - Added End_Hang_Item.
-- 5/12/00 - RLB - Added No_Prefix to Start_Paragraph.
-- 5/13/00 - RLB - Added Special_Character.
-- 5/16/00 - RLB - Added additional special characters.
-- 5/17/00 - RLB - Added New_Page.
-- 5/22/00 - RLB - Added Includes_Changes to Create.
-- 5/23/00 - RLB - Added multi-column formats and New_Column.
-- - Added Tab_Info and Tab_Stops.
-- 5/24/00 - RLB - Added Location to Text_Format.
-- - RLB - Added No_Breaks and Keep_with_Next to Start_Paragraph.
-- 5/25/00 - RLB - Added Big_Files to Create. Added Justification.
-- - RLB - Added Separator_Lines and TOC routines.
-- - RLB - Added "Legal" to the footer, pointing at the title page.
-- 5/26/00 - RLB - Added table operations.
-- 5/28/00 - RLB - Added index references.
-- 6/ 2/00 - RLB - Added Soft_Line_Break.
-- 8/ 2/00 - RLB - Added Soft_Hyphen_Break and left and right quote
-- characters.
-- - RLB - Added additional styles.
-- 8/ 7/00 - RLB - Added Leading flag to Start_Paragraph, removed "Leading"
-- styles.
-- 8/11/00 - RLB - Added Hanging_in_Bulleted styles.
-- 8/16/00 - RLB - Added Code_Indented_Nested_Bulleted.
-- 8/17/00 - RLB - Replaced "Leading" by "Space_After".
-- - RLB - Added Nested_Enumerated.
-- 8/22/00 - RLB - Added Revised_Clause_Header.
-- 9/ 8/00 - RLB - Removed soft hyphen, as this does not work on either
-- browser I tried.
-- 9/26/00 - RLB - Added Syntax_Summary style.
-- 9/27/00 - RLB - Added tab emulation when in the fixed font.
-- 9/28/00 - RLB - Added some style sheets.
-- - RLB - Updated to use absolute positioning for paragraph
-- numbers (this looks much better than floating).
-- 7/18/01 - RLB - Added "Indented" style to supported styles for
-- multi-column.
-- - RLB - Implemented single "Big-File" support.
-- 7/18/02 - RLB - Removed Document parameter from Create, replaced by
-- three strings and For_ISO boolean.
-- - RLB - Added AI_Reference.
-- - RLB - Added Change_Version_Type and uses.
-- 1/15/03 - RLB - Removed space from DIV.paranum, as it doesn't validate
-- with it.
-- 4/10/03 - RLB - Updated to add access to search pages (not generated
-- here; make them by hand, it only needs to be done once).
-- - RLB - Updated to insure that changes are separated by a space.
-- 4/11/03 - RLB - Changed some formats to meet WC3 validation requirements.
-- 9/09/04 - RLB - Removed unused junk noted by Stephen Leake.
-- 9/10/04 - RLB - Added "Both" to possible changes to handle
-- replacement of changed text.
-- 9/14/04 - RLB - Moved Change_Version_Type to ARM_Contents.
-- - RLB - Changed to use left/right quotes whether or not Unicode
-- is being used. (These work on IE, but not on old
-- Netscape.)
-- 9/16/04 - RLB - Added a charset meta in the header, so that browsers
-- can't misinterpret these documents.
-- 11/03/04 - RLB - Added Nested_X2_Bulleted.
-- 11/15/04 - RLB - Added Indented_Nested_Bulleted.
-- 12/15/04 - RLB - Added wider columns.
-- 1/24/05 - RLB - Added Inner_Indented.
-- 2/ 1/05 - RLB - Added Turkish chars to allow an AARM note.
-- 3/15/05 - RLB - Turned on Unicode characters at Pascal's insistence.
-- 3/17/05 - RLB - Removed ceiling and floor characters because they don't
-- work on Windows.
-- 4/ 7/05 - RLB - Added "Related Documents" link, so users can go between
-- the RM and AARM (and also so that they see the ARA
-- sponsor ads).
-- 5/27/05 - RLB - Added arbitrary Unicode characters.
-- 1/11/06 - RLB - Eliminated dispatching Create in favor of tailored
-- versions.
-- 1/12/06 - RLB - Added a number of parameters to Create.
-- 1/16/06 - RLB - Reduced space around button bars.
-- 1/18/06 - RLB - Added additional styles.
-- 1/19/06 - RLB - Added code so that only styles that are used are
-- included in the result (this decreases the minimum
-- file size by a lot).
-- 1/21/06 - RLB - Specified leading for Swiss example styles, because
-- they are too close otherwise.
-- 1/28/06 - RLB - Changed so that button highlights are removed correctly.
-- - RLB - Added tab emulation settings.
-- 2/ 8/06 - RLB - Added additional parameters to the table command.
-- 2/10/06 - RLB - Added even more additional parameters to the
-- table command.
-- - RLB - Added picture command.
-- 2/19/06 - RLB - Added Number_Paragraphs flag and large letter count.
-- 3/01/06 - RLB - Fixed bug in Text_Format when changing fonts.
-- 3/03/06 - RLB - Moved paragraph numbers down slightly; this looks a lot
-- better on Firefox, and better even on IE.
-- - RLB - Added Optimize_for_Firefox flag, and associated style
-- changes.
-- - RLB - Added code so that spaces after an opening tag
-- and before a closing tag are converted to non-breaking.
-- 3/28/06 - RLB - Removed unnecessary space from headers.
-- 3/30/06 - RLB - Added a bit of space around inline pictures.
-- 9/21/06 - RLB - Added Body_Font.
-- 9/22/06 - RLB - Added Subsubclause.
-- 9/23/06 - RLB - Fixed bug in borderless tables.
-- 9/25/06 - RLB - Handled optional renaming of TOC.
-- - RLB - Added Last_Column_Width to Start_Table.
-- - RLB - Fixed broken enumerated style.
-- 10/13/06 - RLB - Added specifiable colors.
-- - RLB - Added Local_Link_Start and Local_Link_End to allow
-- formatting in the linked text.
-- 11/10/06 - RLB - Fixed nesting of text formatting *again*. (AARM 13.11
-- failed WC 3 validation.)
-- 2/ 9/07 - RLB - Changed comments on AI_Reference.
-- 2/14/07 - RLB - Revised to separate style and indent information
-- for paragraphs.
-- 2/15/07 - RLB - Redid enumeration and bullet indenting to make the
-- formats work consistently on Firefox and IE.
-- 2/19/07 - RLB - Added Title style.
-- 12/14/07 - RLB - Added code to support multi-column text without
-- requiring New_Column calls.
-- 12/18/07 - RLB - Added Plain_Annex.
-- 12/19/07 - RLB - Added DOS_Filename flag.
-- - RLB - Added limited colors to Text_Format.
-- 1/02/08 - RLB - Made DOS filenames into all CAPS.
-- 5/ 7/09 - RLB - Added code to prevent making links to dead clauses.
-- 10/18/11 - RLB - Changed to GPLv3 license.
-- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header.
-- 2/15/12 - RLB - Removed horizontal rules from page breaks in HTML;
-- they never are necessary and cause weird looks for
-- breaks put in solely to make the "final" version look
-- good in PDF form.
-- 5/18/12 - RLB - Added anchors to each paragraph number as suggested
-- on comp.lang.ada.
-- 8/31/12 - RLB - Added Output_Path.
-- 10/18/12 - RLB - Added additional hanging styles.
-- 11/26/12 - RLB - Added subdivision names to Clause_Header and
-- Revised_Clause_Header.
-- 12/17/12 - RLB - Added AI12 references. Defined a change color for
-- "version 4" (Ada 202x).
-- 3/26/13 - RLB - Added Script_HTML.
-- 2/ 8/16 - RLB - Added styles for the Ada-Auth.org header.
-- - Defined change colors for versions 5 and 6. (Actually
-- "borrowed" the color for version 2, so the new colors
-- are for version 2 and 6. Can't use dark blue, as links
-- are that color.)
-- 3/ 3/16 - RLB - The color change is hell on the RR manuals. Redid
-- it to switch the colors only if version 5 is in use.
-- 4/20/16 - RLB - Slightly increased the base indent as a lot of
-- paragraph numbers are overlapping.
-- - Added Force_New_Revision_Colors.
LINE_LENGTH : constant := 78;
-- Maximum intended line length.
SWISS_FONT_CODE : constant String := "<font face=""Arial, Helvetica"">";
SMALL_SWISS_FONT_CODE : constant String := "<font face=""Arial, Helvetica"" size=-1>";
TINY_SWISS_FONT_CODE : constant String := "<font face=""Arial, Helvetica"" size=-2>";
LEADING_PERCENT : constant := 70;
-- Leading is 70% of normal height.
TRAILING_PERCENT : constant := 150;
-- Leading is 150% of normal height.
INDENT_EMS_FOR_PARANUMS : constant := 18;
-- Indent *all* text (for HTML 4) this amount to leave (some) room for
-- the paragraph numbers. In 0.1 EMs.
OPTIMIZE_FOR_FIREFOX : constant Boolean := True;
-- If True, we'll optimize for Firefox; otherwise, we'll optimize for
-- IE 6. Note that IE generally shows the Firefox code better than
-- Firefox shows the IE code, so we generally recommend setting to
-- True unless IE must be perfect. (Modern versions of IE are more
-- like Firefox, so it's unlikely that setting this to False should
-- be needed.)
type Tag_Kind is (DIV, UL, DL);
type Format_Info_Type is record
Defined: Boolean := False;
Tag : Tag_Kind;
Size : Integer; -- In relative "units" (based on the normal size). A unit is 125%/80% of normal.
Font : ARM_Output.Font_Family_Type;
Indent : Natural; -- In "units". (A unit is = 2EM of the full sized font).
Right_Indent : Natural; -- In "units". (A unit is = 2EM of the full sized font).
Hang_Outdent : Natural; -- In "units". (A unit is = 2EM of the full sized font).
-- This is the amount that the hanging text hangs out. Normal
-- text starts at Hang_Outdent + Indent "units".
Before : Integer; -- Vertical space before in 0.1 EM.
After : Natural; -- Vertical space after in 0.1 EM.
end record;
-- In the following, "Default" means the Body_Font.
Paragraph_Info : array
(ARM_Output.Paragraph_Style_Type, ARM_Output.Paragraph_Indent_Type) of
Format_Info_Type;
-- Defined below in the body of the package.
-- Are the various styles used??
Paragraph_Used : array (ARM_Output.Paragraph_Style_Type,
ARM_Output.Paragraph_Indent_Type) of Boolean;
Revision_Used : array (ARM_Contents.Change_Version_Type) of Boolean;
Paranum_Used : Boolean;
procedure Free is new Ada.Unchecked_Deallocation (Column_Text_Item_Type, Column_Text_Ptr);
function Make_Clause_Anchor_Name (Output_Object : in HTML_Output_Type;
Clause_Number : in String) return String is
-- Internal routine.
-- Returns the Clause anchor name for the current output object and
-- Clause_Number.
Clause_Name : String(1..10);
Clause_Name_Len : Natural;
begin
if Clause_Number'Length >= 7 and then
Clause_Number(Clause_Number'First .. Clause_Number'First + 5) =
"Annex " then
Clause_Name(1) := Clause_Number(Clause_Number'First + 6);
-- We only want the letter.
Clause_Name_Len := 1;
else
Clause_Name_Len := Clause_Number'Length;
Clause_Name(1..Clause_Name_Len) := Clause_Number;
for I in 1 .. Clause_Name_Len loop
if Clause_Name(I) = '.' then
Clause_Name(I) := '-';
end if;
end loop;
end if;
if Output_Object.DOS_Filenames and (not Output_Object.Big_Files) then
-- If the section number is a single character, then
-- prefix it with '-':
if Clause_Name_Len = 1 then
Clause_Name(2) := Clause_Name(1);
Clause_Name(1) := '-';
Clause_Name_Len := 2;
elsif Clause_Name_Len = 2 then
null;
else
if Clause_Name(2) = '-' then
Clause_Name(2..Clause_Name_Len+1) :=
Clause_Name(1..Clause_Name_Len);
Clause_Name(1) := '-';
Clause_Name_Len := Clause_Name_Len + 1;
end if;
-- OK, the section name is exactly two characters.
-- Figure out the Clause name.
if Clause_Name_Len < 4 or else
Clause_Name(3) /= '-' or else
Clause_Name(4) not in '0'..'9' or else
(Clause_Name_Len >= 5 and then
Clause_Name(5) /= '-' and then Clause_Name(5) not in '0'..'9') or else
(Clause_Name_Len >= 6 and then
Clause_Name(5) /= '-' and then Clause_Name(6) /= '-') then
-- The clause number is 1 or 2 digits following a '-',
-- and is either the end of the string or followed by a '-'.
Ada.Exceptions.Raise_Exception (Program_Error'Identity,
"Weird clause number:" & Clause_Number);
elsif Clause_Name_Len = 4 or else Clause_Name(5) = '-' then
-- Clause is a single digit.
Clause_Name(3..Clause_Name_Len-1) :=
Clause_Name(4..Clause_Name_Len);
Clause_Name_Len := Clause_Name_Len - 1;
elsif Clause_Name(4) = '1' then
-- Clause is 10..19
Clause_Name(3) := Character'Val(
Character'Pos(Clause_Name(5))-Character'Pos('0')+Character'Pos('A'));
Clause_Name(4..Clause_Name_Len-2) :=
Clause_Name(6..Clause_Name_Len);
Clause_Name_Len := Clause_Name_Len - 2;
elsif Clause_Name(4) = '2' then
-- Clause is 20..29
Clause_Name(3) := Character'Val(
Character'Pos(Clause_Name(5))-Character'Pos('0')+Character'Pos('A')+10);
Clause_Name(4..Clause_Name_Len-2) :=
Clause_Name(6..Clause_Name_Len);
Clause_Name_Len := Clause_Name_Len - 2;
elsif Clause_Name(4) = '3' then
-- Clause is 30..39
if Clause_Name(5) > '5' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"MS-DOS filename: Clause too large=" & Clause_Number);
end if;
Clause_Name(3) := Character'Val(
Character'Pos(Clause_Name(5))-Character'Pos('0')+Character'Pos('A')+20);
Clause_Name(4..Clause_Name_Len-2) :=
Clause_Name(6..Clause_Name_Len);
Clause_Name_Len := Clause_Name_Len - 2;
else
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"MS-DOS filename: Clause too large=" & Clause_Number);
end if;
-- OK, the section number is exactly two characters, and the
-- clause number is exactly one. Figure out the subclause
-- name:
if Clause_Name_Len = 3 then
null; -- We're done, no subclause.
elsif Clause_Name_Len < 5 or else
Clause_Name(4) /= '-' or else
Clause_Name(5) not in '0'..'9' or else
(Clause_Name_Len >= 6 and then
Clause_Name(6) /= '-' and then Clause_Name(6) not in '0'..'9') or else
(Clause_Name_Len >= 7 and then
Clause_Name(6) /= '-' and then Clause_Name(7) /= '-') then
-- The subclause number is 1 or 2 digits following a '-',
-- and is either the end of the string or followed by a '-'.
Ada.Exceptions.Raise_Exception (Program_Error'Identity,
"Weird subclause number:" & Clause_Number);
elsif Clause_Name_Len = 5 or else Clause_Name(6) = '-' then
-- SubClause is a single digit.
Clause_Name(4..Clause_Name_Len-1) :=
Clause_Name(5..Clause_Name_Len);
Clause_Name_Len := Clause_Name_Len - 1;
elsif Clause_Name(5) = '1' then
-- SubClause is 10..19
Clause_Name(4) := Character'Val(
Character'Pos(Clause_Name(6))-Character'Pos('0')+Character'Pos('A'));
Clause_Name(5..Clause_Name_Len-2) :=
Clause_Name(7..Clause_Name_Len);
Clause_Name_Len := Clause_Name_Len - 2;
elsif Clause_Name(5) = '2' then
-- SubClause is 20..29
Clause_Name(4) := Character'Val(
Character'Pos(Clause_Name(6))-Character'Pos('0')+Character'Pos('A')+10);
Clause_Name(5..Clause_Name_Len-2) :=
Clause_Name(7..Clause_Name_Len);
Clause_Name_Len := Clause_Name_Len - 2;
elsif Clause_Name(5) = '3' then
-- SubClause is 30..39
if Clause_Name(6) > '5' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"MS-DOS filename: Subclause too large=" & Clause_Number);
end if;
Clause_Name(4) := Character'Val(
Character'Pos(Clause_Name(6))-Character'Pos('0')+Character'Pos('A')+20);
Clause_Name(5..Clause_Name_Len-2) :=
Clause_Name(7..Clause_Name_Len);
Clause_Name_Len := Clause_Name_Len - 2;
else
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"MS-DOS filename: Subclause too large=" & Clause_Number);
end if;
-- OK, the section number is exactly two characters, and the
-- clause number is one, and the subclause number is one or zero.
-- Figure out the subsubclause name:
if Clause_Name_Len < 5 then
null; -- We're done, no subsubclause.
elsif Clause_Name_Len < 6 or else
Clause_Name(5) /= '-' or else
Clause_Name(6) not in '0'..'9' or else
(Clause_Name_Len >= 7 and then
Clause_Name(7) not in '0'..'9') or else
(Clause_Name_Len >= 8) then
-- The subsubclause number is 1 or 2 digits following a '-',
-- and is the end of the string
Ada.Exceptions.Raise_Exception (Program_Error'Identity,
"Weird subclause number:" & Clause_Number);
elsif Clause_Name_Len = 6 then
-- SubSubClause is a single digit.
Clause_Name(5) := Clause_Name(6);
Clause_Name_Len := 5;
elsif Clause_Name(6) = '1' then
-- SubSubClause is 10..19
Clause_Name(5) := Character'Val(
Character'Pos(Clause_Name(7))-Character'Pos('0')+Character'Pos('A'));
Clause_Name_Len := 5;
elsif Clause_Name(5) = '2' then
-- SubSubClause is 20..29
Clause_Name(5) := Character'Val(
Character'Pos(Clause_Name(7))-Character'Pos('0')+Character'Pos('A')+10);
Clause_Name_Len := 5;
elsif Clause_Name(5) = '3' then
-- SubSubClause is 30..39
if Clause_Name(6) > '5' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"MS-DOS filename: Subsubclause too large=" & Clause_Number);
end if;
Clause_Name(5) := Character'Val(
Character'Pos(Clause_Name(7))-Character'Pos('0')+Character'Pos('A')+20);
Clause_Name_Len := 5;
else
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"MS-DOS filename: Subsubclause too large=" & Clause_Number);
end if;
end if;
end if;
return Clause_Name(1..Clause_Name_Len);
end Make_Clause_Anchor_Name;
function Make_Clause_File_Name (Output_Object : in HTML_Output_Type;
Clause_Number : in String) return String is
-- Internal routine.
-- Returns the Clause file name for the current output object and
-- Clause_Number. This does not include any path or extension.
begin
if Output_Object.Big_Files then -- One big file.
return Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right);
else -- Clause files.
if Output_Object.DOS_Filenames then
return Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
Make_Clause_Anchor_Name (Output_Object, Clause_Number);
else
return Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
"-" & Make_Clause_Anchor_Name (Output_Object, Clause_Number);
end if;
end if;
end Make_Clause_File_Name;
function Make_Clause_Link_Name (Output_Object : in HTML_Output_Type;
Clause_Number : in String) return String is
-- Internal routine.
-- Returns the link name for a link to the given clause.
begin
if Output_Object.Big_Files then -- One big file.
-- Note this is a self-reference, so the file name is not needed.
return "#" & Make_Clause_Anchor_Name (Output_Object, Clause_Number);
else -- Clause files.
if Output_Object.DOS_Filenames then
return Make_Clause_File_Name (Output_Object, Clause_Number) & ".HTM";
else
return Make_Clause_File_Name (Output_Object, Clause_Number) & ".html";
end if;
end if;
end Make_Clause_Link_Name;
procedure Put_EMs (Fyle : in Ada.Text_IO.File_Type;
Value : in Natural) is
-- Put an EMs Value (Value is in 0.1 EM).
begin
if Value <= 9 then
Ada.Text_IO.Put (Fyle, '0');
elsif Value <= 99 then
Ada.Text_IO.Put (Fyle, Character'Val(Character'Pos('0') + (Value / 10)));
else
Ada.Text_IO.Put (Fyle, Natural'Image (Value / 10));
end if;
Ada.Text_IO.Put (Fyle, '.');
Ada.Text_IO.Put (Fyle, Character'Val(Character'Pos('0') + (Value Mod 10)));
Ada.Text_IO.Put (Fyle, "em");
end Put_EMs;
procedure Make_Navigation_Bar (Output_Object : in out HTML_Output_Type;
Is_Top : in Boolean) is
-- Internal routine.
-- Generate a properly formatted navigation bar.
Clause : constant String :=
Ada.Strings.Unbounded.To_String(Output_Object.Current_Clause);
begin
if Output_Object.Use_Buttons then
if Is_Top and then Output_Object.HTML_Kind > HTML_3 then
Ada.Text_IO.Put (Output_Object.Output_File, "<div style=""margin-top: 0.6em; margin-bottom: 0.0em"">");
elsif (not Is_Top) and then Output_Object.HTML_Kind > HTML_3 then
Ada.Text_IO.Put (Output_Object.Output_File, "<div style=""margin-top: 0.0em; margin-bottom: 0.6em"">");
else
Ada.Text_IO.Put (Output_Object.Output_File, "<P>");
end if;
Ada.Text_IO.Put (Output_Object.Output_File, "<A HREF=""");
if Output_Object.Big_Files then
Ada.Text_IO.Put (Output_Object.Output_File, "#TOC");
elsif Output_Object.DOS_Filenames then
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
"-TOC.HTM");
else
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
"-TOC.html");
end if;
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""CONT.GIF"" ALT=""Contents"" BORDER=0></A> ");
-- Border=0 prevents the link highlight from being applied.
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""cont.gif"" ALT=""Contents"" BORDER=0></A> ");
-- Border=0 prevents the link highlight from being applied.
end if;
if Ada.Strings.Unbounded.Length(Output_Object.Index_URL) /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, " <A HREF=""");
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Index_URL));
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""INDEX.GIF"" ALT=""Index"" BORDER=0></A> ");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""index.gif"" ALT=""Index"" BORDER=0></A> ");
end if;
else -- Link to the section named "Index".
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("Index" & (6 .. ARM_Contents.Title_Type'Last => ' '))) &
"""><IMG SRC=""INDEX.GIF"" ALT=""Index"" BORDER=0></A> ");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("Index" & (6 .. ARM_Contents.Title_Type'Last => ' '))) &
"""><IMG SRC=""index.gif"" ALT=""Index"" BORDER=0></A> ");
end if;
exception
when ARM_Contents.Not_Found_Error =>
null; -- No section named "Index".
end;
end if;
if Ada.Strings.Unbounded.Length(Output_Object.Ref_URL) /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, " <A HREF=""");
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Ref_URL));
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""LIB.GIF"" ALT=""References"" BORDER=0></A> ");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""lib.gif"" ALT=""References"" BORDER=0></A> ");
end if;
else -- Link to the section named "References".
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("References" & (11 .. ARM_Contents.Title_Type'Last => ' '))) &
"""><IMG SRC=""LIB.GIF"" ALT=""References"" BORDER=0></A> ");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("References" & (11 .. ARM_Contents.Title_Type'Last => ' '))) &
"""><IMG SRC=""lib.gif"" ALT=""References"" BORDER=0></A> ");
end if;
exception
when ARM_Contents.Not_Found_Error =>
null; -- No section named "References".
end;
end if;
if Ada.Strings.Unbounded.Length(Output_Object.Srch_URL) /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, " <A HREF=""");
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Srch_URL));
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""FIND.GIF"" ALT=""Search"" BORDER=0></A> ");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""find.gif"" ALT=""Search"" BORDER=0></A> ");
end if;
else -- Link to the section named "References".
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("Search" & (7 .. ARM_Contents.Title_Type'Last => ' '))) &
"""><IMG SRC=""FIND.GIF"" ALT=""Search"" BORDER=0></A> ");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("Search" & (7 .. ARM_Contents.Title_Type'Last => ' '))) &
"""><IMG SRC=""find.gif"" ALT=""Search"" BORDER=0></A> ");
end if;
exception
when ARM_Contents.Not_Found_Error =>
null; -- No section named "Index".
end;
end if;
if Clause /= "" then
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
Ada.Text_IO.Put (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Previous_Clause(Clause)));
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""PREV.GIF"" ALT=""Previous"" BORDER=0></A> ");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""prev.gif"" ALT=""Previous"" BORDER=0></A> ");
end if;
exception
when ARM_Contents.Not_Found_Error =>
null; -- Probably the first section.
end;
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
Ada.Text_IO.Put (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Next_Clause(Clause)));
if Output_Object.DOS_Filenames then
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""NEXT.GIF"" ALT=""Next"" BORDER=0></A> ");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, """><IMG SRC=""next.gif"" ALT=""Next"" BORDER=0></A> ");
end if;
exception
when ARM_Contents.Not_Found_Error =>
null; -- Probably the last section.
end;
end if;
if Output_Object.HTML_Kind > HTML_3 then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</div>");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</P>");
end if;
else -- Use text navigation
Ada.Text_IO.Put (Output_Object.Output_File, "<P><A HREF=""");
if Output_Object.Big_Files then
Ada.Text_IO.Put (Output_Object.Output_File, "#TOC");
elsif Output_Object.DOS_Filenames then
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
"-TOC.HTM");
else
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
"-TOC.html");
end if;
Ada.Text_IO.Put (Output_Object.Output_File, """>Contents</A>");
if Ada.Strings.Unbounded.Length(Output_Object.Index_URL) /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, " ");
Ada.Text_IO.Put (Output_Object.Output_File, "<A HREF=""");
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Index_URL));
Ada.Text_IO.Put (Output_Object.Output_File, """>Index</A>");
else -- Link to the section named "Index".
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("Index" & (6 .. ARM_Contents.Title_Type'Last => ' '))) &
""">Index</A>");
exception
when ARM_Contents.Not_Found_Error =>
null; -- No section named "Index".
end;
end if;
if Ada.Strings.Unbounded.Length(Output_Object.Srch_URL) /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, " ");
Ada.Text_IO.Put (Output_Object.Output_File, "<A HREF=""");
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Srch_URL));
Ada.Text_IO.Put (Output_Object.Output_File, """>Search</A>");
else -- Link to the section named "Search".
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("Search" & (7 .. ARM_Contents.Title_Type'Last => ' '))) &
""">Search</A>");
exception
when ARM_Contents.Not_Found_Error =>
null; -- No section named "Search".
end;
end if;
if Ada.Strings.Unbounded.Length(Output_Object.Ref_URL) /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, " ");
Ada.Text_IO.Put (Output_Object.Output_File, "<A HREF=""");
Ada.Text_IO.Put (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Ref_URL));
Ada.Text_IO.Put (Output_Object.Output_File, """>Reference Documents</A>");
else -- Link to the section named "References".
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Lookup_Clause_Number ("References" & (11 .. ARM_Contents.Title_Type'Last => ' '))) &
""">Reference Documents</A>");
exception
when ARM_Contents.Not_Found_Error =>
null; -- No section named "References".
end;
end if;
if Clause /= "" then
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
Ada.Text_IO.Put (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Previous_Clause(Clause)));
Ada.Text_IO.Put (Output_Object.Output_File, """>Previous</A>");
exception
when ARM_Contents.Not_Found_Error =>
null; -- Probably the first section.
end;
begin
-- Note: We do the following in one big glup so that if
-- Not_Found_Error is raised, nothing is output.
Ada.Text_IO.Put (Output_Object.Output_File, " <A HREF=""" &
Make_Clause_Link_Name (Output_Object,
ARM_Contents.Next_Clause(Clause)));
Ada.Text_IO.Put (Output_Object.Output_File, """>Next</A>");
exception
when ARM_Contents.Not_Found_Error =>
null; -- Probably the last section.
end;
end if;
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</P>");
end if;
end Make_Navigation_Bar;
type Special_Style_Kinds is (None,
Hanging_Term,
Hanging_Body,
Bulleted_Item,
Bulleted_No_Prefix);
procedure Make_Style (Output_Object : in out HTML_Output_Type;
Name : in String;
Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type;
Kind : Special_Style_Kinds := None;
Enumerated_Adjustment : in Boolean := False) is
-- Internal routine.
-- Generate the style needed.
function Units_to_EMs (Value : in Natural) return Natural is
-- Convert Value from indentation units to EMs. (0.1 EMs, really).
Normal : Boolean;
begin
if Output_Object.HTML_Kind = HTML_4_Only then
case Paragraph_Info(Style, Indent).Font is
when ARM_Output.Default =>
Normal := ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Roman);
when ARM_Output.Roman =>
Normal := True;
when ARM_Output.Fixed | ARM_Output.Swiss => -- Start at 90% (otherwise they are huge!)
Normal := False;
end case;
if Normal then
case Paragraph_Info(Style, Indent).Size is
when 0 => return Value * 20;
when 1 => return Value * 16; -- 20/1.25.
when 2 => return Value * 13; -- 20/1.56.
when 3 => return Value * 10; -- 20/1.93.
when -1 => return Value * 25; -- 20/0.80.
when -2 => return Value * 31; -- 20/0.64.
when -3 => return Value * 40; -- 20/0.50.
when others => return Value; -- Out of range.
end case;
else -- Start at 90% (otherwise they are huge!)
case Paragraph_Info(Style, Indent).Size is
when 0 => return Value * 22; -- 20/0.90
when 1 => return Value * 18; -- 20/1.13.
when 2 => return Value * 14; -- 20/1.40.
when 3 => return Value * 11; -- 20/1.75.
when -1 => return Value * 28; -- 20/0.72.
when -2 => return Value * 34; -- 20/0.58.
when -3 => return Value * 44; -- 20/0.45.
when others => return Value; -- Out of range.
end case;
end if;
elsif ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
-- Special case, see below.
case Paragraph_Info(Style, Indent).Size is
when 0 => return Value * 20;
when 1 => return Value * 16; -- 20/1.25.
when 2 => return Value * 13; -- 20/1.56.
when 3 => return Value * 10; -- 20/1.93.
when -1 => return Value * 25; -- 20/0.80.
when -2 => return Value * 31; -- 20/0.64.
when -3 => return Value * 40; -- 20/0.50.
when others => return Value; -- Out of range.
end case;
else
return Value * 20; -- No font sizes here.
end if;
end Units_to_EMs;
begin
if not Paragraph_Used (Style, Indent) then
return; -- Not used, so don't generate.
end if;
if Kind = Hanging_Term and then Output_Object.HTML_Kind = HTML_4_Only then
-- Special case for better hanging.
Ada.Text_IO.Put (Output_Object.Output_File, " DIV.");
Ada.Text_IO.Put (Output_Object.Output_File, Name & "-Term {");
if OPTIMIZE_FOR_FIREFOX then
-- Tested on Firefox 1.5.
Ada.Text_IO.Put (Output_Object.Output_File, "float: left; ");
-- This does not work on IE: it adds extra spaces, and leaves
-- it effective after a <BR>. We could probably work around
-- those, but then Firefox would look like crap again.
else
Ada.Text_IO.Put (Output_Object.Output_File, "position: absolute; top: auto; left: 0.6em; ");
-- This does not work on Firefox: the text is too high by
-- about half a line and thus doesn't line up properly.
end if;
elsif Kind = Hanging_Body and then Output_Object.HTML_Kind = HTML_4_Only then
Ada.Text_IO.Put (Output_Object.Output_File, " DIV.");
Ada.Text_IO.Put (Output_Object.Output_File, Name & "-Body {");
elsif (Kind = Bulleted_Item or else Kind = Bulleted_No_Prefix) and then
Output_Object.HTML_Kind = HTML_4_Only then
Ada.Text_IO.Put (Output_Object.Output_File, " DIV.");
Ada.Text_IO.Put (Output_Object.Output_File, Name & " {");
else
case Paragraph_Info(Style, Indent).Tag is
when DIV =>
Ada.Text_IO.Put (Output_Object.Output_File, " DIV.");
when UL =>
Ada.Text_IO.Put (Output_Object.Output_File, " UL.");
when DL =>
Ada.Text_IO.Put (Output_Object.Output_File, " DL.");
end case;
Ada.Text_IO.Put (Output_Object.Output_File, Name & " {");
end if;
case Paragraph_Info(Style, Indent).Font is
when ARM_Output.Default =>
if ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Roman) then
Ada.Text_IO.Put (Output_Object.Output_File, "font-family: ""Times New Roman"", Times, serif");
else
Ada.Text_IO.Put (Output_Object.Output_File, "font-family: Arial, Helvetica, sans-serif");
end if;
when ARM_Output.Roman => Ada.Text_IO.Put (Output_Object.Output_File, "font-family: ""Times New Roman"", Times, serif");
when ARM_Output.Swiss => Ada.Text_IO.Put (Output_Object.Output_File, "font-family: Arial, Helvetica, sans-serif");
when ARM_Output.Fixed => Ada.Text_IO.Put (Output_Object.Output_File, "font-family: ""Courier New"", monospace");
end case;
if Output_Object.HTML_Kind = HTML_4_Only then
-- The font size is set by the outer item.
declare
Normal : Boolean;
begin
case Paragraph_Info(Style, Indent).Font is
when ARM_Output.Default =>
Normal := ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Roman);
when ARM_Output.Roman =>
Normal := True;
when ARM_Output.Fixed | ARM_Output.Swiss => -- Start at 90% (otherwise they are huge!)
Normal := False;
end case;
if Normal then
case Paragraph_Info(Style, Indent).Size is
when 0 => null; -- Default.
when 1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 125%");
when 2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 156%");
when 3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 195%");
when -1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 80%");
when -2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 64%");
when -3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 50%");
when others => null; -- Out of range.
end case;
else -- Start at 90% (otherwise they are huge!)
-- Note: This size adjustment is for sections of text, not for in-line text.
case Paragraph_Info(Style, Indent).Size is
when 0 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 90%");
when 1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 113%");
when 2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 140%");
when 3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 175%");
when -1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 72%");
when -2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 58%");
when -3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 45%");
when others => null; -- Out of range.
end case;
end if;
end;
-- Set the leading, because otherwise the lines are too close on IE.
Ada.Text_IO.Put (Output_Object.Output_File, "; line-height: 122%");
elsif ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
-- Special case because the font otherwise gets too small and
-- loses bold-facing.
case Paragraph_Info(Style, Indent).Size is
when 0 => null; -- Default.
when 1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 125%");
when 2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 156%");
when 3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 195%");
when -1 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 80%");
when -2 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 64%");
when -3 => Ada.Text_IO.Put (Output_Object.Output_File, "; font-size: 50%");
when others => null; -- Out of range.
end case;
-- else the size will be set explicitly for HTML_4_Compatible.
end if;
if Kind = Hanging_Body then
if Output_Object.Number_Paragraphs then
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
Put_Ems (Output_Object.Output_File,
Units_to_EMs(Paragraph_Info(Style, Indent).Indent +
Paragraph_Info(Style, Indent).Hang_Outdent) +
INDENT_EMS_FOR_PARANUMS);
else
if Paragraph_Info(Style, Indent).Indent + Paragraph_Info(Style, Indent).Hang_Outdent /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
Put_Ems (Output_Object.Output_File,
Units_to_EMs(Paragraph_Info(Style, Indent).Indent +
Paragraph_Info(Style, Indent).Hang_Outdent));
end if;
end if;
elsif Enumerated_Adjustment then
-- Adjust the left margin to indent the prefix slightly (1/4 of a unit):
declare
Org_Margin : Natural :=
Units_to_EMs(Paragraph_Info(Style, Indent).Indent);
Prefix_Indent : Natural :=
Units_to_EMs(1) / 4;
begin
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
if Output_Object.Number_Paragraphs then
Put_Ems (Output_Object.Output_File, Org_Margin + Prefix_Indent +
INDENT_EMS_FOR_PARANUMS);
else
Put_Ems (Output_Object.Output_File, Org_Margin + Prefix_Indent);
end if;
end;
else
if Output_Object.Number_Paragraphs then
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
Put_Ems (Output_Object.Output_File, Units_to_EMs(Paragraph_Info(Style, Indent).Indent) +
INDENT_EMS_FOR_PARANUMS);
else
if Paragraph_Info(Style, Indent).Indent /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-left: ");
Put_Ems (Output_Object.Output_File, Units_to_EMs(Paragraph_Info(Style, Indent).Indent));
end if;
end if;
end if;
if Kind = Hanging_Term and then Output_Object.HTML_Kind = HTML_4_Only then
-- We let the body provide the necessary right margin. If we don't
-- do this, the following item can end up with an inappropriate indent.
null;
--Ada.Text_IO.Put (Output_Object.Output_File, "; margin-bottom: 0em");
elsif Paragraph_Info(Style, Indent).Right_Indent /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-right: ");
Put_Ems (Output_Object.Output_File, Units_to_EMs(Paragraph_Info(Style, Indent).Right_Indent));
end if;
if Paragraph_Info(Style, Indent).Before /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-top: ");
Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Before);
elsif Paragraph_Info(Style, Indent).Tag /= DIV then
-- The default is non-zero.
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-top: 0em");
end if;
if Kind = Hanging_Term and then Output_Object.HTML_Kind = HTML_4_Only then
-- We let the body provide the necessary space below. If we don't
-- do this, the next line can end up with an inappropriate indent.
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-bottom: 0em");
elsif Paragraph_Info(Style, Indent).After /= 0 then
Ada.Text_IO.Put (Output_Object.Output_File, "; margin-bottom: ");
Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).After);
end if;
if Kind = Bulleted_Item and then Output_Object.HTML_Kind = HTML_4_Only then
-- Set the list item and "disc" format:
Ada.Text_IO.Put (Output_Object.Output_File, "; display: list-item; list-style-type: disc");
end if;
-- Done, close it.
Ada.Text_IO.Put_Line (Output_Object.Output_File, "}");
end Make_Style;
procedure Make_Hung_Text_Style
(Output_Object : in out HTML_Output_Type;
Name : in String;
Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type) is
-- Internal routine.
-- Generate the style needed.
begin
if Output_Object.HTML_Kind = HTML_4_Only then
if ARM_Output."=" (Style, ARM_Output.Enumerated) or else
ARM_Output."=" (Style, ARM_Output.Small_Enumerated) then
Make_Style (Output_Object, Name, Style, Indent,
Kind => Hanging_Term,
Enumerated_Adjustment => True);
else
Make_Style (Output_Object, Name, Style, Indent,
Kind => Hanging_Term);
end if;
else -- HTML_4_Compatible
Ada.Text_IO.Put (Output_Object.Output_File, " DD." & Name & " {");
Ada.Text_IO.Put (Output_Object.Output_File, "margin-left: ");
case Paragraph_Info(Style, Indent).Size is
when 0 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 20);
when 1 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 16); -- 20/1.25.
when 2 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 13); -- 20/1.56.
when -1 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 25); -- 20/0.80.
when -2 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 31); -- 20/0.64.
when -3 => Put_Ems (Output_Object.Output_File, Paragraph_Info(Style, Indent).Hang_Outdent * 40); -- 20/0.50.
when others => null; -- Out of range.
end case;
-- Done, close it.
Ada.Text_IO.Put_Line (Output_Object.Output_File, "}");
end if;
end Make_Hung_Text_Style;
function Paragraph_Name
(Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type) return String is
-- Internal routine.
-- Create the name for the Style and Indent.
-- These had better be unique, and all possibilities (including impossible
-- ones) had better have names.
use type ARM_Output.Paragraph_Indent_Type;
begin
case Style is
when ARM_Output.Normal =>
if Indent = 0 then
return "Normal";
else
-- This was: Indent 1: "SyntaxIndented"; Indent 2:
-- "CodeIndented"; Indent 3: "Indented"; Indent 4: "InnerIndented".
return "Indented" & Character'Val(Character'Pos('0') + Indent);
end if;
when ARM_Output.Wide_Above =>
if Indent = 0 then
return "WideAbove";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "WideAbove";
end if;
when ARM_Output.Small =>
if Indent = 0 then
return "Small";
elsif Indent = 1 then
return "Notes";
elsif Indent = 2 then
return "Annotations";
else
-- This was: Indent 3: "SmallSyntaxIndented"; Indent 4:
-- "SmallCodeIndented"; Indent 5: "SmallIndented"; Indent 6: "SmallInnerIndented".
return "SmallIndented" & Character'Val(Character'Pos('0') + Indent);
end if;
when ARM_Output.Small_Wide_Above =>
if Indent = 0 then
return "SmallWideAbove";
elsif Indent = 2 then
return "AnnotationsWideAbove";
else
return "SmallIndented" & Character'Val(Character'Pos('0') + Indent) & "WideAbove";
end if;
when ARM_Output.Header =>
if Indent = 0 then
return "Header";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Header";
end if;
when ARM_Output.Small_Header =>
if Indent = 0 then
return "SmallHeader";
elsif Indent = 1 then
return "NotesHeader";
else
return "SmallIndented" & Character'Val(Character'Pos('0') + Indent) & "Header";
end if;
when ARM_Output.Index =>
if Indent = 0 then
return "Index";
else -- Should be not used.
return "IndexIndented" & Character'Val(Character'Pos('0') + Indent);
end if;
when ARM_Output.Syntax_Summary =>
if Indent = 1 then
return "SyntaxSummary";
else -- Should be not used.
return "SynSumInd" & Character'Val(Character'Pos('0') + Indent);
end if;
when ARM_Output.Title =>
if Indent = 0 then
return "Title";
else -- Should be not used.
return "TitleIndented" & Character'Val(Character'Pos('0') + Indent);
end if;
when ARM_Output.Examples =>
if Indent = 1 then
return "Examples";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Examples";
end if;
when ARM_Output.Small_Examples =>
if Indent = 3 then
return "SmallExamples";
else
return "SmallIndented" & Character'Val(Character'Pos('0') + Indent) & "Examples";
end if;
when ARM_Output.Swiss_Examples =>
if Indent = 1 then
return "SwissExamples";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SwissExamples";
end if;
when ARM_Output.Small_Swiss_Examples =>
if Indent = 3 then
return "SmallSwissExamples";
else
return "SmallIndented" & Character'Val(Character'Pos('0') + Indent) & "SwissExamples";
end if;
when ARM_Output.Bulleted =>
if Indent = 1 then
return "Bulleted";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Bulleted";
end if;
when ARM_Output.Small_Bulleted =>
if Indent = 3 then
return "SmallBulleted";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallBulleted";
end if;
when ARM_Output.Nested_Bulleted =>
if Indent = 1 then
return "NestedBulleted";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "NestedBulleted";
end if;
when ARM_Output.Small_Nested_Bulleted =>
if Indent = 3 then
return "SmallNestedBulleted";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallNestedBulleted";
end if;
when ARM_Output.Enumerated =>
if Indent = 1 then
return "Enumerated";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Enumerated";
end if;
when ARM_Output.Small_Enumerated =>
if Indent = 3 then
return "SmallEnumerated";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallEnumerated";
end if;
when ARM_Output.Giant_Hanging =>
if Indent = 4 then
return "GiantHanging";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "GiantHanging";
end if;
when ARM_Output.Small_Giant_Hanging =>
if Indent = 6 then
return "SmallGiantHanging";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallGiantHanging";
end if;
when ARM_Output.Wide_Hanging =>
if Indent = 3 then
return "WideHanging";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "WideHanging";
end if;
when ARM_Output.Small_Wide_Hanging =>
if Indent = 5 then
return "SmallWideHanging";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallWideHanging";
end if;
when ARM_Output.Medium_Hanging =>
if Indent = 2 then
return "MediumHanging";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "MediumHanging";
end if;
when ARM_Output.Small_Medium_Hanging =>
if Indent = 4 then
return "SmallMediumHanging";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallMediumHanging";
end if;
when ARM_Output.Narrow_Hanging =>
if Indent = 1 then
return "NarrowHanging";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "NarrowHanging";
end if;
when ARM_Output.Small_Narrow_Hanging =>
if Indent = 3 then
return "SmallNarrowHanging";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallNarrowHanging";
end if;
when ARM_Output.Hanging_in_Bulleted =>
if Indent = 3 then
return "Hanging_in_Bulleted";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "Hanging_in_Bulleted";
end if;
when ARM_Output.Small_Hanging_in_Bulleted =>
if Indent = 5 then
return "SmallHanging_in_Bulleted";
else
return "Indented" & Character'Val(Character'Pos('0') + Indent) & "SmallHanging_in_Bulleted";
end if;
end case;
end Paragraph_Name;
procedure Make_Paragraph_Styles
(Output_Object : in out HTML_Output_Type) is
-- Internal routine.
-- Generate all of the paragraph and related styles.
begin
-- Basic element styles:
if Paranum_Used then
if Output_Object.HTML_Kind = HTML_4_Compatible then
if OPTIMIZE_FOR_FIREFOX then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " DIV.paranum {float: left; font-family: Arial, Helvetica, sans-serif; width: 2.8em; " &
"margin-left: -0.4em; margin-right: -3.0em; margin-top: 0.2em}");
-- Uses floating items. These usually don't work on IE (it
-- adds extra spaces for no reason). However, with the
-- indents, this seems to work properly on IE, too.
else
-- Absolute positioning (CSS2) works better on IE, but
-- Firefox tends to draw these too high.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5em; top: auto; margin-top: 0.2em}");
end if;
-- If these are completely ignored, the paragraph number will
-- end up on a line by itself. That's fine.
else
if OPTIMIZE_FOR_FIREFOX then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " DIV.paranum {float: left; font-family: Arial, Helvetica, sans-serif; font-size: 64%; width: 2.8em; " &
"margin-left: -0.4em; margin-right: -3.0em; margin-top: 0.2em}");
-- Uses floating elements; see above.
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, " DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; font-size: 64%; " &
"left: 0.5em; top: auto; margin-top: 0.2em}");
-- Uses absolute positioning; see above.
end if;
end if;
end if;
Ada.Text_IO.Put_Line (Output_Object.Output_File, " TT {font-family: ""Courier New"", monospace}");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " DT {display: compact}"); -- CSS2. This doesn't seem to work on IE 4.01, but it is harmless.
-- Revision styles:
if Revision_Used ('0') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert0 {text-decoration: underline; color: black}");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete0 {text-decoration: line-through; color: black }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both0 {text-decoration: underline, line-through; color: black }");
-- Both doesn't seem to work, so forget it.
-- else not used, don't generate it.
end if;
if Revision_Used ('1') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert1 {text-decoration: underline; color: rgb(0,51,51) }"); -- (Very) dark turquoise.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete1 {text-decoration: line-through; color: rgb(0,51,51) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both1 {text-decoration: underline, line-through; color: rgb(0,51,51) }");
-- Both doesn't seem to work, so forget it.
-- else not used, don't generate it.
end if;
if Revision_Used ('2') then
if Revision_Used ('5') or else Output_Object.Force_New_Revision_Colors then
-- Ugly color here, nice color for #5
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert2 {text-decoration: underline; color: rgb(102,0,153) }"); -- Violet.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete2 {text-decoration: line-through; color: rgb(102,0,153) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both2 {text-decoration: underline, line-through; color: rgb(102,0,153) }");
-- Both doesn't seem to work, so forget it.
else -- Use the nice green here.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert2 {text-decoration: underline; color: rgb(0,102,0) }"); -- Dark green.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete2 {text-decoration: line-through; color: rgb(0,102,0) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both2 {text-decoration: underline, line-through; color: rgb(0,102,0) }");
-- Both doesn't seem to work, so forget it.
end if;
-- else not used, don't generate it.
end if;
if Revision_Used ('3') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert3 {text-decoration: underline; color: rgb(102,51,0) }"); -- Dark brown.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete3 {text-decoration: line-through; color: rgb(102,51,0) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both3 {text-decoration: underline, line-through; color: rgb(102,51,0) }");
-- Both doesn't seem to work, so forget it.
-- else not used, don't generate it.
end if;
if Revision_Used ('4') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert4 {text-decoration: underline; color: rgb(153,0,0) }"); -- Dark red.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete4 {text-decoration: line-through; color: rgb(153,0,0) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both4 {text-decoration: underline, line-through; color: rgb(153,0,0) }");
-- Both doesn't seem to work, so forget it.
-- else not used, don't generate it.
end if;
if Revision_Used ('5') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert5 {text-decoration: underline; color: rgb(0,102,0) }"); -- Dark green.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete5 {text-decoration: line-through; color: rgb(0,102,0) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both5 {text-decoration: underline, line-through; color: rgb(0,102,0) }");
-- Both doesn't seem to work, so forget it.
-- else not used, don't generate it.
end if;
if Revision_Used ('6') then
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.insert6 {text-decoration: underline; color: rgb(0,102,153) }"); -- Turquiose.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.delete6 {text-decoration: line-through; color: rgb(0,102,153) }");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.both6 {text-decoration: underline, line-through; color: rgb(0,102,153) }");
-- Both doesn't seem to work, so forget it.
-- else not used, don't generate it.
end if;
-- Link styles:
-- We don't need these (they're given in the BODY command), but I've
-- kept them in case we want to change these in the future.
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " A:link {color: rgb(0,0,255)}");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, " A:visited {color: rgb(128,0,128)}");
-- The following styles are for the Ada-Auth.Org header. It would be nice
-- if we could skip them if they're not needed, but we don't have the
-- information needed to do that.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " A.Bar:link {font-family: Arial, Helvetica, sans-serif; font-style: normal; text-decoration: none; color: rgb(204,204,51)}");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " A.Bar:visited {font-family: Arial, Helvetica, sans-serif; font-style: normal; text-decoration: none; color: rgb(204,204,51)}");
-- Paragraph styles:
for S in ARM_Output.Unprefixed_Style_Subtype loop
for I in ARM_Output.Paragraph_Indent_Type loop
Make_Style (Output_Object, Paragraph_Name (S, I), S, I);
end loop;
end loop;
for S in ARM_Output.Bullet_Prefixed_Style_Subtype loop
-- These styles do not allow Indent 0.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
if Output_Object.HTML_Kind = HTML_4_Only then
Make_Style (Output_Object, Paragraph_Name (S, I) & "-NoPrefix", S, I,
Kind => Bulleted_No_Prefix);
Make_Style (Output_Object, Paragraph_Name (S, I), S, I,
Kind => Bulleted_Item);
else
Make_Style (Output_Object, Paragraph_Name (S, I), S, I);
end if;
end loop;
end loop;
for S in ARM_Output.Text_Prefixed_Style_Subtype loop
-- These styles do not allow Indent 0.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
if Paragraph_Used (S, I) then
Make_Style (Output_Object, Paragraph_Name (S, I), S, I, Kind => Hanging_Body);
Make_Hung_Text_Style (Output_Object, Paragraph_Name (S, I), S, I);
-- else not used.
end if;
end loop;
end loop;
end Make_Paragraph_Styles;
MAGIC_STYLE_MARKER : constant String := "&%$# STYLES GO HERE #$%&";
procedure Start_HTML_File (Output_Object : in out HTML_Output_Type;
File_Name : in String;
Title : in String;
Clause : in String) is
-- Internal routine.
-- Create an HTML file, and generate the needed text to start an HTML
-- file. The file name is just the name portion, not the path or
-- extension. Clause is the properly formatted Clause number for
-- this file, if known.
begin
--Ada.Text_IO.Put_Line ("--Creating " & File_Name & ".html");
if Output_Object.HTML_Kind > HTML_3 then
Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
Ada.Strings.Unbounded.To_String (Output_Object.Output_Path) &
File_Name & ".$$$");
elsif Output_Object.DOS_Filenames then
Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
Ada.Strings.Unbounded.To_String (Output_Object.Output_Path) &
File_Name & ".HTM");
else
Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
Ada.Strings.Unbounded.To_String (Output_Object.Output_Path) &
File_Name & ".html");
end if;
-- Save the current clause:
Output_Object.Current_Clause :=
Ada.Strings.Unbounded.To_Unbounded_String(Clause);
-- File introduction:
if Output_Object.HTML_Kind > HTML_3 then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN""");
Ada.Text_IO.Put_Line (Output_Object.Output_File, """http://www.w3.org/TR/html4/loose.dtd"">"); -- HTML 4.01 (with depreciated features)
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 3.2//EN"">"); -- HTML 3.2
end if;
-- so the result can be used on version 3 browsers.)
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HTML>");
-- Header information:
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HEAD>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <TITLE>" & Title & "</TITLE>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <META http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <META NAME=""Author"" CONTENT=""JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor"">");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <META NAME=""GENERATOR"" CONTENT=""Arm_Form.Exe, Ada Reference Manual generator"">");
if Output_Object.HTML_Kind = HTML_4_Only then
-- The style sheet.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <STYLE type=""text/css"">");
-- Element styles:
Ada.Text_IO.Put_Line (Output_Object.Output_File, " H4.centered {text-align: center}");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.swiss {font-family: Arial, Helvetica, sans-serif; font-size: 92%}");
Ada.Text_IO.Put_Line (Output_Object.Output_File, " SPAN.roman {font-family: ""Times New Roman"", Times, serif}");
-- Paragraph styles:
--Paragraph_Used := (others => (others => True)); -- Force showing all, we don't know what is used.
--Revision_Used := (others => True);
--Paranum_Used := True;
--Make_Paragraph_Styles (Output_Object);
-- Dummy line to be replaced after the file is created.
Ada.Text_IO.Put_Line (Output_Object.Output_File, MAGIC_STYLE_MARKER);
Paragraph_Used := (others => (others => False));
Revision_Used := (others => False);
Paranum_Used := False;
Ada.Text_IO.Put_Line (Output_Object.Output_File, " </STYLE>");
elsif Output_Object.HTML_Kind = HTML_4_Compatible then
-- The style sheet.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " <STYLE type=""text/css"">");
-- Paragraph styles:
--Paragraph_Used := (others => (others => True)); -- Force showing all, we don't know what is used.
--Revision_Used := (others => True);
--Paranum_Used := True;
--Make_Paragraph_Styles (Output_Object);
-- Dummy line to be replaced after the file is created.
Ada.Text_IO.Put_Line (Output_Object.Output_File, MAGIC_STYLE_MARKER);
Paragraph_Used := (others => (others => False));
Revision_Used := (others => False);
Paranum_Used := False;
Ada.Text_IO.Put_Line (Output_Object.Output_File, " </STYLE>");
end if;
if Ada.Strings.Unbounded.Length(Output_Object.Script_HTML) /= 0 then
Ada.Text_IO.Put_Line (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Script_HTML));
end if;
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</HEAD>");
Ada.Text_IO.Put_Line (Output_Object.Output_File,
"<BODY TEXT=""" & Output_Object.Text_Color &
""" BGCOLOR=""" & Output_Object.Background_Color &
""" LINK=""" & Output_Object.Link_Color &
""" VLINK=""" & Output_Object.VLink_Color &
""" ALINK=""" & Output_Object.ALink_Color & """>");
if Ada.Strings.Unbounded.Length(Output_Object.Header_HTML) /= 0 then
Ada.Text_IO.Put_Line (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Header_HTML));
end if;
if Output_Object.Nav_on_Top then
Make_Navigation_Bar (Output_Object, Is_Top => True);
-- else no navigation bar
end if;
if Output_Object.Nav_on_Top or else
Ada.Strings.Unbounded.Length(Output_Object.Header_HTML) /= 0 then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR>"); -- Horizontal line (rule).
-- else nothing on top at all.
end if;
end Start_HTML_File;
procedure End_HTML_File (Output_Object : in out HTML_Output_Type) is
-- Internal routine.
-- Generate the needed text to end an HTML file. Also closes the file.
begin
Ada.Text_IO.New_Line (Output_Object.Output_File); -- Blank line to set off paragraphs.
if Output_Object.Nav_on_Bottom or else
Ada.Strings.Unbounded.Length(Output_Object.Footer_HTML) /= 0 then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR>"); -- Horizontal line (rule).
-- else nothing on top at all.
end if;
if Output_Object.Nav_on_Bottom then
Make_Navigation_Bar (Output_Object, Is_Top => False);
-- else no navigation bar.
end if;
if Ada.Strings.Unbounded.Length(Output_Object.Footer_HTML) /= 0 then
Ada.Text_IO.Put_Line (Output_Object.Output_File,
Ada.Strings.Unbounded.To_String(Output_Object.Footer_HTML));
end if;
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</BODY>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</HTML>");
if Output_Object.HTML_Kind <= HTML_3 then
Ada.Text_IO.Close (Output_Object.Output_File);
else -- Close and reread the file to add JUST the styles used by the
-- file; this decreases the minimum size of the files (by as
-- much as 7K as of this writing [1/2006]), which matters when
-- there are hundreds.
-- We also check spaces before end tags and after opening tags;
-- these should be . (See 9.1 in HTML 4.0: "In order to
-- avoid problems with SGML line break rules and inconsistencies
-- among extant implementations, authors should not rely on user
-- agents to render white space immediately after a start tag or
-- immediately before an end tag.") We haven't seen a problem
-- with this, but why ask for trouble?
-- Note that we assume that all occurrences of "<" and ">" in
-- the literal text are written as "<" and ">"; violations
-- might cause the conversion of spaces to non-breaking spaces,
-- which should not cause problems in general. We also assume that
-- all end tags are on one line (they are all very short), so
-- any ">" is the end of a start tag unless there is a "</" preceding it.
declare
Original_Name : constant String := Ada.Text_IO.Name (Output_Object.Output_File);
Reading_File : Ada.Text_IO.File_Type;
Real_Name : constant String :=
Ada.Strings.Fixed.Head (Original_Name, Original_Name'Length-3);
Buffer : String (1..1000);
Len : Natural;
Body_Seen : Boolean := False;
Loc : Natural;
begin
Ada.Text_IO.Close (Output_Object.Output_File);
Ada.Text_IO.Open (Reading_File, Ada.Text_IO.In_File,
Original_Name);
if Output_Object.DOS_Filenames then
Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
Real_Name & "HTM");
else
Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
Real_Name & "html");
end if;
begin
loop
Ada.Text_IO.Get_Line (Reading_File, Buffer, Len);
if Buffer(1..Len) = MAGIC_STYLE_MARKER then
-- Output only the styles used here.
Make_Paragraph_Styles (Output_Object);
elsif not Body_Seen then
if Ada.Strings.Fixed.Index (Buffer(1..Len), "<BODY") /= 0 then
Body_Seen := True;
end if;
Ada.Text_IO.Put_Line (Output_Object.Output_File, Buffer(1..Len));
else
-- Replace spaces before end tags:
loop
Loc := Ada.Strings.Fixed.Index (Buffer(1..Len), " </");
exit when Loc = 0;
Buffer(Loc+6..Len+5) := Buffer(Loc+1..Len);
Buffer(Loc..Loc+5) := " ";
Len := Len+5;
end loop;
-- Replace spaces after start tags:
Loc := 1;
while Loc < Len loop
if Buffer(Loc..Loc+1) = "> " then
-- Candidate; check that this isn't an end tag.
for I in reverse 1..Loc-1 loop
if Buffer(I) = '/' then
-- End tag, nothing to do.
Loc := Loc + 2;
exit;
elsif Buffer(I) = '<' or else I = 1 then
-- Start tag (including reaching the
-- start of the line), replace.
Buffer(Loc+7..Len+5) := Buffer(Loc+2..Len);
Buffer(Loc+1..Loc+6) := " ";
Len := Len+5;
Loc := Loc + 7;
-- If these is the *last* character on the
-- line, we have to "unbreak" the line, else we'd get an extra space.
if Loc > Len then
Ada.Text_IO.Put (Output_Object.Output_File, Buffer(1..Len));
goto Skip_Write;
end if;
exit;
-- else continue.
end if;
end loop;
else
Loc := Loc + 1;
end if;
end loop;
Ada.Text_IO.Put_Line (Output_Object.Output_File, Buffer(1..Len));
<<Skip_Write>> null;
end if;
end loop;
exception
when Ada.Text_IO.End_Error => null; -- Done copying.
end;
Ada.Text_IO.Close (Output_Object.Output_File);
Ada.Text_IO.Delete (Reading_File); -- This was temporary.
end;
end if;
end End_HTML_File;
procedure Create (Output_Object : in out HTML_Output_Type;
Big_Files : in Boolean;
File_Prefix : in String;
Output_Path : in String;
DOS_Filenames : in Boolean;
HTML_Kind : in HTML_Type;
Use_Unicode : in Boolean;
Number_Paragraphs : in Boolean;
Ref_URL : in String;
Srch_URL : in String;
Index_URL : in String;
Use_Buttons : Boolean;
Nav_On_Top : Boolean;
Nav_On_Bottom : Boolean;
Tab_Emulation : Tab_Emulation_Type;
Script_HTML : String;
Header_HTML : String;
Footer_HTML : String;
Title : in String := "";
Body_Font : ARM_Output.Font_Family_Type;
Force_New_Revision_Colors : Boolean;
Text_Color : Color_String;
Background_Color : Color_String;
Link_Color : Color_String;
VLink_Color : Color_String;
ALink_Color : Color_String) is
-- Create an Output_Object for a document.
-- Generate a few large output files if
-- Big_Files is True; otherwise generate smaller output files.
-- The prefix of the output file names is File_Prefix - this
-- should be no more than 5 characters allowed in file names.
-- The files will be written into Output_Path.
-- If DOS_Filename is true, use 8.3 file names;
-- in that case, File_Prefix must be less than 4 characters in length;
-- and no clause or subclause number may exceed 35 if Big_Files is False.
-- The title of the document is Title.
-- HTML_Kind determines the kind of HTML generated; HTML_3 works on
-- every browser but has little control over formatting;
-- HTML_4_Compatible has better control, but tries to make the results
-- look good on older browsers; HTML_4_Only uses maximum formatting,
-- but makes no attempt to look good on browsers older than IE 5.0 and
-- Firefox 1.0.
-- If Use_Unicode is true, Unicode characters available on US versions
-- of Windows 2000 are used when appropriate; otherwise, Unicode
-- characters are only used when explicitly requested with
-- Unicode_Character (other characters are replaced with reasonable
-- equivalents). [Note: It's known that IE on Windows 95/98/ME cannot
-- display Unicode characters.] Use_Unicode has no effect if HTML_Kind
-- is set to HTML_3.
-- Number_Paragraphs means that paragraph numbers will be used;
-- otherwise, the Number parameter to Start_Paragraph must be "".
-- Ref_URL, Srch_URL, and Index_URL are the URLs (possibly relative)
-- for the "References", "Search", and "Index" buttons/labels,
-- respectively. If null, these buttons/labels link to sections named
-- "References", "Search", and "Index"; if these do not exist, the
-- buttons/labels are omitted.
-- If Use_Buttons is true, button images are used, otherwise text labels
-- are used for the navigation bar.
-- If Nav_On_Top is true, the navigation bar will appear in the header
-- of each page. If Nav_On_Bottom is true, the navigation bar will
-- appear in the footer of each page.
-- Tab_Emulation determines how tabs are emulated.
-- Script_HTML gives self-contained HTML that will appear immediately
-- before the </HEAD> of every page. This usually will contain
-- Javascript scripts or CSS styles. The original intent was to allow
-- adding the Google Analytics script to each page.
-- Header_HTML gives self-contained HTML that will appear before the
-- navigation bar in the header. Footer_HTML gives self-contained HTML
-- that will appear after the navigation bar in the footer.
-- Body_Font selects the default font for the document body.
-- Text_Color specifies the default text color; Background_Color
-- specifies the default background color; Link_Color specifies the
-- default color of normal links; VLink_Color specifies the
-- default color of visited links; and ALink_Color specifies the
-- default color of active (in the act of clinking) links.
begin
if Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Already valid object");
end if;
Output_Object.Is_Valid := True;
Ada.Strings.Fixed.Move (Target => Output_Object.File_Prefix,
Source => File_Prefix);
Output_Object.Title := Ada.Strings.Unbounded.To_Unbounded_String (Title);
Output_Object.Big_Files := Big_Files;
Output_Object.Output_Path := Ada.Strings.Unbounded.To_Unbounded_String(Output_Path);
Output_Object.DOS_Filenames := DOS_Filenames;
Output_Object.HTML_Kind := HTML_Kind;
Output_Object.Use_Unicode := Use_Unicode;
Output_Object.Number_Paragraphs := Number_Paragraphs;
Output_Object.Ref_URL := Ada.Strings.Unbounded.To_Unbounded_String(Ref_URL);
Output_Object.Srch_URL := Ada.Strings.Unbounded.To_Unbounded_String(Srch_URL);
Output_Object.Index_URL := Ada.Strings.Unbounded.To_Unbounded_String(Index_URL);
Output_Object.Use_Buttons := Use_Buttons;
Output_Object.Nav_on_Top := Nav_on_Top;
Output_Object.Nav_on_Bottom := Nav_on_Bottom;
Output_Object.Tab_Emulation := Tab_Emulation;
Output_Object.Script_HTML := Ada.Strings.Unbounded.To_Unbounded_String(Script_HTML);
Output_Object.Header_HTML := Ada.Strings.Unbounded.To_Unbounded_String(Header_HTML);
Output_Object.Footer_HTML := Ada.Strings.Unbounded.To_Unbounded_String(Footer_HTML);
Output_Object.Body_Font := Body_Font;
Output_Object.Force_New_Revision_Colors := Force_New_Revision_Colors;
Output_Object.Text_Color := Text_Color;
Output_Object.Background_Color := Background_Color;
Output_Object.Link_Color := Link_Color;
Output_Object.VLink_Color := VLink_Color;
Output_Object.ALink_Color := ALink_Color;
if DOS_Filenames then
if File_Prefix'Length > 3 then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"HTML File Prefix too long - MS-DOS mode");
end if;
else
if File_Prefix'Length > 5 then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"HTML File Prefix too long");
end if;
end if;
if Output_Object.Big_Files then
Start_HTML_File (Output_Object,
Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right),
Ada.Strings.Unbounded.To_String (Output_Object.Title),
Clause => "");
-- Insert an anchor for the title page:
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<A NAME=""TTL""></A>");
end if;
end Create;
procedure Close (Output_Object : in out HTML_Output_Type) is
-- Close an Output_Object. No further output to the object is
-- allowed after this call.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Ada.Text_IO.Is_Open (Output_Object.Output_File) then
End_HTML_File (Output_Object);
end if;
Output_Object.Is_Valid := False;
end Close;
procedure Section (Output_Object : in out HTML_Output_Type;
Section_Title : in String;
Section_Name : in String) is
-- Start a new section. The title is Section_Title (this is
-- intended for humans). The name is Section_Name (this is
-- intended to be suitable to be a portion of a file name).
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Section in paragraph");
end if;
-- We don't generate a file here for HTML. We generate a file for each
-- clause.
if Section_Name'Length > 3 then
Output_Object.Section_Name := Section_Name (Section_Name'First .. Section_Name'First + 2);
else
Output_Object.Section_Name := (others => '-');
Output_Object.Section_Name (1 .. Section_Name'Length) := Section_Name;
end if;
end Section;
procedure Set_Columns (Output_Object : in out HTML_Output_Type;
Number_of_Columns : in ARM_Output.Column_Count) is
-- Set the number of columns.
-- Raises Not_Valid_Error if in a paragraph.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"In paragraph");
end if;
if Number_of_Columns >= 4 then
-- We have special processing for 4 or more columns. Note that we
-- assume do not contain any nested paragraph formats.
Output_Object.Current_Column := 1;
Output_Object.Current_Item := 1;
elsif Output_Object.Column_Count >= 4 and then Number_of_Columns = 1 then
-- Finished processing columns, output the columns as a table.
if Output_Object.Current_Column = 1 then
-- No New_Column calls; break this into columns ourselves.
-- Current_Item represents the total number of items + 2
-- (there is a double count for the end of the paragraph).
declare
Col_Count : Natural := Output_Object.Current_Item - 2;
Where : Column_Text_Ptr;
begin
Col_Count := (Col_Count + Output_Object.Column_Count - 1) /
Output_Object.Column_Count;
Ada.Text_IO.Put_Line(" @@ Calc columns for" & Natural'Image(Output_Object.Column_Count) &
" columns;" & Natural'Image(Output_Object.Current_Item - 1) & " total items;" &
Natural'Image(Col_Count) & " per column.");
-- Split the item list into the appropriate columns.
-- Note that this list is stored in reverse order.
for I in reverse 2 .. Output_Object.Column_Count loop
--Ada.Text_IO.Put_Line(" @@ For column" & Natural'Image(I) & " split at item" &
--Natural'Image(Col_Count*(I-1)));
Where := Output_Object.Column_Text(1);
exit when Where = null; -- No columns to look at.
if Where.Item <= Col_Count*(I-1) then
-- This column is empty.
null;
else
Output_Object.Column_Text(I) := Where;
while Where.Next /= null and then
Where.Next.Item > Col_Count*(I-1) loop
Where.Item := Where.Item - Col_Count*(I-1);
Where := Where.Next;
end loop;
if Where = null then
Output_Object.Column_Text(1) := null;
else
Output_Object.Column_Text(1) := Where.Next;
Where.Next := null;
--Ada.Text_IO.Put_Line(" split item=" & Natural'Image(Where.Item));
Where.Item := Where.Item - Col_Count*(I-1);
end if;
end if;
end loop;
end;
--else there were explicit New_Column calls; no need to
--do anything here.
end if;
if Output_Object.HTML_Kind = HTML_3 then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<UL><UL><TABLE Width=""70%"">"); -- Table with no border or caption, takes up 70% of the screen.
else
Ada.Text_IO.Put_Line (Output_Object.Output_File,
"<div class=""" & Paragraph_Name (ARM_Output.Normal, 2) & """><table width=""70%"">"); -- Table with no border or caption, takes up 70% of the screen.
Paragraph_Used(ARM_Output.Normal, 2) := True;
end if;
-- And start the first row:
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
for Item in 1 .. 5000 loop
for Col in 1 .. Output_Object.Column_Count loop
declare
Find : Column_Text_Ptr := Output_Object.Column_Text(Col);
Temp : Column_Text_Ptr;
begin
-- We're going to free this item after outputting it.
if Find = null then
null;
elsif Find.Next = null then
if Find.Item /= Item then
Find := null;
else
Output_Object.Column_Text(Col) := null;
end if;
else
while Find.Next /= null and then Find.Next.Item /= Item loop
Find := Find.Next;
end loop;
Temp := Find;
Find := Find.Next;
Temp.Next := null;
end if;
if Find /= null then
Ada.Text_IO.Put (Output_Object.Output_File,
Find.Text (1 .. Find.Length));
-- This should always be the last item:
if Find.Next /= null then
Ada.Text_IO.Put_Line ("** Column Item invariant failure!");
end if;
Free (Find);
else -- No item, make a blank.
Ada.Text_IO.Put (Output_Object.Output_File,
" ");
end if;
end;
Ada.Text_IO.Put (Output_Object.Output_File, "<TD align=""left"">");
end loop;
if Output_Object.Column_Text = Column_Text_Ptrs_Type'(others => null) then
-- We've output everything.
Ada.Text_IO.New_Line (Output_Object.Output_File);
if Output_Object.HTML_Kind = HTML_3 then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</TABLE></UL></UL>");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</table></div>");
end if;
exit;
end if;
-- End the row:
Ada.Text_IO.New_Line (Output_Object.Output_File);
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
end loop;
Output_Object.Current_Column := 0;
Output_Object.Current_Item := 0;
-- else Two and Three column formats are displayed without any columns.
-- This is mainly used for the syntax cross-reference and index, and
-- these definitely look better without columns.
end if;
Output_Object.Column_Count := Number_of_Columns;
end Set_Columns;
procedure Check_Clause_File (Output_Object : in out HTML_Output_Type) is
-- Check that a Clause file has been made for this clause; if not,
-- create one.
begin
if not Ada.Text_IO.Is_Open (Output_Object.Output_File) then
if (not Output_Object.Big_Files) and then
Output_Object.DOS_Filenames and then
Output_Object.Section_Name(1) = '-' then
Start_HTML_File (Output_Object,
Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
Make_Clause_Anchor_Name (Output_Object, Output_Object.Section_Name(2..3)), "", Clause => "");
else
Start_HTML_File (Output_Object,
Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
"-" & Output_Object.Section_Name, "", Clause => "");
end if;
end if;
end Check_Clause_File;
procedure Put_Compatibility_Font_Info (Output_Object : in out HTML_Output_Type;
Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type) is
-- Internal:
-- Output the font information for HTML 4.0 compatibility mode.
begin
if Output_Object.HTML_Kind = HTML_4_Compatible then
case Paragraph_Info(Style, Indent).Font is
when ARM_Output.Default =>
if ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Swiss) then
Ada.Text_IO.Put (Output_Object.Output_File, SWISS_FONT_CODE);
Output_Object.Char_Count := Output_Object.Char_Count + SWISS_FONT_CODE'Length;
-- else nothing for Roman.
end if;
when ARM_Output.Roman =>
null;
when ARM_Output.Swiss =>
Ada.Text_IO.Put (Output_Object.Output_File, SWISS_FONT_CODE);
Output_Object.Char_Count := Output_Object.Char_Count + SWISS_FONT_CODE'Length;
when ARM_Output.Fixed =>
Ada.Text_IO.Put (Output_Object.Output_File, "<TT>");
Output_Object.Char_Count := Output_Object.Char_Count + 4;
end case;
if ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
null; -- No font change here.
else
case Paragraph_Info(Style, Indent).Size is
when 0 => null;
when 1 =>
Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""+1"">");
Output_Object.Char_Count := Output_Object.Char_Count + 16;
when 2 =>
Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""+2"">");
Output_Object.Char_Count := Output_Object.Char_Count + 16;
when 3 =>
Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""+3"">");
Output_Object.Char_Count := Output_Object.Char_Count + 16;
when -1 =>
Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""-1"">");
Output_Object.Char_Count := Output_Object.Char_Count + 16;
when -2 =>
Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""-2"">");
Output_Object.Char_Count := Output_Object.Char_Count + 16;
when -3 =>
Ada.Text_IO.Put (Output_Object.Output_File, "<font size=""-3"">");
Output_Object.Char_Count := Output_Object.Char_Count + 16;
when others => null; -- Not supported.
end case;
end if;
end if;
end Put_Compatibility_Font_Info;
procedure Put_End_Compatibility_Font_Info (Output_Object : in out HTML_Output_Type;
Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type) is
-- Internal:
-- Output the font information for HTML 4.0 compatibility mode.
begin
if Output_Object.HTML_Kind = HTML_4_Compatible then
if ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
null; -- No font change here.
else
case Paragraph_Info(Style, Indent).Size is
when 0 => null;
when 1 =>
Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
when 2 =>
Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
when -1 =>
Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
when -2 =>
Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
when -3 =>
Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
when others => null; -- Not supported.
end case;
end if;
case Paragraph_Info(Style, Indent).Font is
when ARM_Output.Default =>
if ARM_Output."=" (Output_Object.Body_Font, ARM_Output.Swiss) then
Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
-- else nothing for Roman.
end if;
when ARM_Output.Roman =>
null;
when ARM_Output.Swiss =>
Ada.Text_IO.Put (Output_Object.Output_File, "</font>");
when ARM_Output.Fixed =>
Ada.Text_IO.Put (Output_Object.Output_File, "</tt>");
end case;
end if;
end Put_End_Compatibility_Font_Info;
procedure Start_Paragraph (Output_Object : in out HTML_Output_Type;
Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type;
Number : in String;
No_Prefix : in Boolean := False;
Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS;
No_Breaks : in Boolean := False;
Keep_with_Next : in Boolean := False;
Space_After : in ARM_Output.Space_After_Type
:= ARM_Output.Normal;
Justification : in ARM_Output.Justification_Type
:= ARM_Output.Default) is
-- Start a new paragraph. The style and indent of the paragraph is as
-- specified. The (AA)RM paragraph number (which might include update
-- and version numbers as well: [12.1/1]) is Number. If the format is
-- a type with a prefix (bullets, hangining items), the prefix is
-- omitted if No_Prefix is true. Tab_Stops defines the tab stops for
-- the paragraph. If No_Breaks is True, we will try to avoid page breaks
-- in the paragraph. If Keep_with_Next is true, we will try to avoid
-- separating this paragraph and the next one. (These may have no
-- effect in formats that don't have page breaks). Space_After
-- specifies the amount of space following the paragraph. Justification
-- specifies the text justification for the paragraph. Not_Valid_Error
-- is raised if Tab_Stops /= NO_TABS for a hanging or bulleted format.
procedure Put_Style (Name : in String;
Include_Compatibility : in Boolean := True;
Use_DIV : in Boolean := False) is
-- Output a style for HTML 4.0; if Include_Compatibility is True,
-- include compatibility font information as well.
-- If Use_DIV is true, ignore the contents of the
-- style data and use a DIV.
begin
if Use_DIV then
Ada.Text_IO.Put (Output_Object.Output_File, "<div");
Output_Object.Char_Count := 4;
else
case Paragraph_Info(Style, Indent).Tag is
when DIV =>
Ada.Text_IO.Put (Output_Object.Output_File, "<div");
Output_Object.Char_Count := 4;
when UL =>
Ada.Text_IO.Put (Output_Object.Output_File, "<ul");
Output_Object.Char_Count := 3;
when DL =>
Ada.Text_IO.Put (Output_Object.Output_File, "<dl");
Output_Object.Char_Count := 3;
end case;
end if;
Ada.Text_IO.Put (Output_Object.Output_File, " class=""" & Name & """");
Output_Object.Char_Count := Output_Object.Char_Count + 8 + Name'Length + 1;
case Justification is
when ARM_Output.Default | ARM_Output.Left | ARM_Output.Justified =>
null;
when ARM_Output.Center =>
Ada.Text_IO.Put (Output_Object.Output_File, " style=""text-align: center""");
Output_Object.Char_Count := Output_Object.Char_Count + 27;
when ARM_Output.Right =>
Ada.Text_IO.Put (Output_Object.Output_File, " style=""text-align: right""");
Output_Object.Char_Count := Output_Object.Char_Count + 26;
end case;
case Space_After is
when ARM_Output.Normal =>
null;
when ARM_Output.Narrow =>
Ada.Text_IO.Put (Output_Object.Output_File, " style=""margin-bottom: ");
Output_Object.Char_Count := Output_Object.Char_Count + 24;
Put_EMs(Output_Object.Output_File, (Paragraph_Info(Style, Indent).After * LEADING_PERCENT) / 100);
Ada.Text_IO.Put (Output_Object.Output_File, """");
Output_Object.Char_Count := Output_Object.Char_Count + 6;
when ARM_Output.Wide =>
Ada.Text_IO.Put (Output_Object.Output_File, " style=""margin-bottom: ");
Output_Object.Char_Count := Output_Object.Char_Count + 24;
Put_EMs(Output_Object.Output_File, (Paragraph_Info(Style, Indent).After * TRAILING_PERCENT) / 100);
Ada.Text_IO.Put (Output_Object.Output_File, """");
Output_Object.Char_Count := Output_Object.Char_Count + 6;
end case;
Ada.Text_IO.Put (Output_Object.Output_File, ">");
Output_Object.Char_Count := Output_Object.Char_Count + 1;
if Output_Object.HTML_Kind = HTML_4_Compatible and then Include_Compatibility then
Put_Compatibility_Font_Info (Output_Object, Style, Indent);
end if;
end Put_Style;
function Paranum_Anchor (Number : in String) return String is
-- Create the string for an anchor from a paragraph number.
-- Note that anchors cannot use "/", so we strip the
-- slash part. "." is allowed (as well as "-", "_", and ":", but
-- nothing else). We don't need the slash part (the version number),
-- as paragraph numbers are unique without it, and the version
-- is specified by the enclosing document (given by the rest of
-- the page).
Where : constant Natural := Ada.Strings.Fixed.Index (Number, "/");
begin
if Where = 0 then
return Number;
else
return Number(Number'First..Where-1);
end if;
end Paranum_Anchor;
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Already in paragraph");
end if;
if not Output_Object.Number_Paragraphs and then
Number /= "" then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Paragraph number when none used");
end if;
if not Paragraph_Info(Style, Indent).Defined then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Undefined style " & ARM_Output.Paragraph_Style_Type'Image(Style) &
" and indent" & ARM_Output.Paragraph_Indent_Type'Image(Indent));
end if;
Output_Object.Is_In_Paragraph := True;
Output_Object.Had_Prefix := not No_Prefix;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line
Output_Object.Conditional_Space := False;
Output_Object.Saw_Hang_End := False;
Output_Object.In_Local_Link := False;
Check_Clause_File (Output_Object);
-- Note: We only support Justification for the Normal and Wide styles.
if Output_Object.Column_Count >= 4 then
-- Formatting is deferred; only a few formats are supported.
if Tab_Stops.Number /= 0 then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Tabs in 4+ column text");
end if;
case Style is
when ARM_Output.Normal =>
null;
when others =>
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Unsupported format in 4+ column text - " & ARM_Output.Paragraph_Style_Type'Image(Style));
end case;
if Number /= "" then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"No paragraph numbers in 4+ column text");
end if;
return; -- Nothing more to do here.
end if;
-- Set up tabs:
case Style is
when ARM_Output.Normal | ARM_Output.Wide_Above |
ARM_Output.Small | ARM_Output.Small_Wide_Above |
ARM_Output.Header | ARM_Output.Small_Header |
ARM_Output.Index | ARM_Output.Syntax_Summary |
ARM_Output.Title |
ARM_Output.Examples | ARM_Output.Small_Examples |
ARM_Output.Swiss_Examples | ARM_Output.Small_Swiss_Examples =>
Output_Object.Tab_Stops := Tab_Stops;
-- No tabs in HTML; we'll emulate them for fixed fonts.
-- We'll expand proportional stops here (text characters
-- are larger than the variable ones these are set up for).
Output_Object.Can_Emulate_Tabs :=
ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed);
for I in 1 .. Tab_Stops.Number loop
if ARM_Output."=" (Tab_Stops.Stops(I).Kind,
ARM_Output.Left_Proportional) then
if ARM_Output."=" (Paragraph_Info(Style, Indent).Font, ARM_Output.Fixed) then
Output_Object.Tab_Stops.Stops(I).Stop :=
(Tab_Stops.Stops(I).Stop * 13 / 12);
else -- Proportional characters are smaller.
Output_Object.Tab_Stops.Stops(I).Stop :=
(Tab_Stops.Stops(I).Stop * 5 / 4);
end if;
else
Output_Object.Tab_Stops.Stops(I).Stop :=
Tab_Stops.Stops(I).Stop;
end if;
end loop;
when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted |
ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
ARM_Output.Hanging_in_Bulleted |
ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
ARM_Output.Small_Hanging_in_Bulleted |
ARM_Output.Enumerated | ARM_Output.Small_Enumerated =>
if Tab_Stops.Number /= 0 then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Tabs in hanging/bulleted paragraph");
end if;
Output_Object.Can_Emulate_Tabs := False;
end case;
if Output_Object.HTML_Kind = HTML_3 then
-- Note: We can't control the space below the paragraphs here, so
-- Space_After is ignored.
-- Make any indents:
for I in 1 .. Indent loop
Ada.Text_IO.Put (Output_Object.Output_File, "<UL>");
Output_Object.Char_Count := Output_Object.Char_Count + 4;
end loop;
case Style is
when ARM_Output.Normal | ARM_Output.Wide_Above |
ARM_Output.Header =>
if ARM_Output."=" (Indent, 0) then
case Justification is
when ARM_Output.Default | ARM_Output.Left | ARM_Output.Justified =>
Ada.Text_IO.Put (Output_Object.Output_File, "<P>");
Output_Object.Char_Count := 3;
when ARM_Output.Center =>
Ada.Text_IO.Put (Output_Object.Output_File, "<P ALIGN=CENTER>");
Output_Object.Char_Count := 16;
when ARM_Output.Right =>
Ada.Text_IO.Put (Output_Object.Output_File, "<P ALIGN=RIGHT>");
Output_Object.Char_Count := 15;
end case;
else
null; -- Formatting is hard in HTML 3!
end if;
when ARM_Output.Small | ARM_Output.Small_Wide_Above |
ARM_Output.Small_Header =>
Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=-1>");
Output_Object.Char_Count := Output_Object.Char_Count + 14;
when ARM_Output.Index =>
-- Note: We don't put this in a smaller font.
if ARM_Output."=" (Indent, 0) then
Ada.Text_IO.Put (Output_Object.Output_File, "<P>");
Output_Object.Char_Count := 3;
else
null; -- Formatting is hard in HTML 3!
end if;
when ARM_Output.Syntax_Summary =>
-- Note: We don't put this in a smaller font.
null;
when ARM_Output.Title =>
Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=+3>");
Output_Object.Char_Count := Output_Object.Char_Count + 14;
when ARM_Output.Examples =>
Ada.Text_IO.Put (Output_Object.Output_File, "<TT>");
Output_Object.Char_Count := Output_Object.Char_Count + 4;
when ARM_Output.Small_Examples =>
Ada.Text_IO.Put (Output_Object.Output_File, "<TT><FONT SIZE=-1>");
Output_Object.Char_Count := Output_Object.Char_Count + 18;
when ARM_Output.Swiss_Examples =>
Ada.Text_IO.Put (Output_Object.Output_File, SWISS_FONT_CODE);
Output_Object.Char_Count := Output_Object.Char_Count + SWISS_FONT_CODE'Length;
when ARM_Output.Small_Swiss_Examples =>
Ada.Text_IO.Put (Output_Object.Output_File, SMALL_SWISS_FONT_CODE);
Output_Object.Char_Count := Output_Object.Char_Count + SMALL_SWISS_FONT_CODE'Length;
when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted =>
if No_Prefix then
null;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<LI TYPE=DISC>");
Output_Object.Char_Count := Output_Object.Char_Count + 14;
end if;
when ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
if No_Prefix then
Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=-1>");
Output_Object.Char_Count := Output_Object.Char_Count + 14;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<LI TYPE=DISC><FONT SIZE=-1>");
Output_Object.Char_Count := Output_Object.Char_Count + 28;
end if;
when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
ARM_Output.Hanging_in_Bulleted |
ARM_Output.Enumerated =>
if No_Prefix then
Ada.Text_IO.Put (Output_Object.Output_File, "<DL><DD>");
Output_Object.Char_Count := Output_Object.Char_Count + 8;
Output_Object.Saw_Hang_End := True;
else -- Has prefix.
Ada.Text_IO.Put (Output_Object.Output_File, "<DL><DT>");
Output_Object.Char_Count := Output_Object.Char_Count + 8;
Output_Object.Saw_Hang_End := False;
end if;
when ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
ARM_Output.Small_Hanging_in_Bulleted |
ARM_Output.Small_Enumerated =>
if No_Prefix then
Ada.Text_IO.Put (Output_Object.Output_File, "<DL><DD><FONT SIZE=-1>");
Output_Object.Char_Count := Output_Object.Char_Count + 22;
Output_Object.Saw_Hang_End := True;
else -- Has prefix.
Ada.Text_IO.Put (Output_Object.Output_File, "<DL><DT><FONT SIZE=-1>");
Output_Object.Char_Count := Output_Object.Char_Count + 22;
Output_Object.Saw_Hang_End := False;
end if;
end case;
Output_Object.Paragraph_Style := Style;
Output_Object.Paragraph_Indent := Indent;
Output_Object.Font := ARM_Output.Default;
Output_Object.Is_Bold := False;
Output_Object.Is_Italic := False;
Output_Object.Size := 0;
Output_Object.Color := ARM_Output.Default;
Output_Object.Change := ARM_Output.None;
Output_Object.Version := '0';
Output_Object.Added_Version := '0';
if Number /= "" then -- Has paragraph number.
Ada.Text_IO.Put (Output_Object.Output_File, "<A NAME=""p");
Ada.Text_IO.Put (Output_Object.Output_File, Paranum_Anchor(Number));
Ada.Text_IO.Put (Output_Object.Output_File, """>");
Ada.Text_IO.Put (Output_Object.Output_File, TINY_SWISS_FONT_CODE);
Ada.Text_IO.Put (Output_Object.Output_File, Number);
Ada.Text_IO.Put (Output_Object.Output_File, Number);
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT></A> ");
Output_Object.Char_Count := Output_Object.Char_Count + TINY_SWISS_FONT_CODE'Length + Number'Length + 8;
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + ((Number'Length+1)/2) + 1;
-- Note: Count these as half characters, as the font is so small.
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
elsif Output_Object.HTML_Kind = HTML_4_Compatible then
if Number /= "" then -- Has paragraph number.
Paranum_Used := True;
Ada.Text_IO.Put (Output_Object.Output_File, "<div class=""paranum"">");
Ada.Text_IO.Put (Output_Object.Output_File, "<a name=""p");
Ada.Text_IO.Put (Output_Object.Output_File, Paranum_Anchor(Number));
Ada.Text_IO.Put (Output_Object.Output_File, """><font size=-2>");
Ada.Text_IO.Put (Output_Object.Output_File, Number);
Ada.Text_IO.Put (Output_Object.Output_File, "</font></a>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</div>");
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line
Output_Object.Conditional_Space := False; -- Don't need it here.
end if;
case Style is
when ARM_Output.Normal | ARM_Output.Wide_Above |
ARM_Output.Header |
ARM_Output.Small | ARM_Output.Small_Wide_Above |
ARM_Output.Small_Header |
ARM_Output.Index | ARM_Output.Syntax_Summary |
ARM_Output.Title |
ARM_Output.Examples | ARM_Output.Swiss_Examples |
ARM_Output.Small_Examples | ARM_Output.Small_Swiss_Examples =>
Put_Style (Paragraph_Name (Style, Indent));
when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
Put_Style (Paragraph_Name (Style, Indent), Include_Compatibility => False);
if No_Prefix then
null;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<li type=disc>");
Output_Object.Char_Count := Output_Object.Char_Count + 14;
end if;
Put_Compatibility_Font_Info (Output_Object, Style, Indent);
when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
ARM_Output.Hanging_in_Bulleted |
ARM_Output.Enumerated |
ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
ARM_Output.Small_Hanging_in_Bulleted |
ARM_Output.Small_Enumerated =>
declare
PName : constant String :=
Paragraph_Name (Style, Indent);
begin
Put_Style (PName, Include_Compatibility => False);
if No_Prefix then
Ada.Text_IO.Put (Output_Object.Output_File, "<dd class="" & PName & "">");
Output_Object.Char_Count := Output_Object.Char_Count + 13 + PName'Length;
Output_Object.Saw_Hang_End := True;
else -- Has prefix.
Ada.Text_IO.Put (Output_Object.Output_File, "<dt>");
Output_Object.Char_Count := Output_Object.Char_Count + 4;
Output_Object.Saw_Hang_End := False;
end if;
Put_Compatibility_Font_Info (Output_Object, Style, Indent);
end;
end case;
Output_Object.Paragraph_Style := Style;
Output_Object.Paragraph_Indent := Indent;
Output_Object.Font := ARM_Output.Default;
Output_Object.Is_Bold := False;
Output_Object.Is_Italic := False;
Output_Object.Size := 0;
Output_Object.Color := ARM_Output.Default;
Output_Object.Change := ARM_Output.None;
Output_Object.Version := '0';
Output_Object.Added_Version := '0';
if Number /= "" then -- Has paragraph number.
if Paragraph_Info(Style, Indent).Indent = 0 and then
((not No_Prefix) or else
Style in ARM_Output.Unprefixed_Style_Subtype) then
-- No indent, either a prefix or a style that doesn't
-- have a prefix.
-- We may have to make a space for the paragraph number,
-- as absolute positioned or floating items can overlap
-- others.
for I in 1 .. (Number'Length+2)-(INDENT_EMS_FOR_PARANUMS/5) loop
-- We assume that each space is roughly equal to
-- 0.5em (that should be conservative).
Ada.Text_IO.Put (Output_Object.Output_File, " ");
Output_Object.Char_Count := Output_Object.Char_Count + 1;
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end loop;
-- else is indented, so we don't need to make space.
end if;
end if;
else -- HTML_4_Only.
if Number /= "" then -- Has paragraph number.
Paranum_Used := True;
Ada.Text_IO.Put (Output_Object.Output_File, "<div class=""paranum"">");
Ada.Text_IO.Put (Output_Object.Output_File, "<a name=""p");
Ada.Text_IO.Put (Output_Object.Output_File, Paranum_Anchor(Number));
Ada.Text_IO.Put (Output_Object.Output_File, """>");
Ada.Text_IO.Put (Output_Object.Output_File, Number);
Ada.Text_IO.Put (Output_Object.Output_File, "</a>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</div>");
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line
Output_Object.Conditional_Space := False; -- Don't need it here.
end if;
case Style is
when ARM_Output.Normal | ARM_Output.Wide_Above |
ARM_Output.Header |
ARM_Output.Small | ARM_Output.Small_Wide_Above |
ARM_Output.Small_Header |
ARM_Output.Index | ARM_Output.Syntax_Summary |
ARM_Output.Title |
ARM_Output.Examples | ARM_Output.Swiss_Examples |
ARM_Output.Small_Examples | ARM_Output.Small_Swiss_Examples =>
Put_Style (Paragraph_Name (Style, Indent));
when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
-- We use formatted DIVs here, as otherwise the indenting
-- varies wildly between Firefox and IE (and does not
-- match similar enumerated lists).
if No_Prefix then
Put_Style (Paragraph_Name (Style, Indent) & "-NoPrefix", Use_DIV => True);
else
Put_Style (Paragraph_Name (Style, Indent), Use_DIV => True);
end if;
when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
ARM_Output.Hanging_in_Bulleted |
ARM_Output.Enumerated |
ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
ARM_Output.Small_Hanging_in_Bulleted |
ARM_Output.Small_Enumerated =>
if No_Prefix then
Put_Style (Paragraph_Name (Style, Indent) & "-Body", Use_DIV => True);
Output_Object.Saw_Hang_End := True;
else -- Has prefix.
Put_Style (Paragraph_Name (Style, Indent) & "-Term", Use_DIV => True);
Output_Object.Saw_Hang_End := False;
end if;
end case;
Output_Object.Paragraph_Style := Style;
Output_Object.Paragraph_Indent := Indent;
Output_Object.Font := ARM_Output.Default;
Output_Object.Is_Bold := False;
Output_Object.Is_Italic := False;
Output_Object.Size := 0;
Output_Object.Color := ARM_Output.Default;
Output_Object.Change := ARM_Output.None;
Output_Object.Version := '0';
Output_Object.Added_Version := '0';
if Number /= "" then -- Has paragraph number.
if Paragraph_Info(Style, Indent).Indent = 0 and then
((not No_Prefix) or else
Style in ARM_Output.Unprefixed_Style_Subtype) then
-- No indent, either a prefix or a style that doesn't
-- have a prefix.
-- We may have to make a space for the paragraph number,
-- as absolute positioned or floating items can overlap
-- others.
for I in 1 .. (Number'Length+2)-((INDENT_EMS_FOR_PARANUMS+5)*3/10) loop
-- We assume that each space is roughly equal to
-- 0.33em (that should be conservative). We also assume
-- that the normal left edge space is 1.0em (this is
-- true on IE 5&6). Paragraph numbers are positioned
-- at 0.5ems, so the additional difference is +5.
Ada.Text_IO.Put (Output_Object.Output_File, " ");
Output_Object.Char_Count := Output_Object.Char_Count + 1;
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end loop;
-- else is indented, so we don't need to make space.
end if;
end if;
end if;
Paragraph_Used(Style, Indent) := True;
-- Note: No_Breaks and Keep_with_Next have no effect here, because
-- HTML doesn't have page breaks.
end Start_Paragraph;
procedure End_Paragraph (Output_Object : in out HTML_Output_Type) is
-- End a paragraph.
procedure Put_End_Style (Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type;
Include_Compatibility : in Boolean := True) is
-- Output a end style for HTML 4.0; if Include_Compatibility is True,
-- include compatibility font information as well.
begin
if Output_Object.HTML_Kind = HTML_4_Compatible and then Include_Compatibility then
Put_End_Compatibility_Font_Info (Output_Object, Style, Indent);
end if;
case Paragraph_Info(Style, Indent).Tag is
when DIV =>
Ada.Text_IO.Put (Output_Object.Output_File, "</div>");
when UL =>
Ada.Text_IO.Put (Output_Object.Output_File, "</ul>");
when DL =>
Ada.Text_IO.Put (Output_Object.Output_File, "</dl>");
end case;
end Put_End_Style;
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
Output_Object.Is_In_Paragraph := False;
if Output_Object.In_Local_Link then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Unclosed Local_Link");
Output_Object.In_Local_Link := False;
end if;
if Output_Object.Column_Count >= 4 then
-- Formatting is deferred; only a few formats are supported.
if Output_Object.Column_Text (Output_Object.Current_Column) /= null and then
Output_Object.Column_Text (Output_Object.Current_Column).Item = Output_Object.Current_Item then
Output_Object.Column_Text (Output_Object.Current_Column).End_Para := True;
end if;
Output_Object.Current_Item := Output_Object.Current_Item + 2; -- Skip an item.
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
return; -- Nothing else to do here.
end if;
if Output_Object.HTML_Kind = HTML_3 then
case Output_Object.Paragraph_Style is
when ARM_Output.Normal | ARM_Output.Wide_Above | ARM_Output.Header |
ARM_Output.Index =>
if ARM_Output."=" (Output_Object.Paragraph_Indent, 0) then
Ada.Text_IO.Put (Output_Object.Output_File, "</P>");
-- else let the indent nesting handling it.
end if;
when ARM_Output.Syntax_Summary =>
null;
when ARM_Output.Small | ARM_Output.Small_Wide_Above |
ARM_Output.Small_Header =>
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
when ARM_Output.Title =>
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
when ARM_Output.Examples =>
Ada.Text_IO.Put (Output_Object.Output_File, "</TT>");
when ARM_Output.Small_Examples =>
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
when ARM_Output.Swiss_Examples =>
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
when ARM_Output.Small_Swiss_Examples =>
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted =>
if Output_Object.Had_Prefix then
Ada.Text_IO.Put (Output_Object.Output_File, "</LI>");
-- else nothing to do.
end if;
when ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
if Output_Object.Had_Prefix then
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT></LI>");
else
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
end if;
when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
ARM_Output.Hanging_in_Bulleted |
ARM_Output.Enumerated =>
Ada.Text_IO.Put (Output_Object.Output_File, "</DL>");
when ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
ARM_Output.Small_Hanging_in_Bulleted |
ARM_Output.Small_Enumerated =>
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT></DL>");
end case;
-- Reverse any indents:
for I in reverse 1 .. Output_Object.Paragraph_Indent loop
Ada.Text_IO.Put (Output_Object.Output_File, "</UL>");
end loop;
Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
elsif Output_Object.HTML_Kind = HTML_4_Only then
case Output_Object.Paragraph_Style is
when ARM_Output.Normal | ARM_Output.Wide_Above |
ARM_Output.Header |
ARM_Output.Small | ARM_Output.Small_Wide_Above |
ARM_Output.Small_Header |
ARM_Output.Index | ARM_Output.Syntax_Summary |
ARM_Output.Title |
ARM_Output.Examples | ARM_Output.Swiss_Examples |
ARM_Output.Small_Examples | ARM_Output.Small_Swiss_Examples =>
Put_End_Style (Output_Object.Paragraph_Style,
Output_Object.Paragraph_Indent);
when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
-- We've overridden the style class here.
Ada.Text_IO.Put (Output_Object.Output_File, "</div>");
when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
ARM_Output.Hanging_in_Bulleted |
ARM_Output.Enumerated |
ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
ARM_Output.Small_Hanging_in_Bulleted |
ARM_Output.Small_Enumerated =>
-- We've overridden the style class here.
Ada.Text_IO.Put (Output_Object.Output_File, "</div>");
end case;
Ada.Text_IO.New_Line (Output_Object.Output_File);
else -- if Output_Object.HTML_Kind = HTML_4_Compatible
case Output_Object.Paragraph_Style is
when ARM_Output.Normal | ARM_Output.Wide_Above |
ARM_Output.Header |
ARM_Output.Small | ARM_Output.Small_Wide_Above |
ARM_Output.Small_Header |
ARM_Output.Index | ARM_Output.Syntax_Summary |
ARM_Output.Title |
ARM_Output.Examples | ARM_Output.Swiss_Examples |
ARM_Output.Small_Examples | ARM_Output.Small_Swiss_Examples =>
Put_End_Style (Output_Object.Paragraph_Style,
Output_Object.Paragraph_Indent);
when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted =>
Put_End_Compatibility_Font_Info (Output_Object,
Output_Object.Paragraph_Style,
Output_Object.Paragraph_Indent);
if Output_Object.Had_Prefix then
Ada.Text_IO.Put (Output_Object.Output_File, "</li>");
-- else null;
end if;
Put_End_Style (Output_Object.Paragraph_Style,
Output_Object.Paragraph_Indent,
Include_Compatibility => False);
when ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
ARM_Output.Hanging_in_Bulleted |
ARM_Output.Enumerated |
ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
ARM_Output.Small_Hanging_in_Bulleted |
ARM_Output.Small_Enumerated =>
Put_End_Style (Output_Object.Paragraph_Style,
Output_Object.Paragraph_Indent);
end case;
Ada.Text_IO.New_Line (Output_Object.Output_File);
end if;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
end End_Paragraph;
procedure Category_Header (Output_Object : in out HTML_Output_Type;
Header_Text : String) is
-- Output a Category header (that is, "Legality Rules",
-- "Dynamic Semantics", etc.)
-- (Note: We did not use a enumeration here to insure that these
-- headers are spelled the same in all output versions).
-- Raises Not_Valid_Error if in a paragraph.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Header in paragraph");
end if;
Ada.Text_IO.New_Line (Output_Object.Output_File);
if Output_Object.HTML_Kind = HTML_4_Only then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H4 Class=""centered"">" & Header_Text & "</H4>");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H4 ALIGN=CENTER>" & Header_Text & "</H4>");
end if;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
end Category_Header;
procedure Clause_Header (Output_Object : in out HTML_Output_Type;
Header_Text : in String;
Level : in ARM_Contents.Level_Type;
Clause_Number : in String;
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
No_Page_Break : in Boolean := False) is
-- Output a Clause header. The level of the header is specified
-- in Level. The Clause Number is as specified; the top-level (and
-- other) subdivision names are as specified. These should appear in
-- the table of contents.
-- For hyperlinked formats, this should generate a link target.
-- If No_Page_Break is True, suppress any page breaks.
-- Raises Not_Valid_Error if in a paragraph.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Header in paragraph");
end if;
if not Output_Object.Big_Files then
if Ada.Text_IO.Is_Open (Output_Object.Output_File) then
End_HTML_File (Output_Object);
end if;
-- Special for table of contents:
if Clause_Number = "" and then
(Header_Text = "Table of Contents" or else -- Ada 95 format
Header_Text = "Contents") then -- ISO 2004 format.
Start_HTML_File (Output_Object,
Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
"-TOC", Header_Text, "");
if Header_Text = "Table of Contents" then -- Ada 95 format
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Table of Contents</H1>");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Contents</H1>");
end if;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
return;
end if;
Start_HTML_File (Output_Object,
Make_Clause_File_Name (Output_Object, Clause_Number),
Header_Text, Clause_Number);
else -- Big Files:
if Clause_Number = "" and then
(Header_Text = "Table of Contents" or else -- Ada 95 format
Header_Text = "Contents") then -- ISO 2004 format.
-- Insert an anchor:
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<A NAME=""TOC""></A>");
if Header_Text = "Table of Contents" then -- Ada 95 format
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Table of Contents</H1>");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Contents</H1>");
end if;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
return;
end if;
-- Insert an anchor:
Ada.Text_IO.Put (Output_Object.Output_File, "<A NAME=""");
Ada.Text_IO.Put (Output_Object.Output_File,
Make_Clause_Anchor_Name (Output_Object, Clause_Number));
Ada.Text_IO.Put_Line (Output_Object.Output_File, """></A>");
end if;
case Level is
when ARM_Contents.Plain_Annex =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number &
"<BR>"); -- Note: Clause_Number includes "Annex"
Ada.Text_IO.Put_Line (Output_Object.Output_File, Header_Text & "</H1>");
when ARM_Contents.Normative_Annex =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number & "</H1>");
-- Note: Clause_Number includes "Annex"
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H2>(normative)</H2>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Header_Text & "</H1>");
when ARM_Contents.Informative_Annex =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number & "</H1>");
-- Note: Clause_Number includes "Annex"
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H2>(informative)</H2>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Header_Text & "</H1>");
when ARM_Contents.Unnumbered_Section =>
if Header_Text /= "" then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
Header_Text & "</H1>");
end if;
when ARM_Contents.Section =>
case Top_Level_Subdivision_Name is
when ARM_Output.Chapter =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Chapter " &
Clause_Number & ": " & Header_Text & "</H1>");
when ARM_Output.Section =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Section " &
Clause_Number & ": " & Header_Text & "</H1>");
when ARM_Output.Clause =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
Clause_Number & " " & Header_Text & "</H1>");
end case;
when ARM_Contents.Clause | ARM_Contents.Subclause |
ARM_Contents.Subsubclause =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
Clause_Number & ' ' & Header_Text & "</H1>");
when ARM_Contents.Dead_Clause =>
raise Program_Error; -- No headers for dead clauses.
end case;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
-- No page breaks in HTML, so we don't need to look at No_Page_Break.
end Clause_Header;
procedure Revised_Clause_Header
(Output_Object : in out HTML_Output_Type;
New_Header_Text : in String;
Old_Header_Text : in String;
Level : in ARM_Contents.Level_Type;
Clause_Number : in String;
Version : in ARM_Contents.Change_Version_Type;
Old_Version : in ARM_Contents.Change_Version_Type;
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
No_Page_Break : in Boolean := False) is
-- Output a revised clause header. Both the original and new text will
-- be output. The level of the header is specified in Level. The Clause
-- Number is as specified; the top-level (and other) subdivision names
-- are as specified. These should appear in the table of contents.
-- For hyperlinked formats, this should generate a link target.
-- Version is the insertion version of the new text; Old_Version is
-- the insertion version of the old text.
-- If No_Page_Break is True, suppress any page breaks.
-- Raises Not_Valid_Error if in a paragraph.
function Header_Text return String is
begin
if Output_Object.HTML_Kind = HTML_3 then
if Old_Version = '0' then -- Old text is original text
return "<U>" & New_Header_Text & "</U><S>" & Old_Header_Text & "</S>";
else
return "<U>" & New_Header_Text & "</U><S><U>" & Old_Header_Text & "</U></S>";
end if;
elsif Old_Version = '0' then -- Old text is original text
Revision_Used(Version) := True;
return "<span class=""insert" & Version & """>" & New_Header_Text &
"</span><span class=""delete" & Version & """>" & Old_Header_Text & "</span>";
else
Revision_Used(Version) := True;
Revision_Used(Old_Version) := True;
return "<span class=""insert" & Version & """>" & New_Header_Text &
"</span><span class=""delete" & Version & """><span class=""insert" & Old_Version & """>" &
Old_Header_Text & "</span></span>";
end if;
end Header_Text;
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Header in paragraph");
end if;
if not Output_Object.Big_Files then
if Ada.Text_IO.Is_Open (Output_Object.Output_File) then
End_HTML_File (Output_Object);
end if;
Start_HTML_File (Output_Object,
Make_Clause_File_Name (Output_Object, Clause_Number),
New_Header_Text, Clause_Number);
else -- Big Files:
-- Insert an anchor:
Ada.Text_IO.Put (Output_Object.Output_File, "<A NAME=""");
Ada.Text_IO.Put (Output_Object.Output_File,
Make_Clause_Anchor_Name (Output_Object, Clause_Number));
Ada.Text_IO.Put_Line (Output_Object.Output_File, """></A>");
end if;
case Level is
when ARM_Contents.Plain_Annex =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number &
"<BR>"); -- Note: Clause_Number includes "Annex"
Ada.Text_IO.Put_Line (Output_Object.Output_File, Header_Text & "</H1>");
when ARM_Contents.Normative_Annex =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number & "</H1>");
-- Note: Clause_Number includes "Annex"
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H2>(normative)</H2>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Header_Text & "</H1>");
when ARM_Contents.Informative_Annex =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Clause_Number & "</H1>");
-- Note: Clause_Number includes "Annex"
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H2>(informative)</H2>");
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" & Header_Text & "</H1>");
when ARM_Contents.Unnumbered_Section =>
if Header_Text /= "" then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
Header_Text & "</H1>");
end if;
when ARM_Contents.Section =>
case Top_Level_Subdivision_Name is
when ARM_Output.Chapter =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Chapter " &
Clause_Number & ": " & Header_Text & "</H1>");
when ARM_Output.Section =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>Section " &
Clause_Number & ": " & Header_Text & "</H1>");
when ARM_Output.Clause =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
Clause_Number & " " & Header_Text & "</H1>");
end case;
when ARM_Contents.Clause | ARM_Contents.Subclause |
ARM_Contents.Subsubclause =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<H1>" &
Clause_Number & ' ' & Header_Text & "</H1>");
when ARM_Contents.Dead_Clause =>
raise Program_Error; -- No headers for dead clauses.
end case;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
-- No page breaks in HTML, so we don't need to look at No_Page_Break.
end Revised_Clause_Header;
procedure TOC_Marker (Output_Object : in out HTML_Output_Type;
For_Start : in Boolean) is
-- Mark the start (if For_Start is True) or end (if For_Start is
-- False) of the table of contents data. Output objects that
-- auto-generate the table of contents can use this to do needed
-- actions.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
null; -- We don't care about this.
end TOC_Marker;
procedure New_Page (Output_Object : in out HTML_Output_Type;
Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page) is
-- Output a page break.
-- Note that this has no effect on non-printing formats.
-- Any_Page breaks to the top of the next page (whatever it is);
-- Odd_Page_Only breaks to the top of the odd-numbered page;
-- Soft_Page allows a page break but does not force one (use in
-- "No_Breaks" paragraphs.)
-- Raises Not_Valid_Error if in a paragraph if Kind = Any_Page or
-- Odd_Page, and if not in a paragraph if Kind = Soft_Page.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
case Kind is
when ARM_Output.Any_Page | ARM_Output.Odd_Page_Only =>
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Page in paragraph");
end if;
-- No real page breaks supported.
--Ada.Text_IO.Put_Line (Output_Object.Output_File, "<P><BR><BR></P>");
--Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR>"); -- Horizontal line.
--Ada.Text_IO.Put_Line (Output_Object.Output_File, "<P><BR></P>");
-- This horizontal rule looks awful when inserted solely to
-- make PDF formats look good; and it doesn't make much sense
-- any other time, either. (Why would we want to start a page
-- with this?) So it's been removed completely; and we have no
-- other page breaks in HTML.
when ARM_Output.Soft_Page =>
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Soft page not in paragraph");
end if;
null; -- No page breaks in HTML.
end case;
end New_Page;
procedure Separator_Line (Output_Object : in out HTML_Output_Type;
Is_Thin : Boolean := True) is
-- Output a separator line. It is thin if "Is_Thin" is true.
-- Raises Not_Valid_Error if in a paragraph.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Separator in paragraph");
end if;
Ada.Text_IO.New_Line (Output_Object.Output_File);
if Is_Thin then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR SIZE=1>"); -- Horizontal line.
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<HR SIZE=2>"); -- Horizontal line.
end if;
Ada.Text_IO.New_Line (Output_Object.Output_File);
end Separator_Line;
procedure Start_Table (Output_Object : in out HTML_Output_Type;
Columns : in ARM_Output.Column_Count;
First_Column_Width : in ARM_Output.Column_Count;
Last_Column_Width : in ARM_Output.Column_Count;
Alignment : in ARM_Output.Column_Text_Alignment;
No_Page_Break : in Boolean;
Has_Border : in Boolean;
Small_Text_Size : in Boolean;
Header_Kind : in ARM_Output.Header_Kind_Type) is
-- Starts a table. The number of columns is Columns; the first
-- column has First_Column_Width times the normal column width, and
-- the last column has Last_Column_Width times the normal column width.
-- Alignment is the horizontal text alignment within the columns.
-- No_Page_Break should be True to keep the table intact on a single
-- page; False to allow it to be split across pages.
-- Has_Border should be true if a border is desired, false otherwise.
-- Small_Text_Size means that the contents will have the AARM size;
-- otherwise it will have the normal size.
-- Header_Kind determines whether the table has headers.
-- This command starts a paragraph; the entire table is a single
-- paragraph. Text will be considered part of the caption until the
-- next table marker call.
-- Raises Not_Valid_Error if in a paragraph.
use type ARM_Output.Header_Kind_Type;
use type ARM_Output.Column_Text_Alignment;
begin
-- No_Page_Break, First_Column_Width, and Last_Column_Width not used,
-- the latter two because column width is calculated based on the
-- contents.
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Table in paragraph");
end if;
if Output_Object.HTML_Kind /= HTML_3 then
Ada.Text_IO.Put (Output_Object.Output_File, "<div class=""" &
Paragraph_Name(ARM_Output.Normal, 1) & """>");
Paragraph_Used(ARM_Output.Normal, 1) := True;
end if;
if Has_Border then
Ada.Text_IO.Put (Output_Object.Output_File, "<TABLE frame=""border"" rules=""all"" border=""2"" cellpadding=""4"">");
else
Ada.Text_IO.Put (Output_Object.Output_File, "<TABLE frame=""void"" rules=""none"" border=""0"" cellpadding=""2"">");
end if;
if Header_Kind = ARM_Output.Both_Caption_and_Header then
Ada.Text_IO.Put (Output_Object.Output_File, "<CAPTION>");
Output_Object.Char_Count := 9;
Output_Object.In_Header := True;
elsif Header_Kind = ARM_Output.Header_Only then
if Alignment = ARM_Output.Center_All then
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TH align=""center"">");
Output_Object.Char_Count := 24;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TH align=""left"">");
Output_Object.Char_Count := 22;
end if;
Output_Object.In_Header := True;
else -- Header_Kind = ARM_Output.No_Headers then
if Alignment = ARM_Output.Center_All then
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""center"">");
Output_Object.Char_Count := 24;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
Output_Object.Char_Count := 22;
end if;
Output_Object.In_Header := False;
end if;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
Output_Object.Is_In_Paragraph := True;
Output_Object.Is_In_Table := True;
Output_Object.Table_Column_Alignment := Alignment;
Output_Object.Table_Has_Small_Text := Small_Text_Size;
if Output_Object.Table_Has_Small_Text then
if Output_Object.HTML_Kind = HTML_4_Only then
Ada.Text_IO.Put (Output_Object.Output_File, "<SPAN STYLE=""font-size: 80%"">");
Output_Object.Char_Count := Output_Object.Char_Count + 29;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=""-1"">");
Output_Object.Char_Count := Output_Object.Char_Count + 16;
end if;
end if;
end Start_Table;
procedure Table_Marker (Output_Object : in out HTML_Output_Type;
Marker : in ARM_Output.Table_Marker_Type) is
-- Marks the end of an entity in a table.
-- If Marker is End_Caption, the table caption ends and the
-- future text is part of the table header.
-- If Marker is End_Header, the table header ends and the
-- future text is part of the table body.
-- If Marker is End_Row, a row in the table is completed, and another
-- row started.
-- If Marker is End_Row_Next_Is_Last, a row in the table is completed,
-- and another row started. That row is the last row in the table.
-- If Marker is End_Item, an item in the table header or body is ended,
-- and another started.
-- If Marker is End_Table, the entire table is finished.
-- Raises Not_Valid_Error if not in a table.
use type ARM_Output.Column_Text_Alignment;
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if (not Output_Object.Is_In_Paragraph) or (not Output_Object.Is_In_Table) then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Table marker not in table");
end if;
-- Close the small fonts (we always need to do this):
if Output_Object.Table_Has_Small_Text then
if Output_Object.HTML_Kind = HTML_4_Only then
Ada.Text_IO.Put (Output_Object.Output_File, "</SPAN>");
Output_Object.Char_Count := Output_Object.Char_Count + 7;
else
Ada.Text_IO.Put (Output_Object.Output_File, "</FONT>");
Output_Object.Char_Count := Output_Object.Char_Count + 7;
end if;
end if;
case Marker is
when ARM_Output.End_Item =>
-- Note: This isn't the first item on a row.
if Output_Object.In_Header then
if Output_Object.Table_Column_Alignment = ARM_Output.Left_All then
Ada.Text_IO.Put (Output_Object.Output_File, "<TH align=""left"">");
Output_Object.Char_Count := Output_Object.Char_Count + 18;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<TH align=""center"">");
Output_Object.Char_Count := Output_Object.Char_Count + 20;
end if;
else
if Output_Object.Table_Column_Alignment = ARM_Output.Left_All then
Ada.Text_IO.Put (Output_Object.Output_File, "<TD align=""left"">");
Output_Object.Char_Count := Output_Object.Char_Count + 18;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<TD align=""center"">");
Output_Object.Char_Count := Output_Object.Char_Count + 20;
end if;
end if;
when ARM_Output.End_Caption =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</CAPTION>");
if Output_Object.Table_Column_Alignment = ARM_Output.Center_All then
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TH align=""center"">");
Output_Object.Char_Count := 24;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TH align=""left"">");
Output_Object.Char_Count := 22;
end if;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
when ARM_Output.End_Header =>
Ada.Text_IO.New_Line (Output_Object.Output_File);
if Output_Object.Table_Column_Alignment = ARM_Output.Center_All then
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""center"">");
Output_Object.Char_Count := 24;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
Output_Object.Char_Count := 22;
end if;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
Output_Object.In_Header := False;
when ARM_Output.End_Row | ARM_Output.End_Row_Next_Is_Last =>
Ada.Text_IO.New_Line (Output_Object.Output_File);
if Output_Object.Table_Column_Alignment = ARM_Output.Center_All then
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""center"">");
Output_Object.Char_Count := 24;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<TR><TD align=""left"">");
Output_Object.Char_Count := 22;
end if;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
when ARM_Output.End_Table =>
Ada.Text_IO.New_Line (Output_Object.Output_File);
if Output_Object.HTML_Kind /= HTML_3 then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</table></div>");
else
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</TABLE>");
end if;
Output_Object.Is_In_Paragraph := False;
Output_Object.Is_In_Table := False;
end case;
if Output_Object.Table_Has_Small_Text and then ARM_Output."/=" (Marker,
ARM_Output.End_Table) then
if Output_Object.HTML_Kind = HTML_4_Only then
Ada.Text_IO.Put (Output_Object.Output_File, "<SPAN STYLE=""font-size: 80%"">");
Output_Object.Char_Count := Output_Object.Char_Count + 29;
else
Ada.Text_IO.Put (Output_Object.Output_File, "<FONT SIZE=""-1"">");
Output_Object.Char_Count := Output_Object.Char_Count + 16;
end if;
end if;
end Table_Marker;
-- Text output: These are only allowed after a Start_Paragraph and
-- before any End_Paragraph. Raises Not_Valid_Error if not allowed.
Special_Set : constant Ada.Strings.Maps.Character_Set :=
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (Ada.Strings.Maps.Character_Range'(Low => Character'Val(127), High => Character'Val(255))),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('<'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('>'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('"'),
Ada.Strings.Maps.To_Set ('&')))));
No_Conditional_Set : constant Ada.Strings.Maps.Character_Set :=
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (' '),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('.'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (','),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (':'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (';'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('!'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('('),
Ada.Strings.Maps.To_Set (')'))))))));
Large_Char_Set : constant Ada.Strings.Maps.Character_Set :=
Ada.Strings.Maps."or" (Ada.Strings.Maps.Constants.Upper_Set,
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set (Ada.Strings.Maps.Character_Range'(Low => '0', High => '9')),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('m'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('w'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('<'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('>'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('&'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('%'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('@'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('$'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('*'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('+'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('='),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('?'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('/'),
Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('\'),
Ada.Strings.Maps.To_Set ('#')))))))))))))))));
procedure Output_Text (Output_Object : in out HTML_Output_Type;
Text : in String) is
-- Output the text to the current output place.
begin
if Output_Object.Column_Count >= 4 then
if (Output_Object.Column_Text(Output_Object.Current_Column) = null) or else
-- No items stored.
(Output_Object.Column_Text(Output_Object.Current_Column).Item /=
Output_Object.Current_Item) then
-- Start a new item.
Output_Object.Column_Text(Output_Object.Current_Column) :=
new Column_Text_Item_Type'(Text => (others => ' '),
Length => 0, Item => Output_Object.Current_Item,
End_Para => False, Next => Output_Object.Column_Text(Output_Object.Current_Column));
end if;
if Output_Object.Column_Text(Output_Object.Current_Column).Length +
Text'Length > Output_Object.Column_Text(Output_Object.Current_Column).Text'Length then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Column item full, but more text! - " &
Output_Object.Column_Text(Output_Object.Current_Column).Text(1..Output_Object.Column_Text(Output_Object.Current_Column).Length) & Text);
else
Output_Object.Column_Text(Output_Object.Current_Column).Text(
Output_Object.Column_Text(Output_Object.Current_Column).Length+1..
Output_Object.Column_Text(Output_Object.Current_Column).Length+Text'Length) :=
Text;
Output_Object.Column_Text(Output_Object.Current_Column).Length :=
Output_Object.Column_Text(Output_Object.Current_Column).Length + Text'Length;
end if;
else -- Normal, use Text_IO.
Ada.Text_IO.Put (Output_Object.Output_File, Text);
Output_Object.Char_Count := Output_Object.Char_Count + Text'Length;
end if;
end Output_Text;
procedure Ordinary_Text (Output_Object : in out HTML_Output_Type;
Text : in String) is
-- Output ordinary text.
-- The text must end at a word break, never in the middle of a word.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Text'Length = 0 then
return; -- Nothing to do.
end if;
if Ada.Strings.Fixed.Count (Text, Special_Set) = 0 then
if Output_Object.Char_Count + Text'Length >= LINE_LENGTH - 10 then
-- We can only break on a space.
for I in Text'range loop
Ordinary_Character (Output_Object, Text(I));
end loop;
else
if Output_Object.Conditional_Space then
Output_Object.Conditional_Space := False;
if Ada.Strings.Maps.Is_In (Text(Text'First), No_Conditional_Set) then
null; -- Don't need the conditional space.
else
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
end if;
Output_Text (Output_Object, Text);
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + Text'Length;
Output_Object.Disp_Large_Char_Count :=
Output_Object.Disp_Large_Char_Count +
Ada.Strings.Fixed.Count (Text, Large_Char_Set);
Output_Object.Any_Nonspace := True;
Output_Object.Last_was_Space := Text(Text'Last) = ' ';
end if;
else
for I in Text'range loop
Ordinary_Character (Output_Object, Text(I));
end loop;
end if;
end Ordinary_Text;
procedure Ordinary_Character (Output_Object : in out HTML_Output_Type;
Char : in Character) is
-- Output an ordinary character.
-- Spaces will be used to break lines as needed.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.Conditional_Space then
Output_Object.Conditional_Space := False;
if Ada.Strings.Maps.Is_In (Char, No_Conditional_Set) then
null; -- Don't need the conditional space.
else
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
end if;
Output_Object.Last_was_Space := False;
if Char = ' ' then
if Output_Object.Char_Count >= LINE_LENGTH - 10 and then
Output_Object.Column_Count < 4 then
if Output_Object.HTML_Kind > HTML_3 then
-- Note: We leave the space here so that later code can tell
-- the difference between a line broken on a space, and a
-- line broken for because it's convinient.
Ada.Text_IO.Put_Line (Output_Object.Output_File, " ");
else -- No later code.
Ada.Text_IO.New_Line (Output_Object.Output_File);
end if;
Output_Object.Char_Count := 0;
Output_Object.Last_was_Space := True;
else
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
-- Output_Object.Any_Nonspace := <unchanged>;
Output_Object.Last_was_Space := True;
elsif Char = '<' then
Output_Text (Output_Object, "<");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
Output_Object.Any_Nonspace := True;
elsif Char = '>' then
Output_Text (Output_Object, ">");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
Output_Object.Any_Nonspace := True;
elsif Char = '"' then
Output_Text (Output_Object, """);
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
-- No change in Disp_Large_Char_Count.
Output_Object.Any_Nonspace := True;
elsif Char = '&' then
Output_Text (Output_Object, "&");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
Output_Object.Any_Nonspace := True;
elsif Char >= Character'Val(126) then -- All higher Latin-1 characters.
case Character'Pos(Char) is
when 160 =>
Output_Text (Output_Object, " ");
when 161 =>
Output_Text (Output_Object, "¡");
when 162 =>
Output_Text (Output_Object, "¢");
when 163 =>
Output_Text (Output_Object, "£");
when 164 =>
Output_Text (Output_Object, "¤");
when 165 =>
Output_Text (Output_Object, "¥");
when 166 =>
Output_Text (Output_Object, "¦");
when 167 =>
Output_Text (Output_Object, "§");
when 168 =>
Output_Text (Output_Object, "¨");
when 169 =>
Output_Text (Output_Object, "©");
when 170 =>
Output_Text (Output_Object, "ª");
when 171 =>
Output_Text (Output_Object, "«");
when 172 =>
Output_Text (Output_Object, "¬");
when 173 =>
Output_Text (Output_Object, "­");
when 174 =>
Output_Text (Output_Object, "®");
when 175 =>
Output_Text (Output_Object, "¯");
when 176 =>
Output_Text (Output_Object, "°");
when 177 =>
Output_Text (Output_Object, "±");
when 178 =>
Output_Text (Output_Object, "²");
when 179 =>
Output_Text (Output_Object, "³");
when 180 =>
Output_Text (Output_Object, "´");
when 181 =>
Output_Text (Output_Object, "µ");
when 182 =>
Output_Text (Output_Object, "¶");
when 183 =>
Output_Text (Output_Object, "·");
when 184 =>
Output_Text (Output_Object, "¸");
when 185 =>
Output_Text (Output_Object, "¹");
when 186 =>
Output_Text (Output_Object, "º");
when 187 =>
Output_Text (Output_Object, "»");
when 188 =>
Output_Text (Output_Object, "¼");
when 189 =>
Output_Text (Output_Object, "½");
when 190 =>
Output_Text (Output_Object, "¾");
when 191 =>
Output_Text (Output_Object, "¿");
when 192 =>
Output_Text (Output_Object, "À");
when 193 =>
Output_Text (Output_Object, "Á");
when 194 =>
Output_Text (Output_Object, "Â");
when 195 =>
Output_Text (Output_Object, "Ã");
when 196 =>
Output_Text (Output_Object, "Ä");
when 197 =>
Output_Text (Output_Object, "Å");
when 198 =>
Output_Text (Output_Object, "Æ");
when 199 =>
Output_Text (Output_Object, "Ç");
when 200 =>
Output_Text (Output_Object, "È");
when 201 =>
Output_Text (Output_Object, "É");
when 202 =>
Output_Text (Output_Object, "Ê");
when 203 =>
Output_Text (Output_Object, "Ë");
when 204 =>
Output_Text (Output_Object, "Ì");
when 205 =>
Output_Text (Output_Object, "Í");
when 206 =>
Output_Text (Output_Object, "Î");
when 207 =>
Output_Text (Output_Object, "Ï");
when 208 =>
Output_Text (Output_Object, "Ð");
when 209 =>
Output_Text (Output_Object, "Ñ");
when 210 =>
Output_Text (Output_Object, "Ò");
when 211 =>
Output_Text (Output_Object, "Ó");
when 212 =>
Output_Text (Output_Object, "Ô");
when 213 =>
Output_Text (Output_Object, "Õ");
when 214 =>
Output_Text (Output_Object, "Ö");
when 215 =>
Output_Text (Output_Object, "×");
when 216 =>
Output_Text (Output_Object, "Ø");
when 217 =>
Output_Text (Output_Object, "Ù");
when 218 =>
Output_Text (Output_Object, "Ú");
when 219 =>
Output_Text (Output_Object, "Û");
when 220 =>
Output_Text (Output_Object, "Ü");
when 221 =>
Output_Text (Output_Object, "Ý");
when 222 =>
Output_Text (Output_Object, "Þ");
when 223 =>
Output_Text (Output_Object, "ß");
when 224 =>
Output_Text (Output_Object, "à");
when 225 =>
Output_Text (Output_Object, "á");
when 226 =>
Output_Text (Output_Object, "â");
when 227 =>
Output_Text (Output_Object, "ã");
when 228 =>
Output_Text (Output_Object, "ä");
when 229 =>
Output_Text (Output_Object, "å");
when 230 =>
Output_Text (Output_Object, "æ");
when 231 =>
Output_Text (Output_Object, "ç");
when 232 =>
Output_Text (Output_Object, "è");
when 233 =>
Output_Text (Output_Object, "é");
when 234 =>
Output_Text (Output_Object, "ê");
when 235 =>
Output_Text (Output_Object, "ë");
when 236 =>
Output_Text (Output_Object, "ì");
when 237 =>
Output_Text (Output_Object, "í");
when 238 =>
Output_Text (Output_Object, "î");
when 239 =>
Output_Text (Output_Object, "ï");
when 240 =>
Output_Text (Output_Object, "ð");
when 241 =>
Output_Text (Output_Object, "ñ");
when 242 =>
Output_Text (Output_Object, "ò");
when 243 =>
Output_Text (Output_Object, "ó");
when 244 =>
Output_Text (Output_Object, "ô");
when 245 =>
Output_Text (Output_Object, "õ");
when 246 =>
Output_Text (Output_Object, "ö");
when 247 =>
Output_Text (Output_Object, "÷");
when 248 =>
Output_Text (Output_Object, "ø");
when 249 =>
Output_Text (Output_Object, "ù");
when 250 =>
Output_Text (Output_Object, "ú");
when 251 =>
Output_Text (Output_Object, "û");
when 252 =>
Output_Text (Output_Object, "ü");
when 253 =>
Output_Text (Output_Object, "ý");
when 254 =>
Output_Text (Output_Object, "þ");
when 255 =>
Output_Text (Output_Object, "ÿ");
when others =>
declare
Code : constant String :=
Natural'Image(Character'Pos(Char));
begin
Output_Text (Output_Object, "&#" & Code(2..4) & ';');
end;
end case;
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
if Ada.Strings.Maps.Is_In (Char, Large_Char_Set) then
Output_Object.Disp_Large_Char_Count :=
Output_Object.Disp_Large_Char_Count + 1;
-- else not a large character.
end if;
Output_Object.Any_Nonspace := True;
else
Output_Text (Output_Object, Char & "");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
if Ada.Strings.Maps.Is_In (Char, Large_Char_Set) then
Output_Object.Disp_Large_Char_Count :=
Output_Object.Disp_Large_Char_Count + 1;
-- else not a large character.
end if;
Output_Object.Any_Nonspace := True;
end if;
end Ordinary_Character;
procedure Hard_Space (Output_Object : in out HTML_Output_Type) is
-- Output a hard space. No line break should happen at a hard space.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
-- Output_Object.Any_Nonspace := <unchanged>;
Output_Object.Last_was_Space := True;
Output_Object.Conditional_Space := False; -- Never need a conditional space here.
end Hard_Space;
procedure Line_Break (Output_Object : in out HTML_Output_Type) is
-- Output a line break. This does not start a new paragraph.
-- This corresponds to a "<BR>" in HTML.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.Column_Count >= 4 then
-- Output is deferred; mark the end of an item.
if Output_Object.Column_Text (Output_Object.Current_Column) /= null and then
Output_Object.Column_Text (Output_Object.Current_Column).Item = Output_Object.Current_Item then
Output_Object.Column_Text (Output_Object.Current_Column).End_Para := False;
end if;
Output_Object.Current_Item := Output_Object.Current_Item + 1;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
else -- Normal.
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<BR>");
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
end if;
end Line_Break;
procedure Index_Line_Break (Output_Object : in out HTML_Output_Type;
Clear_Keep_with_Next : in Boolean) is
-- Output a line break for the index. This does not start a new
-- paragraph in terms of spacing. This corresponds to a "<BR>"
-- in HTML. If Clear_Keep_with_Next is true, insure that the next
-- line does not require the following line to stay with it.
-- Raises Not_Valid_Error if the paragraph is not in the index format.
begin
if ARM_Output."/=" (Output_Object.Paragraph_Style, ARM_Output.Index) then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not index format");
end if;
Line_Break (Output_Object);
end Index_Line_Break;
procedure Soft_Line_Break (Output_Object : in out HTML_Output_Type) is
-- Output a soft line break. This is a place (in the middle of a
-- "word") that we allow a line break. It is usually used after
-- underscores in long non-terminals.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.HTML_Kind > HTML_3 and then Output_Object.Use_Unicode then
Output_Text (Output_Object, "​");
-- else no Soft break in HTML 3.2.
end if;
end Soft_Line_Break;
procedure Soft_Hyphen_Break (Output_Object : in out HTML_Output_Type) is
-- Output a soft line break, with a hyphen. This is a place (in the middle of
-- a "word") that we allow a line break. If the line break is used,
-- a hyphen will be added to the text.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
null; -- Soft hyphens exist, but don't work on either Internet Exploder 4
-- or Netcrash 3. That is, they are always displayed. (They should
-- only be displayed at the location of a line break).
--Output_Text (Output_Object, "­"); -- A Latin-1 char.
end Soft_Hyphen_Break;
procedure Tab (Output_Object : in out HTML_Output_Type) is
-- Output a tab, inserting space up to the next tab stop.
-- Raises Not_Valid_Error if the paragraph was created with
-- Tab_Stops = ARM_Output.NO_TABS.
begin
-- HTML does not have tabs. Emulation is not successful on proportional
-- fonts, so we let the user select how to do it.
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if ARM_Output."="(Output_Object.Tab_Stops, ARM_Output.NO_TABS) then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Tab, but none set");
end if;
Output_Object.Conditional_Space := False; -- Never need a conditional space here.
Output_Object.Last_was_Space := True; -- Treat this as a space.
if Output_Object.Tab_Emulation = Single_Space then
-- Don't emulate these, just use a single space.
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
elsif Output_Object.Tab_Emulation = Quad_Space then
-- Don't emulate these, just use a single space.
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 4;
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
elsif Output_Object.Tab_Emulation = Emulate_Fixed_Only or else
Output_Object.Tab_Emulation = Emulate_Fixed_Only_Quad then
if Output_Object.Can_Emulate_Tabs or else
(not Output_Object.Any_Nonspace) then -- Always can emulate if they're first on a line.
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
for I in 1 .. Output_Object.Tab_Stops.Number loop
if Output_Object.Tab_Stops.Stops(I).Stop >= Output_Object.Disp_Char_Count then
for J in Output_Object.Disp_Char_Count+1 .. Output_Object.Tab_Stops.Stops(I).Stop loop
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
end loop;
exit;
end if;
end loop; -- If we drop out without finding a tab, we just use the single
-- space already written.
elsif Output_Object.Tab_Emulation = Emulate_Fixed_Only then
-- Put in a space.
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
if ARM_Output."=" (Output_Object.Paragraph_Style, ARM_Output.Syntax_Summary) and then
Output_Object.Column_Count > 1 then
-- Special case (hack!) to make Syntax cross-reference look better:
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
end if;
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
elsif Output_Object.Tab_Emulation = Emulate_Fixed_Only_Quad then
-- Put in four hard spaces.
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 4;
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
else -- Emulate all.
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
for I in 1 .. Output_Object.Tab_Stops.Number loop
if Output_Object.Tab_Stops.Stops(I).Stop >= Output_Object.Disp_Char_Count then
for J in Output_Object.Disp_Char_Count+1 .. Output_Object.Tab_Stops.Stops(I).Stop loop
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
end loop;
exit;
end if;
end loop; -- If we drop out without finding a tab, we just use the
-- single space already written.
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
end Tab;
procedure Special_Character (Output_Object : in out HTML_Output_Type;
Char : in ARM_Output.Special_Character_Type) is
-- Output an special character.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.Conditional_Space then
Output_Object.Conditional_Space := False;
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
-- Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
case Char is
when ARM_Output.EM_Dash =>
if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
Output_Text (Output_Object, "—");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, "--");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
end if;
when ARM_Output.EN_Dash =>
if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
Output_Text (Output_Object, "–");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, "-");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
when ARM_Output.GEQ =>
if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
Output_Text (Output_Object, "≥");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, ">=");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
end if;
when ARM_Output.LEQ =>
if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
Output_Text (Output_Object, "≤");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, "<=");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
end if;
when ARM_Output.NEQ =>
if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
Output_Text (Output_Object, "≠");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, "/=");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
end if;
when ARM_Output.PI =>
if Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode then
Output_Text (Output_Object, "π");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, "PI");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 2;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 2;
end if;
when ARM_Output.Left_Ceiling =>
if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
-- This character doesn't display on US Windows 2000/XP.
Output_Text (Output_Object, "⌈");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, "<I>Ceiling</I>(");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 8;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
end if;
when ARM_Output.Right_Ceiling =>
if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
-- This character doesn't display on US Windows 2000/XP.
Output_Text (Output_Object, "⌉");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, ")");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
when ARM_Output.Left_Floor =>
if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
-- This character doesn't display on US Windows 2000/XP.
Output_Text (Output_Object, "⌊");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, "<I>Floor</I>(");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 6;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
end if;
when ARM_Output.Right_Floor =>
if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
-- This character doesn't display on US Windows 2000/XP.
Output_Text (Output_Object, "⌋");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
else
Output_Text (Output_Object, ")");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
when ARM_Output.Thin_Space =>
if FALSE and (Output_Object.HTML_Kind > HTML_3 and Output_Object.Use_Unicode) then
-- This character doesn't display on US Windows 2000/XP.
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
else
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
end if;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
when ARM_Output.Left_Quote =>
if Output_Object.HTML_Kind > HTML_3 then
Output_Text (Output_Object, "‘");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
else
Output_Text (Output_Object, "`");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
end if;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
when ARM_Output.Right_Quote =>
if Output_Object.HTML_Kind > HTML_3 then
Output_Text (Output_Object, "’");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
else
Output_Text (Output_Object, "'");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
end if;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
when ARM_Output.Left_Double_Quote =>
if Output_Object.HTML_Kind > HTML_3 then
Output_Text (Output_Object, "“");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
else
Output_Text (Output_Object, """");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
end if;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
when ARM_Output.Right_Double_Quote =>
if Output_Object.HTML_Kind > HTML_3 then
Output_Text (Output_Object, "”");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
else
Output_Text (Output_Object, """");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
end if;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
when ARM_Output.Small_Dotless_I =>
if Output_Object.HTML_Kind > HTML_3 then --and Output_Object.Use_Unicode then -- We'll use it if it might be supported.
Output_Text (Output_Object, "ı");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
else
Output_Text (Output_Object, "i");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
end if;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
when ARM_Output.Capital_Dotted_I =>
if Output_Object.HTML_Kind > HTML_3 then --and Output_Object.Use_Unicode then -- We'll use it if it might be supported.
Output_Text (Output_Object, "İ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
else
Output_Text (Output_Object, "I");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
end if;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1;
end case;
Output_Object.Any_Nonspace := True;
Output_Object.Last_was_Space := False;
end Special_Character;
procedure Unicode_Character (Output_Object : in out HTML_Output_Type;
Char : in ARM_Output.Unicode_Type) is
-- Output a Unicode character, with code position Char.
Char_Code : constant String := ARM_Output.Unicode_Type'Image(Char);
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.HTML_Kind = HTML_3 then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Unicode not available for HTML 3");
end if;
if Output_Object.Conditional_Space then
Output_Object.Conditional_Space := False;
Output_Text (Output_Object, " ");
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
--Output_Object.Disp_Large_Char_Count := <unchanged>;
end if;
-- We don't check if this is valid, we just use it. So be sparing!
Output_Text (Output_Object, "&#" & Char_Code(2..Char_Code'Length) & ';');
Output_Object.Disp_Char_Count := Output_Object.Disp_Char_Count + 1;
Output_Object.Disp_Large_Char_Count := Output_Object.Disp_Large_Char_Count + 1; -- Assume it is large.
Output_Object.Any_Nonspace := True;
Output_Object.Last_was_Space := False;
end Unicode_Character;
procedure End_Hang_Item (Output_Object : in out HTML_Output_Type) is
-- Marks the end of a hanging item. Call only once per paragraph.
-- Raises Not_Valid_Error if the paragraph style is not in
-- Text_Prefixed_Style_Subtype, or if this has already been
-- called for the current paragraph, or if the paragraph was started
-- with No_Prefix = True.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.Paragraph_Style not in
ARM_Output.Text_Prefixed_Style_Subtype then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not a hanging paragraph - " & ARM_Output.Paragraph_Style_Type'Image(Output_Object.Paragraph_Style));
end if;
if Output_Object.Saw_Hang_End then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Already saw the end of the hanging part");
end if;
Output_Object.Saw_Hang_End := True;
if Output_Object.HTML_Kind = HTML_3 then
case Output_Object.Paragraph_Style is
-- Part of a definition list.
when ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
ARM_Output.Small_Hanging_in_Bulleted |
ARM_Output.Small_Enumerated =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "</FONT><DD><FONT SIZE=-1>");
when others =>
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<DD>");
end case;
elsif Output_Object.HTML_Kind = HTML_4_Only then
declare
Saved_Format : ARM_Output.Format_Type;
begin
-- Save original format:
Saved_Format :=
(Bold => Output_Object.Is_Bold,
Italic => Output_Object.Is_Italic,
Font => Output_Object.Font,
Size => Output_Object.Size,
Color => Output_Object.Color,
Change => Output_Object.Change,
Version => Output_Object.Version,
Added_Version => Output_Object.Added_Version,
Location => Output_Object.Location);
-- Close any open formatting (can't leave it open across a DIV):
Text_Format (Output_Object,
Format => (Bold => False,
Italic => False,
Font => ARM_Output.Default,
Size => 0,
Color => ARM_Output.Default,
Change => ARM_Output.None,
Version => '0',
Added_Version => '0',
Location => ARM_Output.Normal));
-- This has to be a hanging style, so we ignore other cases:
Ada.Text_IO.Put (Output_Object.Output_File, "</div><div class=""" &
Paragraph_Name (Output_Object.Paragraph_Style, Output_Object.Paragraph_Indent) & "-Body"">");
-- If the prefix is too long, add a <BR>. A "unit" is 2.0 ems;
-- a large character is 0.65 ems; and a small character is 0.4 ems.
-- That should be quite conservative.
--Ada.Text_IO.Put_Line("Break hang check: large chars=" & Natural'Image(Output_Object.Disp_Large_Char_Count) &
--" small chars=" & Natural'Image(Output_Object.Disp_Char_Count - Output_Object.Disp_Large_Char_Count) &
--" Hang_Outdent=" & Natural'Image(Paragraph_Info(Output_Object.Paragraph_Format).Hang_Outdent));
if (Output_Object.Disp_Large_Char_Count*13) +
((Output_Object.Disp_Char_Count-Output_Object.Disp_Large_Char_Count)*8) >
Paragraph_Info(Output_Object.Paragraph_Style, Output_Object.Paragraph_Indent).Hang_Outdent*40 then
Ada.Text_IO.Put_Line (Output_Object.Output_File, "<br clear=""left"">");
-- We use "clear=left" so that the next line always
-- starts at the left margin. This shouldn't be necessary,
-- but I've seen cases where it was.
else
Ada.Text_IO.New_Line (Output_Object.Output_File);
end if;
-- Reopen any formatting (using the previously saved values):
Text_Format (Output_Object, Format => Saved_Format);
end;
else -- HTML 4 Compatibility
-- We have to close and reopen the font info here, so that we
-- properly nest these operations to pass the WC3 validator.
Put_End_Compatibility_Font_Info (Output_Object,
Output_Object.Paragraph_Style,
Output_Object.Paragraph_Indent);
-- This has to be a hanging style, so we ignore other cases:
Ada.Text_IO.Put (Output_Object.Output_File, "<dd class=""" &
Paragraph_Name (Output_Object.Paragraph_Style, Output_Object.Paragraph_Indent) & """>");
Put_Compatibility_Font_Info (Output_Object,
Output_Object.Paragraph_Style,
Output_Object.Paragraph_Indent);
end if;
Paragraph_Used(Output_Object.Paragraph_Style, Output_Object.Paragraph_Indent) := True;
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
end End_Hang_Item;
procedure New_Column (Output_Object : in out HTML_Output_Type) is
-- Output a column break.
-- Raises Not_Valid_Error if in a paragraph, or if the number of
-- columns is 1.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"New Column in paragraph");
end if;
if Output_Object.Column_Count <= 1 then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in a multi-column area");
end if;
if Output_Object.Column_Count >= 4 then
Output_Object.Current_Column := Output_Object.Current_Column + 1;
Output_Object.Current_Item := 1;
-- else ignore it, no columns will be used.
end if;
end New_Column;
procedure Text_Format (Output_Object : in out HTML_Output_Type;
Format : in ARM_Output.Format_Type) is
-- Change the text format so that all of the properties are as specified.
-- Note: Changes to these properties ought be stack-like; that is,
-- Bold on, Italic on, Italic off, Bold off is OK; Bold on, Italic on,
-- Bold off, Italic off should be avoided (as separate commands).
use type ARM_Output.Change_Type;
use type ARM_Output.Location_Type;
use type ARM_Output.Size_Type;
use type ARM_Output.Color_Type;
function Change_Needs_Close_or_Open return Boolean is
-- Returns True if "Change" needs to open or close something, based
-- on the current values of Output_Object.
begin
return (Format.Change /= Output_Object.Change or else
Format.Version /= Output_Object.Version or else
Format.Added_Version /= Output_Object.Added_Version);
end Change_Needs_Close_or_Open;
function Font_Needs_Close_or_Open return Boolean is
-- Returns True if "Font" needs to close something, based
-- on the current values of Output_Object and the new value.
-- Note that this depends on whether the Change needs to open
-- or close something; if it does, we need to close and reopen
-- the font even if it is not changing.
begin
return (ARM_Output."/=" (Format.Font, Output_Object.Font) or else
Change_Needs_Close_or_Open);
end Font_Needs_Close_or_Open;
function Location_Needs_Close_or_Open return Boolean is
-- Returns True if "Location" needs to close something, based
-- on the current values of Output_Object and the new value.
-- Note that this depends on whether the Change or Font needs
-- to open or close something; if they do, we need to close and
-- reopen the location even if it is not changing.
begin
return Format.Location /= Output_Object.Location or else
Change_Needs_Close_or_Open or else Font_Needs_Close_or_Open;
end Location_Needs_Close_or_Open;
function Color_Needs_Close_or_Open return Boolean is
-- Returns True if "Color" needs to close something, based
-- on the current values of Output_Object, and the new value.
-- Note that this depends on whether the Change, Font,
-- or Location needs to open or close something; if they do,
-- we need to close the size even if it is not changing.
begin
return (Format.Color /= Output_Object.Color or else
Change_Needs_Close_or_Open or else Font_Needs_Close_or_Open or else
Location_Needs_Close_or_Open);
end Color_Needs_Close_or_Open;
function Size_Needs_Close_or_Open return Boolean is
-- Returns True if "Size" needs to close something, based
-- on the current values of Output_Object, and the new value.
-- Note that this depends on whether the Change, Color, Font,
-- or Location needs to open or close something; if they do,
-- we need to close the size even if it is not changing.
begin
return (Format.Size /= Output_Object.Size or else
Change_Needs_Close_or_Open or else Font_Needs_Close_or_Open or else
Location_Needs_Close_or_Open or else Color_Needs_Close_or_Open);
end Size_Needs_Close_or_Open;
function Italic_Needs_Close_or_Open return Boolean is
-- Returns True if "Italic" needs to close something, based
-- on the current values of Output_Object, and the new value.
-- Note that this depends on whether the Change, Font, Color,
-- Location, or Size needs to open or close something; if they do,
-- we need to close the italics even if it is not changing.
begin
return (Format.Italic /= Output_Object.Is_Italic or else
Change_Needs_Close_or_Open or else Font_Needs_Close_or_Open or else
Location_Needs_Close_or_Open or else Size_Needs_Close_or_Open or else
Color_Needs_Close_or_Open);
end Italic_Needs_Close_or_Open;
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
-- We do these in this order so that the changes are stacked properly.
-- Note that we have to open and close stuff that is not changing
-- in order to get proper nesting in all cases.
if Output_Object.Is_Bold and then
((not Format.Bold) or else
Italic_Needs_Close_or_Open) then
-- The latter so that nesting is preserved; we'll reopen
-- the boldfacing on the other side if needed. Otherwise, when
-- Bold remains on, we'd leave the markup open but close some outer
-- item. That's wrong (even though many browsers can handle it).
Output_Text (Output_Object, "</B>");
Output_Object.Is_Bold := False;
end if;
if Output_Object.Is_Italic and then
((not Format.Italic) or else
Size_Needs_Close_or_Open) then
-- The latter so that nesting is preserved; we'll reopen
-- the italics on the other side in that case.
Output_Text (Output_Object, "</I>");
Output_Object.Is_Italic := False;
end if;
if Format.Size /= Output_Object.Size or else
Color_Needs_Close_or_Open then
-- The latter so that nesting is preserved; we'll reopen
-- the size on the other side in that case.
if Output_Object.Size /= 0 then
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</SPAN>");
else
Output_Text (Output_Object, "</FONT>");
end if;
Output_Object.Size := 0; -- That's the size now.
end if;
end if;
if Format.Color /= Output_Object.Color or else
Location_Needs_Close_or_Open then
-- The latter so that nesting is preserved; we'll reopen
-- the size on the other side in that case.
if Output_Object.Color /= ARM_Output.Default then
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</SPAN>");
else
Output_Text (Output_Object, "</FONT>");
end if;
Output_Object.Color := ARM_Output.Default; -- That's the color now.
end if;
end if;
if Format.Location /= Output_Object.Location or else
Change_Needs_Close_or_Open then
-- The latter so that nesting is preserved; we'll reopen
-- the location on the other side in that case.
case Output_Object.Location is
when ARM_Output.Superscript =>
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</SPAN></SUP>");
else
Output_Text (Output_Object, "</FONT></SUP>");
end if;
when ARM_Output.Subscript =>
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</SPAN></SUB>");
else
Output_Text (Output_Object, "</FONT></SUB>");
end if;
when ARM_Output.Normal =>
null;
end case;
Output_Object.Location := ARM_Output.Normal; -- That's the location now.
end if;
if ARM_Output."/=" (Format.Font, Output_Object.Font) or else
Change_Needs_Close_or_Open then
-- The latter so that nesting is preserved; we'll reopen
-- the font on the other side in that case.
case Output_Object.Font is
when ARM_Output.Default => null;
when ARM_Output.Fixed =>
Output_Text (Output_Object, "</TT>");
when ARM_Output.Roman =>
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</SPAN>");
else
null; -- Default, currently.
--Output_Text (Output_Object, "</FONT>");
end if;
when ARM_Output.Swiss =>
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</SPAN>");
else
Output_Text (Output_Object, "</FONT>");
end if;
end case;
Output_Object.Font := ARM_Output.Default; -- We're now in the default state.
end if;
if Format.Change /= Output_Object.Change or else
Format.Version /= Output_Object.Version or else
Format.Added_Version /= Output_Object.Added_Version then
case Output_Object.Change is
when ARM_Output.Insertion =>
if Output_Object.HTML_Kind = HTML_3 then
Output_Text (Output_Object, "</U>");
else
--Output_Text (Output_Object, "</ins>");
Output_Text (Output_Object, "</span>");
end if;
-- Note: We need to follow these with a space so that
-- we don't get words running together for indexing
-- purposes (Google, Ada Indexer). That's only a concern
-- for deletions directly following insertions (at least in
-- the absence of nesting), so we only add the extra space
-- after insertions. RTF needs insertions and deletions
-- without spaces to work properly, thus the source does not
-- have them.
-- If the last character of the displayed text is a space,
-- we don't need this, and don't generate it. We do
-- generate it for punctuation, as we want a space following
-- that in general.
-- If the next visible character is not in some sort of
-- change section, we'd prefer to not generate
-- the space, but there is no obvious way to determine that
-- (we don't know when the command ends here).
-- We can, however, generate a conditional space that is
-- not generated if the next visible character is a space
-- or punctuation (we don't usually want a space *before*
-- punctuation).
if Output_Object.Last_was_Space then
null;
else
Output_Object.Conditional_Space := True;
end if;
when ARM_Output.Deletion =>
if Output_Object.HTML_Kind = HTML_3 then
Output_Text (Output_Object, "</S>");
else
--Output_Text (Output_Object, "</del>");
Output_Text (Output_Object, "</span>");
end if;
when ARM_Output.Both =>
if Output_Object.HTML_Kind = HTML_3 then
Output_Text (Output_Object, "</S></U>");
else
--Output_Text (Output_Object, "</del></ins>");
--Output_Text (Output_Object, "</span>");
-- CSS2 doesn't allow multiple decorations in a single definition, so we have
-- to nest them. But that might not be right, either (it works on IE).
Output_Text (Output_Object, "</span></span>");
end if;
if Output_Object.Last_was_Space then -- See above for reasons for this.
null;
else
Output_Object.Conditional_Space := True;
end if;
when ARM_Output.None =>
null;
end case;
case Format.Change is
when ARM_Output.Insertion =>
if Output_Object.HTML_Kind = HTML_3 then
Output_Text (Output_Object, "<U>");
else
--Output_Text (Output_Object, "<ins>");
Output_Text (Output_Object, "<span class=""insert" & Format.Version & """>");
Revision_Used(Format.Version) := True;
end if;
when ARM_Output.Deletion =>
if Output_Object.HTML_Kind = HTML_3 then
Output_Text (Output_Object, "<S>");
else
--Output_Text (Output_Object, "<del>");
Output_Text (Output_Object, "<span class=""delete" & Format.Version & """>");
Revision_Used(Format.Version) := True;
end if;
when ARM_Output.Both =>
if Output_Object.HTML_Kind = HTML_3 then
Output_Text (Output_Object, "<U><S>");
else
--Output_Text (Output_Object, "<ins><del>");
--Output_Text (Output_Object, "<span class=""both" & Format.Version & """>");
-- CSS2 doesn't allow multiple decorations in a single definition, so we have
-- to nest them. But that might not be right, either (it works on IE).
Output_Text (Output_Object, "<span class=""insert" & Format.Added_Version & """>");
Output_Text (Output_Object, "<span class=""delete" & Format.Version & """>");
Revision_Used(Format.Added_Version) := True;
Revision_Used(Format.Version) := True;
end if;
when ARM_Output.None =>
null;
end case;
Output_Object.Change := Format.Change;
Output_Object.Version := Format.Version;
Output_Object.Added_Version := Format.Added_Version;
end if;
if ARM_Output."/=" (Format.Font, Output_Object.Font) then
case Format.Font is
when ARM_Output.Default => null;
when ARM_Output.Fixed =>
Output_Text (Output_Object, "<TT>");
when ARM_Output.Roman =>
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "<SPAN Class=""roman"">");
else
null; -- Default, currently.
--Output_Text (Output_Object, "<FONT xxx>");
end if;
when ARM_Output.Swiss =>
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "<SPAN Class=""swiss"">");
else
Output_Text (Output_Object, SWISS_FONT_CODE);
end if;
end case;
Output_Object.Font := Format.Font;
end if;
if Format.Location /= Output_Object.Location then
-- Note: Location needs to be changed before size, as they
-- typically are changed together, and <SUP> and <SUB> reset the
-- size.
case Format.Location is
when ARM_Output.Superscript =>
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "<SUP><SPAN STYLE=""font-size: 140%"">");
-- This is a bit larger than +1; the text is usually too small.
else
Output_Text (Output_Object, "<SUP><FONT SIZE=""+1"">");
end if;
when ARM_Output.Subscript =>
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "<SUB><SPAN STYLE=""font-size: 140%"">");
-- This is a bit larger than +1; the text is usually too small.
else
Output_Text (Output_Object, "<SUB><FONT SIZE=""+1"">");
end if;
when ARM_Output.Normal =>
null;
end case;
Output_Object.Location := Format.Location;
end if;
if Format.Color /= Output_Object.Color then
if Output_Object.HTML_Kind = HTML_4_Only then
case Format.Color is
when ARM_Output.Default => null;
when ARM_Output.Black =>
Output_Text (Output_Object, "<SPAN STYLE=""color: rgb(0,0,0)"">");
when ARM_Output.Red =>
Output_Text (Output_Object, "<SPAN STYLE=""color: rgb(153,0,0)"">");
when ARM_Output.Green =>
Output_Text (Output_Object, "<SPAN STYLE=""color: rgb(0,153,0)"">");
when ARM_Output.Blue =>
Output_Text (Output_Object, "<SPAN STYLE=""color: rgb(0,0,153)"">");
end case;
else
case Format.Color is
when ARM_Output.Default => null;
when ARM_Output.Black =>
Output_Text (Output_Object, "<FONT COLOR=""#000000"">");
when ARM_Output.Red =>
Output_Text (Output_Object, "<FONT COLOR=""#990000"">");
when ARM_Output.Green =>
Output_Text (Output_Object, "<FONT COLOR=""#009900"">");
when ARM_Output.Blue =>
Output_Text (Output_Object, "<FONT COLOR=""#000099"">");
end case;
end if;
Output_Object.Color := Format.Color;
end if;
if Format.Size /= Output_Object.Size then
if Output_Object.HTML_Kind = HTML_4_Only then
case Format.Size is
when 0 => null; -- Do nothing.
when 1 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 125%"">");
when 2 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 156%"">");
when 3 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 194%"">");
when 4 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 244%"">");
when 5 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 305%"">");
when -1 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 80%"">");
when -2 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 64%"">");
when -3 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 51%"">");
when -4 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 41%"">");
when -5 => Output_Text (Output_Object, "<SPAN STYLE=""font-size: 33%"">");
when others =>
-- Too much change:
if Format.Size > 0 then
Output_Text (Output_Object, "<SPAN STYLE=""font-size: 305%"">");
else
Output_Text (Output_Object, "<SPAN STYLE=""font-size: 33%"">");
end if;
end case;
else
-- HTML sizes are 1..7, with a default of 3. So we limit the changes.
if Format.Size > 0 then
if Format.Size > 5 then
Output_Text (Output_Object, "<FONT SIZE=""+5"">");
else
Output_Text (Output_Object, "<FONT SIZE=""+" &
Character'Val(Format.Size + Character'Pos('0')) & """>");
end if;
elsif Format.Size < 0 then
if Format.Size < -4 then
Output_Text (Output_Object, "<FONT SIZE=""-4"">");
else
Output_Text (Output_Object, "<FONT SIZE=""-" &
Character'Val(abs Format.Size + Character'Pos('0')) & """>");
end if;
-- else Format.Size=0, nothing to do.
end if;
end if;
Output_Object.Size := Format.Size;
end if;
if Format.Italic and (not Output_Object.Is_Italic) then
Output_Text (Output_Object, "<I>");
Output_Object.Is_Italic := True;
end if;
if Format.Bold and (not Output_Object.Is_Bold) then
Output_Text (Output_Object, "<B>");
Output_Object.Is_Bold := True;
end if;
end Text_Format;
procedure Clause_Reference (Output_Object : in out HTML_Output_Type;
Text : in String;
Clause_Number : in String) is
-- Generate a reference to a clause in the standard. The text of
-- the reference is "Text", and the number of the clause is
-- Clause_Number. For hyperlinked formats, this should generate
-- a link; for other formats, the text alone is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Clause_Number = "X.X" then
-- Link to a dead clause, just output the text (presumably this
-- is deleted).
Ordinary_Text (Output_Object, Text);
else
Output_Text (Output_Object, "<A HREF=""");
declare
Name : constant String :=
Make_Clause_Link_Name (Output_Object, Clause_Number);
begin
Output_Text (Output_Object, Name);
end;
Output_Text (Output_Object, """>");
Ordinary_Text (Output_Object, Text);
Output_Text (Output_Object, "</A>");
end if;
end Clause_Reference;
procedure Index_Target (Output_Object : in out HTML_Output_Type;
Index_Key : in Natural) is
-- Generate a index target. This marks the location where an index
-- reference occurs. Index_Key names the index item involved.
-- For hyperlinked formats, this should generate a link target;
-- for other formats, nothing is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
-- Insert an anchor:
Output_Text (Output_Object, "<A NAME=""I");
declare
Key_Name : constant String := Natural'Image(Index_Key);
begin
Output_Text (Output_Object, Key_Name(2..Key_Name'Last));
end;
Output_Text (Output_Object, """></A>");
end Index_Target;
procedure Index_Reference (Output_Object : in out HTML_Output_Type;
Text : in String;
Index_Key : in Natural;
Clause_Number : in String) is
-- Generate a reference to an index target in the standard. The text
-- of the reference is "Text", and Index_Key and Clause_Number denotes
-- the target. For hyperlinked formats, this should generate
-- a link; for other formats, the text alone is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
Output_Text (Output_Object, "<A HREF=""");
if Output_Object.Big_Files then
null; -- No file name needed, this is a self-reference.
else
if Output_Object.DOS_Filenames then
Output_Text (Output_Object,
Make_Clause_File_Name (Output_Object, Clause_Number)
& ".HTM");
else
Output_Text (Output_Object,
Make_Clause_File_Name (Output_Object, Clause_Number)
& ".html");
end if;
end if;
Output_Text (Output_Object, "#I");
declare
Key_Name : constant String := Natural'Image(Index_Key);
begin
Output_Text (Output_Object, Key_Name(2..Key_Name'Last));
end;
Output_Text (Output_Object, """>");
Ordinary_Text (Output_Object, Text);
Output_Text (Output_Object, "</A>");
end Index_Reference;
procedure DR_Reference (Output_Object : in out HTML_Output_Type;
Text : in String;
DR_Number : in String) is
-- Generate a reference to an DR from the standard. The text
-- of the reference is "Text", and DR_Number denotes
-- the target. For hyperlinked formats, this should generate
-- a link; for other formats, the text alone is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
declare
Num : Integer := Integer'Value(DR_Number(DR_Number'Last-3 .. DR_Number'Last));
begin
Output_Text (Output_Object, "<A HREF=""");
if Num <= 93 then -- In Defect Reports 1. -- %%%% Update if changed.
Output_Text (Output_Object, "defect1.html");
else -- In Defect Reports 2.
Output_Text (Output_Object, "defect2.html");
end if;
Output_Text (Output_Object, "#");
Output_Text (Output_Object, DR_Number);
end;
Output_Text (Output_Object, """>");
Ordinary_Text (Output_Object, Text);
Output_Text (Output_Object, "</A>");
end DR_Reference;
function Folded_AI95_Number (AI_String : in String) return String is
-- Internal routine.
-- Calculate the "folded" AI number from the full version.
-- AI_String should be in the form "AIzz-00xxx-yy", where -yy, 00,
-- and zz are optional, and 'zz' = 95 if given.
Result : String(1..5);
Hyphen_1 : Natural := Ada.Strings.Fixed.Index (AI_String, "-");
Hyphen_2 : Natural;
begin
if Hyphen_1 = 0 or else AI_String'Last < Hyphen_1+3 then
Result := "00001";
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad AI reference " & AI_String);
elsif Hyphen_1 = AI_String'First+4 and then
AI_String(AI_String'First..Hyphen_1-1) /= "AI95" then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Unknown AI reference " & AI_String);
Result := "00001";
elsif Hyphen_1 = AI_String'First+2 and then
AI_String(AI_String'First..Hyphen_1-1) /= "AI" then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Unknown short AI reference " & AI_String);
Result := "00001";
else
Hyphen_2 := Ada.Strings.Fixed.Index (AI_String(Hyphen_1+1..AI_String'Last), "-");
if Hyphen_2 = 0 then
if AI_String'Last = Hyphen_1+5 then
Result := AI_String(Hyphen_1+1 .. Hyphen_1+5);
elsif AI_String'Last = Hyphen_1+4 then
Result(2..5) := AI_String(Hyphen_1+1 .. Hyphen_1+4);
Result(1) := '0';
elsif AI_String'Last = Hyphen_1+3 then
Result(3..5) := AI_String(Hyphen_1+1 .. Hyphen_1+3);
Result(1) := '0';
Result(2) := '0';
else
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"AI reference too wrong length " & AI_String);
Result := "00001";
end if;
else
if (Hyphen_2-1) - (Hyphen_1+1) = 5-1 then
Result := AI_String (Hyphen_1+1 .. Hyphen_2-1);
elsif (Hyphen_2-1) - (Hyphen_1+1) = 4-1 then
Result(2..5) := AI_String (Hyphen_1+1 .. Hyphen_2-1);
Result(1) := '0';
elsif (Hyphen_2-1) - (Hyphen_1+1) = 3-1 then
Result(3..5) := AI_String (Hyphen_1+1 .. Hyphen_2-1);
Result(1) := '0';
Result(2) := '0';
else
Result := "00001";
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad AI reference (hyphen dist) " & AI_String);
end if;
if AI_String'Last < Hyphen_2+1 or else
AI_String'Last > Hyphen_2+2 then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad AI alternative reference " & AI_String);
elsif AI_String'Last = Hyphen_2+1 then
Result(1) := Character'Pred(AI_String(Hyphen_2+1));
elsif AI_String'Last = Hyphen_2+2 and then AI_String(Hyphen_2+1) = '0' then
Result(1) := Character'Pred(AI_String(Hyphen_2+2));
elsif AI_String'Last = Hyphen_2+2 and then AI_String(Hyphen_2+1) = '1' then
if AI_String(Hyphen_2+2) = '0' then
Result(1) := '9';
else
Result(1) := Character'Val(Character'Pos(AI_String(Hyphen_2+2)) - Character'Pos('1') + Character'Pos('A'));
end if;
elsif AI_String'Last = Hyphen_2+2 and then AI_String(Hyphen_2+1) = '2' then
Result(1) := Character'Val(Character'Pos(AI_String(Hyphen_2+2)) - Character'Pos('1') + Character'Pos('A') + 10);
else
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad AI alternative reference " & AI_String);
end if;
end if;
end if;
return Result;
end Folded_AI95_Number;
procedure AI_Reference (Output_Object : in out HTML_Output_Type;
Text : in String;
AI_Number : in String) is
-- Generate a reference to an AI from the standard. The text
-- of the reference is "Text", and AI_Number denotes
-- the target (in unfolded format). For hyperlinked formats, this should
-- generate a link; for other formats, the text alone is generated.
--
-- We assume AI number is of the form:
-- ZZZZ-nnnn-m whre ZZZZ=AI05, AI12, or SI99, nnnn is a four digit number,
-- and -m is an optional number (-1 is used if it is omitted); or
-- AIzz-nnnnn-mm where AIzz=AI95 or AI (meaning AI95);
-- nnnnn is a five digit number, and -mm is an optional two digit number.
-- We raise Not_Valid_Error otherwise.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if AI_Number'Length > 5 and then
AI_Number(AI_Number'First..AI_Number'First+4) = "AI12-" then
-- AI12:
if AI_Number'Length >= 9 then
if AI_Number(AI_Number'First+5) not in '0'..'9' or else
AI_Number(AI_Number'First+6) not in '0'..'9' or else
AI_Number(AI_Number'First+7) not in '0'..'9' or else
AI_Number(AI_Number'First+8) not in '0'..'9' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad number in AI12 number: " & AI_Number);
end if;
end if;
if AI_Number'Length = 9 then
Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI12s/");
Output_Text (Output_Object, AI_Number & "-1");
elsif AI_Number'Length = 11 then
if AI_Number(AI_Number'Last-1) /= '-' or else
AI_Number(AI_Number'Last) not in '0'..'9' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad sequence number in AI12 number: " & AI_Number);
end if;
Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI12s/");
Output_Text (Output_Object, AI_Number);
else
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad AI12 number: " & AI_Number);
end if;
elsif AI_Number'Length > 5 and then
AI_Number(AI_Number'First..AI_Number'First+4) = "AI05-" then
-- AI05:
if AI_Number'Length >= 9 then
if AI_Number(AI_Number'First+5) not in '0'..'9' or else
AI_Number(AI_Number'First+6) not in '0'..'9' or else
AI_Number(AI_Number'First+7) not in '0'..'9' or else
AI_Number(AI_Number'First+8) not in '0'..'9' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad number in AI05 number: " & AI_Number);
end if;
end if;
if AI_Number'Length = 9 then
Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI05s/");
Output_Text (Output_Object, AI_Number & "-1");
elsif AI_Number'Length = 11 then
if AI_Number(AI_Number'Last-1) /= '-' or else
AI_Number(AI_Number'Last) not in '0'..'9' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad sequence number in AI05 number: " & AI_Number);
end if;
Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AI05s/");
Output_Text (Output_Object, AI_Number);
else
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad AI05 number: " & AI_Number);
end if;
elsif AI_Number'Length > 5 and then
AI_Number(AI_Number'First..AI_Number'First+4) = "SI99-" then
if AI_Number'Length >= 9 then
if AI_Number(AI_Number'First+5) not in '0'..'9' or else
AI_Number(AI_Number'First+6) not in '0'..'9' or else
AI_Number(AI_Number'First+7) not in '0'..'9' or else
AI_Number(AI_Number'First+8) not in '0'..'9' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad number in SI99 number: " & AI_Number);
end if;
end if;
if AI_Number'Length = 9 then
Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/SI99s/");
Output_Text (Output_Object, AI_Number & "-1");
elsif AI_Number'Length = 11 then
if AI_Number(AI_Number'Last-1) /= '-' or else
AI_Number(AI_Number'Last) not in '0'..'9' then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad sequence number in SI99 number: " & AI_Number);
end if;
Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/SI99s/");
Output_Text (Output_Object, AI_Number);
else
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Bad SI99 number: " & AI_Number);
end if;
else -- Must be AI95:
declare
Folded : constant String :=
Folded_AI95_Number(AI_Number); -- We don't want to have written anything if we raise an exception.
begin
Output_Text (Output_Object, "<A HREF=""http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-");
Output_Text (Output_Object, Folded);
end;
end if;
Output_Text (Output_Object, ".TXT"">");
Ordinary_Text (Output_Object, Text);
Output_Text (Output_Object, "</A>");
end AI_Reference;
procedure Local_Target (Output_Object : in out HTML_Output_Type;
Text : in String;
Target : in String) is
-- Generate a local target. This marks the potential target of local
-- links identified by "Target". Text is the text of the target.
-- For hyperlinked formats, this should generate a link target;
-- for other formats, only the text is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
-- Insert an anchor:
Output_Text (Output_Object, "<A NAME=""");
Output_Text (Output_Object, Target);
Output_Text (Output_Object, """>");
Ordinary_Text (Output_Object, Text);
Output_Text (Output_Object, "</A>");
end Local_Target;
procedure Local_Link (Output_Object : in out HTML_Output_Type;
Text : in String;
Target : in String;
Clause_Number : in String) is
-- Generate a local link to the target and clause given.
-- Text is the text of the link.
-- For hyperlinked formats, this should generate a link;
-- for other formats, only the text is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
-- Insert an anchor:
Output_Text (Output_Object, "<A HREF=""");
if Output_Object.Big_Files then
null; -- No file name needed, this is a self-reference.
else
if Output_Object.DOS_Filenames then
Output_Text (Output_Object,
Make_Clause_File_Name (Output_Object, Clause_Number)
& ".HTM");
else
Output_Text (Output_Object,
Make_Clause_File_Name (Output_Object, Clause_Number)
& ".html");
end if;
end if;
Output_Text (Output_Object, "#" & Target);
Output_Text (Output_Object, """>");
Ordinary_Text (Output_Object, Text);
Output_Text (Output_Object, "</A>");
end Local_Link;
procedure Local_Link_Start (Output_Object : in out HTML_Output_Type;
Target : in String;
Clause_Number : in String) is
-- Generate a local link to the target and clause given.
-- The link will surround text until Local_Link_End is called.
-- Local_Link_End must be called before this routine can be used again.
-- For hyperlinked formats, this should generate a link;
-- for other formats, only the text is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.In_Local_Link then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Already in a local link");
end if;
Output_Object.In_Local_Link := True;
-- Insert an anchor:
Output_Text (Output_Object, "<A HREF=""");
if Output_Object.Big_Files then
null; -- No file name needed, this is a self-reference.
else
if Output_Object.DOS_Filenames then
Output_Text (Output_Object,
Make_Clause_File_Name (Output_Object, Clause_Number)
& ".HTM");
else
Output_Text (Output_Object,
Make_Clause_File_Name (Output_Object, Clause_Number)
& ".html");
end if;
end if;
Output_Text (Output_Object, "#" & Target);
Output_Text (Output_Object, """>");
end Local_Link_Start;
procedure Local_Link_End (Output_Object : in out HTML_Output_Type;
Target : in String;
Clause_Number : in String) is
-- End a local link for the target and clause given.
-- This must be in the same paragraph as the Local_Link_Start.
-- For hyperlinked formats, this should generate a link;
-- for other formats, only the text is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if not Output_Object.In_Local_Link then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in a local link");
end if;
Output_Text (Output_Object, "</A>");
Output_Object.In_Local_Link := False;
end Local_Link_End;
procedure URL_Link (Output_Object : in out HTML_Output_Type;
Text : in String;
URL : in String) is
-- Generate a link to the URL given.
-- Text is the text of the link.
-- For hyperlinked formats, this should generate a link;
-- for other formats, only the text is generated.
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
-- Insert an anchor:
Output_Text (Output_Object, "<A HREF=""");
Output_Text (Output_Object, URL);
Output_Text (Output_Object, """>");
Ordinary_Text (Output_Object, Text);
Output_Text (Output_Object, "</A>");
end URL_Link;
procedure Picture (Output_Object : in out HTML_Output_Type;
Name : in String;
Descr : in String;
Alignment : in ARM_Output.Picture_Alignment;
Height, Width : in Natural;
Border : in ARM_Output.Border_Kind) is
-- Generate a picture.
-- Name is the (simple) file name of the picture; Descr is a
-- descriptive name for the picture (it will appear in some web
-- browsers).
-- We assume that it is a .PNG or .JPG and that it will be present
-- in the same directory as the output files.
-- Alignment specifies the picture alignment.
-- Height and Width specify the picture size in pixels.
-- Border specifies the kind of border.
procedure Make_Img (Extra_Attribs : in String) is
H : constant String := Natural'Image(Height);
W : constant String := Natural'Image(Width);
begin
Output_Text (Output_Object, "<IMG src=""" & Name & """");
Output_Text (Output_Object, " height=""" & H(2..H'Last) &
""" width=""" & W(2..W'Last) & """");
if Extra_Attribs /= "" then
Output_Text (Output_Object, Extra_Attribs);
end if;
Output_Text (Output_Object, " alt=""" & Descr & """");
case Border is
when ARM_Output.None =>
Output_Text (Output_Object, " border=""0"">");
when ARM_Output.Thin =>
Output_Text (Output_Object, " border=""1"">");
when ARM_Output.Thick =>
Output_Text (Output_Object, " border=""2"">");
end case;
end Make_Img;
begin
if not Output_Object.Is_Valid then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not valid object");
end if;
case Alignment is
when ARM_Output.Inline =>
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.HTML_Kind = HTML_3 then
Make_Img ("");
else
Make_Img (" style=""margin-left: 0.3em; margin-right: 0.3em""");
end if;
when ARM_Output.Float_Left =>
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.HTML_Kind = HTML_3 then
Make_Img (" align=""left""");
else
Make_Img (" align=""left"" style=""margin-right: 0.3em""");
-- Space on right only; left should align with containing
-- margin.
end if;
when ARM_Output.Float_Right =>
if not Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"Not in paragraph");
end if;
if Output_Object.HTML_Kind = HTML_3 then
Make_Img (" align=""right""");
else
Make_Img (" align=""right"" style=""margin-left: 0.3em""");
-- Space on right only; left should align with containing
-- margin.
end if;
when ARM_Output.Alone_Left =>
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"In paragraph");
end if;
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "<DIV Style=""text-align: left; margin-bottom: ");
Put_EMs(Output_Object.Output_File, (Paragraph_Info(ARM_Output.Normal, 0).After * LEADING_PERCENT) / 100);
Output_Text (Output_Object, """>");
else
Output_Text (Output_Object, "<P>");
end if;
Make_Img("");
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</DIV>");
else
Output_Text (Output_Object, "</P>");
end if;
Ada.Text_IO.New_Line (Output_Object.Output_File);
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
when ARM_Output.Alone_Right =>
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"In paragraph");
end if;
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "<DIV Style=""text-align: right; margin-bottom: ");
Put_EMs(Output_Object.Output_File, (Paragraph_Info(ARM_Output.Normal, 0).After * LEADING_PERCENT) / 100);
Output_Text (Output_Object, """>");
else
Output_Text (Output_Object, "<RIGHT>");
end if;
Make_Img("");
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</DIV>");
else
Output_Text (Output_Object, "</RIGHT>");
end if;
Ada.Text_IO.New_Line (Output_Object.Output_File);
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
when ARM_Output.Alone_Center =>
if Output_Object.Is_In_Paragraph then
Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
"In paragraph");
end if;
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "<DIV Style=""text-align: center; margin-bottom: ");
Put_EMs(Output_Object.Output_File, (Paragraph_Info(ARM_Output.Normal, 0).After * LEADING_PERCENT) / 100);
Output_Text (Output_Object, """>");
else
Output_Text (Output_Object, "<CENTER>");
end if;
Make_Img("");
if Output_Object.HTML_Kind = HTML_4_Only then
Output_Text (Output_Object, "</DIV>");
else
Output_Text (Output_Object, "</CENTER>");
end if;
Ada.Text_IO.New_Line (Output_Object.Output_File);
Output_Object.Char_Count := 0;
Output_Object.Disp_Char_Count := 0;
Output_Object.Disp_Large_Char_Count := 0;
Output_Object.Any_Nonspace := False;
Output_Object.Last_Was_Space := True; -- Start of line.
Output_Object.Conditional_Space := False; -- Don't need it here.
end case;
end Picture;
begin
-- Define the styles:
-- Normal:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Normal, I) :=
(Defined => True,
Tag => DIV,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 6); -- 120
end loop;
-- Wide_Above:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Wide_Above, I) :=
(Defined => True,
Tag => DIV,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 6,
After => 6);
end loop;
-- Header:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Header, I) :=
(Defined => True,
Tag => DIV,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 0);
end loop;
-- Small:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Small, I) :=
(Defined => True,
Tag => DIV,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 6); -- 120
end loop;
-- Small_Wide_Above:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Small_Wide_Above, I) :=
(Defined => True,
Tag => DIV,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 6,
After => 6);
end loop;
-- Small Header:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Small_Header, I) :=
(Defined => True,
Tag => DIV,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 0);
end loop;
-- Examples:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Examples, I) :=
(Defined => True,
Tag => DIV,
Size => 0, -- 18
Font => ARM_Output.Fixed,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 6); -- 120
end loop;
-- Small Examples:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Small_Examples, I) :=
(Defined => True,
Tag => DIV,
Size => -1, -- 15
Font => ARM_Output.Fixed,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 6); -- 120
end loop;
-- Swiss Examples:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Swiss_Examples, I) :=
(Defined => True,
Tag => DIV,
Size => 0, -- 18
Font => ARM_Output.Swiss,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 6); -- 120
end loop;
-- Small Swiss Examples:
for I in ARM_Output.Paragraph_Indent_Type loop
Paragraph_Info(ARM_Output.Small_Swiss_Examples, I) :=
(Defined => True,
Tag => DIV,
Size => -1, -- 15
Font => ARM_Output.Swiss,
Indent => Natural(I),
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 6); -- 120
end loop;
-- Bulleted:
-- Note: Indent = 0 is not allowed.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Bulleted, I) :=
(Defined => True,
Tag => UL,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 1,
Hang_Outdent => 0,
Before => 0,
After => 5);
end loop;
-- Nested Bulleted:
-- Note: Indent = 0 is not allowed.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Nested_Bulleted, I) :=
(Defined => True,
Tag => UL,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 1,
Hang_Outdent => 0,
Before => 0,
After => 5);
end loop;
-- Small Bulleted:
-- Note: Indent = 0 is not allowed.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Small_Bulleted, I) :=
(Defined => True,
Tag => UL,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 1,
Hang_Outdent => 0,
Before => 0,
After => 5);
end loop;
-- Small Nested Bulleted:
-- Note: Indent = 0 is not allowed.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Small_Nested_Bulleted, I) :=
(Defined => True,
Tag => UL,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I),
Right_Indent => 1,
Hang_Outdent => 0,
Before => 0,
After => 5);
end loop;
-- Enumerated:
-- Note: Indent = 0 is not allowed.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Enumerated, I) :=
(Defined => True,
Tag => DL,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I)-1,
Right_Indent => 1,
Hang_Outdent => 1,
Before => 0,
After => 5);
end loop;
-- Small Enumerated:
-- Note: Indent = 0 is not allowed.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Small_Enumerated, I) :=
(Defined => True,
Tag => DL,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I)-1,
Right_Indent => 1,
Hang_Outdent => 1,
Before => 0,
After => 5);
end loop;
-- Giant Hanging
-- Note: Indent < 4 is not allowed.
for I in 4 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Giant_Hanging, I) :=
(Defined => True,
Tag => DL,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I)-4,
Right_Indent => 0,
Hang_Outdent => 4,
Before => 0,
After => 6);
end loop;
-- Small Giant Hanging:
-- Note: Indent < 4 is not allowed.
for I in 4 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Small_Giant_Hanging, I) :=
(Defined => True,
Tag => DL,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I)-4,
Right_Indent => 0,
Hang_Outdent => 4,
Before => 0,
After => 6);
end loop;
-- Wide Hanging
-- Note: Indent < 3 is not allowed.
for I in 3 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Wide_Hanging, I) :=
(Defined => True,
Tag => DL,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I)-3,
Right_Indent => 0,
Hang_Outdent => 3,
Before => 0,
After => 6);
end loop;
-- Small Wide Hanging:
-- Note: Indent < 3 is not allowed.
for I in 3 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Small_Wide_Hanging, I) :=
(Defined => True,
Tag => DL,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I)-3,
Right_Indent => 0,
Hang_Outdent => 3,
Before => 0,
After => 6);
end loop;
-- Medium Hanging
-- Note: Indent < 2 is not allowed.
for I in 2 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Medium_Hanging, I) :=
(Defined => True,
Tag => DL,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I)-2,
Right_Indent => 0,
Hang_Outdent => 2,
Before => 0,
After => 6);
end loop;
-- Small Medium Hanging:
-- Note: Indent < 2 is not allowed.
for I in 2 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Small_Medium_Hanging, I) :=
(Defined => True,
Tag => DL,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I)-2,
Right_Indent => 0,
Hang_Outdent => 2,
Before => 0,
After => 6);
end loop;
-- Narrow Hanging
-- Note: Indent < 1 is not allowed.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Narrow_Hanging, I) :=
(Defined => True,
Tag => DL,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I)-1,
Right_Indent => 0,
Hang_Outdent => 1,
Before => 0,
After => 6);
end loop;
-- Small Narrow Hanging:
-- Note: Indent < 1 is not allowed.
for I in 1 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Small_Narrow_Hanging, I) :=
(Defined => True,
Tag => DL,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I)-1,
Right_Indent => 0,
Hang_Outdent => 1,
Before => 0,
After => 6);
end loop;
-- Hanging in Bulleted
-- Note: Indent < 2 is not allowed.
for I in 2 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Hanging_in_Bulleted, I) :=
(Defined => True,
Tag => DL,
Size => 0, -- 18
Font => ARM_Output.Default,
Indent => Natural(I)-2,
Right_Indent => 1,
Hang_Outdent => 2,
Before => 0,
After => 5);
end loop;
-- Small Hanging in Bulleted
-- Note: Indent < 2 is not allowed.
for I in 2 .. ARM_Output.Paragraph_Indent_Type'Last loop
Paragraph_Info(ARM_Output.Small_Hanging_in_Bulleted, I) :=
(Defined => True,
Tag => DL,
Size => -1, -- 15
Font => ARM_Output.Default,
Indent => Natural(I)-2,
Right_Indent => 1,
Hang_Outdent => 2,
Before => 0,
After => 5);
end loop;
-- Index. Only define the form that we'll use.
Paragraph_Info(ARM_Output.Index, 0) :=
(Defined => True,
Tag => DIV,
Size => 0,
Font => ARM_Output.Default,
Indent => 0,
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 0);
-- Syntax Summary. Only define the form that we'll use.
Paragraph_Info(ARM_Output.Syntax_Summary, 1) :=
(Defined => True,
Tag => DIV,
Size => -1,
Font => ARM_Output.Default,
Indent => 1,
Right_Indent => 0,
Hang_Outdent => 0,
Before => 0,
After => 4);
-- Title. Only define the form that we'll use.
Paragraph_Info(ARM_Output.Title, 0) :=
(Defined => True,
Tag => DIV,
Size => 3, -- 36
Font => ARM_Output.Default,
Indent => 0,
Right_Indent => 0,
Hang_Outdent => 0,
Before => 6,
After => 6);
end ARM_HTML;
|