1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
|
%%%% email-ru.tex
%% Author: Laurent Siebenmann,
%% Math B^at 425, Univ. Paris-Sud, 91405-Orsay
%% Email addresses: (use several) lcs@topo.math.u-psud.fr,
%% lcs@math.polytechnique.fr, laurent@math.toronto.edu
%%
%% Version 2001.02.06 of Feb 2001 (**beta**)
%% http://topo.math.u-psud.fr/~lcs/ASCII-Cyrillic/
%% Look for future versions on CTAN archives.
%%
%% Copyright conditions according to Gnu Public Licence.
%%
%% This utility converts a new *lossless* ASCII
%% transcription of Russian/Ukrainian text
%% -- called ASCII-Cyrillic --
%% to and from the 5 most used 8-bit Cyrillic
%% text file encodings. (Others can be introduced.)
%%
%% "email-ru.tex" is particularly useful for
%% persons outside of Russia obliged to use
%% a non-Cyrillic keyboard for typing Russian.
%%
%% It is also good for viewing Cyrillic
%% text files (including ".tex" files)
%% when one has no suitable Cyrillic screen font.
%%
%% It allows Cyrillic 8-bit text files to be sent
%% in the body of any email message.
%% This feature inspired the name "email-ru.tex".
%%
%% Launch "Plain TeX" of D. Knuth on this file.
%% The usual command line is simply:
%% tex email-ru <return>
%% Then follow instructions given on screen.
%% Documentation follows the last \endinput.
%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%% Params and Tools %%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\catcode`\@=11
\catcode`\/=13
\catcode`\|=13
\chardef\CatOne@=\catcode1\relax %% storage
\catcode1=13 % A syntactical trick for AccIN
%% \HiOctetsCat@{13} will be in force for assimilation
\errorcontextlines=20
\let\ex@\expandafter
\let\cs@\csname
\let\ecs@\endcsname
\let\ne@\noexpand
\def\@e{}
\endlinechar=-1
\def\Sharp@{\string##}
%%temporarily suppress Plain's logging of allocations
\let\wlog@ld\wlog
\def\wlog#1{\relax}
\newif \ifGoodOptions@
\def\empty{}
\def\Line@{}
\ex@\def\cs@ email-ru-version\ecs@{v2001.02.06}
%% Will use loops with fuller syntax
\def\Loop@#1\Repeat@{%
\def\Iterate@{#1\expandafter\Iterate@\fi}%
\Iterate@}
\def\iwr@{\immediate\write16}%
\def\wr@{\immediate\write\MainStreamOut@}%
%\def\Wr@#1{\iwr@{#1}\wr@{#1}} %% for tests
\let\Wr@\wr@ %% for tests
%\def\@EndLine{}%
\def\Gobble@#1{}%
\edef\OtherBacksl@{\ex@\Gobble@\string\\}%
\def\ExpTwiceAfter@{\ex@\ex@\ex@}%
\def\ExpThriceAfter@{\ex@\ExpTwiceAfter@\ex@}%
\def\ExpFourTimesAfter@{\ex@\ExpThriceAfter@\ex@}%
\ifx\undefined\@@end
\let\End\end
\else
\def\End{\cs@ @@end\ecs@}
\fi
%%%% WORD-PROCESSING MACROS from boxedeps.tex
%% %% \long was evicted for email-ru
%%% \IN@0#1@#2@ : Is 1st exp of #1 in 1st exp of #2 ??
%% Answer in \ifIN@
%\let\ex@\expandafter
\newif\ifIN@\def\IN@{\ex@\INN@\ex@}
\def\INN@0#1@#2@{\def\NI@##1#1##2##3\ENDNI@
{\ifx\m@rker##2\IN@false\else\IN@true\fi}%
\ex@\NI@#2@@#1\m@rker\ENDNI@}
\def\m@rker{\m@@rker}
%%% \SPLIT@0#1@#2@ : Split 1st exp of #2 at 1st exp of #1
%% \Initialtoks@ , \Terminaltoks@ will contain pieces
\newtoks\Initialtoks@ \newtoks\Terminaltoks@
\def\SPLIT@{\ex@\SPLITT@\ex@}
\def\SPLITT@0#1@#2@{\def\TTILPS@##1#1##2@{%
\Initialtoks@{##1}\Terminaltoks@{##2}}\ex@\TTILPS@#2@}
%%% \CHAIN@
\newtoks\Chaintoks@
\newtoks\Linktoks@
\def\CHAIN@{%
\edef\Chainholder@{\the\Chaintoks@\the\Linktoks@}%
\Chaintoks@\ex@{\Chainholder@}%
}
\newlinechar=`\^^J
\def\ChainLine@{\Linktoks@\ex@{\ex@^^J\Line@}\CHAIN@}
%%%%% ARITHMETIC MACRO \SetCharValue@#1
%% Supposing #1 has 1st expansion a character cat 11 ot 12
%% assign the octet to byte register \Char@
\def\SetCharValue@#1{\ex@\chardef\ex@\Char@\ex@`#1\relax}
%% \def\mac{a}\SetCharValue@{a}
%% \show\Char@\end
%%%%% \HiOctetsCat@#1
%%%
\def\HiOctetsCat@#1{%
\count255=128\relax
\Loop@
\catcode\count255=#1\relax
\advance\count255 by 1\relax
\ifnum
\count255<256\relax
\Repeat@
}
%%%%% \LowOctetsCat@#1
%%%
\def\LowOctetsCat@#1{%
\count255=0\relax
\Loop@
\catcode\count255=#1\relax
\advance\count255 by 1\relax
\ifnum
\count255<32\relax
\Repeat@
\catcode127=#1\relax
}
%%%%% \ASCIIOctetsCat@#1
%%%
\def\ASCIIOctetsCat@#1{%
\count255=32\relax
\Loop@
\catcode\count255=#1\relax
\advance\count255 by 1\relax
\ifnum
\count255<126\relax
\Repeat@
}
\def\MakeSlantPct@{\lccode`\~=`\%
\lowercase{\edef/{\string ~}}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%% Tables %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% \@LigShorts...: Ru and Ukr variants
%% was \@HiOctetLigOutEncoding
\def\@LigShortsRu{%
/A A /B B /V V /G G /D D /E E /ZH ZH /Z Z %
/I I /ISHRT J /K K /L L /M M /N N /O O /P P %
/R R /S S /T T /U U /F F /H X /C TS /CH CH %
/SH SH /SHCH SHCH /HRDSN " %
/ERY Y /SFTSN ' /EREV E /YU JU /YA JA /YO E %
/a a /b b /v v /g g /d d /e e /zh zh /z z %
/i i /ishrt j /k k /l l /m m /n n /o o /p p %
/r r /s s /t t /u u /f f /h x /c ts /ch ch %
/sh sh /shch shch /hrdsn " %
/ery y /sftsn ' /erev e /yu ju /ya ja /yo e %
/USHRT U /ushrt u %% Byelorussian
/II II /ii ii %% Byelorussian (& Ukr)
%/textnumero No %
%/guillemotleft << %
%/guillemotright >> %
}
%%%%%% \@LigShortsUkr
%%% program also treats word-beginning phenomena:
%%% '{IE} => Ye, '{YI} => Yi, '{ISHRT} => Y
%%% '{YU} => Yu, '{YA} => Ya; also lower case
\def\@LigShortsUkr{\let\temp@=\0 \def\0{}%
/A A /B B /V V /G H /GUP G /D D /E E /IE IE /ZH ZH /Z Z %
/I Y /II I /YI I /ISHRT I /K K /L L /M M /N N /O O /P P %
/R R /S S /T T /U U /F F /H KH /C TS /CH Ch %
/SH Sh /SHCH Shch %% /HRDSN gone!
/APOS ' %
/SFTSN \0 /YU Iu /YA Ia %% avoid missing space problem
/a a /b b /v v /g h /gup g /d d /e e /ie ie /zh zh /z z %
/i y /ii i /yi i /ishrt i /k k /l l /m m /n n /o o /p p %
/r r /s s /t t /u u /f f /h kh /c ts /ch ch %
/sh sh /shch shch %% /hrdsn gone!
/sftsn \0 /yu iu /ya ia %% avoid missing space problem
/apos ' %
%/textnumero No %
%/guillemotleft << %
%/guillemotright >> %
\let\0=\temp@
}
%%%%% \@SetLigShorts: %% 8 to 7
%% s_ means short as function of LaTeX Tag
\def\@SetLigShorts{%
\def/##1 ##2 {\ex@\edef\cs@ ts_##1\ecs@{##2}%
}
\@TheLigShorts
}
%%%%%% \@AccShortsRu \@AccShortsUkr
\def\@AccShortsRu{%
/A A /B B /V V /G G /D D /E E /ZH 'G /ZH 'Z /Z Z %
/I I /ISHRT J /K K /L L /M M /N N /O O /P P %
/R R /S S /T T /U U /F F /H 'K /H X /C C /C 'T %% last dominates
/CH 'C /SH 'S /SH W /SHCH 'W /HRDSN Q %
/ERY Y /SFTSN H /EREV 'E /YU 'U /YA 'A /YO 'O %
/a a /b b /v v /g g /d d /e e /zh 'g /zh 'z /z z %
/i i /ishrt j /k k /l l /m m /n n /o o /p p %
/r r /s s /t t /u u /f f /h 'k /h x /c c /c 't /ch 'c %
/sh 's /sh w /shch 'w /hrdsn q %
/ery y /sftsn h /erev 'e /yu 'u /ya 'a /yo 'o %
%% Byelorussian
/USHRT 'V /ushrt 'v %% Byelorussian only
/II 'I /ii 'i %% Byelorussian (& Ukr but then I,i)
%% Following of questionable benefit
%/textnumero 'N %
%/guillemotleft '< %
%/guillemotright '> %
}
\def\@AccShortsUkr{%
/A A /B B /V V /G H /G G % preferred last
/GUP 'G /D D /E E /IE 'E /ZH 'Z /Z Z %
/I Y /II I /YI 'I /ISHRT J /K K /L L /M M /N N /O O /P P %
/R R /S S /T T /U U /F F /H 'K /H X /C C /C 'T /CH 'C %
/SH 'S /SH W /SHCH 'W %% HRDSN not Ukr
/YA 'A /YU 'U /SFTSN Q %% /YO 'O
/APOS '* %
%
/a a /b b /v v /g h /g g % preferred last
/gup 'g /d d /e e /ie 'e /zh 'z /z z %
/i y /ii i /yi 'i /ishrt j /k k /l l /m m /n n /o o /p p %
/r r /s s /t t /u u /f f /h 'k /h x /c c /c 't /ch 'c %
/sh 's /sh w /shch 'w %% hrdsn not ukr
/ya 'a /yu 'u /sftsn q %% /yo 'o
%
/apos '* %
}
\def\@SetAccOutShorts{%
\def/##1 ##2 {\ex@\def\cs@ ts_##1\ecs@{##2}}%
\@TheAccShorts
}
\def\@SetAccInShortsA{%
\def/##1 ##2 {\ex@\def\cs@ ts_##1\ecs@{##2}%
\ex@\edef\cs@ to_##1\ecs@{'\lbrace@##1\rbrace@}%% prelim background
}
\@TheAccShorts
}
\def\@SetAccInShortsB{%
\def/##1 ##2 {\ex@\edef\cs@ so_##2\ecs@{\cs@ to_##1\ecs@}}%
\@TheAccShorts
}
%%%%%%% \@LetterTags
%% list of all Cyrillic letter alphabetic tags used
%\def\@LetterTags{%
% %% Russian
% /A A /B B /V V /G G /D D /E E /ZH 'Z /Z Z %
% /I I /ISHRT J /K K /L L /M M /N N /O O /P P %
% /R R /S S /T T /U U /F F /H X /C 'T /CH C %
% /SH W /SHCH 'W /HRDSN Q %
% /ERY Y /SFTSN H /EREV 'E /YU 'U /YA 'A /YO 'O %
% %% + for Ukr, Byelorussian, Yug, Macedonian
% /DJE /DZE /DZHE /GJE /GUP /GUP /IE /II %
% /JE /KJE /LJE /NJE /TSJE /USHRT /YI %
% /APOS %
% %% + for Tatar and other
% /CHVCRS /KBEAK /NDSC /OTLD /SCHWA /SHHA /VCRS
% /Y /ZHDSC
% }
%%%%%% \@IdentifyAccInLetterTags
% %% \te_<tag> --> \@e if abstract letter exists else \relax
%\def\@IdentifyAccInLetterTags{%
% \def/##1 {\ex@\def\cs@ te_##1\ecs@{}}%
% \@LetterTags}
%%%%%%% \@DiacriticStrings
%% table with 3 columns, / active three arg
%% #1 = LaTeX tag if known, #2 = short in letters,
%% #3 short in freestyle.%
%% | gives syntactical workaround
%% to be '[<thestring>]
\def\@DiacriticStrings{%
/Delta,Delta,Delta.%
|{quotedblbase}{LLQ}{,,}%
|{quotesinglbase}{llq}{,}%
/textquotedblleft,LQ,``.%
/textquotedblright,RQ,".
%%/textquotedblright,RQ,''.% omit?????????????
%% double fails to define '["] last one wins
%% simply because only the map T --> S tag
%% to short tag currently used
/textquoteleft,lq,`.%
/textquoteright,rq,'.%
/textnumero,No,No.%
/textblacksquare,blacksquare,blacksquare.%
/paragraph,par,P.%
/section,section,S.%
/approx,approx,\string~\string~.%
/textbullet,bullet,**.%
/textperiodcentered,cdot,cdot.%
/textbrokenbar,bbar,bbar.%
/textcent,cent,cent.%
/copyright,cp,copyright.%
/textcurrency,coin,currency.%
/dagger,dag,dag.%
/ddagger,ddag,ddag.%
/degree,deg,deg.%
/divide,divide,div.%
|{dots}{dots}{...}%
/euro,euro,euro.
/florin,florin,florin.%
/lnot,lnot,neg.%
/lessequal,leq,<=.%
/greaterequal,geq,>=.%
/guillemotleft,LG,<<.%
/guillemotright,RG,>>.%
/guilsinglleft,lg,<.%
/guilsinglright,rg,>.%
/infinity,infty,infty.%
/mu,mu,mu.%
/nobreakspace,nbsp,nbsp.%
/textemdash,emdash,---.%
/textendash,endash,--.%
|{notequal}{neq}{\string/=}%
/perthousand,perK,perK.%
/partialdiff,partial,partial.%
/pounds,pounds,pounds.%
/plusminus,pm,+-.%
/textregistered,reg,registered.%
/softhyphen,shy,\string\-.
/solidus,solidus,solidus.
/radical,surd,surd.%
/texttrademark,tm,trademark.%
%/ukrhard,rq,'.%
}
%%%%% \@SetDiacShorts defines some \TS_<tag> --> <7short>
%% Caps for diacritics, T for my tex tag, S for short
%% Extracts info from \@DiacriticStrings
\def\@SetDiacShorts{%
\def/##1,##2,##3.{\ex@\edef\cs@ TS_##2\ecs@{##3}}%
\def|##1##2##3{\ex@\edef\cs@ TS_##2\ecs@{##3}}%
\@DiacriticStrings
}
%%%%%%%% Encoding Vectors
%% Each defines meanings for 128--255
%% /??. letter with tag ??
%% |??. non-letter with tag ??
%% /. undefined 'meaningless'
%% /apos. Cyrillic apostrophe if used by language
%% and otherwise equivalent to |rq. (right quote)
%%%%%%% DosEncoding
%% Creator: Microsoft DOS code page 866
%% LaTeX Tag: cp866nav
%% Comment: Covers Russian, Byelorussian, Ukrainian
%%+ Many variants exist.
%%+ This is the New Alternative Variant (NAV)
\def\DosEncodingVect@{%
/A./B./V./G./D./E./ZH./Z.%% "80--
/I./ISHRT./K./L./M./N./O./P.%% --"8F
/R./S./T./U./F./H./C./CH.%% "90--
/SH./SHCH./HRDSN./ERY./SFTSN./EREV./YU./YA.%% --"9F
/a./b./v./g./d./e./zh./z.%% "A0--
/i./ishrt./k./l./m./n./o./p.%% --"AF
\.\.\.\.\.\.\.\.%% "B0--
\.\.\.\.\.\.\.\.%% --"BF
\.\.\.\.\.\.\.\.%% "C0--
\.\.\.\.\.\.\.\.%% --"CF
\.\.\.\.\.\.\.\.%% "D0--
\.\.\.\.\.\.\.\.%% --"DF
/r./s./t./u./f./h./c./ch.%% "E0--
/sh./shch./hrdsn./ery./sftsn./erev./yu./ya.%% --"EF
/YO./yo./GUP./gup./IE./ie./II./ii.%% "F0--
/YI./yi./USHRT./ushrt.|No.|LG.|RG.|nbsp.%% --"FF
}
%%%%%%% MacEncoding
%% LaTeX Tag: macukr
%% Comment: Covers Russian, Byelorussian, Ukrainian
\def\MacEncodingVect@{%
/A./B./V./G./D./E./ZH./Z.%% "80--
/I./ISHRT./K./L./M./N./O./P.%% --"8F
/R./S./T./U./F./H./C./CH.%% "90--
/SH./SHCH./HRDSN./ERY./SFTSN./EREV./YU./YA.%% --"9F
|dag.|deg./GUP.|pounds.|section.|cdot.|par./II.%% "A0--
|reg.|cp.|tm./TSJE./tsje.|neq./GJE./gje.%% --"AF
|infty.|pm.|leq.|geq./ii.|mu./gup./JE.%% "B0--
/IE./ie./YI./yi./LJE./lje./NJE./nje.%% --"BF
/je./DZE.|lnot.|surd.|florin.|approx.|Delta.|LG.%% "C0--
|RG.|dots.|nbsp./DJE./dje./KJE./kje./dze.%% --"CF
|endash.|emdash.|LQ.|RQ.|lq.\apos.|divide.|LLQ.%% "D0--
/USHRT./ushrt./DZHE./dzhe.|No./YO./yo./ya.%% --"DF
/a./b./v./g./d./e./zh./z.%% "E0--
/i./ishrt./k./l./m./n./o./p.%% --"EF
/r./s./t./u./f./h./c./ch.%% "F0--
/sh./shch./hrdsn./ery./sftsn./erev./yu.|coin.%% --"FF
}
%%%%%%% IsoEncoding
%% LaTeX Tag: ISO88595
%% Comment: ISO~8859-5 also called ISO-IR-144
%% Covers Russian, Byelorussian
%%+ but letter GUP gup of Ukrainian is missing
\def\IsoEncodingVect@{%
\.\.\.\.\.\.\.\.%% "80--
\.\.\.\.\.\.\.\.%% --"8F
\.\.\.\.\.\.\.\.%% "90--
\.\.\.\.\.\.\.\.%% --"9F
|nbsp./YO./TSJE./GJE./IE./DZE./II./YI.%% "A0--
/JE./LJE./NJE./DJE./KJE.|shy./USHRT./DZHE.%% --"AF
/A./B./V./G./D./E./ZH./Z.%% "B0--
/I./ISHRT./K./L./M./N./O./P.%% --"BF
/R./S./T./U./F./H./C./CH.%% "C0--
/SH./SHCH./HRDSN./ERY./SFTSN./EREV./YU./YA.%% --"CF
/a./b./v./g./d./e./zh./z.%% "D0--
/i./ishrt./k./l./m./n./o./p.%% --"DF
/r./s./t./u./f./h./c./ch.%% "E0--
/sh./shch./hrdsn./ery./sftsn./erev./yu./ya.%% --"EF
|No./yo./tsje./gje./ie./dze./ii./yi.%% "F0--
/je./lje./nje./dje./kje.|section./ushrt./dzhe.%% --"FF
}
%%
%%%%%%% WinEncoding
%% LaTeX Tag: cp1251
%% Comment: Microsoft Windows Cyrillic encoding
%%+ covers Russian, Byelorussian, Ukrainian
\def\WinEncodingVect@{%
/TSJE./GJE.|llq./gje.|LLQ.|dots.|dag.|ddag.%% "80--
|euro.|perK./LJE.|lg./NJE./KJE./DJE./DZHE.%% --"8F
/tsje.|lq.\apos.|LQ.|RQ.|bullet.|endash.|emdash.%% "90--
|solidus.|tm./lje.|rg./nje./kje./dje./dzhe.%% --"9F
|nbsp./USHRT./ushrt./JE.|coin./GUP.|bbar.|section.%% "A0--
/YO.|cp./IE.|LG.|lnot.|shy.|reg./YI.%% --"AF
|deg.|pm./II./ii./gup.|mu.|par.|cdot.%% "B0--
/yo.|No./ie.|RG./je./DZE./dze./yi.%% --"BF
/A./B./V./G./D./E./ZH./Z.%% "C0--
/I./ISHRT./K./L./M./N./O./P.%% --"CF
/R./S./T./U./F./H./C./CH.%% "D0--
/SH./SHCH./HRDSN./ERY./SFTSN./EREV./YU./YA.%% --"DF
/a./b./v./g./d./e./zh./z.%% "E0--
/i./ishrt./k./l./m./n./o./p.%% --"EF
/r./s./t./u./f./h./c./ch.%% "F0--
/sh./shch./hrdsn./ery./sftsn./erev./yu./ya.%% --"FF
}
%
%%%%%%% KoiEncoding "universal version"
%% LaTeX Tag: koi8-u
%% Comment: Russian, Byelorussian, Ukrainian
%%+ Devised for Internet use, 1993.
%%+ -u means 'unified'(?)
\def\KoiEncodingVect@{%
\.\.\.\.\.\.\.\.%% "80--
\.\.\.\.\.\.\.\.%% --"8F
\.|lq.\apos.|LQ.|RQ.|bullet.|endash.|emdash.%% "90--
|cp.|tm.|nbsp.|RG.|reg.|LG.|cdot.|coin.%% --"9F
|nbsp./tsje./gup./yo./ie./dze./ii./yi.%% "A0--
/je./lje./nje./dje./kje./gup./ushrt./dzhe.%% --"AF
|No./TSJE./GUP./YO./IE./DZE./II./YI.%% "B0--
/JE./LJE./NJE./DJE./KJE./GUP./USHRT./DZHE.%% --"BF
/yu./a./b./c./d./e./f./g.%% "C0--
/h./i./ishrt./k./l./m./n./o.%% --"CF
/p./ya./r./s./t./u./zh./v.%% "D0--
/sftsn./ery./z./sh./erev./shch./ch./hrdsn.%% --"DF
/YU./A./B./C./D./E./F./G.%% "E0--
/H./I./ISHRT./K./L./M./N./O.%% --"EF
/P./YA./R./S./T./U./ZH./V.%% "F0--
/SFTSN./ERY./Z./SH./EREV./SHCH./CH./HRDSN.%% --"FF
}
%%%%%%% NullEncoding
%%
\def\NullEncodingVect@{%
\.\.\.\.\.\.\.\.%% "80--
\.\.\.\.\.\.\.\.%% --"8F
\.\.\.\.\.\.\.\.%% "90--
\.\.\.\.\.\.\.\.%% --"9F
\.\.\.\.\.\.\.\.%% "A0--
\.\.\.\.\.\.\.\.%% --"AF
\.\.\.\.\.\.\.\.%% "B0--
\.\.\.\.\.\.\.\.%% --"BF
\.\.\.\.\.\.\.\.%% "C0--
\.\.\.\.\.\.\.\.%% --"CF
\.\.\.\.\.\.\.\.%% "D0--
\.\.\.\.\.\.\.\.%% --"DF
\.\.\.\.\.\.\.\.%% "E0--
\.\.\.\.\.\.\.\.%% --"EF
\.\.\.\.\.\.\.\.%% "F0--
\.\.\.\.\.\.\.\.%% --"FF
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\HiOctetsCat@{13}
\def\HighActiveOctetsHolder@{%
/^^80 80 /^^81 81 /^^82 82 /^^83 83 /^^84 84 /^^85 85 /^^86 86 %
/^^87 87 /^^88 88 /^^89 89 /^^8a 8a /^^8b 8b /^^8c 8c /^^8d 8d %
/^^8e 8e /^^8f 8f /^^90 90 /^^91 91 /^^92 92 /^^93 93 /^^94 94 %
/^^95 95 /^^96 96 /^^97 97 /^^98 98 /^^99 99 /^^9a 9a /^^9b 9b %
/^^9c 9c /^^9d 9d /^^9e 9e /^^9f 9f /^^a0 a0 /^^a1 a1 /^^a2 a2 %
/^^a3 a3 /^^a4 a4 /^^a5 a5 /^^a6 a6 /^^a7 a7 /^^a8 a8 /^^a9 a9 %
/^^aa aa /^^ab ab /^^ac ac /^^ad ad /^^ae ae /^^af af /^^b0 b0 %
/^^b1 b1 /^^b2 b2 /^^b3 b3 /^^b4 b4 /^^b5 b5 /^^b6 b6 /^^b7 b7 %
/^^b8 b8 /^^b9 b9 /^^ba ba /^^bb bb /^^bc bc /^^bd bd /^^be be %
/^^bf bf /^^c0 c0 /^^c1 c1 /^^c2 c2 /^^c3 c3 /^^c4 c4 /^^c5 c5 %
/^^c6 c6 /^^c7 c7 /^^c8 c8 /^^c9 c9 /^^ca ca /^^cb cb /^^cc cc %
/^^cd cd /^^ce ce /^^cf cf /^^d0 d0 /^^d1 d1 /^^d2 d2 /^^d3 d3 %
/^^d4 d4 /^^d5 d5 /^^d6 d6 /^^d7 d7 /^^d8 d8 /^^d9 d9 /^^da da %
/^^db db /^^dc dc /^^dd dd /^^de de /^^df df /^^e0 e0 /^^e1 e1 %
/^^e2 e2 /^^e3 e3 /^^e4 e4 /^^e5 e5 /^^e6 e6 /^^e7 e7 /^^e8 e8 %
/^^e9 e9 /^^ea ea /^^eb eb /^^ec ec /^^ed ed /^^ee ee /^^ef ef %
/^^f0 f0 /^^f1 f1 /^^f2 f2 /^^f3 f3 /^^f4 f4 /^^f5 f5 /^^f6 f6 %
/^^f7 f7 /^^f8 f8 /^^f9 f9 /^^fa fa /^^fb fb /^^fc fc /^^fd fd %
/^^fe fe /^^ff ff }%% watch space before brace
%%% (what about CR and linefeed?)
\begingroup
\LowOctetsCat@{13}%% localized
%\global\let^^0c=\relax %% Textures? Plain?; poluting??
\let^^0c=\relax %% localized
\gdef\LowActiveOctetsHolder@{%% watch gdef; will cleanup after
/^^00 00 /^^01 01 /^^02 02 /^^03 03 /^^04 04 /^^05 05 /^^06 06 %
/^^07 07 /^^08 08 /^^09 09 /^^0a 0a /^^0b 0b /^^0c 0c /^^0d 0d %
/^^0e 0e /^^0f 0f /^^10 10 /^^11 11 /^^12 12 /^^13 13 /^^14 14 %
/^^15 15 /^^16 16 /^^17 17 /^^18 18 /^^19 19 /^^1a 1a /^^1b 1b %
/^^1c 1c /^^1d 1d /^^1e 1e /^^1f 1f /^^7f 7f }
\endgroup
\let^^0c=\relax %% was \par for Textures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% TRANSLATION MACROS %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Make sure chars >= 127 are ordinary (lccodes = 0)
%%%% This is default maybe to be changed
\def\HiOctetsZeroLCcodes@{%
\count255=128\relax
\Loop@
\lccode\count255=0\relax
\advance\count255 by 1\relax
\ifnum
\count255<256\relax
\Repeat@
}
%%%%% \PrepMoreLiveAccIn@
%% is one of two:
\def\PrepMoreLiveAccIn@{% maybe < and >
%%% \maybe@excl##1 : is tag active-alpha ??
\def\maybe@excl##1{%
\ifnum \lccode`##1>0 \@e
\ex@\@excl\ex@##1%% DON'T put tracer (...) on this line!
\else
\ex@##1%% nor this line --- because of macro soiling
\fi}
%
\lccode`.=`\}%
%%% \CyrLetter@##1: <diactag> --> \TO_ or puke
\lowercase{\def\CyrLetter@##1.{%
\ex@\ifx\cs@ to_\maybe@excl##1^^A\ecs@\relax
\(CyrLetter@_cont)'\lbrace@\CyrUniv@@##1.%
\else
\(CyrLetter@_bingo)\ex@\ex@\cs@ to_\maybe@excl##1^^A\ecs@
%% \(CyrDiac@_bingo)
\fi}}%%
\lccode`.=0%
%\show\CyrLetter@
%
%%% \CyrDiac@##1: <diactag> --> \TO_ or puke
\def\CyrDiac@##1]{%
\ex@\ifx\cs@ TO_\maybe@excl##1^^A\ecs@\relax
\(CyrDiac@_cont)'[\CyrUniv@@##1]%
\else
\(CyrDiac@_bingo)\ex@\ex@\cs@ TO_\maybe@excl##1^^A\ecs@
%% \(CyrDiac@_bingo)
\fi}%
%
%%% \CyrUniv@@##1 : second depth
\def\CyrUniv@@##1{%
\ifnum \lccode`##1>0 \@e
\(CyrUniv@@_lc)\string##1\ex@\@c@excl %%
\else
\ifx##1\@Excl
\(CyrUniv@@_e)\ex@\ex@\ex@\CyrUniv@@excl
\else
\(CyrUniv@@_o)\ex@\ex@\ex@##1%
\fi
\fi}
%
%%% \CyrUniv@@excl##1 : third depth
\def\CyrUniv@@excl##1{%
\ifnum \lccode`##1>0 \@e
\(CyrUniv@@excl_lc)\ex@ ##1%% do buggerall%%
\else
\ifx##1\@Excl
\(CyrUniv@@excl_Excl)\string!%% (@bs@excl_Excl)
\else
\if\noexpand ##1\string_%
\(CyrUniv@@excl_h)\ExpThriceAfter@\@@UlnCheck %%
\else
\(CyrUniv@@excl_o)\string!\ExpThriceAfter@ ##1%%
\fi
\fi
\fi
}%
%
\uccode`<=`<
\ex@\edef\cs@ so_'<\ecs@{\cs@ TO_LG\ecs@}%
\uccode`>=`>
\ex@\edef\cs@ so_'>\ecs@{\cs@ TO_RG\ecs@}%
\uccode`N=`N
\ex@\edef\cs@ so_'N\ecs@{\cs@ TO_No\ecs@}%
%
%%% Define \TO_"
%% Wanted the '["] --> (exp of) \TO_RQ, but table
%% only gave TS_
\ex@\ifx\cs@ TO_RQ\ecs@\relax
\ex@\edef\cs@ TO_"\ecs@{'["]}%
\else
\ex@\edef\cs@ TO_"\ecs@{\cs@ TO_RQ\ecs@}%
\fi
%\ex@\show\cs@ TO_"\ecs@
%
%%% Following are crucial and delicate matters
\uccode`\{=`\{
\ex@\let\cs@ so_'\lbrace@\ecs@\CyrLetter@
%% \so_<lbrace>#1=\CyrLetter@#1
\uccode`\[=`\[
\ex@\let\cs@ so_'[\ecs@\CyrDiac@ %
\ex@\def\cs@ so_''\ecs@{'}%
%
}%
\def\PrepMoreLiveRuAccIn@{%
\PrepMoreLiveAccIn@
%%% Following for rq-APOS confluence (Russian)
%% Here we know APOS has no short form
%\ex@\show\cs@ to_APOS\ecs@
%\ex@\show\cs@ TO_rq\ecs@
\ex@
\ifx\cs@ TO_rq\ecs@\relax
\else\ex@
\ifx\cs@ to_APOS\ecs@\relax %% is def needed?
\ex@\edef\cs@ to_APOS\ecs@{\cs@ TO_rq\ecs@}%
\ex@\edef\cs@ to_apos\ecs@{\cs@ TO_rq\ecs@}%
\fi
\fi
%\ex@\show\cs@ to_APOS\ecs@
%\ex@\show\cs@ to_apos\ecs@
}
%\iwr@{}%
%\iwr@{ temp@=\temp@}%
%\iwr@{temp@@=\temp@@}%
%\iwr@{}%
%\show\temp@
%\show\temp@@
%\read16 to \Junk
%\def\temp@@{'[rq]}%
\def\PrepMoreLiveUkrAccIn@{%
\PrepMoreLiveAccIn@
\uccode`*=`*
%%% Following for rq-APOS confluence (Ukr)
%\ex@\show\cs@ to_APOS\ecs@
%\ex@\show\cs@ TO_rq\ecs@
\ex@\let\ex@\temp@\cs@ TO_rq\ecs@
\ifx\temp@\relax
\else %%
\ex@\let\ex@\temp@\cs@ to_APOS\ecs@
\edef\temp@@{'\lbrace@ APOS\rbrace@}
\ifx\temp@\temp@@
\ex@\edef\cs@ to_APOS\ecs@{\cs@ TO_rq\ecs@}%
\ex@\edef\cs@ to_apos\ecs@{\cs@ TO_rq\ecs@}%
\fi
\fi
%\ex@\show\cs@ to_APOS\ecs@
%\ex@\show\cs@ to_apos\ecs@
%%%%% Set \so_'*, \to_apos, \to_APOS, to \TO_rq
%% when nothing better available
%% \so_'* --> \to_apos by \@SetAccInShorts
%\ex@\show\cs@ so_'*\ecs@
\ex@\edef\cs@ so_'*\ecs@{\cs@ to_apos\ecs@}%
}%
%%%%% Define category 12 braces
\lccode `\.=123\relax\lowercase{\def\lbrace@{.}}%
\lccode `\.=125\relax\lowercase{\def\rbrace@{.}}%
\lccode `\.=0\relax
%%%%% \@SetHighAccess
%% \c_128 etc. will be the ACTIVE char
%% \h_128 etc. will be lc hex value thereof
\def\@SetHighAccess{%
\def/##1 ##2 {\chardef\byte=`##1\relax
\let##1\relax %% preliminary for edef protection
\edef\temp@{\the\byte}%
\ex@\def\cs@ da_\temp@\ecs@{##1}%%
%% da_ for \the\byte ==> active character
\ex@\def\cs@ do_\temp@\ecs@{\string##1}%%
%% do_ for \the\byte ==> cat 12 char
\ex@\def\cs@ dh_\temp@\ecs@{##2}}%%
%% dh_ for \the\byte ==> lc hex string
\HighActiveOctetsHolder@
}
%%%%% \@HiOctetUkrLigOutDefs %% 8 to 7
%% \TheEightbitEncodingVect@ is typically \DosEncodingVect@
\def\@HiOctetUkrLigOutDefs{%
%%% Auxilliary tools for high octets:
\@SetLigShorts
%% \ts_<LaTeX letter Tag> --> short ASCII %% r-to-s
%% sets some \cs@ ts_<tag>\ecs@ to ASCII char, or ' and that
%% for example \_shch --> 'w
\@SetHighAccess %% \da_<decimal> --> active high octet
\@SetDiacShorts
%%% Defs of active char values '{...} '[...] !__xy and Acc shorts
%% /##1. %% where ##1 is LaTeX letter Tag
%% letter high active octet code \the\count255 -->
%% \ts_<LaTeX letter Tag> if it exists or '{<LaTeX letter Tag>}
%%% for letters
%% \ta_<LaTeX letter Tag> --> active high octet %% r-to-a
%% \ot_<other high octet> --> <LaTeX letter Tag> %% o-to-r
%
\def/##1.{\ex@\let\ex@\temp@\cs@ ts_##1\ecs@
\ifx\temp@\relax
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{\lbrace@ ##1\rbrace@}%
\else
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{\temp@}%
%% Here we know we have letter
%% with a short form \ts_<LaTeX letter Tag>
%% For Ukr context modif preps
%% need ability to access active octets of
%% \CYRIE,\cyrie,\CYRYI,\cyryi,\CYRISHRT,\cyrishrt
%% for example \ta_IE --> the active octet giving IE
%% so prepare this access for all shorts:
\edef\temp@{\ex@\ex@\ex@\ne@\cs@ da_\the\count255\ecs@}%
%\show\temp@
\ex@\let\cs@ ta_##1\ecs@\temp@ %%% defines \ta_<LaTeX letter Tag>
\edef\temp@{\ex@\string\temp@}%% the cat other octet
%\show\temp@
%% Want LaTeX letter Tag of octet when it exists, else \relax
\ex@\edef\cs@ ot_\temp@\ecs@{##1}%
%\ex@\show\cs@ ot_\temp@\ecs@
\fi
\advance\count255 by 1\relax}
%% |##1. %% where ##1 is my short tex diacritic tag for email-ru.tex
%% defines \da_<\the\count255> = <active high octet> --> or Acc short
\def|##1.{%
%% Here we know we have diacritic with a short form \TS_##1
%% For Ukr context modif preps need ability to
%% define active octets of these
%% for example \TA_LQ --> (the active octet '[LQ])
%% so prepare this access for all high diacritics:
\edef\temp@{\cs@ da_\the\count255\ecs@}
%% value is active high octet, still equal \relax
\ex@\edef\cs@ TA_##1\ecs@{\temp@}%% defines \TA_<my diac tag>
\ex@\edef\cs@ OT_\ex@\string\temp@\ecs@{##1}%
%% defines \OT_<my diac other octet>
%%%% *finally* the active high octet
%% value changes from \relax to [\TS_##1]
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@
{[\cs@ TS_##1\ecs@]\ne@\UkrWB@}%
\advance\count255 by 1\relax}
%% \. sets the active high octet equal to !__xy where "XY=\count255
\def\.{\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{%
!\string_\string_\cs@ dh_\the\count255\ecs@}%%
%% in short \def ^^xy{the string !__xy}
\advance\count255 by 1\relax}
%
%%%% \apos. just means |rq. as far as Ukr Translit concerned
%\def\APOS.{|rq.}%
\def\apos.{|rq.}%
%
\count 255=128\relax
%\show\TheEightbitEncodingVect@
\TheEightbitEncodingVect@
%% finally prevent softhyphen catalyzing:
\ex@\ex@\ex@\edef\cs@ TA_shy\ecs@{[\cs@ TS_shy\ecs@]}
}
%%%%% \@HiOctetRuLigOutDefs %% 8 to 7 %% use comments for Ukr
\def\@HiOctetRuLigOutDefs{%
%%%% Auxilliary tools for high octets:
\@SetLigShorts
\@SetHighAccess %% \da_<decimal> --> active high octet
\@SetDiacShorts
%%%% /##1.
\def/##1.{\ex@\let\ex@\temp@\cs@ ts_##1\ecs@
\ifx\temp@\relax
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{\lbrace@ ##1\rbrace@}%
\else
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{\temp@}%
\fi
\advance\count255 by 1\relax}
%%%% |##1.
%% defines \da_<\the\count255> = <active high octet> --> or Acc short
\def|##1.{%
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{[\cs@ TS_##1\ecs@]}%
\advance\count255 by 1\relax}
%%%% \. sets the active high octet equal to !__xy where "XY=\count255
\def\.{\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{%
!\string_\string_\cs@ dh_\the\count255\ecs@}%%
%% in short \def ^^xy{the string !__xy}
\advance\count255 by 1\relax}
%
%%%% \apos. just means |rq. for now 26-11-00
\def\apos.{|rq.}
%
\count 255=128\relax
\TheEightbitEncodingVect@
}
%%%%% \@HiOctetAccOutDefs %% 8 to 7
%% \TheEightbitEncodingVect@ is typically \DosEncodingVect@
\def\@HiOctetAccOutDefs{%
%%% Auxilliary tools for high octets:
\@SetAccOutShorts
%% sets some \cs@ ts_<tag>\ecs@ to ASCII char, or ' and that
%% for example \_shch --> 'w
\@SetHighAccess
\@SetDiacShorts
%\ex@\show\cs@[lg]\ecs@
%%%% Defs of active char values '{...} '[...] !__xy and Acc shorts
%%% /##1. sets the active high octet equal to '{##1} or Acc short
\def/##1.{\ex@\let\ex@\temp@\cs@ ts_##1\ecs@
\ifx\temp@\relax
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@
{'\lbrace@ ##1\rbrace@}%
\else
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{\temp@}%
\fi
\advance\count255 by 1\relax}%
%%% |##1. active high octet --> '[\TS_##1] or Acc short
\def|##1.{\ex@\let\ex@\temp@\cs@ ts_##1\ecs@ %% why this 24-11-00?
\ifx\temp@\relax
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@
{'[\cs@ TS_##1\ecs@]}%
\else
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{\temp@}%
\fi
\advance\count255 by 1\relax}%
%%% \. sets the active high octet equal to !__xy where "XY=\count255
\def\.{\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{%
'\string_\string_\cs@ dh_\the\count255\ecs@}%
%% in short \def ^^xy{'__xy}
\advance\count255 by 1\relax}
%%% \apos. sets the active high octet equal to '* for Ukr
%% and otherwise to '[']
\def\apos.{%
\ex@\let\ex@\temp@\cs@ ts_apos\ecs@%
%\show\temp@ % normally '* (Ukr) or \relax (Ru)
\ifx\temp@\relax
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{'[\cs@ TS_rq\ecs@]}%
\else
\ex@\ex@\ex@\edef\cs@ da_\the\count255\ecs@{\temp@}%
\fi
\advance\count255 by 1\relax}%
\count 255=128\relax
\TheEightbitEncodingVect@
}
%%%%%% \@HiOctetsAccInDefs %% 7 to 8
%% extracts all useful info from the
%% \TheEightbitEncodingVect@ which is typically \DosEncodingVect@
%% it will be (other high octet) valued functions:
%% \so_<7short>, \to_<latextag>,
%% \TO_<7short>, \TO_<mydiactag>, \ho_<hextag>
\def\@HiOctetsAccInDefs{%
%%%%% Extract info from \TheEightbitEncodingVect@
%%%% Auxilliary tools for high octets: (all are used)
\@SetHighAccess
%% \do_<decimal> --> <8other> **, \dh_<decimal> --> <hex> **
\@SetAccInShortsA %% \so_<tag> --> '{<tag>} as default
%% \ts_<tag> --> <7short>, eg. \ts_shch --> 'w **
\@SetDiacShorts %% \TS_<tag> --> <7short> **
%\@IdentifyAccInLetterTags %% \te_<tag> --> \@e when char "known"
%\ex@\show\cs@ te_gje\ecs@
%%%% \Set@ho and \The@o used thrice below,
%% defines \ho_<hex> --> cat 12 octet
\def\The@o{\cs@ do_\the\count255\ecs@}%
\def\Set@ho{\edef\The@hex{\cs@ dh_\the\count255\ecs@}%
\ex@\edef\cs@ ho_\The@hex\ecs@{\The@o}}%
%%%% \. Surely \ho_xy --> ^^xy where "XY=\count255
\def\.{\Set@ho \advance\count255 by 1\relax}%
%%%% /##1. where ##1 is <tag> = LaTeX cyrillic letter tag
\def/##1.{\Set@ho
%%% maybe \so_<7short> --> other high octet
\ex@\ifx\cs@ ts_##1\ecs@\relax
\else
\edef\temp@{\cs@ ts_##1\ecs@}
\ex@\edef\cs@ so_\temp@\ecs@{\The@o}%
\fi
%%% surely \to_<tag> --> other high octet
\ex@\edef\cs@ to_##1\ecs@{\The@o}%
\advance\count255 by 1\relax}%
%%%% |##1. where ##1 is <tag> = my tex diac tag
%%%xxx REVISE to elim TS_ and \@SetDiacShorts
%%%xxx and also diac table anomaly re '["]
\def|##1.{\Set@ho
%%% surely \TO_<7short> --> other high octet
\ex@\edef\cs@ TO_##1\ecs@{\The@o}%
\edef\temp@{\cs@ TS_##1\ecs@}
\ex@\edef\cs@ TO_\temp@\ecs@{\The@o}%
%%% surely \TO_<tag> --> other high octet
\ex@\edef\cs@ TO_##1\ecs@{\The@o}%
\advance\count255 by 1\relax }%
%
%%%% \apos. just means |rq. for now 26-11-00
\def\apos.{|rq.}
%
\count255=128\relax
\TheEightbitEncodingVect@
%
%%%%% Define active English letter A --> \so_A
%% and 'A --> '\so_A if nothing better
\def/##1{\lccode`\~=`##1
\lowercase{\edef~}{\cs@ so_##1\ecs@}%
\ex@\ifx\cs@ so_'##1\ecs@\relax
\ex@\edef\cs@ so_'##1\ecs@{'\cs@ so_##1\ecs@}%
\fi}
\LatinLettersholder@
\@SetAccInShortsB %% \so_'g ==> edef exp of \to_gup etc
}
%%%%%% \StrangeLowOctetsToCaskets@ %%%%% correct for CR & LF??
%
\edef\OctetCasket@#1 #2 {\edef#1{\string!\string_\string_#2}}%
%%\OctetCasket@^^ff ff --> {the string !__ff}
\def\StrangeLowOctetsToCaskets@{%
\let/\OctetCasket@
\LowActiveOctetsHolder@
%% \HighActiveOctetsHolder@ handled otherwise
}
%%%%%% \StrangeOctetResurections@ %%%%% correct for CR & LF??
%% unnecessary now
%%%% \cs@!xy\ecs@ gives resurected octet __xy
\def\OctetResurection@#1 #2 {%
\ex@\edef\cs@ ho_#2\ecs@{\string#1}%
%\ex@\show\cs@ ho_#2\ecs@
}
\def\StrangeOctetResurections@{%
\let/\OctetResurection@
\LowActiveOctetsHolder@
}
%%%%%% \@IsDigitHolder \@IsDigitDefs
%
\def\HexDigitsHolder@{/0/1/2/3/4/5/6/7/8/9/a/b/c/d/e/f}
%
\def\@IsDigit{0}%
\def\@IsDigitDefs{%
\def/##1{\ex@\def\cs@ x_##1\ecs@{0}}% %% 0 is sign of digit
\HexDigitsHolder@}
\def\LatinLettersholder@{%% cat is *letter* here
/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z%
/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z%
}%
%%%%%% \LatinLetterActiveAccOutDefs@
%%% for AccOut currently
\let\pEng@=\relax %% initial
\def\LatinLetterActiveAccOutDef@#1{%
\lccode`\~=`#1\relax\lccode`a=`#1\relax
\lowercase{\edef~{\pEng@ a}}}%
%
\def\LatinLetterActiveAccOutDefs@{%
\let/\LatinLetterActiveAccOutDef@
\LatinLettersholder@
\lccode`\~=0 \lccode`a=`a%% restorative measure
}%
%%%%%% \ActiveUkrLigOutDefs@
%%% for context sensitive, official Ukr lig transliteration
\def\ActiveUkrLigOutDefs@{%
\lccode`\~=13\relax
\lowercase{\let~\UkrLigOutEndLine@}%% it edefs to empty
%%%% \UkrWB@ Word-Beginning catalysis
%% High diacritics have \UkrWB@ catalytic
%% postfix by \@HiOctetUkrLigOutDefs
%%% ASCII chars 32--126 will have
%% \UkrWB@ catalytic postfix iff active
%% But just some diacritics will be activated by
%\lccode`\~=`\-\relax
%\lowercase{\def~{-\UkrWB@}}%
\count255=32\relax
\Loop@
\lccode`\~=\count255\relax
\lowercase{\edef~{\string~\ne@\UkrWB@}}%
\advance\count255 by 1\relax
\ifnum\count255>126\relax\else
\Repeat@
\lccode`\~=0\relax %% restorative
%%% \UkrWBShift@{##1}{##2}%
%% {LaTeX Tag}{Word Beginning transliteration}
\def\UkrWBShift@##1##2{%
\edef\temp@{\ex@\ex@\ex@\string\cs@ ta_##1\ecs@}%
%% cat other, high octet
%\show\temp@
\ex@\edef\cs@ wb_\temp@\ecs@{##2}%
%% ##2 is the catalyzed character(s), cat other, ASCII
%\ex@\show\cs@ wb_\temp@\ecs@
%% It serves in place of \ts_##1
}%
\UkrWBShift@{IE}{Ye}%
\UkrWBShift@{ie}{ye}%
\UkrWBShift@{YI}{Yi}%
\UkrWBShift@{yi}{yi}%
\UkrWBShift@{ISHRT}{Y}%
\UkrWBShift@{ishrt}{y}%
\UkrWBShift@{YU}{Yu}%
\UkrWBShift@{yu}{yu}%
\UkrWBShift@{YA}{Ya}%
\UkrWBShift@{ya}{ya}%
\def\UkrWB@##1{%
%% ##1 is a token and the interesting case is when it is
%% one of the 8 active chars \c_IE,...,\c_ya
\ex@\ifx\cs@ wb_\string##1\ecs@ \relax
%% if a context transformation is NOT defined
\ex@##1%
\else
\cs@ wb_\string##1\ecs@ %% dangerous but OK?
\fi
}%
%%% Post-Z catalysis:
%% \CYRZ\CYRG ==> ZGH, \CYRZ\cyrg ==> Zgh, \cyrz\cyrg ==> zgh
%%
\edef\temp@{\let\ne@\Ukr@G=\ex@\ex@\ex@\ne@\cs@ ta_G\ecs@}\temp@
\edef\temp@{\let\ne@\Ukr@g=\ex@\ex@\ex@\ne@\cs@ ta_g\ecs@}\temp@
%%\Ukr@G is expansion of \ta_G
%%\Ukr@g is expansion of \ta_g
\def\AfterUkrZorz@ ##1{%% checks for G,g ==> GH, gh
%(AfterUkrZorz@)
\ifx##1\Ukr@G
GH%
\else
\ifx##1\Ukr@g
gh%
\else
%(neither ta_G nor ta_g)%
\ex@\ex@\ex@##1%
\fi
\fi
}%
\ex@\ex@\ex@\def\cs@ ta_Z\ecs@{Z\AfterUkrZorz@}%
\ex@\ex@\ex@\def\cs@ ta_z\ecs@{z\AfterUkrZorz@}%
}
%%%%%% \ActiveRuLigOutDefs@
\let\ActiveRuLigOutDefs@\relax%
%%%%%% \PrimableTestPrep@
%% to help decide whether prime in 8-bit file should double
%% depends on whether following char (when char)
%% decision in \def\pr@
%%% N.B. More than Latin letters are primable
\def\PrimableTestPrep@{%
\def/##1{\uccode`##1=1}%
%% uccode=1 means *potentially* primable to us
\LatinLettersholder@/</>/*/[\ex@/\lbrace@ %
%% < > * cause all the fuss; others later??
}
%%%%%% \PrepFlagsAccOut@
%
\def\PrepFlagsAccOut@{%
\let\pEng@=\relax
%% English letter flag from \LatinLetterActiveAccOutDefs@
\let\pExcl@=\relax %% from active !
\let\pBs@=\relax %% from active \
\let\pPr@=\relax %% from active '
\let\pCR@=\relax %% from active ^^M as \endlinechar
%% initial
\lccode`\~=`\\\relax%% makes active \ --> \pBs@
\lowercase{\def~{\pBs@}}%
\lccode`\~=`!\relax%% makes active ! --> \pExcl@
\lowercase{\def~{\pExcl@}}%
\lccode`\~=`\'\relax%% makes active ' --> \pPr@
\lowercase{\def~{\pPr@}}%
\lccode`\~=9\relax%% makes active ^^09 --> !^^09 (string)
\lowercase{\edef~{\string!\string_\string_09}}%
\lccode`\~=13\relax%% makes active ^^0d = !^^0d (string)
\lowercase{\def~{\pCR@}}%
}%
%%%%%% \PrepFlagsAccIn@ for
%
\def\PrepFlagsAccIn@{%
\lccode`\~=`\\\relax%% makes active \ --> \@Bs
\lowercase{\let~\@Bs}%
\lccode`\~=`!\relax%% makes active ! --> \@Excl
\lowercase{\let~\@Excl}%
\lccode`\~=`\'\relax%% makes active ' --> \@Acc
\lowercase{\let~\@Acc}%
\lccode`\~=13\relax%% makes active ^^0d = \@EndLine (string)
\lowercase{\let~\@e}%
\let ^^A=\@e
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% TransSetup %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% \TransSetupAccIn@ (8 out)
\def\TransSetupAccIn@{%
\HiOctetsZeroLCcodes@ %% default to change
\@HiOctetsAccInDefs
\ThePrepMoreLiveAccIn@
%% This one is \PrepMoreLiveRuAccIn@ or \PrepMoreLiveUkrAccIn@
\StrangeOctetResurections@
\PrepFlagsAccIn@
\endlinechar=13
%\show^^A
}
%%%%% \TransSetupAccOut@ (7 out)
\def\TransSetupAccOut@{%
\StrangeLowOctetsToCaskets@
\@HiOctetAccOutDefs
%% high octet to tag short or '{??} or '[??] or !__xy
%%\ex@\show\cs@ ts_APOS\ecs@
\LatinLetterActiveAccOutDefs@
\PrimableTestPrep@ %% to make \IFnextprimable@ work
\PrepFlagsAccOut@
\endlinechar=13 % will change later
}
%%%%% \TransSetupLigOut@
\def\TransSetupLigOut@{%
\StrangeLowOctetsToCaskets@
\@HiOctetLigOutDefs
%% is \@HiOctetRuLigOutDefs or \@HiOctetUkrLigOutDefs
\ActiveLigOutDefs@ %% \relax or \ActiveUkrLigOutDefs@
\endlinechar=-1\relax
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% CategorySetup %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% \CategorySetup@ best done as a predefined macro
%% to avoid self-ref problems
%%%%%% \ActivateLatinLetters@
\def\ActivateLatinLetters@{%
%\showthe\catcode`\/
\def/##1{\catcode`##1=13\relax}%
\LatinLettersholder@
}
%%%%% \MakeSpecialsOther@
%% Dangerous/exotic lower ascii become "other"
\def\MakeSpecialsOther@{%
\catcode9=13 %% tab
%%\catcode13=12 %% CR, just char absorb file at once? No
\catcode32=12 %% space to preserve multiple spaces
\catcode`\#=12
\catcode`\$=12
\catcode`\%=12
\catcode`\&=12
\catcode`\'=12 %% will often undo this
\catcode`\/=12
\catcode`\@=12
\catcode`\\=12 %% will often undo this
\catcode`\^=12
\catcode`\_=12
\catcode`\`=12
\catcode`\{=12
\catcode`\|=12
\catcode`\}=12
\catcode`\~=12
}
%%%% \MakeAsciiOther@
\def\MakeAsciiOther@{%
\count255=0 %
\Loop@
\catcode\count255=12\relax
\advance\count255 by 1\relax
\ifnum \count255< 128\relax
\Repeat@
}
%%%% \ActivateFlagChars@
\def\ActivateFlagChars@{%
\catcode`\'=13
\catcode`\!=13
\catcode`\\=13
\catcode13=13
}
%%%% \UkrLigContextActivations@
%% space, - and other non-letters
\def\UkrLigContextActivations@{%
\catcode13=13 %% CR
%\showthe\lccode`\.%
\count255=32\relax
\Loop@
\ifnum\lccode\count255=0\relax %% nonletters activated
\catcode\count255=13\relax
\fi
\advance\count255 by 1\relax
\ifnum\count255>126\relax\else
\Repeat@
%\def/##1{\catcode`##1=12\relax}\LatinLettersholder@
}
%%%% \RuLigContextActivations@
\let\RuLigContextActivations@\relax
\def\CategorySetupAccIn@{%
\LowOctetsCat@{15}%%
\catcode9=12\catcode10=12\relax %\catcode13=12 %% moderates above
\HiOctetsCat@{15}% %% to prevent disasters.
\MakeSpecialsOther@
\ActivateLatinLetters@ %% also done in AccOut direction
\ActivateFlagChars@ %% catcode 13 becomes 13
}
\def\CategorySetupAccOut@{%
\HiOctetsCat@{13}%
\LowOctetsCat@{13}%% includes controls; may work as input
\MakeSpecialsOther@
\ActivateLatinLetters@ %% but but < > still cat 12
\ActivateFlagChars@
}
\def\CategorySetupLigOut@{%
\HiOctetsCat@{13}%
\LowOctetsCat@{13}%% includes controls; may work as input
\MakeSpecialsOther@
\LigContextActivations@
%% \RuLigContextActivations@ or \UkrLigContextActivations@
%% initially ^^M=\relax
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% SecondPassPrepAccOut %%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\IFnextprimable@{\ifnum\uccode`##1=1\relax}
%%%%% \SecondPassPrepAccOut@ preps :
%%% AccOut is 2-pass process; see Eng.tex fo 2nd alone
%%%% First come a lot of definitions
\def\Gobble@#1{}%
\edef\OtherBacksl@{\ex@\Gobble@\string\\}%
\def\ExpTwiceAfter@{\ex@\ex@\ex@}%
\def\ExpThriceAfter@{\ex@\ExpTwiceAfter@\ex@}%
\def\ExpFourTimesAfter@{\ex@\ExpThriceAfter@\ex@}%
%%%%% \SecondPassPrepAccOut@
%%%% The p-versions are \relax outside SecondPass group
\def \SecondPassPrepAccOut@{%
\let\pEng@=\Eng@ %% Begin English Letterwise mark
\let\pExcl@=\Excl@ %% escaping exclamation marks
\let\pPr@=\Pr@ %% escaping prime
\let\pBs@=\Bs@ %% smart backslash
\let\pCR@=\AccOutEndLine@
}
%%%% \Eng@ meaning Begin English; will be let equal to \?
%%% \? will be prelim flag for English
\def\Eng@{\eng@}
%%%% \eng@#1 meaning begin English with argument
\def\eng@#1{!#1\c@eng@}
%%%% \c@eng@ continue English, first lap
\def\c@eng@#1{%
\ifx#1\Eng@
%\message{Is Eng@:\noexpand#1}%
\ex@\cc@eng@
\else
%\message{Not Eng@:\noexpand#1}%
\ifcat\noexpand#1a%% means Russian naked letter
!#1%% 8 then continue naked
\else
\ExpTwiceAfter@#1% after \ex@ removed here#1
%% just continue naked
\fi
\fi
}
%%%% \cc@eng@ continuing begin English, since
%%% letter here guaranteed, as at \eng@
\def\cc@eng@#1{%
#1\c@eng@ %% this time do not deposit a \string!
}
%%%% \Bs@ Backslash macro, will be \let equal to active \
%%%
\def\Bs@{\bs@}
\def\bs@#1{%
\ifx#1\Eng@
%\message{Is Eng@:\noexpand#1}%
\OtherBacksl@\ex@\cc@eng@
\else
%\message{Not Eng@:\noexpand#1}%
\ifx\Bs@#1%
%\message{Is Bs@:\noexpand#1}%
\OtherBacksl@\OtherBacksl@
\else
\ifcat\noexpand#1a%
\OtherBacksl@!#1
\else
\OtherBacksl@\ExpThriceAfter@#1%
\fi
\fi
\fi}
%%%% \Pr@ Prime macro, will be \let equal to active '
%%% Is the preconverted character ' not yet doubled
%%% Beware that primes for "accented" Russian letters
%%% are already ' (cat 12) at this intermediate stage
\def\Pr@{\pr@}%
%
\def\pr@#1{%
\ifcat\noexpand#1\noexpand\Pr@ %% test for flag \Pr@ and friends
\(pr@_flag)''\ex@#1%
\else
\ifnum\uccode`#1=1 \@e
%% not flag but primable \IFnextprimable@
\(pr@_primable@)''#1%
\else
\if\noexpand#1'%% is it ' from ya and friends
\(pr@_prime)''#1%
\else
\(pr@_p)'\ExpThriceAfter@#1% finally sure one prime will do
\fi
\fi
\fi
}%
%%%% \Excl@ Exclamation macro, will be \let equal to active !
%%% Is the preconverted character ! not yet doubled.
%%% Watch for interaction with \?=\Eng@.
\def\Excl@{\excl@}%
\def\excl@#1{%
\ifx#1\Excl@
!!\ex@\excl@
\else
\ifx#1\Eng@%%
%\message{Is Eng@:\string#1}%
!!\ex@\ex@\ex@\Eng@%
\else
\ifcat\noexpand#1a%
!!#1%
\else
\if\noexpand#1!%
%\message{Is !:\string#1}%
!!!%
\else
%\message{Not !:\string#1}%
!\ExpFourTimesAfter@#1%
\fi
\fi
\fi
\fi
}%
%%%% \EmptyEndLine@@ \UkrLigOutEndLine@ \AccOutEndLine@
%%% \endlinechar will be 13 and active and equal to:
\def\EmptyEndLine@@{}%
%%% but ALSO
\def\UkrLigOutEndLine@{\EmptyEndLine@@}%
%%% AND
\let\AccOutEndLine@\EmptyEndLine@@
%%% AND
\edef\AccInEndLine@{%
\ne@\Wobble@]\ne@\Wobble@\rbrace@\ne@\Gobble@\relax}%
%%% \Wobble@#1 is an end-of-line test
%% for AccIn mode and '[] '{} syntaxes
%%
\def\Wobble@#1{\cs@ W_#1\ecs@}
\ex@\edef\cs@ W_]\ecs@{}%
\ex@\edef\cs@ W_\rbrace@\ecs@{}%
\ex@\edef\cs@ W_\ecs@{Wobble}%% value must be string (not \relax)
%% since it will enter a \cs@ ... \ecs@
%% \AccInEndLine@ normally ultimately
%% vanishes if simply \edef expanded.
%% It's a \write that adds a CR in output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%% AccIn ' ! \ %%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\(#1){}
\def\@Acc{\@acc}
% \def\@acc#1{%
% \ifnum \uccode`#1>0 \@e
% %(@acc_uccode)%
% %\cs@'\string#1\ecs@
% \ex@\ex@\cs@ so_'\string#1\ecs@
% \else
% \ifx#1\@Acc
% \(@acc_@Acc)%
% \ex@'%
% \else
% \(@acc_puke)%
% '\ex@\ex@\ex@#1%
% \fi
% \fi}
\def\@acc#1{%
\ex@\ifx\cs@ so_'\string#1\ecs@\relax
%\(@acc_puke for \cs@ so_'\string#1\ecs@)%
%% above tracer fails when #1 is )
'\ex@#1%
\else
%\(@acc_so_)%
\ex@\ex@\cs@ so_'\string#1\ecs@
\fi
}
\def\@Excl{\@excl}
\def\@excl#1{%
\ifnum \lccode`#1>0 \@e
\(@excl_c)\string#1\ex@\@c@excl %%(@excl_c)
\else
\ifx#1\@Excl
\(@excl_!)\string!%% (@excl_!)
\else
\(@excl_@@excl)\ex@\ex@\ex@ \@@excl \ex@\ex@\ex@#1%
%% quiery continues with \@@excl
\fi
\fi
}
\def\@@excl#1{%% handle _ and reliquat
\if\noexpand#1\string_%
%% \string!\string_ held back
\(@@excl_h)\ex@\@@UlnCheck %%(@@excl_h)
\else
\(@@excl_p)\string!\ex@#1%% (@@excl_p)
\fi
}
\def\@c@excl#1{%
\ifnum \lccode`#1>0 \@e
\(@c@excl_a)\string#1\ex@\@c@excl %%(@c@excl_a)
\else
\ifx#1\@Excl
\(@c@excl_@Excl)\ex@\ex@\ex@ \@eexcl %%\@UlnCheck
%% \@eexcl an "anti exclam"
%% \string! held back %%(@c@excl_!)
\else
\if\noexpand#1\string_%
%% \string!\string_ held back
\(@c@excl_hat)\ExpThriceAfter@\@@@UlnCheck %%(@c@excl_hat)
\else
\(@c@excl_p)\ExpThriceAfter@#1%% (@c@excl_p)
\fi
\fi
\fi
}
%%% an "anti exclam or exit exclam"
\def\@eexcl#1{%
\ifnum \lccode`#1>0 \@e
\(@eexcl_x)\ex@#1%% (@eexcl_x)
\else
\if\noexpand#1\string_%
%% \string!\string_ held back
\(@eexcl_hat)\ex@\ex@\ex@\@@@UlnCheck %%(@eexcl_hat)
\else
\(@eexcl_p)\ex@\ex@\ex@#1%% (@eexcl_p)
\fi
\fi
}
%%% past ! occurring in Eng look for first _ for case of !__xy
\def\@UlnCheck#1{%
\if\noexpand#1\string_%
%% retain first \string_
\(@UlnCheck_h)\ex@\@@UlnCheck %%(@UlnCheck_h)
\else
\(@UlnCheck_p)\ex@#1%% (@UlnCheck_p)
\fi
}
%%% past !_ look for second _ for case of !__xy
\def\@@UlnCheck#1{%
\if\noexpand#1\string_%
%% retain second \string_
\(@@UlnCheck_d)\ex@\@DigitCheck %%(@@UlnCheck_d)
\else
\(@@UlnCheck_p)\string!\string_\ex@#1%% (@@UlnCheck_p)
\fi
}
%%% past end-of-english _ look for second _ for case of !__xy
\def\@@@UlnCheck#1{%
\if\noexpand#1\string_%
%% retain second \string_
\(@@@UlnCheck_d)\ex@\@DigitCheck %%(@@@UlnCheck_d)
\else
\(@@@UlnCheck_p)\string_\ex@#1%% (@@UlnCheck_p)
\fi
}
%%% \@DigitCheck
%%% past !__ look for hex digit
%%% Prudent approach avoids line overrun; speed OK?
\def\@DigitCheck#1{%
\ex@\ifx\cs@ x_\string#1\ecs@\@IsDigit
\ex@\@DigitAll\ex@#1%% (@DigitCheck_d)
%% replace #1 as only storage device available
\else
\string!\string_\string_\ex@#1 %%(@DigitCheck_p)
\fi
}
%%% \@DigitAll
%%% past !__<digit> look for second hex digit #2
%%% Prudent approach avoids line overrun; speed OK?
\def\@DigitAll#1#2{%
\ex@\ifx\cs@ x_\string#2\ecs@\@IsDigit
%% x for hex%% (@DigitAll_d)
%\cs@!\string#1\string#2\ecs@ %% one octet replaces 5!
\cs@ ho_\string#1\string#2\ecs@
\else
\string!\string_\string_\ex@#1\ex@#2%
%% puke up five %% (@DigitAll_p)
\fi
}
%%%%%% \HexDigitsHolder@ \@IsDigitDefs
%
\def\HexDigitsHolder@{/0/1/2/3/4/5/6/7/8/9/a/b/c/d/e/f}
%
\def\@IsDigit{\@@IsDigit}%
\def\@IsDigitDefs{%% x_ for hex
\def/##1{\ex@\def\cs@ x_##1\ecs@{\@@IsDigit}}%
%% \@@IsDigit is sign of digit
\HexDigitsHolder@}
\@IsDigitDefs
%%% \@Bs and \@bs#1
\def\@Bs{\@bs}
\def\@bs#1{\OtherBacksl@
\ifnum \lccode`#1>0 \@e
\(@Bs_a)\string#1\ex@\@c@excl %%(@Bs_a)
\else
\ifx#1\@Bs
\(@Bs_bs)\OtherBacksl@ %%(@Bs_bs)
\else
\ifx#1\@Excl
\(@Bs_bs!)\ExpThriceAfter@\@bs@excl %%(@Bs_bs!)
\else
\(@Bs_o)\ExpThriceAfter@#1%% (@Bs_o)
\fi
\fi
\fi
}
\def\@bs@excl#1{%
\ifnum \lccode`#1>0 \@e
\(@bs@excl_lc)\ex@ #1%% do buggerall%% (@bs@excl_lc)
\else
\ifx#1\@Excl
\(@bs@excl_Excl)\string!%% (@bs@excl_Excl)
\else
\if\noexpand #1\string_%
\(@bs@excl_h)\ExpThriceAfter@\@@UlnCheck %%(@bs@excl_h)
\else
\(@bs@excl_o)\string!\ExpThriceAfter@ #1%% (@bs@excl_o)
\fi
\fi
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% MainConversionLoop %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\MainConversionLoop@{%
\message{\Sharp@}
\count255=0
\Loop@ %%
\advance\count255 1\relax
\ifnum\count255>40\relax
\count255=0\relax
\message{\Sharp@}%
\fi
\ifeof\MainStreamIn@
\else
\read\MainStreamIn@ to \Line@
\TheTreatLine@
\Repeat@
}
%%%%% \TreatLine... Macros
%
%%%% AccIn
\def\TreatLineAccIn@{%
%\show\Line@
%\show\AccInEndLine@
%\def\temp@{\ex@\Line@\AccInEndLine@}
%\show\temp@
%\tracingmacros=1
%\show ^^A
%\ex@\show\cs@ W_^^A\ecs@
\Wr@{\ex@\Line@\AccInEndLine@}% provisional?
}
%%%% AccOut
\def\TreatLineAccOut@{% new 25 Aug
\edef\Line@{\Line@}%% maybe add \EmptyEndLine@
\begingroup
\SecondPassPrepAccOut@
\Wr@{\Line@\AccOutEndLine@}%
\endgroup
}
%%%% LigOut \TreatLineLigOut@
%% is \TreatLineUkrLigOut@ or \TreatLineRuLigOut@
\def\TreatLineUkrLigOut@{% new 1 Nov
\Wr@{\ex@\UkrWB@\Line@\UkrLigOutEndLine@}
}% provisional?
\def\TreatLineRuLigOut@{% new 7 Sept
\Wr@{\Line@}}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% I / O %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newread\MainStreamIn@
\newwrite\MainStreamOut@
\def\MainFileIn@{IN.txt}%
\def\MainFileOut@{OUT.txt}%
\def\AuxFileOut@{OUT.txt}%% this time, so not really needed
\def\AuxEncodingFile@{\cs@ \Encodingtag@ EncodingFile@\ecs@}
\def\ExtraEncodingFile@{extraenc.tex}
\def\HeadEncodingFile@{IN.txt}
%%%%% \SetupLineReads@ uses \TheStreamIn@ and
%% \TheFileIn@ which must be specified
\def\SetupLineReads@{%
\openin\TheStreamIn@\TheFileIn@\relax
\ifeof\TheStreamIn@
\closein\TheStreamIn@
\def\Decision@{\iwr@{}%
\iwr@{ * Sorry, "\TheFileIn@" is absent\string/busy; quitting.}
\cs@ end\ecs@}
\else
\let\Decision@\relax
\fi
\Decision@
}
\def\SetupModifLineReads@{%% for Extra or Head
\let\TheFileIn@\AuxEncodingFile@ %% alternative here!
\let\TheStreamIn@\MainStreamIn@
\SetupLineReads@
}
\def\SetupMainLineReads@{%% for Extra or Head
\let\TheStreamIn@\MainStreamIn@
\let\TheFileIn@\MainFileIn@ %% alternative here!
\SetupLineReads@
}
%%%%% \SetupWriteOuts@
\def\SetupWriteOuts@{%
\immediate\openout\TheStreamOut@\TheFileOut@\relax
}
\def\SetupMainWriteOuts@{%
\let\TheStreamOut@\MainStreamOut@
\let\TheFileOut@\MainFileOut@
\SetupWriteOuts@
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% INTERVIEW %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% This can serve as a table of contents for this section
%
\def\InterviewUser@{%
\GetPrevOptions@
\Splash@
\SetupMainLineReads@
\GetUserChanges@
\InscribeUserChanges@
\AbortLossyInput@
\SetupMainWriteOuts@
%\WriteProlog@
}
\def\ReservedPrevOptions@{7ARW}
\let\PrevOptions@\ReservedPrevOptions@
%%%% \GetPrevOptions@
\def\GetPrevOptions@{%
\openin\MainStreamIn@ email-ru.opn \relax
\ifeof\MainStreamIn@
\else
\read\MainStreamIn@ to \PrevOptions@
\fi
\closein\MainStreamIn@
%\show\PrevOptions@
\TestOptions@\PrevOptions@
\ifGoodOptions@
%\iwr@{Good PrevOptions.}
\PreImplant@\PrevOptions@ %% includes format test
%% then preimplantation done and atoms defined
\else
%\iwr@{Bad PrevOptions.}
\let\PrevOptions@\ReservedPrevOptions@ %% \TestOptions@ not needed
\PreImplant@\PrevOptions@ %% so that atoms defined
\fi
}
%%%% \PreImplant@ #1; 1st exp of #1 is some sifted options like 8SW
%%% Sets atomic tags \Direction@, \ACtype@,
%% \LangGroup@, \Encoding@, for these options
\def\PreImplant@#1{ %% for reuse
\ex@\PreImplant@@#1\endPreImplant@@} % 4 \relax for insurance
\def\PreImplant@@#1#2#3#4#5\endPreImplant@@{%
\def\Direction@{#1}
\def\ACtype@{#2}
\def\LangGroup@{#3}%\show\LangGroup@
\def\Encoding@{#4}%\show\Encoding@
}
%%%% \TestOptions@ for \PrevOptions from possibly damaged file
\def\TestOptions@@#1#2#3#4#5\endTestOptions@@{%
\IN@0#1@78@
\ifIN@
\IN@0#2@LA@
\ifIN@
\IN@0#3@RU@
\ifIN@
\IN@0#4@DEHMIWK@
\ifIN@
\def\ttemp{#5}%\show\ttemp
\ifx\ttemp\empty
\GoodOptions@true
%\message{GoodOptions@true}%
\fi
\fi
\fi
\fi
\fi
}
%
\def\TestOptions@#1{%
%\edef\temp{#1}\show\temp
\GoodOptions@false
\ex@\TestOptions@@#1\endTestOptions@@}
%%%% \SetModetag@ sets \Modetag@ to AccIn, AccOut, or LigOut
%% \LangGroup@ does not affect this
\def\SetModetag@{%
\if\Direction@ 8%
\def\Modetag@{AccIn}%
\else
\if\ACtype@ L%
\def\Modetag@{LigOut}%
\else
\def\Modetag@{AccOut}%
\fi
\fi}
%%%% \PrepOptionTags@
%%% Uses \Direction@, \ACtype@, \LangGroup@, \Encoding@.
%%% Sets Long tags \Modetag@,
%% \ACtypetag@, \LangGrouptag@, \Encodingtag@,
%
\def\Ltag@{Lig}
\def\Atag@{Acc}
%
\def\Dtag@{Dos}
\def\Mtag@{Mac}
\def\Itag@{Iso}
\def\Wtag@{Win}
\def\Ktag@{Koi}
\def\Etag@{Extra}
\def\Htag@{Head}
%
\def\Rtag@{Ru}\def\Rlongtag@{Russian}
\def\Utag@{Ukr}\def\Ulongtag@{Ukrainian}
%
\def\PrepOptionTags@{%
\SetModetag@ %% sets \Modetag@
\edef\ACtypetag@{\cs@\ACtype@ tag@\ecs@}%
\edef\Encodingtag@{\cs@\Encoding@ tag@\ecs@}%
\edef\LangGrouptag@{%
\cs@\LangGroup@ tag@\ecs@}% short name Ru or Ukr or ...
\edef\TheLangGroup@{%
\cs@\LangGroup@ longtag@\ecs@}%% full name; for dialog
\edef\LangAlphabetA@{\cs@\LangGrouptag@ AlphabetA@\ecs@}
\edef\LangAlphabetZ@{\cs@\LangGrouptag@ AlphabetZ@\ecs@}
}
\def\iwr@{\immediate\write16}%
\def\wr@{\immediate\write\MainStreamOut@}%
\def\MainFileIn@{IN.txt}%
\def\MainFileOut@{OUT.txt}%
%{\cs@ OUT-\SiftedOptions@.txt\ecs@}%
\def\ExtraEncodingFile@{extraenc.tex}
\def\batchindirname@{IN_BAT}%
\def\batchoutdirname@{OUT_BAT}%
\def\batchfilename@{batch}%
\def\DosBlurb@{DOS New Alternative Cyrillic encoding cp866nav}%
\def\MacBlurb@{Apple Macintosh Cyrillic}%
\def\IsoBlurb@{ISO8859-5 of 1988 for Sun,DEC,HP,Linux... }%
\def\WinBlurb@{Windows Cyrillic encoding, MicroSoft cp1251}%
\def\KoiBlurb@{KOI8 Internet Cyrillic (RFC-1489 of 1993)}%
\def\HeadBlurb@{Header encoding, placed near top of input}%
\def\ExtraBlurb@{Extra encoding from your own "\ExtraEncodingFile@"}%
\def\RuAlphabetA@{ a b v g d e 'o 'z z i j k l m n o p r s t}%
\def\RuAlphabetZ@{ u f x 't c w 'w q y h 'e 'u 'a }%
\def\UkrAlphabetA@{ a b v g(or h) 'g d e 'e 'z z y i 'i j k}%
\def\UkrAlphabetZ@{ l m n o p r s t u f x 't c w 'w q 'u 'a }%
\def\Rule@{ //////////////////////////////////////////////////////////}%
%%%%%% \Splash@
\def\Splash@ {%
\MakeSlantPct@
\iwr@{}%
\iwr@{\Rule@}%
\iwr@{ ///////////////////// email-ru.tex ///////////////////////}%
\iwr@{ // Converts Cyrillic text files between universal 7-bit}%
\iwr@{ // "ASCI-Cyrillic" and 8-bit Cyrillic text encodings.}%
\iwr@{ // Name input file "\MainFileIn@", alongside of "email-ru.tex".}%
\iwr@{ //// OPTIONS: Strike any option keys; then one <return>:-}%
\iwr@{ / X = abort now.}%
\iwr@{ / 8 = 8-bit output ; 7 = 7-bit output. }%
%\iwr@{ /// There are two routes for input:}%
%\iwr@{ / F = File ("\MainFileIn@", normally %
% alongside of this "email-ru.tex").}%
%\iwr@{ / B = Batch (files in directory %
% "\batchindirname@", in same location).}%
\iwr@{ /// There are two supported 7-bit formats:}%
\iwr@{ / L = Lossy transcription (using Ligatures);}%
\iwr@{ / A = ASCII-Cyrillic, using ' as accent and also ! \noexpand\ }%
\iwr@{ /// There are two supported language groups:}%
\iwr@{ / R = Russian (including Bulgarian and Byelorussian);}%
\iwr@{ / U = Ukrainian.}%
\iwr@{ /// There are many supported 8-bit Cyrillic encodings:}%
\iwr@{ / D = \DosBlurb@;}%
\iwr@{ / M = \MacBlurb@;}%
\iwr@{ / I = \IsoBlurb@;}%
\iwr@{ / W = \WinBlurb@;}%
\iwr@{ / K = \KoiBlurb@;}%
\iwr@{ / H = \HeadBlurb@;}%
\iwr@{ / E = \ExtraBlurb@.}%
\iwr@{ //// HELP: toward end of this %
macro file "email-ru.tex".}%
\iwr@{\Rule@}%
\iwr@{}%
}
%%% Subtle sanitization to see only ACDIKLMSTWX78
%%% Fails with case change alone; so use active too
\def \SeeOnlyACDEHIKLMRSTUWX78@{%
\count255=0\relax
\Loop@
\catcode\count255=9\relax
\advance\count255 by 1\relax
\ifnum
\count255<256\relax
\Repeat@
\catcode`7=12\relax
\catcode`8=12\relax
%% Undo above for 11 letters
\def/##1{\catcode`##1=11\relax}%
/A/C/D/E/H/I/K/L/M/R/S/T/U/W/X/a/c/d/e/h/i/k/l/m/r/s/t/u/w/x
\catcode`7=12\relax\catcode`8=12\relax
%% next make active a expand to letter A, etc.
\def/##1{\uccode`\~=`##1\relax\uppercase{\def~{##1}}}%
/a/c/d/e/h/i/k/l/m/s/r/t/u/w/x %% these are cat 11
%% then make these 11 letters active
\def/##1{\catcode`##1=13\relax}%
/a/c/d/e/h/i/k/l/m/r/s/t/u/w/x
}
\def\GetUserChanges@{%
\iwr@{ *** Default options: \PrevOptions@. }%
\iwr@{ *** Just type any change(s) and hit <return>.}%
\iwr@{ *** (Lowercase is OK.)}%
\begingroup
\SeeOnlyACDEHIKLMRSTUWX78@
\global\read16 to \YourChanges
\xdef\YourChanges{\YourChanges}
\endgroup
%\show\YourChanges
\let\UserChanges@\YourChanges
%\show\UserChanges@
\let\Reliquat@\UserChanges@
%\show\Reliquat@
\def\SiftedOptions@{}%
}
\def\Codify@#1{%
\IN@0#1@\Reliquat@ @%
\ifIN@\else
\edef\temp{#1}\message{Bug in \string\Codify@.}
\show\temp\show\Reliquat@
\show\Direction@
\fi
\SPLIT@0#1@\Reliquat@ @%
\edef\Reliquat@{\the\Initialtoks@\the\Terminaltoks@}%
\edef\SiftedOptions@{\SiftedOptions@#1}%
}
\def\CaseX@{%
\IN@0X@\UserChanges@ @%
\ifIN@
\def\Decision@{
\iwr@{ * Exit requested (by X).}
\endgroup\end}%
\else
\def\Decision@{}%
\fi
\Decision@}
\def\AdjustDirection@{%
%\show\UserChanges@
\IN@07@\UserChanges@ @%
\ifIN@
\Codify@{7}%
\else
\IN@08@\UserChanges@ @%
\ifIN@
\Codify@{8}%
\else
\edef\Reliquat@{\Reliquat@\Direction@}
\Codify@{\Direction@}%
\fi\fi
}
\def\AdjustACtype@{%
\IN@0L@\UserChanges@ @%
\ifIN@
\Codify@{L}%
\else
\IN@0A@\UserChanges@ @%
\ifIN@
\Codify@{A}%
\else
\edef\Reliquat@{\Reliquat@\ACtype@}
\Codify@{\ACtype@}%
\fi\fi
}
\def\AdjustLangGroup@{%
\IN@0R@\UserChanges@ @%
\ifIN@
\Codify@{R}%
\else
\IN@0U@\UserChanges@ @%
\ifIN@
\Codify@{U}%
\else
\edef\Reliquat@{\Reliquat@\LangGroup@}
\Codify@{\LangGroup@}%
\fi\fi
}
\def\AdjustEncoding@{%
\IN@0D@\UserChanges@ @%
\ifIN@
\Codify@{D}%
\else
\IN@0M@\UserChanges@ @%
\ifIN@
\Codify@{M}%
\else
\IN@0I@\UserChanges@ @%
\ifIN@
\Codify@{I}%
\else
\IN@0W@\UserChanges@ @%
\ifIN@
\Codify@{W}%
\else
\IN@0K@\UserChanges@ @%
\ifIN@
\Codify@{K}%
\else
\IN@0H@\UserChanges@ @%
\ifIN@
\Codify@{H}%
\else
\IN@0E@\UserChanges@ @%
\ifIN@
\Codify@{E}%
\else
\edef\Reliquat@{\Reliquat@\Encoding@}
\Codify@{\Encoding@}%
\fi\fi\fi\fi\fi\fi\fi
}
%%%% \InscribeUserChanges@
%%% Uses \PrevOptions@ in atomic form plus \UserChanges@
%%% Yields \SiftedOptions@ and \Reliquat@
%%% Yields full implementation of \SiftedOptions@
\def\InscribeUserChanges@{%
\CaseX@
\AdjustDirection@
\AdjustACtype@
\AdjustLangGroup@
\AdjustEncoding@
\PreImplant@\SiftedOptions@ % updates atomic options
\PrepOptionTags@
%\iwr@{ Direction@ = \Direction@}%
%\iwr@{ ACtype@ = \ACtype@}%
%\iwr@{ Encoding@ = \Encoding@}%
\iwr@{ Options keys being used: \SiftedOptions@}%
\iwr@{}%
\iwr@{ Modetag@ = \Modetag@}%
\iwr@{ ACtypetag@ = \ACtypetag@}%
\iwr@{ LangGrouptag@ = \LangGrouptag@}%
\iwr@{ Encodingtag@ = \Encodingtag@}%
\iwr@{}%
}
\def\AbortLossyInput@{%
%\message{AbortLossyInput@}%
\def\Decision@{}%
\if\ACtype@ L%
\if\Direction@ 8%
\iwr@{ !!! Sorry, type L (=Lossy) %
7-bit cannot be converted to 8-bit!}%
\def\Decision@{\read16 to \byebye \end}%
\fi
\fi
\Decision@}
\def\PrologRule@
{ /////////////////////////////////////////////////////////////////}%
\def\WritePrologOut@{%
\MakeSlantPct@
\Wr@{\PrologRule@}
%\show\SiftedOptions@
\Wr@{ //// Converted by "email-ru.tex", %
\cs@ email-ru-version\ecs@, options \SiftedOptions@, to}
\IN@07@\SiftedOptions@ @%
\ifIN@
\IN@0L@\SiftedOptions@ @%
\ifIN@
\Wr@{ //// \TheLangGroup@\space
text in a readable but lossy 7-bit ASCII format,}
\IN@0R@\SiftedOptions@ @%
\ifIN@
\Wr@{ //// namely the U.S. Lib. of Congress transcription scheme.}
\else
\Wr@{ //// namely the official Ukrainian one of 1996.}
\fi
\else
\Wr@{ //// \TheLangGroup@\space
text in faithful 7-bit ASCII-Cyrillic format.}
\Wr@{ //// The 33 letters of the modern \TheLangGroup@
\space alphabet are:}
\Wr@{ //// \LangAlphabetA@}
\Wr@{ //// \LangAlphabetZ@}
\Wr@{ //// For perfect restoration %
to many common 8-bit Cyrillic text}
\Wr@{ //// encodings, %
obtain the TeX utility "email-ru.tex" from CTAN.}
\fi
\else
\Wr@{ //// \TheLangGroup@\space
text in the 8-bit extended ASCII encoding:-}
\Wr@{ //// \cs@ \Encodingtag@ Blurb@\ecs@. For readable}
\Wr@{ //// ASCII transcriptions, %
use "email-ru.tex" available on CTAN.}
\fi
\Wr@{\PrologRule@}
\Wr@{}
\iwr@{ Processing (in 40 line units):-}\message{ }%
}
%%%%%%%%%%%%%%%%%%% <--------- END OF INTERVIEW
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% MODIFICATIONS %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifExit@
\newif\ifModif@
\newif\ifAbortModif@
\newtoks\Modiftoks@
\newcount\Modifcount@
\newcount\EndModifcount@
%\newcount\Prologcount@
\def \MaybeAbortModif@{
\ifAbortModif@
\iwr@{}
\endgroup\endgroup
\iwr@{ !! Hit return to abort.}
\read-1 to \Junk@
\ex@\end
\fi
}
%%%%% \FindAndCopyModif@
%% Uses \AuxEncodingFile@, \AuxStreamIn@
%% provides \Modifcount@, \EndModifcount@
\def\FindAndCopyModif@{%
\SetupModifLineReads@
\count255=0
\Loop@ %%
\read\MainStreamIn@ to \Line@
% \iwr@{ Line@ = \Line@}%
\ifeof\MainStreamIn@
\AbortModif@true
\iwr@{}%
\iwr@{ !! At eof of \AuxEncodingFile@.}%
\iwr@{ !! Although modification was announced for input,}%
\iwr@{ !! the flag \ModifFlag@\space is missing.}%
\iwr@{ !! The input line number now is \the \count255.}%
\fi
\MaybeAbortModif@
\advance\count255 1\relax
\ifnum\count255>80\relax
\Exit@true
\global\AbortModif@true
\iwr@{}%
\iwr@{ !! Input limit.}%
\iwr@{ !! Although modification was announced for input,}%
\iwr@{ !! the flag \ModifFlag@\space is missing.}%
\iwr@{ !! The input line number now is \the \count255.}%
\iwr@{ Line@ = \Line@}%
\fi
\IN@0\ModifFlag@ @\Line@ @
\ifIN@
%\iwr@{}%
%\iwr@{ *** Bingo ***************}%
\Exit@true
\Modif@true
\global\Modifcount@=\count255
%\iwr@{}
%\iwr@{ ** Modification beginning at line \the\count255.}
%\iwr@{ ** Exit@ is true.}
\fi
\ifExit@
\else
\Repeat@
%
\MaybeAbortModif@
%
\Exit@false
\Chaintoks@{}%% clean slate
\ChainLine@ %% in reserve for keeps !!!!!!!!!!!
\Wr@{\Line@}%% temp for reading
\Loop@ %%
\read\TheStreamIn@ to \Line@
\ChainLine@ %% in reserve for keeps !!!!!!!!!!!
\Wr@{\Line@}%% temp for reading
\ifeof\MainStreamIn@
\Exit@true
\AbortModif@true
\iwr@{}%
\iwr@{ !! End of input file and the}%
\iwr@{ !! flag \EndModifFlag@\space is missing.}%
\iwr@{ !! The line number now is \the \count255 : }%
\fi
\MaybeAbortModif@
\advance\count255 1\relax
%\iwr@{}%
%\iwr@{ ** Count 255 advanced to \the\count255.}%
\ifnum\count255>220\relax
\Exit@true
\AbortModif@true
\iwr@{}%
\iwr@{ !! Runon modification. Aborting at line 220.}%
\iwr@{ !! Need a flag: }%
\iwr@{ !! "\EndModifFlag@"}%
\iwr@{ !! The line number now is \the \count255 : }%
\fi
\MaybeAbortModif@
\IN@0\EndModifFlag@ @\Line@ @%
\ifIN@
\Exit@true %\message{** Exit@true **}%
\global\EndModifcount@=\count255
%\iwr@{}%
%\iwr@{ ** Modification ending at line \the\count255.}%
%\iwr@{ ** Exit@ is true. }%
\fi
\ifExit@
\else
\Repeat@
%
\cs@ \Encodingtag@ StreamInAdjust@\ecs@
%% Explanation: If Extra is encoding tag, then closein
%% \ExtraEncodingFile@ and openin \MainFileIn@
%% But if it is Head then do nothing and continue input.
\immediate\closeout\MainStreamOut@
%\iwr@{}%
%\iwr@{ *** Both loops completed.}%
%\iwr@{ *** Modification began at line \the\Modifcount@.}%
%\iwr@{ *** Modification ended at line \the\EndModifcount@.}%
%\iwr@{ *** See modif in "\MainFileOut@". %
% Then hit <return> to continue.}%
%\read16 to \Junk@
}
\def\ExtraStreamInAdjust@{%
\immediate\closein\MainStreamIn@
\immediate\openin\MainStreamIn@\MainFileIn@\relax}
%% \HeadStreamInAdjust@ will be relax
\MakeSlantPct@
\uccode`!=`\%
\uccode`?=`\#
\uppercase{%
\edef\ModifFlag@{!?[<ASCII-CYRILLIC\string_MODIF>?]}%
\edef\EndModifFlag@{!?[<ASCII-CYRILLIC\string_ENDMODIF>?]}%
}
\uccode`!=0
\uccode`?=0
\def\CatsForCopying@{%
\LowOctetsCat@{12}%
\HiOctetsCat@{12}%
\MakeSpecialsOther@ }
\def\TransCodeTheRest@{%
\count255=0
\Loop@ %%
\advance\count255 by 1\relax
\ifnum\count255=40\relax
\count255=0\message{\Sharp@}%
\fi
\ifeof\MainStreamIn@
\else
\read\MainStreamIn@ to \Line@
\ex@\uppercase\ex@{\ex@\Wr@\ex@{\Line@}}%
%\iwr@{\Line@}%
\Repeat@
}
\def\DoConversion@{%
\iwr@{}%
\iwr@{ ** ExploitModifs@}%
%
\TransCodeTheRest@
\immediate\closein\MainStreamIn@
\immediate\closeout\MainStreamOut@
}
%%%%%%%%%%%%%%%%%%% <--------- END OF MODIFICATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% \ImplantCurrentOptions@ %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%% \ImplantCurrentOptions@
%% Is unique bridge between interview and converter parts
%%%%% Currently \Modetag@ (LigOut or AccOut )
%% and \Encodingtag@ determine \ACtypetag@
%% so last is confined to Interview.
%%%%% \Modetag@ \Encodingtag@ \LangGrouptag@ are all
%% that is currently used from Interview
\def \ImplantCurrentOptions@{%
%%%%% \CategorySetup@
\ex@\let\ex@\CategorySetup@
%%**** = formally indep of encoding and language
\cs@ CategorySetup\Modetag@ @\ecs@
%%%%% \TheTransSetup@
\ex@\let\ex@\TheTransSetup@ %%****
\cs@ TransSetup\Modetag@ @\ecs@
%%%%% \MainConversionLoop@ is formally invariant
%%%%% \TreatLineLigOut@ %%** means formally indep of encoding
\ex@\let\ex@\TreatLineLigOut@ %%
\cs@ TreatLine\LangGrouptag@ LigOut@\ecs@
%\show\TreatLineLigOut@
%%%%% \TheTreatLine@
\ex@\let\ex@\TheTreatLine@ %%****
\cs@ TreatLine\Modetag@ @\ecs@ %%
%\show\TheTreatLine@
%%%%% \TheEightbitEncodingVect@
\ex@\let\ex@\TheEightbitEncodingVect@ %% formally indep of language
\cs@ \Encodingtag@ EncodingVect@\ecs@
%\show\TheEightbitEncodingVect@
%\ex@\show\cs@ \Encodingtag@ EncodingVect@\ecs@
%%%%% \@TheModeShorts \@TheAccShorts or \@TheLigShorts
\ex@\let\ex@\@TheAccShorts %%**
\cs@ @AccShorts\LangGrouptag@\ecs@
\ex@\let\ex@\@TheLigShorts %%**
\cs@ @LigShorts\LangGrouptag@\ecs@
%%%%% \@HiOctetLigOutDefs
\ex@\let\ex@\@HiOctetLigOutDefs %%**
\cs@ @HiOctet\LangGrouptag@ LigOutDefs\ecs@
%%%%% \ActiveLigOutDefs@
\ex@\let\ex@\ActiveLigOutDefs@ %%**
\cs@ Active\LangGrouptag@ LigOutDefs@\ecs@
%%%%% \LigContextActivations@
\ex@\let\ex@\LigContextActivations@ %%**
\cs@ \LangGrouptag@ LigContextActivations@\ecs@
%%%%% \ThePrepMoreLiveAccIn@
\ex@\let\ex@\ThePrepMoreLiveAccIn@ %%**
\cs@ PrepMoreLive\LangGrouptag@ AccIn@\ecs@
%\show\PrepMoreLiveAccIn@
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% MAIN %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%% \Main@:- After \CategorySetup@ to \endgroup
%% must avoid space { } etc
\def\Main@{%
\begingroup
\InterviewUser@
\DoTheHeader@ %% hiatus "}{" , but here
%% \SiftedOptions@, \PrevOptions@ etc. etc. global
\ImplantCurrentOptions@
\TheTransSetup@
%\ex@\show\cs@'\string>\ecs@
\MaybeSetupLineReads@
\begingroup
\CategorySetup@
%\showthe\catcode`\-
%\showthe\catcode127
%\showthe\catcode32\relax
%\showthe\catcode`\\
\MainConversionLoop@
\endgroup
\Endgame@
\endgroup
\end
}
\def\MaybeSetupLineReads@{%
\def\temp@{E}%
\ifx\Encoding@\temp@
\SetupMainLineReads@
\fi}
\def\ProcessingReport@{}
\def\DoTheHeader@{%
\IN@0\Encoding@ @DMIWK@
\ifIN@
\ex@\DoOrdHeader@
\else
\ex@\DoAuxHeader@
\fi}
\def\DoOrdHeader@{%
\SetupMainWriteOuts@
\WritePrologOut@
}
\newtoks\temptoks@
\def\DoAuxHeader@{%
%\iwr@{ * \string\DoAuxHeader@}%
\SetupMainWriteOuts@
\CatsForCopying@
%\iwr@{}
\iwr@{ * \ne@\FindAndCopyModif@ :- %
Seeking modifs in "\AuxEncodingFile@".}%
\iwr@{}
\FindAndCopyModif@
\global\Chaintoks@\Chaintoks@
\global\let\SiftedOptions@\SiftedOptions@
\global\let\PrevOptions@\PrevOptions@
\global\let\Modetag@\Modetag@
\global\let\Encodingtag@\Encodingtag@
\global\let\LangGrouptag@\LangGrouptag@
\global\let\TheLangGroup@\TheLangGroup@
\global\let\LangAlphabetA@\LangAlphabetA@
\global\let\LangAlphabetZ@\LangAlphabetZ@
\endgroup %%%%%%%%%%%%% coming up for old categories
\let\AsciiCyrModif\relax %% to get by gate on encoding
%\iwr@{ * Now digesting the modifs in "\MainFileOut@".}%
%\iwr@{}%
\input\MainFileOut@ %% !!!!!!!!
\begingroup %%%%%%%%%%%%
\CatsForCopying@
%% Now wipe out \MainFileOut@
\SetupMainWriteOuts@
\WritePrologOut@
\Wr@{\the\Chaintoks@}\Wr@{}%
\global\Chaintoks@{}%% Cleanup
\temptoks@\ex@{\AuxEncodingVect@}%
%\showthe\temptoks@
%\iwr@{}%
%\iwr@{ ** Here is meaning of \string\AuxEncodingVect@:}%
%\iwr@{\the\temptoks@}%
%\iwr@{}%
%\iwr@{ ** Hit <return> to continue.}%
%\read16 to \Junk
\ex@\let\cs@\Encodingtag@ EncodingVect@\ecs@\AuxEncodingVect@
}%
%\let\ExtraEncodingVect@\NullEncodingVect@
%\let\HeadEncodingVect@\NullEncodingVect@
%%%%% \Closing@
\def\Closing@{%
\ProcessingReport@
\iwr@{}
\iwr@{ *** Finished! See \MainFileOut@\space
alongside of \MainFileIn@.}%
%\iwr@{ *** Hit <return> to exit.}%
%\read16 to \byebye
}
\def\WriteEpilog@{%
\MakeSlantPct@
%\Wr@{}%
\Wr@{\PrologRule@}%
\Wr@{ //// End of output by %
"email-ru.tex", with options \SiftedOptions@.}%
\Wr@{\PrologRule@}%
}
\def\WritePrevOptions@{%
\ifx\SiftedOptions@\PrevOptions@
\else
\immediate\openout\MainStreamOut@ email-ru.opn \relax
\immediate\write\MainStreamOut@{\SiftedOptions@}%
\immediate\closeout\MainStreamOut@
\fi
}%
\def\Endgame@{%
\WriteEpilog@
\immediate\closein\MainStreamIn@
\immediate\closeout\MainStreamOut@
\WritePrevOptions@
\Closing@
%%%%%%%% End of assimilation categories
%%
\catcode`\/=12 %% was 13
\catcode`\|=12 %% was 13
\catcode1=\CatOne@ %% syntactical trick for AccIN
\catcode`\@=12 %% was 11
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% EXECUTE MAIN %%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Main@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% %%%%
%%% DOCUMENTATION FOR "email-ru.tex" %%%%
%%% %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Nota Bene: This documentation is mostly ASCII text. But it
requires a few lines of Cyrillic text. These are presented in
the MS Windows 8-bit encoding cp1251 for octets 128--255. As
cyrillic characters may not display correctly, all blocks of
one or more such lines are preceded by a warning line tagged
"%#Cy(" and followed by a line tagged "%#Cy)". GIF versions
are visible on the HTML home page at
http://topo.math.u-psud.fr/~lcs/ASCII-Cyrillic/ascii-cy.htm
CONTENTS
SECTION 1 Introduction
SECTION 2 Russian ASCII-Cyrillic
APPENDIX ASCII-Cyrillic for Bulgarian and Byellorussian
APPENDIX ASCII-Cyrillic for Ukrainian
APPENDIX Specifying a Cyrillic encoding vector in the input
APPENDIX Specifying an external Cyrillic encoding vector
APPENDIX The ^^xy pitfall
APPENDIX Email transfer checklist
SECTION 1
*** Introduction ***
This utility serves Russian and Ukrainian languages in
parallel. The documentation is initially for Russian and the
few modifications needed to adapt to the Ukrainian alphabet are
concentrated in an appendix.
Here is a fragment of Russian email in 8-bit Microsoft
Windows Russian text encoding. It can be typed and read on
any computer in any country where a Cyrillic alphabet is
indigenous --- but rarely beyond.
%#Cy(
Íà îáðàòíîì ïóòè Gardine îáúÿñíèëà ìíå, êàê
äåëàòü ïåðåñàäêó íà ìåòðî. Ìû ñ íåé ïðîåõàëè
áîëüøóþ ÷àñòü ïóòè âìåñòå. Îíà âûøëà íà
îñòàíîâêå ïîñëå òîãî, êàê ìû ïåðåñåëè íà ìîþ
ëèíèþ. Ïîëüçîâàòüñÿ ìåòðî ¹13A,
äåéñòâèòåëüíî, î÷åíü ïðîñòî -- ãîðàçäî ïðîùå,
÷åì â Ìîñêâå. Êîãäà ÿ ýòî ïîíÿëà, òî ñðàçó
óñïîêîèëàñü. Ñåé÷àñ âñ¸ â ïîðÿäêå. ß ìîãó
ïîëüçîâàòüñÿ ìåòðî, è óæå íå áîþñü õîäèòü ïî
Ïàðèæó.
%#Cy)
Even this degree of portability is hampered by the
frequent need to re-encode for another computer operating
system. If that problem is already bothering you here,
you may want to read the HTML or PDF formatted documentation
available at http://topo.math.u-psud.fr/~lcs/ASCII-Cyrillic/
or on CTAN TeX archives.
The utility "email-ru.tex" serves primarily to quickly
convert this 8-bit text to and from a new 7-bit ASCII
transcription of Russian, called "ASCII-Cyrillic" which is is
both typeable and readable on every computer worldwide:
Na obratnom puti !Gardine obq'asnila mne, kak
delath peresadku na metro. My s nej proexali
bolhwu'u casth puti vmeste. Ona vywla na
ostanovke posle togo, kak my pereseli na mo'u
lini'u. Polhzovaths'a metro 'N13!A,
dejstvitelhno, ocenh prosto -- gorazdo pro'we,
cem v Moskve. Kogda 'a 'eto pon'ala, to srazu
uspokoilash. Sejcas vs'o v por'adke. 'A mogu
polhzovaths'a metro, i u'ze ne bo'ush xodith po
Pari'zu.
Well chosen English (Latin) letters stand for most Russian
letters. To distinguish the remaining handful of Russian
letters, a prefixed accent ' is used. Further, to introduce
English words, the exclamation mark ! appears. The whole
ASCII-Cyrillic system for Russian can hopefully be learned
in an hour.
Russian prose (8-bit encoded) is less than 4 percent
bulkier in 7-bit ASCII-Cyrillic form. Thus typing speed
for ASCII-Cyrillic on any computer keyboard can approach
that for a Cyrillic keyboard.
The bulk difference of 4 percent drops to less then 1
percent when modern "gzip" compression is applied to both.
Thus there is virtually no penalty for storing Cyrillic text
files in ASCII-Cyrillic form.
The 7-bit ASCII-Cyrillic form can be converted by
"email-ru.tex" back to any of the most used 8-bit encodings.
ASCII-Cyrillic is a cousin of existing transcriptions of
Russian which differ in using the concept of ligature -- i.e.
they use two or more English letters for certain Russian letters.
The utility "email-ru.tex" also converts Russian to one such
ligature-based transcription system established by the the USA
Library of Congress:
Na obratnom puti Gardine ob\jasnila mne, kak
delat' peresadku na metro. My s nej proexali
bol'shuju chast' puti vmeste. Ona vyshla na
ostanovke posle togo, kak my pereseli na moju
liniju. Pol'zovat'sja metro No13A,
dejstvitel'no, ochen' prosto -- gorazdo proshche,
chem v Moskve. Kogda ja eto ponjala, to srazu
uspokoilas'. Sejchas vse v porjadke. Ja mogu
pol'zovat'sja metro, i uzhe ne bojus' xodit' po
Parizhu.
Caveat: Accurate reconversion of existing ligature-based
transcriptions back to 8-bit format requires
a good deal of human intervention.
Although not more readable, the ASCII-Cyrillic
representation has the advantage that, for machines as well
as men, it is completely unambiguous as well as easily
readable. The "email-ru.tex" utility does the translation
*both* ways without human intervention, and the conversion
(8-bit) ==> (7-bit) ==> (8-bit) gives back *exactly* the
original 8-bit Russian text. (One minor oddity to remember:
terminal spaces on all lines are deleted.)
Thus, by ASCII Cyrillic encoding a Russian text file,
one can archive and transfer it and conveniently and safely.
The utility "email-ru.tex" provides the means for encoding
and decoding almost anywhere.
Outside of Russia, with no Russian keyboard available,
one can now accurately type and read Russian using
ASCII-Cyrillic.
The converter "email-ru.tex" is programmed as a macro
package for the widely (and even freely) available program
called TeX. It is widely installed, and even the most modest
installation of TeX (in version >=3 of 1989) should suffice.
It is fair here to think of TeX as a machine accepting
many attachments like "email-ru.tex", which permit one to do
a great variety jobs in the world of documentation.
Here is an internet address leading to many choices of
TeX implementation:
http://www.TUG.org
The simplest configuration or "format" of TeX called
"Plain" is best; but there is a good chance that
a randomly chosen format will also work.
Beginner's operating instructions for using
"email-ru.tex" once the TeX program is available are
simple:-
(i) put a copy of the file to convert, alongside of
email-ru.tex and give it the name "IN.txt".
(ii) process "email-ru.tex" (not "IN.txt") with Plain TeX. The
usual command line is:
tex email-ru.tex<return>
On computers with a graphical interface, one instead
usually just pushes the icon of "email-ru.tex" onto the
icon of the TeX program, indicating the format Plain if
the occasion offers itself.
(iii) follow the instructions offered by email-ru.tex. An
explanatory prolog and trailer will be added to the converted
output.
PITFALL: A few important TeX implementations, particularly
under the unix and Macintosh operating systems, cannot be
configured to \write true octets > 127 as "email-ru.tex"
expects in converting *from* ASCII-Cyrillic *to* 8-bit
Cyrillic text. Instead, octets >= 128 are represented by 4
ASCII character 'pseudo-octets' "^^xy" where "xy" is the
lowercase two digit hexadecimal notation for the octet. If
you encounter this in your announced 8-bit output from
"email-ru.tex", please refer to the appendix called "The ^^xy
pitfall" to learn how you can work around this difficulty.
SECTION 2
*** Russian ASCII-Cyrillic for email-ru.tex ***
This section is a practical introduction to
the new ASCII-Cyrillic system.
The 33 letters of the modern Russian alphabet, in
alphabetic order, are typed:
a b v g d e 'o 'z z i j k l m n o p r
s t u f x 't 'c w 'w q y h 'e 'u 'a
The letter 'o is an <e-dieresis> pronounced "yo", and in
principle it should be placed immediately after e. However,
most Russian dictionaries list it as an accented Russian e
and not as an autonomous letter like the other 32.
The MS Windows 8-bit version is:
%#Cy(
à á â ã ä å æ ç è é ê ë ì í î ï ð
ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ ¸
%#Cy)
Similarly for capital letters:
A B V G D E 'O 'Z Z I J K L M N O P R
S T U F X 'T 'C W 'W Q Y H 'E 'U 'A
correspond to:
%#Cy(
À Á Â Ã Ä Å ¨ Æ Ç È É Ê Ë Ì Í Î Ï Ð
Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß
%#Cy)
Where there are several ergonomically "optimal" choices for
typing a Russian character, several may be admissible.
Thus:
'g='z 's=w c='t 'k=x
Incidentally, the strongest justification for typing "c" for a
letter consistently pronounced "ts" is the
traditional Russian recitation of the Latin alphabet:
ah beh tseh deh ...
For the Russian number character, which resembles in
shape the pair "No", ASCII-Cyrillic uses the notation '[No]
or alternatively 'N. A short list of important
representations for non-letter characters are:
'[No] Cyrillic number sign = 'N
'[<<] Cyrillic left quotes (left guillemets) = '<
'[>>] Cyrillic right quotes (right guillemets) = '>
'[,,] Cyrillic left inner double quotes ='[LQ]
'["] Cyrillic right inner double quotes ='[RQ] (*not* '[''])
'['] Single right quote ='[rq] (usually = '{apos})
'[`] Single left quote ='[lq]
'[---] long dash ='[emdash]
'[--] medium dash ='[endash]
'[...] dots (suspension) ='[dots]
'[<=] less than or equal ='[leq]
'[>=] greater than or equal ='[geq]
'[/=] not equal ='[neq]
'[nbsp] unbreakable space
'[\-] soft hyphen ='[shy]
'[^o] degree(s) ='[degree]
'[**] bullet ='[bullet]
'[~~] approx ='[approx]
Conventions established by TeX or PostScript or Unicode are
followed; however, additionally, some short forms with mnemonic
value are available as the above examples illustrate. An adequate
table of concordances of norms can be found by searching for the
word "currency" in this file.
[In TeX typescripts, many of the above diacritics already
have equally convenient ASCII representations as a TeX control
word beginning with "\" . Thus few of the above concern TeX
users.]
For the Cyrillic *letter* "gup" not in the modern Russian
alphabet of 33 letters, ASCII-Cyrillic uses '{gup} (and
'{GUP} for the uppercase form). Similarly for other Cyrillic
characters. The braces proclaim a Cyrillic letter.
The ASCII-Cyrillic expression for an octet >127 *not*
encoded to any normalized character, is !__xy where xy is the
two-digit hexadecimal representation of the octet. For example,
octet "8B, in the KOI8 encoding, is for non-text graphic
purposes and thus is rendered in ASCII-Cyrillic format as
!__8b. Conversion back to the 8-bit form will work. However,
although the 5 octet string "!__8b" is ASCII text, this text
is not independent of 8-bit encoding. Thus, it is best to
eliminate such "unencoded" or "meaningless" octets.
Beware that, if, in ASCII-Cyrillic, you type simply
"Coca-Cola", then you get:
%#Cy(
×î÷à-×îëà
%#Cy)
ASCII-Cyrillic is not well designed for typing English
sentences, but occasional English words or letters are used
in Russian, so ASCII-Cyrillic allows one to type !U for an
isolated U and:
!Coca-!Cola for Coca-Cola
TeX is a powerful stable and portable formatting
system -- perhaps the most widely used for scientific and
technical documents. For a continental European language with
an accented Latin alphabet (French for example), a TeX
typescript is often created as an 8-bit text file that (just
as for Russian) depends on 8-bit encoding. However TeX itself
has always offered an alternative more prolix ASCII form for
such accented latin letters; and it has always served to provide
exchangeable ASCII typescripts that are readable and editable.
ASCII-Cyrillic seems to be the first ASCII scheme to offer
something similar for all Russian TeX typescripts.
To let TeX users more easily type in ASCII-Cyrillic, the
latter preserves TeX control sequences like \begin. The
familiar (La)TeX command
\begin{document}
is thus expressed as:
\begin{!document}
Here \ and ! have special roles, and are called escape characters
because they allow the letter sequences "begin" and "document"
to escape from routine conversion between English letters and
Russian Cyrillic letters.
Since the three ASCII characters ' ! \ do have special
powers to influence the interpretation of what follows, their
syntax in ASCII-Cyrillic typing has some eccentricities.
Fortunately, these occur only rarely. They will be discussed
in a file "email-ru.spc" (not yet available) that will contain
more formal specifications for ASCII-Cyrillic. In the
interim, curious users can probe the intricacies using
"email-ru.tex". (Please report inconsistencies and
infelicities to the author!)
The ASCII non-letter characters are all common to Russian
and English, namely:
<space>
! " # $ % & ' ( ) * + , - . /
0 1 2 3 4 5 6 7 8 9 : ; < = > ? @
[ \ ] ^ _ `
{ | } ~
It is worth remembering these, since you can then pretty well
identify ASCII text at sight. All of these, except on occasion
' ! \ , can be freely used in ASCII-Cyrillic typing of Russian
prose; they are not altered under conversion to an 8-bit
encoding.
One advantage of ASCII-Cyrillic representation is that it
appears the same on every computer in the world today. Indeed,
the ASCII encoding has for decades been a universally (but not
exclusively) used standard for computers. Its use by programmers
worldwide guarantees its validity for many future decades.
The MS Windows 8-bit Cyrillic encoding can be expected only in
Russia and under MS Windows operating systems. On the other hand,
the first 128 of 256 codes in it adhere to the universal ASCII
standard (which is also an ISO standard). The same inclusion of
ASCII holds for most other Cyrillic encodings in use today; at the
technical level, "email-ru.tex" relies heavily on this convenient
fact. Hopefully an overwhelming majority of Russian computer users
work with one of the five 8-bit encodings currently supported by
"email-ru.tex"; their tags for "email-ru.tex" are D,M,I,W,K
respectively (the order being historical). Deviations can be
handled by introducing an an auxiliary encoding, as indicated in
appendices, and using auxiliary keys H or E.
These tags are less discriminating than the conventional
tags fully identifying encodings used by Russian computer
screen fonts for text. There is in practice a one-to-many
correspondence from keys in the user dialog to encodings:
D (Dos) <=> cp866... MS DOS encodings
M (Mac) <=> mac... Apple Macintosh Cyrillic encodings
I (Iso) <=> iso88595 of 1988 for unix (Sun,DEC,HP,Linux,etc.)
W (Win) <=> cp1251 for Microsoft Windows
K (Koi) <=> koi8... Internet encodings, since RFC-1489 of 1993
H (Head) <=> encoding specified at the Head of the file
to be processed (see Appendix for syntax).
E (Extra)<=> Extra user-defined encoding -- same syntax but
located in (or via) the file "extraenc.tex".
The casual user of "email-ru.tex" should should just notice
which sort of computer environment he is using, and guess from
the above list which of the five tags D,M,I,W,K best applies.
Almost always, one of these five works perfectly:- because it is
the same as for the computer involved as regards all characters
actually used. (Deviations for unused characters are of no
practical significance!)
Technical comment: In the above list, ... stands for any
continuation yielding some valid LaTeX input encoding tag for
Cyrillic that you can find in the LaTeX file "cyinpenc.dtx".
The latter builds files named "<encodingtag>.def" directly
employed by LaTeX installations. Alternative references for
these Cyrillic encodings are:
--- russian.el, 1994 by Valery Alexeev <ava@math.jhu.edu>
"Display, translate and edit buffers containing Russian
characters" an emacs editor macro package, LCD Archive Entry:
~/packages/russian.el.Z
--- nic.funet.fi:/pub/culture/russian/comp/characters
--- cyrillic.encoding.faq by Andras Kornai <andras@calera.com>
--- lettermappings.gz by Dmitri Vulis <dlv@sunyvms1.bitnet>
--- internet RFC 1489
--- http://www.fingertipsoft.com/ref/cyrillic
Conversion between different 8-bit encodings is possible
using "email-ru.tex". But one must do it in two steps, going via
the ASCII_Cyrillic 7-bit format. Beware that in case the target
encoding does not contain a certain character in the source file,
that character is left in a distinctive ASCII-Cyrillic form.
This, in practice, helps you see and repair the damage. Such
damage is neither exceptional nor avoidable since the characters
covered by the encodings vary somewhat with the encoding. But it
is usually minor and repairable.
Exercise: You know enough at this point to use ASCII-Cyrillic to
type or read any Russian email or any piece of Russian prose,
for example, that in the first section. Convert forth and back
between 7-bit and 8-bit forms using "email-ru.tex".
This version of "email-ru.tex" is preliminary; if a problem is
is encountered, please first check the most up-to-date version; then
please communicate bugs and suggestions to the author.
Possibilities for future development:
-- support for more Cyrillic alphabets
-- support for Unicode Cyrillic
-- support for the Mime protocol
-- batch mode
-- segmented files (e.g. just certain parts marked for conversion)
-- integration with TeX for rapid typesetting of ASCII-Cyrillic
text.
Thanks are due to the members of the Cyrillic TeX discussion
list (CyrTeX-en@vsu.ru) for clarifying the problems a utility
such as this one should address. The list archives are available
at:
https://info.vsu.ru/Lists/CyrTeX-en/List.html
Advice from Maksym Polyakov <mpoliak@pcomp.nauu.kiev.ua> was
essential in establishing the Ukrainian mode.
Laurent Siebenmann
lcs@topo.math.u-psud.fr
lcs@math.polytechnique.fr
laurent@math.toronto.edu
ASCII-Cyrillic home page in December 2000:
http://topo.math.u-psud.fr/~lcs/ASCII-Cyrillic/ascii-cy.htm
Copyright Conditions: Gnu Public Licence
*** APPENDIX ASCII-Cyrillic for Bulgarian and Byelorussian ***
ASCII-Cyrillic for Bulgarian coincides with ASCII-Cyrillic
for Russian.
ASCII-Cyrillic for Byelorussian is fully compatible with
Russian, but uses two extra letters:
%#Cy(
³ ¢
%#Cy)
<==> '{ii} '{ushrt} <==> 'i 'v
The short forms are currently available even in Russian mode, but
this may change in future versions.
*** APPENDIX ASCII-Cyrillic for Ukrainian ***
This is similar to but distinct from the Russian mode and is
*not* compatible with it.
The 33+1 letters of the modern Ukrainian alphabet, listed in
alphabetic order (MS Windows 8-bit encoding here) are:
%#Cy(
à á â ã ´ ä å º æ ç è ³ ¿ é ê ë ì
í î ï ð ñ ò ó ô õ ö ÷ ø ù þ ÿ ü ’
%#Cy)
and the preferred Ukrainian ASCII-Cyrillic (short) form is:
a b v g 'g d e 'e 'z z y i 'i j k l m n
o p r s t u f x 't 'c w 'w 'u 'a q '*
The 34th character is a Cyrillic apostrophe, a modifier letter that
has various roles, among them those of the hard sign of Russian. The
representation valid for all Cyrillic languages is '{apos}.
The following four letters do not occur in
Russian:
%#Cy(
´ º ³ ¿
%#Cy)
<==> '{gup} '{ie} '{ii} '{yi} (for all Cyrillic)
<==> 'g 'e i 'i (for Ukrainian)
<==> (no Russian short forms)
The forms '{gup} etc. (in the second row) are the same for all
cyrillic languages.
Reciprocally, the following four Russian letters
do not occur in Ukrainian:
%#Cy(
ú û ý ¸
%#Cy)
<==> '{hrdsn} '{ery} '{erev} '{yo} (for all Cyrillic)
<==> (no Ukrainian short forms)
<==> q y 'e 'o (for Russian)
The following two letters are common to Ukrainian and Russian
but the ASCII-Cyrillic short forms are different.
%#Cy(
è ü
%#Cy)
<==> '{i} '{sftsn} (for all Cyrillic)
<==> y q (for Ukrainian)
<==> i h (for Russian)
The use, in Ukrainian ASCII-Cyrillic, of q as a short form for
'{sftsn} is justified by the fact that the shape q rotated by 180
degrees is similar to that of '{sftsn}. But there is another
reason for this choice. It permits one to use h as an alternative
Ukrainian short form for '{g} --- which is natural since in many
cases '{g} is pronounced like the harsh German h in "Horst".
The full list of alternatives short forms is:
's=w
c='t
'k='x=x
h=g
Similarly for capital letters. In particular:
%#Cy(
À Á Â Ã ¥ Ä Å ª Æ Ç È ² ¯ É Ê Ë Ì Í
Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Þ ß Ü ’
%#Cy)
have the Ukrainian ASCII-Cyrillic representation:
A B V G 'G D E 'E 'Z Z Y I 'I J K L M N
O P R S T U F X 'T 'C W 'W 'U 'A Q '*
Long forms valid for all Cyrillic languages are:
'{A} '{B} '{V} '{G} '{GUP} '{D} '{E} '{IE} '{ZH} '{Z}
'{R} '{I} '{II} '{YI} '{J} '{K} '{L} '{M} '{N} '{O}
'{P} '{S} '{T} '{U} '{F} '{X} '{C} '{CH}
'{SH} '{SHCH} '{YU} '{YA} '{SFTSN} '{APOS}
Note that the Ukrainian apostrophe '{APOS} is a *letter*
and unlike '{SFTSN} it normally coincides with the lowercase
version: normally '{APOS}='{apos}. In case of a distinction
'* will be '{apos}.
There is an official lossy "Latin transliteration" for
Ukrainian using the ligature concept, and it is supported by
"email-ru.tex". See the Ukrainian national norm of 1996
summarized at:
http://www.rada.kiev.ua/translit.htm
Beware that the official transliterations of the six letters
'{g} '{ie} '{yi} '{ishrt} '{yu} '{ya}
are *context dependent*. This is a good reason for relying
on "email-ru.tex" to do the official transliteration.
The other aspects of ASCII-Cyrillic are the same for Ukrainian
and Russian.
*** APPENDIX Specifying a Cyrillic encoding vector in the input ***
The following is technical, but probably well within the reach
of confirmed TeX users.
The encoding option key "H" (for Header) in the main dialog
serves to request use of an encoding vector given in full near the top
of the input file.
Here is the appropriate syntax; it should be imitated quite
exactly. Beginning in the first 80 lines of the file to convert
(normally IN.txt), there should occur the following sort of
structure:
%#[<ASCII-CYRILLIC_MODIF>#]
\ifx\AsciiCyrModif\relax %%% TeX gateway
%%% Encoding to be used only if requested via the
%%% "H" encoding option key of the "email-ru.tex" dialog.
%%% LaTeX encoding Tag: cp866
\def\AuxEncodingVect@{%
/A./B./V./G./D./E./ZH./Z.%% "80--
/I./ISHRT./K./L./M./N./O./P.%% --"8F
/R./S./T./U./F./H./C./CH.%% "90--
/SH./SHCH./HRDSN./ERY./SFTSN./EREV./YU./YA.%% --"9F
/a./b./v./g./d./e./zh./z.%% "A0--
/i./ishrt./k./l./m./n./o./p.%% --"AF
\.\.\.\.\.\.\.\.%% "B0--
\.\.\.\.\.\.\.\.%% --"BF
\.\.\.\.\.\.\.\.%% "C0--
\.\.\.\.\.\.\.\.%% --"CF
\.\.\.\.\.\.\.\.%% "D0--
\.\.\.\.\.\.\.\.%% --"DF
/r./s./t./u./f./h./c./ch.%% "E0--
/sh./shch./hrdsn./ery./sftsn./erev./yu./ya.%% --"EF
/YO./yo./IE./ie./YI./yi./USHRT./ushrt.%% "F0--
|deg.|bullet.|cdot.|surd.|No.|coin.|blacksquare.|nbsp.%% --"FF
}
%%% This is the old "Standard" version of DOS encoding cp~866.
%%% Key D gave the New Alternative Variant" or "NAV" version
%%% The differences lie in the range "F2--"FE.
\fi
%#[<ASCII-CYRILLIC_ENDMODIF>#]
This provides an ordered list of 128 definitions for the encoding
positions 128="80 to 255="FF. There are, basically, three sorts of
definition and 8 definitions per row. For example:
--- "/SHCH." encodes position "9C as the Cyrillic *letter* whose TeX
name is \CYRSHCH. The truncated TeX name is always used.
--- "|nbsp." encodes position "FF as the unbreakable space. The "|"
indicates that this is a *diacritic* character. The names for
diacritical characters used here are the shorter alphabetical names
that one finds in the list of diacritics you can locate by searching
for the word "currency" in this file.
--- "\." encodes position "B0 as a *undefined*, and similarly for
"B1--"DF.
See also comments preceeding the internal encodings.
If there is no encoding definition set up in the above manner, then
"email-ru.tex" will abort.
Material on lines before:
%#[<ASCII-CYRILLIC_MODIF>#]
will be skipped. Then, lines up to and including:
%#[<ASCII-CYRILLIC_ENDMODIF>#]
will be copied verbatim and appear immediately after the usual
prologue for the output. Lines after that will be converted using the
designated encoding.
Beware: If the H option key is not used, then (in the present version)
the *whole* input file will be converted with another specified
encoding. Remove to safe storage unused encodings; they may confuse
inexperienced users.
*** APPENDIX Specifying an external Cyrillic encoding vector ***
In the main dialog the encoding option key "E" (for External) is
devoted to this. It requests an encoding via the *user-defined* file
"extraenc.tex". The simplest possibility for "extraenc.tex" is exactly
the sort of segment
%#[<ASCII-CYRILLIC_MODIF>#]
...
%#[<ASCII-CYRILLIC_ENDMODIF>#]
used with the "H" option key. The behavior commanded is the same
as with the "H" option key, except that the whole input file is
converted. In particular, the encoding vector will be inserted
into the output, below the usual prolog.
A TeX programmer would be able to provide access via a
dialog in "extraenc.tex" to an arbitrary number of encoding
vectors.
*** APPENDIX The ^^xy Pitfall ***
The pitfall to be discussed affects chiefly conversion
from 7-bit ASCII-Cyrillic text files to 8-bit Cyrillic text.
The author of TeX, Donald Knuth, provided, beginning with the
first 8-bit version 3 of 1989, a "pseudo-8-bit" mechanism allowing
octets > 127 being output via the TeX primitive command \write to
be written each as a sequence of four ASCII octets ^^xy
(called a "pseudo-octet") where xy is the the 2-digit lowercase
hexadecimal notation for the octet. For example, octet 128 becomes
^^80, and octet 255 becomes ^^ff.
The use of this mechanism seems to be standard TeX.
Presumably, it was intended to allow TeX to function on
operating systems that are unable to handle text files
containing octets >= 128. However, there are now virtually no
such operating systems, and the feature is a hinderance to many
users, in particular to users of email-ru.tex wishing to extract
true 8-bit text from ASCII-Cyrillic. Thus, *most* TeX
implementations now offer true 8-bit text output, at least
optionally -- thus enabling "email-ru.tex" to convert
ASCII-Cyrillic to true 8-bit text.
If your TeX writes only "pseudo-octets", try the following:
WORKAROUND (A) If (as is highly probable) you *know* that the
*intended* 8-bit output would contain no pseudo-octet ^^xy then you
can finish the conversion job by applying the tiny converter "Kto8"
to get rid of the "pseudo-octets". The name "Kto8" is a contraction
of the phrase "Knuthian-to-8-bit". "Kto8" currently scans once,
converting any Knuthian pseudo-octet ^^xy encountered to the
corresponding genuine octet. Further, it does something similar
for Knuth's representations of the form ^^X for the octets
0,1,..,31, and 127. It is self-documenting. Look for "Kto8" in the
ASCII-Cyrillic distribution directory; there will be binaries for
the Macintosh, Windows, and some unix operating systems.
WORKAROUND (B) Examine the operating options for your TeX
implementation (normally in documentation provided by the
implementor) to see if, by hook or by crook, you can get true
8-bit output. Many implementors, commercial or not, are extremely
responsive to user enquiries.
WORKAROUND (C) Ask yourself whether an 8-bit Cyrillic version is
strictly necessary. If the 8-bit output was really intended for
typographic composition by TeX, then you will probably find that
the "pseudo-8-bit" output will be equally acceptable to TeX,
albeit unreadable to human eyes.
WORKAROUND (D) Use one of the many fully 8-bit-capable TeX
installations.
Here is a list of TeX implementations for which the current
version is known to offer true 8-bit \write output, at least
optionally (see www.tug.org for other TeX implementations).
PLEASE CONTRIBUTE ADDITIONS TO THIS LIST!
** MS Windows Operating System, including DOS
-- BaKoMa TeX by B.K. Malyshev
-- emtex, for DOS, by E. Mattes
Comments: Create format file using option flag -o.
Octet 255 infortunately remains ^^ff.
-- fptex for Windows, by F. Popineau.
Comments: It is a Windows port of tetex.
-- miktex for Windows, by C. Schenk.
-- VTeX by MicroPress Inc.
Comments: 8-bit output is the default behavior for the
console-mode compilers [free versions on Linux and OS/2, as well
as Console mode on Win] but the 7-bit behaviour is the default
in GUI version which is integrated into the Vtex/Win IDE. In
either case, there is a switch to change the behaviour.
-- Y&Y TeX, by Y&Y Inc, http://www.Y&Y.com
Comment: By default, output is 8-bit. Command line option -K
gives pseudo-8-bit output.
** Macintosh OS
-- Textures, by Blue Sky Research (since TeX 3)
-- OzTeX from v4 of 2001
Comment: To get true 8-bit output, you must set
write_8_bit = true in your configuration file and then
rebuild your format file(s).
** Unix OS and Linux OS
-- tetex for unix and linux, by T. Esser
It is based on web2C.
-- web2C maintained currently by Olaf Weber.
Comment: Specific compilations not included,
cf. tetex and fptex.
In case your default configuration is not OK,
try the tex command line option:
"--translate-file=cp8bit.tcx"
and learn about TCX files.
-- VTeX for Linux (see MS Widows listing).
---------------
Veteran TeX users should note one more subtle point
concerning pseudo-octets:- When in its usual *typesetting* mode
and reading a pseudo octet ^^xy, TeX will behave exactly as if
it has read the octet numbered xy (in lowercase hexadecimal
notation). In contrast, when running "email-ru.tex", TeX
regards an ^^xy in the input file as merely a sequence of 4
ASCII octets. This is because ^ then has TeX category 12
('other'). If you really truly want "email-ru.tex" to have the
more exotic behavior, you can, in effect, obtain it by
preliminary processing of the input with Kto8.
*** APPENDIX Email Transfer Checklist ***
ASCII-Cyrillic is a useful format for simplest email
transfers of Cyrillic text files. The universally accepted ASCII
text part of an email message can be used. This feature explains
the name "email-ru.tex".
For informal letters, it may be as good to use a
ligature-based ASCII representation (also generated by
"email-ru.tex"). But, if the typescript is "work in progress" (a
draft of work to be published later on), then a *faithful* system
like ASCII-Cyrillic is infinitely better.
As with any electronic transfer, care is required to avoid
mutilation and misinterpretation. Watch the following points.
(1) Be sure the ASCII-Cyrillic version has no "meaningless"
characters like !__ab. You may have to change your encoding or
revise the 8-bit source to get rid of these without real damage to
your typescript.
(2) Arrange that the file has no long lines (say >70 characters).
Many text editors, word processors, and web browsers allow
adjustment of text file line breaks; check out their text file I/O
features.
(3) Make sure the ASCII-Cyrillic version is indeed faithful.
First delete trailing spaces on all lines (as TeX ignores these).
Then take your 8-bit version, convert doubly 8 ==> 7 ==> 8, and
check that the resulting 8-bit version is restored 100% (using a
file comparison utility).
(4) Arrange that no "tilde" character "~" occurs at the beginning
of any line, for example, by inserting a space before each line.
(5) Be sure the recipient has TeX, and also "email-ru.tex".
Fortunately, the latter is ASCII text that can be sent by email
after precaution (4).
(6) If you know which 8-bit encoding your correspondent will be
using, then do that 7 ==> 8 bit conversion yourself, and verify
that his/her encoding includes all the characters you are using.
If not, in the 8-bit file, there will be some "unencoded" letters
or diacritics appearing in the form '{??} or '[??], for a suitable
tag ??.
(7) If your correspondent uses a mysterious 8-bit encoding, you
can learn what it is by examining his/her 8-bit typescripts. Then
include the mysterious encoding vector at the top of the
ASCII-Cyrillic version as indicated in another APPENDIX. Tell your
correspondent to select the "H" encoding option key in converting
the received email to 8-bit. The *whole* email can be processed;
just the part after the encoding vector will be output, and in the
mysterious 8-bit encoding.
(8) The following test may detect email ASCII text transmission
problems beyond those already mentioned. They were frequent in
early days but are now quite rare.
%%%%%%%%%%%% ASCII Character transmission test
%
% Upper case letters: ABCDEFGHIJKLMNOPQRSTUVWXYZ
% Lower case letters: abcdefghijklmnopqrstuvwxyz
% Digits: 0123456789
% Square, curly, angle braces, parentheses: [] {} <> ()
% Backslash, slash, vertical bar: \ / |
% Punctuation: . ? ! , : ;
% Underscore, hyphen, equals sign: _ - =
% Quotes--right left double: ' ` "
%"at", "number" "dollar", "percent", "and": @ # $ % &
% "hat", "star", "plus", "tilde": ^ * + ~
%
%%%%%%%%%%%%%%%%%%%%%%%%
%
% A single error can be disastrous in TeX files.
%
%%%%%%%%%%%%%%%%%%%%%%%%
|