/usr/share/gap/pkg/AtlasRep/gap/access.gi is in gap-atlasrep 1.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 | #############################################################################
##
#W access.gi GAP 4 package AtlasRep Thomas Breuer
##
#Y Copyright (C) 2001, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany
##
## This file contains functions for accessing data from the ATLAS of Group
## Representations.
##
#############################################################################
##
#F AGR.StringFile( <filename> )
##
## In unfortunate cases, files may contain line breaks of the form "\r\n"
## instead of "\n".
## 'Read' would recognize this situation, and would silently replace these
## line breaks, but 'StringFile' keeps the file contents.
## Therefore we remove the '\r' characters.
##
AGR.StringFile:= function( filename )
local str;
str:= StringFile( filename );
if IsString( str ) then
str:= ReplacedString( str, "\r", "" );
fi;
return str;
end;
#############################################################################
##
#V AGR.ExtensionInfoCharacterTable
#V AGR.HasExtensionInfoCharacterTable
#V AGR.LibInfoCharacterTable
##
if IsBound( ExtensionInfoCharacterTable ) then
AGR.ExtensionInfoCharacterTable:= ExtensionInfoCharacterTable;
AGR.HasExtensionInfoCharacterTable:= HasExtensionInfoCharacterTable;
AGR.LibInfoCharacterTable:= LibInfoCharacterTable;
fi;
#############################################################################
##
#F AGR.IsLowerAlphaOrDigitChar( <char> )
##
AGR.IsLowerAlphaOrDigitChar:=
char -> IsLowerAlphaChar( char ) or IsDigitChar( char );
#############################################################################
##
## If the IO package is not installed then error messages are avoided
## via the following assignments.
##
if not IsBound( SingleHTTPRequest ) then
SingleHTTPRequest:= "dummy";
fi;
if not IsBound( IO_stat ) then
IO_stat:= "dummy";
fi;
#############################################################################
##
#F AtlasOfGroupRepresentationsTransferFile( <server>, <srvfile>, <dstfile> )
##
## This function encapsulates the access to a file either via <C>wget</C>
## or via the <Package>IO</Package> package
## <Cite Key="IO"/><Index>IO package</Index>.
## <P/>
## The source file is described by the server name <A>server</A> and the
## path <A>srvfile</A>.
## The file is written to the filename <A>dstfile</A>.
##
## <#GAPDoc Label="IO_or_wget">
## When access to remote data is enabled
## (see Section <Ref Subsect="subsect:Local or remote access"/>)
## then one needs either the &GAP; package <Package>IO</Package>
## <Cite Key="IO"/><Index>IO package</Index>
## or the external program <F>wget</F><Index Key="wget"><F>wget</F></Index>
## for accessing data files.
## <P/>
## The chosen alternative is given by the value of the <C>wget</C> component
## of the global variable <Ref Var="AtlasOfGroupRepresentationsInfo"/>.
## <P/>
## If this component has the value <K>true</K> then only <F>wget</F>
## is tried,
## if the value is <K>false</K> then only the <Package>IO</Package> package
## is used.
## If this component is not bound or bound to another value than <K>true</K>
## or <K>false</K> (this is also the default)
## then the <Package>IO</Package> package <Index>IO package</Index>
## is preferred to <F>wget</F><Index Key="wget"><F>wget</F></Index>
## if this package is available, and otherwise <F>wget</F> is tried.
## <P/>
## Note that the system program <F>wget</F> may be not available,
## and that it may require some work to install it;
## hints for that can be found on the home page of the
## <Package>AtlasRep</Package> package (see
## Section <Ref Sect="sect:Web Services for the AtlasRep Package"/>).
## <#/GAPDoc>
##
## If the access worked then <K>true</K> is returned,
## otherwise <K>false</K>.
##
BindGlobal( "AtlasOfGroupRepresentationsTransferFile",
function( server, srvfile, dstfile )
local pos, dstdir, wget, io, result;
# Check whether 'dstfile' can be written.
pos:= Positions( dstfile, '/' );
if pos = [] then
dstdir:= ".";
else
dstdir:= dstfile{ [ 1 .. pos[ Length( pos ) ] - 1 ] };
fi;
if not IsWritableFile( dstdir ) then
Info( InfoWarning, 1,
"Package AtlasRep:\n",
"#I cannot write to the directory '", dstdir, "',\n",
"#I perhaps change the AtlasRep data directories using\n",
"#I 'SetUserPreference( \"AtlasRep\",",
" \"AtlasRepDataDirectory\", ... )'" );
return false;
fi;
# Determine admissible alternatives.
wget:= true;
io:= true;
if IsBound( AtlasOfGroupRepresentationsInfo.wget ) then
if AtlasOfGroupRepresentationsInfo.wget = true then
io:= false;
elif AtlasOfGroupRepresentationsInfo.wget = false then
wget:= false;
fi;
fi;
srvfile:= Concatenation( "/", srvfile);
# Try the IO package if it is admissible.
if io and LoadPackage( "io" ) = true then
Info( InfoAtlasRep, 2,
"calling SingleHTTPRequest to get ", server, srvfile );
result:= SingleHTTPRequest( server, 80, "GET",
srvfile,
rec(), false, dstfile );
if result.statuscode <> 200 then
Info( InfoAtlasRep, 2,
"SingleHTTPRequest failed with status\n#I ", result.status );
else
return true;
fi;
fi;
# Try wget if it is admissible.
if wget then
wget:= Filename( DirectoriesSystemPrograms(), "wget" );
if wget = fail then
Info( InfoAtlasRep, 1, "no `wget' executable found" );
else
Info( InfoAtlasRep, 2,
"calling `wget' to get `", server, srvfile, "'" );
result:= Process( DirectoryCurrent(), wget,
InputTextNone(), OutputTextNone(),
[ "-q", "-O", dstfile,
Concatenation( "http://", server, srvfile ) ] );
if result <> 0 then
Info( InfoAtlasRep, 2,
"`wget' failed to fetch `",
Concatenation( "http://", server, srvfile ), "'" );
RemoveFile( dstfile );
else
return true;
fi;
fi;
fi;
# No admissible alternative was successful.
return false;
end );
#############################################################################
##
#V AtlasOfGroupRepresentationsAccessFunctionsDefault
##
## several functions may be provided; return value `fail' means that
## the next function is tried, otherwise the result counts
##
InstallValue( AtlasOfGroupRepresentationsAccessFunctionsDefault, [
rec(
description:= "default functions (read text files)",
active:= true,
location:= function( filename, groupname, dirname, type )
local pref, datadirs, info, name, namegz, names, fname;
pref:= UserPreference( "AtlasRep", "AtlasRepDataDirectory" );
if dirname in [ "datagens", "dataword" ] then
datadirs:= [ Directory( Concatenation( pref, dirname ) ) ];
else
for info in AtlasOfGroupRepresentationsInfo.private do
if dirname = info[2] then
datadirs:= [ Directory( info[1] ) ];
break;
fi;
od;
if not IsBound( datadirs ) then
Error( "no private directory with identifier `", dirname, "'" );
fi;
fi;
# There may be an uncompressed or a compressed version.
# If both are available then prefer the uncompressed version.
if IsString( filename ) then
name:= Filename( datadirs, filename );
if name = fail or not IsExistingFile( name ) then
namegz:= Filename( datadirs, Concatenation( filename, ".gz" ) );
if namegz = fail then
# No version is available yet.
return Filename( datadirs[1], filename );
else
return namegz;
fi;
else
return name;
fi;
else
# Treat the list entries separately.
names:= [];
for fname in filename do
name:= Filename( datadirs, fname );
if name = fail or not IsExistingFile( name ) then
namegz:= Filename( datadirs, Concatenation( fname, ".gz" ) );
if namegz = fail then
# No version is available yet.
Add( names, Filename( datadirs[1], fname ) );
else
Add( names, namegz );
fi;
else
Add( names, name );
fi;
od;
return names;
fi;
end,
fetch:= function( filepath, filename, groupname, dirname, type )
local triple, info, dirnam, result, gzip;
# Get the group name info.
triple:= First( AtlasOfGroupRepresentationsInfo.groupnames,
x -> x[3] = groupname );
if triple = fail then
Error( "illegal value of <groupname>" );
fi;
# Try to fetch the remote file.
result:= fail;
for info in AtlasOfGroupRepresentationsInfo.servers do
dirnam:= Concatenation( info[2], triple[1], "/", triple[2] );
# Compose the name of the directory on the server.
if dirname = "dataword" then
Append( dirnam, "/words/" );
elif filename[ Length( filename ) ] = 'g' then
Append( dirnam, "/gap0/" );
else
Append( dirnam, "/mtx/" );
fi;
# Fetch the file if possible.
result:= AtlasOfGroupRepresentationsTransferFile( info[1],
Concatenation( dirnam, filename ),
filepath );
if result = false then
Info( InfoAtlasRep, 2,
"cannot transfer file from '", info[1], "'\n",
"#I to '", filepath, "'" );
else
break;
fi;
od;
if result = false then
Info( InfoAtlasRep, 1,
"file '", filename, "' not fetched" );
return false;
fi;
# The file has just been fetched, perform postprocessing.
# (For MeatAxe format only: If wanted then compress the new file.)
if AtlasOfGroupRepresentationsInfo.compress = true
and dirnam[ Length( dirnam ) - 1 ] = 'x' then
gzip:= Filename( DirectoriesSystemPrograms(), "gzip" );
if gzip = fail or not IsExecutableFile( gzip ) then
Info( InfoAtlasRep, 1, "no `gzip' executable found" );
else
result:= Process( DirectoryCurrent(), gzip,
InputTextNone(), OutputTextNone(), [ filepath ] );
if result = fail then
Info( InfoAtlasRep, 2,
"impossible to compress file `", filepath, "'" );
fi;
fi;
fi;
return true;
end,
contents:= function( filepath, filename, groupname, dirname, type )
local len, i;
if IsString( filepath ) then
len:= Length( filepath );
if 3 < len and filepath{ [ len-2 .. len ] } = ".gz" then
filepath:= filepath{ [ 1 .. len-3 ] };
fi;
else
filepath:= ShallowCopy( filepath );
for i in [ 1 .. Length( filepath ) ] do
len:= Length( filepath[i] );
if 3 < len and filepath[i]{ [ len-2 .. len ] } = ".gz" then
filepath[i]:= filepath[i]{ [ 1 .. len-3 ] };
fi;
od;
fi;
return type[2].ReadAndInterpretDefault( filepath );
end,
),
rec(
description:= "read MeatAxe binary not text format",
active:= false,
location:= function( filename, groupname, dirname, type )
local pref, datadirs, info, names, fname, name;
if not type[1] in [ "perm", "matff" ] then
return fail;
fi;
pref:= UserPreference( "AtlasRep", "AtlasRepDataDirectory" );
if dirname = "datagens" then
datadirs:= [ Directory( Concatenation( pref, dirname ) ) ];
else
for info in AtlasOfGroupRepresentationsInfo.private do
if dirname = info[2] then
datadirs:= [ Directory( info[1] ) ];
break;
fi;
od;
if not IsBound( datadirs ) then
Error( "no private directory with identifier `", dirname, "'" );
fi;
fi;
# A list of file names is given, and the files are not compressed.
# Replace the text format names by binary format names.
filename:= List( filename, nam -> ReplacedString( nam, ".m", ".b" ) );
names:= [];
for fname in filename do
name:= Filename( datadirs, fname );
if name = fail then
# No version is available yet.
Add( names, Filename( datadirs[1], fname ) );
else
Add( names, name );
fi;
od;
return names;
end,
fetch:= function( filepath, filename, groupname, dirname, type )
local triple, info, dirnam, result;
# Get the group name info.
triple:= First( AtlasOfGroupRepresentationsInfo.groupnames,
x -> x[3] = groupname );
if triple = fail then
Error( "illegal value of <groupname>" );
fi;
# Try to fetch the remote file.
result:= fail;
filename:= ReplacedString( filename, ".m", ".b" );
for info in AtlasOfGroupRepresentationsInfo.servers do
# Fetch the file if possible.
result:= AtlasOfGroupRepresentationsTransferFile( info[1],
Concatenation( info[2], triple[1], "/", triple[2],
"/bin/", filename ),
filepath );
if result = false then
Info( InfoAtlasRep, 2,
"no connection to AtlasRep server ", info[1] );
else
break;
fi;
od;
if result = false then
Info( InfoAtlasRep, 1,
"no file `", filename, "' found on the servers" );
return false;
fi;
# (Do not compress the new file, it is in binary format.)
return true;
end,
contents:= function( filepath, filename, groupname, dirname, type )
# This function is called only for the types "perm" and "matff",
# and binary format files are *not* compressed.
return List( filepath, FFMatOrPermCMtxBinary );
end,
),
#T The following is currently useless because of an unlucky files format.
# rec(
# description:= "read GAP format not MeatAxe format",
#
# active:= false,
#
# location:= function( filename, groupname, dirname, type )
# local datadirs, info, names, fname, name;
#
# # (Does the same as the `location' function for MeatAxe binary format,
# # except that we replace the suffix of the filename by `.g' not `.b'.)
# if not type[1] in [ "perm", "matff" ] then
# return fail;
# fi;
# if dirname = "datagens" then
# datadirs:= DirectoriesPackageLibrary( "atlasrep", dirname );
# else
# for info in AtlasOfGroupRepresentationsInfo.private do
# if dirname = info[2] then
# datadirs:= [ Directory( info[1] ) ];
# break;
# fi;
# od;
# if not IsBound( datadirs ) then
# Error( "no private directory with identifier `", dirname, "'" );
# fi;
# fi;
#
# # A list of file names is given, and the files are not compressed.
# # Replace the text format names by binary format names.
# filename:= List( filename, nam -> ReplacedString( nam, ".m", ".g" ) );
# names:= [];
# for fname in filename do
# name:= Filename( datadirs, fname );
# if name = fail then
# # No version is available yet.
# Add( names, Filename( datadirs[1], fname ) );
# else
# Add( names, name );
# fi;
# od;
# return names;
## alternative for ONE file with SEVERAL generators:
## # Replace the list of text format names by one GAP format name.
## filename:= ReplacedString( filename[1], ".m1", ".g" );
## name:= Filename( datadirs, filename );
## if name = fail then
## # No version is available yet.
## return Filename( datadirs[1], filename );
## else
## return name;
## fi;
# end,
#
# fetch:= function( filepath, filename, groupname, dirname, type )
# local triple, info, dirnam, result;
#
# # (Does the same as the `fetch' function for MeatAxe binary format,
# # except that the source file is expected in `gap' not `bin'.)
# # Get the group name info.
# triple:= First( AtlasOfGroupRepresentationsInfo.groupnames,
# x -> x[3] = groupname );
# if triple = fail then
# Error( "illegal value of <groupname>" );
# fi;
#
# # Try to fetch the remote file.
# result:= fail;
# filename:= ReplacedString( filename, ".m", ".g" );
# for info in AtlasOfGroupRepresentationsInfo.servers do
#
# # Fetch the file if possible.
# result:= AtlasOfGroupRepresentationsTransferFile( info[1],
# Concatenation( info[2], triple[1], "/", triple[2],
# "/gap/", filename ),
# filepath );
# if result = false then
# Info( InfoAtlasRep, 2,
# "no connection to AtlasRep server ", info[1] );
# else
# break;
# fi;
#
# od;
# if result = false then
# Info( InfoAtlasRep, 1,
# "no file `", filename, "' found on the servers" );
# return false;
# fi;
#
# # (Do not compress the new file, it is not in MeatAxe text format.)
# return true;
# end,
#
# contents:= function( filepath, filename, groupname, dirname, type )
# # This function is called only for the types "perm" and "matff",
# # and GAP format files are *not* compressed.
# return List( filepath, AtlasDataGAPFormatFile );
## alternative for ONE file with SEVERAL generators:
## return AtlasDataGAPFormatFile( filepath );
# end,
# ),
rec(
description:= "direct access to a local server",
active:= false,
location:= function( filename, groupname, dirname, type )
local triple, dirnam, name, names, fname;
# This is meaningful only for official data
# and if there is a local server.
if not ( dirname in [ "datagens", "dataword" ] and
IsBound( AtlasOfGroupRepresentationsInfo.localserver ) ) then
return fail;
fi;
# Get the group name info.
triple:= First( AtlasOfGroupRepresentationsInfo.groupnames,
x -> x[3] = groupname );
if triple = fail then
Error( "illegal value of <groupname>" );
fi;
# Compose the name of the directory on the server.
dirnam:= Concatenation( AtlasOfGroupRepresentationsInfo.localserver,
triple[1], "/", triple[2] );
if dirname = "dataword" then
Append( dirnam, "/words/" );
elif filename[ Length( filename ) ] = 'g' then
Append( dirnam, "/gap0/" );
else
Append( dirnam, "/mtx/" );
fi;
# Check whether the file(s) exist(s).
if IsString( filename ) then
name:= Concatenation( dirnam, filename );
if IsExistingFile( name ) then
return name;
fi;
return fail;
else
names:= [];
for fname in filename do
name:= Concatenation( dirnam, fname );
if IsExistingFile( name ) then
Add( names, name );
else
return fail;
fi;
od;
return names;
fi;
end,
fetch:= function( filepath, filename, groupname, dirname, type )
# The `location' function has checked that the file exists.
return true;
end,
contents:= function( filepath, filename, groupname, dirname, type )
# We need not care about compressed files.
return type[2].ReadAndInterpretDefault( filepath );
end,
),
] );
#############################################################################
##
#F AGR.CrcFileFits( <filename>, <path> )
##
AGR.CrcFileFits:= function( filename, path )
local crc, len;
crc:= First( AtlasOfGroupRepresentationsInfo.filenames,
p -> p[1] = filename );
if crc = fail then
return false;
fi;
len:= Length( path );
if path{ [ len - 2 .. len ] } = ".gz" then
path:= path{ [ 1 .. len - 3 ] };
fi;
if crc[2] = CrcFile( path ) then
return true;
else
Info( InfoWarning, 1,
"CrcFile value of\n",
"#I '", path, "'\n",
"#I does not match, ignoring this file" );
return false;
fi;
end;
#############################################################################
##
#F AtlasOfGroupRepresentationsLocalFilename( <dirname>, <groupname>,
#F <filename>, <type> )
##
InstallGlobalFunction( AtlasOfGroupRepresentationsLocalFilename,
function( dirname, groupname, filename, type )
local cand, r, path, i;
cand:= [];
for r in Reversed( AtlasOfGroupRepresentationsInfo.accessFunctions ) do
if r.active = true then
path:= r.location( filename, groupname, dirname, type );
if path <> fail then
# Check whether the CRC values fit.
if IsString( path ) then
path:= [ path ];
filename:= [ filename ];
fi;
for i in [ 1 .. Length( filename ) ] do
path[i]:= [ path[i], IsExistingFile( path[i] ) ];
od;
if ForAll( path, x -> x[2] ) then
# This has priority, do not consider other sources.
cand:= [ [ r, path ] ];
break;
else
Add( cand, [ r, path ] );
fi;
fi;
fi;
od;
return cand;
end );
#############################################################################
##
#F AtlasOfGroupRepresentationsLocalFilenameTransfer( <dirname>, <groupname>,
#F <filename>, <type> )
##
InstallGlobalFunction( AtlasOfGroupRepresentationsLocalFilenameTransfer,
function( dirname, groupname, filename, type )
local cand, list, filenamex, result, ok, i;
# Determine the local directory where to look for the file,
# and the functions that claim to be applicable.
cand:= AtlasOfGroupRepresentationsLocalFilename( dirname, groupname,
filename, type );
if IsString( filename ) then
filenamex:= [ filename ];
else
filenamex:= filename;
fi;
for list in cand do
if Length( list[2] ) = Length( filenamex ) then
# This is the situation we can handle.
if IsString( filename ) then
result:= [ list[2][1][1], list[1] ];
else
result:= [ List( list[2], x -> x[1] ), list[1] ];
fi;
ok:= true;
for i in [ 1 .. Length( list[2] ) ] do
if list[2][i][2] then
# This file is already available.
if dirname in [ "datagens", "dataword" ] then
# Check its crc value.
if not AGR.CrcFileFits( filenamex[i], list[2][i][1] ) then
return fail;
fi;
fi;
elif AtlasOfGroupRepresentationsInfo.remote = true and
dirname in [ "datagens", "dataword" ] and
list[1].fetch( list[2][i][1],
filenamex[i], groupname, dirname, type ) then
# We have created a new local file.
# Check its crc value,
if not AGR.CrcFileFits( filenamex[i], list[2][i][1] ) then
return fail;
fi;
else
# We cannot fetch the file.
ok:= false;
break;
fi;
od;
if ok then
# Return path(s) and access functions.
return result;
fi;
fi;
od;
# Not all files can be made available, or not all crc values fit.
Info( InfoAtlasRep, 1,
"no file(s) `", filename, "' found in the local directories" );
return fail;
end );
#############################################################################
##
#F AtlasOfGroupRepresentationsTestTableOfContentsRemoteUpdates()
##
InstallGlobalFunction(
AtlasOfGroupRepresentationsTestTableOfContentsRemoteUpdates, function()
local version, inforec, home, server, path, dstfilename, result, lines,
pref, datadirs, line, pos, pos2, filename, filenames, localfile,
servdate, stat;
if LoadPackage( "io" ) <> true then
Info( InfoAtlasRep, 1, "the package IO is not available" );
return fail;
fi;
# Download the file that lists the changes.
version:= InstalledPackageVersion( "atlasrep" );
inforec:= First( PackageInfo( "atlasrep" ), r -> r.Version = version );
home:= inforec.PackageWWWHome;
if home{ [ 1 .. 7 ] } = "http://" then
home:= home{ [ 8 .. Length( home ) ] };
fi;
server:= home{ [ 1 .. Position( home, '/' ) - 1 ] };
path:= home{ [ Position( home, '/' ) + 1 .. Length( home ) ] };
dstfilename:= Filename( DirectoryTemporary(), "changes.htm" );
result:= [];
if AtlasOfGroupRepresentationsTransferFile( server,
Concatenation( path, "/htm/data/changes.htm" ),
dstfilename ) then
lines:= SplitString( AGR.StringFile( dstfilename ), "\n" );
lines:= Filtered( lines,
x -> 20 < Length( x ) and x{ [ 1 .. 4 ] } = "<tr>"
and x{ [ -3 .. 0 ] + Length( x ) } = " -->" );
pref:= UserPreference( "AtlasRep", "AtlasRepDataDirectory" );
datadirs:= [ Directory( Concatenation( pref, "datagens" ) ),
Directory( Concatenation( pref, "dataword" ) ) ];
for line in lines do
pos:= PositionSublist( line, "</td><td>" );
if pos <> fail then
pos2:= PositionSublist( line, "</td><td>", pos );
filename:= line{ [ pos+9 .. pos2-1 ] };
if PositionSublist( filename, "<it>i</it>" ) <> fail then
filenames:= List( [ "1", "2" ],
i -> ReplacedString( filename, "<it>i</it>", i ) );
else
filenames:= [ filename ];
fi;
for filename in filenames do
localfile:= Filename( datadirs, filename );
if localfile <> fail then
if not IsExistingFile( localfile ) then
localfile:= Concatenation( localfile, ".gz" );
fi;
if IsExistingFile( localfile ) then
# There is something to compare.
pos:= PositionSublist( line, "<!-- " );
if pos <> fail then
servdate:= Int( line{ [ pos+5 .. Length( line )-4 ] } );
stat:= IO_stat( localfile );
if stat <> fail then
if stat.mtime < servdate then
Add( result, localfile );
fi;
fi;
fi;
fi;
fi;
od;
fi;
od;
fi;
return result;
end );
#############################################################################
##
#F AGR.FileContents( <dirname>, <groupname>, <filename>, <type> )
##
AGR.FileContents:= function( dirname, groupname, filename, type )
local result;
if not ( IsString( filename ) or
( IsList( filename ) and ForAll( filename, IsString ) ) ) then
Error( "<file> must be a string or a list of strings" );
fi;
result:= AtlasOfGroupRepresentationsLocalFilenameTransfer( dirname,
groupname, filename, type );
if result = fail then
return fail;
fi;
# 3. We have the local file(s). Try to extract the contents.
return result[2].contents( result[1], filename, groupname, dirname, type );
end;
#############################################################################
##
#F FilenameAtlas( <dirname>, <groupname>, <filename> )
##
InstallGlobalFunction( FilenameAtlas,
function( dirname, groupname, filename )
local type;
if not IsBound( AtlasOfGroupRepresentationsInfo.WarnedFilenameAtlas ) then
AtlasOfGroupRepresentationsInfo.WarnedFilenameAtlas:= true;
Info( InfoWarning, 1,
"FilenameAtlas is deprecated,\n#I use ",
"`AtlasOfGroupRepresentationsLocalFilenameTransfer' instead" );
fi;
for type in AGR.DataTypes( "rep", "prg" ) do
if AGR.ParseFilenameFormat( filename, type[2].FilenameFormat )
<> fail then
return AtlasOfGroupRepresentationsLocalFilenameTransfer( dirname,
groupname, filename, type )[1];
fi;
od;
return fail;
end );
#############################################################################
##
#F AGR.InfoForName( <gapname> )
##
AGR.InfoForName:= function( gapname )
local pos;
gapname:= AGR.GAPName( gapname );
pos:= PositionSorted( AtlasOfGroupRepresentationsInfo.GAPnames,
[ gapname ] );
if pos <= Length( AtlasOfGroupRepresentationsInfo.GAPnames ) and
AtlasOfGroupRepresentationsInfo.GAPnames[ pos ][1] = gapname then
return AtlasOfGroupRepresentationsInfo.GAPnames[ pos ];
else
return fail;
fi;
end;
#############################################################################
##
## auxiliary function
##
AGR.TST:= function( gapname, value, compname, testfun, msg )
if not IsBound( AGR.GAPnamesRec.( gapname ) ) then
Error( "AGR.GAPnamesRec.( \"", gapname, "\" ) is not bound" );
elif not IsBound( AGR.GAPnamesRec.( gapname )[3] ) then
Error( "AGR.GAPnamesRec.( \"", gapname, "\" )[3] is not bound" );
elif IsBound( AGR.GAPnamesRec.( gapname )[3].( compname ) ) then
Error( "AGR.GAPnamesRec.( \"", gapname, "\" )[3].", compname,
" is bound" );
elif not testfun( value ) then
Error( "<", compname, "> must be a ", msg );
fi;
end;
#############################################################################
##
#F AGR.IsRepNameAvailable( <repname> )
##
## If `AtlasOfGroupRepresentationsInfo.checkData' is bound then this
## function is called when additional data are added that refer to the
## representation <repname>.
##
AGR.IsRepNameAvailable:= function( repname )
local filenames, type, parsed, groupname, gapname;
filenames:= [ Concatenation( repname, ".m1" ),
Concatenation( repname, ".g" ) ];
for type in AGR.DataTypes( "rep" ) do
parsed:= List( filenames,
x -> AGR.ParseFilenameFormat( x, type[2].FilenameFormat ) );
if ForAny( parsed, IsList ) then
break;
fi;
od;
if ForAll( parsed, IsBool ) then
Print( "#E wrong format of `", repname, "'\n" );
return false;
fi;
groupname:= First( parsed, IsList )[1];
gapname:= First( AtlasOfGroupRepresentationsInfo.GAPnames,
pair -> pair[2] = groupname );
if gapname = fail then
Print( "#E no group name `", groupname, "' for `", repname, "'\n" );
return false;
elif ForAll( AllAtlasGeneratingSetInfos( gapname[1] ),
x -> x.repname <> repname ) then
Print( "#E no representation `", repname, "' available\n" );
return false;
fi;
return true;
end;
#############################################################################
##
#F AGR.IsPrgNameAvailable( <prgname> )
##
## If `AtlasOfGroupRepresentationsInfo.checkData' is bound then this
## function is called when additional data are added that refer to the
## program <prgname>.
##
AGR.IsPrgNameAvailable:= function( prgname )
local type, parsed, groupname;
for type in AGR.DataTypes( "prg" ) do
parsed:= AGR.ParseFilenameFormat( prgname, type[2].FilenameFormat );
if IsList( parsed ) then
break;
fi;
od;
if parsed = fail then
Print( "#E wrong format of `", prgname, "'\n" );
return false;
fi;
groupname:= parsed[1];
if ForAny( AGR.TablesOfContents( "all" ),
toc -> IsBound( toc.( groupname ) ) and
ForAny( RecNames( toc.( groupname ) ),
nam -> ForAny( toc.( groupname ).( nam ),
l -> l[ Length( l ) ] = prgname ) ) ) then
return true;
else
Print( "#E no program `", prgname, "' available\n" );
return false;
fi;
end;
#############################################################################
##
#V AGR.MapNameToGAPName
#F AGR.GAPName( <name> )
##
## Let <name> be a string.
## If `LowercaseString( <name> )' is the lower case version of the GAP name
## of an ATLAS group then `AGR.GAPName' returns this GAP name.
## If <name> is an admissible name of a GAP character table with identifier
## <id> (this condition is already case insensitive) then `AGR.GAPName'
## returns `AGR.GAPName( <id> )'.
##
## These two conditions are forced to be consistent, as follows.
## Whenever a GAP name <nam>, say, of an ATLAS group is notified with
## `AGR.GNAN', we compute `LibInfoCharacterTable( <nam> )'.
## If this is `fail' then there is no danger of an inconsistency,
## and if the result is a record <r> then we have the condition
## `AGR.GAPName( <r>.firstName ) = <nam>'.
##
## So a case insensitive partial mapping from character table identifiers
## to GAP names of ATLAS groups is built in `AGR.GNAN',
## and is used in `AGR.GAPName'
##
## Examples of different names for a group are `"F3+"' vs. `"Fi24'"'
## and `"S6"' vs. `"A6.2_1"'.
##
AGR.MapNameToGAPName:= [ [], [] ];
AGR.GAPName:= function( name )
local r, nname, pos;
# Make sure that the file `gap/types.g' is alreay loaded.
IsRecord( AtlasOfGroupRepresentationsInfo );
if IsBound( AGR.LibInfoCharacterTable ) then
r:= AGR.LibInfoCharacterTable( name );
else
r:= fail;
fi;
if r = fail then
nname:= LowercaseString( name );
else
nname:= r.firstName;
fi;
pos:= Position( AGR.MapNameToGAPName[1], nname );
if pos = fail then
return name;
fi;
return AGR.MapNameToGAPName[2][ pos ];
end;
#############################################################################
##
#F AGR.GNAN( <gapname>, <atlasname> )
##
## <#GAPDoc Label="AGR.GNAN">
## <Mark><C>AGR.GNAN( <A>gapname</A>, <A>atlasname</A> )</C></Mark>
## <Item>
## Called with two strings <A>gapname</A> (the &GAP; name of the group)
## and <A>atlasname</A> (the &ATLAS; name of the group),
## <C>AGR.GNAN</C> stores the information in the list
## <C>AtlasOfGroupRepresentationsInfo.GAPnames</C>,
## which defines the name mapping between the <Package>ATLAS</Package>
## names and &GAP; names of the groups.
## <P/>
## This function may be used also for private extensions of the database.
## <P/>
## An example of a valid call is
## <C>AGR.GNAN("A5.2","S5")</C>.
## </Item>
## <#/GAPDoc>
##
AGR.GNAN:= function( gapname, atlasname )
local value, r, pos;
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
if ForAny( AtlasOfGroupRepresentationsInfo.GAPnames,
pair -> gapname = pair[1] ) then
Error( "cannot notify `", gapname, "' more than once" );
elif ForAny( AtlasOfGroupRepresentationsInfo.GAPnames,
pair -> atlasname = pair[2] ) then
Error( "ambiguous GAP names for ATLAS name `", atlasname, "'" );
fi;
fi;
# Make the character table names admissible.
if IsBound( AGR.LibInfoCharacterTable ) then
r:= AGR.LibInfoCharacterTable( gapname );
else
r:= fail;
fi;
if r = fail then
# Store the lowercase name.
Add( AGR.MapNameToGAPName[1], LowercaseString( gapname ) );
Add( AGR.MapNameToGAPName[2], gapname );
elif not r.firstName in AGR.MapNameToGAPName[1] then
Add( AGR.MapNameToGAPName[1], r.firstName );
Add( AGR.MapNameToGAPName[2], gapname );
else
Error( "<gapname> is not compatible with CTblLib" );
fi;
value:= [ gapname, atlasname, rec() ];
AddSet( AtlasOfGroupRepresentationsInfo.GAPnames, value );
AGR.GAPnamesRec.( gapname ):= value;
end;
#############################################################################
##
#F AGR.GRP( <dirname>, <simpname>, <groupname> )
##
## <#GAPDoc Label="AGR.GRP">
## <Mark><C>AGR.GRP( <A>dirname</A>, <A>simpname</A>, <A>groupname</A>)</C></Mark>
## <Item>
## Called with three strings, <C>AGR.GRP</C> stores in the
## <C>groupname</C> component of
## <Ref Var="AtlasOfGroupRepresentationsInfo"/> in which path on the
## servers the data about the group with &ATLAS; name <A>groupname</A>
## can be found.
## <P/>
## This function is <E>not</E> intended for private extensions of the
## database.
## <P/>
## An example of a valid call is
## <C>AGR.GRP("alt","A5","S5")</C>.
## </Item>
## <#/GAPDoc>
##
AGR.GRP:= function( dirname, simpname, groupname )
local entry;
if ForAll( AtlasOfGroupRepresentationsInfo.GAPnames,
pair -> pair[2] <> groupname ) then
# There is no corresponding GAP name.
AddSet( AtlasOfGroupRepresentationsInfo.GAPnames,
Immutable( [ groupname, groupname ] ) );
AGR.SetGAPnamesSortDisp();
Info( InfoAtlasRep, 1,
"no GAP name known for `", groupname, "'" );
fi;
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
entry:= First( AtlasOfGroupRepresentationsInfo.groupnames,
l -> l[3] = groupname );
if entry <> fail then
# Check whether the group is already notified.
if entry[1] = dirname then
Info( InfoAtlasRep, 1,
"group with Atlas name `", groupname, "' already notified" );
else
Error( "group with Atlas name `", groupname,
"' notified for different directories!" );
fi;
if entry[2] <> simpname then
Error( "group with Atlas name `", groupname,
"' notified for different simple groups!" );
fi;
return;
fi;
fi;
# Notify the group.
Add( AtlasOfGroupRepresentationsInfo.groupnames,
[ dirname, simpname, groupname ] );
end;
#############################################################################
##
#F AGR.TOC( <typename>, <filename>, <crc> )
##
## <#GAPDoc Label="AGR.TOC">
## <Mark><C>AGR.TOC( <A>typename</A>, <A>filename</A>, <A>crcfile</A> )</C></Mark>
## <Item>
## Called with two strings <A>typename</A> and <A>filename</A>,
## and a list <A>crc</A> of integers,
## <C>AGR.TOC</C> notifies an entry to the <C>TableOfContents.remote</C>
## component of <Ref Var="AtlasOfGroupRepresentationsInfo"/>,
## where <A>typename</A> must be the name of the data type to which
## the entry belongs,
## <A>filename</A> must be the prefix of the data file(s),
## and <A>crc</A> must be the list of <Ref BookName="ref" Func="CrcFile"/>
## values of the file(s).
## <P/>
## This function is <E>not</E> intended for private extensions of the
## database.
## <P/>
## An example of a valid call is
## <C>AGR.TOC("perm","S5G1-p5B0.m",[-3581724,115937465])</C>.
## </Item>
## <#/GAPDoc>
##
AGR.TOC:= function( type, string, crc )
local n, t, stringx, record, entry, groupname, added, j;
n:= Length( crc );
# Parse the filename with the given format info.
# type:= First( AGR.DataTypes( "rep", "prg" ), x -> x[1] = type );
for t in AGR.DataTypes( "rep", "prg" ) do
if t[1] = type then
type:= t;
break;
fi;
od;
if 1 < n then
stringx:= Concatenation( string, "1" );
else
stringx:= string;
fi;
record:= AtlasTableOfContents( "remote" ).TableOfContents;
entry:= AGR.ParseFilenameFormat( stringx, type[2].FilenameFormat );
if entry = fail then
Info( InfoAtlasRep, 1, "`", [ type, string, crc ],
"' is not a valid t.o.c. entry" );
return;
fi;
# Get the list for the data in the record for the group name.
groupname:= entry[1];
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) and
ForAll( AtlasOfGroupRepresentationsInfo.groupnames,
x -> x[3] <> groupname ) then
Error( "`", groupname, "' is not a valid group name" );
fi;
if not IsBound( record.( groupname ) ) then
record.( groupname ):= rec();
fi;
record:= record.( groupname );
if not IsBound( record.( type[1] ) ) then
record.( type[1] ):= [];
fi;
# Add the first filename.
added:= type[2].AddFileInfo( record.( type[1] ), entry, stringx );
Add( AtlasOfGroupRepresentationsInfo.filenames,
Immutable( [ stringx, crc[1] ] ) );
# Add the other filenames if necessary.
if added then
for j in [ 2 .. n ] do
entry[ Length( entry ) ]:= j;
stringx:= Concatenation( string, String( j ) );
added:= type[2].AddFileInfo( record.( type[1] ), entry, stringx )
and added;
Add( AtlasOfGroupRepresentationsInfo.filenames,
Immutable( [ stringx, crc[j] ] ) );
od;
fi;
if not added then
Info( InfoAtlasRep, 1, "`", [ type, string, crc ],
"' is not a valid t.o.c. entry" );
fi;
end;
#############################################################################
##
#F AGR.GRS( <gapname>, <size> )
##
## <#GAPDoc Label="AGR.GRS">
## <Mark><C>AGR.GRS( <A>gapname</A>, <A>size</A> )</C></Mark>
## <Item>
## Called with the string <A>gapname</A> (the &GAP; name of the group)
## and the integer <A>size</A> (the order of the group),
## <C>AGR.GRS</C> stores this information in
## <C>AtlasOfGroupRepresentationsInfo.GAPnames</C>.
## <P/>
## An example of a valid call is
## <C>AGR.GRS("A5.2",120)</C>.
## </Item>
## <#/GAPDoc>
##
AGR.GRS:= function( gapname, size )
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
AGR.TST( gapname, size, "size", IsPosInt, "positive integer" );
fi;
AGR.GAPnamesRec.( gapname )[3].size:= size;
end;
#############################################################################
##
#F AGR.MXN( <gapname>, <nrMaxes> )
##
## <#GAPDoc Label="AGR.MXN">
## <Mark><C>AGR.MXN( <A>gapname</A>, <A>nrMaxes</A> )</C></Mark>
## <Item>
## Called with the string <A>gapname</A> (the &GAP; name of the group)
## and the integer <A>nrMaxes</A> (the number of classes of maximal
## subgroups of the group),
## <C>AGR.MXN</C> stores the information in
## <C>AtlasOfGroupRepresentationsInfo.GAPnames</C>.
## <P/>
## An example of a valid call is
## <C>AGR.MXN("A5.2",4)</C>.
## </Item>
## <#/GAPDoc>
##
AGR.MXN:= function( gapname, nrMaxes )
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
AGR.TST( gapname, nrMaxes, "nrMaxes", IsPosInt, "positive integer" );
fi;
AGR.GAPnamesRec.( gapname )[3].nrMaxes:= nrMaxes;
end;
#############################################################################
##
#F AGR.MXO( <gapname>, <sizesMaxes> )
##
## <#GAPDoc Label="AGR.MXO">
## <Mark><C>AGR.MXO( <A>gapname</A>, <A>sizesMaxes</A> )</C></Mark>
## <Item>
## Called with the string <A>gapname</A> (the &GAP; name of the group)
## and the list <A>sizesMaxes</A> (of subgroup orders of the classes of
## maximal subgroups of the group, not necessarily dense,
## in non-increasing order),
## <C>AGR.MXO</C> stores the information in
## <C>AtlasOfGroupRepresentationsInfo.GAPnames</C>.
## <P/>
## An example of a valid call is
## <C>AGR.MXO("A5.2",[60,24,20,12])</C>.
## </Item>
## <#/GAPDoc>
##
AGR.MXO:= function( gapname, sizesMaxes )
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
AGR.TST( gapname, sizesMaxes, "sizesMaxes",
x -> IsList( x ) and ForAll( x, IsPosInt )
and IsSortedList( Reversed( Compacted( x ) ) ),
"list of non-increasing pos. integers" );
fi;
AGR.GAPnamesRec.( gapname )[3].sizesMaxes:= sizesMaxes;
end;
#############################################################################
##
#F AGR.MXS( <gapname>, <structureMaxes> )
##
## <#GAPDoc Label="AGR.MXS">
## <Mark><C>AGR.MXS( <A>gapname</A>, <A>structureMaxes</A> )</C></Mark>
## <Item>
## Called with the string <A>gapname</A> (the &GAP; name of the group)
## and the list <A>structureMaxes</A> (of strings describing the
## structures of the maximal subgroups of the group, not necessarily dense),
## <C>AGR.MXS</C> stores the information in
## <C>AtlasOfGroupRepresentationsInfo.GAPnames</C>.
## <P/>
## An example of a valid call is
## <C>AGR.MXS("A5.2",["A5","S4","5:4","S3x2"])</C>.
## </Item>
## <#/GAPDoc>
##
AGR.MXS:= function( gapname, structureMaxes )
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
AGR.TST( gapname, structureMaxes, "structureMaxes",
x -> IsList( x ) and ForAll( x, IsString ),
"list of strings" );
fi;
AGR.GAPnamesRec.( gapname )[3].structureMaxes:= structureMaxes;
end;
#############################################################################
##
## AGR.KERPRG( <gapname>, <kernelProgram> )
##
## <#GAPDoc Label="AGR.KERPRG">
## <Mark><C>AGR.KERPRG( <A>gapname</A>, <A>kernelProgram</A> )</C></Mark>
## <Item>
## Called with the string <A>gapname</A> (the &GAP; name of the group)
## and the list <A>kernelProgram</A> (with entries the standardization of
## the group, the &GAP; name of a factor group, and the list of lines of a
## straight line program that computes generators of the kernel of the
## epimorphism from the group to the factor group),
## <C>AGR.KERPRG</C> stores the information in
## <C>AtlasOfGroupRepresentationsInfo.GAPnames</C>.
## <P/>
## An example of a valid call is
## <C>AGR.KERPRG("2.J2",[1,"J2",[[[1,2]]]])</C>.
## </Item>
## <#/GAPDoc>
##
AGR.KERPRG:= function( gapname, kernelProgram )
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) and
not ( IsList( kernelProgram ) and Length( kernelProgram ) = 3 and
IsPosInt( kernelProgram[1] ) and
IsString( kernelProgram[2] ) and
IsDenseList( kernelProgram[3] ) ) then
Error( "<kernelProgram> must be a suitable list" );
fi;
if not IsBound( AGR.GAPnamesRec.( gapname )[3].kernelPrograms ) then
AGR.GAPnamesRec.( gapname )[3].kernelPrograms:= [];
fi;
Add( AGR.GAPnamesRec.( gapname )[3].kernelPrograms, kernelProgram );
end;
#############################################################################
##
#F AGR.STDCOMP( <gapname>, <factorCompatibility> )
##
## <#GAPDoc Label="AGR.STDCOMP">
## <Mark><C>AGR.STDCOMP</C></Mark>
## <Item>
## Called with the string <A>gapname</A> (the &GAP; name of the group)
## and the list <A>factorCompatibility</A> (with entries
## the standardization of the group, the &GAP; name of a factor group,
## the standardization of this factor group, and
## <K>true</K> or <K>false</K>, indicating whether mapping the standard
## generators for <A>gapname</A> to those of <A>factgapname</A> defines an
## epimorphism),
## <C>AGR.STDCOMP</C> stores the information in
## <C>AtlasOfGroupRepresentationsInfo.GAPnames</C>.
## <P/>
## An example of a valid call is
## <C>AGR.STDCOMP("2.A5.2",[1,"A5.2",1,true])</C>.
## </Item>
## <#/GAPDoc>
##
AGR.STDCOMP:= function( gapname, factorCompatibility )
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) and
not ( IsList( factorCompatibility ) and
Length( factorCompatibility ) = 4 and
IsPosInt( factorCompatibility[1] ) and
IsString( factorCompatibility[2] ) and
IsPosInt( factorCompatibility[3] ) and
IsBool( factorCompatibility[4] ) ) then
Error( "<factorCompatibility> must be a suitable list" );
fi;
if not IsBound( AGR.GAPnamesRec.( gapname )[3].factorCompatibility ) then
AGR.GAPnamesRec.( gapname )[3].factorCompatibility:= [];
fi;
Add( AGR.GAPnamesRec.( gapname )[3].factorCompatibility,
factorCompatibility );
end;
#############################################################################
##
#F AGR.RNG( <repname>, <descr> )
##
## <#GAPDoc Label="AGR.RNG">
## <Mark><C>AGR.RNG( <A>repname</A>, <A>descr</A> )</C></Mark>
## <Item>
## Called with two strings <A>repname</A> (denoting the name
## of a file containing the generators of a matrix representation over a
## ring that is not determined by the filename)
## and <A>descr</A> (describing this ring <M>R</M>, say),
## <C>AGR.RNG</C> adds the triple
## <M>[ <A>repname</A>, <A>descr</A>, R ]</M>
## to the list stored in the <C>ringinfo</C> component of
## <Ref Var="AtlasOfGroupRepresentationsInfo"/>.
## <P/>
## An example of a valid call is
## <C>AGR.RNG("A5G1-Ar3aB0","Field([Sqrt(5)])")</C>.
## </Item>
## <#/GAPDoc>
##
AGR.RNG:= function( repname, descr )
local triple;
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
# Check that this representation really exists.
if not AGR.IsRepNameAvailable( repname ) then
return;
fi;
fi;
triple:= [ repname, descr, EvalString( descr ) ];
if triple in AtlasOfGroupRepresentationsInfo.ringinfo then
Info( InfoAtlasRep, 1,
"triple `", triple, "' cannot be notified more than once" );
else
Add( AtlasOfGroupRepresentationsInfo.ringinfo, triple );
fi;
end;
#############################################################################
##
#F AGR.TOCEXT( <atlasname>, <std>, <maxnr>, <files> )
##
## <#GAPDoc Label="AGR.TOCEXT">
## <Mark><C>AGR.TOCEXT( <A>atlasname</A>, <A>std</A>, <A>maxnr</A>, <A>files</A> )</C></Mark>
## <Item>
## Called with the string <A>atlasname</A> (the &ATLAS; name of the
## group), the positive integers <A>std</A> (the standardization) and
## <A>maxnr</A> (the number of the class of maximal subgroups), and
## the list <A>files</A> (of filenames of straight line programs for
## computing generators of the <A>maxnr</A>-th maximal subgroup, using
## a straight line program for a factor group plus perhaps some straight
## line program for computing kernel generators),
## <C>AGR.TOCEXT</C> stores the information in the <C>maxext</C> component
## of the <A>atlasname</A> component of the <C>"remote"</C>
## table of contents.
## <P/>
## An example of a valid call is
## <C>AGR.TOCEXT("2A5",1,3,["A5G1-max3W1"])</C>.
## </Item>
## <#/GAPDoc>
##
AGR.TOCEXT:= function( atlasname, std, maxnr, files )
local r, info;
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
if not ( IsString( atlasname ) and IsPosInt( std )
and IsPosInt( maxnr )
and IsList( files )
and ForAll( files, IsString ) ) then
Error( "not a valid t.o.c.ext entry" );
elif ForAll( AtlasOfGroupRepresentationsInfo.GAPnames,
x -> x[2] <> atlasname ) then
Error( "`", atlasname, "' is not a valid group name" );
fi;
# Check that the required programs really exist.
if not AGR.IsPrgNameAvailable( files[1] ) then
# The program for the max. subgroup of the factor is not available.
return;
elif IsBound( files[2] ) then
# Check whether the required program for computing kernel generators
# is available.
info:= First( AtlasOfGroupRepresentationsInfo.GAPnames,
x -> x[2] = atlasname )[3];
if not ( IsBound( info.kernelPrograms ) and
ForAny( info.kernelPrograms, x -> x[2] = files[2] ) ) then
Print( "#E kernel program required by `", atlasname, "' and `",
files, "' not available\n" );
return;
fi;
fi;
fi;
r:= AtlasTableOfContents( "remote" ).TableOfContents;
if not IsBound( r.( atlasname ) ) then
r.( atlasname ):= rec();
fi;
r:= r.( atlasname );
if not IsBound( r.maxext ) then
r.maxext:= [];
fi;
Add( r.maxext, [ std, maxnr, files ] );
end;
#############################################################################
##
#F AGR.API( <repname>, <info> )
##
## <#GAPDoc Label="AGR.API">
## <Mark><C>AGR.API( <A>repname</A>, <A>info</A> )</C></Mark>
## <Item>
## Called with the string <A>repname</A> (denoting the name of a
## permutation representation)
## and the list <A>info</A> (describing the point stabilizer of this
## representation),
## <C>AGR.API</C> binds the component <A>repname</A> of the record
## <C>AtlasOfGroupRepresentationsInfo.permrepinfo</C> to <A>info</A>.
## <P/>
## <A>info</A> has the following entries.
## <List>
## <Item>
## At position <M>1</M>, the transitivity is stored.
## </Item>
## <Item>
## If the transitivity is zero then the second entry is the list of
## orbit lengths.
## </Item>
## <Item>
## If the transitivity is positive then the second entry is the rank
## of the action.
## </Item>
## <Item>
## If the transitivity is positive then the third entry is one of the
## strings <C>"prim"</C>, <C>"imprim"</C>, denoting primitivity or not.
## </Item>
## <Item>
## If the transitivity is positive then the fourth entry is a string
## describing the structure of the point stabilizer.
## If the third entry is <C>"imprim"</C> then this description consists
## of a subgroup part and a maximal subgroup part, separated by
## <C>" < "</C>.
## </Item>
## <Item>
## If the third entry is <C>"prim"</C> then the fifth entry is either
## <C>"???"</C>
## or it denotes the number of the class of maximal subgroups
## that are the point stabilizers.
## </Item>
## </List>
## <P/>
## An example of a valid call is
## <C>AGR.API("A5G1-p5B0",[3,2,"prim","A4",1])</C>.
## </Item>
## <#/GAPDoc>
##
AGR.API:= function( repname, info )
local r;
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
if IsBound( AtlasOfGroupRepresentationsInfo.permrepinfo.( repname ) ) then
Error( "cannot notify `", repname, "' more than once" );
fi;
# Check that this representation really exists.
if not AGR.IsRepNameAvailable( repname ) then
return;
fi;
fi;
r:= rec( transitivity:= info[1] );
if info[1] = 0 then
r.orbits:= info[2];
else
r.rankAction:= info[2];
r.isPrimitive:= ( info[3] = "prim" );
r.stabilizer:= info[4];
if r.isPrimitive then
r.maxnr:= info[5];
fi;
fi;
AtlasOfGroupRepresentationsInfo.permrepinfo.( repname ):= r;
end;
#############################################################################
##
#F AGR.CHAR( <groupname>, <repname>, <char>, <pos>[, <charname>] )
##
## <#GAPDoc Label="AGR.CHAR">
## <Mark><C>AGR.CHAR( <A>groupname</A>, <A>repname</A>, <A>char</A>, <A>pos</A>[, <A>charname</A>] )</C></Mark>
## <Item>
## Called with the strings <A>groupname</A> (the &GAP; name of the group)
## and <A>repname</A> (denoting the name of the representation),
## the integer <A>char</A> (the characteristic of the representation),
## and <A>pos</A> (the position or list of positions of the irreducible
## constituent(s)),
## <C>AGR.CHAR</C> stores the information in
## <C>AtlasOfGroupRepresentationsInfo.characterinfo</C>.
## A string describing the character can be entered as <A>charname</A>.
## <P/>
## An example of a valid call is
## <C>AGR.CHAR("M11","M11G1-p11B0",0,[1,2],"1a+10a")</C>.
## </Item>
## <#/GAPDoc>
##
AGR.CHAR:= function( arg )
local map, groupname, repname, char, pos;
map:= AtlasOfGroupRepresentationsInfo.characterinfo;
groupname:= arg[1];
repname:= arg[2];
char:= arg[3];
pos:= arg[4];
if not IsBound( map.( groupname ) ) then
map.( groupname ):= [];
fi;
map:= map.( groupname );
if char = 0 then
char:= 1;
fi;
if not IsBound( map[ char ] ) then
map[ char ]:= [ [], [], [] ];
fi;
map:= map[ char ];
if IsBound( AtlasOfGroupRepresentationsInfo.checkData ) then
# Check whether we have already a character for this representation.
# (Two different representations with the same character are allowed.)
if arg[2] in map[2] and map[1][ Position( map[2], repname ) ] <> pos then
Error( "attempt to enter two different characters for ", arg[2] );
fi;
# Check that this representation really exists.
if not AGR.IsRepNameAvailable( repname ) then
return;
fi;
fi;
Add( map[1], pos );
Add( map[2], repname );
if Length( arg ) = 5 then
Add( map[3], arg[5] );
else
Add( map[3], fail );
fi;
end;
#############################################################################
##
#F AGR.CompareAsNumbersAndNonnumbers( <nam1>, <nam2> )
##
## This function is available as `BrowseData.CompareAsNumbersAndNonnumbers'
## if the Browse package is available.
## But we must deal also with the case that this package is not available.
##
AGR.CompareAsNumbersAndNonnumbers:= function( nam1, nam2 )
local len1, len2, len, digit, comparenumber, i;
len1:= Length( nam1 );
len2:= Length( nam2 );
len:= len1;
if len2 < len then
len:= len2;
fi;
digit:= false;
comparenumber:= 0;
for i in [ 1 .. len ] do
if nam1[i] in DIGITS then
if nam2[i] in DIGITS then
digit:= true;
if comparenumber = 0 then
# first digit of a number, or previous digits were equal
if nam1[i] < nam2[i] then
comparenumber:= 1;
elif nam1[i] <> nam2[i] then
comparenumber:= -1;
fi;
fi;
else
# if digit then the current number in `nam2' is shorter,
# so `nam2' is smaller;
# if not digit then a number starts in `nam1' but not in `nam2',
# so `nam1' is smaller
return not digit;
fi;
elif nam2[i] in DIGITS then
# if digit then the current number in `nam1' is shorter,
# so `nam1' is smaller;
# if not digit then a number starts in `nam2' but not in `nam1',
# so `nam2' is smaller
return digit;
else
# both characters are non-digits
if digit then
# first evaluate the current numbers (which have the same length)
if comparenumber = 1 then
# nam1 is smaller
return true;
elif comparenumber = -1 then
# nam2 is smaller
return false;
fi;
digit:= false;
fi;
# now compare the non-digits
if nam1[i] <> nam2[i] then
return nam1[i] < nam2[i];
fi;
fi;
od;
if digit then
# The suffix of the shorter string is a number.
# If the longer string continues with a digit then it is larger,
# otherwise the first digits of the number decide.
if len < len1 and nam1[ len+1 ] in DIGITS then
# nam2 is smaller
return false;
elif len < len2 and nam2[ len+1 ] in DIGITS then
# nam1 is smaller
return true;
elif comparenumber = 1 then
# nam1 is smaller
return true;
elif comparenumber = -1 then
# nam2 is smaller
return false;
fi;
fi;
# Now the longer string is larger.
return len1 < len2;
end;
#############################################################################
##
#F AGR.SetGAPnamesSortDisp()
##
## Bind the component `AtlasOfGroupRepresentationsInfo.GAPnamesSortDisp'.
##
AGR.SetGAPnamesSortDisp:= function()
local list;
list:= ShallowCopy( AtlasOfGroupRepresentationsInfo.GAPnames );
SortParallel( List( list, x -> x[1] ), list,
AGR.CompareAsNumbersAndNonnumbers );
AtlasOfGroupRepresentationsInfo.GAPnamesSortDisp:= list;
end;
#############################################################################
##
#F AGR.ParseFilenameFormat( <string>, <format> )
##
AGR.ParseFilenameFormat:= function( string, format )
local result, i, res;
string:= SplitString( string, "-" );
if Length( string ) <> Length( format[1] ) then
return fail;
fi;
result:= [];
for i in [ 1 .. Length( string ) ] do
# Loop over the '-' separated components.
res:= format[2][i]( string[i], format[1][i] );
if res = fail then
return fail;
fi;
Append( result, res );
od;
return result;
end;
#############################################################################
##
#F AtlasDataGAPFormatFile( <filename> )
##
InstallGlobalFunction( AtlasDataGAPFormatFile, function( filename )
local record;
InfoRead1( "#I reading `", filename, "' started\n" );
record:= ReadAsFunction( filename );
InfoRead1( "#I reading `", filename, "' done\n" );
if record = fail then
Info( InfoAtlasRep, 1,
"problem reading `", filename, "' as function\n" );
else
record:= record();
fi;
return record;
end );
#############################################################################
##
#F AtlasStringOfFieldOfMatrixEntries( <mats> )
#F AtlasStringOfFieldOfMatrixEntries( <filename> )
##
InstallGlobalFunction( AtlasStringOfFieldOfMatrixEntries, function( mats )
local F, n, str;
if IsString( mats ) then
mats:= AtlasDataGAPFormatFile( mats ).generators;
fi;
if IsCyclotomicCollCollColl( mats ) then
F:= Field( Rationals, Flat( mats ) );
elif ForAll( mats, IsQuaternionCollColl ) then
F:= Field( Flat( List( Flat( mats ), ExtRepOfObj ) ) );
else
Error( "<mats> must be a matrix list of cyclotomics or quaternions" );
fi;
n:= Conductor( F );
if DegreeOverPrimeField( F ) = 2 then
# The field is quadratic,
# so it is generated by `Sqrt(n)' if $`n' \equiv 1 \pmod{4}$,
# by `Sqrt(-n)' if $`n' \equiv 3 \pmod{4}$,
# and by one of `Sqrt(n/4)', `Sqrt(-n/4)' otherwise.
if n mod 4 = 1 then
str:= Concatenation( "[Sqrt(", String( n ), ")]" );
elif n mod 4 = 3 then
str:= Concatenation( "[Sqrt(-", String( n ), ")]" );
elif Sqrt( -n/4 ) in F then
str:= Concatenation( "[Sqrt(-", String( n/4 ), ")]" );
else
str:= Concatenation( "[Sqrt(", String( n/4 ), ")]" );
fi;
elif IsCyclotomicField( F ) then
# The field is not quadratic but cyclotomic.
str:= Concatenation( "[E(", String( n ), ")]" );
else
str:= "";
fi;
if IsCyclotomicCollCollColl( mats ) then
if str = "" then
str:= String( F );
else
str:= Concatenation( "Field(", str, ")" );
fi;
elif F = Rationals then
str:= "QuaternionAlgebra(Rationals)";
elif str = "" then
str:= Concatenation( "QuaternionAlgebra(", String( F ), ")" );
else
str:= Concatenation( "QuaternionAlgebra(", str, ")" );
fi;
return [ F, str ];
end );
#############################################################################
##
#F AtlasOfGroupRepresentationsScanFilename( <name>, <result> )
##
BindGlobal( "AtlasOfGroupRepresentationsScanFilename",
function( name, result )
local filename, pos, type, format, groupname;
filename:= name;
pos:= Position( filename, '/' );
while pos <> fail do
filename:= filename{ [ pos+1 .. Length( filename ) ] };
pos:= Position( filename, '/' );
od;
for type in AGR.DataTypes( "rep", "prg" ) do
format:= AGR.ParseFilenameFormat( filename, type[2].FilenameFormat );
if format <> fail then
groupname:= format[1];
if not IsBound( result.( groupname ) ) then
result.( groupname ):= rec();
fi;
if not IsBound( result.( groupname ).( type[1] ) ) then
result.( groupname ).( type[1] ):= [];
fi;
return type[2].AddFileInfo( result.( groupname ).( type[1] ),
format, name );
fi;
od;
return false;
end );
#############################################################################
##
#F AtlasOfGroupRepresentationsUpdateTableOfContentsFile( <dstfilename> )
##
## Fetch the current table of contents from the package's home directory,
## and write it to the file <A>dstfilename</A>,
## which is interpreted as an absolute path.
##
## This function is used by the script <F>etc/maketoc</F> and in the call
## <C>AtlasTableOfContents( "remote" )</C>.
##
BindGlobal( "AtlasOfGroupRepresentationsUpdateTableOfContentsFile",
function( dstfilename )
local version, inforec, home, server, path;
version:= InstalledPackageVersion( "atlasrep" );
inforec:= First( PackageInfo( "atlasrep" ), r -> r.Version = version );
home:= inforec.PackageWWWHome;
if home{ [ 1 .. 7 ] } = "http://" then
home:= home{ [ 8 .. Length( home ) ] };
fi;
server:= home{ [ 1 .. Position( home, '/' ) - 1 ] };
path:= home{ [ Position( home, '/' ) + 1 .. Length( home ) ] };
# Fetch the file if possible.
return AtlasOfGroupRepresentationsTransferFile( server,
Concatenation( path, "/atlasprm.g" ),
dstfilename );
end );
#############################################################################
##
#F AtlasOfGroupRepresentationsComposeTableOfContents( <filelist>,
#F <groupnames> )
##
## This code is used by `AtlasTableOfContents'.
##
BindGlobal( "AtlasOfGroupRepresentationsComposeTableOfContents",
function( filelist, groupnames )
local result, name, len, groupname, record, type, listtosort;
# Initialize the result record.
result:= rec( otherfiles:= [] );
# Deal with the case of `gzip'ped files, and omit obvious garbage.
for name in Set( filelist ) do
len:= Length( name );
if 3 <= len and name{ [ len-2 .. len ] } = ".gz" then
name:= name{ [ 1 .. len-3 ] };
fi;
if AtlasOfGroupRepresentationsScanFilename( name, result ) = false then
if not ( name in [ "dummy", ".", "..", "CVS", "CVS:", "./CVS:",
"Entries", "Repository", "Root", "toc.g",
".cvsignore" ] or
name[ Length( name ) ] = '%' or
( 3 <= Length( name )
and name{ Length( name ) + [ - 2 .. 0 ] } = "BAK" ) ) then
Info( InfoAtlasRep, 3,
"t.o.c. construction: ignoring name `", name, "'" );
AddSet( result.otherfiles, name );
fi;
fi;
od;
# Postprocessing,
# and *sort* the representations as given in the type definition.
for groupname in List( groupnames, x -> x[3] ) do
if IsBound( result.( groupname ) ) then
record:= result.( groupname );
for type in AGR.DataTypes( "rep", "prg" ) do
if IsBound( record.( type[1] ) ) then
type[2].PostprocessFileInfo( result, record );
# Sort the data of the given type as defined.
if IsBound( type[2].SortTOCEntries ) then
listtosort:= List( record.( type[1] ), type[2].SortTOCEntries );
SortParallel( listtosort, record.( type[1] ) );
fi;
fi;
od;
fi;
od;
# Store the current date in Coordinated Universal Time
# (Greenwich Mean Time).
result.lastupdated:= CurrentDateTimeString();
return result;
end );
#############################################################################
##
#F AtlasTableOfContents( <dirname> )
##
InstallGlobalFunction( AtlasTableOfContents, function( string )
local toc, groupnames, prefix, filenames, dstdir, dstfile, tocremote,
typeinfo, groupname, r, pair, type, entry, fileinfo, filename, loc,
dirname, privdir, dir, result;
toc:= AtlasOfGroupRepresentationsInfo.TableOfContents;
# Take the stored version if it is already available.
groupnames:= AtlasOfGroupRepresentationsInfo.groupnames;
if IsBound( toc.( string ) ) then
return rec( groupnames := groupnames,
TableOfContents := toc.( string ) );
fi;
prefix:= "";
filenames:= [];
if string = "remote" then
# Someone has unbound the value, we interpret this as the wish
# to transfer the current file `atlasprm.g' from the package homepage,
# and to read it.
# If we are allowed to overwrite the file from the installation
# then we do this, otherwise we use a temporary file.
dstdir:= DirectoriesPackageLibrary( "atlasrep", "gap" );
dstfile:= Filename( dstdir, "atlasprm.g" );
if not IsWritableFile( dstfile ) then
dstfile:= Filename( DirectoryTemporary(), "atlasprm.g" );
fi;
if not AtlasOfGroupRepresentationsUpdateTableOfContentsFile( dstfile )
then
return fail;
fi;
ReplaceAtlasTableOfContents( dstfile );
return rec( groupnames := AtlasOfGroupRepresentationsInfo.groupnames,
TableOfContents := toc.remote );
elif string = "local" then
# List the information that is locally available,
# by testing which of the files in the remote t.o.c. are stored.
tocremote:= AtlasTableOfContents( "remote" ).TableOfContents;
typeinfo:= Concatenation(
List( AGR.DataTypes( "rep" ), x -> [ "datagens", x ] ),
List( AGR.DataTypes( "prg" ), x -> [ "dataword", x ] ) );
for groupname in RecNames( tocremote ) do
r:= tocremote.( groupname );
if IsRecord( r ) then
for pair in typeinfo do
type:= pair[2];
if IsBound( r.( type[1] ) ) then
for entry in r.( type[1] ) do
fileinfo:= entry[ Length( entry ) ];
if IsString( fileinfo ) then
fileinfo:= [ fileinfo ];
fi;
for filename in fileinfo do
loc:= AtlasOfGroupRepresentationsLocalFilename( pair[1],
groupname, filename, type );
if not IsEmpty( loc ) and ForAll( loc[1][2], x -> x[2] ) then
Add( filenames, filename );
fi;
od;
od;
fi;
od;
fi;
od;
else
# List the contents of the private data directories.
dirname:= First( AtlasOfGroupRepresentationsInfo.private,
pair -> pair[2] = string )[1];
if IsExistingFile( dirname ) then
# List the information available in the given private directory.
# (Up to one directory layer above the data files is supported.)
filenames:= [];
privdir:= Directory( dirname );
for dir in Difference( DirectoryContents( dirname ), [ ".", ".." ] ) do
dstfile:= Filename( privdir, dir );
if IsDirectoryPath( dstfile ) then
Append( filenames, List( DirectoryContents( dstfile ),
x -> Concatenation( dir, "/", x ) ) );
else
Add( filenames, dir );
fi;
od;
fi;
fi;
# Compose the result record.
result:= AtlasOfGroupRepresentationsComposeTableOfContents( filenames,
groupnames );
result.diridPrivate:= string;
# Store the newly computed table of contents.
toc.( string ):= result;
# Return the result record.
return rec( groupnames := groupnames,
TableOfContents := result );
end );
#############################################################################
##
#F ReloadAtlasTableOfContents( \"local\" )
#F ReloadAtlasTableOfContents( \"remote\" )
##
InstallGlobalFunction( ReloadAtlasTableOfContents, function( string )
local toc, old, new;
toc:= AtlasOfGroupRepresentationsInfo.TableOfContents;
if IsBound( toc.( string ) ) then
old:= toc.( string );
Unbind( toc.( string ) );
fi;
new:= AtlasTableOfContents( string );
if new = fail then
if IsBound( old ) then
toc.( string ):= old;
fi;
Info( InfoAtlasRep, 1,
"could not reload ", string, " table of contents" );
return fail;
fi;
toc.( string ):= new.TableOfContents;
if string = "remote" then
AtlasOfGroupRepresentationsInfo.groupnames:= new.groupnames;
fi;
return true;
end );
#############################################################################
##
#F StoreAtlasTableOfContents( <filename> )
##
## Note that we must put everything into a single file because this is the
## one that can be fetched automatically by users.
##
InstallGlobalFunction( StoreAtlasTableOfContents, function( filename )
if IsExistingFile( filename ) and not IsWritableFile( filename ) then
Error( "<filename> must be writable if exists" );
elif not IsBound( AtlasOfGroupRepresentationsInfo.TableOfContents.(
"remote" ) ) then
Error( "no remote t.o.c. exists" );
fi;
# Add the data.
FileString( filename, StringOfAtlasTableOfContents( "remote" ) );
end );
#############################################################################
##
#F ReplaceAtlasTableOfContents( <filename> )
##
InstallGlobalFunction( ReplaceAtlasTableOfContents, function( filename )
local priv, pair;
if not IsReadableFile( filename ) then
Error( "<filename> must be the name of a readable file" );
fi;
# Remove the information we are going to add by reading the file.
AtlasOfGroupRepresentationsInfo.TableOfContents.( "remote" ):= rec();
priv:= AtlasOfGroupRepresentationsInfo.private;
AtlasOfGroupRepresentationsInfo.GAPnames := [];
AtlasOfGroupRepresentationsInfo.GAPnamesSortDisp:= [];
AtlasOfGroupRepresentationsInfo.groupnames := [];
AtlasOfGroupRepresentationsInfo.ringinfo := [];
AtlasOfGroupRepresentationsInfo.private := [];
AtlasOfGroupRepresentationsInfo.characterinfo:= rec();
AtlasOfGroupRepresentationsInfo.permrepinfo:= rec();
AGR.MapNameToGAPName:= [ [], [] ];
AGR.GAPnamesRec:= rec();
# Replace the old version by the new one.
AtlasOfGroupRepresentationsInfo.checkData:= true;
Reread( filename );
Unbind( AtlasOfGroupRepresentationsInfo.checkData );
# Reinsert the information from private directories.
for pair in priv do
AtlasOfGroupRepresentationsNotifyPrivateDirectory( pair[1], pair[2] );
od;
end );
#############################################################################
##
#F StringOfAtlasTableOfContents( <string> )
##
InstallGlobalFunction( StringOfAtlasTableOfContents, function( string )
local str, pos, toc, sepline, triple, groupname, reps, type, entry,
lines, nam, line, r, map, i, j;
# Currently only the argument `"remote"' is supported.
if string <> "remote" then
Error( "sorry, private tables of contents are not yet supported here" );
fi;
# Copy the constant part of the data to the desired file.
str:= StringFile( Filename( DirectoriesPackageLibrary( "atlasrep", "gap" ),
"atlasprm.g" ) );
pos:= PositionSublist( str, "AGR.SetGAPnamesSortDisp();" );
pos:= Position( str, '\n', pos );
str:= str{ [ 1 .. pos ] };
toc:= AtlasTableOfContents( string ).TableOfContents;
sepline:= RepeatedString( "#", 77 );
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str, "Store group orders.\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( AGR.GAPnamesRec ) do
if IsBound( AGR.GAPnamesRec.( nam )[3].size ) then
entry:= AGR.GAPnamesRec.( nam )[3].size;
Add( lines, Concatenation( "AGR.GRS(\"", nam, "\",",
String( entry ), ");\n" ) );
fi;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str, "Store numbers of classes of maximal subgroups.\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( AGR.GAPnamesRec ) do
if IsBound( AGR.GAPnamesRec.( nam )[3].nrMaxes ) then
entry:= AGR.GAPnamesRec.( nam )[3].nrMaxes;
Add( lines, Concatenation( "AGR.MXN(\"", nam, "\",",
String( entry ), ");\n" ) );
fi;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str, "Store orders of maximal subgroups.\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( AGR.GAPnamesRec ) do
if IsBound( AGR.GAPnamesRec.( nam )[3].sizesMaxes ) then
entry:= AGR.GAPnamesRec.( nam )[3].sizesMaxes;
Add( lines, Concatenation( "AGR.MXO(\"", nam, "\",",
ReplacedString( String( entry ), " ", "" ), ");\n" ) );
fi;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str, "Store structures of maximal subgroups.\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( AGR.GAPnamesRec ) do
if IsBound( AGR.GAPnamesRec.( nam )[3].structureMaxes ) then
entry:= AGR.GAPnamesRec.( nam )[3].structureMaxes;
Add( lines, Concatenation( "AGR.MXS(\"", nam, "\",",
ReplacedString( String( entry ), " ", "" ), ");\n" ) );
fi;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str, "Store information about generators of kernels.\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( AGR.GAPnamesRec ) do
if IsBound( AGR.GAPnamesRec.( nam )[3].kernelPrograms ) then
for entry in AGR.GAPnamesRec.( nam )[3].kernelPrograms do
Add( lines, Concatenation( "AGR.KERPRG(\"", nam, "\",",
ReplacedString( String( entry ), " ", "" ), ");\n" ) );
od;
fi;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str, "In the following, the table of contents is built\n" );
Append( str, "## using `AGR.GRP' and `AGR.TOC'.\n" );
Append( str, "## This part of the file is created by the function\n" );
Append( str, "## `StringOfAtlasTableOfContents',\n" );
Append( str, "## do not edit below this line!\n" );
Append( str, "##\n\n" );
for triple in AtlasOfGroupRepresentationsInfo.groupnames do
# Start with the notification of the group.
Append( str, "# " );
Append( str, triple[3] );
Append( str, "\n" );
Append( str, "AGR.GRP(\"" );
Append( str, triple[1] );
Append( str, "\",\"" );
Append( str, triple[2] );
Append( str, "\",\"" );
Append( str, triple[3] );
Append( str, "\");\n" );
# Append the notifications of data entries for the group.
groupname:= triple[3];
if IsBound( toc.( groupname ) ) then
reps:= toc.( groupname );
for type in AGR.DataTypes( "rep", "prg" ) do
if IsBound( reps.( type[1] ) ) then
for entry in reps.( type[1] ) do
if IsBound( type[2].TOCEntryString ) then
Append( str, type[2].TOCEntryString( type[1], entry ) );
else
Info( InfoAtlasRep, 1,
"no component `TOCEntryString' for data type `",
type[1], "'" );
fi;
od;
fi;
od;
fi;
Append( str, "\n" );
od;
Append( str, "\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str,
"What follows now are the representation dependent additional data.\n" );
Append( str, "## They must be read after the notification of the representations,\n" );
Append( str, "## in order to give us a chance to check the existence of the underlying\n");
Append( str, "## representation.\n" );
Append( str, "##\n" );
# Append the compatibility information w.r.t. factors.
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str, "Store info about compatibility of generators with those of factor groups.\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( AGR.GAPnamesRec ) do
if IsBound( AGR.GAPnamesRec.( nam )[3].factorCompatibility ) then
for entry in AGR.GAPnamesRec.( nam )[3].factorCompatibility do
Add( lines, Concatenation( "AGR.STDCOMP(\"", nam, "\",",
ReplacedString( String( entry ), " ", "" ), ");\n" ) );
od;
fi;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
# Append the information about the base rings of char. zero repres.
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str, "Store information about the rings over which characteristic zero\n" );
Append( str, "## representations are written if known.\n" );
Append( str, "## Note that the filenames do not contain this information,\n" );
Append( str, "## so it has to be stored explicitly.\n" );
Append( str, "##\n" );
lines:= [];
for entry in AtlasOfGroupRepresentationsInfo.ringinfo do
Add( lines, Concatenation( "AGR.RNG(\"", entry[1], "\",\"", entry[2],
"\");\n" ) );
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
# Append the information about compatibility of maxes scripts.
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str,
"Store information which straight line programs for restricting to maximal\n" );
Append( str,
"## subgroups of a group can be used also for restricting to maximal\n" );
Append( str, "## subgroups of downward extensions.\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( toc ) do
if IsRecord( toc.( nam ) ) and IsBound( toc.( nam ).maxext ) then
for entry in toc.( nam ).maxext do
Add( lines, Concatenation( "AGR.TOCEXT(\"", nam, "\",",
String( entry[1] ), ",", String( entry[2] ), ",",
ReplacedString( String( entry[3] ), " ", "" ), ");\n" ) );
od;
fi;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
# Append the primitivity information.
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## " );
Append( str,
"Store information about the point stabilizers of permutation\n" );
Append( str, "## representations if known.\n" );
Append( str,
"## Note that the filenames do not contain this information,\n" );
Append( str, "## so it has to be stored explicitly.\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( AtlasOfGroupRepresentationsInfo.permrepinfo ) do
r:= AtlasOfGroupRepresentationsInfo.permrepinfo.( nam );
if not IsBound( r.isPrivate ) then
line:= Concatenation( "AGR.API(\"", nam, "\",[" );
Append( line, String( r.transitivity ) );
Append( line, "," );
if r.transitivity = 0 then
Append( line, ReplacedString( String( r.orbits ), " ", "" ) );
Append( line, "]);\n" );
else
Append( line, String( r.rankAction ) );
Append( line, "," );
if r.isPrimitive then
Append( line, "\"prim\"" );
else
Append( line, "\"imprim\"" );
fi;
Append( line, ",\"" );
Append( line, r.stabilizer );
Append( line, "\"" );
if r.isPrimitive then
Append( line, "," );
if IsInt( r.maxnr ) then
Append( line, String( r.maxnr ) );
else
Append( line, "\"" );
Append( line, String( r.maxnr ) );
Append( line, "\"" );
fi;
fi;
Append( line, "]);\n" );
fi;
Add( lines, line );
fi;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
# Append the character information.
Append( str, "\n\n" );
Append( str, sepline );
Append( str, "\n##\n## precomputed character data\n" );
Append( str, "##\n" );
lines:= [];
for nam in RecNames( AtlasOfGroupRepresentationsInfo.characterinfo ) do
map:= AtlasOfGroupRepresentationsInfo.characterinfo.( nam );
for i in [ 1 .. Length( map ) ] do
if IsBound( map[i] ) then
for j in [ 1 .. Length( map[i][1] ) ] do
line:= Concatenation( "AGR.CHAR(\"", nam, "\",\"", map[i][2][j], "\"," );
#T only for the non-private ones!
if i = 1 then
Append( line, "0" );
else
Append( line, String( i ) );
fi;
Append( line, "," );
Append( line, ReplacedString( String( map[i][1][j] ), " ", "" ) );
if map[i][3][j] <> fail then
Append( line, ",\"" );
Append( line, map[i][3][j] );
Append( line, "\"" );
fi;
Append( line, ");\n" );
Add( lines, line );
od;
fi;
od;
od;
Sort( lines );
for line in lines do
Append( str, line );
od;
# Finally, append the current date and time.
Append( str, "\n\n" );
Append( str, "AtlasOfGroupRepresentationsInfo.TableOfContents.( \"" );
Append( str, string );
Append( str, "\" ).lastupdated:=\n \"" );
Append( str, toc.lastupdated );
Append( str, "\";\n\n" );
Append( str, sepline );
Append( str, "\n##\n#E\n\n" );
return str;
end );
#############################################################################
##
#F AGR.TablesOfContents( <descr> )
##
## Admissible arguments are
## 1 the string "all",
## 2 the string "public",
## 3 a string describing a private table of contents,
## (which occurs as the second component of an entry in
## `AtlasOfGroupRepresentationsInfo.private') or
## 4 a list of conditions such as [ <std>, "contents", <...> ]
## 5 a list of strings as 1-3.
##
AGR.TablesOfContents:= function( descr )
local pos, tocid, i, label, tocs, flag, toc, pair;
if descr = [] then
descr:= [ "all" ];
elif IsString( descr ) then
descr:= [ descr ];
elif not IsList( descr ) then
Error( "<descr> must be a string or a list of strings/conditions" );
fi;
pos:= Position( descr, "contents" );
if pos <> fail then
# `descr' is a list of conditions.
# Evaluate its "contents" part,
# i. e., restrict the tables of contents, and remove this condition.
tocid:= descr[ pos+1 ];
for i in [ pos .. Length( descr ) - 2 ] do
descr[i]:= descr[ i+2 ];
od;
Unbind( descr[ Length( descr ) ] );
Unbind( descr[ Length( descr ) ] );
if IsString( tocid ) then
descr:= [ tocid ];
else
descr:= tocid;
fi;
elif ForAny( descr, x -> x <> "all" and x <> "public"
and ForAll( AtlasOfGroupRepresentationsInfo.private,
pair -> x <> pair[2] ) ) then
# `descr' is a list of conditions that does not restrict the
# table of contents.
descr:= [ "all" ];
fi;
# Now `descr' is a list of identifiers of tables of contents.
label:= JoinStringsWithSeparator( SortedList( descr ), "|" );
if not IsBound( AtlasOfGroupRepresentationsInfo.TOC_Cache.( label ) ) then
tocs:= [];
if descr = "all" or descr = "public" or
"all" in descr or "public" in descr then
flag:= String( AtlasOfGroupRepresentationsInfo.remote );
if not IsBound( AtlasOfGroupRepresentationsInfo.TOC_Cache.(
flag ) ) then
if flag = "true" then
toc:= AtlasTableOfContents( "remote" ).TableOfContents;
else
toc:= AtlasTableOfContents( "local" ).TableOfContents;
fi;
AtlasOfGroupRepresentationsInfo.TOC_Cache.( flag ):= toc;
fi;
Add( tocs, AtlasOfGroupRepresentationsInfo.TOC_Cache.( flag ) );
fi;
for pair in AtlasOfGroupRepresentationsInfo.private do
if descr = "all" or "all" in descr or
descr = pair[2] or pair[2] in descr then
Add( tocs,
AtlasOfGroupRepresentationsInfo.TableOfContents.( pair[2] ) );
fi;
od;
AtlasOfGroupRepresentationsInfo.TOC_Cache.( label ):= tocs;
fi;
return AtlasOfGroupRepresentationsInfo.TOC_Cache.( label );
end;
#############################################################################
##
#F AtlasOfGroupRepresentationsNotifyPrivateDirectory( <dir>[, <dirid>]
#F [, <test>] )
##
InstallGlobalFunction( AtlasOfGroupRepresentationsNotifyPrivateDirectory,
function( arg )
local dirname, dirid, test, oldtest, olddata, dir, prm, toc,
allfilenames, RemovedDirectories,
groupname, record, type, entry, name, tocs, ok, oldtoc, names,
unknown, nam;
# Get and check the arguments.
if 1 <= Length( arg ) and Length( arg ) <= 3 and
( IsString( arg[1] ) or IsDirectory( arg[1] ) ) and
( Length( arg ) = 1 or ( IsString( arg[2] ) or IsBool( arg[2] ) ) ) and
( Length( arg ) < 3 or ( IsString( arg[2] ) and IsBool( arg[3] ) ) ) then
if IsString( arg[1] ) then
dirname:= ShallowCopy( arg[1] );
else
dir:= arg[1];
dirname:= ShallowCopy( dir![1] );
#T this is not clean!
#T (how to call DirectoryContents for a directory given as an object?)
fi;
if Length( arg ) = 1 then
dirid:= dirname;
elif IsString( arg[2] ) or Length( arg ) = 3 then
dirid:= arg[2];
else
dirid:= dirname;
fi;
if Length( arg ) = 1 then
test:= false;
elif IsBool( arg[2] ) then
test:= arg[2];
elif Length( arg ) = 3 then
test:= arg[3];
else
test:= false;
fi;
else
Error( "usage: AtlasOfGroupRepresentationsNotifyPrivateDirectory(\n",
" <dirname>[,<dirid>][,<test>])" );
fi;
# Add the directory name.
if IsEmpty( dirname ) then
Error( "<dirname> must not be empty" );
elif dirname[ Length( dirname ) ] <> '/' then
Add( dirname, '/' );
fi;
if ForAny( AtlasOfGroupRepresentationsInfo.private,
pair -> pair[2] = dirid and pair[1] <> dirname ) then
Error( dirid,
" is already the identifier of another private directory" );
fi;
AddSet( AtlasOfGroupRepresentationsInfo.private, [ dirname, dirid ] );
# Read the primary file (for group declarations and describing data).
# The file may contain calls of `AGR.GNAN' (which must come *before* the
# data for the groups in question can be notified) and of `AGR.API' and
# `AGR.CHAR' (which must come *afterwards*).
# So we must postpone the calls of `AGR.IsRepNameAvailable'.
oldtest:= IsBound( AtlasOfGroupRepresentationsInfo.checkData );
Unbind( AtlasOfGroupRepresentationsInfo.checkData );
olddata:= rec(
permrepinfo:= RecNames( AtlasOfGroupRepresentationsInfo.permrepinfo ),
);
#T same for characters!
prm:= Filename( dir, "toc.g" );
if IsExistingFile( prm ) = true then
Read( prm );
fi;
# Set up a table of contents for the private directory.
toc:= AtlasTableOfContents( dirid ).TableOfContents;
Unbind( toc.otherfiles );
# Check that no filename of this table of contents exists already in
# other tables of contents.
# 1. Compute the list of all filenames.
allfilenames:= [];
RemovedDirectories:= function( string )
string:= SplitString( string, "/" );
return string[ Length( string ) ];
end;
for groupname in RecNames( toc ) do
record:= toc.( groupname );
if IsRecord( record ) then
for type in RecNames( record ) do
for entry in record.( type ) do
name:= entry[ Length( entry ) ];
if IsString( name ) then
Add( allfilenames, RemovedDirectories( name ) );
else
Append( allfilenames, List( name, RemovedDirectories ) );
fi;
od;
od;
fi;
od;
# 2. Check whether the list is disjoint to the other tables of contents.
#T this is expensive
if AtlasOfGroupRepresentationsInfo.remote = true then
tocs:= [ AtlasTableOfContents( "remote" ).TableOfContents ];
else
tocs:= [ AtlasTableOfContents( "local" ).TableOfContents ];
fi;
Append( tocs, List( Filtered( AtlasOfGroupRepresentationsInfo.private,
pair -> pair[2] <> dirid ),
x -> AtlasOfGroupRepresentationsInfo.TableOfContents.( x[2] ) ) );
ok:= true;
for oldtoc in tocs do
for groupname in RecNames( toc ) do
if IsBound( oldtoc.( groupname ) ) then
record:= oldtoc.( groupname );
if IsRecord( record ) then
for type in RecNames( record ) do
for entry in record.( type ) do
names:= entry[ Length( entry ) ];
if IsString( names ) then
names:= [ names ];
fi;
for name in names do
if name in allfilenames then
ok:= false;
Info( InfoAtlasRep, 1,
"file `", name, "' was already in another t.o.c." );
#T better remove the entry for this file
fi;
od;
od;
od;
fi;
fi;
od;
od;
# Add group names that were not notified.
unknown:= Set( Filtered( RecNames( toc ),
x -> ForAll( AtlasOfGroupRepresentationsInfo.GAPnames,
pair -> x <> pair[2] ) ) );
RemoveSet( unknown, "diridPrivate" );
RemoveSet( unknown, "lastupdated" );
if not IsEmpty( unknown ) then
ok:= false;
Info( InfoAtlasRep, 1,
"no GAP names defined for ", unknown );
UniteSet( AtlasOfGroupRepresentationsInfo.GAPnames,
List( unknown, x -> [ x, x ] ) );
fi;
AGR.SetGAPnamesSortDisp();
AtlasOfGroupRepresentationsInfo.TOC_Cache:= rec();
AtlasOfGroupRepresentationsInfo.TableOfContents.merged:= rec();
# Run the postponed tests.
if test then
AtlasOfGroupRepresentationsInfo.checkData:= true;
for nam in Difference(
RecNames( AtlasOfGroupRepresentationsInfo.permrepinfo ),
olddata.permrepinfo ) do
AtlasOfGroupRepresentationsInfo.permrepinfo.( nam ).isPrivate:= true;
ok:= AGR.IsRepNameAvailable( nam ) and ok;
od;
#T check also the characters!
fi;
# Restore the original flag.
if not oldtest then
Unbind( AtlasOfGroupRepresentationsInfo.checkData );
fi;
# Return the flag.
return ok;
end );
#############################################################################
##
#F AtlasOfGroupRepresentationsForgetPrivateDirectory( <dirid> )
##
InstallGlobalFunction( AtlasOfGroupRepresentationsForgetPrivateDirectory,
function( dirid )
local private, i, dirname, dir, prm, str, file, GAPnames, pos, pos2,
gapname, j;
Unbind( AtlasOfGroupRepresentationsInfo.TableOfContents.( dirid ) );
GAPnames:= AtlasOfGroupRepresentationsInfo.GAPnames;
private:= AtlasOfGroupRepresentationsInfo.private;
for i in [ 1 .. Length( private ) ] do
if private[i][2] = dirid then
# Remove the group declarations.
dirname:= private[i][1];
dir:= Directory( dirname );
prm:= Filename( dir, "toc.g" );
if IsExistingFile( prm ) = true then
str:= StringFile( prm );
pos:= PositionSublist( str, "GNAN" );
while pos <> fail do
while pos <= Length( str ) and str[ pos ] <> '"' do
pos:= pos + 1;
pos2:= Position( str, '"', pos );
if pos2 <> fail then
gapname:= str{ [ pos+1 .. pos2-1 ] };
for j in [ 1 .. Length( GAPnames ) ] do
if IsBound( GAPnames[j] ) and GAPnames[j][1] = gapname then
Unbind( GAPnames[j] );
Unbind( AGR.GAPnamesRec.( gapname ) );
break;
fi;
od;
fi;
od;
pos:= PositionSublist( str, "GNAN", pos2 );
od;
fi;
# Remove the information concerning the private directory.
Unbind( private[i] );
AtlasOfGroupRepresentationsInfo.private:= Compacted( private );
break;
fi;
od;
AtlasOfGroupRepresentationsInfo.GAPnames:= Compacted( GAPnames );
AGR.SetGAPnamesSortDisp();
AtlasOfGroupRepresentationsInfo.TOC_Cache:= rec();
AtlasOfGroupRepresentationsInfo.TableOfContents.merged:= rec();
end );
if IsString( SingleHTTPRequest ) then
Unbind( SingleHTTPRequest );
fi;
if IsString( IO_stat ) then
Unbind( IO_stat );
fi;
#############################################################################
##
#E
|