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
|
cccccccccccccccccccccccccccccccccccccccccccccccc
cc cc
cc pmxa.for 5/9/98 cc
cc cc
cc A production of Dr. Don's PC and cc
cc Harpsichord Emporium (dsimons@logicon.com) cc
cc cc
cc This is noware: No fee, no guarantee. cc
cc cc
cccccccccccccccccccccccccccccccccccccccccccccccc
cc
cc Need to consider X spaces in xtuplets when getting poenom, and
cc maybe fbar?
cc
cc Known changes since pmxa. Version 1.1b (see pmxb for longer list)
cc
cc Check ID codes for slurs.
cc Redefine iemin to include ALL notes groups as bitmap.
cc Version 1.24 still does not have details for spacing/positioning
cc arpeggios if there are accidentals or shifted notes or crowded scores.
cc Fix problem in 1.22 with arpeggios across multi-line staves
cc Fix problem in 1.22 with flat key signatures
cc Read setup data as strings
cc Warning for octave designation plus +/-
cc Don't pause for volta warning,
cc Macros
cc Correct fsyst to account for transposition and key changes.
cc Check for nbars > nsyst
cc
ccccccccccccccccccccccccccccccccccc
parameter (nm=7,nkb=500,nks=125,nbz=200)
logical loop,usefig
integer nn(nm),list(4,nbz),ipl(nm,nbz),nodur(nm,nbz),
* nnl(nm),itsofar(nm),nib(nm,15),lastbar(0:nks),nbarss(nks)
common /comnotes/ nnodur,wminnh(nkb),nnpd(2000),durb(2000),
* nptr(nkb),ibarcnt,ieminb(nkb),iemaxb(nkb),mbrest,ibarmbr,
* ibaroff,udsp(nkb),wheadpt
common /compage/ widthpt,ptheight,nsyst,nflb,ibarflb(0:40),
* isysflb(0:40),npages,nfpb,ipagfpb(0:10),isysfpb(0:10),
* usefig,fintstf,gintstf
common /comkeys/ nkeys,ibrkch(14),newkey(14),iskchb,idsig,isig1,
* kchmid(14),ornrpt,shifton,barend
real*4 elsk(nkb),celsk(0:nkb),elss(nks)
character*128 lnholdq
character*24 basenameq
logical rest(nm,nbz),firstline,fbon,isvolt,iskchb,kchmid,ornrpt
common /comget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
* inchord
logical lastchar,newmeter,newmb(nkb),issegno,bottreb,isheadr,
* inchord,shifton,barend
common /all/ iv,list,nnl,nv,ibar,ipl,mtrnuml,
* nodur,jn,lenbar,iccount,nbars,itsofar,nib,nn,
* rest,lenbr0,lenbr1,firstline,newmeter
common /linecom/ elskb
common /cblock/
* etatop,etabot,etait,etatc,etacs1,hgtin,hgtti,hgtco,
* xilbn,xilbtc,xilhdr,xilfig,a,b,inbothd,inhnoh
common /commvl/ nvmx(nm),ivmx(nm,2),ivx,fbar
common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
logical mrecord,mplay,endmac
jprntb = 81
macuse = 0
ornrpt = .false.
mrecord = .false.
mplay = .false.
lastchar = .false.
do 42 ibarcnt = 1 , nkb
udsp(ibarcnt) = 0.
wminnh(ibarcnt) = -1.
42 continue
print*,'Please type a basename (<9 characters, no dots): '
read(*,'(a)')basenameq
idot = index(basenameq,'.')
if (idot .ne. 0) then
basenameq = basenameq(1:idot-1)
end if
lbase = index(basenameq,' ')-1
data wtimesig,wclef,wkeysig, a20,whead20 , abig20
* / 0.72 , 0.8 , 0.28, 0.3 , 0.3 , 0.38 /
open(10,file=basenameq(1:lbase)//'.pmx')
call getset(nv,noinst,mtrnuml,mtrdenl,mtrnmp,mtrdnp,
* xmtrnum0,newkey(1),npages,nsyst,musicsize,fracindent,bottreb)
c
c isig1 will be changed in getnote if there is a transposition
c
isig1 = newkey(1)
if (npages .gt. nsyst) then
print*,'npages > nsyst in input. Please fix the input.'
stop 1
end if
c
c fbar = afterruleskip/elemskip
c apt = width of small accidental + space in points (= 6 at 20pt)
c abigpt = width of big accidental + space in points (= 7.6 at 20pt)
c
fbar = 1.
apt = a20*musicsize
abigpt = abig20*musicsize
wheadpt = whead20*musicsize
ifig = 0
usefig = .true.
lenbeat = ifnodur(mtrdenl,'x')
lenmult = 1
if (mtrdenl .eq. 2) then
lenbeat = 16
lenmult = 2
end if
lenbr1 = lenmult*mtrnuml*lenbeat
lenbr0 = lenmult*xmtrnum0*lenbeat+.1
mtrnuml = 0
if (lenbr0 .ne. 0) then
ibaroff = 1
lenbar = lenbr0
else
ibaroff = 0
lenbar = lenbr1
end if
ibarcnt = 0
nptr(1) = 1
iccount = 128
nflb = 0
nfpb = 0
ipagfpb(0) = 1
isysfpb(0) = 1
ibarflb(0) = 1
isysflb(0) = 1
c
c Initialize for loop over lines
c
nkeys = 1
ibrkch(1) = 1
shifton = .false.
firstline = .true.
newmeter = .false.
inchord = .false.
ihead = 0
isheadr = .false.
idsig = 0
fintstf = -1.
gintstf = 1.0
30 loop = .true.
iskchb = .false.
issegno = .false.
nbars = 0
ibarmbr = 0
3 do 4 iv = 1 , nv
nvmx(iv) = 1
ivmx(iv,1) = iv
itsofar(iv) = 0
nnl(iv) = 0
do 5 j = 1 , nbz
rest(iv,j) = .false.
5 continue
4 continue
iv = 1
ivx = 1
fbon = .false.
barend = .false.
isvolt = .false.
2 if (loop) then
c
c Within this short loop, nv voices are filled up for the duration of a block.
c On exit (loop=.false.) the following are set: nnl(nv),itsofar(nv)
c nodur(..),rest(..). nnl will later be
c increased and things slid around as accidental skips are added.
c
call getnote(loop,ifig)
if (lastchar) go to 20
go to 2
end if
do 10 ibar = 1 , nbars
ibarcnt = ibarcnt+1
nptr(ibarcnt+1) = nptr(ibarcnt)
newmb(ibarcnt) = .false.
if (newmeter.and.ibar.eq.1) newmb(ibarcnt) = .true.
c
c Above is only for spacing calcs later on. Remember new meter can only occur
c at START of a new input line (ibar = 1)
c
if (ibar .ne. ibarmbr) then
c print*,'Now processing bar #',ibarcnt-ibaroff
call outbar(ibarcnt-ibaroff,jprntb)
else
c write(*,'(a19,i4,a1,i4)')' Multibar rest, bars',
write(*,'(/,a19,i4,a1,i4)')' Multibar rest, bars',
* ibarcnt-ibaroff,'-',ibarcnt-ibaroff+mbrest-1
ibaroff = ibaroff-mbrest+1
c
jprntb = 0
c
end if
if (firstline .and. lenbr0.ne.0) then
if (ibar .eq. 1) then
lenbar = lenbr0
else
lenbar = lenbr1
end if
end if
if (ibar .gt. 1) then
c
c For bars after first, slide all stuff down to beginning of arrays
c
do 11 iv = 1 , nv
do 11 kv = 1 , nvmx(iv)
ivx = ivmx(iv,kv)
ioff = nib(ivx,ibar-1)
do 12 ip = 1 , nib(ivx,ibar)-ioff
nodur(ivx,ip) = nodur(ivx,ip+ioff)
rest(ivx,ip) = rest(ivx,ip+ioff)
12 continue
11 continue
end if
do 67 iv = 1 , nv
do 67 kv = 1 , nvmx(iv)
ioff= 0
if(ibar.gt.1)ioff = nib(ivmx(iv,kv),ibar-1)
67 continue
call makeabar()
elsk(ibarcnt) = elskb
10 continue
firstline = .false.
newmeter = .false.
go to 30
20 continue
c
c Vertical analysis.
c
if (npages .eq. 0) then
if (nsyst .eq. 0) then
print*,'When npages=0, must set nsyst=bars/syst, not 0'
stop 1
end if
nsyst = (ibarcnt-1)/nsyst+1
if (nv .eq. 1) then
nsystpp = 12
else if (nv .eq. 2) then
nsystpp = 7
else if (nv .eq. 3) then
nsystpp = 5
else if (nv .eq. 4) then
nsystpp = 3
else
nsystpp = 2
end if
npages = (nsyst-1)/nsystpp+1
end if
c
c Check nsyst vs ibarcnt
c
if (nsyst .gt. ibarcnt) then
print*
print*,'nsyst,ibarcnt:',nsyst,ibarcnt
print*,'There are more systems than bars.'
stop 1
end if
nflb = nflb+1
ibarflb(nflb) = ibarcnt+1
isysflb(nflb) = nsyst+1
heightil = ptheight*4./musicsize
c
c Set up dummy forced page after last real one
c
nfpb = nfpb+1
ipagfpb(nfpb) = npages+1
isysfpb(nfpb) = nsyst+1
open(12,file='pmxtex.dat')
write(12,'(a)')basenameq(1:lbase)
write(12,*)lbase
c
c Pass to pmxb the initial signature, including effect of transposition.
c
write(12,'(8f10.5/f10.5,3i5)')fbar,apt,abigpt,wheadpt,etait,
* etatc,etacs1,etatop,etabot,inbothd,inhnoh,isig1
write(12,*)npages,widthpt,ptheight,nsyst
do 8 ifpb = 1 , nfpb
c
c Each time thru this loop is like a single score with several pages
c
npages = ipagfpb(ifpb)-ipagfpb(ifpb-1)
nsyst = isysfpb(ifpb)-isysfpb(ifpb-1)
nomnsystp = (nsyst-1)/npages+1
nshort = nomnsystp*npages-nsyst
do 7 ipage = 1 , npages
nsystp = nomnsystp
if (ipage .le. nshort) nsystp = nsystp-1
xilfrac = 0.
xiltxt = 0.
if (ipage.eq.1 .and. ihead.gt.0) then
c
c Needn't zero out ihead after printing titles if we only allow titles at top?
c
if (iand(ihead,1) .eq. 1) then
xiltxt = xiltxt+hgtin*4/musicsize
xilfrac = xilfrac+etait
end if
if (iand(ihead,2) .eq. 2) then
xiltxt = xiltxt+hgtti*4/musicsize
xilfrac = xilfrac+etatc
end if
if (iand(ihead,4) .eq. 4) then
xiltxt = xiltxt+hgtco*4/musicsize
xilfrac = xilfrac+etacs1
else
c
c Use double the title-composer space if there is no composer
c
xilfrac = xilfrac+etatc
end if
end if
D = xilfrac+nsystp-1+etatop+etabot
C = nsystp*(nv-1)
xN = heightil - xiltxt - 4*nsystp*nv - (nsystp-1)*xilbn
if (bottreb) xN = xN-(nsystp-1)*xilbtc
if (ihead.eq.0 .and. isheadr) xN = xN - xilhdr
if (ifig .eq. 1) then
xN = xN - nsystp*xilfig
end if
glueil = (xN-b*C)/(D+a*C)
omegaG = (b*D+a*xN)/(D+a*C)
c
c G = N/(D + omega * C) = glueil, (1)
c N = scaleable height (\interlignes) = height - htext - staff heights - xil
c xil = extra interliges = (nsy-1)*xilbn + 10 if header and no titles
c + (nsy-1)*xiltcb for treble clef bottoms
c + nsy*xilfig for figures
c D = omega-indep factors for scalable height = nsy-1 (intersystem glue)
c + etatop + etabot + etatxt +
c C*omega = nsy*(nv-1)*omega (\interstaff part)
c But (empirically) omega*G = a*G + b (2)
c with a=1.071 and b=2.714
c Solving (1) and (2) gives
c G = (N-b*C)/(D+a*C) , omega*G = (b*D+a*N)/(D+a*C)
c Pass to pmxb omega*G (=\interstaff-4)
c (etatop,bot,it,tc,cx)*G as inputs to \titles
c
c glueil = (heightil-xiltxt-nsystp*(xil+4*nv))
c * /(nsystp*(1+gfact*(nv-1))-1+etatop+etabot+xilfrac)
c xnsttop = glueil*etatop
c xintstaff = 4+gfact*glueil
c
c Only the first page will get local adjustment now if needed, others in pmxb
c
if (ifpb.eq.1 .and. ipage.eq.1 .and. fintstf.gt.0.) then
facins = fintstf
fintstf = -1.
else
c
c gintstf = 1.0 by default, but may be changed with AI<x>
c
facins = gintstf
end if
write(12,*)nsystp,max(0.,etatop*glueil),facins*(omegaG+4)
ihead = 0
isheadr = .false.
7 continue
8 continue
c
c Done with vertical, now do horizontals
c
celsk(1) = elsk(1)
do 21 ibar = 2 , ibarcnt
celsk(ibar) = celsk(ibar-1)+elsk(ibar)
21 continue
lastbar(0) = 0
ibar1 = 1
wmins = -1.
iflb = 1
ikey = 1
c
c Return nsyst to its *total* value
c
nsyst = isysfpb(nfpb)-1
do 22 isyst = 1 , nsyst
if (isyst .eq. isysflb(iflb)) iflb = iflb+1
ibarb4 = lastbar(isyst-1)
if (isyst .eq. 1) then
c elsstarg = celsk(ibarcnt)/(nsyst-fracindent)*(1-fracindent)
elssold = celsk(ibarcnt)/(nsyst-fracindent)*(1-fracindent)
elsstarg = celsk(ibarflb(1)-1)/(isysflb(1)-1-fracindent)
* *(1-fracindent)
celskb4 = 0.
else
celskb4 = celsk(ibarb4)
c elsstarg = (celsk(ibarcnt)-celskb4)/(nsyst-isyst+1)
elssold = (celsk(ibarcnt)-celskb4)/(nsyst-isyst+1)
elsstarg = (celsk(ibarflb(iflb)-1)-celskb4)
* /(isysflb(iflb)-isyst)
end if
diff1 = abs(elsstarg-elsk(ibarb4+1))
do 23 ibar = ibarb4+2 , ibarcnt
diff = elsstarg-(celsk(ibar)-celskb4)
if (abs(diff) .ge. diff1) go to 24
diff1 = abs(diff)
23 continue
24 ibar = ibar-1
lastbar(isyst) = ibar
nbarss(isyst) = ibar-ibarb4
c
c elss is # of elemskip in the syst. from notes, not ruleskips, ask's, afterrs
c
elss(isyst) = celsk(ibar)-celskb4
write(12,'(i5)')lastbar(isyst-1)+1
c
c Transposed sigs are isig1, newkey(2,3,...).
c
if (ikey .eq. 1) then
key1 = isig1
else
key1 = newkey(ikey)
end if
fsyst = wclef+abs(key1)*wkeysig+2./musicsize
xelsk = 0.
1 if (ikey.lt.nkeys) then
if (ibrkch(ikey+1).le.lastbar(isyst)) then
c
c Add space for all key changes
c
ikey = ikey+1
key2 = newkey(ikey)
nacc = max(abs(key2-key1),max(abs(key1),abs(key2)))
fsyst = fsyst+nacc*wkeysig
c
c Account for afterruleskips (fbar)
c
xelsk = xelsk+fbar/2
if (ibrkch(ikey).lt.lastbar(isyst) .and. .not.kchmid(ikey))
* xelsk = xelsk-1.
key1 = key2
go to 1
end if
end if
c
c Add extra fixed space for double bar
c
if (isyst .eq. nsyst) then
fsyst = fsyst+4.5/musicsize
end if
c
c Add extra fixed space for initial time signature
c
if (isyst .eq. 1) then
fsyst = fsyst+wtimesig
end if
c
c Add extra fixed space for time signature changes & user-defined spaces
c
do 26 ibars = ibarb4+1 , lastbar(isyst)
if (newmb(ibars)) fsyst = fsyst+wtimesig
fsyst = fsyst+udsp(ibars)/musicsize
26 continue
wdpt = widthpt
if (isyst .eq. 1) wdpt = widthpt*(1-fracindent)
wsyspt = wdpt-fsyst*musicsize-0.4*nbarss(isyst)
c
c Checks for min spacing
c Get range of NOtes def'ns required, also min allowable space
c
c iemin = 1000
iemin = 0
c iemax = 0
do 45 ibar = ibar1 , ibar1+nbarss(isyst)-1
c iemin = min(iemin,ieminb(ibar))
iemin = ior(iemin,ieminb(ibar))
c iemax = max(iemax,iemaxb(ibar))
if (wminnh(ibar).ge.0.) wmins = wminnh(ibar)
45 continue
if (wmins .lt. 0) wmins = 0.3
wminpt = (1+wmins)*0.3*musicsize
c
c Find min,max actual duration for this system & # of notes
c
dtmin = 1000.
dtmax = 0.
nns = 0
do 43 iptr = nptr(ibar1) , nptr(ibar1+nbarss(isyst))-1
dtmin = min(dtmin,durb(iptr))
dtmax = max(dtmax,durb(iptr))
nns = nns + nnpd(iptr)
43 continue
c elmin0 = wsyspt*feon(dtmin)/(elss(isyst)+fbar*nbarss(isyst))
elmin0 = wsyspt*feon(dtmin)/
* (elss(isyst)+fbar*nbarss(isyst)+xelsk)
if (elmin0 .ge. wminpt) then
sumelsk = elss(isyst)
eonk = 0.
ewmxk = 1.
else
c elmin1 = wsyspt/(fbar*nbarss(isyst)/feon(dtmax)+nns)
elmin1 = wsyspt/((fbar*nbarss(isyst)+xelsk)/feon(dtmax)+nns)
if (elmin1 .le. wminpt) then
print*
print*,'In system #',isyst,' cannot meet min. space rqmt'
eonk = 0.9
else
eonk = min(.9,(wminpt-elmin0)/(elmin1-elmin0))
end if
ewmxk = feon(dtmax)**eonk
c
c Recompute poenom!
c
sumelsk = 0
do 44 iptr = nptr(ibar1) , nptr(ibar1+nbarss(isyst))-1
sumelsk = sumelsk
* + nnpd(iptr)*feon(durb(iptr))**(1-eonk)*ewmxk
44 continue
end if
poenom = wsyspt/(sumelsk+fbar*nbarss(isyst)+xelsk)
c write(12,'(1pe12.5/i5,4e12.3,2i5)') poenom,nbarss(isyst),
c * sumelsk,fsyst,eonk,ewmxk,iemin,iemax
write(12,'(1pe12.5/i5,4e12.3,i9)') poenom,nbarss(isyst),
* sumelsk,fsyst,eonk,ewmxk,iemin
ibar1 = ibar1+nbarss(isyst)
22 continue
close(12)
open(13,file='pmxtex.fig')
write(13,'(i5)')ifig
close(13)
c print*,'Done with first pass. Now run pmxb.'
write(*,'(/,a)')' Done with first pass. Now run pmxb.'
end
subroutine getnote(loop,ifig)
parameter (nm=7,nkb=500,nbz=200)
common /all/ iv,list(4,nbz),nnl(nm),nv,ibar,
* ipl(nm,nbz),mtrnuml,
* nodur(nm,nbz),jn,lenbar,iccount,nbars,itsofar(nm),
* nib(nm,15),nn(nm),
* rest(nm,nbz),lenbr0,lenbr1,firstline,newmeter
common /comnotes/ nnodur,wminnh(nkb),nnpd(2000),durb(2000),
* nptr(nkb),ibarcnt,ieminb(nkb),iemaxb(nkb),mbrest,ibarmbr,
* ibaroff,udsp(nkb),wheadpt
common /comget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
* inchord
common /compage/ widthpt,ptheight,nsyst,nflb,ibarflb(0:40),
* isysflb(0:40),npages,nfpb,ipagfpb(0:10),isysfpb(0:10),
* usefig,fintstf,gintstf
common /commvl/ nvmx(nm),ivmx(nm,2),ivx,fbar
common /comkeys/ nkeys,ibrkch(14),newkey(14),iskchb,idsig,isig1,
* kchmid(14),ornrpt,shifton,barend
logical lastchar,firstline,rest,loop,newmeter,fbon,issegno,barend,
* isheadr,fulbrp,usefig,isvolt,iskchb,kchmid,plusmin,ornrpt
common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
logical mrecord,mplay,endmac,inchord,isvshft,shifton
character*128 lineq,lnholdq
character*1 charq,dotq,dumq,durq,charlq
character*51 literq(2)
data literq
* /'Literal TeX string cannot start with 4 backslashes!',
* 'TeX string must have <129 char, end with backslash!'/
1 call getchar(lineq,iccount,charq)
if (charq .ne. ' ') charlq = charq
if (lastchar) then
if (charlq .ne. '/') then
print*,'Last non-blank character is "',charlq,'", not "/"'
stop 1
end if
return
end if
if (charq .eq. ' ') then
go to 1
else if (charq.eq.'%' .and. iccount.eq.1) then
iccount = 128
go to 1
else if ((ichar(charq).ge.97.and.ichar(charq).le.103) .or.
* charq.eq.'r') then
c
c This is a note/rest. Setup, increase note count, then loop 'til blank
c
idotform = 0
numnum = 0
plusmin = .false.
inchord = .false.
28 nnl(ivx) = nnl(ivx)+1
if (nnl(ivx) .gt. nbz) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '>200 notes in line of music. Use smaller blocks!')
stop 1
end if
dotq = 'x'
c
c Check if this is 'r ' and previous note was full-bar-pause
c
fulbrp = charq.eq.'r' .and. lineq(iccount+1:iccount+1) .eq.' '
* .and. nnl(ivx).gt.1 .and. rest(ivx,nnl(ivx)-1) .and.
* nodur(ivx,nnl(ivx)-1) .eq. lenbar
2 call getchar(lineq,iccount,durq)
ic = ichar(durq)
if (ic.le.57 .and. ic.ge.48) then
c
c Digit
c
if (numnum .eq. 0) then
nnodur = ic-48
numnum = 1
go to 2
else if (numnum .eq. 1) then
if (charq .eq. 'r') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Only one digit allowed after rest symbol "r"!')
stop 1
end if
numnum = 2
if (plusmin) then
print*
print*,'*********WARNING*********'
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Before version 1.2, +/- was ignored if octave was!')
print*,
* 'explicitly specified. May need to edit old editions'
end if
go to 2
else
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '>2 digits in note symbol!')
stop 1
end if
else if (durq.eq.'d') then
dotq = durq
if (index('+-',lineq(iccount+1:iccount+1)) .gt. 0) then
c
c move a dot, provided a number follows.
c
call getchar(lineq,iccount,durq)
call getchar(lineq,iccount,durq)
if (index('0123456789-.',durq) .eq. 0) then
c
c Backup, exit the loop normally
c
iccount = iccount-2
go to 2
c call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
c * 'Expected a number after +/- after "d" (raise dot)!')
c stop 1
end if
call readnum(lineq,iccount,dumq,fnum)
if (index('+-',dumq) .gt. 0) then
c
c Vertical shift also
c
call getchar(lineq,iccount,durq)
if (index('0123456789-.',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Expected number after 2nd +/- (shift dot)!')
stop 1
end if
call readnum(lineq,iccount,durq,fnum)
end if
iccount = iccount-1
end if
go to 2
else if (index('+-',durq) .gt. 0) then
if (charq .ne. 'r') then
plusmin = .true.
if (numnum .eq. 2) then
print*
print*,'*********WARNING*********'
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Before version 1.2, +/- was ignored if octave was!')
print*,
* 'explicitly specified. May need to edit old editions'
end if
go to 2
c end if
c
c It's a rest containing +|- . Must refer to a vertical shift. Read past.
c
else
call getchar(lineq,iccount,durq)
call readnum(lineq,iccount,durq,dum)
iccount = iccount-1
go to 2
end if
else if (index('fsnulare',durq) .gt. 0) then
go to 2
else if (durq .eq. 'p') then
fulbrp = charq.eq.'r'
if (.not. fulbrp) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'You entered "p"; I expected "rp"!')
stop 1
else if (lineq(iccount+1:iccount+1).ne.' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'You entered "rp" followed by non-blank!')
stop 1
end if
go to 2
else if (durq .eq. 'b') then
if (charq .ne. 'r') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'You entered "b"; I expected "rb"!')
stop 1
else if (numnum .eq. 2) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'You entered "r" & "b" with two numbers!')
end if
go to 2
else if (durq .eq. 'x') then
c
c xtuplet: Set all durations to 0 except last one.
c
if (charq .eq. 'r') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Xtuplets currently may not start with a rest!')
stop 1
end if
call getchar(lineq,iccount,durq)
if (index('123456789',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'First char after "x" in xtuplet must be "1"-"9"!')
stop 1
end if
call readnum(lineq,iccount,durq,fnum)
if (fnum .gt. 99) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Xtuplet cannot have more than 99 notes!')
stop 1
else if (index(' n',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Only legal characters here are " " or "n"!')
stop 1
end if
if (durq .eq. 'n') then
c
c Number alteration stuff
c
numshft = 0
30 call getchar(lineq,iccount,durq)
if (durq .eq. 'f') then
go to 30
else if (index('+-',durq) .gt. 0) then
numshft = numshft+1
if (numshft .eq. 3) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Only 2 numbers are allowed after "n" in xtup!')
stop 1
end if
call getchar(lineq,iccount,durq)
if (index('0123456789.',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'This character should be a digit or "."!')
stop 1
end if
call readnum(lineq,iccount,durq,snum)
iccount = iccount-1
if ((numshft.eq.1 .and. snum.gt.15.1) .or.
* (numshft.eq.2 .and. snum.gt.1.51)) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Number after "n" in xtup is out of range!')
stop 1
end if
go to 30
else if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after "n" in xtup!')
stop 1
end if
end if
ntup = int(fnum+.1)
do 6 itup = 2 , ntup
nodur(ivx,nnl(ivx)) = 0
nnl(ivx) = nnl(ivx)+1
110 call getchar(lineq,iccount,durq)
if (durq.eq.' ') then
go to 110
else if (durq .eq. 'o') then
c
c Ornament in xtup. "o" symbol must come AFTER the affected note
c
call getchar(lineq,iccount,dumq)
if (index('(stmx+Tup._)e:>^',dumq) .eq. 0 ) then
if (index('fg',dumq) .gt. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Fermata or segno not allowed in xtuplet!')
else
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal ornament!')
end if
stop 1
end if
if (dumq .eq. 'T') then
c
c Trill. may be followed by 't' and/or number. read 'til blank
c
29 call getchar(lineq,iccount,dumq)
if (dumq .ne. ' ') go to 29
else if (dumq .eq. 'e') then
call getchar(lineq,iccount,dumq)
if (index('sfn',dumq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after "e" in edit. accid. symbol!')
stop 1
end if
call getchar(lineq,iccount,dumq)
else if (dumq .eq. ':') then
if (lineq(iccount+1:iccount+1) .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '":" must be followed by blank in "o: "!')
stop 1
else if (.not.ornrpt) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Turned off repeated ornaments before they were on!')
stop 1
end if
ornrpt = .false.
else
call getchar(lineq,iccount,dumq)
end if
if (index('+- :',dumq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character in ornament symbol!')
stop 1
end if
if (dumq .eq. ':') then
if (ornrpt) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Turned on repeated ornaments but already on!')
stop 1
end if
ornrpt = .true.
end if
if (index('+-',dumq) .gt. 0)
* call readnum(lineq,iccount,durq,fnum)
go to 110
else if (index('st()',durq) .gt. 0) then
iposn = 0
isvshft = .false.
15 call getchar(lineq,iccount,dumq)
iposn = iposn+1
if (index('udlt',dumq) .gt. 0) then
go to 15
else if (index('+-',dumq) .gt. 0) then
iccount = iccount+1
call readnum(lineq,iccount,durq,fnum)
if (.not.isvshft) then
isvshft = .true.
if (int(fnum+.5) .gt. 15) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Magnitude of slur height adjustment cannot exceed 15!')
stop 1
end if
else
if (abs(fnum).gt.6.3) then
call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
* 'Slur horiz shift must be in the range (-6.3,6.3)!')
stop 1
end if
end if
iccount = iccount-1
go to 15
else if (dumq .ne. ' ') then
ic = ichar(dumq)
if ((ic.ge.48.and.ic.le.57) .or.
* (ic.ge.65.and.ic.le.90)) then
if (iposn .eq. 1) go to 15
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Slur ID must be 2nd character in slur symbol!')
stop 1
end if
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character in slur symbol!')
stop 1
end if
go to 110
else if (index('0123456789#-nx_',durq) .gt. 0) then
c
c We have a figure. Only allow on 1st note of xtup
c
if (itup .ne. 2) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Figure in xtup only allowed on 1st note!')
stop 1
else if (durq.eq.'x') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'No floating figures in xtuplets!')
stop 1
end if
if (usefig .and. ivx.eq.1) ifig = 1
26 call getchar(lineq,iccount,durq)
if (index('0123456789#-n_',durq) .gt. 0) then
go to 26
else if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character in figure in xtuplet!')
stop 1
end if
go to 110
else if (durq .eq. char(92)) then
call chklit(lineq,iccount,literr)
if (literr .gt. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* literq(literr))
stop 1
end if
go to 110
else if (durq .eq. 'M') then
c
c Temporary trap until I get around putting this in pmxb
c
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Macros not yet allowed in xtuplets!')
stop 1
else if (durq .eq. 'X') then
c
c Assume hardspace, not shift, for now
c
call getchar(lineq,iccount,durq)
if (index('+-',durq) .gt. 0) iccount = iccount+1
call readnum(lineq,iccount,durq,fnum)
iccount = iccount-1
go to 110
else if (durq .eq. 'z') then
c
c Chord note in xtup. Read past for now.
c
33 call getchar(lineq,iccount,durq)
if (durq .ne. ' ') go to 33
go to 110
end if
if (index('abcdefg',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'In xtup, this character is not allowed!')
stop 1
end if
7 call getchar(lineq,iccount,durq)
if (index('+-sfn',durq) .gt. 0) go to 7
6 continue
c
c 6==End of loop for xtuplet input
c
else if (durq .eq. 'm') then
c
c Multi-bar rest: next 1 or two digits are # of bars.
c
if (iv .gt. 1) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Cannot have multibar rest if nv>1!')
stop 1
else if (mod(itsofar(iv),lenbar) .ne. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Multibar rest must start at beginning of bar!')
stop 1
else if (ibarmbr .gt. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Only one multibar rest allowed per block!')
stop 1
end if
c
c For some purposes, pretend its one bar only
c
nodur(iv,nnl(iv)) = lenbar
ibarmbr = nbars+1
mbrest = 0
20 call getchar(lineq,iccount,durq)
if (ichar(durq).ge.48.and.ichar(durq).le.57) then
mbrest = 10*mbrest+ichar(durq)-48
go to 20
end if
if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after "rm"!')
stop 1
end if
else if (durq .eq. '.') then
c
c Dotted pattern. Close out note. Mult time by 3/4.
c Set time for next note to 1/4. Start the note.
c
idotform = 1
else if (durq .eq. ',') then
idotform = 3
c
c Now flow to duration setting, is if durq=' '
c
else if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character!')
stop 1
end if
c
c Set the duration
c
if (idotform .gt. 0) then
if (idotform .eq. 1) then
nodur(ivx,nnl(ivx)) = ifnodur(nnodur,dotq)*3/2
else if (idotform .eq. 2) then
nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx)-1)/3
else if (idotform .eq. 3) then
nodur(ivx,nnl(ivx)) = ifnodur(nnodur,dotq)
else if (idotform .eq. 4) then
nodur(ivx,nnl(ivx)) = nodur(ivx,nnl(ivx)-1)/2
end if
else if (ibarmbr.ne.nbars+1 .and. .not.fulbrp) then
nodur(ivx,nnl(ivx)) = ifnodur(nnodur,dotq)
else if (fulbrp) then
nodur(ivx,nnl(ivx)) = lenbar
fulbrp = .false.
end if
c print*,'ivx,nnl(ivx),nodur:',ivx,nnl(ivx),nodur(ivx,nnl(ivx))
if (charq .eq. 'r') then
rest(ivx,nnl(ivx)) = .true.
end if
c
c If inside forced beam, check if note is beamable
c
if (fbon) then
if (nodur(ivx,nnl(ivx)) .lt. 16) go to 120
if (nnl(ivx) .gt. 1) then
if (nodur(ivx,nnl(ivx)-1) .eq. 0) go to 120
end if
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Unbeamable thing in forced beam!')
stop 1
end if
120 continue
itsofar(ivx) = itsofar(ivx)+nodur(ivx,nnl(ivx))
if (mod(itsofar(ivx),lenbar) .eq. 0) then
nbars = nbars+1
if (shifton) barend = .true.
c
c Will check barend when 1st note of next bar is entered.
c
if (nbars .gt. 15) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Cannot have more than 15 bars in an input block!')
stop 1
end if
nib(ivx,nbars) = nnl(ivx)
if (firstline .and. lenbar.ne.lenbr1) then
c
c Just finished the pickup bar for this voice.
c
if (itsofar(ivx) .ne. lenbr0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Pickup bar length disagrees with mtrnum0!')
stop 1
end if
lenbar = lenbr1
itsofar(ivx) = 0
end if
else if (barend) then
if (shifton) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Bar ended with user-defined shift still on!')
stop 1
end if
barend = .false.
end if
if (idotform .eq. 1) then
call getchar(lineq,iccount,charq)
idotform = 2
numnum = 1
go to 28
else if (idotform .eq. 3) then
call getchar(lineq,iccount,charq)
idotform = 4
numnum = 1
go to 28
end if
c
c End of sub block for note-rest
c
else if (charq .eq. 'z') then
inchord = .true.
call getchar(lineq,iccount,charq)
25 call getchar(lineq,iccount,durq)
if (index('nfs+-.0123456789dre',durq) .gt. 0) go to 25
if (durq .ne. ' ' .or. index('abcdefg',charq).eq.0) then
call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
* 'Illegal character in chord note!')
stop 1
end if
else if (charq .eq. 'G') then
ngr = 1
9 call getchar(lineq,iccount,charq)
if (index('123456789',charq) .gt. 0) then
call readnum(lineq,iccount,durq,fnum)
ngr = int(fnum+.1)
iccount = iccount-1
go to 9
else if (index('AWulxs',charq) .gt. 0) then
go to 9
else if (charq .eq. 'm') then
call getchar(lineq,iccount,charq)
if (index('01234',charq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'A digit less than 5 must follow "m" in a grace note!')
stop 1
end if
go to 9
end if
c
c At this point, charq is first note name in rest (grace?)
c
do 19 igr = 1 , ngr
numnum = 0
c if (igr .gt. 1) call getchar(lineq,iccount,charq)
c++
if (igr .gt. 1) then
c if (charq .ne. ' ') then
c call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
c * 'In multiple grace, expected blank!')
c stop 1
c end if
55 call getchar(lineq,iccount,charq)
if (charq .eq. ' ') go to 55
end if
c++
if (index('abcdefg',charq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'In grace, expected "a"-"g"!')
stop 1
end if
18 call getchar(lineq,iccount,charq)
if (charq .ne. ' ') then
if (index('+-1234567',charq) .gt. 0) then
if (numnum .eq. 1) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Only one of "+-1234567" allowed here in grace!')
stop 1
end if
numnum = 1
go to 18
else if (index('nfs',charq) .gt. 0) then
go to 18
end if
c
c Digits are possible octave numbers
c
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after note name in grace!')
stop 1
end if
19 continue
else if (charq .eq. char(92)) then
call chklit(lineq,iccount,literr)
if (literr .gt. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* literq(literr))
stop 1
end if
else if (charq .eq. 'o') then
c
c "o" symbol must come AFTER the affected note
c
call getchar(lineq,iccount,dumq)
if (index('(stmgx+Tupf._)e:>^',dumq) .eq. 0 ) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal ornament!')
stop 1
end if
if (dumq .eq. ':') then
call getchar(lineq,iccount,dumq)
if (dumq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Expected blank after "o:"!')
stop 1
else if (.not.ornrpt) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Turned off repeated ornaments before they were on!')
stop 1
end if
ornrpt = .false.
else if (dumq .eq. 'g') then
if (issegno) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Sorry, only one "segno" per input block!')
stop 1
else if (ivx .ne. 1) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'segno can only be in voice 1!')
stop 1
end if
issegno = .true.
12 call getchar(lineq,iccount,dumq)
if (dumq.eq.'-' .or.
* (ichar(dumq).ge.48.and.ichar(dumq).le.58)) go to 12
if (dumq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character in segno ornament symbol!')
stop 1
end if
else if (dumq .eq. 'T') then
c
c Trill. may be followed by 't' and/or number. read 'til blank
c
22 call getchar(lineq,iccount,dumq)
if (dumq .eq. ':') then
if (lineq(iccount+1:iccount+1) .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Expected blank after ":"!')
stop 1
end if
go to 32
else if (dumq .ne. ' ') then
go to 22
end if
else if (dumq .eq. 'f') then
call getchar(lineq,iccount,dumq)
if (index(' d+-:',dumq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after "f" in fermata ornament symbol!')
stop 1
end if
if (dumq .eq. 'd') call getchar(lineq,iccount,dumq)
if (dumq .eq. ':') go to 32
else if (dumq .eq. 'e') then
call getchar(lineq,iccount,dumq)
if (index('sfn',dumq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after "e" in edit. accid. symbol!')
stop 1
end if
call getchar(lineq,iccount,dumq)
else
call getchar(lineq,iccount,dumq)
end if
if (index('+- :',dumq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character in ornament symbol!')
stop 1
end if
if (index('+-',dumq) .gt. 0)
* call readnum(lineq,iccount,durq,fnum)
32 continue
if (dumq .eq. ':') then
if (ornrpt) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Turned on repeated ornaments but already on!')
stop 1
end if
ornrpt = .true.
end if
c else if (charq .eq. 's' .or. charq .eq. 't') then
else if (index('st()',charq) .gt. 0) then
isvshft = .false.
iposn = 0
8 call getchar(lineq,iccount,dumq)
iposn = iposn+1
if (index('udlt+- ',dumq) .eq. 0) then
c
c Check for explicit ID code.
c
ic = ichar(dumq)
if (ic.lt.48 .or. (ic.gt.57.and.ic.lt.65) .or.
* ic.gt.90) then
c
c Not 0-9 or A-Z, so exit
c
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character in slur symbol!')
stop 1
else
c
c It is a possible ID code. Right place?
c
if (iposn .ne. 1) then
c
c Slur ID is not 2nd!
c
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Slur ID must be second character in slur symbol!')
stop 1
end if
end if
c
c Slur ID is OK.
c
go to 8
end if
if (index('udlt',dumq) .gt. 0) then
go to 8
else if (index('+-',dumq) .gt. 0) then
if (charq .eq. 't') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '"+|-" for slur height only allowed in "s"-slurs!')
stop 1
end if
iccount = iccount+1
call readnum(lineq,iccount,durq,fnum)
if (.not.isvshft) then
isvshft = .true.
if (int(fnum+.5) .gt. 15) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Magnitude of slur height adjustment cannot exceed 15!')
stop 1
end if
else
if (abs(fnum) .gt. 6.3) then
call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
* 'Slur horiz shift must be in range (-6.3,6.3)!')
stop 1
end if
end if
iccount = iccount-1
go to 8
end if
else if (charq .eq. '?') then
continue
else if ((ichar(charq).ge.48.and.ichar(charq).le.57) .or.
* index('#-nx_',charq) .gt. 0) then
c
c We have a figure. Must come AFTER the note it goes under
c
if (itsofar(ivx).eq.0 .and.
* (.not.firstline.or.lenbr0.eq.0.or.lenbar.eq.lenbr0)) then
c
c Figure before first note in block
c
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Cannot put figure before first note in block!')
stop 1
end if
if (charq.eq.'x') then
indxb = index(lineq(iccount:128),' ')
if (indxb .lt. 5) then
call errmsg(lineq,iccount+indxb-1,ibarcnt-ibaroff+nbars+1,
* 'Cannot have a blank here in floating figure!')
stop 1
end if
end if
if (usefig) ifig = 1
5 call getchar(lineq,iccount,charq)
if (charq .ne. ' ') go to 5
else if (charq .eq. '[') then
if (fbon) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Started forced beam while another was open!')
stop 1
end if
fbon = .true.
17 call getchar(lineq,iccount,charq)
if (index('uljh',charq) .gt. 0) then
go to 17
else if (index('+-',charq) .gt. 0) then
iccount = iccount+1
call readnum(lineq,iccount,durq,fnum)
iccount = iccount-1
go to 17
else if (charq .eq. 'm') then
c
c Forced multiplicity, next char should be 1-4
c
call getchar(lineq,iccount,charq)
if (index('1234',charq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Forced multiplicity for a beam must be 1, 2, 3, or 4!')
stop 1
end if
go to 17
else if (charq .ne. ' ') then
if (index('0123456789',charq) .gt. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'After "[", digits must now be preceeded by "+" or "-"!')
print*,'You will have to edit older sources to meet this rqmt,'
print*,'but it was needed to allow 2-digit height adjustments.'
print*,'Sorry for the inconvenience. --The Management'
else
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after [!')
end if
stop 1
end if
else if (charq .eq. ']') then
call getchar(lineq,iccount,charq)
c if (charq .eq. ' ') then
if (index('j ',charq) .gt. 0) then
if (fbon) then
fbon = .false.
else
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Forced beam stop with no corresponding start!')
stop 1
end if
else if (charq .eq. '[') then
if (.not.fbon) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '"][" can only go in forced beam!')
stop 1
end if
c else
else if (charq .ne. 'j') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '"]" must be followed by blank, "j", or "["!')
stop 1
end if
else if (index('lhw',charq) .gt. 0) then
c
c Save position for later check
c
icclhw = iccount
call getchar(lineq,iccount,durq)
if (index('0123456789.+- ',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after "l", "w", or "h"!')
stop 1
end if
isheadr = isheadr .or. charq .eq. 'h'
if (index(' +-',durq) .gt. 0) then
c
c There is a header (or lower string?)
c
if (index('+-',durq) .gt. 0) then
c
c User-defined vert offset (\internote).
c
if (charq .ne. 'h') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '"+" or "-" not permitted here!')
stop 1
end if
c
c Have "h" followed by +/- . Check for digit.
c Can blow durq since not using fnum for now, but...
c
call getchar(lineq,iccount,durq)
if (index('123456789',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'There must be a digit here!')
stop 1
end if
c
c Have "h" followed by +/- followed by a digit. No need to get the number.
c
c call readnum(lineq,iccount,durq,fnum)
end if
if (charq .ne. 'w') then
c
c Header or lower string.
c
c if (iccount .ne. 2) then
if (icclhw .ne. 1) then
call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
* '"h" or "l" must be first character in line!')
stop 1
end if
c
c Read past the next line, which has the string.
c
c read(10,'(a)')charq
call read10(charq,1,lastchar)
nline = nline+1
iccount = 128
else
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Symbol "w" (width) must be followed by a digit!')
stop 1
end if
else
c
c Height or width change spec. Check if at start of piece.
c
if (ibarcnt .gt. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Symbol must go at top of first input block!')
stop 1
end if
call readnum(lineq,iccount,durq,dimen)
c
c Check units. Convert to points
c
if (durq .eq. ' ' .or. durq .eq. 'p') then
dimen = dimen+.5
else if (durq .eq. 'i') then
dimen = dimen*72+.5
else if (durq .eq. 'm') then
dimen = dimen/25.4*72+.5
else
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal unit; must be "p","i",or"m"!')
stop 1
end if
if (charq .eq. 'h') then
ptheight = int(dimen)
else
widthpt = int(dimen)
end if
end if
else if (charq .eq. 'm') then
c
c Time signature change. Only allow at beginning of block.
c mtrnuml, mtrdenl (logical) and p (printable) will be input.
c mtrnuml=0 initially. (In common)
c
c Check whether at beginning of a block
c
if (ivx.ne.1 .or. nnl(1).ne.0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Meter change only OK in voice 1, at start of block!')
stop 1
end if
newmeter = .true.
call readmeter(lineq,iccount,mtrnuml,mtrdenl)
if (mtrnuml .eq. 0) then
call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
* 'Digit 0 not allowed here!')
stop 1
end if
call readmeter(lineq,iccount,mtrnmp,mtrdnp)
c
c Read past printed time signature; not used in pmxa.
c
lenbeat = ifnodur(mtrdenl,'x')
lenmult = 1
if (mtrdenl .eq. 2) then
lenbeat = 16
lenmult = 2
end if
lenbar = lenmult*mtrnuml*lenbeat
mtrnuml = 0
else if (charq .eq. 'C') then
call getchar(lineq,iccount,durq)
if (.not.(index('tsmanrb',durq).gt.0 .or.
* (ichar(durq).ge.48 .and. ichar(durq).le.54))) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Must have t,s,m,a,n,r,b or 1-6 after C!')
stop 1
end if
else if (charq .eq. 'R') then
if (ivx .ne. 1) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Repeats can only go in voice 1!')
stop 1
end if
10 call getchar(lineq,iccount,durq)
if (index('lrdD',durq) .gt. 0) go to 10
if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after "R" (repeat/double bar)!')
stop 1
end if
else if (charq .eq. 'V') then
c
c Ending
c
if (iv .ne. 1) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Voltas are only allowed in voice #1!')
stop 1
else if (isvolt) then
print*
print*,'*******WARNING********'
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'There is more than one volta in this input block.!')
print*,'This may work in a score, but WILL NOT work in parts.'
print*,
*'Safest to have only 1 volta per block, at the start of the block'
end if
isvolt = .true.
11 call getchar(lineq,iccount,durq)
if (durq .ne.' ') go to 11
else if (charq .eq. 'B') then
continue
else if (charq .eq. 'P') then
if (ivx.ne.1 .or. nnl(1).ne.0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Only allowed at beginning of block!')
stop 1
end if
16 call getchar(lineq,iccount,durq)
if (durq.eq.'l'.or.durq.eq.'r'.or.(ichar(durq).ge.48 .and.
* ichar(durq).le.57)) go to 16
if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Only "l", "r", or digit allowed after "P"!')
stop 1
end if
else if (charq .eq. 'W') then
call getchar(lineq,iccount,durq)
if (durq .ne. '.') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Next char after " W" must be "."!')
stop 1
end if
call getchar(lineq,iccount,durq)
if (ichar(durq).ge.48 .or. ichar(durq).le.57) then
wminnh(ibarcnt+nbars+1) = .1*(ichar(durq)-48)
else
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Next char after " W." must be 0-9!')
stop 1
end if
else if (charq .eq. 'T') then
c
c Titles
c
call getchar(lineq,iccount,durq)
if (index('itc',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Must put "i", "t", or "c" after "T"!')
stop 1
end if
ihead = ihead+2**(index('itc',durq)-1)
c
c Maybe a number after 'Tt', but ignore here. Read past string on next line.
c
c read(10,'(a)')charq
call read10(charq,1,lastchar)
nline = nline+1
iccount = 128
else if (charq .eq. 'A') then
27 call getchar(lineq,iccount,durq)
if (index('rbsd',durq) .gt. 0) then
go to 27
else if (durq .eq. 'a') then
call getchar(lineq,iccount,durq)
call readnum(lineq,iccount,durq,fbar)
iccount = iccount-1
go to 27
else if (durq .eq. 'i') then
call getchar(lineq,iccount,durq)
c
c Local interstaff correction. Set to -1. if not specifiec, or after use,
c or anytime except at top, since pmxb handles all times except at top.
c
call readnum(lineq,iccount,durq,tintstf)
if (ibarcnt .eq. 0) fintstf = tintstf
iccount = iccount-1
go to 27
else if (durq .eq. 'I') then
c
c Global interstaff correction. Use in place of fintstf if fintstf<0
c
call getchar(lineq,iccount,durq)
call readnum(lineq,iccount,durq,gintstf)
iccount = iccount-1
go to 27
else if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'The only legal entries after "A" are "r,s,b,a,i,I,d"!')
stop 1
end if
else if (charq .eq. 'K') then
c
c Rules and function of K command
c
c Only 1 K +/-n +/-m allowed per block if n.ne.0 (transposition). isig1 is
c initial sig, and must be passed to pmxb because it is needed when topfile
c is called, which is before the K+n+m command is read in pmxb. Also, we
c compute and save ibrkch and newkey for each syst, accounting for key changes,
c then adjust fbar to make poenom much more accurate.
c
call getchar(lineq,iccount,durq)
if (index('+-',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '"K" (transpose or key change) must be followed by "+,-"!')
stop 1
end if
iccount = iccount+1
num1 = 44-ichar(durq)
c
c num1= +1 or -1
c
call readnum(lineq,iccount,durq,fnum)
num1 = int(fnum+.1)*num1
if (index('+-',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '1st number after "K" must be followed by "+,-"!')
stop 1
end if
iccount = iccount+1
num2 = 44-ichar(durq)
call readnum(lineq,iccount,durq,fnum)
num2 = num2*int(fnum+.1)
if (num1 .eq. 0) then
c
c Key change, only one per block allowed
c
if (iskchb) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Only one key change allowed per input block!')
stop 1
end if
iskchb = .true.
nkeys = nkeys+1
kchmid(nkeys) = mod(itsofar(ivx),lenbar).ne.0
c
c Make ibrkch = barnum-1 if at start of bar, so fsyst advances ok at linebreak.
c
ibrkch(nkeys) = ibarcnt+nbars
if (kchmid(nkeys)) ibrkch(nkeys) = ibrkch(nkeys)+1
newkey(nkeys) = num2+idsig
else
c
c Transposition
c
if (ibarcnt .gt. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Transposition must be at top of first input block!')
stop 1
end if
isig1 = num2
idsig = isig1-newkey(1)
c
c idsig is the difference between sig after transposition, and sig in setup.
c It may alter # of accid's in key changes if there is transposition.
c
end if
else if (charq .eq. '|') then
c
c Optional bar symbol
c
if (mod(itsofar(ivx),lenbar).ne.0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Bar line marker out of place!')
stop 1
else if (shifton) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Bar ended with user-defined shift still on!')
stop 1
end if
else if (charq .eq. '/') then
if (fbon) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Block ended with forced beam open!')
stop 1
else if (shifton) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Bar ended with user-defined shift still on!')
stop 1
end if
barend = .false.
c
c Perform time checks
c
if (mod(itsofar(ivx),lenbar).ne.0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Block duration not divisible by lenbar!')
print*,'lenbar is ',lenbar
stop 1
else if (ivx.gt.1 .and. itsofar(ivx).ne.itsofar(1)) then
print*
print*,'# of bars in voice 1, current voice:',
* itsofar(1)/lenbar,itsofar(ivx)/lenbar
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Block duration not equal to voice 1!')
stop 1
end if
call getchar(lineq,iccount,durq)
if (durq .eq. ' ' .and. iv.eq.nv) then
c
c End of input block
c
loop = .false.
else
c
c Start a new voice
c
if (lenbr0.ne.0 .and. firstline) lenbar = lenbr0
nbars = 0
if (durq .eq. ' ') then
c
c New voice is on next staff
c
iv = iv+1
ivx = iv
else
c
c New voice is on same staff. Set up for it
c
ivx = nv+1
do 23 iiv = 1 , nv
if (nvmx(iiv) .eq. 2) ivx = ivx+1
23 continue
nvmx(iv) = 2
ivmx(iv,2) = ivx
itsofar(ivx) = 0
nnl(ivx) = 0
do 24 j = 1 , nbz
rest(ivx,j) = .false.
24 continue
end if
end if
iccount = 128
else if (charq .eq. 'S') then
c
c New nsyst: for use with partmaker scor2prt, for parts w/ diff # of systs.
c
if (ibarcnt .gt. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '"S" can only be in first input block!')
stop 1
end if
call getchar(lineq,iccount,durq)
call readnum(lineq,iccount,durq,fnsyst)
nsyst = int(fnsyst+.1)
if (durq .eq. 'P') then
c
c New npages for parts. Assuming <10.
c
call getchar(lineq,iccount,durq)
if (index('123456789',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Symbol after "P" must be a digit!')
stop 1
end if
npages = ichar(durq)-48
end if
else if (charq .eq. 'L') then
nflb = nflb+1
ibarflb(nflb) = ibarcnt+nbars+1
call getchar(lineq,iccount,durq)
if (index('123456789',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Need integer to define forced line break!')
stop 1
end if
call readnum(lineq,iccount,durq,sysflb)
isysflb(nflb) = int(sysflb+.1)
if (nflb .gt. 1) then
c
c Check if new number is > prior one
c
if (isysflb(nflb) .le. isysflb(nflb-1)) then
call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
* 'You already forced a line break at a later line!')
stop 1
end if
end if
if (npages .eq. 0) then
print*
print*,'WARNING! You forced a line break at line ',
* isysflb(nflb),' but npage = 0. Continue?'
read(*,'(a)') charq
if (index('yY',charq) .eq. 0) stop 1
else if (isysflb(nflb) .gt. nsyst) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Forced line break at line num > nsyst!')
stop 1
else if (index(' PM',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Must have " ", "P", or "M" here!')
stop 1
end if
if (durq .eq. 'P') then
c
c Forced page break here, get page number.
c
call getchar(lineq,iccount,durq)
if (index('123456789',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Need integer to define forced page break!')
stop 1
end if
call readnum(lineq,iccount,durq,fnum)
nfpb = nfpb+1
ipagfpb(nfpb) = fnum+.1
isysfpb(nfpb) = isysflb(nflb)
end if
if (index(' M',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character in linebreak symbol!')
stop 1
else if (durq .eq. 'M') then
call getchar(lineq,iccount,durq)
31 if (durq .eq. '+') then
c
c Vertical spacing, read past number.
c
call getchar(lineq,iccount,durq)
if (index('123456789',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Integer required here!')
stop 1
end if
call readnum(lineq,iccount,durq,fnum)
go to 31
else if (durq .eq. 'i') then
c
c Change indentation, read past number
c
call getchar(lineq,iccount,durq)
if (index('.123456789',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Decimal number required here!')
stop 1
end if
call readnum(lineq,iccount,durq,fnum)
go to 31
else if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after Movement break symbol!')
stop1
end if
end if
else if (charq .eq. 'F') then
usefig = .false.
else if (charq .eq. 'X') then
call getchar(lineq,iccount,charq)
if (charq .eq. ':') then
if (.not.shifton) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'You ended a 1-voice shift without starting one!')
stop 1
else if (lineq(iccount+1:iccount+1) .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* '":" (end shift) must be followed by a blank here!')
stop 1
end if
shifton = .false.
else if (index('0123456789.-',charq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'This character must be "." , "-" , or a digit!')
stop 1
else
if (charq.eq.'-') iccount = iccount+1
call readnum(lineq,iccount,durq,fnum)
if (charq.eq.'-') fnum = -fnum
if (index(':Sp ',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'This must be ":" , "S" , "p" , or blank!')
stop 1
else if (index(':Sp',durq).gt.0 .and.
* lineq(iccount+1:iccount+1).ne.' ') then
call errmsg(lineq,iccount+1,ibarcnt-ibaroff+nbars+1,
* 'There must be a blank here!')
stop 1
end if
if (durq .eq. ':') then
shifton = .true.
else
if (durq .ne. 'p') fnum = fnum*wheadpt
udsp(ibarcnt+nbars+1) = udsp(ibarcnt+nbars+1)+fnum
end if
end if
else if (charq .eq. 'M') then
call setmac(lineq,iccount,ibarcnt,ibaroff,nbars,charq,durq)
else
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character!')
stop 1
end if
return
end
subroutine getchar(lineq,iccount,charq)
common /comget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
* inchord
logical lastchar,issegno,isheadr,isvolt,fbon,inchord
common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
logical mrecord,mplay,endmac
character*1 charq
character*128 lineq,lnholdq
c
c Gets the next character out of lineq*128. If pointer iccount=128 on entry,
c then reads in a new line. Resets iccount. Ends program if no more input.
c
if (iccount .eq. 128) then
call read10(lineq,128,lastchar)
if (lastchar) return
if (.not.endmac) then
iccount = 0
if (.not.mplay) nline = nline+1
else
endmac = .false.
iccount = icchold
lineq = lnholdq
end if
if (mrecord) then
call mrec1(lineq,iccount,ibarcnt,ibaroff,nbars,ndxm)
end if
end if
iccount = iccount+1
charq = lineq(iccount:iccount)
return
end
function ifnodur(idur,dotq)
character*1 dotq
if (idur .eq. 6) then
ifnodur=1
else if (idur .eq. 3) then
ifnodur=2
else if (idur .eq. 1) then
ifnodur=4
else if (idur .eq. 8) then
ifnodur=8
else if (idur .eq. 4) then
ifnodur=16
else if (idur .eq. 2) then
ifnodur=32
else if (idur .eq. 0) then
ifnodur=64
else if (idur .eq. 16) then
c
c Only used for denominator of time signatures, not for notes
c
ifnodur=4
else if (idur .eq. 9) then
ifnodur = 128
else
print*
print*,'You entered an invalid note-length value:',idur
stop 1
end if
if (dotq .eq. 'd') ifnodur = ifnodur*3/2
return
end
subroutine makeabar()
parameter (nm=7,nkb=500,nbz=200)
common /all/ iv,list(4,nbz),nnl(nm),nv,ibar,
* ipl(nm,nbz),mtrnuml,
* nodur(nm,nbz),jn,lenbar,iccount,nbars,itsofar(nm),
* nib(nm,15),nn(nm),
* rest(nm,nbz),lenbr0,lenbr1,firstline,newmeter
common /linecom/ elskb
common /comnotes/ nnodur,wminnh(nkb),nnpd(2000),durb(2000),
* nptr(nkb),ibarcnt,ieminb(nkb),iemaxb(nkb),mbrest,ibarmbr,
* ibaroff,udsp(nkb),wheadpt
common /commvl/ nvmx(nm),ivmx(nm,2),ivx,fbar
logical rest,firstline,newmeter,intup,herext
integer it(nm),cnn(nm),istart(20),istop(20),itstart(20),
* nspace(20),nindex(20)
elskb = 0.
c ieminb(ibarcnt) = 1000
ieminb(ibarcnt) = 0
c iemaxb(ibarcnt) = 0
do 1 iv = 1 , nv
do 1 kv = 1 , nvmx(iv)
ivx = ivmx(iv,kv)
if (ibar .gt. 1) then
nn(ivx) = nib(ivx,ibar)-nib(ivx,ibar-1)
else
nn(ivx) = nib(ivx,ibar)
end if
1 continue
c
c initialize list note counter, time(iv), curr. note(iv)
c
ilnc = 1
do 4 iv = 1 , nv
do 4 kv = 1 , nvmx(iv)
ivx = ivmx(iv,kv)
cnn(ivx) = 1
2 list(1,ilnc) = ivx
list(2,ilnc) = cnn(ivx)
list(3,ilnc) = 0
it(ivx) = nodur(ivx,cnn(ivx))
if (nodur(ivx,cnn(ivx)).eq.0) then
c
c To keep all notes of xtup together, get another note from this voice
c
ilnc = ilnc+1
cnn(ivx) = cnn(ivx)+1
go to 2
end if
if (it(ivx) .eq. lenbar) it(ivx) = 1000
ilnc = ilnc+1
4 continue
c
c Build the list
c
5 continue
c
c Determine which voice comes next from end of notes done so far.
c itmin is the earliest ending time of notes done so far
c
itmin = 1000
do 6 iv = 1 , nv
do 6 kv = 1 , nvmx(iv)
ivx = ivmx(iv,kv)
itminn = min(itmin,it(ivx))
if(itminn .lt. itmin) then
itmin = itminn
ivnext = ivx
end if
6 continue
if (itmin .eq. 1000) go to 7
list(1,ilnc) = ivnext
cnn(ivnext) = cnn(ivnext)+1
list(2,ilnc) = cnn(ivnext)
list(3,ilnc) = itmin
c
c Check if this voice is done
c
if (cnn(ivnext) .eq. nn(ivnext)) then
it(ivnext) = 1000
else
it(ivnext) = it(ivnext)+nodur(ivnext,cnn(ivnext))
end if
ilnc = ilnc+1
go to 5
7 continue
ntot = ilnc-1
do 8 in = 1 , ntot-1
list(4,in) = list(3,in+1)-list(3,in)
8 continue
list(4,ntot) = nodur(list(1,ntot),list(2,ntot))
c
c Debug writes
c
c write(*,'(26i3)')(list(1,in),in=1,ntot)
c write(*,'(26i3)')(list(2,in),in=1,ntot)
c write(*,'(26i3)')(list(3,in),in=1,ntot)
c write(*,'(26i3)')(list(4,in),in=1,ntot)
c write(*,'(26i3)')(nodur(list(1,in),list(2,in)),in=1,ntot)
c
c Done w/ list. A kluged up loop for building note blocks:
c
ib = 1
istart(1) = 1
nspace(1) = 0
in = 1
9 continue
if (in .eq. ntot) then
if (nspace(ib) .eq. 0) nspace(ib)=list(4,in)
istop(ib) = ntot
c
c Now we flow out of this if and into block-building
c
else if (nspace(ib) .eq. 0) then
c
c nspace hasn't been set yet, so tentatively set:
c
nspace(ib) = list(4,in)
if (nspace(ib) .eq. 0) then
in=in+1
else
istop(ib) = in
end if
go to 9
else if (list(4,in+1) .eq. 0) then
c
c This is not the last note in the group, so
c
in = in+1
go to 9
else if (list(4,in+1) .eq. nspace(ib)) then
c
c Keep spacing the same, update tentative stop point
c
in = in+1
istop(ib) = in
go to 9
end if
c
c At this point istart and istop are good, so close out block
c
itstart(ib) = list(3,istart(ib))
nindex(ib) = kindxf(nspace(ib))
ieminb(ibarcnt) = ior(ieminb(ibarcnt),2**nindex(ib))
c iemaxb(ibarcnt) = max(iemaxb(ibarcnt),nindex(ib))
elsperns = feon(float(nspace(ib)))
if (istop(ib) .eq. ntot) then
nnsk = (lenbar-itstart(ib))/nspace(ib)
else
nnsk = (list(3,istop(ib)+1)-itstart(ib))/nspace(ib)
end if
elskb = elskb+elsperns*nnsk
if (nptr(ibarcnt+1) .gt. nptr(ibarcnt)) then
call catspace(float(nspace(ib)),nnsk)
else
c
c This is the first entry for this bar
c
nnpd(nptr(ibarcnt)) = nnsk
durb(nptr(ibarcnt)) = nspace(ib)
nptr(ibarcnt+1) = nptr(ibarcnt+1)+1
end if
if (istop(ib) .eq. ntot) go to 15
c
c End of spatial accounting for now
c
ib = ib+1
istart(ib) = istop(ib-1)+1
in = istart(ib)
c
c Set tentative block space for new block
c
nspace(ib) = list(4,in)
istop(ib) = in
go to 9
15 continue
nb = ib
c write(*,'(24i3)')(istart(ib),istop(ib),ib=1,nb)
c
c Run through blocks, correcting elskb as needed for xtuplets
c
do 100 ib = 1 , nb
herext = .false.
intup = .false.
do 101 in = istart(ib) , istop(ib)
if (nodur(list(1,in),list(2,in)) .eq. 0) then
if (.not.herext) then
c
c New window with some number of xtups starts here.
c
ntupm = 0
herext = .true.
itxstart = list(3,in)
end if
if (.not.intup) then
c
c New xtup starts here
c
ntup = 0
intup = .true.
end if
ntup = ntup+1
go to 101
else if (intup) then
c
c xtup ends here
c
ntup = ntup+1
lxtup = nodur(list(1,in),list(2,in))
if (ntup .ge. ntupm) ntupm=ntup
intup = .false.
end if
if (herext .and.
* (in.eq.istop(ib).or.list(3,in+1).ne.itxstart)) then
c
c Finished with all notes starting where xtup starts, so close out.
c
ixtend = itxstart+lxtup
c
c Compute "natural" length (in *elemskips) of xtuplet
c
elxtup = ntupm*feon(lxtup/1./ntupm)
c
c Compute natural lengths of other stuff spanning same time interval
c
if (ixtend .le. list(3,istop(ib))+list(4,istop(ib))) then
c
c xtup is contained in a single block
c
nsk = lxtup/nspace(ib)
elother = nsk*feon(lxtup/1./nsk)
else
c
c xtup spills over to next block
c
ltime = itstart(ib+1)-itxstart
nsk = ltime/nspace(ib)
elother = nsk*feon(float(nspace(ib)))
do 103 iib = ib+1 , nb
if (ixtend .le.
* list(3,istop(iib))+list(4,istop(iib))) then
ltime = ixtend-itstart(iib)
nsk = ltime/nspace(iib)
elother = elother+nsk*feon(float(nspace(iib)))
go to 104
else
ltime = list(3,istop(iib))+list(4,istop(iib))
* -itstart(iib)
nsk = ltime/nspace(iib)
elother = elother+nsk*feon(float(nspace(iib)))
end if
103 continue
end if
104 continue
elskb = elskb+dim(elxtup,elother)
if (elxtup .gt. elother) then
c
c Need to adjust catalog of tspaces
c
call catspace(float(lxtup)/ntupm,ntupm)
call catspace(float(lxtup),-1)
end if
herext = .false.
ntupm = 0
end if
101 continue
100 continue
c
c Eliminate any zeroes in nnpd. Manual loop since upper limit may change.
c
iptr = nptr(ibarcnt)
105 continue
if (iptr .gt. nptr(ibarcnt+1)-1) go to 106
if (nnpd(iptr) .eq. 0) then
nptr(ibarcnt+1) = nptr(ibarcnt+1)-1
do 107 iiptr = iptr , nptr(ibarcnt+1)-1
nnpd(iiptr) = nnpd(iiptr+1)
durb(iiptr) = durb(iiptr+1)
107 continue
else
iptr = iptr+1
end if
go to 105
106 continue
return
end
function feon(time)
c feon = max(1.8,1.+alog(time/2)/.69315)
feon = sqrt(time/2)
return
end
function kindxf(nspace)
kindxf = 2*alog(nspace*1.)/0.69315 + 1.3
return
end
function tspace(ie)
if (mod(ie,2).eq.0) then
tspace = .75*2.**(ie/2)
else
tspace = sqrt(2.**(ie-1))
end if
return
end
subroutine catspace(tspace,nnsk)
parameter (nkb=500)
common /comnotes/ nnodur,wminnh(nkb),nnpd(2000),durb(2000),
* nptr(nkb),ibarcnt,ieminb(nkb),iemaxb(nkb),mbrest,ibarmbr,
* ibaroff,udsp(nkb),wheadpt
do 16 iptr = nptr(ibarcnt) , nptr(ibarcnt+1)-1
if (abs(tspace-durb(iptr)) .lt. 0.001) then
c
c Must increment old entry
c
nnpd(iptr) = nnpd(iptr)+nnsk
return
end if
16 continue
c
c Didn't find current duration, must add a new entry
c
do 18 iptr = nptr(ibarcnt) , nptr(ibarcnt+1)-1
if (tspace .lt. durb(iptr)) then
c
c New entry will go at this iptr. Bump up the rest
c
do 19 jptr = nptr(ibarcnt+1)-1 , iptr , -1
nnpd(jptr+1) = nnpd(jptr)
durb(jptr+1) = durb(jptr)
19 continue
nnpd(iptr) = nnsk
durb(iptr) = tspace
nptr(ibarcnt+1) = nptr(ibarcnt+1)+1
return
end if
18 continue
c
c New entry goes at the end
c
nnpd(nptr(ibarcnt+1)) = nnsk
durb(nptr(ibarcnt+1)) = tspace
nptr(ibarcnt+1) = nptr(ibarcnt+1)+1
return
end
subroutine chklit(lineq,iccount,literr)
character*128 lineq
character*1 charq
literr = 0
itype = 1
17 call getchar(lineq,iccount,charq)
if (charq .eq. char(92)) then
itype = itype+1
if (itype .gt. 3) then
literr = 1
return
end if
go to 17
end if
lenlit = itype
18 call getchar(lineq,iccount,charq)
if (charq.eq.char(92)) then
call getchar(lineq,iccount,charq)
if (charq .ne. ' ') then
c
c Starting a new tex command withing the string
c
lenlit = lenlit+2
if (lenlit .gt. 128) then
literr = 2
return
c print*,'TeX string must have <80 char, end w/ " '
c * //char(92)//'"'
c stop
end if
go to 18
end if
else
lenlit = lenlit+1
if (lenlit .gt. 128) then
literr = 2
return
end if
go to 18
end if
return
end
subroutine readnum(lineq,iccount,durq,fnum)
character*128 lineq
character*1 durq
i1 = iccount
1 call getchar(lineq,iccount,durq)
if (index('0123456789.',durq) .gt. 0) go to 1
i2 = iccount-1
if (i2 .lt. i1) then
print*,'Found "'//durq//'" instead of number'
stop 1
end if
icf = i2-i1+49
read(lineq(i1:i2),'(f'//char(icf)//'.0)')fnum
return
end
subroutine readmeter(lineq,iccount,mtrnum,mtrden)
character*128 lineq
character*1 durq
if (index(lineq(iccount+1:iccount+3),'/') .eq. 0) then
c
c No slashes, so use old method
c
call getchar(lineq,iccount,durq)
if (durq .eq. '-') then
c
c Negative numerator is used only to printed; signals vertical slash
c
call getchar(lineq,iccount,durq)
mtrnum = -(ichar(durq)-48)
else if (durq .eq. 'o') then
c
c Numerator is EXACTLY 1
c
mtrnum = 1
else
mtrnum = ichar(durq)-48
if (mtrnum .eq. 1) then
c
c Numerator is >9
c
call getchar(lineq,iccount,durq)
mtrnum = 10+ichar(durq)-48
end if
end if
call getchar(lineq,iccount,durq)
if (durq .eq. 'o') then
mtrden = 1
else
mtrden = ichar(durq)-48
if (mtrden .eq. 1) then
call getchar(lineq,iccount,durq)
mtrden = 10+ichar(durq)-48
end if
end if
else
c
c Expect the form m[n1]/[n2]/[n3]/[n4] . Advance iccount by one from '/' or 'm'
c
iccount = iccount+1
ns = index(lineq(iccount:128),'/')
read(lineq(iccount:iccount+ns-2),'(i'//char(48+ns)//')')mtrnum
c
c Reset iccount to start of second integer
c
iccount = iccount+ns
c
c There must be either a slash or a blank at pos'n 2 or 3
c
ns = index(lineq(iccount:iccount+2),'/')
if (ns .eq. 0) ns = index(lineq(iccount:iccount+2),' ')
read(lineq(iccount:iccount+ns-2),'(i'//char(48+ns)//')')mtrden
c
c Set iccount to last character used
c
iccount = iccount+ns-1
end if
return
end
subroutine errmsg(lineq,iccount,ibarno,msgq)
common /comget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
* inchord
logical lastchar,fbon,issegno,isheadr,isvolt,inchord
character*128 lineq
character*78 outq
character*128 msgq
if (iccount .le. 78) then
outq = lineq(1:78)
iposn = iccount
else
outq = '... '//lineq(55:128)
iposn = iccount-50
end if
print*
ndigbn = max(1,int(log10(ibarno+.1)+1))
ndignl = int(log10(nline+.1)+1)
lenmsg = index(msgq,'!')-1
c write(*,'(a15,i'//char(48+ndignl)//',a6,i'//char(48+ndigbn)//
write(*,'(/,a15,i'//char(48+ndignl)//',a6,i'//char(48+ndigbn)//
*',a)')' ERROR in line ',nline,', bar ',ibarno,': '//msgq(1:lenmsg)
i10 = iposn/10
i1 = iposn-10*i10
c write(*,'('//char(48+i10)//char(48+i1)//'x,a)')char(25)
write(*,'('//char(48+i10)//char(48+i1)//'x,a)')'v'
print*,outq(1:78)
c write(*,'('//char(48+i10)//char(48+i1)//'x,a)')char(24)
write(*,'('//char(48+i10)//char(48+i1)//'x,a)')'^'
return
end
block data
common /compage/ widthpt,ptheight,nsyst,nflb,ibarflb(0:40),
* isysflb(0:40),npages,nfpb,ipagfpb(0:10),isysfpb(0:10),
* usefig,fintstf,gintstf
common /cblock/
* etatop,etabot,etait,etatc,etacs1,hgtin,hgtti,hgtco,
* xilbn,xilbtc,xilhdr,xilfig,a,b,inbothd,inhnoh
logical usefig
data ptheight,widthpt,
* etatop,etabot,etait,etatc,etacs1,hgtin,hgtti,hgtco,
* xilbn,xilbtc,xilhdr,xilfig,a,b,inbothd,inhnoh
* / 740. , 524. ,
* .50 , .25 , 0.4 , 0.4 , 0.2 , 12. ,21. , 12.,
* 4 , 1.6 ,5.,5.7,1.071,2.714,16 ,16 /
end
subroutine mrec1(lineq,iccount,ibarcnt,ibaroff,nbars,ndxm)
c
c This is called when (a) macro recording is just starting and
c (b) at the start of a new line, if recording is on
c
character*128 lineq,lnholdq
common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
logical mrecord,mplay,endmac
if (.not.mrecord) then
c
c Starting the macro
c
open(20+macnum,status='SCRATCH')
mrecord = .true.
end if
if (iccount .lt. 128) then
ndxm = index(lineq(iccount+1:128),'M')
if (ndxm .gt. 0) then
c
c This line ends the macro.
c
if (lineq(iccount+ndxm+1:iccount+ndxm+1) .ne. ' ') then
call errmsg(lineq,iccount+ndxm+1,ibarcnt-ibaroff+nbars+1,
* 'Improper macro termination!')
stop 1
end if
c if (iccount.gt.0) then
c
c Check that M is not the only character in the line
c
c if (iccount.ne.1) then
if (ndxm .gt. 1) then
write(20+macnum,'(a)')
* lineq(iccount+1:iccount+ndxm-1)
end if
mrecord = .false.
else
c
c This line just continues the macro
c
write(20+macnum,'(a)')lineq(iccount+1:128)
end if
end if
return
end
subroutine read10(string,lenstr,lastchar)
character*(*) string
character*128 lnholdq
logical lastchar
common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
logical mrecord,mplay,endmac
if (.not.mplay) then
read(10,'(a)',end=999)string(1:lenstr)
return
999 lastchar = .true.
return
else
read(20+macnum,'(a)',end=998)string
return
998 mplay = .false.
endmac = .true.
return
end if
end
subroutine setmac(lineq,iccount,ibarcnt,ibaroff,nbars,charq,durq)
character*1 charq,durq
common /commac/ macnum,mrecord,mplay,macuse,icchold,lnholdq,endmac
logical mrecord,mplay,endmac,btest
character*128 lnholdq,lineq
c
c Macro action
c
call getchar(lineq,iccount,charq)
if (index('RSP ',charq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Illegal character after "M" (macro)!')
stop 1
else if (charq .ne. ' ') then
c
c Record or playback a macro. Get the number of the macro.
c
call getchar(lineq,iccount,durq)
if (index('123456789',durq) .eq. 0) then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Must input number after "MR" or "MP"')
stop 1
end if
call readnum(lineq,iccount,durq,fnum)
macnum = fnum+.1
if (durq .ne. ' ') then
call errmsg(lineq,iccount,ibarcnt-ibaroff+nbars+1,
* 'Macro number must be followed by a blank!')
stop 1
end if
c if (charq .eq. 'R') then
if (index('RS',charq ).gt. 0) then
c
c Record or save a macro
c
if (macnum.lt.1 .or. macnum.gt.20) then
call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
* 'Macro number not in range 1-20!')
stop 1
else if (btest(macuse,macnum)) then
print*
print*,'WARNING: Redefined macro # ',macnum
close(20+macnum)
end if
macuse = ibset(macuse,macnum)
if (charq .eq. 'R') then
call mrec1(lineq,iccount,ibarcnt,ibaroff,nbars,ndxm)
else if (charq .eq. 'S') then
c
c Save (Record but don't activate)
c
1 call mrec1(lineq,iccount,ibarcnt,ibaroff,nbars,ndxm)
if (mrecord) then
read(10,'(a)')lineq
iccount = 0
go to 1
end if
c iccount = ndxm
iccount = iccount+ndxm+1
end if
else
c
c Playback the macro
c
if (.not.btest(macuse,macnum)) then
call errmsg(lineq,iccount-1,ibarcnt-ibaroff+nbars+1,
* 'Cannot play a macro that has not been recorded!')
stop 1
end if
rewind(20+macnum)
icchold = iccount
lnholdq = lineq
iccount = 128
mplay = .true.
end if
end if
return
end
subroutine getset(nv,noinst,mtrnuml,mtrdenl,mtrnmp,mtrdnp,
* xmtrnum0,newkey,npages,nsyst,musicsize,fracindent,bottreb)
character*128 lineq
logical lastchar,issegno,isheadr,isvolt,inchord,fbon,bottreb
common /comget/ lastchar,fbon,issegno,ihead,isheadr,nline,isvolt,
* inchord
c
c Get the first line
c
iccount = 0
nline = 1
9 read(10,'(a)')lineq
if (lineq(1:1) .eq. '%') then
nline = nline+1
go to 9
end if
if (lineq(1:3) .eq. '---') then
c
c Have TeX input until next line that starts with '---'
c
3 nline = nline+1
read(10,'(a)',end=1)lineq
go to 2
1 print*,'You did not terminate type 0 TeX input with "---"'
stop 1
2 continue
if (lineq(1:3) .ne. '---') go to 3
c
c Force a new line read on first call to readin
c
iccount = 128
end if
c
c Here, lineq and nline are first non-TeX lines.
c
nv = readin(lineq,iccount,nline)+.1
noinst = readin(lineq,iccount,nline)+.1
if (noinst .le. 0) then
noinst = noinst-1
do 10 iinst = 1 , -noinst
xdum = readin(lineq,iccount,nline)
10 continue
end if
mtrnuml = readin(lineq,iccount,nline)+.1
mtrdenl = readin(lineq,iccount,nline)+.1
mtrnmp = readin(lineq,iccount,nline)+.1
mtrdnp = readin(lineq,iccount,nline)+.1
xmtrnum0 = readin(lineq,iccount,nline)
newkey = ni(readin(lineq,iccount,nline))
npages = readin(lineq,iccount,nline)+.1
nsyst = readin(lineq,iccount,nline)+.1
musicsize = readin(lineq,iccount,nline)+.1
fracindent = readin(lineq,iccount,nline)
if (npages .gt. nsyst) then
print*,'Error in input file: npages > nsyst'
stop 1
end if
c
c Next noinst non-comment lines are names of instruments.
c
do 4 i = 1 , abs(noinst)
5 read(10,'(a)')lineq
nline = nline+1
if (lineq(1:1) .eq. '%') go to 5
4 continue
c
c Mext non-comment line has nv clef names
c
6 read(10,'(a)')lineq
nline = nline+1
if (lineq(1:1) .eq. '%') go to 6
do 7 iv = 1 , nv
if (index('brnamst0123456',lineq(iv:iv)) .eq. 0) then
call errmsg(lineq,iv,0,
* 'There should be a clef symbol here!')
stop 1
end if
7 continue
if (lineq(nv+1:nv+1) .ne. ' ') then
call errmsg(lineq,nv+1,0,
* 'There should be a blank here!')
stop 1
end if
c
c Set flag if voice 1 is treble, since it affects vertical spacing
c
bottreb = lineq(1:1).eq.'t'
c
c Mext non-comment line has path name
c
8 read(10,'(a128)')lineq
nline = nline+1
if (lineq(1:1) .eq. '%') go to 8
lpath = index(lineq,' ')-1
if (lineq(lpath:lpath).ne.'/'.and.
* lineq(lpath:lpath).ne.char(92)) then
call errmsg(lineq,lpath,0,
*'Last character of pathname is not / or '//char(92)//'!')
stop 1
end if
return
end
function readin(lineq,iccount,nline)
c
c Reads a piece of setup data from file lineq, gets a new lineq from
c file 10 (jobname.pmx) and increments nline if needed, passes over
c comment lines
c
character*128 lineq
character*1 durq
4 if (iccount .eq. 128) then
1 read(10,'(a)')lineq
nline = nline+1
if (lineq(1:1) .eq. '%') go to 1
iccount = 0
end if
iccount = iccount+1
c
c Find next non-blank or end of line
c
do 2 iccount = iccount , 127
if (lineq(iccount:iccount) .ne. ' ') go to 3
2 continue
c
c If here, need to get a new line
c
iccount = 128
go to 4
3 continue
c
c iccount now points to start of number to read
c
i1 = iccount
5 call getchar(lineq,iccount,durq)
c
c Remember that getchar increments iccount, then reads a character.
c
if (index('0123456789.-',durq) .gt. 0) go to 5
i2 = iccount-1
if (i2 .lt. i1) then
print*,'Found "'//durq//'" instead of number'
stop 1
end if
icf = i2-i1+49
read(lineq(i1:i2),'(f'//char(icf)//'.0)')readin
return
end
function ni(x)
if (x .ge. 0.) then
ni = x+0.5001
else
ni = x-0.5001
end if
return
end
subroutine outbar(i,jlast)
nfmt = log10(i+.5)+2
if (jlast+5+nfmt .lt. 80) then
write(*,'(a5,i'//char(48+nfmt)//',$)')' Bar',i
jlast = jlast+5+nfmt
else
write(*,'(/,a5,i'//char(48+nfmt)//',$)')' Bar',i
jlast = 5+nfmt
end if
return
end
|