1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
|
/****************************************************************************
*
* Copyright(c) 2007-2012, John Forkosh Associates, Inc. All rights reserved.
* http://www.forkosh.com mailto: john@forkosh.com
* --------------------------------------------------------------------------
* This file is part of mathTeX, which is free software. You may redistribute
* and/or modify it under the terms of the GNU General Public License,
* version 3 or later, as published by the Free Software Foundation.
* MathTeX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
* See the GNU General Public License for specific details.
* By using mathTeX, you warrant that you have read, understood and
* agreed to these terms and conditions, and that you possess the legal
* right and ability to enter into this agreement and to use mathTeX
* in accordance with it.
* Your mathtex.zip distribution should contain the file COPYING,
* an ascii text copy of the GNU General Public License, version 3.
* If not, point your browser to http://www.gnu.org/licenses/
* or write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* --------------------------------------------------------------------------
*
* Purpose: o MathTeX, licensed under the gpl, lets you easily embed
* LaTeX math in your html pages or blogs, wikis, bb's, etc.
* It submits a LaTeX math expression to latex, and
* immediately emits the corresponding gif image, rather than
* the usual TeX dvi.
* For example,
* <img src="/cgi-bin/mathtex.cgi?\int_{-\infty}^xe^{-t^2}dt"
* alt="" border=0 align=middle>
* immediately generates the corresponding gif image,
* displaying the rendered expression wherever you put
* that <img> tag.
* But there's no inherent need to repeatedly write
* cumbersome <img> tags as illustrated above. You can write
* your own custom tags, or write a wrapper script around
* mathTeX to simplify the notation.
* See http://www.forkosh.com/mathtex.html for more information.
*
* Functions: =============================================================
* main(argc,argv) latex's math expression and emits gif/png
* mathtex(expression,filename) create image of math expression
* setpaths(method) set paths for latex,dvipng,dvips,convert
* isnotfound(filename) check "... 2>.err" file for "not found"
* validate(expression) remove illegal \commands from expression
* advertisement(expression,mode) wrap expression in ad message
* mathlog(expression,filename) write entry in log file
* makepath(oath,name,extension) construct path/name.extension
* isfexists(filename) check whether or not filename exists
* isdexists(dirname) check whether or not directory exists
* whichpath(program,nlocate) determines path to command
* locatepath(program,nlocate) tries locate if whichpath() fails
* presentwd(nsub) determines pwd, nsub dirs up
* rrmdir(path) rm -r path
* rewritecache(cachefile,maxage) write cachefile with imageinfo
* emitcache(cachefile,maxage,isbuffer) dump cachefile to stdout
* readcachefile(cachefile,buffer) read cachefile into buffer
* crc16(s) 16-bit crc of string s
* md5str(instr) md5 hash library functions
* unescape_url(url) xlate all %xx's in url to ascii
* x2c(what) xlate a single hex "xx" to equivalent ascii char
* timelimit(command,killtime) throttle command after killtime
* getdirective(string,directive,iscase,isvalid,nargs,args) \dir
* mathprep(expression) preprocessor for mathTeX input
* strwstr(string,substr,white,sublen) find substr in string
* strreplace(string,from,to,iscase,nreplace) change from to to
* strchange(nfirst,from,to) change nfirst chars of from to to
* isstrstr(string,snippets,iscase) is any snippet in string?
* nomath(s) removes/replaces any LaTeX math chars in s
* strwrap(s,linelen,tablen)insert \n's and spaces to wrap lines
* strpspn(s,reject,segment) non-{[()]} chars of s not in reject
* strqspn(s,q,isunescape) find matching " or ' in quoted string
* isnumeric(s) determine if s is an integer
* evalterm(store,term) evaluate numeric value of expression
* getstore(store,identifier)return value corresponding to ident
* timewaitfor(whundredths)delay execution for hundredths of sec
* timestamp(tzdelta,ifmt) returns current date:time stamp
* tzadjust(tzdelta,year,month,day,hour) adjust time for tzone
* daynumber(year,month,day) #calendar days from Jan 1, 1973
* calendar(year,month,day) formats one-month calendar string
* emitembedded(imagenum,isquery) emit embedded image to stdout
* embeddedimages(imagenum,nbytes,imgtype) embedded gif or png
*
* Source: mathtex.c
*
* --------------------------------------------------------------------------
* Notes o See the comment block above each function
* for more information about it.
* o MathTeX runs only under Unix-like operating systems.
* To compile mathTeX
* cc mathtex.c -DLATEX=\"$(which latex)\" \
* -DDVIPNG=\"$(which dvipng)\" \
* -DDVIPS=\"$(which dvips)\" \
* -DCONVERT=\"$(which convert)\" \
* -o mathtex.cgi
* And see discussion of optional -D switches below.
* To install mathTeX
* (a) mv mathtex.cgi to your cgi-bin/ directory
* and chmod its permissions as necessary
* (b) mkdir cgi-bin/mathtex which is the cache directory
* and chmod its permissions so mathtex.cgi can rw it.
* See http://www.forkosh.com/mathtex.html for more information.
* o The timelimit() code is adapted from
* http://devel.ringlet.net/sysutils/timelimit/
* Compile with -DTIMELIMIT=\"$(which timelimit)\" to use an
* installed copy of that program rather than the built-in code.
* o Some program parameters adjustable by optional -D switches on
* mathTeX's compile line are illustrated with default values...
* -DLATEX=\"/usr/share/texmf/bin/latex\" path to LaTeX program
* -DPDFLATEX=\"/usr/share/texmf/bin/pdflatex\" path to pdflatex
* -DDVIPNG=\"/usr/share/texmf/bin/dvipng\" path to dvipng
* -DDVIPS=\"/usr/share/texmf/bin/dvips\" path to dvips
* -DPS2EPSI=\"/usr/bin/ps2epsi\" path to ps2epsi
* -DCONVERT=\"/usr/bin/convert\" path to convert
* -DCACHE=\"mathtex/\" relative path to mathTeX's cache dir
* -DTIMELIMIT=\"/usr/local/bin/timelimit\" path to timelimit
* -WARNTIME=10 #secs latex can run using standalone timelimit
* -KILLTIME=10 #secs latex can run using built-in timelimit()
* -DGIF emit gif images
* -DPNG emit png images
* -DDISPLAYSTYLE \[ \displaystyle \]
* -DTEXTSTYLE $ \textstyle $
* -DPARSTYLE paragraph mode, supply your own $ $ or \[ \]
* -DFONTSIZE=5 1=\tiny,...,5=\normalsize,...,10=\Huge
* -DUSEPACKAGE=\"filename\" file containing \usepackage's
* -DNEWCOMMAND=\"filename\" file containing \newcommand's
* -DDPI=\"120\" dvipng -D DPI parameter (as \"string\")
* -DGAMMA=\"2.5\" dvipng --gamma GAMMA param (as \"string\")
* -DNOQUIET -halt-on-error (default reply q(uiet) to error)
* -DTEXTAREANAME=\"formdata\" <textarea name=...> in a <form>
* -DREFERER=\"\" comma-separated list of valid referers
* -DMAXINVALID=0 max length expression from invalid referer
* -DADFREQUENCY=0 one request out of n displayed along with ad
* -DADVERTISEMENT=\"filename\" file containing ad template
* See http://www.forkosh.com/mathtex.html for more information.
*
* --------------------------------------------------------------------------
* Revision History:
* See http://www.forkosh.com/mathtexchangelog.html for more information.
* 10/11/07 J.Forkosh Installation Version 1.00.
* 02/17/08 J.Forkosh Version 1.01
* 03/06/09 J.Forkosh Version 1.02
* 08/14/09 J.Forkosh Version 1.03
* 04/06/11 J.Forkosh Version 1.04
* 11/15/11 J.Forkosh Version 1.05
* 10/26/14 J.Forkosh Most recent change (see REVISIONDATE below)
*
****************************************************************************/
/* -------------------------------------------------------------------------
Program ID
-------------------------------------------------------------------------- */
#define VERSION "1.05" /* mathTeX version number */
#define REVISIONDATE "26 Oct 2014" /* date of most recent revision */
#define COPYRIGHTDATE "2007-2014" /* copyright date */
/* -------------------------------------------------------------------------
Standard header files
-------------------------------------------------------------------------- */
/* ---
* standard headers
* ---------------- */
#include <stdio.h>
#include <stdlib.h>
#define _GNU_SOURCE
#include <string.h>
char *strcasestr(); /* non-standard extension */
#include <ctype.h>
#include <time.h>
extern char **environ; /* for \environment directive */
/* -------------------------------------------------------------------------
Information adjustable by -D switches on compile line
-------------------------------------------------------------------------- */
/* ---
* executable paths (e.g., path/latex including filename of executable image)
* ----------------------------------------------------------------------- */
/* --- determine which switches have been explicitly specified --- */
#if defined(LATEX)
#define ISLATEXSWITCH 1 /* have -DLATEX=\"path/latex\" */
#else
#define ISLATEXSWITCH 0 /* no -DLATEX switch */
#define LATEX "/usr/share/texmf/bin/latex" /* default path to latex */
#endif
#if defined(PDFLATEX)
#define ISPDFLATEXSWITCH 1 /* have -PDFDLATEX=\"path/latex\" */
#else
#define ISPDFLATEXSWITCH 0 /* no -PDFDLATEX switch */
#define PDFLATEX "/usr/share/texmf/bin/pdflatex" /* default pdflatex path*/
#endif
#if defined(DVIPNG)
#define ISDVIPNGSWITCH 1 /* have -DDVIPNG=\"path/dvipng\" */
#else
#define ISDVIPNGSWITCH 0 /* no -DDVIPNG switch */
#define DVIPNG "/usr/share/texmf/bin/dvipng"/* default path to dvipng */
#endif
#if defined(DVIPS)
#define ISDVIPSSWITCH 1 /* have -DDVIPS=\"path/dvips\" */
#else
#define ISDVIPSSWITCH 0 /* no -DDVIPS switch */
#define DVIPS "/usr/share/texmf/bin/dvips" /* default path to dvips */
#endif
#if defined(PS2EPSI)
#define ISPS2EPSISWITCH 1 /* have -DPS2EPSI=\"path/ps2epsi\" */
#else
#define ISPS2EPSISWITCH 0 /* no -DPS2EPSI switch */
#define PS2EPSI "/usr/bin/ps2epsi" /* default path to ps2epsi */
#endif
#if defined(CONVERT)
#define ISCONVERTSWITCH 1 /* have -DCONVERT=\"path/convert\" */
#else
#define ISCONVERTSWITCH 0 /* no -DCONVERT switch */
#define CONVERT "/usr/bin/convert" /* default path to convert */
#endif
#if defined(TIMELIMIT)
#define ISTIMELIMITSWITCH 1 /* have -DTIMELIMIT=\"path/timelimit\" */
#else
#define ISTIMELIMITSWITCH 0 /* no -DTIMELIMIT switch */
#define TIMELIMIT "/usr/local/bin/timelimit" /* default path to timelimit*/
#endif
#if !defined(WAIT) /* -DWAIT=\"50\" for half-second */
#define WAIT "\000" /* default to no wait */
#endif
#if !defined(NOWAIT) /* comma-separated list of referer's*/
#define NOWAIT "\000" /* default to everyone waits */
#endif
/* --- paths, as specified by -D switches, else from whichpath() --- */
static char latexpath[256] = LATEX, pdflatexpath[256] = PDFLATEX,
dvipngpath[256] = DVIPNG, dvipspath[256] = DVIPS,
ps2epsipath[256] = PS2EPSI, convertpath[256] = CONVERT,
timelimitpath[256] = TIMELIMIT;
/* --- source of path info: 0=default, 1=switch, 2=which, 3=locate --- */
static int islatexpath=ISLATEXSWITCH, ispdflatexpath=ISPDFLATEXSWITCH,
isdvipngpath=ISDVIPNGSWITCH, isdvipspath=ISDVIPSSWITCH,
isps2epsipath=ISPS2EPSISWITCH, isconvertpath=ISCONVERTSWITCH,
istimelimitpath=ISTIMELIMITSWITCH;
/* ---
* home path pwd of running executable image,
* and http_referer,etc information
* ------------------------------------------- */
static char homepath[256] = "\000"; /* path to executable image */
static char this_referer[256];
/* ---
* cache path -DCACHE=\"path/\" specifies directory
* ------------------------------------------------ */
#if !defined(CACHE)
#define CACHE "mathtex/" /* relative to mathtex.cgi */
#endif
#if !defined(CACHELOG)
#define CACHELOG "mathtex.log" /* default cache log file */
#endif
#define MAXAGE 7200 /* maxage in cache is 7200 secs */
static int iscaching = 1; /* true if caching images */
static char cachepath[256] = CACHE; /* path to cached image files */
/* ---
* working directory for temp files -DWORK=\"path/\"
* ------------------------------------------------- */
#if !defined(WORK)
#define WORK "\000" /* relative to mathtex.cgi */
#endif
static char workpath[256] = WORK; /* path to temp file working dir */
/* ---
* latex method info specifying latex,pdflatex
* ------------------------------------------- */
#if ISLATEXSWITCH==0 && ISPDFLATEXSWITCH==1
#define LATEXMETHOD 2
#elif !defined(LATEXMETHOD)
#define LATEXMETHOD 1
#endif
static int latexmethod = LATEXMETHOD; /* 1=latex, 2=pdflatex */
static int ispicture = 0; /* true for picture environment */
/* ---
* image method info specifying dvipng or dvips/convert
* use dvipng if -DDVIPNG supplied (or -DDVIPNGMETHOD specified),
* else use dvips/convert if -DDVIPS supplied (or -DDVIPSMETHOD specified)
* ----------------------------------------------------------------------- */
#if defined(DVIPNGMETHOD) || ISDVIPNGSWITCH==1
#define IMAGEMETHOD 1
#elif defined(DVIPSMETHOD) || (ISDVIPSSWITCH==1 && ISDVIPNGSWITCH==0)
#define IMAGEMETHOD 2
#elif !defined(IMAGEMETHOD)
#define IMAGEMETHOD 1
#endif
static int imagemethod = IMAGEMETHOD; /* 1=dvipng, 2=dvips/convert */
/* ---
* image type info specifying gif, png
* ----------------------------------- */
#if defined(GIF)
#define IMAGETYPE 1
#endif
#if defined(PNG)
#define IMAGETYPE 2
#endif
#if !defined(IMAGETYPE)
#define IMAGETYPE 1
#endif
static int imagetype = IMAGETYPE; /* 1=gif, 2=png */
static char *extensions[] = { NULL, /* image type file .extensions */
"gif", "png", NULL };
/* ---
* \[ \displaystyle \] or $ \textstyle $ or \parstyle
* ------------------------------------------------------ */
#if defined(DISPLAYSTYLE)
#define MATHMODE 0
#endif
#if defined(TEXTSTYLE)
#define MATHMODE 1
#endif
#if defined(PARSTYLE)
#define MATHMODE 2
#endif
#if !defined(MATHMODE)
#define MATHMODE 0
#endif
static int mathmode = MATHMODE; /* 0=display 1=text 2=paragraph */
/* ---
* font size info 1=\tiny ... 10=\Huge
* ----------------------------------- */
#if !defined(FONTSIZE)
#define FONTSIZE 5
#endif
static int fontsize = FONTSIZE; /* 1=tiny ... 10=Huge */
static char *sizedirectives[] = { NULL, /* fontsize directives */
"\\tiny", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize",
"\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge", NULL };
/* ---
* dpi/density info for dvipng/convert
* ----------------------------------- */
#if !defined(DPI)
#define DPI "120"
#endif
static char density[256] = DPI; /*-D/-density arg for dvipng/convert*/
/* ---
* default -gamma for convert is 0.5, or --gamma for dvipng is 2.5
* --------------------------------------------------------------- */
#define DVIPNGGAMMA "2.5" /* default gamma for dvipng */
#define CONVERTGAMMA "0.5" /* default gamma for convert */
#if !defined(GAMMA)
#define ISGAMMA 0 /* no -DGAMMA=\"gamma\" switch */
#if IMAGEMETHOD == 1 /* for dvipng... */
#define GAMMA DVIPNGGAMMA /* ...default gamma is 2.5 */
#elif IMAGEMETHOD == 2 /* for convert... */
#define GAMMA CONVERTGAMMA /* ...default gamma is 0.5 */
#else /* otherwise... */
#define GAMMA "1.0" /* ...default gamma is 1.0 */
#endif
#else
#define ISGAMMA 1 /* -DGAMMA=\"gamma\" supplied */
#endif
static char gamma[256] = GAMMA; /* -gamma arg for convert() */
/* ---
* latex -halt-on-error or quiet
* ----------------------------- */
#if defined(QUIET)
#define ISQUIET 99999 /* reply q */
#elif defined(NOQUIET)
#define ISQUIET 0 /* reply x (-halt-on-error) */
#elif defined(NQUIET)
#define ISQUIET NQUIET /* reply NQUIET <Enter>'s then x */
#else
#define ISQUIET 3 /* default reply 3 <Enter>'s then x*/
#endif
static int isquiet = ISQUIET; /* >99=quiet, 0=-halt-on-error */
/* ---
* emit depth below baseline (for vertical centering)
* -------------------------------------------------- */
#if defined(DEPTH)
#define ISDEPTH 1
#else
#define ISDEPTH 0
#endif
static int isdepth = ISDEPTH; /* true to emit depth */
/* ---
* timelimit -tWARNTIME -TKILLTIME
* ------------------------------- */
#if !defined(KILLTIME) /* no -DKILLTIME given... */
#define NOKILLTIMESWITCH /* ...remember that fact below */
#if ISTIMELIMITSWITCH == 0 /* standalone timelimit disabled */
#if defined(WARNTIME) /* have WARNTIME but not KILLTIME */
#define KILLTIME (WARNTIME) /* so use WARNTIME for KILLTIME */
#else /* neither WARNTIME nor KILLTIME */
#define KILLTIME (10) /* default for built-in timelimit()*/
/*#define KILLTIME (0)*/ /* disable until debugged */
#endif
#else /* using standalone timelimit */
#define KILLTIME (1) /* always default -T1 killtime */
#endif
#endif
#if !defined(WARNTIME) /*no -DWARNTIME given for timelimit*/
#if ISTIMELIMITSWITCH == 0 /* and no -DTIMELIMIT path either */
#define WARNTIME (-1) /* so standalone timelimit disabled*/
#else /*have path to standalone timelimit*/
#if !defined(NOKILLTIMESWITCH) /* have KILLTIME but not WARNTIME */
#define WARNTIME (KILLTIME) /* so use KILLTIME for WARNTIME */
#undef KILLTIME /* but not for standalone killtime */
#define KILLTIME (1) /* default -T1 killtime instead */
#else /* neither KILLTIME nor WARNTIME */
#define WARNTIME (10) /* so default -t10 warntime */
#endif
#endif
#endif
static int warntime=WARNTIME, killtime=KILLTIME; /* -twarn -Tkill values */
/* ---
* compile (or not) built-in timelimit() code
* ------------------------------------------ */
#if ISTIMELIMITSWITCH==0 && KILLTIME>0 /*no -DTIMELIMIT, but have KILLTIME*/
#define ISCOMPILETIMELIMIT 1 /* so we need built-in code */
#else
#define ISCOMPILETIMELIMIT 0 /* else we don't need built-in code*/
#endif
static int iscompiletimelimit=ISCOMPILETIMELIMIT; /* 1=use timelimit() */
#if ISCOMPILETIMELIMIT /*header files, etc for timelimit()*/
/* --- header files for timelimit() --- */
#include <sys/signal.h>
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#include <sysexits.h>
/*#define EX_OSERR 71*/ /* system error (e.g., can't fork) */
#define HAVE_SIGACTION
/* --- global variables for timelimit() --- */
volatile int fdone, falarm, fsig, sigcaught;
#endif
/* ---
* additional latex \usepackage{}'s
* -------------------------------- */
static int npackages = 0; /* number of additional packages */
static char packages[9][128]; /* additional package names */
static char packargs[9][128]; /* optional arg for package */
/* ---
* <textarea name=TEXTAREANAME ...> in a <form>
* -------------------------------------------- */
#if !defined(TEXTAREANAME)
#define TEXTAREANAME "formdata"
#endif
/* ---
* comma-separated list of HTTP_REFERER's allowed/denied to use mathTeX
* -------------------------------------------------------------------- */
#if !defined(REFERER)
#define REFERER "\000"
#endif
#if !defined(DENYREFERER)
#define DENYREFERER "\000"
#endif
#if !defined(MAXINVALID) /* longest length expression */
#define MAXINVALID 0 /* from an invalid referer */
#endif /* that will be rendered w/o error */
/* ---
* time zone delta t (in hours)
* ---------------------------- */
#if !defined(TZDELTA)
#define TZDELTA 0
#endif
/* ---
* default uses locatepath() if whichpath() fails
* ---------------------------------------------- */
#if !defined(NOWHICH)
#define ISWHICH 1
#else
#define ISWHICH 0
#endif
#if !defined(NOLOCATE)
#define ISLOCATE 1
#else
#define ISLOCATE 0
#endif
/* ---
* one image in every ADFREQUENCY will be wrapped inside "advertisement"
* --------------------------------------------------------------------- */
#if !defined(ADFREQUENCY)
#define ADFREQUENCY 0 /* never show advertisement if 0 */
#endif
static int adfrequency = ADFREQUENCY; /* advertisement frequency */
#if !defined(HOST_SHOWAD)
#define HOST_SHOWAD "\000" /* show ads on all hosts */
#endif
/* ---
* debugging and error reporting
* ----------------------------- */
#if !defined(MSGLEVEL)
#define MSGLEVEL 1
#endif
#if !defined(MAXMSGLEVEL)
#define MAXMSGLEVEL 999999
#endif
static int msglevel = MSGLEVEL; /* message level for verbose/debug */
static FILE *msgfp = NULL; /* output in command-line mode */
char *strwrap(); /* help format debugging messages */
#define showmsg(showlevel,label,data) /* default message format */ \
if ( msgfp!=NULL && msglevel>=(showlevel) ) { \
fprintf(msgfp,(strlen(label)+strlen(data)<64? \
"\nmathTeX> %s: %s\n" : "\nmathTeX> %s:\n %s\n"), \
(label),strwrap((data),64,-9)); fflush(msgfp); } else
static int msgnumber = 0; /* embeddedimages() in query mode */
#define MAXEMBEDDED 15 /* 1...#embedded images available */
#define TESTMESSAGE 1 /* msg# for mathTeX test message */
#define UNKNOWNERROR 2 /* msg# for non-specific error */
#define CACHEFAILED 3 /* msg# if mkdir cache failed */
#define MKDIRFAILED 4 /* msg# if mkdir tempdir failed */
#define CHDIRFAILED 5 /* msg# if chdir tempdir failed */
#define FOPENFAILED 6 /* msg# if fopen(latex.tex) failed */
#define SYLTXFAILED 7 /* msg# if system(latex) failed */
#define LATEXFAILED 8 /* msg# if latex failed */
#define SYPNGFAILED 9 /* msg# if system(dvipng) failed */
#define DVIPNGFAILED 10 /* msg# if dvipng failed */
#define SYPSFAILED 11 /* msg# if system(dvips) failed */
#define DVIPSFAILED 12 /* msg# if dvips failed */
#define SYCVTFAILED 13 /* msg# if system(convert) failed */
#define CONVERTFAILED 14 /* msg# if convert failed */
#define EMITFAILED 15 /* msg# if emitcache() failed */
static char *embeddedtext[] = { NULL, /* text of embedded image messages */
"(1) mathTeX test message:\\" /* msg#1 mathTeX "okay" test */
"cgi program running okay.",
"(2) mathTeX failed: probably due to\\" /* msg#2 general error message */
"bad paths, permissions, or installation.",
"(3) Can't mkdir cgi-bin/mathtex/\\" /* msg#3 can't create cache dir */
"cache directory: check permissions.",
"(4) Can't mkdir cgi-bin/tempnam/\\" /* msg#4 */
"work directory: check permissions.",
"(5) Can't cd cgi-bin/tempnam/\\" /* msg#5 */
"work directory: check permissions.",
"(6) Can't fopen(\"latex.tex\") file:\\" /* msg#6 */
"check permissions.",
"(7) Can't run latex program:\\" /* msg#7 */
"check -DLATEX=\"path\", etc.",
"(8) latex ran but failed:\\" /* msg#8 */
"check your input expression.",
"(9) Can't run dvipng program:\\" /* msg#9 */
"check -DDVIPNG=\"path\", etc.",
"(10) dvipng ran but failed:", /* msg#10 */
"(11) Can't run dvips program:\\" /* msg#11 */
"check -DDVIPS=\"path\", etc.",
"(12) dvips ran but failed:", /* msg#12 */
"(13) Can't run convert program:\\" /* msg#13 */
"check -DCONVERT=\"path\", etc.",
"(14) convert ran but failed:", /* msg#14 */
"(15) Can't emit cached image:\\" /* msg#15 */
"check permissions.",
NULL } ; /* --- end-of-*embeddedtext[] --- */
/* ---
* output file (from shell mode)
* ----------------------------- */
static char outfile[256] = "\000"; /* output file, or empty for default*/
/* ---
* temporary work directory
* ------------------------ */
static char tempdir[256] = "\000"; /* temporary work directory */
/* ---
* internal buffer sizes
* --------------------- */
#if !defined(MAXEXPRSZ)
#define MAXEXPRSZ (32767) /*max #bytes in input tex expression*/
#endif
#if !defined(MAXGIFSZ)
#define MAXGIFSZ (131072) /* max #bytes in output GIF image */
#endif
/* ---
* latex wrapper document template (default, isdepth=0, without depth)
* ------------------------------------------------------------------- */
static char latexdefaultwrapper[MAXEXPRSZ+16384] =
"%%% url: %%referer%%\n" /* http_referer submitting request */
"\\documentclass[10pt]{article}\n" /*[fleqn] omitted*/
"\\usepackage[latin1]{inputenc}\n"
"\\usepackage{amsmath}\n"
"\\usepackage{amsfonts}\n"
"\\usepackage{amssymb}\n"
/*"\\usepackage{bm}\n"*/ /* bold math */
#if defined(USEPACKAGE) /* cc -DUSEPACKAGE=\"filename\" */
#include USEPACKAGE /* filename with \usepackage{}'s */
#endif /* or anything for the preamble */
"%%usepackage%%\n"
#if 0
"\\def\\stackboxes#1{\\vbox{\\def\\\\{\\egroup\\hbox\\bgroup}"
"\\hbox\\bgroup#1\\egroup}}\n"
"\\def\\fparbox#1{\\fbox{\\stackboxes{#1}}}\n"
#endif
"%%%\\pagestyle{empty}\n"
"%%pagestyle%%\n"
"%%previewenviron%%\n"
"\\begin{document}\n"
/*"\\setlength{\\mathindent}{0pt}\n"*/ /* only with [fleqn] option */
"\\setlength{\\parindent}{0pt}\n"
#if 0
"%%%\\renewcommand{\\input}[1]" /* don't let users \input{} */
"{\\mbox{[[$\\backslash$input\\{#1\\} illegal]]}}\n"
#endif
#if defined(NEWCOMMAND) /* cc -DNEWCOMMAND=\"filename\" */
#include NEWCOMMAND /* filename with \newcommand{}'s */
#endif /* or anything for the document */
"\\newcommand{\\amsatop}[2]{{\\genfrac{}{}{0pt}{1}{#1}{#2}}}\n"
"\\newcommand{\\twolines}[2]{{\\amsatop{\\mbox{#1}}{\\mbox{#2}}}}\n"
"\\newcommand{\\fs}{{\\eval{fs}}}\n" /* \eval{} test */
"%%fontsize%%\n"
"%%setlength%%\n"
"%%beginmath%% "
"%%expression%% \n" /* \n in case expression contains %*/
" %%endmath%%\n"
"\\end{document}\n";
/* ---
* latex wrapper document template (optional, isdepth=1, with depth)
* see http://www.mactextoolbox.sourceforge.net/articles/baseline.html
* for discussion of this procedure
* ------------------------------------------------------------------- */
static char latexdepthwrapper[MAXEXPRSZ+16384] =
"%%% url: %%referer%%\n" /* http_referer submitting request */
"\\documentclass[10pt]{article}\n" /*[fleqn] omitted*/
"\\usepackage[latin1]{inputenc}\n"
"\\usepackage{amsmath}\n"
"\\usepackage{amsfonts}\n"
"\\usepackage{amssymb}\n"
"%%%\\usepackage{calc}\n"
#if defined(USEPACKAGE) /* cc -DUSEPACKAGE=\"filename\" */
#include USEPACKAGE /* filename with \usepackage{}'s */
#endif /* or anything for the preamble */
"%%usepackage%%\n"
#if defined(NEWCOMMAND) /* cc -DNEWCOMMAND=\"filename\" */
#include NEWCOMMAND /* filename with \newcommand{}'s */
#endif /* or anything for the document */
"\\newcommand{\\amsatop}[2]{{\\genfrac{}{}{0pt}{1}{#1}{#2}}}\n"
"\\newcommand{\\twolines}[2]{{\\amsatop{\\mbox{#1}}{\\mbox{#2}}}}\n"
"\\newcommand{\\fs}{{\\eval{fs}}}\n" /* \eval{} test */
"%%pagestyle%%\n"
"%%previewenviron%%\n"
"\\newsavebox{\\mybox}\n"
"\n"
"\\newlength{\\mywidth}\n"
"\\newlength{\\myheight}\n"
"\\newlength{\\mydepth}\n"
"\n"
/*"\\setlength{\\mathindent}{0pt}\n"*/ /* only with [fleqn] option */
"\\setlength{\\parindent}{0pt}\n"
"%%fontsize%%\n"
"%%setlength%%\n"
"\n"
"\\begin{lrbox}{\\mybox}\n"
"%%beginmath%% "
"%%expression%% \n" /* \n in case expression contains %*/
" %%endmath%%\n"
"\\end{lrbox}\n"
"\n"
"\\settowidth {\\mywidth} {\\usebox{\\mybox}}\n"
"\\settoheight{\\myheight} {\\usebox{\\mybox}}\n"
"\\settodepth {\\mydepth} {\\usebox{\\mybox}}\n"
"\n"
"\\newwrite\\foo\n"
"\\immediate\\openout\\foo=\\jobname.info\n"
" \\immediate\\write\\foo{depth = \\the\\mydepth}\n"
" \\immediate\\write\\foo{height = \\the\\myheight}\n"
" \\addtolength{\\myheight} {\\mydepth}\n"
" \\immediate\\write\\foo{totalheight = \\the\\myheight}\n"
" \\immediate\\write\\foo{width = \\the\\mywidth}\n"
"\\closeout\\foo\n"
"\n"
"\\begin{document}\n"
"\\usebox{\\mybox}\n"
"\\end{document}\n";
/* ---
* latex wrapper used
* ------------------ */
static char *latexwrapper = /* with or without depth */
( ISDEPTH? latexdepthwrapper : latexdefaultwrapper );
/* ---
* elements from \jobname.info to be prepended to graphics file
* ------------------------------------------------------------ */
#define IMAGEINFO struct imageinfo_struct /*"typedef" for imageinfo struct*/
#define MAXIMAGEINFO 32 /* max 32 image info elements */
IMAGEINFO {
char *identifier; /* identifier in \jobname.info */
char *format; /* format to write in graphics file*/
double value; /* value of identifier */
char units[32]; /* units of value, e.g., "pt" */
int algorithm; /* value conversion before writing */
} ; /* --- end-of-store_struct --- */
static IMAGEINFO imageinfo[MAXIMAGEINFO] = {
{ "depth", "Vertical-Align:%dpx\n", -9999., "", 1 }, /* below baseline */
{ NULL, NULL, -9999., "", -9999 } /* end-of-imageinfo */
} ; /* --- end-of-imageinfo[] --- */
/* -------------------------------------------------------------------------
Unix or Windows header files
-------------------------------------------------------------------------- */
/* ---
* compiling under Windows if -DWINDOWS explicitly supplied or...
* -------------------------------------------------------------- */
#if !defined(WINDOWS) /* -DWINDOWS not explicitly given by user */
#if defined(_WINDOWS) || defined(_WIN32) || defined(WIN32) \
|| defined(DJGPP) /* try to recognize windows compilers */ \
|| defined(_USRDLL) /* must be WINDOWS if compiling for DLL */
#define WINDOWS /* signal windows */
#endif
#endif
/* ---
* unix headers
* ------------ */
#if !defined(WINDOWS) /* if not compiling under Windows... */
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#endif
/* ---
* windows-specific header info
* ---------------------------- */
#if defined(WINDOWS) /* Windows opens stdout in char mode, and */
#include <fcntl.h> /* precedes every 0x0A with spurious 0x0D.*/
#include <io.h> /* So emitcache() issues a Win _setmode() */
/* call to put stdout in binary mode. */
#if defined(_O_BINARY) && !defined(O_BINARY) /* only have _O_BINARY */
#define O_BINARY _O_BINARY /* make O_BINARY available, etc... */
#define setmode _setmode
#define fileno _fileno
#endif
#if defined(_O_BINARY) || defined(O_BINARY) /* setmode() now available */
#define HAVE_SETMODE /* so we'll use setmode() */
#endif
#endif
static int iswindows = /* 1 if running under Windows, or 0 if not */
#ifdef WINDOWS
1; /* 1 when program running under Windows */
#else
0; /* 0 when not running under Windows */
#endif
/* -------------------------------------------------------------------------
application macros
-------------------------------------------------------------------------- */
/* --- check if a string is empty --- */
#define isempty(s) ((s)==NULL?1:(*(s)=='\000'?1:0))
/* --- last char of a string --- */
#define plastchar(s) (isempty(s)?NULL:((s)+(strlen(s)-1)))
#define lastchar(s) (isempty(s)?'\000':*(plastchar(s)))
/* --- check for thischar in accept --- */
#define isthischar(thischar,accept) \
( (thischar)!='\000' && !isempty(accept) \
&& strchr((accept),(thischar))!=(char *)NULL )
/* --- skip/find whitespace --- */
#define WHITESPACE " \t\n\r\f\v" /* skipped whitespace chars */
#define skipwhite(thisstr) if ( (thisstr) != NULL ) \
thisstr += strspn(thisstr,WHITESPACE)
#define findwhite(thisstr) while ( !isempty(thisstr) ) \
if ( isthischar(*(thisstr),WHITESPACE) ) break; else (thisstr)++
/* thisstr += strcspn(thisstr,WHITESPACE) */
/* --- skip \command (i.e., find char past last char of \command) --- */
#define skipcommand(thisstr) while ( !isempty(thisstr) ) \
if ( !isalpha(*(thisstr)) ) break; else (thisstr)++
/* --- strncpy() n bytes and make sure it's null-terminated --- */
#define strninit(target,source,n) if( (target)!=NULL && (n)>=0 ) { \
char *thissource = (source); \
(target)[0] = '\000'; \
if ( (n)>0 && thissource!=NULL ) { \
strncpy((target),thissource,(n)); \
(target)[(n)] = '\000'; } }
/* --- strip leading and trailing whitespace --- */
#define trimwhite(thisstr) if ( (thisstr) != NULL ) { \
int thislen = strlen(thisstr); \
while ( --thislen >= 0 ) \
if ( isthischar((thisstr)[thislen],WHITESPACE) ) \
(thisstr)[thislen] = '\000'; \
else break; \
if ( (thislen = strspn((thisstr),WHITESPACE)) > 0 ) \
{strsqueeze((thisstr),thislen);} } else
/* --- strcpy(s,s+n) using memmove() (also works for negative n) --- */
#define strsqueeze(s,n) if((n)!=0) { if(!isempty((s))) { \
int thislen3=strlen(s); \
if ((n) >= thislen3) *(s) = '\000'; \
else memmove((s),(s)+(n),1+thislen3-(n)); }} else /*user supplies ;*/
/* --- strsqueeze(s,t) with two pointers --- */
#define strsqueezep(s,t) if(!isempty((s))&&!isempty((t))) { \
int sqlen=strlen((s))-strlen((t)); \
if (sqlen>0 && sqlen<=999) {strsqueeze((s),sqlen);} } else
/* --- min and max of args --- */
#define max2(x,y) ((x)>(y)? (x):(y)) /* larger of 2 arguments */
#define min2(x,y) ((x)<(y)? (x):(y)) /* smaller of 2 arguments */
/* -------------------------------------------------------------------------
other application global data
-------------------------------------------------------------------------- */
/* --- getdirective() global data --- */
static int argformat = 0; /* 111... if arg not {}-enclosed */
static int optionalpos = 0; /* # {args} before optional [args] */
static int noptional = 0; /* # optional [args] found */
static char optionalargs[8][512] = /* buffer for optional args */
{ "\000", "\000", "\000", "\000", "\000", "\000", "\000", "\000" };
/* -------------------------------------------------------------------------
store for evalterm() [n.b., these are stripped-down funcs from nutshell]
-------------------------------------------------------------------------- */
#define STORE struct store_struct /* "typedef" for store struct */
#define MAXSTORE 100 /* max 100 identifiers */
STORE {
char *identifier; /* identifier */
int *value; /* address of corresponding value */
} ; /* --- end-of-store_struct --- */
static STORE mathtexstore[MAXSTORE] = {
{ "fontsize", &fontsize }, { "fs", &fontsize }, /* font size */
/*{ "mytestvar", &mytestvar },*/
{ NULL, NULL } /* end-of-store */
} ; /* --- end-of-mimestore[] --- */
/* ==========================================================================
* Function: main ( argc, argv )
* Purpose: driver for mathtex.c
* emits, usually to stdout, a gif or png image
* of a LaTeX math expression entered either as
* (1) html query string from a browser (most typical), or
* (2) a query string from an html <form method="get">
* whose <textarea name=TEXTAREANAME>
* (usually for demo), or
* (3) command-line arguments (usually just to test).
* If no input supplied, expression defaults to "f(x)=x^2",
* treated as test (input method 3).
* --------------------------------------------------------------------------
* Command-Line Arguments:
* When running mathTeX from the command-line, rather than
* from a browser (usually just for testing), syntax is
* ./mathtex [-m msglevel] verbosity of debugging output
* [-c cachepath ] name of cache directory
* [expression expression, e.g., x^2+y^2,
* -m 0-99, controls verbosity level for debugging output
* >=9 retains all directories and files created
* -c cachepath specifies relative path to cache directory
* --------------------------------------------------------------------------
* Exits: 0=success (always exits 0, regardless of success/failure)
* --------------------------------------------------------------------------
* Notes: o For an executable that emits gif images
* cc mathtex.c -o mathtex.cgi
* or, alternatively, for an executable that emits png images
* cc -DPNG mathtex.c -o mathtex.cgi
* See Notes at top of file for other compile-line -D options.
* o Move executable to your cgi-bin directory and either
* point your browser to it directly in the form
* http://www.yourdomain.com/cgi-bin/mathtex.cgi?f(x)=x^2
* or put a tag in your html document of the form
* <img src="/cgi-bin/mathtex.cgi?f(x)=x^2"
* border=0 align=middle>
* where f(x)=x^2 (or any other expression) will be displayed
* either as a gif or png image (as per -DIMAGETYPE flag).
* ======================================================================= */
/* --- entry point --- */
int main ( int argc, char *argv[] )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
/* --- expression to be emitted --- */
static char exprbuffer[MAXEXPRSZ+1] = "\000"; /* input TeX expression */
char hashexpr[MAXEXPRSZ+1] = "\000"; /* usually use md5 of original expr*/
char *expression = exprbuffer; /* ptr to expression */
char *query = getenv("QUERY_STRING"); /* getenv("QUERY_STRING") result */
int isquery = 0; /* true if input from QUERY_STRING */
/* --- preprocess expression for special mathTeX directives, etc --- */
char *mathprep(); /* preprocess expression */
int unescape_url(); /* convert %20 to blank space, etc */
int strreplace(), irep=0; /* look for keywords in expression */
char *strchange(); /* edit expression */
char *getdirective(), argstring[256],/*look for \density,\usepackage,etc*/
*pdirective = NULL; /* ptr to char after \directive */
int validate(); /* remove \input, etc */
int advertisement(), crc16(); /*wrap expression in advertisement*/
int evalterm(); /* preprocess \eval{expression} */
char *adtemplate = NULL; /* usually use default message */
char *host_showad = HOST_SHOWAD; /* show ads only on this host */
char *nomath(); /* remove math chars from string */
/* --- referer initialization variables --- */
char *http_referer = getenv("HTTP_REFERER"), /* referer using mathTeX */
*mathtex_host = getenv("HTTP_HOST"), /* http host for mathTeX */
*server_name = getenv("SERVER_NAME"), /* server hosting mathTeX */
*http_host = (!isempty(mathtex_host)?mathtex_host: /*match host*/
(!isempty(server_name)?server_name:(NULL))); /* or server_name */
int isvalidreferer = 1; /* can this referer use mathTeX? */
int whundredths = 0; /* #hundredths-secs to delay image */
struct { char *deny; /* http_referer can't contain this */
int msgnumber; } /* emit invalid_referer_msg[msg#] */
htaccess[] = { /* ".htaccess" table for deny */
#ifdef HTACCESS /* eg, -DHTACCESS=\"htaccess.txt\" */
#include HTACCESS /* eg, {"",1}, for no referer */
#endif
{ NULL, -999 } }; /* trailer */
/* --- other initialization variables --- */
char *whichpath(); /* look for latex,dvipng,etc */
int setpaths(); /* set paths to latex,dvipng,etc */
int isstrstr(); /* find any snippet in string */
int isdexists(); /* check whether cache dir exists */
int perm_all = (S_IRWXU|S_IRWXG|S_IRWXO); /* 777 permissions */
int readcachefile(), nbytes=0; /*read expr for -f command-line arg*/
char *timestamp(), /*for \time (in addition to \today)*/
*calendar(); /* for \calendar{yyyy,mm,dd} string*/
int emitembedded(); /* in case latex can't run */
int timelimit(); /* just to check stub or built-in */
int timewaitfor(); /* impose a delay on query replies */
int iscolorpackage = 0, /* true if \usepackage{color} found*/
iseepicpackage = 0, /* true if \usepackage{eepic} found*/
ispict2epackage = 0, /* true if \usepackage{pict2e}found*/
ispreviewpackage = 0; /* true if \usepackage{preview} */
/* --- image rendering --- */
int mathtex(); /* generate new image using LaTeX */
/* --- image caching --- */
int rewritecache(); /* rewrite cachefile with imageinfo*/
int emitcache(); /* emit cached image if it exists */
int maxage = MAXAGE; /* max-age is typically two hours */
char *makepath(); /* construct full path/filename.ext*/
char *md5str(), *md5hash=NULL; /* md5 has of expression */
char *presentwd(), *pwdpath=NULL; /* home pwd for relative file paths */
int mathlog(); /* log requests */
/* --- messages --- */
char *copyright1 = /* copyright, gnu/gpl notice */
"+-----------------------------------------------------------------------+\n"
"|mathTeX vers " VERSION ", Copyright(c) " COPYRIGHTDATE
", John Forkosh Associates, Inc|\n"
"+-----------------------------------------------------------------------+\n"
"| mathTeX is free software, licensed to you under terms of the GNU/GPL |\n"
"| and comes with absolutely no warranty whatsoever. |\n",
*copyright2 = /* second part of copyright */
"| See http://www.forkosh.com/mathtex.html for complete details. |\n"
"+-----------------------------------------------------------------------+";
char *usage1 = /* usage instructions */
"Command-line Usage:\n"
" ./mathtex.cgi \"expression\" expression, e.g., \"x^2+y^2\"\n"
" | -f input_file or read expression from input_file\n"
" [ -o output_file ] write image to ouput_file\n"
" [ -m msglevel ] verbosity / message level\n"
" [ -c cache ] path to cache directory\n",
*usage2 = /* second part of usage */
"Example:\n"
" ./mathtex.cgi \"x^2+y^2\" -o equation1\n"
"creates equation1.gif containing image of x^2+y^2\n";
char *versiontemplate = /* mathTeX version "adtemplate" */
"\\begin{center}\n"
"\\fbox{\\footnotesize $\\twolines{mathTeX version " VERSION
",\\ \\ revised " REVISIONDATE "}{Copyright (c) " COPYRIGHTDATE
", John Forkosh Associates, Inc.}$}\\\\ \\vspace*{-.2in}"
"%%beginmath%% %%expression%% %%endmath%%\n"
"\\end{center}\n";
char whichtemplate[512] = /* mathTeX which "adtemplate" */
"\\begin{center}\n"
"\\fbox{\\footnotesize %%whichpath%%}\\\\ \\vspace*{-.2in}"
"%%beginmath%% %%expression%% %%endmath%%\n"
"\\end{center}\n";
int maxinvalidmsg = 2; /* max invalid_referer_msg[] index */
char *invalid_referer_msg[] = { /* invalid referer messages */
/* --- message#0 (default invalid_referer message) --- */
"\\parstyle\\usepackage{color}\\small\\color{red}\\noindent "
"\\fbox{$\\twolines{\\textbf{%%referer%%}}"
"{\\textbf{is not authorized to use mathTeX on this server}}$}",
/* --- message#1 ("provide http_referer" message) --- */
"\\parstyle\\usepackage{color}\\small\\color{red}\\noindent "
"\\fbox{$\\twolines{\\textbf{To use the public math\\TeX{} server,}}"
"{\\textbf{please provide your HTTP\\_REFERER}}$}",
/* --- message#2 ("production use" message) --- */
"\\parstyle\\usepackage{color}\\small\\color{red}\\noindent "
"\\fbox{$\\twolines{\\textbf{For production use,"
" please install mathtex.cgi on}}"
"{\\textbf{your own server. See www.forkosh.com/mathtex.html}}$}",
/* --- end-of-table trailer --- */
NULL } ; /* --- end-of-invalid_referer_msg[] --- */
/* -------------------------------------------------------------------------
Initialization
-------------------------------------------------------------------------- */
/* --- set global variables --- */
msgfp = NULL; /* for query mode output */
msgnumber = 0; /* no errors to report yet */
if ( imagetype < 1 || imagetype > 2 ) imagetype = 1; /* keep in bounds */
if ( imagemethod<1 || imagemethod>2 ) imagemethod = 1; /* keep in bounds */
if ( (pwdpath = presentwd(0)) /* pwd where exectuable resides */
!= NULL ) /* got it */
strcpy(homepath,pwdpath); /* save it for mathtex() later */
strninit(this_referer,((!isempty(http_referer))?http_referer:">>none<<"),255);
strreplace(this_referer,"\n"," ",0,0); /* get rid of newlines */
strreplace(this_referer,"\r"," ",0,0); /* ditto cr's, just in case */
/* ---
* check QUERY_STRING query for expression
* --------------------------------------- */
if ( query != NULL ) /* check query string from environ */
if ( strlen(query) >= 1 ) /* caller gave us a query string */
{ strninit(expression,query,MAXEXPRSZ); /* so use it as expression */
isquery = 1; } /* and set isquery flag */
if ( !isquery ) /* empty query string */
{ char *addr = getenv("SERVER_ADDR"); /* additional getenv("") results */
if ( !isempty(http_host) || addr!=NULL ) /* assume http query */
{ isquery = 1; /* set flag to signal query */
strcpy(expression,"\\fbox{\\rm No expression supplied}"); }
} /* --- end-of-if(!isquery) --- */
/* ---
* process command-line args (only if not a query)
* ----------------------------------------------- */
if ( !isquery /* don't have an html query string */
/*&& argc>1*/ ) { /* and have command-line args */
int argnum = 0; /*argv[] index for command-line args*/
int isendofswitches = 0; /* -- arg signals no more -switches */
msglevel = 3; /*adjust minimum shell message level*/
msgfp = stdout; /* for comamnd-line mode output */
while ( argc > ++argnum ) { /*check for switches and expression*/
if ( *argv[argnum] == '-' /* have some -switch */
&& !isendofswitches ) { /* and haven't seen a -- arg yet*/
char *field = argv[argnum] + 1; /* ptr to char(s) following - */
char flag = tolower((int)(*field)); /* single char following - */
field++; /* bump past flag */
trimwhite(field); /*remove leading/trailing whitespace*/
if ( isempty(field) ) { /* no chars after -flag char, so */
if ( flag == '-' ) /* have -- arg, so */
isendofswitches = 1; /* signal no more -switches */
else /* have a single char flag, so */
field = argv[++argnum]; } /* arg following flag is its value */
switch ( flag ) { /* see what user wants to tell us */
/* --- unrecognized -switch flag --- */
default: /*argnum--;*/ break;
/* --- interpret recognized flags --- */
case 'c': strcpy(cachepath,field);
if ( strlen(cachepath) < 1 /* path is an empty string */
|| strcmp(cachepath,"none") == 0 ) /* or keyword "none" */
iscaching = 0; /* so disable caching */
break;
case 'm': msglevel = atoi(field); break;
case 'f': nbytes = readcachefile(field,(unsigned char *)exprbuffer);
exprbuffer[nbytes] = '\000'; /* null-terminate expression */
if ( !isempty(outfile) ) break; /* default to same outfile */
case 'o': strcpy(outfile,field); /* output file for image */
trimwhite(outfile); /*remove leading/trailing whitespace*/
break;
} /* --- end-of-switch(flag) --- */
} /* --- end-of-if(*argv[argnum]=='-') --- */
else /* expression if arg not a -flag */
strcpy(exprbuffer,argv[argnum]); /* take last unswitched arg */
} /* --- end-of-while(argc>++argnum) --- */
if ( isempty(expression) ) { /*no expression, show usage and quit*/
if ( msgfp!=NULL && msglevel>=3 ) /* user needs usage instructions */
fprintf(msgfp,"%s%s\n%s%s\n",copyright1,copyright2, /*show copyright*/
usage1,usage2); /* and show usage */
goto end_of_job; } /* quit */
} /* --- end-of-if(!isquery) --- */
/* ---
* pre-process expression
* ---------------------- */
if ( !isempty(TEXTAREANAME) ) /* if <form>'s are allowed */
if ( isquery ) /*check for <form> on query strings*/
if(memcmp(expression,TEXTAREANAME,strlen(TEXTAREANAME))==0) { /*have form*/
char *delim = strchr(expression,'='); /* find = following TEXTAREANAME */
if ( delim != (char *)NULL ) /* found unescaped equal sign */
{strsqueeze(expression,((int)(delim-expression)+1));} /*squeeze name=*/
while ( (delim=strchr(expression,'+')) != NULL ) /*unescaped plus sign*/
*delim = ' '; /* is "shorthand" for blank space */
unescape_url(expression); /*convert %20, etc (twice for form)*/
} /* --- end-of-if(memcmp()==0) --- */
unescape_url(expression); /* convert %20 to blank space, etc */
mathprep(expression); /* convert < to <, etc */
validate(expression); /* remove \input, etc */
/* ---
* check if this http_referer is allowed to use mathTeX
* ---------------------------------------------------- */
msgnumber = 0; /* default invalid message number */
/* --- see if user fails to match -DREFERER list of valid domains --- */
if ( isquery ) /* not relevant if in command mode */
if ( !isempty(REFERER) ) /* nor if compiled w/o -DREFERER= */
if ( !isstrstr(http_referer,REFERER,0) ) /* invalid http_referer */
isvalidreferer = 0; /* signal invalid referer */
/* --- see if user matches -DDENYREFERER list of invalid domains --- */
if ( isquery ) /* not relevant if in command mode */
if ( isvalidreferer ) /* or if alteady invalid */
if ( !isempty(DENYREFERER) ) /*nor if compiled w/o -DDENYREFERER*/
if ( isstrstr(http_referer,DENYREFERER,0) ) /* invalid http_referer */
isvalidreferer = 0; /* signal invalid referer */
/* --- see if user matches -DHTACCESS list of invalid domains --- */
if ( isquery ) /* not relevant if in command mode */
if ( isvalidreferer ) { /* or if alteady invalid */
int iaccess=0; /* htaccess[] index */
msgnumber = (-999); /* 0 or positive if match found */
for ( iaccess=0; msgnumber<0; iaccess++ ) { /*run thru htaccess[] table*/
char *deny = htaccess[iaccess].deny; /* referer to be denied */
if ( deny == NULL ) break; /* null signals end-of-table */
if ( isempty(deny) ) /* signal for http://>>none<< */
{ if ( isempty(http_referer) ) /* http_referer not supplied */
msgnumber = htaccess[iaccess].msgnumber; } /* so set message# */
else /* have referer to check for */
if ( !isempty(http_referer) ) /* and have referer to be checked */
if ( isstrstr(http_referer,deny,0) ) /* invalid http_referer */
msgnumber = htaccess[iaccess].msgnumber; /* so set message# */
} /* --- end-of-for(iaccess) --- */
if ( msgnumber >= 0 ) /* deny access to this referer */
isvalidreferer = 0; } /* signal invalid referer */
/* --- render short expressions even for invalid referers --- */
if ( !isvalidreferer ) /* have an invalid referer */
if ( MAXINVALID > 0 ) /* but short expressions allowed */
if ( strlen(expression) <= MAXINVALID ) /* and this one is short enough */
isvalidreferer = 1; /* so let it through */
/* --- check for invalidreferer directive (user wants to see message) --- */
if ( getdirective(expression,"\\invalidreferer",1,0,1,argstring)
!= NULL ) { /* found \invalidreferer directive */
isvalidreferer = 0; /* signal invalid referer */
msgnumber = atoi(argstring); } /* requested message number */
/* --- wait or substitute invalid referer message if referer is invalid --- */
whundredths = 0; /* no wait specified yet */
if ( !isvalidreferer ) { /* invalid referer detected */
if ( msgnumber > 100 ) { /* wait msgnumber-100 tenths sec */
whundredths = 10*(msgnumber-100); /* hundredths = 10*tenths */
isvalidreferer = 1; } /* reset valid referer, but wait */
else { /* or don't process request at all */
if ( msgnumber<0 || msgnumber>maxinvalidmsg ) /* check message range */
msgnumber = 0; /* default if out-of-bounds */
strcpy(expression,invalid_referer_msg[msgnumber]); /* choose message */
strreplace(expression,"%%referer%%", /* replace actual referer */
(isempty(http_referer)?"your domain":nomath(http_referer)),0,0); } }
msgnumber = 0; /* reset global message number */
/* ---
* query delay
* -------------- */
if ( isquery ) /* have a query */
if ( !isempty(WAIT) || whundredths>0 ) { /* wait imposed on queries */
if ( whundredths < 1 ) whundredths = atoi(WAIT); /*#hundredths of a sec*/
if ( !isempty(NOWAIT) ) /* have -DNOWAIT=\",,,\" referers */
if ( isstrstr(http_referer,NOWAIT,0) ) /* no wait for this refererer */
whundredths = 0; /* so reset wait time */
if ( whundredths > 0 ) /* if we have a wait */
timewaitfor(whundredths); /* return after waiting */
} /* --- end-of-if(!isempty(WAIT)) --- */
/* ---
* check for embedded image \message directive (which supercedes everything)
* ----------------------------------------------------------------------- */
if ( getdirective(expression,"\\message",1,0,1,argstring)
!= NULL ) { /* found \message directive */
if ( msgfp!=NULL && msglevel>=1 ) /* copyright notice */
fprintf(msgfp,"%s%s\n",copyright1,copyright2); /* always show copyright*/
msgnumber = atoi(argstring); /* requested message number */
emitembedded(msgnumber,(isquery?2:0)); /* emit image, suppress msgfp */
goto end_of_job; } /*nothing to do after emitting image*/
/* ---
* check for \switches directive (which supercedes everything else)
* ---------------------------------------------------------------- */
if ( strreplace(expression,"\\switches","",0,0) /* remove \switches */
>= 1 ) { /* found \switches */
char *pathsource[] = { "default", "switch", "which", "locate" };
/*iscaching = 0;*/ /* don't cache \switches image */
*expression = '\000'; /* reset expression */
/*setpaths(imagemethod);*/ /* set paths */
setpaths(0); /* show _all_ set paths */
strcat(expression,"\\parstyle"); /* set paragraph mode */
strcat(expression,"\\small\\tt"); /* set font,size */
strcat(expression,"\\fparbox{"); /* emit -Dswitches in framed box */
strcat(expression,"Program image...\\\\\n"); /* image */
sprintf(expression+strlen(expression),"%s\\\\",argv[0]);
strcat(expression,"Paths...\\\\\n"); /* paths */
sprintf(expression+strlen(expression), /* latex path */
"-DLATEX=$\\backslash$\"%s$\\backslash$\" \\ (%s)\\\\ \n",
latexpath,pathsource[islatexpath]);
sprintf(expression+strlen(expression), /* pdflatex path */
"-DPDFLATEX=$\\backslash$\"%s$\\backslash$\" \\ (%s)\\\\ \n",
pdflatexpath,pathsource[ispdflatexpath]);
sprintf(expression+strlen(expression), /* dvipng path */
"-DDVIPNG=$\\backslash$\"%s$\\backslash$\" \\ (%s)\\\\ \n",
dvipngpath,pathsource[isdvipngpath]);
sprintf(expression+strlen(expression), /* dvips path */
"-DDVIPS=$\\backslash$\"%s$\\backslash$\" \\ (%s)\\\\ \n",
dvipspath,pathsource[isdvipspath]);
sprintf(expression+strlen(expression), /* ps2epsi path */
"-DPS2EPSI=$\\backslash$\"%s$\\backslash$\" \\ (%s)\\\\ \n",
ps2epsipath,pathsource[isps2epsipath]);
sprintf(expression+strlen(expression), /* convert path */
"-DCONVERT=$\\backslash$\"%s$\\backslash$\" \\ (%s)\\\\ \n",
convertpath,pathsource[isconvertpath]);
strcat(expression,"}"); /* end-of-\fparbox{} */
} /* --- end-of-if(strreplace("\\switches")>=1) --- */
else /* no \switches in expression */
/* ---
* check for \environment directive (which supercedes everything else)
* ------------------------------------------------------------------- */
if ( strreplace(expression,"\\environment","",0,0) /* remove \environment */
>= 1 ) { /* found \environment */
int ienv = 0; /* environ[] index */
/*iscaching = 0;*/ /* don't cache \environment image */
*expression = '\000'; /* reset expression */
setpaths(10*latexmethod+imagemethod); /* set paths */
strcat(expression,"\\parstyle"); /* set paragraph mode */
strcat(expression,"\\scriptsize\\tt"); /* set font,size */
strcat(expression,"\\noindent"); /* don't indent first line */
strcat(expression,"\\begin{verbatim}"); /* begin verbatim environment */
for ( ienv=0; ; ienv++ ) { /* loop over environ[] strings */
if ( environ[ienv] == (char *)NULL ) break; /* null terminates list */
if ( *(environ[ienv]) == '\000' ) break; /* double-check empty string */
sprintf(expression+strlen(expression), /* display environment string */
" %2d. %s \n", ienv+1,strwrap(environ[ienv],50,-6));
/* "%2d.\\ \\ %s\\ \\\\ \n", ienv+1,nomath(environ[ienv])); */
} /* --- end-of-for(ienv) --- */
strcat(expression,"\\end{verbatim}"); /* end verbatim environment */
} /* --- end-of-if(strreplace("\\environment")>=1) --- */
/* ---
* save copy of expression before further preprocessing for MD5 hash
* ------------------------------------------------------------------ */
strcpy(hashexpr,expression); /* save unmodified expr for hash */
/* ---
* check for \which directive (supercedes everything not above)
* ------------------------------------------------------------ */
if ( getdirective(expression,"\\which",1,0,1,argstring)
!= NULL ) { /* found \which directive */
int ispermitted = 1; /* true if a legitimate request */
int nlocate = 1; /* use locate if which fails */
char *path = NULL; /* whichpath() to argstring program*/
char whichmsg[512]; /* displayed message */
trimwhite(argstring); /*remove leading/trailing whitespace*/
if ( isempty(argstring) ) ispermitted = 0; /* arg is an empty string */
else { /* have non-empty argstring */
int arglen = strlen(argstring); /* #chars in argstring */
if ( strcspn(argstring,WHITESPACE) < arglen /* embedded whitespace */
|| strcspn(argstring,"{}[]()<>") < arglen /* illegal char */
|| strcspn(argstring,"|/\"\'\\") < arglen /* illegal char */
|| strcspn(argstring,"`!@%&*+=^")< arglen /* illegal char */
) ispermitted = 0; /*probably not a legitimate request*/
} /* --- end-of-if/else(isempty(argstring)) --- */
if ( ispermitted ) { /* legitimate request */
path = whichpath(argstring,&nlocate); /* path to argstring program */
sprintf(whichmsg, /* display path or "not found" */
"%s(%s) = %s", (path==NULL||nlocate<1?"which":"locate"),
argstring,(path!=NULL?path:"not found")); }
else /* display "not permitted" message */
sprintf(whichmsg,"which(%s) = not permitted", argstring);
strreplace(whichtemplate,"%%whichpath%%",whichmsg,0,0); /*insert message*/
adtemplate = whichtemplate; /* set which message */
adfrequency = 1; /* force its display */
/*iscaching = 0;*/ /* don't cache it */
if ( path != NULL ) /* change \ to $\backslash$ */
/*strreplace(path,"\\","$\\backslash$",0,0)*/; /* make \ displayable */
/*strcpy(expression,"\\parstyle\\small\\tt ");*/ /* re-init expression */
/*strcat(expression,"\\fparbox{");*/ /* emit path in framed box */
/*sprintf(expression+strlen(expression),*/ /* display path or "not found" */
/*"which(%s) = %s",argstring,(path!=NULL?path:"not found"));*/
/*strcat(expression,"}");*/ /* end-of-\fparbox{} */
} /* --- end-of-if(getdirective("\\which")!=NULL) --- */
/* ---
* check for picture environment, i.e., \begin{picture}, but don't remove it
* ----------------------------------------------------------------------- */
if ( strstr(expression,"picture") != NULL ) /* picture environment used */
ispicture = 1; /* signal picture environment */
if ( strreplace(expression,"\\nopicture","",0,0) /* remove \nopicture */
>= 1 ) ispicture = 0; /* user wants to handle picture */
if ( ispicture ) { /* set picture environment defaults*/
imagemethod = 2; /* must use convert, not dvipng */
mathmode = 2; /* must be in paragraph mode */
isdepth = 0; /* reset default in case it's true */
if ( !ISGAMMA ) strcpy(gamma,CONVERTGAMMA); /* default convert gamma */
} /* --- end-of-if(ispicture) --- */
/* ---
* check for embedded directives, remove them and set corresponding values
* ----------------------------------------------------------------------- */
/* --- first (re)set default modes required for certain environments --- */
if ( strstr(expression,"gather") != NULL ) /* gather environment used */
mathmode = 2; /* need paragraph style for gather */
if ( strstr(expression,"eqnarray") != NULL ) /* eqnarray environment used */
mathmode = 2; /*need paragraph style for eqnarray*/
/* --- check for explicit displaystyle/textstyle/parstyle directives --- */
if ( strreplace(expression,"\\displaystyle","",0,0) /*remove \displaystyle*/
>= 1 ) mathmode = 0; /* found \displaystyle so set flag*/
if ( strreplace(expression,"\\textstyle","",0,0) /* remove \textstyle */
>= 1 ) mathmode = 1; /* found \textstyle so reset flag */
if ( strreplace(expression,"\\parstyle","",0,0) /* remove \parstyle */
>= 1 ) mathmode = 2; /* found \parstyle so reset flag */
if ( strreplace(expression,"\\parmode","",0,0) /*\parmode same as \parstyle*/
>= 1 ) mathmode = 2; /* found \parmode so reset flag */
/* --- check for quiet/halt directives (\quiet or \halt) --- */
if ( strreplace(expression,"\\quiet","",0,0) /*remove occurrences of \quiet*/
>= 1 ) isquiet = 64; /* found \quiet so set isquiet flag*/
if ( strreplace(expression,"\\noquiet","",0,0) /* remove \noquiet */
>= 1 ) isquiet = 0; /* found \noquiet so reset flag */
if ( getdirective(expression,"\\nquiet",1,0,1,argstring) /*\nquiet{#Enters}*/
!= NULL ) { /* found \nquiet{#<Enter>'s} */
isquiet = atoi(argstring); } /* interpret arg as isquiet value */
/* --- check for program paths --- */
if ( getdirective(expression,"\\convertpath",1,0,1,argstring) /*convert path*/
!= NULL ) { /* \convertpath{/path/to/convert} */
strcpy(convertpath,argstring); /*interpret arg as /path/to/convert*/
if ( strstr(convertpath,"convert") == NULL ) { /* just path without name */
if ( lastchar(convertpath) != '/' ) /* not even a / at end of path */
strcat(convertpath,"/"); /* so add a / */
strcat(convertpath,"convert"); } /* add name of convert program */
isconvertpath = 1; } /* treat like -DCONVERT switch */
/* --- check for fontsize directives (\tiny ... \Huge) --- */
if ( 1 || mathmode != 2 ) /*latex sets font size in \parstyle*/
for (irep=1; !isempty(sizedirectives[irep]); irep++) /*1=\tiny...10=\Huge*/
if ( strstr(expression,sizedirectives[irep]) != NULL ) { /*found \size*/
if ( mathmode != 2 ) /* not in paragraph mode */
strreplace(expression,sizedirectives[irep],"",1,0); /*remove \size*/
fontsize = irep; } /* found \size so set fontsize */
/* --- check for \depth or \nodepth directive --- */
if ( strreplace(expression,"\\depth","",0,0) /* \depth requested */
>= 1 ) { /* found \depth */
if ( 1 ) { /* guard */
/* ---
* note: curl_init() stops at the first whitespace char in $url argument,
* so php functions using \depth replace blanks with tildes
* ---------------------------------------------------------------------- */
/*int ntilde = 0;*/ /* # ~ chars replaced */
/*ntilde =*/ strreplace(expression,"~"," ",0,0); }
isdepth = 1; /* so reset flag */
latexwrapper = latexdepthwrapper; } /* and wrapper */
if ( strreplace(expression,"\\nodepth","",0,0) /* \nodepth requested */
>= 1 ) { /* found \nodepth */
isdepth = 0; /* so reset flag */
latexwrapper = latexdefaultwrapper; } /* and wrapper */
/* --- replace \time directive with timestamp (similar to \today) --- */
if ( strstr(expression,"\\time") != NULL ) { /* user wants a timestamp */
strreplace(expression,"\\time",timestamp(TZDELTA,3),0,0); /* insert time */
maxage = 5; /* re-render after 5 secs */
iscaching = 0; } /* don't cache \time */
if ( strstr(expression,"\\today") != NULL ) { /* user has a datestamp */
iscaching = 0; } /* don't cache \today either */
/* --- replace \thisyear directive with 2012 --- */
if ( strstr(expression,"\\thisyear") != NULL ) /* user wants current year */
strreplace(expression,"\\thisyear",timestamp(TZDELTA,5),0,0);/*insert year*/
/* --- replace \calendar directive with calendar string --- */
while ( strstr(expression,"\\calendar") != NULL ) { /* user wants calendar */
int yy=0, mm=0, dd=0; /* current or user-specified cal */
mathmode = 2; /* typeset in paragraph mode */
strreplace(expression,"\\calendar",calendar(yy,mm,dd),0,1);
maxage = 5; /* re-render after 5 secs */
iscaching = 0; /* don't cache \calendar */
} /* --- end-of-while("\\calendar") --- */
/* --- check for explicit usepackage directives in expression --- */
while ( npackages < 9 ) /* no more than 9 extra packages */
if ( getdirective(expression,"\\usepackage",1,0,-1,packages[npackages])
== NULL ) break; /* no more \usepackage directives */
else { /* found another \usepackage */
/* --- check for optional \usepackage [args] --- */
*(packargs[npackages]) = '\000'; /* init for no optional args */
if ( noptional > 0 ) { /* but we found an optional arg */
strninit(packargs[npackages],optionalargs[0],127); } /*copy the first*/
/* --- check for particular packages --- */
if ( strstr(packages[npackages],"color") != NULL ) /*\usepackage{color}*/
iscolorpackage = 1; /* set color package flag */
if ( strstr(packages[npackages],"eepic") != NULL ) /*\usepackage{eepic}*/
iseepicpackage = 1; /* set eepic package flag */
if ( strstr(packages[npackages],"pict2e") != NULL ) /* {pict2e} */
ispict2epackage = 1; /* set pict2e package flag */
if ( strstr(packages[npackages],"preview") != NULL ) /* {preview} */
ispreviewpackage = 1; /* set preview package flag */
npackages++; } /* bump package count */
/* --- check for advertisement host and directive (\advertisement) --- */
if ( !isempty(host_showad) ) /*ad messages only for this referer*/
if ( !isempty(http_host) ) /* have HTTP_HOST or SERVER_NAME */
if ( strstr(http_host,host_showad) /* see if this host sees ad */
== NULL ) /* not mathtex host for ad message */
adfrequency = 0; /* turn off advertisements */
if ( strreplace(expression,"\\advertisement","",0,0) /*remove \advertisement*/
>= 1 ) adfrequency = 1; /* force advertisement display */
/* --- check for version directive (\version) --- */
if ( strreplace(expression,"\\version","",0,0) /* remove \version */
>= 1 ) { adtemplate = versiontemplate; /* set version message */
adfrequency = 1; } /* and force its display */
/* --- check for image type directives (\gif or \png) --- */
if ( strreplace(expression,"\\png","",0,0) /* remove occurrences of \png */
>= 1 ) imagetype = 2; /* found -png so set png imagetype */
if ( strreplace(expression,"\\gif","",0,0) /* remove occurrences of \gif */
>= 1 ) imagetype = 1; /* found -gif so set gif imagetype */
/* --- check for latex method directives (\latex or \pdflatex) --- */
if ( strreplace(expression,"\\latex","",1,0) /*remove occurrences of \latex*/
>= 1 ) latexmethod = 1; /* found \latex so set latex method */
if ( strreplace(expression,"\\pdflatex","",0,0) /* remove \pdflatex */
>= 1 ) latexmethod = 2; /* found \pdflatex so set pdflatex */
/* --- check for image method directives (\dvips or \dvipng) --- */
if ( strreplace(expression,"\\dvipng","",0,0) /*remove occurrences of \dvipng*/
>= 1 ) { /* found -dvipng in expression */
imagemethod = 1; /* set dvipng imagemethod */
if ( !ISGAMMA ) strcpy(gamma,DVIPNGGAMMA); } /* default dvipng gamma */
if ( strreplace(expression,"\\dvips","",0,0) /* remove occurrences of -dvips*/
>= 1 ) { /* found -dvips in expression */
imagemethod = 2; /* set dvips/convert imagemethod */
if ( !ISGAMMA ) strcpy(gamma,CONVERTGAMMA); } /* default convert gamma */
/* --- check for convert/dvipng command's -density/-D parameter --- */
if ( getdirective(expression,"\\density",1,1,1,density) /*look for \density*/
== NULL ) /* no \density directive */
getdirective(expression,"\\dpi",1,1,1,density); /* so try \dpi instead */
/* --- check for convert command's \gammacorrection parameter --- */
getdirective(expression,"\\gammacorrection",1,1,1,gamma); /*look for \gamma*/
/* --- check for \cache or \nocache directive --- */
if ( strreplace(expression,"\\cache","",0,0) /* remove \cache */
>= 1 ) iscaching = 1; /* cache this image */
if ( strreplace(expression,"\\nocache","",0,0) /* remove \nocache */
>= 1 ) iscaching = 0; /* don't cache this image */
/* ---check for \eval{}'s in (1)submitted expressions, (2)\newcommand's--- */
for ( irep=1; irep<=2; irep++ ) { /* 1=expression, 2=latexwrapper */
char *thisrep = (irep==1?expression:latexwrapper); /* choose 1 or 2 */
while ( (pdirective=getdirective(thisrep,"\\eval",1,0,1,argstring))
!= NULL ) { /* found \eval{} directive */
int ival = (isempty(argstring)?0:evalterm(mathtexstore,argstring));
char aval[256]; /* buffer to convert ival to alpha */
sprintf(aval,"%d",ival); /* convert ival to alpha */
strchange(0,pdirective,aval); } /* replace \eval{} with result */
} /* --- end-of-for(irep) --- */
/* --- see if we need any packages not already \usepackage'd by user --- */
if ( npackages < 9 /* have room for one more package */
&& !iscolorpackage ) /* \usepackage{color} not specified*/
if ( strstr(expression,"\\color") != NULL ) { /* but \color is used */
strcpy(packages[npackages],"color"); /* so \usepackage{color} is needed*/
*(packargs[npackages]) = '\000'; /* no optional args */
npackages++; } /* bump package count */
if ( npackages < 9 /* have room for one more package */
&& ispicture ) { /* and using picture environment */
if ( latexmethod == 1 ) /* using latex with eepic */
if ( !iseepicpackage ) { /* \usepackage{eepic} not specified*/
strcpy(packages[npackages],"eepic"); /* \usepackage{eepic} needed */
*(packargs[npackages]) = '\000'; /* no optional args */
npackages++; } /* bump package count */
if ( latexmethod == 2 /* using pdflatex with pict2e */
&& npackages < 8 ) { /* have room for two more packages */
if ( !ispict2epackage ) { /*\usepackage{pict2e} not specified*/
strcpy(packages[npackages],"pict2e"); /* \usepackage{pict2e} needed */
*(packargs[npackages]) = '\000'; /* no optional args */
npackages++; } /* bump package count */
if ( !ispreviewpackage ) { /*\usepackage{preview} not specified*/
strcpy(packages[npackages],"preview"); /*\usepackage{preview} needed*/
strcpy(packargs[npackages],"active,tightpage"); /* set optional args */
npackages++; } /* bump package count */
} /* --- end-of-if(latexmethod==2) --- */
} /* --- end-of-if(ispicture) --- */
/* ---
* check for empty expression
* -------------------------- */
trimwhite(expression); /*remove leading/trailing whitespace*/
if ( isempty(expression) ) /* no expression supplied */
if ( adfrequency != 1 ) /* and not a forced message */
strcpy(expression,"\\fbox{\\rm No expression supplied}"); /* error msg */
/* ---
* check for "advertisement"
* ------------------------- */
if ( adfrequency > 0 ) { /* advertising enabled */
int npump = crc16(expression)%16; /* #times, 0-15, to pump rand() */
srand(atoi(timestamp(TZDELTA,4))); /* init rand() with mmddhhmmss */
while ( npump-- >= 0 ) rand(); /* pre-pump rand() before use */
if ( rand()%adfrequency == 0 ) { /* once every adfrequency calls */
advertisement(expression,adtemplate); /*wrap expression in advertisement*/
if ( strcasestr(hashexpr,"\\advertisement") == NULL ) /* random ad */
strchange(0,hashexpr,"\\advertisement "); } } /* signal ad in expr */
/* ---
* hash the expression for name of cached image file
* ------------------------------------------------- */
md5hash = md5str(hashexpr); /* md5 hash of original expression */
/* ---
* check for \msglevel{msglevel} for debugging
* ------------------------------------------- */
if ( getdirective(expression,"\\msglevel",1,0,1,argstring)/*look for \msglvl*/
!= NULL ) /* found \msglevel directive */
if ( (msglevel = min2(atoi(argstring),MAXMSGLEVEL)) /*assign new msglevel*/
> 0 ) /* user wants messages */
if ( isquery ) /* can't write messages to stdout */
msgfp = fopen(makepath(NULL,md5hash,".out"),"w"); /* file md5hash.out */
/* ---
* emit initial messages
* --------------------- */
if ( msgfp!=NULL && msglevel>=1 ) { /*copyright notice and path to image*/
fprintf(msgfp,"%s%s\n",copyright1,copyright2); /* always show copyright */
showmsg(3,"running image",argv[0]); /* and executable image if verbose */
showmsg(4,"home directory",homepath); /* and pwd of executable image */
showmsg(2,"input expression",hashexpr); /* and input expression */
if ( msglevel >= 8 ) { /* and if very verbose */
fprintf(msgfp, /* timelimit info */
"\nmathTeX> %s timelimit: warn/killtime=%d/%d, path=%s\n",
(timelimit("",-99)==992?"Built-in":"Stub"), warntime, killtime,
(istimelimitpath?timelimitpath:"none"));
fflush(msgfp); } /* flush message buffer */
} /* --- end-of-if(msgfp!=NULL&&msglevel>=1) --- */
/* -------------------------------------------------------------------------
Emit cached image or render the expression
-------------------------------------------------------------------------- */
if ( md5hash != NULL ) { /* md5str() almost surely succeeded*/
/* ---
* check for cache directory, and create it if it doesn't already exist
* -------------------------------------------------------------------- */
if ( isempty(outfile) ) /* no explicit output file given */
if ( !isdexists(makepath(NULL,NULL,NULL)) ) /* and no cache directory */
if ( mkdir(makepath(NULL,NULL,NULL),perm_all) /* so make cache dir */
!= 0 ) { /* failed, emit embedded error image*/
emitembedded(CACHEFAILED,isquery); /* emit CACHEFAILED message */
goto end_of_job; } /* quit if failed to mkdir cache */
/* ---
* emit cached image if it already exists
* -------------------------------------- */
if ( isquery ) /* re-render if running from shell */
if ( iscaching ) /* or if not caching image */
if(emitcache(makepath(NULL,md5hash,extensions[imagetype]),maxage,0) > 0)
goto end_of_job; /* done if cached image emitted */
/* ---
* first log caching request for new image
* --------------------------------------- */
if ( msglevel >= 1 ) /* check if logging */
if ( iscaching ) /* only log images being cached */
if ( isempty(outfile) ) /* and not saved to explicit outfile*/
mathlog(hashexpr,md5hash); /* log request for new image */
/* ---
* now generate the new image and emit it
* -------------------------------------- */
/* --- set up name for temporary work directory --- */
/*strninit(tempdir,tmpnam(NULL),255);*/ /* maximum name length is 255 */
strninit(tempdir,md5hash,255); /* maximum name length is 255 */
/* --- additional message --- */
showmsg(9,"working directory",tempdir); /* working directory */
/* --- mathtex() generates the image and saves it to file --- */
if ( mathtex(expression,md5hash) /* generate new image */
== imagetype ) { /* and emit cache if succeeded */
nbytes = 999; /* signal rewritecache() success */
/* --- rewrite dvipng or convert cachefile with extra imageinfo --- */
if ( isdepth ) nbytes = /* we have extra imageinfo */
rewritecache(makepath(NULL,md5hash,extensions[imagetype]),maxage);
/* --- emit the newly-generated image --- */
if ( nbytes > 0 ) /* mathtex() and rewritecache() ok */
if ( isquery ) /* don't emit cache to shell stdout*/
emitcache(makepath(NULL,md5hash,extensions[imagetype]),maxage,0); }
else { /* latex failed to run */
/* --- failed, so emit the embedded image of an error message --- */
isdepth = 0; /* no imageinfo in embedded images */
if ( msgnumber < 1 ) msgnumber = 2; /* general failure message */
emitembedded(msgnumber,isquery); } /* emit message image */
/* ---
* remove images not being cached
* ------------------------------ */
if ( !iscaching ) /* don't want this image cached */
if ( isempty(outfile) ) /* unless explicit outfile provided*/
remove(makepath(NULL,md5hash,extensions[imagetype])); /* remove file */
} /* --- end-of-if(md5hash!=NULL) --- */
end_of_job:
if ( msgfp!=NULL && msgfp!=stdout ) /* have an open message file */
fclose(msgfp); /* so close it at eoj */
exit ( 0 );
} /* --- end-of-function main() --- */
/* ==========================================================================
* Function: mathtex ( expression, filename )
* Purpose: create image of latex math expression
* --------------------------------------------------------------------------
* Arguments: expression (I) pointer to null-terminated char string
* containing latex math expression
* filename (I) pointer to null-terminated char string
* containing filename but not .extension
* of output file (should be the md5 hash
* of expression)
* --------------------------------------------------------------------------
* Returns: ( int ) imagetype if successful, 0=error
* --------------------------------------------------------------------------
* Notes: o created file will be filename.gif if imagetype=1
* or filename.png if imagetype=2.
* ======================================================================= */
/* --- entry point --- */
int mathtex ( char *expression, char *filename )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
char errormsg[1024] = /* latex runs but can't make .dvi */
"\\fbox{\\footnotesize $\\mbox{Latex failed, probably due to} "
"\\atop \\mbox{an error in your expression.}$}";
char usepackage[1024] = "\000"; /* additional \usepackage{}'s */
char convertargs[1024] = /* args/switches for convert */
" -density %%dpi%% -gamma %%gamma%%"
/*" -border 0% -fuzz 2%"*/
" -trim -transparent \"#FFFFFF\" ";
char dvipngargs[1024] = /* args/switches for dvipng */
" --%%imagetype%% -D %%dpi%% --gamma %%gamma%%"
" -bg Transparent -T tight -v" /* -q for quiet, -v for verbose */
" -o %%giffile%% "; /* output filename supplied as -o */
/* --- other variables --- */
static int iserror = 0; /* true if procesing error message */
int setpaths(); /* set paths for latex,dvipng,etc */
char *makepath(), latexfile[256],giffile[256]="\000";/*path/filename.ext*/
FILE *latexfp = NULL; /*latex wrapper file for expression*/
char command[2048], subcommand[1024]; /*system(command) runs latex, etc*/
char *beginmath[] = /* start math mode */
{ " \\noindent $\\displaystyle ", " \\noindent $ ", " " },
*endmath[] = /* end math mode */
{ " $ ", " $ ", " " };
int perm_all = (S_IRWXU|S_IRWXG|S_IRWXO); /* 777 permissions */
int dir_stat = 0; /* 1=mkdir okay, 2=chdir okay */
int sys_stat = 0; /* system() return status */
int isdexists(), isfexists(), /* check if dir, .dvi file created */
isnotfound(); /* check .err file for "not found" */
char *presentwd(), *pwdpath=NULL; /* pwd for file paths */
int isworkpath = 0; /* true if cd'ed to working dir */
int strreplace(); /* replace template directives */
int ipackage = 0; /* packages[] index 0...npackages-1*/
int rrmdir(); /* rm -r */
int gifpathlen = 0; /* ../ or ../../ prefix of giffile */
int status = 0; /* imagetype or 0=error */
int timelimit(); /* and using built-in timelimit() */
/* -------------------------------------------------------------------------
Make temporary work directory and cd to ~workpath/tempdir/
-------------------------------------------------------------------------- */
msgnumber = 0; /* no error to report yet */
if ( !isempty(workpath) ) /*have a working dir for temp files*/
if ( isdexists(workpath) ) /* if working directory exists */
if ( chdir(workpath) /* cd to working directory */
== 0 ) isworkpath=1; /* signal cd to workpath succeeded */
if ( !isdexists(tempdir/*filename*/) ) /* if temp directory doesn't exist */
if ( mkdir(tempdir/*filename*/,perm_all) /* make temp dirextory */
!= 0 ) { /* mkdir failed */
msgnumber = MKDIRFAILED; /* set corresponding message number*/
goto end_of_job; } /* and quit */
dir_stat++; /* signal mkdir successful */
if ( chdir(tempdir/*filename*/) /* cd to temp directory */
!= 0 ) { /* cd failed */
msgnumber = CHDIRFAILED; /* set corresponding message number*/
goto end_of_job; } /* and quit */
dir_stat++; /* signal chdir successful */
/* -------------------------------------------------------------------------
set up latex directives for user-specified additional \usepackage{}'s
-------------------------------------------------------------------------- */
if ( !iserror ) /* don't \usepackage for error */
if ( npackages > 0 ) /* have additional packages */
for ( ipackage=0; ipackage<npackages; ipackage++ ) { /*make \usepackage{}*/
strcat(usepackage,"\\usepackage"); /* start with a directive */
if ( !isempty(packargs[ipackage]) ) { /* have an optional arg */
strcat(usepackage,"["); /* begin optional argument */
strcat(usepackage,packargs[ipackage]); /* add optional arg */
strcat(usepackage,"]"); } /* finish optional arg */
strcat(usepackage,"{"); /* begin package name argument */
strcat(usepackage,packages[ipackage]); /* add package name */
strcat(usepackage,"}\n"); } /* finish constructing directive */
/* -------------------------------------------------------------------------
Replace "keywords" in latex template with expression and other directives
-------------------------------------------------------------------------- */
/* --- embed http_referer submitting request --- */
strreplace(latexwrapper,"%%referer%%",this_referer,1,0);
/* --- usually replace %%pagestyle%% with \pagestyle{empty} --- */
if ( !ispicture /* not \begin{picture} environment */
|| latexmethod == 1 ) /* or using latex/dvips/ps2epsi */
strreplace(latexwrapper,"%%pagestyle%%","\\pagestyle{empty}",1,0);
/* --- replace %%previewenviron%% if a picture and using pfdlatex --- */
if ( ispicture /* have \begin{picture} environment */
&& latexmethod == 2 ) /* and using pdflatex/convert */
strreplace(latexwrapper,"%%previewenviron%%",
"\\PreviewEnvironment{picture}",1,0);
/* --- replace %%beginmath%%...%%endmath%% with \[...\] or with $...$ --- */
if ( mathmode<0 || mathmode>2 ) mathmode=0; /* mathmode validity check */
strreplace(latexwrapper,"%%beginmath%%",beginmath[mathmode],1,0);
strreplace(latexwrapper,"%%endmath%%",endmath[mathmode],1,0);
/* --- replace %%fontsize%% in template with \tiny...\Huge --- */
strreplace(latexwrapper,"%%fontsize%%",sizedirectives[fontsize],1,0);
/* --- replace %%setlength%% in template for pictures when necessary --- */
if ( ispicture /* have \begin{picture} environment */
&& strstr(expression,"\\unitlength") == NULL ) /* but no \unitlength */
strreplace(latexwrapper,"%%setlength%%", /* so default it to 1 inch */
"\\setlength{\\unitlength}{1.0in}",1,0);
/* --- replace %%usepackage%% in template with extra \usepackage{}'s --- */
strreplace(latexwrapper,"%%usepackage%%",usepackage,1,0);
/* --- replace %%expression%% in template with expression --- */
strreplace(latexwrapper,"%%expression%%",expression,1,0);
/* -------------------------------------------------------------------------
Create latex document wrapper file containing expression
-------------------------------------------------------------------------- */
strcpy(latexfile,makepath("","latex",".tex")); /* latex filename latex.tex */
latexfp = fopen(latexfile,"w"); /* open latex file for write */
if ( latexfp == NULL ) { /* couldn't open latex file */
msgnumber = FOPENFAILED; /* set corresponding message number*/
goto end_of_job; } /* and quit */
fprintf(latexfp,"%s",latexwrapper); /* write file */
fclose(latexfp); /* close file after writing it */
/* -------------------------------------------------------------------------
Set paths to programs we'll need to run
-------------------------------------------------------------------------- */
setpaths(10*latexmethod+imagemethod);
/* -------------------------------------------------------------------------
Execute the latex file
-------------------------------------------------------------------------- */
/* --- initialize system(command); to execute the latex file --- */
*command = '\000'; /* init command as empty string */
/* --- run latex under timelimit if explicitly given -DTIMELIMIT switch --- */
if ( istimelimitpath /* given explict -DTIMELIMIT path */
&& warntime > 0 /* and positive warntime, and... */
&& !iscompiletimelimit ) { /* not using built-in timelimit() */
if ( killtime < 1 ) killtime=1; /* don't make trouble for timelimit*/
strcat(command,makepath("",timelimitpath,NULL)); /* timelimit program */
if ( isempty(command) ) /* no path to timelimit */
warntime = (-1); /*reset flag to signal no timelimit*/
else { /* have path to timelimit program */
sprintf(command+strlen(command), /* add timelimit args after path */
" -t%d -T%d ",warntime,killtime); }
} /* --- end-of-if(warntime>0) --- */
/* --- path to latex executable image followed by args --- */
if ( latexmethod != 2 ) /* not explicitly using pdflatex */
strcpy(subcommand,makepath("",latexpath,NULL)); /* running latex program */
else /* explicitly using pdflatex */
strcpy(subcommand,makepath("",pdflatexpath,NULL)); /* running pdflatex */
if ( isempty(subcommand) ) { /* no program path to latex */
msgnumber = SYLTXFAILED; /* set corresponding error message */
goto end_of_job; } /* signal failure and emit error */
strcat(command,subcommand); /* add latex path (after timelimit)*/
strcat(command," "); /* add a blank before latex args */
strcat(command,latexfile); /* run on latexfile we just wrote */
if ( isquiet > 0 ) { /* to continue after latex error */
if ( isquiet > 99 ) /* explicit q requested */
system("echo \"q\" > reply.txt"); /* reply q to latex error prompt */
else { /* reply <Enter>'s followed by x */
int nquiet = isquiet; /* this many <Enter>'s before x */
FILE *freply =fopen("reply.txt","w"); /* open reply.txt for write */
if ( freply != NULL ) { /* opened successfully */
while ( --nquiet >= 0 ) /* nquiet times... */
fputs("\n",freply); /* ...write <Enter> to reply.txt */
fputs("x",freply); /* finally followed by an x */
fclose(freply); } } /* close reply.txt */
strcat(command," < reply.txt"); } /*by redirecting stdin to reply.txt*/
else strcat(command," < /dev/null"); /* or redirect stdin to /dev/null */
strcat(command," >latex.out 2>latex.err"); /* redirect stdout and stderr */
showmsg(5,"latex command executed",command); /* show latex command executed*/
/* --- execute the latex file --- */
sys_stat = timelimit(command,killtime); /* throttle the latex command */
if ( msgfp!=NULL && msglevel>=3 ) /* and show command's return status*/
fprintf(msgfp,"\nmathTeX> system() return status: %d\n", sys_stat);
if ( latexmethod != 2 ) /* ran latex */
if ( !isfexists(makepath("","latex",".dvi")) ) /* but no latex dvi */
sys_stat = (-1); /* signal that latex failed */
if ( latexmethod == 2 ) /* ran pdflatex */
if ( !isfexists(makepath("","latex",".pdf")) ) /* but no pdflatex pdf */
sys_stat = (-1); /* signal that pdflatex failed */
if ( sys_stat == (-1) ) { /* system() or pdf/latex failed */
if ( !iserror ) { /* don't recurse if errormsg fails */
iserror = 1; /* set error flag */
isdepth = ispicture = 0; /* reset depth, picture mode */
status = mathtex(errormsg,filename); /* recurse just once for error msg*/
goto end_of_job; } /* ignore original expression */
else { /* ignore 2nd try to recurse */
msgnumber = /* set corresponding message number*/
(sys_stat==(-1)?SYLTXFAILED: /* system() failed */
(isnotfound("latex")?SYLTXFAILED: /* latex program not found */
LATEXFAILED)); /* latex ran but failed */
goto end_of_job; } /* and quit */
} /* --- end-of-if(system()==-1||!isfexists()) --- */
/* -------------------------------------------------------------------------
Extract image info from latex.info (if available)
-------------------------------------------------------------------------- */
if ( isdepth ) /* image info requested */
if ( isfexists(makepath("","latex",".info")) ) { /* and have latex.info */
FILE *info = fopen(makepath("","latex",".info"),"r"); /*open it for read*/
char infoline[256]; /* read a line from latex.info */
if ( info != NULL ) { /* open succeeded */
while ( fgets(infoline,255,info) != NULL ) { /* read until eof or error */
int i = 0; /* imageinfo[] index */
char *delim = NULL; /* find '=' in infoline */
trimwhite(infoline); /*remove leading/trailing whitespace*/
for ( i=0; imageinfo[i].format!=NULL; i++ ) /* all imageinfo[] fields */
if ( strstr(infoline,imageinfo[i].identifier) == infoline ) {
imageinfo[i].value = (-9999.); /* init value to signal error */
*(imageinfo[i].units) = '\000'; /* init units to signal error */
if ( (delim=strchr(infoline,'=')) == NULL ) break; /* no '=' delim */
memmove(infoline,delim+1,strlen(delim)); /* get value after '=' */
trimwhite(infoline); /*remove leading/trailing whitespace*/
imageinfo[i].value = strtod(infoline,&delim); /* convert to integer */
if ( !isempty(delim) ) { /* units, e.g., "pt", after value */
memmove(infoline,delim,strlen(delim)+1); /* get units field */
trimwhite(infoline); /*remove leading/trailing whitespace*/
strninit(imageinfo[i].units,infoline,16); } /* copy units */
break; /* don't check further identifiers */
} /* --- end-of-if(strstr(infoline,identifier)) --- */
} /* --- end-of-while(fgets()!=NULL) --- */
fclose(info); /* close info file */
} /* --- end-of-if(info!=NULL) --- */
} /* --- end-of-if(isfexists("latex.info")) --- */
/* -------------------------------------------------------------------------
Construct the output path/filename.[gif,png] for the image file
-------------------------------------------------------------------------- */
if ( isempty(outfile) /* using default cache directory */
|| !isthischar(*outfile,"/\\") ) { /* or just given a relative path */
*giffile = '\000'; /* start with empty string */
if ( isworkpath ) { /* we've cd'ed to a working dir */
if ( !isempty(homepath) ) /* have a homepath */
strcpy(giffile,homepath); /* so just use it */
else { /* home path not available */
int nsub = (isworkpath?2:1); /* up two dirs for workdir, else 1 */
if ( iserror ) nsub++; /* and another if in error subdir */
if ( (pwdpath=presentwd(nsub)) /* get path nsub dirs up from pwd */
!= NULL ) /* got it */
strcpy(giffile,pwdpath); } /* use it as giffile prefix */
} /* --- end-of-if(isworkpath) --- */
if ( isempty(giffile) ) { /* haven't constructed giffile */
if ( iserror ) strcat(giffile,"../"); /*up to temp if in error subdir*/
strcat(giffile,"../"); /* up to home or working dir */
if ( isworkpath ) /* temp under working dir */
strcat(giffile,"../"); /* up from working to home dir */
} /* --- end-of-if(isempty(giffile)) --- */
gifpathlen = strlen(giffile); /* #chars in ../ or ../../ prefix */
} /* --- end-of-if(isempty(outfile)||etc) --- */
if ( isempty(outfile) ) /* using default output filename */
strcat(giffile,makepath(NULL,filename,extensions[imagetype]));
else /* have an explicit output file */
strcat(giffile,makepath("",outfile,extensions[imagetype]));
showmsg(3,"output image file",giffile+gifpathlen); /* show output filename */
/* -------------------------------------------------------------------------
Run dvipng for .dvi-to-gif/png
-------------------------------------------------------------------------- */
if ( imagemethod == 1 ) { /*dvipng method requested (default)*/
/* ---
* First replace "keywords" in dvipngargs template with actual values
*------------------------------------------------------------------- */
/* --- replace %%imagetype%% in dvipng arg template with gif or png --- */
strreplace(dvipngargs,"%%imagetype%%",extensions[imagetype],1,0);
/* --- replace %%dpi%% in dvipng arg template with actual dpi --- */
strreplace(dvipngargs,"%%dpi%%",density,1,0);
/* --- replace %%gamma%% in dvipng arg template with actual gamma --- */
strreplace(dvipngargs,"%%gamma%%",gamma,1,0);
/* --- replace %%giffile%% in dvipng arg template with actual giffile --- */
strreplace(dvipngargs,"%%giffile%%",giffile,1,0);
/* ---
* And run dvipng to convert .dvi file directly to .gif/.png
*---------------------------------------------------------- */
strcpy(command,makepath("",dvipngpath,NULL)); /* running dvipng program */
if ( isempty(command) ) { /* no program path to dvipng */
msgnumber = SYPNGFAILED; /* set corresponding error message */
goto end_of_job; } /* signal failure and emit error */
strcat(command,dvipngargs); /* add dvipng switches */
strcat(command,makepath("","latex",".dvi")); /* run dvipng on latex.dvi */
strcat(command," >dvipng.out 2>dvipng.err"); /* redirect stdout, stderr */
showmsg(5,"dvipng command executed",command); /* dvipng command executed */
sys_stat = system(command); /* execute the dvipng command */
if ( sys_stat == (-1) /* system(dvipng) failed */
|| !isfexists(giffile) ) { /*or dvipng failed to create giffile*/
msgnumber = /* set corresponding message number*/
(sys_stat==(-1)?SYPNGFAILED: /* system() failed */
(isnotfound("dvipng")?SYPNGFAILED: /* dvipng program not found */
DVIPNGFAILED)); /* dvipng ran but failed */
goto end_of_job; } /* and quit */
} /* --- end-of-if(imagemethod==1) --- */
/* -------------------------------------------------------------------------
Run dvips for .dvi-to-postscript and convert for postscript-to-gif/png
-------------------------------------------------------------------------- */
if ( imagemethod == 2 ) { /* dvips/convert method requested */
/* ---
* First run dvips to convert .dvi file to .ps postscript
*------------------------------------------------------- */
if ( latexmethod != 2 ) { /* only if not using pdflatex */
strcpy(command,makepath("",dvipspath,NULL)); /* running dvips program */
if ( isempty(command) ) { /* no program path to dvips */
msgnumber = SYPSFAILED; /* set corresponding error message */
goto end_of_job; } /* signal failure and emit error */
if ( !ispicture ) strcat(command," -E"); /*add -E switch if not picture*/
strcat(command," "); /* add a blank */
strcat(command,makepath("","latex",".dvi")); /* run dvips on latex.dvi */
strcat(command," -o "); /* to produce output file in */
if ( !ispicture ) /* when not a picture (usually) */
strcat(command,makepath("","dvips",".ps")); /*dvips.ps postscript file*/
else /*intermediate temp file for ps2epsi*/
strcat(command,makepath("","dvitemp",".ps")); /*temp postscript file*/
strcat(command," >dvips.out 2>dvips.err"); /* redirect stdout, stderr */
showmsg(5,"dvips command executed",command); /* dvips command executed */
sys_stat = system(command); /* execute system(dvips) */
/* --- run ps2epsi if dvips ran without -E (for \begin{picture}) --- */
if ( sys_stat != (-1) /* system(dvips) succeeded */
&& ispicture ) { /* and we ran dvips without -E */
strcpy(command,makepath("",ps2epsipath,NULL)); /* running ps2epsi */
if ( isempty(command) ) { /* no program path to ps2epsi */
msgnumber = SYPSFAILED; /* set corresponding error message */
goto end_of_job; } /* signal failure and emit error */
strcat(command," "); /* add a blank */
strcat(command,makepath("","dvitemp",".ps")); /*temp postscript file*/
strcat(command," "); /* add a blank */
strcat(command,makepath("","dvips",".ps")); /*dvips.ps postscript file*/
strcat(command," >ps2epsi.out 2>ps2epsi.err");/*redirect stdout,stderr*/
showmsg(5,"ps2epsi command executed",command); /* command executed */
sys_stat = system(command); /* execute system(ps2epsi) */
} /* --- end-of-if(ispicture) --- */
if ( sys_stat == (-1) /* system(dvips) failed */
|| !isfexists(makepath("","dvips",".ps")) ) { /*dvips didn't create .ps*/
msgnumber = /* set corresponding message number*/
(sys_stat==(-1)?SYPSFAILED: /* system() failed */
(isnotfound("dvips")?SYPSFAILED: /* dvips program not found */
DVIPSFAILED)); /* dvips ran but failed */
goto end_of_job; } /* and quit */
} /* --- end-of-if(latexmethod!=2) --- */
/* ---
* Then replace "keywords" in convertargs template with actual values
*------------------------------------------------------------------- */
/* --- replace %%dpi%% in convert arg template with actual density --- */
strreplace(convertargs,"%%dpi%%",density,1,0);
/* --- replace %%gamma%% in convert arg template with actual gamma --- */
strreplace(convertargs,"%%gamma%%",gamma,1,0);
/* ---
* And run convert to convert .ps file to .gif/.png
*-------------------------------------------------- */
strcpy(command,makepath("",convertpath,NULL)); /*running convert program*/
if ( isempty(command) ) { /* no program path to convert */
msgnumber = SYCVTFAILED; /* set corresponding error message */
goto end_of_job; } /* signal failure and emit error */
strcat(command,convertargs); /* add convert switches */
if ( latexmethod != 2 ) /* we ran latex and dvips */
strcat(command,makepath("","dvips",".ps")); /* convert from postscript */
if ( latexmethod == 2 ) /* we ran pdflatex */
strcat(command,makepath("","latex",".pdf")); /* convert from pdf */
strcat(command," "); /* field separator */
strcat(command,giffile); /* followed by ../cache/filename */
strcat(command," >convert.out 2>convert.err"); /*redirect stdout, stderr*/
showmsg(5,"convert command executed",command); /*convert command executed*/
sys_stat = system(command); /* execute system(convert) command */
if ( sys_stat == (-1) /* system(convert) failed */
|| !isfexists(giffile) ) { /* or convert didn't create giffile*/
msgnumber = /* set corresponding message number*/
(sys_stat==(-1)?SYCVTFAILED: /* system() failed */
(isnotfound("convert")?SYCVTFAILED: /* convert program not found */
CONVERTFAILED)); /* convert ran but failed */
goto end_of_job; } /* and quit */
} /* --- end-of-if(imagemethod==2) --- */
status = imagetype; /* signal success */
/* -------------------------------------------------------------------------
Back to caller
-------------------------------------------------------------------------- */
end_of_job:
if ( dir_stat >= 2 ) chdir(".."); /* return up to working dir or home*/
if ( dir_stat >= 1 ) rrmdir(tempdir/*filename*/);/*rm -r temp working dir*/
if ( isworkpath ) /* return from working dir to home */
chdir((!isempty(homepath)?homepath:"..")); /* best guess at home */
iserror = 0; /* always reset error flag */
return ( status );
} /* --- end-of-function mathtex() --- */
/* ==========================================================================
* Function: setpaths ( method )
* Purpose: try to set accurate paths for
* latex,pdflatex,timelimit,dvipng,dvips,convert
* --------------------------------------------------------------------------
* Arguments: method (I) 10*ltxmethod + imgmethod where
* ltxmethod =
* 1 for latex, 2 for pdflatex,
* 0 for both
* imgmethod =
* 1 for dvipng, 2 for dvips/convert,
* 0 for both
* --------------------------------------------------------------------------
* Returns: ( int ) 1
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int setpaths ( int method )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
char *programpath=NULL, *whichpath(); /* look for latex,dvipng,etc */
int nlocate = 0; /*if which fails, #locate|grep hits*/
int ltxmethod = method/10, /* divide by 10 */
imgmethod = method%10; /* remainder after division by 10 */
static int islatexwhich=0, ispdflatexwhich=0, /* set true after we try */
isdvipngwhich=0, isdvipswhich=0, /*whichpath() for that program*/
isps2epsiwhich=0, isconvertwhich=0, istimelimitwhich=0;
/* ---
* set paths, either from -DLATEX=\"path/latex\", etc, or call whichpath()
* ----------------------------------------------------------------------- */
/* --- path for latex program --- */
if ( ltxmethod==1 || ltxmethod==0 ) /* not needed for pdflatex only */
/*if ( !ISLATEXSWITCH && !islatexwhich )*/ /* nb, use islatexpath instead */
if ( !islatexpath && !islatexwhich ) { /* no -DLATEX=\"path/latex\" */
islatexwhich = 1; /* signal that which already tried */
nlocate = ISLOCATE; /* use locate if which fails??? */
if ( (programpath=whichpath("latex",&nlocate)) /* try to find latex path */
!= NULL ) { /* succeeded */
islatexpath = (nlocate==0?2:3); /* set flag signalling which() */
strninit(latexpath,programpath,255); } }/* copy path from whichpath() */
/* --- path for pdflatex program --- */
if ( ltxmethod==2 || ltxmethod==0 ) /* not needed for latex only */
/*if ( !ISPDFLATEXSWITCH && !ispdflatexwhich )*/ /*nb, use ispdflatexpath*/
if ( !ispdflatexpath && !ispdflatexwhich ) { /*no -DPDFLATEX=\"pdflatex\"*/
ispdflatexwhich = 1; /* signal that which already tried */
nlocate = ISLOCATE; /* use locate if which fails??? */
if ( (programpath=whichpath("pdflatex",&nlocate)) /*try to find pdflatex*/
!= NULL ) { /* succeeded */
ispdflatexpath = (nlocate==0?2:3); /* set flag signalling which() */
strninit(pdflatexpath,programpath,255); } }/*copy path from whichpath()*/
/* --- path for timelimit program --- */
if ( 0 ) /* only use explicit -DTIMELIMIT */
if ( warntime > 0 ) /* have -DWARNTIME or -DTIMELIMIT */
/*if ( !ISTIMELIMITSWITCH*/ /* nb, use istimelimitpath instead */
if ( !istimelimitpath /*no -DTIMELIMIT=\"path/timelimit\"*/
&& !istimelimitwhich ) {
istimelimitwhich = 1; /* signal that which already tried */
nlocate = ISLOCATE; /* use locate if which fails??? */
if ( (programpath=whichpath("timelimit",&nlocate)) /* try to find path */
!= NULL ) { /* succeeded */
istimelimitpath = (nlocate==0?2:3); /* set flag signalling which() */
strninit(timelimitpath,programpath,255); } } /* copy from whichpath()*/
/* --- path for dvipng program --- */
if ( imgmethod != 2 ) /* not needed for dvips/convert */
/*if ( !ISDVIPNGSWITCH && !isdvipngwhich )*/ /*nb, use isdvipngpath instead*/
if ( !isdvipngpath && !isdvipngwhich ) { /* no -DDVIPNG=\"path/dvipng\" */
isdvipngwhich = 1; /* signal that which already tried */
nlocate = ISLOCATE; /* use locate if which fails??? */
if ( (programpath=whichpath("dvipng",&nlocate)) /* try to find dvipng */
!= NULL ) { /* succeeded */
isdvipngpath = (nlocate==0?2:3); /* set flag signalling which() */
strninit(dvipngpath,programpath,255); } }/*so copy path from whichpath()*/
/* --- path for dvips program --- */
if ( imgmethod != 1 ) /* not needed for dvipng */
/*if ( !ISDVIPSSWITCH && !isdvipswhich )*/ /* nb, use isdvipspath instead */
if ( !isdvipspath && !isdvipswhich ) { /* no -DDVIPS=\"path/dvips\" */
isdvipswhich = 1; /* signal that which already tried */
nlocate = ISLOCATE; /* use locate if which fails??? */
if ( (programpath=whichpath("dvips",&nlocate)) /* try to find dvips path */
!= NULL ) { /* succeeded */
isdvipspath = (nlocate==0?2:3); /* set flag signalling which() */
strninit(dvipspath,programpath,255); } }/* so copy path from whichpath()*/
/* --- path for ps2epsi program --- */
if ( (ispicture || method==0) /* only needed for \begin{picture} */
&& imgmethod != 1 /* not needed for dvipng */
&& ltxmethod != 2 ) /* not needed for pdflatex */
/*if ( !ISPS2EPSISWITCH && !isps2epsiwhich )*/ /*use isps2epsipath instead*/
if ( !isps2epsipath && !isps2epsiwhich ) { /*no -DPS2EPSI=\"path/ps2epsi\"*/
isps2epsiwhich = 1; /* signal that which already tried */
nlocate = ISLOCATE; /* use locate if which fails??? */
if ( (programpath=whichpath("ps2epsi",&nlocate))/*try to find ps2epsi path*/
!= NULL ) { /* succeeded */
isps2epsipath = (nlocate==0?2:3); /* set flag signalling which() */
strninit(ps2epsipath,programpath,255); } } /*copy path from whichpath()*/
/* --- path for convert program --- */
if ( imgmethod != 1 ) /* not needed for dvipng */
/*if ( !ISCONVERTSWITCH && !isconvertwhich )*/ /*use isconvertpath instead*/
if ( !isconvertpath && !isconvertwhich ) { /*no -DCONVERT=\"path/convert\"*/
isconvertwhich = 1; /* signal that which already tried */
nlocate = ISLOCATE; /* use locate if which fails??? */
if ( (programpath=whichpath("convert",&nlocate)) /* try to find convert */
!= NULL ) { /* succeeded */
isconvertpath = (nlocate==0?2:3); /* set flag signalling which() */
strninit(convertpath,programpath,255); } } /*copy path from whichpath()*/
/* --- adjust imagemethod to comply with available programs --- */
if ( imgmethod != imagemethod /* ignore recursive call */
&& imgmethod != 0 ) goto end_of_job; /* but 0 is a call for both methods*/
if ( imagemethod == 1 ) /* dvipng wanted */
if ( !isdvipngpath ) { /* but we have no real path to it */
if ( imgmethod == 1 ) setpaths(2); /* try to set dvips/convert paths */
if ( isdvipspath && isconvertpath ) { /* and we do have dvips, convert */
imagemethod = 2; /* so flip default to use them */
if ( !ISGAMMA ) strcpy(gamma,CONVERTGAMMA); } }/*default convert gamma*/
if ( imagemethod == 2 ) /* dvips, convert wanted */
if ( !isdvipspath || !isconvertpath ) {/*but we have no real paths to them*/
if ( imgmethod == 2 ) setpaths(1); /* try to set dvipng path */
if ( isdvipngpath ) { /* and we do have dvipng path */
imagemethod = 1; /* so flip default to use it */
if ( !ISGAMMA ) strcpy(gamma,DVIPNGGAMMA); } }/* default dvipng gamma */
/* --- back to caller --- */
end_of_job:
return ( 1 );
} /* --- end-of-function setpaths() --- */
/* ==========================================================================
* Function: isnotfound ( filename )
* Purpose: check a "... 2>filename.err" file for a "not found" message,
* indicating the corresponding program path is incorrect
* --------------------------------------------------------------------------
* Arguments: filename (I) pointer to null-terminated char string
* containing filename (an .err extension
* is tacked on, just pass the filename)
* to be checked for "not found" message
* --------------------------------------------------------------------------
* Returns: ( int ) 1 if filename.err contains "not found",
* 0 otherwise (or for any error)
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int isnotfound ( char *filename )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int status = 0; /* set 1 if "not found" found */
int isfexists(); /* check if filename exists */
char command[256]; /* grep program */
FILE *grepout = NULL; /* grep's stdout */
char grepline[256]; /* line from grep's stdout */
int strreplace(); /* make sure "not found" was found */
int nlines = 0; /* #lines read */
/* -------------------------------------------------------------------------
grep filename.err for filename (i.e., the program name), then check each
such line for "not found", "no such", etc.
-------------------------------------------------------------------------- */
/* --- initialization --- */
if ( isempty(filename) ) goto end_of_job; /* no input filename supplied */
sprintf(command,"%s.err",filename); /* look for filename.err */
if ( !isfexists(command) ) { /* filename.err doesn't exist */
status = 1; /* assume this means "not found" */
goto end_of_job; } /* and return that to caller */
/* --- grep filename.err for filename (i.e., for the program name) --- */
sprintf(command,"grep -i \"%s\" %s.err",filename,filename); /*construct cmd*/
/* --- use popen() to invoke grep --- */
grepout = popen( command, "r" ); /* issue grep and capture stdout */
if( grepout == NULL ) goto end_of_job; /* failed */
/* --- read the pipe one line at a time --- */
while ( fgets(grepline,255,grepout) /* get next line */
!= NULL ) { /* not at eof yet */
if ( strreplace(grepline,"not found","",0,0) /* check for "not found" */
> 0 ) nlines++; /* count another "not found" line */
if ( strreplace(grepline,"no such","",0,0) /* check for "no such" */
> 0 ) nlines++; /* count another "no such" line */
} /* --- end-of-while(fgets()!=NULL) -- */
if ( nlines > 0 ) status = 1; /* "not found" found */
/* --- pclose() waits for command to terminate --- */
pclose( grepout ); /* finish */
end_of_job: /* back to caller */
return ( status ); /*1 if filename contains "not found"*/
} /* --- end-of-function isnotfound() --- */
/* ==========================================================================
* Function: validate ( expression )
* Purpose: remove/replace illegal \commands from expression
* --------------------------------------------------------------------------
* Arguments: expression (I/O) pointer to null-terminated char string
* containing latex expression to be validated.
* Upon return, invalid \commands have been
* removed or replaced
* --------------------------------------------------------------------------
* Returns: ( int ) #illegal \commands found (hopefully 0)
* --------------------------------------------------------------------------
* Notes: o Ignore this note and see the one below it instead...
* This routine is currently "stubbed out",
* i.e., the invalid[] list of invalid \commands is empty.
* Instead, \renewcommand's are embedded in the LaTeX wrapper.
* So the user's -DNEWCOMMAND=\"filename\" can contain
* additional \renewcomand's for any desired validity checks.
* o Because some \renewcommand's appear to occasionally cause
* latex to go into a loop after encountering syntax errors,
* I'm now using validate() to disable \input, etc.
* For example, the following short document...
* \documentclass[10pt]{article}
* \begin{document}
* \renewcommand{\input}[1]{dummy renewcommand}
* %%\renewcommand{\sqrt}[1]{dummy renewcommand}
* %%\renewcommand{\beta}{dummy renewcommand}
* \[ \left( \begin{array}{cccc} 1 & 0 & 0 &0
* \\ 0 & 1 %%% \end{array}\right)
* \]
* \end{document}
* reports a "! LaTeX Error:" and then goes into
* a loop if you reply q. But if you comment out the
* \renewcommand{\input} and uncomment either or both
* of the other \renewcommand's, then latex runs to
* completion (with the same syntax error, of course,
* but without hanging).
*
* ======================================================================= */
/* --- entry point --- */
int validate ( char *expression )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
/* --- list of invalid \commands --- */
static struct {
int action; /* 0=ignore, 1=apply, 2=abort */
char *command; /* invalid \command */
int nargs; /* #args, \command{arg1}...{nargs} */
int optionalpos; /* #{args} before optional [arg] */
int argformat; /* 0=LaTeX {arg} or [arg], 1=arg */
char *displaystring; } /* display this instead */
invalid[] = { /* list of invalid commands */
#if defined(INVALID) /* cc -DINVALID=\"filename\" */
#include INVALID /* filename with invalid \commands */
#endif /* as illustrated below... */
/* actn "command" #args pos fmt "replacement string" or NULL
* ---- ----------------- ----- --- --- -------------------------- */
{ 1, "\\newcommand", 2, 1, 0, NULL },
{ 1, "\\providecommand", 2, 1, 0, NULL },
{ 1, "\\renewcommand", 2, 1, 0, NULL },
{ 1, "\\input", 1, -1, 0, NULL },
/* --plain TeX commands with non-{}-enclosed args we can't parse-- */
{ 1, "\\def", 2, -1, 20, NULL },
{ 1, "\\edef", 2, -1, 20, NULL },
{ 1, "\\gdef", 2, -1, 20, NULL },
{ 1, "\\xdef", 2, -1, 20, NULL },
{ 1, "\\loop", 0, -1, 0, NULL },
{ 1, "\\csname", 0, -1, 0, NULL },
{ 1, "\\catcode", 0, -1, 0, NULL },
{ 1, "\\output", 0, -1, 0, NULL },
{ 1, "\\everycr", 0, -1, 0, NULL },
{ 1, "\\everypar", 0, -1, 0, NULL },
{ 1, "\\everymath", 0, -1, 0, NULL },
{ 1, "\\everyhbox", 0, -1, 0, NULL },
{ 1, "\\everyvbox", 0, -1, 0, NULL },
{ 1, "\\everyjob", 0, -1, 0, NULL },
{ 1, "\\openin", 0, -1, 0, NULL },
{ 1, "\\read", 0, -1, 0, NULL },
{ 1, "\\openout", 0, -1, 0, NULL },
{ 1, "\\write", 0, -1, 0, NULL },
/* --- other dangerous notation --- */
{ 1, "^^", 0, -1, 0, NULL },
#if 0
/* --- test cases --- */
/*{ 1, "\\input", 1, -1, 0,
"{\\mbox{$\\backslash$input\\{#1\\}}}" },*/
{ 1, "\\input", 1, -1, 0,
"{\\mbox{~$\\backslash$input\\{#1\\}~not~permitted~}}" },
{ 1, "\\newcommand", 2, 1, 0, NULL},
/*"{\\mbox{~$\\backslash$newcommand\\{#1\\}[#0]\\{#2\\}"
"~not~permitted~}}" },*/
#endif
{ 0, NULL, 0, -1, 0, NULL } } ; /* end-of-list */
/* --- other variables --- */
int ninvalid = 0, /* #invalid =commands found */
ivalid = 0; /* invalid[ivalid] list index */
char *getdirective(), *pcommand=NULL; /* find and remove invalid command */
static char args[10][512]= {"","","","","","","","","",""}; /*\cmd{arg}'s*/
char *pargs[11] = { args[0],args[1],args[2],args[3], /* ptrs to them */
args[4],args[5],args[6],args[7],args[8],args[9], NULL };
char display[2048], argstr[256], optstr[1024]; /*displaystring with args*/
char *strchange(); /* place display where command was */
int strreplace(); /* replace #1 with args[0], etc */
char *nomath(); /* change \ to \\, { to \{, etc */
int iarg=0, iopt=0; /* args[], optionalargs[] indexes */
/* -------------------------------------------------------------------------
Initialization
-------------------------------------------------------------------------- */
if ( isempty(expression) ) /* no input to validate */
goto end_of_job; /* so quit */
/* -------------------------------------------------------------------------
Check each invalid command in list
-------------------------------------------------------------------------- */
for ( ivalid=0; !isempty(invalid[ivalid].command); ivalid++ ) { /*run list*/
/* --- extract local copy of invalid command list elements --- */
int action = invalid[ivalid].action; /* 0=ignore,1=apply,2=abort*/
char *command = invalid[ivalid].command; /* invalid \command */
int nargs = invalid[ivalid].nargs; /*number of \command {arg}'s*/
int myoptionalpos = invalid[ivalid].optionalpos; /*#{args} before [arg]*/
int myargformat = invalid[ivalid].argformat; /* 0={arg},1=arg*/
char *displaystring= invalid[ivalid].displaystring; /*display template*/
/* --- arg format info --- */
int nfmt=0,/*isnegfmt=0,*/ /* {arg} format */
argfmt[9]={0,0,0,0,0,0,0,0,0}; /* argformat digits */
/* --- args returned as (char *) if nargs=1 or (char **) if nargs>1 --- */
void *argptr = (nargs<2?(void *)args[0]:(void *)pargs); /*(char * or **)*/
/* --- find and remove/replace all invalid command occurrences --- */
if ( action < 1 ) continue; /* ignore this invalid \command */
optionalpos = myoptionalpos; /* set global arg for getdirective */
argformat = myargformat; /* set global arg for getdirective */
/* --- interpret argformat digits --- */
if ( argformat != 0 ) { /* have argformat */
int myfmt = argformat; /* local copy */
if ( myfmt < 0 ) { /*isnegfmt=1;*/ myfmt=(-myfmt); } /* check sign */
while ( myfmt>0 && nfmt<9 ) { /* have more format digits */
argfmt[nfmt] = myfmt%10; /* store low-order decimal digit */
myfmt /= 10; /* and shift it out */
nfmt++; } /* count another format digit */
} /* --- end-of-if(argformat!=0) --- */
/* --- remove/replace each occurrence of invalid \command --- */
while ( (pcommand = getdirective(expression,command,1,0,nargs,argptr))
!= NULL ) { /* found and removed an occurrence */
ninvalid++; /* count another invalid \command */
if ( noptional >= 8 ) noptional=7; /* don't overflow our buffers */
/* --- construct optional [arg]...[arg] for display --- */
*optstr = '\000'; /*init optional [arg]...[arg] string*/
if ( noptional > 0 ) /* have optional [args] */
for ( iopt=0; iopt<noptional; iopt++ ) /* construct "[arg]...[arg]" */
if ( !isempty(optionalargs[iopt]) ) { /* have an optional arg */
strcat(optstr,"["); /* leading [ for optional arg */
strcat(optstr,nomath(optionalargs[iopt])); /*optional arg string*/
strcat(optstr,"]"); } /* trailing ] */
/* --- construct error message display or use supplied template --- */
if ( isempty(displaystring) ) { /*replace \command by not~permitted*/
strcpy(display,"\\mbox{~\\underline{"); /* underline error in \mbox{}*/
strcat(display,nomath(command)); /* command without \ */
for ( iarg=0; iarg<nargs; iarg++ ) { /* add {args} and any [args] */
int ifmt = (nfmt<=iarg?0:argfmt[nfmt-iarg-1]); /* arg format digit */
if ( iarg==myoptionalpos && noptional>0 ) /* [args] belong here */
strcat(display,optstr); /* insert them before next {arg} */
if ( isempty(args[iarg]) ) break; /* no more args */
if(ifmt==0) strcat(display,"\\{"); /* insert leading \{ for arg */
strcat(display,nomath(args[iarg])); /* arg */
if(ifmt==0) strcat(display,"\\}"); } /* trailing \} for arg */
strcat(display,"~not~permitted}~}"); } /* finish error, close \mbox{}*/
else { /*replace \command by displaystring*/
strcpy(display,displaystring); /* local copy of display template */
if ( noptional < 1 ) /* no optional args */
strreplace(display,"[#0]","",0,0); /* so remove tag from template */
for ( iarg=0; iarg<nargs; iarg++ ) { /* replace #1 with args[0], etc */
if ( iarg==myoptionalpos && noptional>0 ) /* [args] belong here */
strreplace(display,"[#0]",optstr,0,0); /*insert them before {arg}*/
if ( isempty(args[iarg]) ) break; /* no more args */
else { /* have an arg */
sprintf(argstr,"#%d",iarg+1); /* #1 in template displays args[0] */
strreplace(display,argstr,nomath(args[iarg]),0,0); } /* replace */
} /* --- end-of-for(iarg) --- */
} /* --- end-of-if/else(isempty(displaystring)) --- */
strchange(0,pcommand,display); /* place display where command was */
for ( iarg=0; iarg<10; iarg++ ) *args[iarg] = '\000'; /* reset args */
} /* --- end-of-while(getdirective()!=NULL) --- */
} /* --- end-of-for(ivalid) --- */
end_of_job:
return ( ninvalid ); /* back to caller with #invalid */
} /* --- end-of-function validate() --- */
/* ==========================================================================
* Function: advertisement ( expression, message )
* Purpose: wrap expression in advertisement message
* --------------------------------------------------------------------------
* Arguments: expression (I/O) pointer to null-terminated char string
* containing expression to be "wrapped",
* and returning wrapped expression
* message (I) pointer to null-terminated char string
* containing template for advertisement
* message, or NULL to use default message
* --------------------------------------------------------------------------
* Returns: ( int ) 1 if successful, 0=error
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int advertisement ( char *expression, char *message )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
/* --- advertisement template --- */
char *adtemplate =
#if defined(ADVERTISEMENT) /* cc -DADVERTISEMENT=\"filename\" */
#include ADVERTISEMENT /* filename with advertisement */
#else /* formatted as illustrated below */
"\\begin{center}\n"
"\\fbox{$\\mbox{\\footnotesize\\LaTeX{} rendering courtesy of}\\atop\n"
"\\mbox{\\scriptsize http://www.forkosh.com/mathtex.html}$}\\\\ \n"
"\\vspace*{-4mm}\n"
" %%beginmath%% %%expression%% %%endmath%% \n"
"\\end{center}\n"
#endif
; /* terminating semicolon */
/* --- other variables --- */
char adbuffer[MAXEXPRSZ+2048]; /*construct wrapped expression here*/
char *beginmath[] = { "\\[", "$", " " }, /* start math mode */
*endmath[] = { "\\]", "$", " " }; /* end math mode */
int strreplace(); /* replace %%keywords%% with values*/
/* -------------------------------------------------------------------------
wrap expression in advertisement
-------------------------------------------------------------------------- */
/* --- start with template --- */
if ( isempty(message) ) /* caller didn't supply message */
message = adtemplate; /* so use default message */
strcpy(adbuffer,message); /* copy message template to buffer */
/* --- replace %%beginmath%%...%%endmath%% with \[...\] or with $...$ --- */
if ( mathmode<0 || mathmode>2 ) mathmode=0; /* out-of-bounds sanity check*/
if ( isempty(expression) ) mathmode = 2; /*ad only, no need for math mode*/
strreplace(adbuffer,"%%beginmath%%",beginmath[mathmode],1,0);
strreplace(adbuffer,"%%endmath%%",endmath[mathmode],1,0);
/* --- replace %%expression%% in template with expression --- */
strreplace(adbuffer,"%%expression%%",expression,1,0);
/* --- replace original expression --- */
strcpy(expression,adbuffer); /* expression mow wrapped in ad */
mathmode = 2; /* \[...\] already in expression */
return ( 1 ); /* always just return 1 */
} /* --- end-of-function advertisement() --- */
/* ==========================================================================
* Function: mathlog ( expression, filename )
* Purpose: write entry in log file
* --------------------------------------------------------------------------
* Arguments: expression (I) pointer to null-terminated char string
* containing latex math expression
* filename (I) pointer to null-terminated char string
* containing filename but not .extension
* of output file
* --------------------------------------------------------------------------
* Returns: ( int ) 1 if successful, 0=error
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int mathlog ( char *expression, char *filename )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
FILE *filefp = NULL; /* fopen(filename) for logfile */
char *timestamp(); /* time stamp for logged messages */
char *makepath(); /* construct full path/filename.ext*/
char *http_referer = getenv("HTTP_REFERER"); /* referer using mathTeX */
char *dashes = /* separates logfile entries */
"--------------------------------------------------------------------------";
/* -------------------------------------------------------------------------
write message to cache log file
-------------------------------------------------------------------------- */
if ( !isempty(CACHELOG) ) { /* if a logfile is given */
if ( (filefp=fopen(makepath(NULL,CACHELOG,NULL),"a")) /*open logfile*/
!= NULL ) { /* ignore logging if can't open */
int isreflogged = 0; /* set true if http_referer logged */
fprintf(filefp,"%s %s\n", /* timestamp, md5 file */
timestamp(TZDELTA,0), /* timestamp */
makepath("",filename,extensions[imagetype])); /* hashed filename */
fprintf(filefp,"%s\n",expression); /* expression in filename */
if ( !isempty(http_referer) ) { /* show referer if we have one */
int loglen = strlen(dashes); /* #chars on line in log file*/
char *refp = http_referer; /* line to be printed */
isreflogged = 1; /* signal http_referer logged*/
while ( 1 ) { /* printed in parts if needed*/
fprintf(filefp,"%.*s\n",loglen,refp); /* print a part */
if ( strlen(refp) <= loglen ) break; /* no more parts */
refp += loglen; } /* bump ptr to next part */
} /* --- end-of-if(!isempty(http_referer)) --- */
if ( !isreflogged ) /* http_referer not logged */
fprintf(filefp,"http://>>none<<\n"); /* so log dummy referer line */
fprintf(filefp,"%s\n",dashes); /* separator line */
fclose(filefp); /* close logfile immediately */
} /* --- end-of-if(filefp!=NULL) --- */
} /* --- end-of-if(!isempty(CACHELOG)) --- */
return ( 1 );
} /* --- end-of-function mathlog() --- */
/* ==========================================================================
* Function: makepath ( path, name, extension )
* Purpose: return string containing path/name.extension
* --------------------------------------------------------------------------
* Arguments: path (I) pointer to null-terminated char string
* containing "" path or path/ or NULL to
* use cachepath if caching enabled
* name (I) pointer to null-terminated char string
* containing filename but not .extension
* of output file or NULL
* extension (I) pointer to null-terminated char string
* containing extension or NULL
* --------------------------------------------------------------------------
* Returns: ( char * ) "cachepath/filename.extension" or NULL=error
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
char *makepath ( char *path, char *name, char *extension )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
static char namebuff[512]; /* buffer for constructed filename */
char *filename = NULL; /*ptr to filename returned to caller*/
/* -------------------------------------------------------------------------
construct filename
-------------------------------------------------------------------------- */
/* --- validity checks --- */
/*if ( isempty(name) ) goto end_of_job;*/ /* no name supplied by caller */
/* --- start with caller's path/ or default path to cache directory --- */
*namebuff = '\000'; /* re-init namebuff */
if ( path == NULL ) { /* use default path to cache */
if ( !isempty(cachepath) ) /* have a cache path */
strcpy(namebuff,cachepath); } /* begin filename with path */
else /* or use caller's supplied path */
if ( *path != '\000' ) /* if it's not an empty string */
strcpy(namebuff,path); /* begin filename with path */
if ( !isempty(namebuff) ) /* have a leading path */
if ( !isthischar(lastchar(namebuff),"\\/") ) /* no \ or / at end of path */
strcat(namebuff,(iswindows?"\\":"/")); /* so add windows\ or unix/ */
/* --- add name after path/ (name arg might just be a blank space) --- */
if ( !isempty(name) ) { /* name supplied by caller */
if ( !isempty(namebuff) ) /* and if we already have a path */
if ( isthischar(*name,"\\/") ) name++; /* skip leading \ or / in name */
strcat(namebuff,name); } /* name concatanated after path/ */
/* --- add extension after path/name */
if ( !isempty(extension) ) { /* have a filename extension */
if ( !isthischar(lastchar(namebuff),".") ) { /* no . at end of name */
if ( !isthischar(*extension,".") ) /* and extension has no leading . */
strcat(namebuff,"."); /* so we need to add our own . */
strcat(namebuff,extension); } /* add extension after path/name. */
else /* . already at end of name */
strcat(namebuff, /* add extension without . */
(!isthischar(*extension,".")?extension:extension+1)); /*skip leading . */
} /* --- end-of-if(!isempty(extension)) --- */
filename = namebuff; /* successful name back to caller */
/*end_of_job:*/
return ( filename ); /* back with name or NULL=error */
} /* --- end-of-function makepath() --- */
/* ==========================================================================
* Function: isfexists ( filename )
* Purpose: check whether or not filename exists
* --------------------------------------------------------------------------
* Arguments: filename (I) pointer to null-terminated char string
* containing filename to check for
* --------------------------------------------------------------------------
* Returns: ( int ) 1 = filename exists, 0 = not
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int isfexists ( char *filename )
{
FILE *fp = (isempty(filename)?NULL:fopen(filename,"r")); /* try to fopen*/
int status = 0; /* init for non-existant filename */
if ( fp != NULL ) { /* but filename does exist */
status = 1; /* so flip status */
fclose(fp); } /* and close the file */
return ( status ); /* tell caller if we found filename*/
} /* --- end-of-function isfexists() --- */
/* ==========================================================================
* Function: isdexists ( dirname )
* Purpose: check whether or not directory exists
* --------------------------------------------------------------------------
* Arguments: dirname (I) pointer to null-terminated char string
* containing directory name to check for
* --------------------------------------------------------------------------
* Returns: ( int ) 1 = directory exists, 0 = not
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int isdexists ( char *dirname )
{
int status = 0; /* init for non-existant dirname */
if ( !isempty(dirname) ) { /* must have directory name */
char directory[512]; /* local copy of dirname */
DIR *dp = NULL; /* dp=opendir() opens directory */
strcpy(directory,dirname); /* start with name given by caller */
if ( !isthischar(lastchar(directory),"/") ) /* no / at end of directory */
strcat(directory,"/"); /* so add one ourselves */
if ( (dp=opendir(directory)) != NULL ) { /* dirname exists */
status = 1; /* so flip status */
closedir(dp); } /* and close the directory */
} /* --- end-of-if(!isempty(dirname)) --- */
return ( status ); /* tell caller if we found dirname */
} /* --- end-of-function isdexists() --- */
/* ==========================================================================
* Function: whichpath ( program, nlocate )
* Purpose: determines the path to program with popen("which 'program'")
* --------------------------------------------------------------------------
* Arguments: program (I) pointer to null-terminated char string
* containing program whose path is desired
* nlocate (I/0) addr of int containing NULL to ignore,
* or (addr of int containing) 0 to *not*
* use locate if which fails. If non-zero,
* use locate if which fails, and return
* number of locate lines (if locate succeeds)
* --------------------------------------------------------------------------
* Returns: ( char * ) path to program, or NULL for any error
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
char *whichpath ( char *program, int *nlocate )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
static char pathbuff[256]; /* buffer for returned path */
char command[256]; /* which program */
FILE *whichout = NULL; /* which's stdout */
int nchars = 0, /* read whichout one char at a time*/
pathchar; /* fgetc(whichout) */
char *path = NULL; /* either pathbuff or NULL=error */
char *locatepath(); /* try locate if which fails */
int islocate = (nlocate==NULL? 1 : (*nlocate!=0?1:0)); /* 1=use locate*/
/* -------------------------------------------------------------------------
Issue which command and read its output
-------------------------------------------------------------------------- */
/* --- check if which() suppressed --- */
if ( !ISWHICH ) return ( NULL ); /*not running which, return failure*/
/* --- first construct the command --- */
if ( isempty(program) ) goto end_of_job; /* no input */
sprintf(command,"which %s",program); /* construct command */
/* --- use popen() to invoke which --- */
whichout = popen( command, "r" ); /* issue which and capture stdout */
if( whichout == NULL ) goto end_of_job; /* failed */
/* --- read the pipe one char at a time --- */
while ( (pathchar=fgetc(whichout)) /* get one more char */
!= EOF ) { /* not at eof yet */
pathbuff[nchars] = (char)pathchar; /* store the char */
if ( ++nchars >= 255 ) break; } /* don't overflow buffer */
pathbuff[nchars] = '\000'; /* null-terminate path */
trimwhite(pathbuff); /*remove leading/trailing whitespace*/
/* --- pclose() waits for command to terminate --- */
pclose( whichout ); /* finish */
if ( nchars > 0 ) { /* found path with which */
path = pathbuff; /* give user successful path */
if ( islocate && nlocate!=NULL ) *nlocate = 0; } /* signal we used which */
end_of_job:
if ( path == NULL ) /* which failed to find program */
if ( islocate ) /* and we're using locate */
path = locatepath(program,nlocate); /* try locate instead */
return ( path ); /* give caller path to command */
} /* --- end-of-function whichpath() --- */
/* ==========================================================================
* Function: locatepath ( program, nlocate )
* Purpose: determines the path to program with popen("locate 'program'")
* --------------------------------------------------------------------------
* Arguments: program (I) pointer to null-terminated char string
* containing program whose path is desired
* nlocate (O) addr to int returning #lines locate|grep
* found, or NULL to ignore
* --------------------------------------------------------------------------
* Returns: ( char * ) path to program, or NULL for any error
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
char *locatepath ( char *program, int *nlocate )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
static char pathbuff[256]; /* buffer for returned path */
char command[256]; /* locate program | grep /program$ */
FILE *locateout = NULL; /* locate's stdout */
char pathline[256]; /* read locateout one line at a time*/
int nlines = 0; /* #lines read */
int linelen=0, pathlen = 9999; /* choose shortest path */
char *path = NULL; /* either pathbuff or NULL=error */
/* -------------------------------------------------------------------------
Issue locate|grep command and read its output
-------------------------------------------------------------------------- */
/* --- first construct the command --- */
if ( isempty(program) ) goto end_of_job; /* no input */
/*if ( strlen(program) < 2 ) goto end_of_job; */ /* might run forever */
sprintf(command,"locate -q -r \"/%s$\" | grep \"bin\"",program);
/* --- use popen() to invoke locate|grep --- */
locateout = popen( command, "r" ); /* issue locate and capture stdout */
if( locateout == NULL ) goto end_of_job; /* failed */
/* --- read the pipe one line at a time --- */
while ( fgets(pathline,255,locateout) /* get next line */
!= NULL ) { /* not at eof yet */
trimwhite(pathline); /*remove leading/trailing whitespace*/
if ( (linelen=strlen(pathline)) > 0 ) { /* ignore empty lines */
if ( linelen < pathlen ) { /* new shortest path */
strcpy(pathbuff,pathline); /* store shortest for caller */
pathlen = linelen; } /* and reset new shortest length */
nlines++; } } /* count another non-empty line */
/* --- pclose() waits for command to terminate --- */
pclose( locateout ); /* finish */
if ( pathlen>0 && pathlen<256 ) path = pathbuff; /*give user successful path*/
if ( nlocate != NULL ) *nlocate = nlines; /* and number of locate|grep hits*/
end_of_job:
return ( path ); /* give caller path to command */
} /* --- end-of-function locatepath() --- */
/* ==========================================================================
* Function: presentwd ( int nsub )
* Purpose: determines pwd, nsub directories "up"
* --------------------------------------------------------------------------
* Arguments: nsub (I) int containing #subdirectories "up" to
* which path is wanted. 0 for pwd
* --------------------------------------------------------------------------
* Returns: ( char * ) path to pwd, or NULL for any error
* --------------------------------------------------------------------------
* Notes: o A forward / is always the last character
* ======================================================================= */
/* --- entry point --- */
char *presentwd ( int nsub )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
static char pathbuff[256]; /* buffer for returned path */
FILE *pwd = NULL; /* pwd's stdout */
char *path = NULL; /* either pathbuff or NULL=error */
int wdmethod = 1; /* 1=getcwd(), 2=popen("pwd","r") */
/* -------------------------------------------------------------------------
issue getcwd() call
-------------------------------------------------------------------------- */
if ( wdmethod == 1 ) { /* --- getcwd(pathbuff,255) --- */
if ( (path = getcwd(pathbuff,255)) /* get cwd */
== NULL ) goto end_of_job; /* failed */
trimwhite(pathbuff); } /*remove leading/trailing whitesapce*/
/* -------------------------------------------------------------------------
issue pwd command and read its output
-------------------------------------------------------------------------- */
if ( wdmethod == 2 ) { /* --- popen("pwd","r") --- */
/* --- use popen() to invoke pwd --- */
if ( (pwd = popen( "pwd", "r" )) /* issue pwd and capture stdout */
== NULL ) goto end_of_job; /* failed */
*pathbuff = '\000'; /* empty string in case fgets fails */
/* --- read the pipe one line at a time --- */
while ( fgets(pathbuff,255,pwd) /* get next line */
!= NULL ) { /* not at eof yet */
trimwhite(pathbuff); /*remove leading/trailing whitespace*/
if ( strlen(pathbuff) > 0 ) break; } /* try again if empty line */
/* --- pclose() waits for command to terminate --- */
pclose( pwd ); } /* finish */
/* -------------------------------------------------------------------------
strip leading directories
-------------------------------------------------------------------------- */
if ( nsub > 0 ) { /* caller wants path above pwd */
if ( lastchar(pathbuff) == '/' ) /* have terminating / */
*plastchar(pathbuff) = '\000'; /* strip it */
while ( nsub > 0 ) { /* still higher path wanted */
char *slash = strrchr(pathbuff,'/'); /* last / on path */
if ( slash == NULL ) break; /* can't go up any higher */
*slash = '\000'; /* truncate "/highestdir" from path */
nsub--; } /* we're now one path up */
} /* --- end-of-if(nsub>0) --- */
if ( lastchar(pathbuff) != '/' ) /* need terminating / */
strcat(pathbuff,"/"); /* add it */
/* --- back to caller --- */
path = pathbuff; /* successful path */
end_of_job:
return ( path ); /* give caller path */
} /* --- end-of-function presentwd() --- */
/* ==========================================================================
* Function: rrmdir ( path )
* Purpose: rm -r path
* --------------------------------------------------------------------------
* Arguments: path (I) pointer to null-terminated char string
* containing path to be rm'ed,
* relative to cwd.
* --------------------------------------------------------------------------
* Returns: ( int ) 0 = success, -1 = error
* --------------------------------------------------------------------------
* Notes: o Based on Program 4.7, pages 108-111, in
* Advanced Programming in the UNIX Environment,
* W. Richard Stevens, Addison-Wesley 1992, ISBN 0-201-56317-7
* ======================================================================= */
/* --- entry point --- */
int rrmdir ( char *path )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
DIR *directory = NULL; /* opendir() opens path directory */
struct dirent *entry = NULL; /* readdir() gives directory entry */
struct stat st_info; /* lstat() gives info about entry */
char nextpath[512], *pnext=NULL; /* recurse path/filename in dir */
int status = (-1); /* init in case of any error */
/* -------------------------------------------------------------------------
Check file type at path
-------------------------------------------------------------------------- */
if ( path != NULL ) /* have path argument */
if ( *path != '\000' ) /* and it's not an empty string */
if ( strcmp(path,".") != 0 /* and it's not "." */
&& strcmp(path,"..") != 0 ) /* and also not ".." */
status = lstat(path,&st_info); /* what kind of file is at path? */
if ( status < 0 ) goto end_of_job; /* no kind of file found at path */
/* -------------------------------------------------------------------------
Recurse level if file is a directory
-------------------------------------------------------------------------- */
if ( S_ISDIR(st_info.st_mode) ) { /* have a directory */
/* ---
* Initialization
* -------------- */
/* --- init path for each file in directory --- */
strcpy(nextpath,path); /* start with path from caller */
pnext = nextpath + strlen(path); /* ptr to '\000' at end of path */
if ( *(pnext-1) != '/' ) /* no trailing / at end of path */
*pnext++ = '/'; /* so add one */
*pnext = '\000'; /* null-terminate nextpath */
/* --- open the directory at caller's path (with trailing /) --- */
directory = opendir(nextpath); /* open the directory */
/* ---
* Run through all files in directory
* ---------------------------------- */
if ( directory != NULL ) { /* directory successfully opened */
while ( (entry = readdir(directory)) /* next entry in directory */
!= NULL ) /* NULL signals end-of-directory */
if ( strcmp(entry->d_name,".") != 0 /* filename not "." */
&& strcmp(entry->d_name,"..") != 0 ) { /* and also not ".." */
strcpy(pnext,entry->d_name); /* add filename to path */
status = rrmdir(nextpath); } /* recurse */
closedir(directory); /* close directory after last file */
showmsg(29,"rrmdir removing directory",path); /* show directory removed*/
} /* --- end-of-if(directory!=NULL) --- */
} /* --- end-of-if(S_ISDIR(st_info.st_mode)) --- */
else /* file isn't a directory */
showmsg(29," rrmdir removing file",path); /* show file removed */
/* -------------------------------------------------------------------------
Remove file or directory (keep it for debugging if msglevel>=9)
-------------------------------------------------------------------------- */
if ( msglevel < 9 ) status = remove(path); /* remove file or directory */
end_of_job:
return ( status );
} /* --- end-of-function rrmdir() --- */
/* ==========================================================================
* Function: rewritecache ( cachefile, maxage )
* Purpose: rewrites cached image file with headers and extra image info
* --------------------------------------------------------------------------
* Arguments: cachefile (I) pointer to null-terminated char string
* containing full path to existing image file
* written by dvipng or convert
* maxage (I) int containing maxage, in seconds, for
* http header
* --------------------------------------------------------------------------
* Returns: ( int ) #bytes in original image (0 signals error)
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int rewritecache ( char *cachefile, int maxage )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int nbytes=0, readcachefile(); /* read cache file */
FILE *rewriteptr = NULL; /* write cachefile back over itself*/
unsigned char buffer[MAXGIFSZ+1]; /* bytes from cachefile */
int i = 0; /* imageinfo[] index */
/* -------------------------------------------------------------------------
initialization
-------------------------------------------------------------------------- */
/* --- read original image file --- */
if ( (nbytes = readcachefile(cachefile,buffer)) /* read the file */
< 1 ) { /* file not read */
msgnumber = EMITFAILED; goto end_of_job; } /* signal error to caller */
/* --- re-open the file for write --- */
if ( (rewriteptr = fopen(cachefile,"wb")) /*open cachefile for binary write*/
== NULL ) { /* failed to open for write */
nbytes = 0; goto end_of_job; } /* signal error to caller */
/* --- first emit max-age http header --- */
fprintf( rewriteptr, "Cache-Control: max-age=%d\n",max2(0,maxage) );
/* --- now emit our "special" image info http headers --- */
for ( i=0; imageinfo[i].format!=NULL; i++ ) /* all imageinfo[] fields */
if ( (imageinfo[i].value) + 9999. > 1.0 ) { /*this field has actual value*/
double value = imageinfo[i].value; /* value from latex.info file */
char *units = imageinfo[i].units; /* value units, e.g., "pt" */
int algorithm= imageinfo[i].algorithm; /* conversion algorithm */
char *format = imageinfo[i].format; /* http header output format */
int px = 0; /* depth in px */
switch( algorithm ) { /* convert value for http header */
default: break;
case 1: /* depth in pts converted to px */
if ( 1 || (strstr(units,"pt")!=NULL) ) /* units are pts */
px = (int)((value/72.)*strtod(density,NULL) + 0.5); /* pts-to-px */
if ( algorithm == 1 ) px = (-px); /* vertical alignment is -depth */
fprintf( rewriteptr, format, px ); /* write http header for depth */
break;
} /* --- end-of- switch(algorithm) --- */
} /* --- end-of-if(imageinfo[i].value!=-9999) --- */
/* --- finally emit content length and type http headers --- */
fprintf( rewriteptr, "Content-Length: %d\n",nbytes );
fprintf( rewriteptr, "Content-type: image/%s\n\n",extensions[imagetype] );
/* -------------------------------------------------------------------------
rewrite bytes from cachefile
-------------------------------------------------------------------------- */
/* --- write bytes back to cachefile --- */
if ( fwrite(buffer,sizeof(unsigned char),nbytes,rewriteptr) /*write buffer*/
< nbytes ) /* failed to write all bytes */
nbytes = 0; /* reset total count to 0 */
end_of_job:
if ( rewriteptr != NULL ) fclose(rewriteptr); /* close cachefile */
return ( nbytes ); /* back with #bytes emitted */
} /* --- end-of-function rewritecache() --- */
/* ==========================================================================
* Function: emitcache ( cachefile, maxage, isbuffer )
* Purpose: dumps bytes from cachefile to stdout
* --------------------------------------------------------------------------
* Arguments: cachefile (I) pointer to null-terminated char string
* containing full path to file to be dumped,
* or contains buffer of bytes to be dumped
* maxage (I) int containing maxage, in seconds, for
* http header, or -1 to not emit headers
* isbuffer (I) >=1 if cachefile is buffer of bytes to be
* dumped, and if isbuffer>=9 it's the #bytes
* in buffer to be dumped. Otherwise,
* strlen(cachefile) determines #bytes.
* --------------------------------------------------------------------------
* Returns: ( int ) #bytes dumped (0 signals error)
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int emitcache ( char *cachefile, int maxage, int isbuffer )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int nbytes=0, readcachefile(); /* read cache file */
FILE *emitptr = stdout; /* emit cachefile to stdout */
unsigned char buffer[MAXGIFSZ+1]; /* bytes from cachefile */
unsigned char *buffptr = buffer; /* ptr to buffer */
/* -------------------------------------------------------------------------
initialization
-------------------------------------------------------------------------- */
/* --- check that files opened okay --- */
if ( emitptr == (FILE *)NULL ) /* failed to open emit file */
goto end_of_job; /* so return 0 bytes to caller */
/* --- read the file if necessary --- */
if ( isbuffer ) { /* cachefile is buffer */
buffptr = (unsigned char *)cachefile; /* so reset buffer pointer */
nbytes = (isbuffer<9?strlen((char *)buffptr):isbuffer); }/*determine #bytes*/
else /* cachefile is file name */
if ( (nbytes = readcachefile(cachefile,buffer)) /* read the file */
< 1 ) { /* file not read */
msgnumber = EMITFAILED; /* signal error */
goto end_of_job; } /* quit if file not read */
/* --- first emit http headers if requested --- */
if ( isdepth == 0 /* http headers not already in file*/
&& maxage >= 0 ) /* and caller wants http headers */
{ /* --- emit mime content-type line --- */
fprintf( emitptr, "Cache-Control: max-age=%d\n",maxage );
fprintf( emitptr, "Content-Length: %d\n",nbytes );
fprintf( emitptr, "Content-type: image/%s\n\n",extensions[imagetype] ); }
/* -------------------------------------------------------------------------
set stdout to binary mode (for Windows)
-------------------------------------------------------------------------- */
/* emitptr = fdopen(STDOUT_FILENO,"wb"); */ /* doesn't work portably, */
#ifdef WINDOWS /* so instead... */
#ifdef HAVE_SETMODE /* prefer (non-portable) setmode() */
if ( setmode ( fileno (stdout), O_BINARY) /* windows specific call */
== -1 ) ; /* handle error */ /* sets stdout to binary mode */
#else /* setmode() not available */
#if 1
freopen ("CON", "wb", stdout); /* freopen() stdout binary */
#else
stdout = fdopen (STDOUT_FILENO, "wb"); /* fdopen() stdout binary */
#endif
#endif
#endif
/* -------------------------------------------------------------------------
emit bytes from cachefile
-------------------------------------------------------------------------- */
/* --- write bytes to stdout --- */
if ( fwrite(buffptr,sizeof(unsigned char),nbytes,emitptr) /* write buffer */
< nbytes ) /* failed to write all bytes */
nbytes = 0; /* reset total count to 0 */
end_of_job:
return ( nbytes ); /* back with #bytes emitted */
} /* --- end-of-function emitcache() --- */
/* ==========================================================================
* Function: readcachefile ( cachefile, buffer )
* Purpose: read cachefile into buffer
* --------------------------------------------------------------------------
* Arguments: cachefile (I) pointer to null-terminated char string
* containing full path to file to be read
* buffer (O) pointer to unsigned char string
* returning contents of cachefile
* --------------------------------------------------------------------------
* Returns: ( int ) #bytes read (0 signals error)
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int readcachefile ( char *cachefile, unsigned char *buffer )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
FILE *cacheptr = fopen(cachefile,"rb"); /*open cachefile for binary read*/
unsigned char cachebuff[512]; /* bytes from cachefile */
int buflen = 256, /* #bytes we try to read from file */
nread = 0, /* #bytes actually read from file */
maxbytes = MAXGIFSZ, /* max #bytes returned in buffer */
nbytes = 0; /* total #bytes read */
/* -------------------------------------------------------------------------
initialization
-------------------------------------------------------------------------- */
/* --- check that files opened okay --- */
if ( cacheptr == (FILE *)NULL ) goto end_of_job; /*failed to open cachefile*/
/* --- check that output buffer provided --- */
if ( buffer == (unsigned char *)NULL ) goto end_of_job; /* no buffer */
/* -------------------------------------------------------------------------
read bytes from cachefile
-------------------------------------------------------------------------- */
while ( 1 )
{
/* --- read bytes from cachefile --- */
nread = fread(cachebuff,sizeof(unsigned char),buflen,cacheptr); /* read */
if ( nbytes + nread > maxbytes ) /* block too big for buffer */
nread = maxbytes - nbytes; /* so truncate it */
if ( nread < 1 ) break; /* no bytes left in cachefile */
/* --- store bytes in buffer --- */
memcpy(buffer+nbytes,cachebuff,nread); /* copy current block to buffer */
/* --- ready to read next block --- */
nbytes += nread; /* bump total #bytes emitted */
if ( nread < buflen ) break; /* no bytes left in cachefile */
if ( nbytes >= maxbytes ) break; /* avoid buffer overflow */
} /* --- end-of-while(1) --- */
end_of_job:
if ( cacheptr != NULL ) fclose(cacheptr); /* close file if opened */
return ( nbytes ); /* back with #bytes emitted */
} /* --- end-of-function readcachefile() --- */
/* ==========================================================================
* Function: crc16 ( s )
* Purpose: 16-bit crc of string s
* --------------------------------------------------------------------------
* Arguments: s (I) pointer to null-terminated char string
* whose crc is desired
* --------------------------------------------------------------------------
* Returns: ( int ) 16-bit crc of s
* --------------------------------------------------------------------------
* Notes: o From Numerical Recipes in C, 2nd ed, page 900.
* ======================================================================= */
/* --- entry point --- */
int crc16 ( char *s )
{
/* -------------------------------------------------------------------------
Compute the crc
-------------------------------------------------------------------------- */
unsigned short crc = 0; /* returned crc */
int ibit; /* for(ibit) eight one-bit shifts */
while ( !isempty(s) ) { /* while there are still more chars*/
crc = (crc ^ (*s)<<8); /* add next char */
for ( ibit=0; ibit<8; ibit++ ) /* generator polynomial */
if ( crc & 0x8000 ) { crc<<=1; crc=crc^4129; }
else crc <<= 1;
s++; /* next xhar */
} /* --- end-of-while(!isempty(s)) --- */
return ( (int)crc ); /* back to caller with crc */
} /* --- end-of-function crc16() --- */
/* ==========================================================================
* Function: md5str ( instr )
* Purpose: returns null-terminated character string containing
* md5 hash of instr (input string)
* --------------------------------------------------------------------------
* Arguments: instr (I) pointer to null-terminated char string
* containing input string whose md5 hash
* is desired
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to null-terminated 32-character
* md5 hash of instr
* --------------------------------------------------------------------------
* Notes: o Other md5 library functions are included below.
* They're all taken from Christophe Devine's code,
* which (as of 04-Aug-2004) is available from
* http://www.cr0.net:8040/code/crypto/md5/
* o The P,F,S macros in the original code are replaced
* by four functions P1()...P4() to accommodate a problem
* with Compaq's vax/vms C compiler.
* ======================================================================= */
/* --- #include "md5.h" --- */
#ifndef uint8
#define uint8 unsigned char
#endif
#ifndef uint32
#define uint32 unsigned long int
#endif
typedef struct
{ uint32 total[2];
uint32 state[4];
uint8 buffer[64];
} md5_context;
void md5_starts( md5_context *ctx );
void md5_update( md5_context *ctx, uint8 *input, uint32 length );
void md5_finish( md5_context *ctx, uint8 digest[16] );
/* --- md5.h --- */
#define GET_UINT32(n,b,i) \
{ (n) = ( (uint32) (b)[(i) ] ) \
| ( (uint32) (b)[(i) + 1] << 8 ) \
| ( (uint32) (b)[(i) + 2] << 16 ) \
| ( (uint32) (b)[(i) + 3] << 24 ); }
#define PUT_UINT32(n,b,i) \
{ (b)[(i) ] = (uint8) ( (n) ); \
(b)[(i) + 1] = (uint8) ( (n) >> 8 ); \
(b)[(i) + 2] = (uint8) ( (n) >> 16 ); \
(b)[(i) + 3] = (uint8) ( (n) >> 24 ); }
/* --- P,S,F macros defined as functions --- */
void P1(uint32 *X,uint32 *a,uint32 b,uint32 c,uint32 d,int k,int s,uint32 t)
{ *a += (uint32)(d ^ (b & (c ^ d))) + X[k] + t;
*a = ((*a<<s) | ((*a & 0xFFFFFFFF) >> (32-s))) + b;
return; }
void P2(uint32 *X,uint32 *a,uint32 b,uint32 c,uint32 d,int k,int s,uint32 t)
{ *a += (uint32)(c ^ (d & (b ^ c))) + X[k] + t;
*a = ((*a<<s) | ((*a & 0xFFFFFFFF) >> (32-s))) + b;
return; }
void P3(uint32 *X,uint32 *a,uint32 b,uint32 c,uint32 d,int k,int s,uint32 t)
{ *a += (uint32)(b ^ c ^ d) + X[k] + t;
*a = ((*a<<s) | ((*a & 0xFFFFFFFF) >> (32-s))) + b;
return; }
void P4(uint32 *X,uint32 *a,uint32 b,uint32 c,uint32 d,int k,int s,uint32 t)
{ *a += (uint32)(c ^ (b | ~d)) + X[k] + t;
*a = ((*a<<s) | ((*a & 0xFFFFFFFF) >> (32-s))) + b;
return; }
/* --- entry point (this one little stub written by me)--- */
char *md5str( char *instr )
{ static char outstr[64];
unsigned char md5sum[16];
md5_context ctx;
int j;
md5_starts( &ctx );
md5_update( &ctx, (uint8 *)instr, strlen(instr) );
md5_finish( &ctx, md5sum );
for( j=0; j<16; j++ )
sprintf( outstr + j*2, "%02x", md5sum[j] );
outstr[32] = '\000';
return ( outstr ); }
/* --- entry point (all md5 functions below by Christophe Devine) --- */
void md5_starts( md5_context *ctx )
{ ctx->total[0] = 0;
ctx->total[1] = 0;
ctx->state[0] = 0x67452301;
ctx->state[1] = 0xEFCDAB89;
ctx->state[2] = 0x98BADCFE;
ctx->state[3] = 0x10325476; }
void md5_process( md5_context *ctx, uint8 data[64] )
{ uint32 X[16], A, B, C, D;
GET_UINT32( X[0], data, 0 );
GET_UINT32( X[1], data, 4 );
GET_UINT32( X[2], data, 8 );
GET_UINT32( X[3], data, 12 );
GET_UINT32( X[4], data, 16 );
GET_UINT32( X[5], data, 20 );
GET_UINT32( X[6], data, 24 );
GET_UINT32( X[7], data, 28 );
GET_UINT32( X[8], data, 32 );
GET_UINT32( X[9], data, 36 );
GET_UINT32( X[10], data, 40 );
GET_UINT32( X[11], data, 44 );
GET_UINT32( X[12], data, 48 );
GET_UINT32( X[13], data, 52 );
GET_UINT32( X[14], data, 56 );
GET_UINT32( X[15], data, 60 );
A = ctx->state[0];
B = ctx->state[1];
C = ctx->state[2];
D = ctx->state[3];
P1( X, &A, B, C, D, 0, 7, 0xD76AA478 );
P1( X, &D, A, B, C, 1, 12, 0xE8C7B756 );
P1( X, &C, D, A, B, 2, 17, 0x242070DB );
P1( X, &B, C, D, A, 3, 22, 0xC1BDCEEE );
P1( X, &A, B, C, D, 4, 7, 0xF57C0FAF );
P1( X, &D, A, B, C, 5, 12, 0x4787C62A );
P1( X, &C, D, A, B, 6, 17, 0xA8304613 );
P1( X, &B, C, D, A, 7, 22, 0xFD469501 );
P1( X, &A, B, C, D, 8, 7, 0x698098D8 );
P1( X, &D, A, B, C, 9, 12, 0x8B44F7AF );
P1( X, &C, D, A, B, 10, 17, 0xFFFF5BB1 );
P1( X, &B, C, D, A, 11, 22, 0x895CD7BE );
P1( X, &A, B, C, D, 12, 7, 0x6B901122 );
P1( X, &D, A, B, C, 13, 12, 0xFD987193 );
P1( X, &C, D, A, B, 14, 17, 0xA679438E );
P1( X, &B, C, D, A, 15, 22, 0x49B40821 );
P2( X, &A, B, C, D, 1, 5, 0xF61E2562 );
P2( X, &D, A, B, C, 6, 9, 0xC040B340 );
P2( X, &C, D, A, B, 11, 14, 0x265E5A51 );
P2( X, &B, C, D, A, 0, 20, 0xE9B6C7AA );
P2( X, &A, B, C, D, 5, 5, 0xD62F105D );
P2( X, &D, A, B, C, 10, 9, 0x02441453 );
P2( X, &C, D, A, B, 15, 14, 0xD8A1E681 );
P2( X, &B, C, D, A, 4, 20, 0xE7D3FBC8 );
P2( X, &A, B, C, D, 9, 5, 0x21E1CDE6 );
P2( X, &D, A, B, C, 14, 9, 0xC33707D6 );
P2( X, &C, D, A, B, 3, 14, 0xF4D50D87 );
P2( X, &B, C, D, A, 8, 20, 0x455A14ED );
P2( X, &A, B, C, D, 13, 5, 0xA9E3E905 );
P2( X, &D, A, B, C, 2, 9, 0xFCEFA3F8 );
P2( X, &C, D, A, B, 7, 14, 0x676F02D9 );
P2( X, &B, C, D, A, 12, 20, 0x8D2A4C8A );
P3( X, &A, B, C, D, 5, 4, 0xFFFA3942 );
P3( X, &D, A, B, C, 8, 11, 0x8771F681 );
P3( X, &C, D, A, B, 11, 16, 0x6D9D6122 );
P3( X, &B, C, D, A, 14, 23, 0xFDE5380C );
P3( X, &A, B, C, D, 1, 4, 0xA4BEEA44 );
P3( X, &D, A, B, C, 4, 11, 0x4BDECFA9 );
P3( X, &C, D, A, B, 7, 16, 0xF6BB4B60 );
P3( X, &B, C, D, A, 10, 23, 0xBEBFBC70 );
P3( X, &A, B, C, D, 13, 4, 0x289B7EC6 );
P3( X, &D, A, B, C, 0, 11, 0xEAA127FA );
P3( X, &C, D, A, B, 3, 16, 0xD4EF3085 );
P3( X, &B, C, D, A, 6, 23, 0x04881D05 );
P3( X, &A, B, C, D, 9, 4, 0xD9D4D039 );
P3( X, &D, A, B, C, 12, 11, 0xE6DB99E5 );
P3( X, &C, D, A, B, 15, 16, 0x1FA27CF8 );
P3( X, &B, C, D, A, 2, 23, 0xC4AC5665 );
P4( X, &A, B, C, D, 0, 6, 0xF4292244 );
P4( X, &D, A, B, C, 7, 10, 0x432AFF97 );
P4( X, &C, D, A, B, 14, 15, 0xAB9423A7 );
P4( X, &B, C, D, A, 5, 21, 0xFC93A039 );
P4( X, &A, B, C, D, 12, 6, 0x655B59C3 );
P4( X, &D, A, B, C, 3, 10, 0x8F0CCC92 );
P4( X, &C, D, A, B, 10, 15, 0xFFEFF47D );
P4( X, &B, C, D, A, 1, 21, 0x85845DD1 );
P4( X, &A, B, C, D, 8, 6, 0x6FA87E4F );
P4( X, &D, A, B, C, 15, 10, 0xFE2CE6E0 );
P4( X, &C, D, A, B, 6, 15, 0xA3014314 );
P4( X, &B, C, D, A, 13, 21, 0x4E0811A1 );
P4( X, &A, B, C, D, 4, 6, 0xF7537E82 );
P4( X, &D, A, B, C, 11, 10, 0xBD3AF235 );
P4( X, &C, D, A, B, 2, 15, 0x2AD7D2BB );
P4( X, &B, C, D, A, 9, 21, 0xEB86D391 );
ctx->state[0] += A;
ctx->state[1] += B;
ctx->state[2] += C;
ctx->state[3] += D; }
void md5_update( md5_context *ctx, uint8 *input, uint32 length )
{ uint32 left, fill;
if( length < 1 ) return;
left = ctx->total[0] & 0x3F;
fill = 64 - left;
ctx->total[0] += length;
ctx->total[0] &= 0xFFFFFFFF;
if( ctx->total[0] < length )
ctx->total[1]++;
if( left && length >= fill )
{ memcpy( (void *) (ctx->buffer + left),
(void *) input, fill );
md5_process( ctx, ctx->buffer );
length -= fill;
input += fill;
left = 0; }
while( length >= 64 )
{ md5_process( ctx, input );
length -= 64;
input += 64; }
if( length >= 1 )
memcpy( (void *) (ctx->buffer + left),
(void *) input, length ); }
void md5_finish( md5_context *ctx, uint8 digest[16] )
{ static uint8 md5_padding[64] =
{ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
uint32 last, padn;
uint32 high, low;
uint8 msglen[8];
high = ( ctx->total[0] >> 29 )
| ( ctx->total[1] << 3 );
low = ( ctx->total[0] << 3 );
PUT_UINT32( low, msglen, 0 );
PUT_UINT32( high, msglen, 4 );
last = ctx->total[0] & 0x3F;
padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
md5_update( ctx, md5_padding, padn );
md5_update( ctx, msglen, 8 );
PUT_UINT32( ctx->state[0], digest, 0 );
PUT_UINT32( ctx->state[1], digest, 4 );
PUT_UINT32( ctx->state[2], digest, 8 );
PUT_UINT32( ctx->state[3], digest, 12 ); }
/* --- end-of-function md5str() and "friends" --- */
/* ==========================================================================
* Functions: int unescape_url ( char *url )
* char x2c ( char *what )
* Purpose: unescape_url replaces 3-character sequences %xx in url
* with the single character represented by hex xx.
* x2c returns the single character represented by hex xx
* passed as a 2-character sequence in what.
* --------------------------------------------------------------------------
* Arguments: url (I) char * containing null-terminated
* string with embedded %xx sequences
* to be converted.
* what (I) char * whose first 2 characters are
* interpreted as ascii representations
* of hex digits.
* --------------------------------------------------------------------------
* Returns: ( int ) length of url string after replacements.
* ( char ) x2c returns the single char
* corresponding to hex xx passed in what.
* --------------------------------------------------------------------------
* Notes: o These two functions were taken from util.c in
* ftp://ftp.ncsa.uiuc.edu/Web/httpd/Unix/ncsa_httpd/cgi/ncsa-default.tar.Z
* o Added ^M,^F,etc, and +'s to blank xlation 0n 01-Oct-06
* ======================================================================= */
/* --- entry point --- */
int unescape_url ( char *url ) {
int x=0, y=0;
char x2c();
static char *hex="0123456789ABCDEFabcdef";
int xlatectrl=1, xlateblank=0/*1*/;
/* ---
* first xlate ctrl chars and +'s to blanks
* ---------------------------------------- */
if ( xlatectrl || xlateblank ) { /*xlate ctrl chars and +'s to blanks*/
char *ctrlchars = (!xlateblank? "\n\t\v\b\r\f\a\015" :
(!xlatectrl? "+" : "+\n\t\v\b\r\f\a\015" ));
int urllen = strlen(url); /* total length of url string */
/* --- replace ctrlchars with blanks --- */
while ( (x=strcspn(url,ctrlchars)) < urllen ) /* found a ctrlchar */
url[x] = ' '; /*replace ctrl char or + with blank*/
/* --- get rid of leading/trailing ctrlchars (now whitespace) --- */
trimwhite(url); /*remove leading/trailing whitespace*/
} /* --- end-of-if(xlatectrl||xlateblank) --- */
/* ---
* now xlate %nn to corresponding char (original ncsa code)
* -------------------------------------------------------- */
for(x=y=0;url[y];++x,++y)
if((url[x] = url[y]) == '%')
if(isthischar(url[y+1],hex)
&& isthischar(url[y+2],hex))
{ url[x] = x2c(&url[y+1]);
y+=2; }
url[x] = '\000';
return x;
} /* --- end-of-function unescape_url() --- */
/* --- entry point --- */
char x2c(char *what) {
char digit;
digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0'));
digit *= 16;
digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A')+10 : (what[1] - '0'));
return(digit);
} /* --- end-of-function x2c() --- */
/* ==========================================================================
* Function: timelimit ( char *command, int killtime )
* Purpose: Issues a system(command) call, but throttles command
* after killtime seconds if it hasn't already completed.
* --------------------------------------------------------------------------
* Arguments: command (I) char * to null-terminated string
* containing system(command) to be executed
* killtime (I) int containing maximum #seconds
* to allow command to run
* --------------------------------------------------------------------------
* Returns: ( int ) return status from command,
* or -1 for any error.
* --------------------------------------------------------------------------
* Notes: o The timelimit() code is adapted from
* http://devel.ringlet.net/sysutils/timelimit/
* Compile with -DTIMELIMIT=\"$(which timelimit)\" to use an
* installed copy of timelimit rather than this built-in code.
* o if symbol ISCOMPILETIMELIMIT is false, a stub function
* that just issues system(command) is compiled instead.
* ======================================================================= */
#if !ISCOMPILETIMELIMIT
/* --- entry point for stub timelimit() function --- */
int timelimit(char *command, int killtime) {
if ( isempty(command) ) /* no command given */
return( (killtime==(-99)?991:(-1)) ); /* return -1 or stub identifier */
return ( system(command) ); } /* just issue system(command) */
#else
/* --- entry points for signal handlers --- */
void sigchld(int sig) { fdone = 1; }
void sigalrm(int sig) { falarm = 1; }
void sighandler(int sig) { sigcaught = sig; fsig = 1; }
/* --- entry point --- */
int timelimit(char *command, int killtime)
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
pid_t pid = 0;
int killsig = (int)(SIGKILL);
int setsignal();
int status = (-1);
/* -------------------------------------------------------------------------
check args
-------------------------------------------------------------------------- */
if ( isempty(command) ) /* no command given */
return( (killtime==(-99)?992:(-1)) ); /* return -1 or built-in identifier*/
if ( killtime < 1 ) return ( system(command) ); /* throttling disabled */
if ( killtime > 999 ) killtime = 999; /* default maximum to 999 seconds */
/* -------------------------------------------------------------------------
install signal handlers
-------------------------------------------------------------------------- */
fdone = falarm = fsig = sigcaught = 0;
if ( setsignal(SIGALRM, sigalrm) < 0 ) return(-1);
if ( setsignal(SIGCHLD, sigchld) < 0 ) return(-1);
if ( setsignal(SIGTERM, sighandler) < 0 ) return(-1);
if ( setsignal(SIGHUP, sighandler) < 0 ) return(-1);
if ( setsignal(SIGINT, sighandler) < 0 ) return(-1);
if ( setsignal(SIGQUIT, sighandler) < 0 ) return(-1);
/* -------------------------------------------------------------------------
fork off the child process
-------------------------------------------------------------------------- */
fflush(NULL); /* flush all buffers before fork */
if ( (pid=fork()) < 0 ) return(-1); /* failed to fork */
if ( pid == 0 ) { /* child process... */
status = system(command); /* ...submits command */
_exit(status); } /* and _exits without user cleanup */
/* -------------------------------------------------------------------------
parent process sleeps for allowed time
-------------------------------------------------------------------------- */
alarm(killtime);
while ( !(fdone||falarm||fsig) ) pause();
alarm(0);
/* -------------------------------------------------------------------------
send kill signal if child hasn't completed command
-------------------------------------------------------------------------- */
if ( fsig ) return(-1); /* some other signal stopped child */
if ( !fdone ) kill(pid, killsig); /* not done, so kill it */
/* -------------------------------------------------------------------------
return status of child pid
-------------------------------------------------------------------------- */
if ( waitpid(pid, &status, 0) == -1 ) return(-1); /* can't get status */
if ( 1 ) return(status); /* return status to caller */
#if 0 /* interpret status */
if ( WIFEXITED(status) )
return (WEXITSTATUS(status));
else if ( WIFSIGNALED(status) )
return (WTERMSIG(status) + 128);
else
return (EX_OSERR);
#endif
} /* --- end-of-function timelimit() --- */
/* --- entry point --- */
int setsignal ( int sig, void (*handler)(int) )
{
#ifdef HAVE_SIGACTION
struct sigaction act;
memset(&act, 0, sizeof(act));
act.sa_handler = handler;
act.sa_flags = 0;
#ifdef SA_NOCLDSTOP
act.sa_flags |= SA_NOCLDSTOP;
#endif
if (sigaction(sig, &act, NULL) < 0) return(-1);
#else
if (signal(sig, handler) == SIG_ERR) return(-1);
#endif
return(0);
} /* --- end-of-function setsignal() --- */
#endif /* ISCOMPILETIMELIMIT */
/* ==========================================================================
* Function: getdirective(string, directive, iscase, isvalid, nargs, args)
* Purpose: Locates the first \directive{arg1}...{nargs} in string,
* returns arg1...nargs in args[],
* and removes \directive and its args from string.
* --------------------------------------------------------------------------
* Arguments: string (I/0) char * to null-terminated string from which
* the first occurrence of \directive will be
* interpreted and removed
* directive (I) char * to null-terminated string containing
* the \directive to be interpreted in string
* iscase (I) int containing 1 if match of \directive
* in string should be case-sensitive,
* or 0 if match is case-insensitive.
* isvalid (I) int containing validity check option:
* 0=no checks, 1=must be numeric
* nargs (I) int containing (maximum) number of
* {args} following \directive, or 0 if none.
* args (O) void * interpreted as (char *) if nargs=1
* to return the one and only arg,
* or interpreted as (char **) if nargs>1
* to array of returned arg strings
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to first char after removed \directive, or
* NULL if \directive not found, or any error.
* --------------------------------------------------------------------------
* Notes: o If optional [arg]'s are found, they're stored in the global
* optionalargs[] buffer, and the noptional counter is bumped.
* o set global argformat's decimal digits for each arg,
* e.g., 1357... means 1 for 1st arg, 3 for 2nd, 5 for 3rd, etc.
* 0 for an arg is the default format (i.e., argformat=0),
* and means it's formatted as a LaTeX {arg} or [arg].
* 1 for an arg means arg terminated by first non-alpha char
* 2 means arg terminated by { (e.g., as for /def)
* 8 means arg terminated by first whitespace char
* ======================================================================= */
/* --- entry point --- */
char *getdirective ( char *string, char *directive,
int iscase, int isvalid, int nargs, void *args )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int iarg = (-1); /* init to signal error */
char *pfirst = NULL, /* ptr to 1st char of directive */
*plast = NULL, /* ptr past last char of last arg */
*plbrace=NULL, *prbrace=NULL; /* ptr to left,right brace of arg */
int fldlen = 0; /* #chars between { and } delims */
char argfld[512]; /* {arg} characters */
int nfmt=0, /*isnegfmt=0,*/ /* {arg} format */
argfmt[9]={0,0,0,0,0,0,0,0,0}; /* argformat digits */
int gotargs = (args==NULL?0:1); /* true if args array supplied */
int isdalpha = 1; /* true if directive ends with alpha*/
char *strpspn(char *s,char *reject,char *segment); /*non-() not in rej*/
/* -------------------------------------------------------------------------
Find first \directive in string
-------------------------------------------------------------------------- */
noptional = 0; /* no optional [args] yet */
for ( iarg=0; iarg<8; iarg++ ) /* for each one... */
*optionalargs[iarg] = '\000'; /* re-init optional [arg] buffer */
if ( argformat != 0 ) { /* have argformat */
int myfmt = argformat; /* local copy */
if ( myfmt < 0 ) { /*isnegfmt=1;*/ myfmt=(-myfmt); } /* check sign */
while ( myfmt>0 && nfmt<9 ) { /* have more format digits */
argfmt[nfmt] = myfmt%10; /* store low-order decimal digit */
myfmt /= 10; /* and shift it out */
nfmt++; } /* count another format digit */
} /* --- end-of-if(argformat!=0) --- */
if ( isempty(directive) ) goto end_of_job; /* no input \directive given */
if ( !isalpha((int)(directive[strlen(directive)-1])) )isdalpha=0;/*not alpha*/
pfirst = string; /* start at beginning of string */
while ( 1 ) { /* until we find \directive */
if ( !isempty(pfirst) ) /* still have string from caller */
pfirst = /* ptr to 1st char of directive */
(iscase>0? strstr(pfirst,directive): /* case-sensistive match */
strcasestr(pfirst,directive)); /* case-insensistive match */
if ( isempty(pfirst) ) { /* \directive not found in string */
pfirst = NULL; /* signal \directive not found */
goto end_of_job; } /* quit, signalling error to caller*/
plast = pfirst + strlen(directive); /*ptr to fist char past directive*/
if ( !isdalpha || !isalpha((int)(*plast)) ) break; /* found \directive */
pfirst = plast; /* keep looking */
plast = NULL; /* reset plast */
} /* --- end-of-while(1) --- */
if ( nargs < 0 ) { /* optional [arg] may be present */
nargs = -nargs; /* flip sign back to positive */
/*noptional = 1;*/ } /* and set optional flag */
/* -------------------------------------------------------------------------
Get arguments
-------------------------------------------------------------------------- */
iarg = 0; /* no args yet */
if ( nargs > 0 ) /* \directive has {args} */
while ( iarg < nargs+noptional ) { /* get each arg */
int karg = iarg-noptional; /* non-optional arg index */
int kfmt = (nfmt<=karg?0:argfmt[nfmt-karg-1]); /* arg format digit */
/* --- find left { and right } arg delimiters --- */
plbrace = plast; /*ptr to fist char past previous arg*/
skipwhite(plbrace); /* push it to first non-white char */
if ( isempty(plbrace) ) break; /* reached end-of-string */
/* --- check LaTeX for single-char arg or {arg} or optional [arg] --- */
if ( kfmt == 0 ) { /* interpret LaTeX {arg} format */
if ( !isthischar(*plbrace,(iarg==optionalpos+noptional?"{[":"{")) ) {
/* --- single char argument --- */
plast = plbrace + 1; /* first char after single-char arg*/
argfld[0] = *plbrace; /* arg field is this one char */
argfld[1] = '\000'; } /* null-terminate field */
else { /* have {arg} or optional [arg] */
/* note: to use for validation, need robust {} match like strpspn() */
if ( (prbrace = strchr(plbrace,(*plbrace=='{'?'}':']'))) /*right }or]*/
== NULL ) break; /*and no more args if no right brace*/
if ( 1 ) /* true to use strpspn() */
prbrace = strpspn(plbrace,NULL,NULL); /* push to matching } or ] */
plast = prbrace + 1; /* first char after right brace */
/* --- extract arg field between { and } delimiters --- */
fldlen = (int)(prbrace-plbrace) - 1; /* #chars between { and } delims*/
if ( fldlen >= 256 ) fldlen=255; /* don't overflow argfld[] buffer */
if ( fldlen > 0 ) /* have chars in field */
memcpy(argfld,plbrace+1,fldlen); /*copy field chars to local buffer*/
argfld[fldlen] = '\000'; /* and null-terminate field */
trimwhite(argfld); /* trim whitespace from argfld */
} /* --- end-of-if/else(!isthischar(*plbrace,...)) --- */
} /* --- end-of-if(kfmt==0) --- */
/* --- check plain TeX for arg terminated by whitespace --- */
if ( kfmt != 0 ) { /* interpret plain TeX arg format */
char *parg = NULL; /* ptr into arg, used as per kfmt */
plast = plbrace; /* start at first char of arg */
if ( *plast == '\\' ) plast++; /* skip leading \command backslash */
/* --- interpret arg according to its format --- */
switch ( kfmt ) {
case 1:
default: skipcommand(plast); break; /* push ptr to non-alpha char */
case 2: parg = strchr(plast,'{'); /* next arg always starts with { */
if ( parg != NULL ) plast=parg; else plast++; /* up to { or 1 char */
break;
case 8: findwhite(plast); break; /*ptr to whitespace after last char*/
} /* --- end-of-switch(kfmt) --- */
/* --- extract arg field --- */
fldlen = (int)(plast-plbrace); /* #chars between in field */
if ( fldlen >= 256 ) fldlen=255; /* don't overflow argfld[] buffer */
if ( fldlen > 0 ) /* have chars in field */
memcpy(argfld,plbrace,fldlen); /*copy field chars to local buffer*/
argfld[fldlen] = '\000'; /* and null-terminate field */
if ( 1 ) { trimwhite(argfld); } /* trim whitespace from argfld */
} /* --- end-of-if(kfmt!=0) --- */
if ( isvalid != 0 ) { /* argfld[] validity check desired */
if ( isvalid == 1 ) { /* numeric check wanted */
int validlen = strspn(argfld," +-.0123456789"); /*very simple check*/
argfld[validlen] = '\000'; } /* truncate invalid chars */
} /* --- end-of-if(isvalid!=0) --- */
/* --- store argument field in caller's array --- */
if ( kfmt==0 && *plbrace=='[' ) { /*store [arg] as optionalarg instead*/
if ( noptional < 8 ) { /* don't overflow our buffer */
strninit(optionalargs[noptional],argfld,254); } /*copy to optionalarg*/
noptional++; } /* count another optional [arg] */
else /*{args} returned in caller's array*/
if ( gotargs ) { /*caller supplied address or array*/
if ( nargs < 2 ) /*just one arg, so it's an address*/
strcpy((char *)args,argfld); /* so copy arg field there */
else { /* >1 arg, so it's a ptr array */
char *argptr = ((char **)args)[karg]; /* arg ptr in array of ptrs */
if ( argptr != NULL ) /* array has iarg-th address */
strcpy(argptr,argfld); /* so copy arg field there */
else gotargs = 0; } } /* no more addresses in array */
/* --- completed this arg --- */
iarg++; /* bump arg count */
} /* --- end-of-while(iarg<nargs) --- */
/* -------------------------------------------------------------------------
Back to caller
-------------------------------------------------------------------------- */
end_of_job:
if ( 1 ) argformat = 0; /* always/never reset global arg */
if ( 1 ) optionalpos = 0; /* always/never reset global arg */
if ( pfirst!=NULL && plast!=NULL ) /* have directive field delims */
{strsqueeze(pfirst,((int)(plast-pfirst)));} /* squeeze out directive */
return ( pfirst ); /* ptr to 1st char after directive */
} /* --- end-of-function getdirective() --- */
/* ==========================================================================
* Function: mathprep ( expression )
* Purpose: preprocessor for mathTeX input, e.g.,
* (a) removes leading/trailing $'s from $$expression$$
* (b) xlates &html; special chars to equivalent latex
* (c) xlates &#nnn; special chars to equivalent latex
* Should only be called once (after unescape_url())
* --------------------------------------------------------------------------
* Arguments: expression (I/O) char * to first char of null-terminated
* string containing mathTeX/LaTeX expression,
* and returning preprocessed string
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to input expression,
* or NULL for any parsing error.
* --------------------------------------------------------------------------
* Notes: o The ten special symbols $ & % # _ { } ~ ^ \ are reserved
* for use in LaTeX commands. The corresponding directives
* \$ \& \% \# \_ \{ \} display the first seven, respectively,
* and \backslash displays \. It's not clear to me whether
* or not mathprep() should substitute the displayed symbols,
* e.g., whether $ better xlates to \$ or to $.
* Right now, it's the latter.
* ======================================================================= */
/* --- entry point --- */
char *mathprep ( char *expression )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int isym=0, inum=0; /* symbols[], numbers[] indexes */
char *strchange(); /* change leading chars of string */
char *strwstr(); /*use strwstr() instead of strstr()*/
int strreplace(); /* substitute/from/to/ */
int ndollars = 0; /* #leading/trailing $$...$$'s */
int explen = (isempty(expression)?0:strlen(expression)); /*#input chars*/
/* ---
* html special/escape chars converted to latex equivalents
* -------------------------------------------------------- */
char *htmlsym=NULL; /* symbols[isym].html */
static struct { char *html; char *termchar; char *latex; } symbols[] =
{ /* ---------------------------------------------------------
user-supplied newcommands (different than -DNEWCOMMAND)
--------------------------------------------------------- */
#ifdef NEWCOMMANDS /* -DNEWCOMMANDS=\"filename.h\" */
#include NEWCOMMANDS
#endif
/* ----------------------------------------
html char termchar LaTeX equivalent...
---------------------------------------- */
{ """, ";", "\"" }, /* " is first, " */
{ "&", ";", "&" },
{ "<", ";", "<" },
{ ">", ";", ">" },
{ "&backslash",";", "\\" },
{ " ", ";", " " /*"~"*/ },
{ "¡", ";", "{\\mbox{!`}}" },
{ "¦", ";", "|" },
{ "±", ";", "\\pm" },
{ "²", ";", "{{}^2}" },
{ "³", ";", "{{}^3}" },
{ "µ", ";", "\\mu" },
{ "¹", ";", "{{}^1}" },
{ "¼", ";", "{\\frac14}" },
{ "½", ";", "{\\frac12}" },
{ "¾", ";", "{\\frac34}" },
{ "¿", ";", "{\\mbox{?`}}" },
{ "Â", ";", "{\\rm\\hat A}" },
{ "Ã", ";", "{\\rm\\tilde A}" },
{ "Ä", ";", "{\\rm\\ddot A}" },
{ "Å", ";", "{\\overset{o}{\\rm A}}" },
{ "ã", ";", "{\\rm\\tilde a}" },
{ "ÿ", ";", "{\\rm\\ddot y}" }, /* ÿ is last, ÿ */
{ "&#", ";", "{[\\&\\#nnn?]}" }, /* all other &#nnn's */
/* ----------------------------------------
html tag termchar LaTeX equivalent...
---------------------------------------- */
{ "< br >", NULL, " \000" /*"\\\\"*/ },
{ "< br / >", NULL, " \000" /*"\\\\"*/ },
{ "< dd >", NULL, " \000" },
{ "< / dd >", NULL, " \000" },
{ "< dl >", NULL, " \000" },
{ "< / dl >", NULL, " \000" },
{ "< p >", NULL, " \000" },
{ "< / p >", NULL, " \000" },
/* ---------------------------------------
garbage termchar LaTeX equivalent...
--------------------------------------- */
{ "< tex >", NULL, "\000" },
{ "< / tex >", NULL, "\000" },
{ NULL, NULL, NULL }
} ; /* --- end-of-symbols[] --- */
/* ---
* html &#nn chars converted to latex equivalents
* ---------------------------------------------- */
int htmlnum=0; /* numbers[inum].html */
static struct { int html; char *latex; } numbers[] =
{ /* ---------------------------------------
html num LaTeX equivalent...
--------------------------------------- */
{ 9, " " }, /* horizontal tab */
{ 10, " " }, /* line feed */
{ 13, " " }, /* carriage return */
{ 32, " " }, /* space */
{ 33, "!" }, /* exclamation point */
{ 34, "\"" }, /* " */
{ 35, "#" }, /* hash mark */
{ 36, "$" }, /* dollar */
{ 37, "%" }, /* percent */
{ 38, "&" }, /* & */
{ 39, "\'" }, /* apostrophe (single quote) */
{ 40, ")" }, /* left parenthesis */
{ 41, ")" }, /* right parenthesis */
{ 42, "*" }, /* asterisk */
{ 43, "+" }, /* plus */
{ 44, "," }, /* comma */
{ 45, "-" }, /* hyphen (minus) */
{ 46, "." }, /* period */
{ 47, "/" }, /* slash */
{ 58, ":" }, /* colon */
{ 59, ";" }, /* semicolon */
{ 60, "<" }, /* < */
{ 61, "=" }, /* = */
{ 62, ">" }, /* > */
{ 63, "\?" }, /* question mark */
{ 64, "@" }, /* commercial at sign */
{ 91, "[" }, /* left square bracket */
{ 92, "\\" }, /* backslash */
{ 93, "]" }, /* right square bracket */
{ 94, "^" }, /* caret */
{ 95, "_" }, /* underscore */
{ 96, "`" }, /* grave accent */
{ 123, "{" }, /* left curly brace */
{ 124, "|" }, /* vertical bar */
{ 125, "}" }, /* right curly brace */
{ 126, "~" }, /* tilde */
{ 160, "~" }, /* (use tilde for latex) */
{ 166, "|" }, /* ¦ (broken vertical bar) */
{ 173, "-" }, /* ­ (soft hyphen) */
{ 177, "{\\pm}" }, /* ± (plus or minus) */
{ 215, "{\\times}" }, /* × (plus or minus) */
{ -999, NULL }
} ; /* --- end-of-numbers[] --- */
/* -------------------------------------------------------------------------
initialization
-------------------------------------------------------------------------- */
if ( explen < 1 ) goto end_of_job; /* no input expression supplied */
/* -------------------------------------------------------------------------
remove leading/trailing $$...$$'s and set mathmode accordingly
-------------------------------------------------------------------------- */
/* --- count and remove leading/trailing $'s from $$expression$$ --- */
while ( explen > 2 ) /* don't exhaust entire expression */
if ( expression[0] == '$' /* have leading $ char */
&& expression[explen-1] == '$' ) { /* and trailing $ char */
explen -= 2; /* remove leading and trailing $'s */
strsqueeze(expression,1); /* squeeze out leading $ */
expression[explen] = '\000'; /* and terminate at trailing $ */
ndollars++; } /* count another dollar */
else break; /* no more $...$ pairs */
/* --- set mathmode for input $$expression$$ --- */
if ( ndollars > 0 ) /* have $$expression$$ input */
switch ( ndollars ) { /* set mathmode accordingly */
case 1: mathmode = 1; break; /* $...$ is \textstyle */
case 2: mathmode = 0; break; /* $$...$$ is \displaystyle */
case 3: mathmode = 2; break; /* $$$...$$$ is \parstyle */
default: break; } /* I have no idea what you want */
/* --- check for input \[expression\] if no $$'s --- */
if ( ndollars < 1 ) /* not an $$expression$$ */
if ( explen > 4 ) /* long enough to contain \[...\] */
if ( strncmp(expression,"\\[",2) == 0 /* so check for leading \[ */
&& strncmp(expression+explen-2,"\\]",2) == 0 ) { /* and trailing \] */
explen -= 4; /* remove leading/trailing \[...\] */
strsqueeze(expression,2); /* squeeze out leading \[ */
expression[explen] = '\000'; /* and terminate at trailing \] */
mathmode = 0; } /* set \displaystyle */
/* -------------------------------------------------------------------------
run thru table, converting all occurrences of each html to latex equivalent
-------------------------------------------------------------------------- */
for ( isym=0; (htmlsym=symbols[isym].html)!=NULL; isym++ )
{
char *htmlterm = symbols[isym].termchar, /* &symbol; terminator */
*latexsym = symbols[isym].latex, /* latex replacement */
errorsym[256]; /* error message replacement */
int htmllen = strlen(htmlsym), /* length of html token */
wstrlen = htmllen, /* token length found by strwstr() */
latexlen = strlen(latexsym); /* length of latex replacement */
int isstrwstr = 1, /* true to use strwstr() */
istag = (isthischar(*htmlsym,"<")?1:0), /*html <tag> starts with <*/
isamp = (isthischar(*htmlsym,"&")?1:0); /*html char starts with & */
char wstrwhite[128] = "i"; /* whitespace chars for strwstr() */
char *expptr = expression, /* ptr within expression */
*tokptr = NULL; /*ptr to token found in expression*/
/* ---
* xlate every occurrence of current htmlsym command
* ------------------------------------------------- */
skipwhite(htmlsym); /*skip any bogus leading whitespace*/
htmllen = wstrlen = strlen(htmlsym); /*reset length of html token and...*/
istag = (isthischar(*htmlsym,"<")?1:0); /* ...html <tag> starts with < */
isamp = (isthischar(*htmlsym,"&")?1:0); /* ...html char starts with & */
if ( isamp ) isstrwstr = 0; /* don't use strwstr() for &char */
if ( istag ) { /* use strwstr() for <tag> */
isstrwstr = 1; /* make sure flag is set true */
if ( !isempty(htmlterm) ) /* got a term char string */
strninit(wstrwhite,htmlterm,64); /* interpret it as whitespace arg */
htmlterm = NULL; } /* rather than as a terminater */
while ( (tokptr=(!isstrwstr?strstr(expptr,htmlsym): /*strtsr or strwstr*/
strwstr(expptr,htmlsym,wstrwhite,&wstrlen))) /*looks for another htmlsym*/
!= NULL ) { /* we found another htmlsym */
char termchar = *(tokptr+wstrlen), /* char terminating html sequence */
prevchar = (tokptr==expptr?' ':*(tokptr-1)); /*char preceding tok*/
int toklen = wstrlen; /* tot length of token+terminator */
/* --- ignore match if leading char escaped (not really a match) --- */
if ( isthischar(prevchar,"\\") ) { /* inline symbol escaped */
expptr = tokptr+toklen; /*just resume search after literal*/
continue; } /* but don't replace it */
/* --- ignore match if it's just a prefix of a longer expression --- */
if ( !istag ) /*<br>-type command can't be prefix*/
if ( isalpha((int)termchar) ) { /*we just have prefix of longer sym*/
expptr = tokptr+toklen; /* just resume search after prefix */
continue; } /* but don't replace it */
/* --- check for &# prefix signalling &#nnn --- */
if ( strcmp(htmlsym,"&#") == 0 ) { /* replacing special &#nnn; chars */
/* --- accumulate chars comprising number following &# --- */
char anum[32]; /* chars comprising number after &# */
inum = 0; /* no chars accumulated yet */
while ( termchar != '\000' ) { /* don't go past end-of-string */
if ( !isdigit((int)termchar) ) break; /* and don't go past digits */
if ( inum > 10 ) break; /* some syntax error in expression */
anum[inum] = termchar; /* accumulate this digit */
inum++; toklen++; /* bump field length, token length */
termchar = *(tokptr+toklen); } /* char terminating html sequence */
anum[inum] = '\000'; /* null-terminate anum */
/* --- look up &#nnn in number[] table --- */
htmlnum = atoi(anum); /* convert anum[] to an integer */
latexsym = errorsym; /* init latex replacement for error*/
strninit(latexsym,symbols[isym].latex,128); /* init error message */
strreplace(latexsym,"nnn",anum,1,1); /* place actual &#num in message*/
latexlen = strlen(latexsym); /* and length of latex replacement */
for ( inum=0; numbers[inum].html>=0; inum++ ) /* run thru numbers[] */
if ( htmlnum == numbers[inum].html ) { /* till we find a match */
latexsym = numbers[inum].latex; /* latex replacement */
latexlen = strlen(latexsym); /* length of latex replacement */
break; } /* no need to look any further */
} /* --- end-of-if(strcmp(htmlsym,"&#")==0) --- */
/* --- check for optional ; terminator after &symbol --- */
if ( !istag ) /* html <tag> doesn't have term. */
if ( termchar != '\000' ) /* token not at end of expression */
if ( !isempty(htmlterm) ) /* sequence may have terminator */
toklen += (isthischar(termchar,htmlterm)?1:0); /*add terminator*/
/* --- replace html command with latex equivalent --- */
strchange(toklen,tokptr,latexsym); /* replace html symbol with latex */
expptr = tokptr + latexlen; /* resume search after replacement */
} /* --- end-of-while(tokptr!=NULL) --- */
} /* --- end-of-for(isymbol) --- */
/* -------------------------------------------------------------------------
back to caller with preprocessed expression
-------------------------------------------------------------------------- */
trimwhite(expression); /*remove leading/trailing whitespace*/
showmsg(99,"mathprep expression",expression); /*show preprocessed expression*/
end_of_job:
return ( expression );
} /* --- end-of-function mathprep() --- */
/* ==========================================================================
* Function: strwstr (char *string, char *substr, char *white, int *sublen)
* Purpose: Find first substr in string, but wherever substr contains
* a whitespace char (in white), string may contain any number
* (including 0) of whitespace chars. If white contains I or i,
* then match is case-insensitive (and I,i _not_ whitespace).
* --------------------------------------------------------------------------
* Arguments: string (I) char * to null-terminated string in which
* first occurrence of substr will be found
* substr (I) char * to null-terminated string containing
* "template" that will be searched for
* white (I) char * to null-terminated string containing
* whitespace chars. If NULL or empty, then
* " \t\n\r\f\v" (see #define WHITESPACE) used.
* If white contains I or i, then match is
* case-insensitive (and I,i _not_ considered
* whitespace).
* sublen (O) address of int returning "length" of substr
* found in string (which may be longer or
* shorter than substr itself).
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to first char of substr in string
* or NULL if not found or for any error.
* --------------------------------------------------------------------------
* Notes: o Wherever a single whitespace char appears in substr,
* the corresponding position in string may contain any
* number (including 0) of whitespace chars, e.g.,
* string="abc def" and string="abcdef" both match
* substr="c d" at offset 2 of string.
* o If substr="c d" (two spaces between c and d),
* then string must have at least one space, so now "abcdef"
* doesn't match. In general, the minimum number of spaces
* in string is the number of spaces in substr minus 1
* (so 1 space in substr permits 0 spaces in string).
* o Embedded spaces are counted in sublen, e.g.,
* string="c d" (three spaces) matches substr="c d"
* with sublen=5 returned. But string="ab c d" will
* also match substr=" c d" returning sublen=5 and
* a ptr to the "c". That is, the mandatory preceding
* space is _not_ counted as part of the match.
* But all the embedded space is counted.
* (An inconsistent bug/feature is that mandatory
* terminating space is counted.)
* o Moreover, string="c d" matches substr=" c d", i.e.,
* the very beginning of a string is assumed to be preceded
* by "virtual blanks".
* ======================================================================= */
/* --- entry point --- */
char *strwstr ( char *string, char *substr, char *white, int *sublen )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
char *psubstr=substr, *pstring=string,/*ptr to current char in substr,str*/
*pfound = (char *)NULL; /*ptr to found substr back to caller*/
char *pwhite=NULL, whitespace[256]; /* callers white whithout i,I */
int iscase = 1; /* case-insensitive if i,I in white*/
int foundlen = 0; /* length of substr found in string*/
int nstrwhite=0, nsubwhite=0, /* #leading white chars in str,sub */
nminwhite=0; /* #mandatory leading white in str */
int nstrchars=0, nsubchars=0, /* #non-white chars to be matched */
isncmp=0; /*strncmp() or strncasecmp() result*/
/* -------------------------------------------------------------------------
Initialization
-------------------------------------------------------------------------- */
/* --- set up whitespace --- */
strcpy(whitespace,WHITESPACE); /*default if no user input for white*/
if ( white != NULL ) /*user provided ptr to white string*/
if ( *white != '\000' ) { /*and it's not just an empty string*/
strcpy(whitespace,white); /* so use caller's white spaces */
while ( (pwhite=strchr(whitespace,'i')) != NULL ) /* have an embedded i */
{ iscase = 0; strsqueeze(pwhite,1); } /*set flag and squeeze it out*/
while ( (pwhite=strchr(whitespace,'I')) != NULL ) /* have an embedded I */
{ iscase = 0; strsqueeze(pwhite,1); } /*set flag and squeeze it out*/
if ( *whitespace == '\000' ) /* caller's white just had i,I */
strcpy(whitespace,WHITESPACE); } /* so revert back to default */
/* -------------------------------------------------------------------------
Find first occurrence of substr in string
-------------------------------------------------------------------------- */
if ( string != NULL ) /* caller passed us a string ptr */
while ( *pstring != '\000' ) { /* break when string exhausted */
char *pstrptr = pstring; /* (re)start at next char in string*/
int leadingwhite = 0; /* leading whitespace */
psubstr = substr; /* start at beginning of substr */
foundlen = 0; /* reset length of found substr */
if ( substr != NULL ) /* caller passed us a substr ptr */
while ( *psubstr != '\000' ) { /*see if pstring begins with substr*/
/* --- check for end-of-string before finding match --- */
if ( *pstrptr == '\000' ) /* end-of-string without a match */
goto nextstrchar; /* keep trying with next char */
/* --- actual amount of whitespace in string and substr --- */
nsubwhite = strspn(psubstr,whitespace); /* #leading white chars in sub */
nstrwhite = strspn(pstrptr,whitespace); /* #leading white chars in str */
nminwhite = max2(0,nsubwhite-1); /* #mandatory leading white in str */
/* --- check for mandatory leading whitespace in string --- */
if ( pstrptr != string ) /*not mandatory at start of string*/
if ( nstrwhite < nminwhite ) /* too little leading white space */
goto nextstrchar; /* keep trying with next char */
/* ---hold on to #whitespace chars in string preceding substr match--- */
if ( pstrptr == pstring ) /* whitespace at start of substr */
leadingwhite = nstrwhite; /* save it as leadingwhite */
/* --- check for optional whitespace --- */
if ( psubstr != substr ) /* always okay at start of substr */
if ( nstrwhite>0 && nsubwhite<1 ) /* too much leading white space */
goto nextstrchar; /* keep trying with next char */
/* --- skip any leading whitespace in substr and string --- */
psubstr += nsubwhite; /* push past leading sub whitespace*/
pstrptr += nstrwhite; /* push past leading str whitespace*/
/* --- now get non-whitespace chars that we have to match --- */
nsubchars = strcspn(psubstr,whitespace); /* #non-white chars in sub */
nstrchars = strcspn(pstrptr,whitespace); /* #non-white chars in str */
if ( nstrchars < nsubchars ) /* too few chars for match */
goto nextstrchar; /* keep trying with next char */
/* --- see if next nsubchars are a match --- */
isncmp = (iscase? strncmp(pstrptr,psubstr,nsubchars): /*case sensitive*/
strncasecmp(pstrptr,psubstr,nsubchars)); /*case insensitive*/
if ( isncmp != 0 ) /* no match */
goto nextstrchar; /* keep trying with next char */
/* --- push past matched chars --- */
psubstr += nsubchars; pstrptr += nsubchars; /*nsubchars were matched*/
} /* --- end-of-while(*psubstr!='\000') --- */
pfound = pstring + leadingwhite; /* found match starting at pstring */
foundlen = (int)(pstrptr-pfound); /* consisting of this many chars */
goto end_of_job; /* back to caller */
/* ---failed to find substr, continue trying with next char in string--- */
nextstrchar: /* continue outer loop */
pstring++; /* bump to next char in string */
} /* --- end-of-while(*pstring!='\000') --- */
/* -------------------------------------------------------------------------
Back to caller with ptr to first occurrence of substr in string
-------------------------------------------------------------------------- */
end_of_job:
if ( msgfp!=NULL && msglevel>=999 ) { /* debugging/diagnostic output */
fprintf(msgfp,"strwstr> str=\"%.72s\" sub=\"%s\" found at offset %d\n",
string,substr,(pfound==NULL?(-1):(int)(pfound-string))); fflush(msgfp); }
if ( sublen != NULL ) /*caller wants length of found substr*/
*sublen = foundlen; /* give it to him along with ptr */
return ( pfound ); /*ptr to first found substr, or NULL*/
} /* --- end-of-function strwstr() --- */
/* ==========================================================================
* Function: strreplace ( string, from, to, iscase, nreplace )
* Purpose: Changes the first nreplace occurrences of 'from' to 'to'
* in string, or all occurrences if nreplace=0.
* --------------------------------------------------------------------------
* Arguments: string (I/0) char * to null-terminated string in which
* occurrence of 'from' will be replaced by 'to'
* from (I) char * to null-terminated string
* to be replaced by 'to'
* to (I) char * to null-terminated string that will
* replace 'from'
* iscase (I) int containing 1 if matches of 'from'
* in 'string' should be case-sensitive,
* or 0 if matches are case-insensitive.
* nreplace (I) int containing (maximum) number of
* replacements, or 0 to replace all.
* --------------------------------------------------------------------------
* Returns: ( int ) number of replacements performed,
* or 0 for no replacements or -1 for any error.
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int strreplace ( char *string, char *from, char *to,
int iscase, int nreplace )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int fromlen = (from==NULL?0:strlen(from)), /* #chars to be replaced */
tolen = (to==NULL?0:strlen(to)); /* #chars in replacement string */
int iscommand = (fromlen<2?0:(*from=='\\'?1:0)); /*is from a \command ?*/
char *pfrom = (char *)NULL, /*ptr to 1st char of from in string*/
*pstring = string, /*ptr past previously replaced from*/
*strchange(); /* change 'from' to 'to' */
/*int iscase = 1;*/ /* true for case-sensitive match */
int nreps = 0; /* #replacements returned to caller*/
/* -------------------------------------------------------------------------
repace occurrences of 'from' in string to 'to'
-------------------------------------------------------------------------- */
if ( string == (char *)NULL /* no input string */
|| (fromlen<1 && nreplace<=0) ) /* replacing empty string forever */
nreps = (-1); /* so signal error */
else /* args okay */
while (nreplace<1 || nreps<nreplace) { /* up to #replacements requested */
if ( fromlen > 0 ) /* have 'from' string */
pfrom = /*ptr to 1st char of from in string*/
(iscase>0? strstr(pstring,from): /* case-sensistive match */
strcasestr(pstring,from)); /* case-insensistive match */
else pfrom = pstring; /*or empty from at start of string*/
if ( pfrom == (char *)NULL ) break; /*no more from's, so back to caller*/
if ( iscommand ) /* ignore prefix of longer string */
if ( isalpha((int)(*(pfrom+fromlen))) ) { /* just a longer string */
pstring = pfrom+fromlen; /* pick up search after 'from' */
continue; } /* don't change anything */
if ( iscase > 1 ) { ; } /* ignore \escaped matches */
if ( strchange(fromlen,pfrom,to) /* leading 'from' changed to 'to' */
== (char *)NULL ) { nreps=(-1); break; } /* signal error to caller */
nreps++; /* count another replacement */
pstring = pfrom+tolen; /* pick up search after 'to' */
if ( *pstring == '\000' ) break; /* but quit at end of string */
} /* --- end-of-while() --- */
return ( nreps ); /* #replacements back to caller */
} /* --- end-of-function strreplace() --- */
/* ==========================================================================
* Function: strchange ( nfirst, from, to )
* Purpose: Changes the nfirst leading chars of `from` to `to`.
* For example, to change char x[99]="12345678" to "123ABC5678"
* call strchange(1,x+3,"ABC")
* --------------------------------------------------------------------------
* Arguments: nfirst (I) int containing #leading chars of `from`
* that will be replace by `to`
* from (I/O) char * to null-terminated string whose nfirst
* leading chars will be replaced by `to`
* to (I) char * to null-terminated string that will
* replace the nfirst leading chars of `from`
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to first char of input `from`
* or NULL for any error.
* --------------------------------------------------------------------------
* Notes: o If strlen(to)>nfirst, from must have memory past its null
* (i.e., we don't do a realloc)
* ======================================================================= */
/* --- entry point --- */
char *strchange ( int nfirst, char *from, char *to )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int tolen = (to==NULL?0:strlen(to)), /* #chars in replacement string */
nshift = abs(tolen-nfirst); /*need to shift from left or right*/
if ( from == NULL ) goto end_of_job; /* error if no source string */
/* -------------------------------------------------------------------------
shift from left or right to accommodate replacement of its nfirst chars by to
-------------------------------------------------------------------------- */
if ( tolen < nfirst ) /* shift left is easy */
{strsqueeze(from,nshift);} /* squeeze out extra bytes */
if ( tolen > nfirst ) /* need more room at start of from */
{ char *pfrom = from+strlen(from); /* ptr to null terminating from */
for ( ; pfrom>=from; pfrom-- ) /* shift all chars including null */
*(pfrom+nshift) = *pfrom; } /* shift chars nshift places right */
/* -------------------------------------------------------------------------
from has exactly the right number of free leading chars, so just put to there
-------------------------------------------------------------------------- */
if ( tolen != 0 ) /* make sure to not empty or null */
memcpy(from,to,tolen); /* chars moved into place */
end_of_job: return ( from ); /* changed string back to caller */
} /* --- end-of-function strchange() --- */
/* ==========================================================================
* Function: isstrstr ( char *string, char *snippets, int iscase )
* Purpose: determine whether any substring of 'string'
* matches any of the comma-separated list of 'snippets',
* ignoring case if iscase=0.
* --------------------------------------------------------------------------
* Arguments: string (I) char * containing null-terminated
* string that will be searched for
* any one of the specified snippets
* snippets (I) char * containing null-terminated,
* comma-separated list of snippets
* to be searched for in string
* iscase (I) int containing 0 for case-insensitive
* comparisons, or 1 for case-sensitive
* --------------------------------------------------------------------------
* Returns: ( int ) 1 if any snippet is a substring of
* string, 0 if not
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int isstrstr ( char *string, char *snippets, int iscase )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int status = 0; /*1 if any snippet found in string*/
char snip[256], *snipptr = snippets, /* munge through each snippet */
delim = ',', *delimptr = NULL, /* separated by delim's */
*strstrptr = NULL; /* looking for a match in string */
/* -------------------------------------------------------------------------
initialization
-------------------------------------------------------------------------- */
/* --- arg check --- */
if ( isempty(string) /*both string and snippets required*/
|| isempty(snippets) ) goto end_of_job; /* quit if either missing */
/* -------------------------------------------------------------------------
extract each snippet and see if it's a substring of string
-------------------------------------------------------------------------- */
while ( snipptr != NULL ) { /* while we still have snippets */
/* --- extract next snippet --- */
if ( (delimptr = strchr(snipptr,delim)) /* locate next comma delim */
== NULL ) { /*not found following last snippet*/
strcpy(snip,snipptr); /* local copy of last snippet */
snipptr = NULL; } /* signal end-of-string */
else { /* snippet ends just before delim */
int sniplen = (int)(delimptr-snipptr) - 1; /* #chars in snippet */
memcpy(snip,snipptr,sniplen); /* local copy of snippet chars */
snip[sniplen] = '\000'; /* null-terminated snippet */
snipptr = delimptr + 1; } /* next snippet starts after delim */
/* --- check if snippet in string --- */
strstrptr = (iscase? strstr(string,snip) : strcasestr(string,snip) );
if ( strstrptr != NULL ) { /* found snippet in string */
status = 1; /* so reset return status */
break; } /* no need to check any further */
} /* --- end-of-while(*snipptr!=0) --- */
end_of_job: return ( status ); /*1 if snippet found in list, else 0*/
} /* --- end-of-function isstrstr() --- */
/* ==========================================================================
* Function: nomath ( s )
* Purpose: Removes/replaces any LaTeX math chars in s
* so that s can be rendered in paragraph mode.
* --------------------------------------------------------------------------
* Arguments: s (I) char * to null-terminated string
* whose math chars are to be removed/replaced
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to "cleaned" copy of s
* or "" (empty string) for any error.
* --------------------------------------------------------------------------
* Notes: o The returned pointer addresses a static buffer,
* so don't call nomath() again until you're finished
* with output from the preceding call.
* ======================================================================= */
/* --- entry point --- */
char *nomath ( char *s )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
static char sbuff[4096]; /* copy of s with no math chars */
int strreplace(); /* replace _ with -, etc */
/* -------------------------------------------------------------------------
Make a clean copy of s
-------------------------------------------------------------------------- */
/* --- check input --- */
*sbuff = '\000'; /* initialize in case of error */
if ( isempty(s) ) goto end_of_job; /* no input */
/* --- start with copy of s --- */
strninit(sbuff,s,3000); /* leave room for replacements */
/* --- make some replacements (*must* replace \ first) --- */
strreplace(sbuff,"\\","\\textbackslash ",0,0); /* change all \'s to text */
strreplace(sbuff,"_","\\textunderscore ",0,0); /* change all _'s to text */
strreplace(sbuff,"<","\\textlangle ",0,0); /* change all <'s to text */
strreplace(sbuff,">","\\textrangle ",0,0); /* change all >'s to text */
strreplace(sbuff,"$","\\textdollar ",0,0); /* change all $'s to text */
strreplace(sbuff,"&","\\&",0,0); /* change every & to \& */
strreplace(sbuff,"%","\\%",0,0); /* change every % to \% */
strreplace(sbuff,"#","\\#",0,0); /* change every # to \# */
strreplace(sbuff,"~","\\~",0,0); /* change every ~ to \~ */
strreplace(sbuff,"{","\\{",0,0); /* change every { to \{ */
strreplace(sbuff,"}","\\}",0,0); /* change every } to \} */
strreplace(sbuff,"^","\\ensuremath{\\widehat{~}}",0,0); /* change every ^ */
end_of_job:
return ( sbuff ); /* back with clean copy of s */
} /* --- end-of-function nomath() --- */
/* ==========================================================================
* Function: strwrap ( s, linelen, tablen )
* Purpose: Inserts \n's and spaces in (a copy of) s to wrap lines
* at linelen and indent them by tablen.
* --------------------------------------------------------------------------
* Arguments: s (I) char * to null-terminated string
* to be wrapped.
* linelen (I) int containing maximum linelen
* between \n's.
* tablen (I) int containing number of spaces to indent
* lines. 0=no indent. Positive means
* only indent first line and not others.
* Negative means indent all lines except first.
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to "line-wrapped" copy of s
* or "" (empty string) for any error.
* --------------------------------------------------------------------------
* Notes: o The returned copy of s has embedded \n's as necessary
* to wrap lines at linelen. Any \n's in the input copy
* are removed first. If (and only if) the input s contains
* a terminating \n then so does the returned copy.
* o The returned pointer addresses a static buffer,
* so don't call strwrap() again until you're finished
* with output from the preceding call.
* ======================================================================= */
/* --- entry point --- */
char *strwrap ( char *s, int linelen, int tablen )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
static char sbuff[4096]; /* line-wrapped copy of s */
char *sol = sbuff; /* ptr to start of current line*/
char tab[32] = " "; /* tab string */
int strreplace(); /* remove \n's */
char *strchange(); /* add \n's and indent space */
int finalnewline = (lastchar(s)=='\n'?1:0); /*newline at end of string?*/
int istab = (tablen>0?1:0); /* init true to indent first line */
int rhslen = 0, /* remaining right hand side length*/
thislen = 0, /* length of current line segment */
thistab = 0, /* length of tab on current line */
wordlen = 0; /* length to next whitespace char */
/* -------------------------------------------------------------------------
Make a clean copy of s
-------------------------------------------------------------------------- */
/* --- check input --- */
*sbuff = '\000'; /* initialize in case of error */
if ( isempty(s) ) goto end_of_job; /* no input */
if ( tablen < 0 ) tablen = (-tablen); /* set positive tablen */
if ( tablen >= linelen ) tablen = linelen-1; /* tab was longer than line */
tab[min2(tablen,16)] = '\000'; /* null-terminate tab string */
tablen = strlen(tab); /* reset to actual tab length */
/* --- start with copy of s --- */
strninit(sbuff,s,3000); /* leave room for \n's and tabs */
if ( linelen < 1 ) goto end_of_job; /* can't do anything */
trimwhite(sbuff); /*remove leading/trailing whitespace*/
strreplace(sbuff,"\n"," ",0,0); /* remove any original \n's */
strreplace(sbuff,"\r"," ",0,0); /* remove any original \r's */
strreplace(sbuff,"\t"," ",0,0); /* remove any original \t's */
/* -------------------------------------------------------------------------
Insert \n's and spaces as needed
-------------------------------------------------------------------------- */
while ( 1 ) { /* till end-of-line */
/* --- init --- */
trimwhite(sol); /*remove leading/trailing whitespace*/
thislen = thistab = 0; /* no chars in current line yet */
if ( istab && tablen>0 ) { /* need to indent this line */
strchange(0,sol,tab); /* insert indent at start of line */
thistab = tablen; } /* line starts with whitespace tab */
if ( sol == sbuff ) istab = 1-istab; /* flip tab flag after first line */
sol += thistab; /* skip tab */
rhslen = strlen(sol); /* remaining right hand side chars */
if ( rhslen <= linelen ) break; /* no more \n's needed */
if ( 0 && msglevel >= 99 ) {
fprintf(stdout,"strwrap> rhslen=%d, sol=\"\"%s\"\"\n",rhslen,sol);
fflush(stdout); }
/* --- look for last whitespace preceding linelen --- */
while ( 1 ) { /* till we exceed linelen */
wordlen = strcspn(sol+thislen,WHITESPACE); /*ptr to next whitespace char*/
if ( thislen+thistab+wordlen >= linelen ) break; /*next word won't fit*/
thislen += (wordlen+1); } /* ptr past next whitespace char */
if ( thislen < 1 ) break; /* line will have one too-long word*/
sol[thislen-1] = '\n'; /* replace last space with newline */
sol += thislen; /* next line starts after newline */
} /* --- end-of-while(1) --- */
end_of_job:
if ( finalnewline ) strcat(sbuff,"\n"); /* replace final newline */
return ( sbuff ); /* back with clean copy of s */
} /* --- end-of-function strwrap() --- */
/* ==========================================================================
* Function: strpspn ( char *s, char *reject, char *segment )
* Purpose: finds the initial segment of s containing no chars
* in reject that are outside (), [] and {} parens, e.g.,
* strpspn("abc(---)def+++","+-",segment) returns
* segment="abc(---)def" and a pointer to the first '+' in s
* because the -'s are enclosed in () parens.
* --------------------------------------------------------------------------
* Arguments: s (I) (char *)pointer to null-terminated string
* whose initial segment is desired
* reject (I) (char *)pointer to null-terminated string
* containing the "reject chars"
* If reject contains a " or a ', then the
* " or ' isn't itself a reject char,
* but other reject chars within quoted
* strings (or substrings of s) are spanned.
* segment (O) (char *)pointer returning null-terminated
* string comprising the initial segment of s
* that contains non-rejected chars outside
* (),[],{} parens, i.e., all the chars up to
* but not including the returned pointer.
* (That's the entire string if no non-rejected
* chars are found.)
* --------------------------------------------------------------------------
* Returns: ( char * ) pointer to first reject-char found in s
* outside parens, or a pointer to the
* terminating '\000' of s if there are
* no reject chars in s outside all () parens.
* But if reject is empty, returns pointer
* to matching )]} outside all parens.
* --------------------------------------------------------------------------
* Notes: o the return value is _not_ like strcspn()'s
* o improperly nested (...[...)...] are not detected,
* but are considered "balanced" after the ]
* o if reject not found, segment returns the entire string s
* o but if reject is empty, returns segment up to and including
* matching )]}
* o leading/trailing whitespace is trimmed from returned segment
* ======================================================================= */
/* --- entry point --- */
char *strpspn ( char *s, char *reject, char *segment )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
char *ps = s; /* current pointer into s */
char *strqspn(char *s,char *q,int isunescape); /*span quoted string*/
char qreject[256]="\000", *pq=qreject, *pr=reject; /*find "or' in reject*/
int isqspan = 0; /* true to span quoted strings */
int depth = 0; /* () paren nesting level */
int seglen=0, maxseg=2047; /* segment length, max allowed */
int isescaped=0, checkescapes=1; /* signals escaped chars */
/* -------------------------------------------------------------------------
initialization
-------------------------------------------------------------------------- */
/* --- check arguments --- */
if ( isempty(s) /* no input string supplied */
/*|| isempty(reject)*/ ) goto end_of_job; /* no reject chars supplied */
/* --- set up qreject w/o quotes --- */
if ( !isempty(reject) ) /* have reject string from caller */
while ( *pr != '\000' ) { /* until end-of-reject string */
if ( !isthischar(*pr,"\"\'") ) /* not a " or ' */
*pq++ = *pr; /* copy actual reject char */
else isqspan = 1; /* span rejects in quoted strings */
pr++; } /* next reject char from caller */
*pq = '\000'; /* null-terminate qreject */
/* -------------------------------------------------------------------------
find first char from s outside () parens (and outside ""'s) and in reject
-------------------------------------------------------------------------- */
while ( *ps != '\000' ) { /* search till end of input string */
int spanlen = 1; /*span 1 non-reject, non-quoted char*/
if ( !isescaped ) { /* ignore escaped \(,\[,\{,\),\],\}*/
if ( isthischar(*ps,"([{") ) depth++; /* push another paren */
if ( isthischar(*ps,")]}") ) depth--; } /* or pop another paren */
if ( depth < 1 ) { /* we're outside all parens */
if ( isqspan ) /* span rejects in quoted strings */
if ( isthischar(*ps,"\"\'") ) { /* and we're at opening quote */
pq = strqspn(ps,NULL,0); /* locate matching closing quote */
if ( pq != ps ) /* detected start of quoted string */
if ( *pq == *ps ) /* and found closing quote */
spanlen = ((int)(pq-ps)) + 1; } /* span the entire quoted string */
if ( isempty(qreject) ) break; /* no reject so break immediately */
if ( isthischar(*ps,qreject) ) break; } /* only break on a reject char */
if ( checkescapes ) /* if checking escape sequences */
isescaped = (*ps=='\\'?1:0); /* reset isescaped signal */
if ( segment != NULL ) { /* caller gave us segment */
int copylen = min2(spanlen,maxseg-seglen); /* don't overflow segment */
if ( copylen > 0 ) /* have room in segment buffer */
memcpy(segment+seglen,ps,copylen); } /* so copy non-reject chars */
seglen += spanlen; ps += spanlen; /* bump to next char */
} /* --- end-of-while(*ps!=0) --- */
end_of_job:
if ( segment != NULL ) { /* caller gave us segment */
if ( isempty(qreject) && !isempty(s) ) { /* no reject char */
segment[min2(seglen,maxseg)] = *ps; seglen++; } /*closing )]} to seg*/
segment[min2(seglen,maxseg)] = '\000'; /* null-terminate the segment */
trimwhite(segment); } /* trim leading/trailing whitespace*/
return ( ps ); /* back to caller */
} /* --- end-of-function strpspn() --- */
/* ==========================================================================
* Function: strqspn ( char *s, char *q, int isunescape )
* Purpose: finds matching/closing " or ' in quoted string
* that begins with " or ', and optionally changes
* escaped quotes to unescaped quotes.
* --------------------------------------------------------------------------
* Arguments: s (I) (char *)pointer to null-terminated string
* that begins with " or ',
* q (O) (char *)pointer returning null-terminated
* quoted token, with or without outer quotes,
* and with or without escaped inner quotes
* changed to unescaped quotes, depending
* on isunescape.
* isunescape (I) int containing 1 to change \" to " if s
* is "quoted" or change \' to ' if 'quoted',
* or containing 2 to change both \" and \'
* to unescaped quotes. Other \sequences aren't
* changed. Note that \\" emits \".
* isunescape=0 makes no changes at all.
* Note: the following not implemented yet --
* If unescape is negative, its abs() is used,
* but outer quotes aren't included in q.
* --------------------------------------------------------------------------
* Returns: ( char * ) pointer to matching/closing " or '
* (or to char after quote if isunescape<0),
* or terminating '\000' if none found,
* or unchanged (same as s) if not quoted string
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
char *strqspn ( char *s, char *q, int isunescape )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
char *ps = s, *pq = q; /* current pointer into s, q */
char quote = '\000'; /* " or ' quote character */
int qcopy = (isunescape<0?0:1); /* true to copy outer quotes */
int isescaped = 0; /* true to signal \escape sequence */
int maxqlen = 2400; /* max length of returned q */
/* -------------------------------------------------------------------------
Initialization
-------------------------------------------------------------------------- */
/* --- check args --- */
if ( s == NULL ) goto end_of_job; /* no string supplied */
skipwhite(ps); /* skip leading whitespace */
if ( *ps == '\000' /* string exhausted */
|| (!isthischar(*ps,"\"\'")) ) { /* or not a " or ' quoted string */
ps = s; goto end_of_job; } /*signal error/not string to caller*/
if ( isunescape < 0 ) isunescape = (-isunescape); /* flip positive */
/* --- set quote character --- */
quote = *ps; /* set quote character */
if ( qcopy && q!=NULL ) *pq++ = quote; /* and copy it to output token */
/* -------------------------------------------------------------------------
span characters between quotes
-------------------------------------------------------------------------- */
while ( *(++ps) != '\000' ) { /* end-of-string always terminates */
/* --- process escaped chars --- */
if ( isescaped ) { /* preceding char was \ */
if ( *ps != '\\' ) isescaped = 0; /* reset isescaped flag unless \\ */
if ( q != NULL ) { /* caller wants quoted token */
if ( isunescape==0 /* don't unescape anything */
|| (isunescape==1 && *ps!=quote) /* escaped char not our quote */
|| (isunescape==2 && (!isthischar(*ps,"\"\'"))) ) /* not any quote */
if ( --maxqlen > 0 ) /* so if there's room in token */
*pq++ = '\\'; /*keep original \ in returned token*/
if ( !isescaped ) /* will have to check 2nd \ in \\ */
if ( --maxqlen > 0 ) /* if there's room in token */
*pq++ = *ps; } /* put escaped char in token */
continue; } /* go on to next char in string */
/* --- check if next char escaped --- */
if ( *ps == '\\' ) { /* found escape char */
isescaped=1; continue; } /*set flag and process escaped char*/
/* --- check for unescaped closing quote --- */
if ( *ps == quote ) { /* got an unescaped quote */
if ( qcopy && q!=NULL ) *pq++ = quote; /* copy it to output token */
if ( 0 && !qcopy ) ps++; /* return ptr to char after quote */
goto end_of_job; } /* back to caller */
/* --- process other chars --- */
if ( q != NULL ) /* caller want token returned */
if ( --maxqlen > 0 ) /* and there's still room in token */
*pq++ = *ps; /* put char in token */
} /* --- end-of-while(*(++ps)!='\000') --- */
/*ps = NULL;*/ /*pq = q;*/ /* error if no closing quote found */
end_of_job:
if ( q != NULL ) *pq = '\000'; /* null-terminate returned token */
return ( ps ); /* return ptr to " or ', or NULL */
} /* --- end-of-function strqspn() --- */
/* ==========================================================================
* Function: isnumeric ( s )
* Purpose: determine if s is an integer
* --------------------------------------------------------------------------
* Arguments: s (I) (char *)pointer to null-terminated string
* that's checked for a leading + or -
* followed by digits
* --------------------------------------------------------------------------
* Returns: ( int ) 1 if s is numeric, 0 if it is not
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int isnumeric ( char *s )
{
/* -------------------------------------------------------------------------
determine whether s is an integer
-------------------------------------------------------------------------- */
int status = 0; /* return 0 if not numeric, 1 if is*/
char *p = s; /* pointer into s */
if ( isempty(s) ) goto end_of_job; /* missing arg or empty string */
skipwhite(p); /*check for leading +or- after space*/
if ( *p=='+' || *p=='-' ) p++; /* skip leading + or - */
for ( ; *p != '\000'; p++ ) { /* check rest of s for digits */
if ( isdigit(*p) ) continue; /* still got uninterrupted digits */
if ( !isthischar(*p,WHITESPACE) ) goto end_of_job; /* non-numeric char */
skipwhite(p); /* skip all subsequent whitespace */
if ( *p == '\000' ) break; /* trailing whitespace okay */
goto end_of_job; /* embedded whitespace non-numeric */
} /* --- end-of-for(*p) --- */
status = 1; /* numeric after checks succeeded */
end_of_job:
return ( status ); /*back to caller with 1=string, 0=no*/
} /* --- end-of-function isnumeric() --- */
/* ==========================================================================
* Function: evalterm ( STORE *store, char *term )
* Purpose: evaluates a term
* --------------------------------------------------------------------------
* Arguments: store (I/O) STORE * containing environment
* in which term is to be evaluated
* term (I) char * containing null-terminated string
* with a term like "3" or "a" or "a+3"
* whose value is to be determined
* --------------------------------------------------------------------------
* Returns: ( int ) value of term,
* or NOVALUE for any error
* --------------------------------------------------------------------------
* Notes: o Also evaluates index?a:b:c:etc, returning a if index<=0,
* b if index=1, etc, and the last value if index is too large.
* Each a:b:c:etc can be another expression, including another
* (index?a:b:c:etc) which must be enclosed in parentheses.
* ======================================================================= */
/* --- entry point --- */
int evalterm ( STORE *store, char *term )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int termval = 0; /* term value returned to caller */
char token[2048] = "\000", /* copy term */
*delim = NULL; /* delim '(' or '?' in token */
/*int evalwff(),*/ /* recurse to evaluate terms */
/* evalfunc();*/ /* evaluate function(arg1,arg2,...)*/
char *strpspn(); /* span delims */
int getstore(); /* lookup variables */
int isnumeric(); /* numeric=constant, else variable */
static int evaltermdepth = 0; /* recursion depth */
int novalue = (-89123456); /* dummy (for now) error signal */
/* -------------------------------------------------------------------------
Initialization
-------------------------------------------------------------------------- */
if ( ++evaltermdepth > 99 ) goto end_of_job; /*probably recursing forever*/
if ( store==NULL || isempty(term) ) goto end_of_job; /*check for missing arg*/
skipwhite(term); /* skip any leading whitespace */
/* -------------------------------------------------------------------------
First look for conditional of the form term?term:term:...
-------------------------------------------------------------------------- */
/* ---left-hand part of conditional is chars preceding "?" outside ()'s--- */
delim = strpspn(term,"?",token); /* chars preceding ? outside () */
if ( *delim != '\000' ) { /* found conditional expression */
int ncolons = 0; /* #colons we've found so far */
if ( *token != '\000' ) /* evaluate "index" value on left */
if ( (termval=evalterm(store,token)) /* evaluate left-hand term */
== novalue ) goto end_of_job; /* return error if failed */
while ( *delim != '\000' ) { /* still have chars in term */
delim++; *token='\000'; /* initialize for next "value:" */
if ( *delim == '\000' ) break; /* no more values */
delim = strpspn(delim,":",token); /* chars preceding : outside () */
if ( ncolons++ >= termval ) break; /* have corresponding term */
} /* --- end-of-while(*delim!='\000')) --- */
if ( *token != '\000' ) /* have x:x:value:x:x on right */
termval=evalterm(store,token); /* so evaluate it */
goto end_of_job; /* return result to caller */
} /* --- end-of-if(*delim!='\000')) --- */
/* -------------------------------------------------------------------------
evaluate a+b recursively
-------------------------------------------------------------------------- */
/* --- left-hand part of term is chars preceding "/+-*%" outside ()'s --- */
term = strpspn(term,"/+-*%",token); /* chars preceding /+-*% outside ()*/
/* --- evaluate a+b, a-b, etc --- */
if ( *term != '\000' ) { /* found arithmetic operation */
int leftval=0, rightval=0; /* init leftval for unary +a or -a */
if ( *token != '\000' ) /* or eval for binary a+b or a-b */
if ( (leftval=evalterm(store,token)) /* evaluate left-hand term */
== novalue ) goto end_of_job; /* return error if failed */
if ( (rightval=evalterm(store,term+1)) /* evaluate right-hand term */
== novalue ) goto end_of_job; /* return error if failed */
switch ( *term ) { /* perform requested arithmetic */
default: break; /* internal error */
case '+': termval = leftval+rightval; break; /* addition */
case '-': termval = leftval-rightval; break; /* subtraction */
case '*': termval = leftval*rightval; break; /* multiplication */
case '/': if ( rightval != 0 ) /* guard against divide by zero */
termval = leftval/rightval; break; /* integer division */
case '%': if ( rightval != 0 ) /* guard against divide by zero */
termval = leftval%rightval; break; /*left modulo right */
} /* --- end-of-switch(*relation) --- */
goto end_of_job; /* return result to caller */
} /* --- end-of-if(*term!='\000')) --- */
/* -------------------------------------------------------------------------
check for parenthesized expression or term of the form function(arg1,arg2,...)
-------------------------------------------------------------------------- */
if ( (delim = strchr(token,'(')) != NULL ) { /* token contains a ( */
/* --- strip trailing paren (if there hopefully is one) --- */
int toklen = strlen(token); /* total #chars in token */
if ( token[toklen-1] == ')' ) /* found matching ) at end of token*/
token[--toklen] = '\000'; /* remove trailing ) */
/* --- handle parenthesized subexpression --- */
if ( *token == '(' ) { /* have parenthesized expression */
strsqueeze(token,1); /* so squeeze out leading ( */
/* --- evaluate edited term --- */
trimwhite(token); /* trim leading/trailing whitespace*/
termval = evalterm(store,token); } /* evaluate token recursively */
/* --- handle function(arg1,arg2,...) --- */
else { /* have function(arg1,arg2,...) */
*delim = '\000'; /* separate function name and args */
/*termval = evalfunc(store,token,delim+1);*/ } /* evaluate function */
goto end_of_job; } /* return result to caller */
/* -------------------------------------------------------------------------
evaluate constants directly, or recursively evaluate variables, etc
-------------------------------------------------------------------------- */
if ( *token != '\000' ) { /* empty string */
if ( isnumeric(token) ) /* have a constant */
termval = atoi(token); /* convert ascii-to-int */
else { /* variable or "stored proposition"*/
termval = getstore(store,token); } /* look up token */
} /* --- end-of-if(*token!=0) --- */
/* -------------------------------------------------------------------------
back to caller with truth value of proposition
-------------------------------------------------------------------------- */
end_of_job:
/* --- back to caller --- */
if ( evaltermdepth > 0 ) evaltermdepth--; /* pop recursion depth */
return ( termval ); /* back to caller with value */
} /* --- end-of-function evalterm() --- */
/* ==========================================================================
* Function: getstore ( store, identifier )
* Purpose: finds identifier in store and returns corresponding value
* --------------------------------------------------------------------------
* Arguments: store (I) (STORE *)pointer to store containing
* the desired identifier
* identifier (I) (char *)pointer to null-terminated string
* containing the identifier whose value
* is to be returned
* --------------------------------------------------------------------------
* Returns: ( int ) identifier's corresponding value,
* or 0 if identifier not found (or any error)
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int getstore ( STORE *store, char *identifier )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int value = 0; /* store[istore].value for identifier */
int istore=0; /* store[] index containing identifier */
char seek[512], hide[512]; /* identifier arg, identifier in store */
/* --- first check args --- */
if ( store==NULL || isempty(identifier)) goto end_of_job; /* missing arg */
strninit(seek,identifier,500); /* local copy of caller's identifier */
trimwhite(seek); /* remove leading/trailing whitespace */
/* --- loop over store --- */
for ( istore=0; istore<MAXSTORE; istore++ ) { /* until end-of-table */
char *idstore = store[istore].identifier; /* ptr to identifier in store */
if ( isempty(idstore) ) /* empty id signals eot */
break; /* de-reference any default/error value */
strninit(hide,idstore,500); /* local copy of store[] identifier */
trimwhite(hide); /* remove leading/trailing whitespace */
if ( !strcmp(hide,seek) ) /* found match */
break; /* de-reference corresponding value */
} /* --- end-of-for(istore) --- */
if ( store[istore].value != NULL ) /* address of int supplied */
value = *(store[istore].value); /* return de-referenced int */
end_of_job:
return ( value ); /* store->values[istore] or NULL */
} /* --- end-of-function getstore() --- */
/* ==========================================================================
* Function: timewaitfor ( whundredths )
* Purpose: wait for whundredths hundredths of a second
* --------------------------------------------------------------------------
* Arguments: tzdelta (I) integer, positive or negative, containing
* containing number of hours to be added or
* subtracted from system time (to accommodate
* your desired time zone).
* ifmt (I) integer containing 0 for default format
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to null-terminated buffer
* containing current date:time stamp
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int timewaitfor( int whundredths )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int secs = whundredths/100, /* whole seconds */
hundredths = whundredths - (100*secs); /* remainder is hundredths */
long nanos = ((long)hundredths)*((long)10000000); /* times ten million */
struct timespec waitfor = { 0, 0 }; /* nanosleep arg */
if ( whundredths>=1 && secs<=999 ) { /* sanity check */
waitfor.tv_sec = secs; waitfor.tv_nsec = nanos; /* init nanosleep arg */
nanosleep(&waitfor,NULL); } /* impose delay */
return ( 1 ); /* back to caller after delay */
} /* --- end-of-function timewaitfor() --- */
/* ==========================================================================
* Function: timestamp ( tzdelta, ifmt )
* Purpose: returns null-terminated character string containing
* current date:time stamp as ccyy-mm-dd:hh:mm:ss{am,pm}
* --------------------------------------------------------------------------
* Arguments: tzdelta (I) integer, positive or negative, containing
* containing number of hours to be added or
* subtracted from system time (to accommodate
* your desired time zone).
* ifmt (I) integer containing 0 for default format
* --------------------------------------------------------------------------
* Returns: ( char * ) ptr to null-terminated buffer
* containing current date:time stamp
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
char *timestamp( int tzdelta, int ifmt )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
static char timebuff[256]; /* date:time buffer back to caller */
/*long time_val = 0L;*/ /* binary value returned by time() */
time_t time_val = (time_t)(0); /* binary value returned by time() */
struct tm *tmstruct=(struct tm *)NULL, *localtime(); /* interpret time_val */
int year=0, hour=0,ispm=1, /* adjust year, and set am/pm hour */
month=0, day=0, /* adjust day and month for delta */
minute=0,second=0; /* minute and second not adjusted */
int tzadjust(); /* time zone adjustment function */
int daynumber(); /* #days since Jan 1, 1973 */
static char *daynames[] = { "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday", "Sunday" } ;
static char *monthnames[] = { "?", "January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December", "?" } ;
/* -------------------------------------------------------------------------
get current date:time, adjust values, and and format stamp
-------------------------------------------------------------------------- */
/* --- first init returned timebuff in case of any error --- */
*timebuff = '\000';
/* --- get current date:time --- */
time((time_t *)(&time_val)); /* get date and time */
tmstruct = localtime((time_t *)(&time_val)); /* interpret time_val */
/* --- extract fields --- */
year = (int)(tmstruct->tm_year); /* local copy of year, 0=1900 */
month = (int)(tmstruct->tm_mon) + 1; /* local copy of month, 1-12 */
day = (int)(tmstruct->tm_mday); /* local copy of day, 1-31 */
hour = (int)(tmstruct->tm_hour); /* local copy of hour, 0-23 */
minute= (int)(tmstruct->tm_min); /* local copy of minute,0-59 */
second= (int)(tmstruct->tm_sec); /* local copy of second,0-59 */
/* --- adjust year --- */
year += 1900; /* set century in year */
/* --- adjust for timezone --- */
tzadjust(tzdelta,&year,&month,&day,&hour);
/* --- check params --- */
if ( hour<0 || hour>23
|| day<1 || day>31
|| month<1 || month>12
|| year<1973 ) goto end_of_job;
/* --- adjust hour for am/pm --- */
switch ( ifmt )
{
default:
case 0:
if ( hour < 12 ) /* am check */
{ ispm=0; /* reset pm flag */
if ( hour == 0 ) hour = 12; } /* set 00hrs = 12am */
if ( hour > 12 ) hour -= 12; /* pm check sets 13hrs to 1pm, etc */
break;
case 4: break; /* numeric result */
} /* --- end-of-switch(ifmt) --- */
/* --- format date:time stamp --- */
switch ( ifmt )
{
default:
case 0: /* --- 2005-03-05:11:49:59am --- */
sprintf(timebuff,"%04d-%02d-%02d:%02d:%02d:%02d%s",
year,month,day,hour,minute,second,((ispm)?"pm":"am"));
break;
case 1: /* --- Saturday, March 5, 2005 --- */
sprintf(timebuff,"%s, %s %d, %d",
daynames[daynumber(year,month,day)%7],monthnames[month],day,year);
break;
case 2: /* --- Saturday, March 5, 2005, 11:49:59am --- */
sprintf(timebuff,"%s, %s %d, %d, %d:%02d:%02d%s",
daynames[daynumber(year,month,day)%7],monthnames[month],day,year,
hour,minute,second,((ispm)?"pm":"am"));
break;
case 3: /* --- 11:49:59am --- */
sprintf(timebuff,"%d:%02d:%02d%s",
hour,minute,second,((ispm)?"pm":"am"));
break;
case 4: /* --- 1231235959 (mmddhhmmss time as integer) --- */
sprintf(timebuff,"%d%02d%02d%02d%02d",
month,day,hour,minute,second);
break;
case 5: /* --- 2005 --- */
sprintf(timebuff,"%d",year);
break;
} /* --- end-of-switch(ifmt) --- */
end_of_job:
return ( timebuff ); /* return stamp to caller */
} /* --- end-of-function timestamp() --- */
/* ==========================================================================
* Function: tzadjust ( tzdelta, year, month, day, hour )
* Purpose: Adjusts hour, and day,month,year if necessary,
* by delta increment to accommodate your time zone.
* --------------------------------------------------------------------------
* Arguments: tzdelta (I) integer, positive or negative, containing
* containing number of hours to be added or
* subtracted from given time (to accommodate
* your desired time zone).
* year (I) addr of int containing 4-digit year
* month (I) addr of int containing month 1=Jan - 12=Dec.
* day (I) addr of int containing day 1-31 for Jan.
* hour (I) addr of int containing hour 0-23
* Returns: ( int ) 1 for success, or 0 for error
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int tzadjust ( int tzdelta, int *year, int *month, int *day, int *hour )
{
/* --------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int yy = *year, mm = *month, dd = *day, hh = *hour; /*dereference args*/
/* --- calendar data --- */
static int modays[] =
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0 };
/* --------------------------------------------------------------------------
check args
-------------------------------------------------------------------------- */
if ( mm<1 || mm>12 ) return(-1); /* bad month */
if ( dd<1 || dd>modays[mm] ) return(-1); /* bad day */
if ( hh<0 || hh>23 ) return(-1); /* bad hour */
if ( tzdelta>23 || tzdelta<(-23) ) return(-1); /* bad tzdelta */
/* --------------------------------------------------------------------------
make adjustments
-------------------------------------------------------------------------- */
/* --- adjust hour --- */
hh += tzdelta; /* apply caller's delta */
/* --- adjust for feb 29 --- */
modays[2] = (yy%4==0?29:28); /* Feb has 29 days in leap years */
/* --- adjust day --- */
if ( hh < 0 ) /* went to preceding day */
{ dd--; hh += 24; }
if ( hh > 23 ) /* went to next day */
{ dd++; hh -= 24; }
/* --- adjust month --- */
if ( dd < 1 ) /* went to preceding month */
{ mm--; dd = modays[mm]; }
if ( dd > modays[mm] ) /* went to next month */
{ mm++; dd = 1; }
/* --- adjust year --- */
if ( mm < 1 ) /* went to preceding year */
{ yy--; mm = 12; dd = modays[mm]; }
if ( mm > 12 ) /* went to next year */
{ yy++; mm = 1; dd = 1; }
/* --- back to caller --- */
*year=yy; *month=mm; *day=dd; *hour=hh; /* reset adjusted args */
return ( 1 );
} /* --- end-of-function tzadjust() --- */
/* ==========================================================================
* Function: daynumber ( year, month, day )
* Purpose: Returns number of actual calendar days from Jan 1, 1973
* to the given date (e.g., bvdaynumber(1974,1,1)=365).
* --------------------------------------------------------------------------
* Arguments: year (I) int containing year -- may be either 1995 or
* 95, or may be either 2010 or 110 for those
* years.
* month (I) int containing month, 1=Jan thru 12=Dec.
* day (I) int containing day of month, 1-31 for Jan, etc.
* Returns: ( int ) Number of days from Jan 1, 1973 to given date,
* or -1 for error (e.g., year<1973).
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
int daynumber ( int year, int month, int day )
{
/* --------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
/* --- returned value (note: returned as a default "int") --- */
int ndays; /* #days since jan 1, year0 */
/* --- initial conditions --- */
static int year0 = 73, /* jan 1 was a monday, 72 was a leap */
days4yrs = 1461, /* #days in 4 yrs = 365*4 + 1 */
days1yr = 365;
/* --- table of accumulated days per month (last index not used) --- */
static int modays[] =
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
/* --- variables for #days since day0 --- */
int nyears, nfouryrs; /*#years, #4-yr periods since year0*/
/* --------------------------------------------------------------------------
Check input
-------------------------------------------------------------------------- */
if ( month < 1 || month > 12 ) /*month used as index, so must be ok*/
return ( -1 ); /* otherwise, forget it */
if ( year >= 1900 ) year -= 1900; /*use two-digit years (3 after 2000)*/
/* --------------------------------------------------------------------------
Find #days since jan 1, 1973
-------------------------------------------------------------------------- */
/* --- figure #complete 4-year periods and #remaining yrs till current --- */
nyears = year - year0; /* #years since year0 */
if ( nyears < 0 ) return ( -1 ); /* we're not working backwards */
nfouryrs = nyears/4; /* #complete four-year periods */
nyears -= (4*nfouryrs); /* remainder excluding current year*/
/* --- #days from jan 1, year0 till jan 1, this year --- */
ndays = (days4yrs*nfouryrs) /* #days in 4-yr periods */
+ (days1yr*nyears); /* +remaining days */
/*if ( year > 100 ) ndays--;*/ /* subtract leap year for 2000AD */
/* --- add #days within current year --- */
ndays += (modays[month-1] + (day-1));
/* --- may need an extra day if current year is a leap year --- */
if ( nyears == 3 ) /*three preceding yrs so this is 4th*/
{ if ( month > 2 ) /* past feb so need an extra day */
/*if ( year != 100 )*/ /* unless it's 2000AD */
ndays++; } /* so add it in */
return ( (int)(ndays) ); /* #days back to caller */
} /* --- end-of-function daynumber() --- */
/* ==========================================================================
* Function: calendar ( year, month, day )
* Purpose: returns null-terminated character string containing
* \begin{tabular}...\end{tabular} for the one-month calendar
* specified by year=1973...2099 and month=1...12.
* If either arg out-of-range, today's value is used.
* --------------------------------------------------------------------------
* Arguments: year (I) int containing 1973...2099 or 0 for current
* year
* month (I) int containing 1...12 or 0 for current month
* day (I) int containing day to emphasize or 0
* --------------------------------------------------------------------------
* Returns: ( char * ) char ptr to null-terminated buffer
* containing \begin{tabular}...\end{tabular}
* string that will render calendar for
* requested month, or NULL for any error.
* --------------------------------------------------------------------------
* Notes: o
* ======================================================================= */
/* --- entry point --- */
char *calendar( int year, int month, int day )
{
/* -------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
static char calbuff[4096]; /* calendar returned to caller */
time_t time_val = (time_t)(0); /* binary value returned by time() */
struct tm *tmstruct=(struct tm *)NULL, *localtime(); /* interpret time_val */
int yy=0, mm=0, dd=0; /* today (emphasize today's dd) */
int idd=1, iday=0, daynumber(); /* day-of-week for idd=1...31 */
char aval[64]; /* ascii day or 4-digit year */
char *small = sizedirectives[(fontsize>1?fontsize-1:1)], /* small chars */
*smaller=sizedirectives[(fontsize>2?fontsize-2:1)]; /* smaller */
/* --- calendar data --- */
static char *monthnames[] = { "?", "January", "February", "March", "April",
"May", "June", "July", "August", "September", "October",
"November", "December", "?" } ;
static int modays[] =
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0 };
/* -------------------------------------------------------------------------
initialization
-------------------------------------------------------------------------- */
/* --- get current date/time --- */
time((time_t *)(&time_val)); /* get date and time */
tmstruct = localtime((time_t *)(&time_val)); /* interpret time_val */
yy = 1900 + (int)(tmstruct->tm_year); /* current four-digit year */
mm = 1 + (int)(tmstruct->tm_mon); /* current month, 1-12 */
dd = (int)(tmstruct->tm_mday); /* current day, 1-31 */
/* --- check args --- */
if ( year<1973 || year>2099 ) year = yy; /* current year if out-of-bounds */
if ( month<1 || month>12 ) month = mm; /* current month if out-of-bounds */
if ( month==mm && year==yy && day==0 ) /* current month and default day */
day = dd; /* emphasize current day */
modays[2] = (year%4==0?29:28); /* Feb has 29 days in leap years */
/* --- initialize calendar string --- */
strcpy(calbuff,"{\\begin{center} {"); /* center `month year` above cal */
strcat(calbuff,small); /* small font size */
strcat(calbuff,"\\text{"); /* month set in roman */
strcat(calbuff,monthnames[month]); /* insert month name */
strcat(calbuff,"}\\ "); /* add a space */
sprintf(aval,"%d",year); /* convert year to ascii */
strcat(calbuff,aval); /* add year */
strcat(calbuff,"}\\vspace*{1pt} \\\\"); /* end top row */
/* --- now begin calendar array --- */
strcat(calbuff,"\\begin{tabular}{|c|c|c|c|c|c|c|} \\hline" );
strcat(calbuff,"{");strcat(calbuff,smaller);strcat(calbuff,"\\text{Sun}} &");
strcat(calbuff,"{");strcat(calbuff,smaller);strcat(calbuff,"\\text{Mon}} &");
strcat(calbuff,"{");strcat(calbuff,smaller);strcat(calbuff,"\\text{Tue}} &");
strcat(calbuff,"{");strcat(calbuff,smaller);strcat(calbuff,"\\text{Wed}} &");
strcat(calbuff,"{");strcat(calbuff,smaller);strcat(calbuff,"\\text{Thu}} &");
strcat(calbuff,"{");strcat(calbuff,smaller);strcat(calbuff,"\\text{Fri}} &");
strcat(calbuff,"{");strcat(calbuff,smaller);strcat(calbuff,"\\text{Sat}}");
strcat(calbuff," \\\\ \\hline " );
/* -------------------------------------------------------------------------
generate calendar
-------------------------------------------------------------------------- */
for ( idd=1; idd<=modays[month]; idd++ ) /* run through days of month */
{
/* --- get day-of-week for this day --- */
iday = 1 + (daynumber(year,month,idd)%7); /* 1=Monday...7=Sunday */
if ( iday == 7 ) iday = 0; /* now 0=Sunday...6=Saturday */
/* --- may need empty cells at beginning of month --- */
if ( idd == 1 ) /* first day of month */
if ( iday > 0 ) /* need to skip cells */
{ strcpy(aval,"\\ &\\ &\\ &\\ &\\ &\\ &\\ &\\ &\\ &\\"); /*cells to skip*/
aval[3*iday] = '\000'; /*skip cells preceding 1st of month*/
strcat(calbuff,aval); } /* add skip string to buffer */
/* --- add idd to current cell --- */
sprintf(aval,"%d",idd); /* convert idd to ascii */
if ( idd == day /* emphasize today's date */
/*&& month==mm && year==yy*/ ) /* only if this month's calendar */
{ strcat(calbuff,"{"); /* emphasize current day */
strcat(calbuff,small); /* small */
strcat(calbuff,"$\\langle$"); /* enclose curent day in <> */
strcat(calbuff,aval); /* put in idd */
strcat(calbuff,"$\\rangle$}"); } /* finish emphasis */
else /* not today's date */
strcat(calbuff,aval); /* so just put in idd */
/* --- terminate cell --- */
if ( idd < modays[month] ) { /* not yet end-of-month */
if ( iday < 6 ) /* still have days left in week */
strcat(calbuff,"&"); /* new cell in same week */
else /* reached end-of-week */
strcat(calbuff,"\\\\ \\hline"); } /* so start new week */
else /* --- terminate last week of month --- */
if ( iday < 6 ) { /* only if there are empty cells */
strcpy(aval,"&\\ &\\ &\\ &\\ &\\ &\\ &\\ &\\ &\\ &");/*empty end cells*/
aval[3*(6-iday)] = '\000'; /* cells after last of month */
strcat(calbuff,aval); } /* add end-of-week string to buffer*/
} /* --- end-of-for(idd) --- */
strcat(calbuff,"\\\\ \\hline"); /* final underline at end-of-month */
/* --- return calendar to caller --- */
strcat(calbuff,"\\end{tabular}\\end{center}}"); /* terminate array */
if(0) strcpy(calbuff,"testing");
return ( calbuff ); /* back to caller with calendar */
} /* --- end-of-function calendar() --- */
/* ==========================================================================
* Function: emitembedded ( imagenum, isquery )
* Purpose: Emits embedded gif (or png) message to stdout
* --------------------------------------------------------------------------
* Arguments: imagenum (I) int containing image number desired
* isquery (I) int containing 0 for command-line run,
* 1 for query mode, 2 for query mode but
* suppress msgfp output even if it's enabled.
* Returns: int #bytes emitted (returned by emitcache()),
* or 0 for failure
* --------------------------------------------------------------------------
* Notes: o If mathTeX fails, these images contain
* error messages that can be displayed
* ======================================================================= */
/* --- entry point --- */
int emitembedded ( int imagenum, int isquery )
{
/* --------------------------------------------------------------------------
Allocations and Declarations
-------------------------------------------------------------------------- */
int nbytes = 0, /* #bytes in embedded image */
imgtype = 0; /* image type 1=gif,2=png */
unsigned char *eimage=NULL, *embeddedimages(); /* retrieve embedded image */
int emitcache(); /* emit embedded image to stdout */
int maxage = MAXAGE; /* maxage is typically 7200 secs */
/* --------------------------------------------------------------------------
Retrieve and emit embedded image
-------------------------------------------------------------------------- */
/* --- retrieve image --- */
if ( imagenum<1 || imagenum>MAXEMBEDDED ) imagenum=1; /*out-of-bounds check*/
eimage = embeddedimages(imagenum,&nbytes,&imgtype); /*retrieve image*/
/* --- display message image on stdout --- */
if ( isquery ) /* don't emit error to shell stdout*/
if ( eimage != NULL ) { /* have embedded image */
imagetype = imgtype; /* set embedded image type */
nbytes = emitcache((char *)eimage,maxage,nbytes); } /* and emit image */
/* --- show message text on msgfp --- */
if ( isquery != 2 ) /* msgfp output enabled */
if ( msgfp!=NULL && msglevel>=1 ) /* display on msgfp, too */
fprintf(msgfp,"\nmathTeX> message#%d %s:\n %s\n",
imagenum,(nbytes>0?"succeeded":"failed"),
strwrap(embeddedtext[imagenum],64,-9));
/* --- back to caller --- */
return ( nbytes ); /* return #bytes emitted, 0=error */
} /* --- end-of-function emitembedded() --- */
/* ==========================================================================
* Function: embeddedimages ( imagenum, nbytes, imgtype )
* Purpose: Returns unsigned char ptr to embedded gif or png message
* --------------------------------------------------------------------------
* Arguments: imagenum (I) int containing image number desired
* nbytes (O) ptr to int returning #bytes in image,
* or returning 0 for error
* imgtype (O) ptr to int returning 1=gif, 2=png,
* or unchanged for error
* Returns: ( unsigned char * ) embedded gif or png, or NULL for error
* --------------------------------------------------------------------------
* Notes: o If mathTeX fails, these binary images of gifs/pngs
* supply error messages that can be displayed
* o String initializations for these binary images were
* created by my utility file2hex.c, and the important
* thing to notice is that the images are broken into
* one or more 500-byte strings. If you change that
* length, change variable stringsz correspondingly.
* ======================================================================= */
/* --- entry point --- */
unsigned char *embeddedimages ( int imagenum, int *nbytes, int *imgtype )
{
/* --------------------------------------------------------------------------
Embedded Image Allocations and Declarations
-------------------------------------------------------------------------- */
/* ---
* Each image broken up into 500-byte strings. See Notes above.
* ------------------------------------------------------------- */
static int stringsz = 500; /* sizeof each image string */
/* ---
* image1[] contains a 1885-byte gif rendering of expression
* \usepackage{color}\color{blue}\footnotesize\fparbox{
* (1) mathTeX test message:\\cgi program running okay.\\
* See mathtex.html\#message1}
* ----------------------------------------------------------- */
#define IMAGETYPE1 1 /* 1=gif, 2=png */
#define IMAGESIZE1 1885 /* #bytes in image1[] */
static unsigned char *image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\x39\xb4\x91\x1c\xe3RG\xb9\xfcU\x8ay@\xe4\x1e\xf1"
"\n\x89\x1d\xf\x92\x91\x93\x14\x83_\x3\xc4\x63>\x1e\xc2\x91\x89\xa0\x43"
"\x8e\x17\xe9\"R\xfc\x30\x80W\x89\x8b\"\x88lGF>\x92\fJ\x96\x2\\$\xd9\x16"
"\xb2\x12\xc2\x89\x33\xee\x0Q*\x12\x1\x1b\xd4\x42;\xad<\x85",
(unsigned char *) "\x86%K\xd9\xcc\x98V2\xd7\x90\xf2)\x86\xc1\xd6\xec\xa0"
"\xe6\xb1Z\xeaG\xf\x8b\xa0\xc7#L\xf6\xb1=\x90\xf2+S\x1\x66Xt\xc2\x93\x95"
"\x65\x65+\xa9\x19\x62\x10\xdc`\x96\xd1\\\xc2\x99\xa0\xca\\\xcb<\xc3\xca"
"\xb9\x41\x33Q\r@\x9d\xda\x34\xa7\xb9\xb6\xd1\"`\x88\xd3\xf\x34\x35\xc3"
"\x19r\x1e&k*3\xdak\x16\x33\xeO&\xe1\x8arA\x5r\xdeR\xab\xcc\xf5\xad/\xb3"
"\xa1\x9bo\xfct\x0\xfamS\?\xf9\xa4\\\x1c\x14\xb0\x8cu\xd0\xe9\x18\x94\x9b"
"\'!\x94\xb3\xd0\xe6\xd4\xe4\x9e\x63\xc1$uv\xe0NM\xf5 E80\f\xe0\x7f\x90"
"\xb2\xd1\xfcu\xb3\x37\x35\x99\xdcx>*\x9f\x4\xbd\x61!\x5\xe2\t\x10)W6\x92"
"\xe\x14\x30;\xb1\f\xe6|i\xd2\x0\x1\xc8>-\v\xe9+X\xd6\xd1\x64Z\xf1\xa2"
"\x86X\x87\xe7~\x82$\x17\x61\xa9\x42\xd0\x43\x45\x87\xd4\xf1!\x1c\x8d\xc8"
"y\xces\xaa\x8e\x90$\x8f@P\xeb\x1f\xdf\x83\xaa\xec\x82\x44\x91\xa4>/\x1cw"
"\xf2\'\x91\xbe\x1a\xd5+\xf5\xa8IL\xfa\xd1\x93\x98\x1a%\xdeU\xc9\xa8\xd9I"
"R\x84~\xca\x83J1pL72\xa1\xf,%E8\x11\xc2\t}\xdd\x41#\xcb\x98\xc3\x37\x1d"
"\x6~bR\x5\x9d\xe6\xc7\x87\x96\xa4\x11\x84_p\x0#=\xea\x85\x2\xe\xd0\b\x1e"
"\x84l\x15h\xa4\xd7+T0u\x8f\xd5\xach\x7f\x15\xda\xd1\x9aVR\xa7M-\x18\x32"
"\xab\xda\xd6\x16\x81\xb5\xae\x8d\xed\x10i@\xdb\xda\xda\xf6\xb6\xb8\xcd"
"\xadnS\x10\x2\x0;",
NULL } ; /* --- end-of-image1[] --- */
/* ---
* image2[] contains a 2296-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (2) mathTeX failed: probably due to\\bad paths, permissions,
* or installation.\\See mathtex.html\#message2}
* ------------------------------------------------------------ */
#define IMAGETYPE2 1 /* 1=gif, 2=png */
#define IMAGESIZE2 2296 /* #bytes in image2[] */
static unsigned char *image2[] = {
(unsigned char *) "GIF89a\x1\x1\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb"
"\xdb\xff\xe\xe\xff}}\xff \xffOO\xff\x16\x16\xff==\xff\x3\x3\xff\x1\x1"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0!\xf9\x4"
"\x1\x0\x0\x0\x0,\x0\x0\x0\x0\x1\x1\x38\x0\x0\x5\xfe` \x8e\x64i\x9eh\xaa"
"\xael\xeb\xbep,\xcftm\x97@\xae\xef|\xef\xff\xc0\xa0pH,\x1a\x8f\xc8\xa4r"
"\xc9l\xe6\x44\xce\xa8tJ\xadZ\xaf\xd8!4\xcb\xedz\xbf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xc0\xf4\xa9\n\xb1\xfe\xdd\x30~\xc7\xb3\a\x5\x4\x64%CZ\tvk\x84\v<\x16"
"\xc4\xc5&\"\x90I>\x97\xbe\x1\x80\xc8\xa2\?\xd3+.\xde\x93IX\x5\x8a~\x1c"
"\xfe\x92-q\x89\xcbN\xf6\xb8tq\xaa\xccXG\x8c\x8d 3\xa4\xc4\xe9\xa1\xcc}V"
"\x1c\x89\x1e\xbf\xd2\x19W\xe6\xe6##Q\xaf#\xd7\x61\x33\x38nZ\xe4\xaeY\x13"
"\x5`\xea\x1c\xf4\xca\xe6\xaex *e\xb9\xd9\x9f\xad\xba\xd7\x33Q\xe5\xb0{"
"\xa9\xd9J2\xc9\x84\xf3\x38\x91\x8f\x39\xd3\n\xa0\xddt\xb3\x9f\xa9\xf3\xf"
"\x10\xb7y\xd0wf\x0;\xd5}\'Ma\x8e\vFa<\x80\x8f\x66\x43\xaf\x8fx\xaajN\xb3"
"\xc4J\x94\x44\x8e\x30O\xac\xa4\x18\xf3\xaa\xd4\x94\x30\x80\xca\x80\xf8l"
"\x2;\x8e\x44\xe1\xb3\x80\x14\x13@.\xa2\xfeiO\xa5:\x85\xd7\x46\x5\xc8_0I9"
"\xd6;\xd4Y\xd3Z\xa6\xfa\xf0\xb4\x15\xee\xa3\xe2_\xfb\xfa\xd7\xc8\x6\xea"
"\xb1\x93\xcdl\tG\xae\xd9\xd0\x96\xf5\xb3\xa3M\xed\xb3N\xbb\xda\xd8V\xda"
"\r\xb6\xcd\xedn{\xfb\xdb\xe0\xe\xb7\xb8]\x0\x80\x10\x0\x0;",
NULL } ; /* --- end-of-image2[] --- */
/* ---
* image3[] contains a 2235-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (3) Can't mkdir cgi-bin/mathtex/\\cache directory: check
* permissions.\\See mathtex.html\#message3}
* --------------------------------------------------------- */
#define IMAGETYPE3 1 /* 1=gif, 2=png */
#define IMAGESIZE3 2235 /* #bytes in image3[] */
static unsigned char *image3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"\xe2n\xe\x41\x96\x62l\xe\xdcS\xc0\x8f\x9c=\xb9\xca\x66Z\xc9\x65\xe1jyi"
"\xa6G|\x4\x19p\n\x98\x92\xa0\x84\x83\x92\xb1-\x99\xa6o\xff\xe5@\a\x2\x92"
"@\xd0\x8e\x98\x46\x10\xa8U\x97\xe\xe8\xc1\xc0^\b\x84\x6O\'\x9f\xe0Q\xe3M"
"\f4\x80Y\x3\rP\x82\xe8\x82\x38\x36\xe0@\x80\x86\x1d\x90\xe8P\x93.:\x14"
"\x7f\x1\b\xe6\x94\'.)Zi\x90>0\xf0\x9e%\x0@p\xc0\xa9\v\xfc\xb1\xe8j\x9d"
"\xd8\x13\a\xa5\x9e\xc6\xea\x8a\xe(}\x1a\xeb\xa0@\x19\xda\xe8\xa3\xb0\xc2"
"Z\x80\xa3q\x18 \'S-e\xb2\xd5\x2z\xf8\x82\x9c\x46=|x\xd3)\f\x14\xd7\x83"
"\x1d\x85\xfe\x11\x39\x84\xb5K\xf4\x81\xad\x10\xc3,\x10\x95\'\t\xdc\xf8"
"\x83\x44@\x10 \xed\xb5r\x4\xe1\x11\xb9\x39\x98{\x84\x9dZ\x9d\x9b\x3\x2"
"\xca\xb2\xb1\x86I\xed\xea(E\xaa\xf6\xf6\xc0o\x9d\xcc\xf6\x30\xe\xf\xa3"
"\xf5k/{\x94X\x81\x80\xb8\x6/\x8c\x4\xbc\xd3\x31\xb7\xad\xc1\x14\x43\x81"
"\xc0\xc4j\\\xfcp\xc0\x15w\xec\xf1\xc7\x3r\f\xf2\xc8$\x8f\f\xf1\x11\x85$",
(unsigned char *) "\x91r\xc9\xcc-R\xc4\xca,Sq2*\x6\xf9\xb0\v\x84\xed \xc1"
"n\x16\x37\x17\xd1\xf3\x18\xb6\x4\x11t\x14\x33\x1b\x11\x19\x11\xbf\x15"
"\x66\x34\x19G\xfT\xb3\x15\x3\a\x11\x35\xd1\";\xd1\xb4\x10W\x17\x1\x91"
"\x18Y\xfb\xd0u\xcc\x1bk\x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5&nM\xa4h\xf0P\x8ev\x89\x5"
"\xb0j\x93\xcb\xddX\':\x98\x90\xce\x38hY\xdbR\x82\xa2\xd8\xc5\xd5\x42^b"
"\x80\x17hD\x10\x87\xf0\x85o5\xe6\x43\xa0\x62\xd4\x43\x1b\x45~v8@\x1m~"
"\xd0\x11Z4\x16\xce\x89\xb0\xfdLk\xad\x17\x1c\xf9\xad\xd1\xb6\xe6\xa0\x9d"
"\x39PC\x8d\xcf\xfa\x44v\xfc\xe4\xc2\xc9\xe6\xd0\x91\n\x1e\xc3\xb8\x1\x3!"
"u\xf0\xc3@\xe5\"7r\x0*\xc8j\xfe\x8d\xa8\xdc\x6\xe\xae\x86,\x82P\a[\xd8\a"
"\xee~\xa4:\xa2@\xf\x38;XN\xe7\xa8!\xaa\vJ\x14\xe4n\x88]E\xba\b;3D\xe3"
"\x8c\x98\x63#\xe9\x36\xb7L\x8a$\xcf\x1f\x14\x10\x10J|\xab=)\x82\x1c\x17"
"\xab\x38\xe0\xc9\xbc\x17\x44\x91\x85\xdc\x81\x38t\xde\xaaUB\a\xce\x80",
(unsigned char *) "\xa3h$\fO\x10\x8e\x11M\xe1P\x93~(\xdc\xd8R\x99#\xa7"
"\x13\xcap~\xb1\xb3_\xfe,\x86=\xd9\x8d\r\x85\x19\x19\x1a\x16\x63%I\x91"
"\xdc\x1\x85[\x2$\xccz!\xaa\xa9\xa0\x4\x4\xf4\xf1J\xc7\x35\xf3~\x92\x92"
"\xe6\xa2<\xa9\xabY\x9e\x84\x95\xc0\x34r0\x89\x45\x13\xad\x94\x84\x15\xa5"
"\x98\x66\x1e\x80\x15\xcdij\xf3LX\xa6U\x90\xa5\xdc\x63oZ\xb3;\xdf\x14\x1d"
"\xe7>Y\xaaS\xf9\x30z\xcd\x9c\x83\x9e\xbe\x1a\x6\x2i\x8c\x12\xd2YHp\x7f`"
"\xcex\x9a\"\nK\xad\x87\x39\xd8\f\tv>C[\xf3L\xc6\xb7\b\x10\xae;\xd7\x43"
"\xa4\x63}*J\xbb@\xd0\x88\xc2\x96\x1_\x91\xd3W\xc7$\xbah+\xc4\x4\xd1\x62@"
"\x18\x43\'\xad\xe8J{\xba\xa2\x94\xfe\xb4\xa8\x63\x16\xeaQ\x9b\x1a\x64"
"\xa5>\xb5\xaa)\x96\xeaU\xbbz\r6\x88\xb5\xacgM\xebZ\xdb\xfa\xd6\xb8\xe\x1"
"\x0;",
NULL } ; /* --- end-of-image3[] --- */
/* ---
* image4[] contains a 2238-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (4) Can't mkdir cgi-bin/tempnam/\\work directory: check
* permissions.\\See mathtex.html\#message4}
* --------------------------------------------------------- */
#define IMAGETYPE4 1 /* 1=gif, 2=png */
#define IMAGESIZE4 2238 /* #bytes in image4[] */
static unsigned char *image4[] = {
(unsigned char *) "GIF89a\xe9\x0\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb"
"\xdb\xff\xe\xe\xff}}\xff \xffOO\xff\x1\x1\xff==\xff\x16\x16\xff\x3\x3"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0!\xf9\x4"
"\x1\x0\x0\x0\x0,\x0\x0\x0\x0\xe9\x0\x38\x0\x0\x5\xfe` \x8e\x64i\x9eh\xaa"
"\xael\xeb\xbep,\xcft=\x2x\xae\xef|\xef\xff\xc0\xa0pH,\x1a\x8f\xc8\xa4r)Z"
":\x9f\xd0\xa8tJ\xad\xf2\x9a\xd6\xacv\xcb\xedv\xb1\xde\xb0xL\x1e\x83\xcb"
"\xe8\xb4z=<\xfb\x6\x84\x1e\xc2\x31,(\x6\xb8\x82\xb1\x80x\"\x14zr\x80\x61"
"\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x9a\x65\x1c\xc5&"
"\xcajMu\xb8\xb4\x1f\x17^\xc8=\x1d\x61\x61\xfdlc\x0\x6<lB\x0\xa4\x86\xd9"
"\x80\x18\x8e\b1+<\x91\x18\"\x5i\xe8\x9e\x2<jS\xa1yb\v\xab\xa3\x43\xf2"
"\x38\x91\x1P\x1c!\xfbp\x83\x87\x41]*N\xa8\v\xfe\b5\x86\xf4\b\xd6\xd9\xe;"
"X\xc2\x9f\x92V\x95\"=\x99\xaf\x19\x85)\x12*,\xf2\x90\xe2\xb0Q1i\xd4\xd2"
"\x1a\xdd\x43\x46\'yI\xfyT\x9f\x18\x99h\xa5@L\xc6L\x0\x38\x64$\xdc(&8.\a"
"\x91Y\xa2\x63~\xb6\x18\x9a,=\xa0P\x88i\x15\x35\x12\x45\xf\x46\xad\xe7};"
"\x80\x94V\xd4s\xabJ9\xa3",
(unsigned char *) "U\x9c\xc1\x94\x1\xf0 (BeR\x1f\x91\xe0\xa4,\x8a\x91\x0t"
"\xe5@\x95+)%%X\xe5*\xa0\x88g\x95\x9e\xd4\v(\rC+L\xf2\xf2U}\xea\x64\xaf"
"\x62\xa5\xcb\xcf\xc0\x61<\xc4 \xc0&@\xc5\xcbM63\x9a\xe0\xa8%\xbd\x82\xe0"
"\ve\xc9\xcc\x64\xea(\x2Ol\xc4\xad \x80\x63YuHV\xb7\"\xf1\xado\x16\xc1Y9"
"\x80\xa7\xf\xdc\x19\xce\x1f\xe6\x80gV#\x82&V\x92\xaf\xa9\xe5s\x92\xff"
"\x94\x2\x1c\x1e\xb8\x86\x80\xd5-\xa0\xeb\x43\xa8\x42\x17\n\x5|2\xf4\xa1"
"\x10=\x98\x1dX\x89\x86\x93\x41\xc1\xa2I\xc0\xa8\xfe:\xba\tQ+\b\xabX\xa1"
"\x91\xa1\x17\x2\x61\x33\xe3\xc4,\x16\x8f BIs\x80\x95\xa6`ra\xd4\x43\x3"
"\x8c\n@\x9d;\x8d\x41\x43\x46\xe9Ys\xd6\xc9\x83Z<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U\x92PB"
"\x6U+W\xf5\x63\x91\\\xc2)\xb0\x18\x45\x92\xfd\x94\aU\x5Y\x97\xb2\x12\x93"
"\x96\r\xb5\xcc)\xef\xf2\xc7\xce\x94&t\x9e\xa9\xe<\xed\xaau\x9cZ\xe1h~"
"\x9c\a\x3\xb4\xa9\xc1_`_\xc4Xb#\x9e\xd0\x13\b\xcc\xb2g9\xfd\x90\x84\xbe"
"\xd2\x37\x9d\xf5\x8cg8\t\xa8\x3i\xb1\x84\x0\xd5\x42X\xbe\x1c\x43\xdaQ+"
"\xf0\xd5\xc2\x62XW5\xe4\xba\x30\x46\x37\x9a\n\xc2(Y\x19\xf6\xc5\xdb\x8eQ"
"\xf2\xd2\xa0\xe\xa8\xa5\x43M\xea\x8a\x8d\xba\xd4\xa8N\xd7\xa9S\xcdj6\xac"
"\xba\xd5\xb0.\x83\rfM\xebZ\xdb\xfa\xd6\xb8\xce\xb5\xae\x43\x0\x0;",
NULL } ; /* --- end-of-image4[] --- */
/* ---
* image5[] contains a 2212-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (5) Can't cd cgi-bin/tempnam/\\work directory: check
* permissions.\\See mathtex.html\#message5}
* --------------------------------------------------------- */
#define IMAGETYPE5 1 /* 1=gif, 2=png */
#define IMAGESIZE5 2212 /* #bytes in image5[] */
static unsigned char *image5[] = {
(unsigned char *) "GIF89a\xe6\x0\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb"
"\xdb\xff\xe\xe\xff}}\xff \xffOO\xff\x16\x16\xff==\xff\x1\x1\xff\x3\x3"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0!\xf9\x4"
"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eb\xc2\a*w\x89\x85v\xd2\xe9\xce\xa1\x16"
"p[9@\xc6\x17\xdf\xb1_\xf3\x1\x97\x39;\xc2I\x8c:t \x19\xa1\x31p8\x11\x86"
"\x46\xbb\x1b\xa3\xef^#\xbc\x85L",
(unsigned char *) "\vrx\xfb\xb3\'\xba\x11\x0m\xb4\x63\x80{\x84\xa2\xfe\""
"\xe2\x41\x95s\xee\xc4\x14\xb0\n\x81X\xd1\x92\x80\x32\xe2(u\x0\xa9P.JJ"
"\x8e\xd2\x4%\'\xc2Hw\xcc\x18\xc5O\v\xcaQ\"\xa2\nS\xb8XK\f\xe5S\x8bk\x9c"
"\'\xa0\xe2\x84\xc5\xb3\x8cT/-\x11\xcc\\\xe2\x32I0\xa6\x12N\xd8\xd4@\xc2"
"\xac\x18\x8a\x99\x81U\x17\xc2\xa5.\x81\xa4\xe6&\xde,\x15\x1d\xa6i\x10o!"
"\x1\xadGF\x98\xa8\x92\xa1Mg\xe\x3U\x4P\x15\x34\x8fv\x11\x35\xe4\x13\xa1["
"8\xebK\xbf\x30,\x10\x99\xf6\x16w\xc6\xf3\x15\xb8\x32\xd0\x33T\xab\xbel\b"
"\xb4\xa0\x17)M/E3\xfa\xd1\xedr4\xa4\'\xed\rIS\xfa\xd2\x89\x46-\xa6\x37]"
"\xe9&\xd4\xe0\xd3\xa0\xe\xb5\xa8GM\xeaR\x9b\x9a\x4!\x0\x0;",
NULL } ; /* --- end-of-image5[] --- */
/* ---
* image6[] contains a 1954-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (6) Can't fopen("latex.tex") file:\\check permissions.\\
* See mathtex.html\#message6}
* --------------------------------------------------------- */
#define IMAGETYPE6 1 /* 1=gif, 2=png */
#define IMAGESIZE6 1954 /* #bytes in image6[] */
static unsigned char *image6[] = {
(unsigned char *) "GIF89a\xd9\x0\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\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"\xea\x63R\xdc\xd2\x39\xb8\x32@N\xc4\xa3\xd6\x1e\xc6s#_\xf8\xb0\x44p\bB"
"\xb5\xa0\xd0\xc6\x1c\f\xa0\x32~\x1c\x82\x1f@\x18\xad\x1b\x45g\x1,\r\x90"
"\x88x!D-\x16q\f\xa7\x14\t\x99\xc2\xc0\x13\x1c`J\f-\xfb\xad\x13@rZ)\xb4"
"\xa7\xa5\x63H\xaer&\xa7\xab\x5\xe9R\xf7\xba\xbe\xc5\xaev\xcd`\xdd\xedz"
"\xb7\n4\xfc\xaex\xd1W\x83\xf2\x9a\xf7\xbc\xe8M\xafz\xd7[\x83\x10\x0\x0;",
NULL } ; /* --- end-of-image6[] --- */
/* ---
* image7[] contains a 2110-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (7) Can't run latex program:\\check -DLATEX=$\backslash$
* "path$\backslash$", etc.\\See mathtex.html\#message7}
* --------------------------------------------------------- */
#define IMAGETYPE7 1 /* 1=gif, 2=png */
#define IMAGESIZE7 2110 /* #bytes in image7[] */
static unsigned char *image7[] = {
(unsigned char *) "GIF89a\xd9\x0\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb"
"\xdb\xff\xe\xe\xff}}\xff \xffOO\xff\x16\x16\xff==\xff\x1\x1\xff\x3\x3"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0!\xf9\x4"
"\x1\x0\x0\x0\x0,\x0\x0\x0\x0\xd9\x0\x38\x0\x0\x5\xfe` \x8e\x64i\x9eh\xaa"
"\xael\xeb\xbep,\xcf\x34\n\xdcx\xae\xef|\xef\xff\xc0\xa0pH,\x1a\x8f\xc8"
"\xa4N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\x12 \xd1;\xa6\x97\xf8\xe9\x1d\x9e"
"\xd0\x44|\x9b\b\xdf\xf5\xee\x17Kyl\x8f\n\xd5\v`\xf6\xd2w,n\xf8L,\b\x90"
"\x1f\xe\xd1\xb1IO\x82",
(unsigned char *) "\xcay\x8f\xd7\xca\x61\xd1r&\xe0\x39H/}\xf0\xa6 \xc0"
"\xe9\t\xeb$FQ\xfe\xc9\xb7\x43\xda\x82M\x90\xac\xd3\x9d\b\x90\xa7i\xf6o"
"\xc3\xdd<\xe6(L:\xd0/\x1c\x8a\x82<\xfc\x82-e<\x5j\xf8\x1\r\x0<\xc3\x8eyL"
"d>i\xb2\xc8H&\xc5\x90\x93\xcc\x64\x30,\xb9\xc9P\xce\xc2\x93\xa3Le\a\xd5"
"\xe0\xcaX\xce\xb2\x96\xb7\xcc\xe5.\xd3 \x4\x0;",
NULL } ; /* --- end-of-image7[] --- */
/* ---
* image8[] contains a 1896-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (8) latex ran but failed:\\check your input expression.\\
* See mathtex.html\#message8}
* --------------------------------------------------------- */
#define IMAGETYPE8 1 /* 1=gif, 2=png */
#define IMAGESIZE8 1896 /* #bytes in image8[] */
static unsigned char *image8[] = {
(unsigned char *) "GIF89a\xc6\x0\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb"
"\xdb\xff\xe\xe\xff}}\xff \xffOO\xff\x16\x16\xff\x1\x1\xff==\xff\x3\x3"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0!\xf9\x4"
"\x1\x0\x0\x0\x0,\x0\x0\x0\x0\xc6\x0\x38\x0\x0\x5\xfe` \x8e\x64i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"
":\x87O\x9c\x18\xa0\xd4\xab\x83\xb4\xf3\x8el+~\x8a\x8f>\xfc\xe0\n\xcd\xae"
"\xb0\xb6\xe5\xa9=\xcf\x1\xe6\x1c<s}\xf8\x91\x41\xf0\xfe\xa4\x43\x65\xad"
"\n\xf9\xd9\xc3JR\xcd\xf1\x0\x31\x6\x38\xd5\x95z\x3,\xd4\xd6\xb7[\x95\xb4"
"\x3\x3\xcc\x18\x10\x87z\xe3\xad\x36\x98\x1\x46]\xf9\x19H\xe2\xa2\x14UX"
"\xb0\x15\xeaUDAA0\x94\xbe\x36HEU\xbd\x85\x90\xfbN_\x86\x31,\x98\x2\xf0"
"\x36\x10Z\xbe\x43\xac\x14\x19\x61\xb3\x38\x96W\x0\x17gwY\x1b\xc5\xbd\x91"
"\x0}\xba\x96\x87\x18\xc6\xac\xb9",
(unsigned char *) "\x66X\xca\x9b\xe0\xa5\x17\x95|\xd9\xa2\xf2\xa0\x1ag2"
"\x80;W\xde|\x80\xbd\x19\x93\f.cbT\xda\x14\xca\x93}&\x19J\xaa\t\xcc\xc3"
"\x2\x6\x30P\n\?\xb9\x99<(\xd1R\x17\xdd\xef \xb2\xedvCi\xa7\xfd\xf2\x9ak"
"\xaf\x14pO\x3\xa9\x88\xcdn\xbeP\xf\x8d]\x10\xdc\x86\x45\xa5\xc9\xcb=c"
"\xb0\x41[=p\xda%\xe\xb0s^\x3\x99>\xe2\x9d\xa3W\x13\xfc_[\xdd\xd5\x15K"
"\xdc\xcd=7\xdeNP\x15L8%\x88\x1f\x65\xc0\x1d\x46Mn\x3s\xb3\x8cx\x3\xdfR"
"\xab\xb3\x85\xd0\xfe\x9d\xeel\x0\x7f\x10\x96\xc8\v\x81\xe4\x30 :\xe9x\x5"
"\x90\x80\x9fJ\xa1\x14]/\x18*\xa0\xa1\x89LJ\x9b_\x89\xa6\x87k\x88\x43\x5"
"\xe3\x64\xfb\x86\x0\x6\x87\r\xea\x6^k\x8f\xef\xb6\xb3\x1\xe2p(\xfe\x6"
"\xd5\x1a\x86\xad\x42\xc0\x1b\xbd\xcf\x8eu\xe9\x12\xbe\xf8\xc3\x94_\xee"
"\x80K\xf8>Hw\xc3\x8f\xce=q\x8b\xeG\xe2@~\x97\xde\f\xa2\xed\x8e\xe9\xf7"
"\xd8>#P\bz\x5\'\xfc\x95\xe1h\x15\xff\x3\x93\xfe\xac\xb0\x6`uA\x1\xae\x30"
"\xa0\x14\x10x\x91\x35\rpR\x10\x44\xd2\x3#HA\x18\x81\xae`\x15\x82\x1f\x19"
"\xe4\xe4\x4\xe\x1a\xc1\x83\xce\x39\xc6\xfb\xd4\x64\x96\x1b\xfd\'\\a\xb8"
"\x83\x9e\xcew\x84\x15\x16L\b.\x1c\x89\xe7\xb2T\x88\x43\xcc\xcf\x6\xdc"
"\x92Li\xc2@\x89\x42\x41\n5\xe7\xa0\x45-\x9c\xa4\x16-\x9d\xe6h;X\t\xc4z"
"\xf4\x43\'Hjj\x98i\"ap\xf0\x44 dC\x10\xa6\x0Sqd\xe4\x3\xcb\xe4\xcd\x33"
"\xcb\x1a\xfe\x88Hp\xe1\x93\x84\xd0$/\x9c\xdaHA*\xf2+^\x98q \x16\x89G\x18"
"\x87\x45\xa5\xb4\xd9\xe2\x8dl\x84\x96\x3\xcc\xc8\x9fl\x9d\xec(\xac\x18"
"\x80t\xca\xb8\xa9>\xa6\x31\x8c\xcd\x8aV\"\x99\x41\x10J\xcc\x3S\xc4\b\xe3"
"x\xc2\x31\x8e\xef]\x90\x17\x30\t\x0\x1b\xfeU.N\"\x91\x17N\xa1XV\x18\xd7"
"\x43\x8a\xf5\xc2",
(unsigned char *) "\x93\x11\x11\xd8!\xce\x61\xcaR\xe\xcd\x64\x82p\xc5;"
"\xc2\xe5\n|\xbdrT\n3\x80\xc3t\xd9\x9c\xcd\xe4\x64\'aQ\x11*\x1\x0\x13\x99"
"X2\bn\x98J\xcd\\\xe7\x32;\x5\xce\x6\x8b\x41\xcc\x33\x97\xb9\x17\xf\xcd\v"
"h\xcf\x9c\x46Z\xec\x42\xb5\x8c\x35Sg9\xc3Y\x8f\xa2\xf9\a\x94\x88\xac\x99"
"iYK\x2\xda\xb2-\xd0\xe5\x5\a\xf9\xd1\x9a\xd6\xa6#5\xda\x88\x46j\xe1\x99"
"\xa7sL\x3\xc4{fs\x10qP\x0\x34\xf2\xa2\x9aw\xe2s\x10Z3\x1b\xd9\xfe\x33"
"\xb6\x64\xd8\xf3\x11\xf4X\xa3\xd6\x8c\xb7\x19\xb2(\xf1\x15\x2\x8b\\\xeb"
"\x66\xce\x63\xbek>\xac:\xc9\xb9\xce\x41y\xa1\xd1g-\x8e=\x1e\xfd\xceH\xb7"
"\x12P\xbc\xe8\xe4\x31)\x1d\x15G-GL^P\xee\x43 \xedU\xe\x34J\xd1\xa6u\xd1"
"\x9d\x8e\xc8\v\xe7N\x97\xa2L\xa1\xe#\a\xd8\x1d\xf7\xf2#\"\xff\x14\xcf"
"\x10K\x8d\xc7S\x89Z\xa0=*\xaf\x11\xc4\xe0\x9d\x84\x9e\xaa\x10\xa5z\xd5"
"\x44oa\xc6\xddp\xfa\xd5\xec\x15uz\xd7s#\xf5\xf6\xc9\x9f\x11-\x82l\a\xe0"
"\aU\x8e\xaa\xae\xf9\x1c\x93\a\b(E^\x88\x84\x8b\x1b\xf2\x41G\x7f\x65!\x8f"
"\x8e \xc8,\xb6PH\xf6K\x9f\xfbp\xb0\x80\x82\x12\x0U\x82\xc5\xa0_\x93TA(= "
"\x90\x1d\xfd\x2=rA\x1f$L\xb0\xb2Up\t\x9c\xc8\xf0\x18\x83\x32\xe1\xb3\xa0"
"M-\x16P\xab\xda\xd6J\xe9\x92\xae\x8d\xad\x16X+\xdb\xda\x1a\x81\xb6\xb6"
"\xcd-\xdbh\xc0\xdb\xde\xfa\xf6\xb7\xc0\r\xaepU\x10\x2\x0;",
NULL } ; /* --- end-of-image8[] --- */
/* ---
* image9[] contains a 2215-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (9) Can't run dvipng program:\\check -DDVIPNG=$\backslash$
* "path$\backslash$", etc.\\See mathtex.html\#message9}
* --------------------------------------------------------- */
#define IMAGETYPE9 1 /* 1=gif, 2=png */
#define IMAGESIZE9 2215 /* #bytes in image9[] */
static unsigned char *image9[] = {
(unsigned char *) "GIF89a\xe1\x0\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb"
"\xdb\xff\xe\xe\xff}}\xff \xffOO\xff==\xff\x1\x1\xff\x3\x3\xff\x16\x16"
"\xff[[\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0!\xf9\x4\x1"
"\x0\x0\x0\x0,\x0\x0\x0\x0\xe1\x0\x38\x0\x0\x5\xfe` \x8e\x64i\x9eh\xaa"
"\xael\xeb\xbep,\xcf\x34\f\xdcx\xae\xef|\xef\xff\xc0\xa0pH,\x1a\x8f\xc8"
"\xa4P\xa4l:\x9f\xd0\xa8t*eR\xaf\xd8\xacv\xab\xb5r\xbf\xe0\xb0\xf8\xeb"
"\x1d\x9b\xcf\xe8\xf4\xaf\xdc\x1b\x10x\x88\x86\xb0\xa0\x18\xdc\n\xc5\x2"
"\xc2\x8cP\xe0\xd5\x80U\x1@\x5\x6\x37q\n\r{\x0\x3\v\?\x3\t\r\n\x4\v\v\x86"
"\x44\a\t8\x7f\\\x5\t\x97<\x91\x81\xa3K\x83\?\a{\b\x1x\b\a8\vv<\x3\xf\x8b"
"\x37\x9fy\f8\xa0\\\x6\xbb:\x4\xb1\xa4\xc2<l:\x90\x37\r\xae\x37\a\xb1\x3"
"\x10=\a\xb9\x39\x3\xbe\x41\n\xc8\xd5Y\xbd\xc3\xdc\x45\xc5\x39\xdb\x0\x6"
"\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xae\x98\x1"
"\x35qCk`A\x0\x39\xa0RGml\x93\xe5\x9c<\x18\x17\x95\x93\xa7\x89\xda\x43P"
"\xf6\x3)\x85\xfe`\x99\xbdL(\x14H:\r\xab\xc0\x92\x10\x87\x30T\x9c\xf7\xc3"
"\xeMQ\xaal\x9c\xf8\x93\x18\xba\tP*xU\x94_hUO\xe6\x98\x6>\xf7Y\n\xff\xd8"
"\x96\x19l,\b+\xd2\x1e\xfa\xd1\xcf\x32\x34\xa4\'=\nIS\xfa\xd2h\xb0\x34"
"\xa6\x37\x1d\x6Ms\xfa\xd3\xd1\xaa\x81\xa8GM\xeaR\x9b\xfa\xd4\xa8\x46u\b"
"\x0\x0;",
NULL } ; /* --- end-of-image9[] --- */
/* ---
* image10[] contains a 1465-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (10) dvipng ran but failed:\\See mathtex.html\#message10}
* ---------------------------------------------------------- */
#define IMAGETYPE10 1 /* 1=gif, 2=png */
#define IMAGESIZE10 1465 /* #bytes in image10[] */
static unsigned char *image10[] = {
(unsigned char *) "GIF89a\xcd\x0(\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0\xff"
"\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb\xdb"
"\xff\xe\xe\xff}}\xff \xffOO\xff\x3\x3\xff==\xff\x1\x1\xff\x16\x16\xff[["
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0!\xf9\x4\x1\x0\x0"
"\x0\x0,\x0\x0\x0\x0\xcd\x0(\x0\x0\x5\xfe` \x8e\x64i\x9eh\xaa\xael\xeb"
"\xbep,\xcf\x30`\xdfx\xae\xef|\xef\xff\xc0\xa0pH,\x1a\x8f\x41\x11r\xc9l:"
"\x9f\xd0\xe8P)\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be\x91\xf2\xf5\x94\x0K\\~\xb9\xab\x45;ia"
"\xe1\xae\xb7\xf4]\x19p\aW\xee\xdb\xc0\x95\xf5\xfd\xcd\xc9\xbe\x64\xd6"
"\x81\a\x80vl\xef\x90\xa3\xed\xb7\x39\x86\x92\xb2\x92\xa4%\xcd\x89! :R"
"\x88\x86\xc4\x8a\x46\xf0\xc8GF\xdaQ\x8f\xd8P@\x89\xa8\xa4\x11\x1ey\xc4"
"\x33\"(\x8d\a\x8a,\x81 ,\xcd\x91l\xd3.\x1c P\x84!l\xc7\x0\x19\x10\x91"
"\x35\x34\xa6\x16\x4\xf0\xde\xc8\x1ax=\x12I\f*+T\x10\x83n\xf2 \xe5-\xcfs"
"\xaaRDi\xb8\x14\x12\\\x95I\a\xd6z\x93\r\x8cH\x84$\xee\xe0\x63%4\xc2\x1d"
"\xd0\xa4*%V\x91\x16\x62\"\x0\x99\x96\x38\x8a+\xf5\xcfU\x99r;\x80\xc7$"
"\x13\x6=)mb\x9b\x2\xa3\xa6\xa4\xe1\x45\x32(\xaa\x34\x6\x2\xa2\x1a\xe7H"
"\xc7\x1f\xd6\xf1\x8ex\xac\x9c\x1c\xf3\xc8GL]\xaa\x8f\x80\xec\x5\r\x6I"
"\xc8\x42\x1a\xf2\x90\x88L\xa4\fB\x0\x0;",
NULL } ; /* --- end-of-image10[] --- */
/* ---
* image11[] contains a 2134-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (11) Can't run dvips program:\\check -DDVIPS=$\backslash$
* "path$\backslash$", etc.\\See mathtex.html\#message11}
* ---------------------------------------------------------- */
#define IMAGETYPE11 1 /* 1=gif, 2=png */
#define IMAGESIZE11 2134 /* #bytes in image11[] */
static unsigned char *image11[] = {
(unsigned char *) "GIF89a\xd3\x0\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb"
"\xdb\xff\xe\x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f\x8e\xa9\x84\xd2\xc9\x6i\x93\x13,\x5X#\'\x87J\x6k"
"\xbdV\x9d\xeb\x34\xa5\xb6\xd8\xb1\x5i\xc3\x63\x89\xcf&4\xb3\xb5\xc2\xe7"
"\f\x11P\xc4\x1b\xe8\xe8\x83\xde\xe3\xeb\x85h\x86\x1fo \x96;\xc5\xa5JN"
"\xda\x9d\xb3\x94%\xa6\x96;\xcf\r\x8c\x1\x8d\xa7\x14Ve7\xba\xd6\xe8\xc3T"
"\x14\x4\x80\xa9,7C\x8f\x2/f\xe3\xfa\xc9S\xb1Q\x1n\x9c\xa2\x3\xee\x62\x0@"
"\n\xf0LDJ\x13\x1d\x63\xd4\bA\xea(\x8a\x45\xf2o\x94\x0\x89\x8f\x46\x18"
"\x84\x13\x99\x0\xf0\x8d\x4<\x8f\x34)x\x19\x11I",
(unsigned char *) "Z\x83\xf3Ka\xf9\xba\x44J\x4H\r,2\xfc\xa2:\xfa\xc3\x39]"
"*W}\xe7;!\x13\x61\xd4\xc4\x45 \xc6.#)\x88\x16\'\xe1\x92\x90\xc2\xa6\x13"
"\xe4\x19\x9f\xa5\x98RN\x9e\xac\x5\xa0\x80\xf3\x8a\x43\x11 Q\xaf\xba\x82"
"\xc1\x80\t\x86\x97.\v\f\x99\x8a\xa9\x10\xad\x30\x64\"{!\x19\xc2:\x3\x2"
"\xbf\xd0\x64\'[YVU\xbe\xb2\x96\x85\x91\xe5-{\x99\x97_\xe\x33\xaf\xba,"
"\xe6\x32k\xa1\x6hN\xb3\x9a\xd7\xcc\xe6\x36\xbb\x19\x6!\x0\x0;",
NULL } ; /* --- end-of-image11[] --- */
/* ---
* image12[] contains a 1426-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (12) dvips ran but failed:\\See mathtex.html\#message12}
* ---------------------------------------------------------- */
#define IMAGETYPE12 1 /* 1=gif, 2=png */
#define IMAGESIZE12 1426 /* #bytes in image12[] */
static unsigned char *image12[] = {
(unsigned char *) "GIF89a\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10N\x16\x41\xd1\x94UV\xa9\x83\x96=P\xa4\b\x97h\x1c"
"\xb9\x3\x1\xdc\xc1Q$\x14\x33\x65\xa3\x66r@\x10#\xc4\x61P(p\x88\x89k\xd6"
"\xd9\x9f\x98<\\\xc9\x3\x2`\xda\xe9\xe7\x9fS\xe0\t\xe8\xa0\x84\x86Y\xe8"
"\xa1\x88vQ\x13()\x82\x62\x46\x1fP@\xba\x84\xa4@\xa1\xd2g\xa2<\xd4\xb4"
"\x64 Ij\xb1\xc7(\x9a\x1c\x1j\xa8\x98\xcc\x93\x83K\x0\xf0\x37(!\x86 r\xa9"
"\x39\x5\xa4\xe6\x61\x18\x97\x34\x86\x44\x9a\x9d!\xa6\x43\x91\xe\\z\x86*"
"\x10\x36i\x8d,>\x98\xa3\x0u\x15\x81\xd1Mm:,{\xc4L\xce\x6\xb1M \xe6\xfe"
"\x1d\xea\xa0r\xd3\xf4\x0\x17\x4!\xd1\xd5\xd2\x1c,\xfdG\x11\?\x11}\x98"
"\xd9\x44\x36\x30\xd0P$\x1e\x81\x84[\xb9\xe0~\x14R\xb8.\xc9\xd3\f\x1\a\x0"
"X\f\xbc\xe9\xca\xbb`\xb9 J\xe4\x1a\x36\x84\x65\x4\x15\xb9\x13\x9a+p\xba"
"\xdf\n\xa4X\x93\x3\x15\x94\xee\xba\xde\"\"\xf\x90\xe2\xe6\xf4\xdcRz\xda"
"\xb0\xa8\x1\r\x88\xc0\x46Z\x19I\x88]\xc9\\\xed",
(unsigned char *) "\x95\xd5VeaU\xab\xcan\x91<\x80V\x1a\xc5Q\xe6q\xc1\xe5"
"\xbcr\x84\x91\x5r\bHY\x1d\"\x93\xca\x30\xa7z\xf2\xccM\xc5\xa2\x92S\x94"
"\xb4\xec\xb1\"\?\xca\x9c\xdaiV\xe9\xab\xc3\xa2\xae< \xd4\x65\x99q\xc2ufx"
"\xfa\x66\x8c\x62\xe9\x89\x1d\xc9\xd7\xd1\xa4\xda\xc0\x8c\xc0\x94]ke\xba"
"\tK\xd6x\x91\xa1\x1d@a\x83)\x82\x37\x9c\xd0P\xe6q1o\xd8\xadq\x82v\xed`,h"
"\xac\x18\xa7\x9a\x36p\v\x87\x9bX\x8fG&\x91\x37\x1e\x16\x1e\xd9\x39\x91"
"\xdbwN\x1c\nt\x93\xd9m\xfe\x99]\x8e\x8b\xe2\xb2\x39\xa0U\xe9{\r\xd7KB&-"
"\x8e\xce\x32\xa4u\f\x80\xb1\xbf\x34\x80\x0\x1\xf8\xc9\x98\xbb\xae\x9a"
"\xcfW\x1f.\xe8\x45\xd6\xd4\xee\x2\xd1G\x89\xaa\xbe\x41\x16\xbc\xe6\x90q"
"\x8e\xd9U]\x8b~_^\xb1\xd9\x30K\xf5\x0\xcc\xe2;.7\xe3\x9e\xd7\xe0\x8b\x38"
"%\x9d\xb6\x82\x9e\x4If\xac\x15\xd3\xe3\x8f\x6\xac\x7f\xb3\x44\xac\xe8X"
"\xa2\x8d!6\x2\xa3\x8c\xf2\xbf\x18\xa3\x85\xee{\xd4\bD\x8fhF\xfe\x9eq\xbf"
"\x84\xc5\xaf\x44\x3\\M\xb5\x44r\x80\x3:\x10\x37\xee\xbb\x10\x1\xde \xc1"
"\x37\xd0\xfG\xf4\x39\x80\x6\x13\xc1#\x1f\x1\x86\x1\x2\"P\t\x8aU\xbe&)\"3"
"U\xa2\x88\xec\x80\xc0%_Mi\x10Op\xe1;(a9!\xec\xe1KR\xca\x12\xe\x16\x0:\x2"
"\xdc\x3\x86N\xc0\x1a\xa6\xecT\xb0\x1\x64\b\f\t\xb9\xc1\x7f\xaa \xc4!\xae"
"\xe9\x19x(C\xd7\x42\xc7\xc4\x12:\xf1\x8aX\xcc\x94\x15\xb3\xc8\xc5,6\xb1"
"\x8b`<\x14\xd4\x17\xc3H\xc6\?\xd1\xe0\x8chL\xa3\x1a\xd7\xc8\xc6\x36\xca "
"\x4\x0;",
NULL } ; /* --- end-of-image12[] --- */
/* ---
* image13[] contains a 2307-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (13) Can't run convert program:\\check -DCONVERT=$\backslash$
* "path$\backslash$", etc.\\See mathtex.html\#message13}
* ------------------------------------------------------------- */
#define IMAGETYPE13 1 /* 1=gif, 2=png */
#define IMAGESIZE13 2307 /* #bytes in image13[] */
static unsigned char *image13[] = {
(unsigned char *) "GIF89a\xef\x0\x38\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0"
"\xff\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb"
"\xdb\xff\xe\xe\xff}}\xff \xffOO\xff\x3\x3\xff==\xff\x1\x1\xff\x16\x16"
"\xff\x32\x32\xff\v\v\xff>>\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0!\xf9\x4"
"\x1\x0\x0\x0\x0,\x0\x0\x0\x0\xef\x0\x38\x0\x0\x5\xfe` \x8e\x64i\x9eh\xaa"
"\xael\xeb\xbep,\xcft\x9d\x2x\xae\xef|\xef\xff\xc0\xa0pH,\x1a\x8f\xc8\xa4"
"r\xc9\x13\x31\x9f\xd0\xa8tJ\xadZs\xce\xabv\xcb\xedz\xbb\xd9\xafxL.\x93"
"\xc3\xe6\xb4z\xcd&\xa2}\x3\x2\x11\xe1\x18\x16\x14\x3\\\xc1X@\xb4\xff\x80"
"Ro<\x5\x6\x39\x85yz\n\n\x6\x89\x3\v@\x3\t\xe\n\x4\v\v\x86\x45\a\t\x87"
"\x81Q{\x9e\x62\x83;\a~\x0\f\f\r\n9\r{\n\x1\x39\v\x89<\x3\r\xa6\x38\t\x99"
"\x44\x5\f9\xba\xa1J\xbf\xc0[\xa3\x39\x92\xa4\xab\x38\xe~\xaf\xc6\x10>\a"
"\xbd:\x3\xc2\x42\xc9\xe\xd5\xc3\x44\xd8\xda`\xb0\?\x6\xc2\a\xc9:\t\xd2"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1f|\t \nX\xcf\x9fn\xe9!w2\xeb\x0\x8fj\xd3\x38"
"\x17\xe5\xafs\xd2\x92L\xf0\xe4\xa3;\xfb\x1\x89\x85t\x89\x13\xe8$S\x9d"
"\xb1\xd4(7\x19:\x9d\x12\xc5\x61\xa1\x3\x88]%9\xb1Ysq\x0\x8e,\b\x80\x64\'"
"\xd1YP\x84\xea\x8b\x9b{\xf4#\xf7\x39`H\x16\xf5\xc2QN\xba\x88R\xa9\xc3"
"\xa6=8h;\xc8[\xad$x1\xd4\x9b\xf2\xd4-D\xc5/)\xc2\x8a\x0\xb2r\x17\x1c\xd0"
"\x65[\xb3\xee\xf4\n\x9e\xf5\"\x19\x80U\xacS\xf2j\xa5\xbf\x86\x42\x32x]"
"\x86\x33v\v\xd9\xc9\x8e\xb6\xb2\xa0-\xedj\xf\xcb\xd7\xd6\xce\xf6\xae\xa8"
"\xad\xedn\xaf\x81\xdb\xde\xe\xf7\x19l@\xeer\x9b\xfb\xdc\xe8N\xb7\xba\xd7"
"]\x82\x10\x0\x0;",
NULL } ; /* --- end-of-image13[] --- */
/* ---
* image14[] contains a 1444-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (14) convert ran but failed:\\See mathtex.html\#message14}
* ---------------------------------------------------------- */
#define IMAGETYPE14 1 /* 1=gif, 2=png */
#define IMAGESIZE14 1444 /* #bytes in image14[] */
static unsigned char *image14[] = {
(unsigned char *) "GIF89a\xcd\x0(\x0\x84\x0\x0\xff\xff\xff\xff\x0\x0\xff"
"\xff\xff\xff\x99\x99\xff\x64\x64\xff\xb8\xb8\xff--\xff\b\b\xff\xdb\xdb"
"\xff\xe\xe\xff}}\xff \xffOO\xff\x3\x3\xff\x1\x1\xff==\xff\x16\x16\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0"
"\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x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e2\x80\xe8\x8c\x96&1)\x84\xe8\xfc"
"\xc1\xa5\x16yp\xb2\x88\x11\xae\xbe\nD\xac\x37\xb0\xc4\x90\xa2\x82\x10R\\"
"\xa3\x9b\x14\x46\x63\x18\x9aP&\x13-\xda\f\xab\x63-YB\x90\xa8\"\xa3\x10yJ"
"*>\xec\xa5\xc0w\xaf\xfe\x80\x41\xcdg\x5\x1a\xdb\x3\x65\xd7\x6\x81\xcd"
"\x1f\xf3\x31\xba\xd3\x31\x83\xf1\xda\xc3\x1\xe|$J\?\xf5\xb0\x9b\x43T\x10"
"\xd5\x18\x91($\x89\xe2\x11R\xf1\xd6s/\x95+\xed\x83\x65:\a\x1c\xc6\x94<"
"\xf4\xd8k\x90h\xe\xc4\x1b\xe4\xbc\xc6\t5\xc8\x0\x61\xa5\x93\x30\xc1\v"
"\x17\xcc\xaf\?\b\xacs\x99\x31\x1a\xdf\xd3NC\xeb\x9a\xf3\xd2\xc5\x91\xec"
"\x4\xce\xae\x37\xcc",
(unsigned char *) "Y\x95\b\xeeH5\xc0\x1sM\x5\xdaX\xbb\xf1\xe6\x16X\x9f"
"\xd5\xdc\\\xcc/c\xd4\x80\x1cu\xde\x96s\xb0\x34\xd3\xbc\xd6\x1f\xb2\x18"
"\x94\x94,(\x15\xbd\x14\xcf\x6-\xd8\x99\xd4m}\x15\x96xSB\xcd\xdd\r\x4\xe8"
"\x84\xb2\rs\xce\xf8\x80]\xa6\x41\x46I\xd9\x90\x39\xda\\h\xa3\r]\x19t\xa7"
"\x1\xb3\x1e\x8c\x93\xe5\xd5\xdb\xdav\x1bs\xf\x9eo\xaf\x85\x36%\xa8p\x16J"
"\xe0\x80\xda \x1a\x7f\x0\x0\xb3\xa3\x63\x66\x8f\x63\x13`\xb5\x45{\xea"
"\x7f\xc5\x94\x42\xddu\xc7\xf6\xdd\x16rKq.\x9d\x88\xfe\x98\xd3xO\xe6w\x8b"
"\xf8\xb9\xe6r(\xf0\fd\x93@\xa6\xb9\x64\xd4\x15\xb0\xf\x4J\xc9\xce\x0\xed"
"\x9b\xf3\x16\xf\xc8\x98\xfb\xe5\x10\xd3\xb2\x5m\xee\xe\n\xc0\xf2\x33\x81"
"\xce /\x94r\x9a\x3H\x9f\x64\xf5%g\x80\xf2od\xec[X\xb7\x9e\xde\x9f\xf6"
"\x9e\xa5\xfe\x18Xf\xbf.\x97\x86\xcf\xe4\x61\x95\x1\xe6\xff\x37\xd6\xf3"
"\x41S\xbf\xb5\x37=H\xeb\bd\xb3M$\xa5y\xf7#y\xc0\x93\xfc+\xa0\xa4\x8d\x89"
"\x30\x92<\xa0\x94#\x1:\xe5~\x1dI\xc4\x43\x1a\x31\f\x1c\x41\xe9,.\"X\xff"
"\x1c\xe8,\xdf\x84\v$\xfb\x83\f\x1\x1f\x88\xa2s\x98\x63\r\x9d\x61\x5\x1"
"\xaaW#&\xf9\xe6\x0(\\\x0V\xf2\x17\xa1\ti\xe2\xf\x13\x12^\xca&7*\xc8\x98I"
"\"\x9b\xb2S\x9b\x80\x30\xa6\x1c\x12\x61Y>\x80\xd8\x5\x61\x45*\xf0\xc4IT8"
"X@\xeb\b\x90\xf\x32mcr\xa5\xca\xd3\x3\x1e\x16\xb1\x30\xc4\x83k\x2{B\xd8"
"\xa2\b\aS\xec\xa1\ffs&]\x15\xb6\xc8\xc5\x32\x46\x8a\x8c\x66L\xa3\xa2\xd0"
"\xa8\xc6\x36\xea\x89\x8dn\x8c#\x1ch@\xc7:\xda\xf1\x8ex\xcc\xa3\x1e\x65"
"\x10\x2\x0;",
NULL } ; /* --- end-of-image14[] --- */
/* ---
* image15[] contains a 1870-byte gif rendering of expression
* \usepackage{color}\color{red}\footnotesize\fparbox{
* (15) Can't emit cached image:\\check permissions.\\
* See mathtex.html\#message15}
* ---------------------------------------------------------- */
#define IMAGETYPE15 1 /* 1=gif, 2=png */
#define IMAGESIZE15 1870 /* #bytes in image15[] */
static unsigned char *image15[] = {
(unsigned char *) "GIF89a\xcd\x0\x38\x0\x84\x0\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*\xebg\x85\a\x94\xf1\xa0`HU\xbfR\xe9\x84\xf9\x11\xb6\t\xd7\xf0_\x18l"
"\xc5\xbe\x64\r\xf6\xb1\x98\x95\x82\x63\x33\xcb\xd9\x8eu\xf6\xb3\xf6\xbb,"
"hG\xcb*\xd2\x9a\xb6\xb1\x34H\xadjW\xcb\xda\xd6\xba\xf6\xb5\x31\b\x1\x0;",
NULL } ; /* --- end-of-image15[] --- */
/* --------------------------------------------------------------------------
Other Allocations and Declarations
-------------------------------------------------------------------------- */
/* ---
* aggregate array of embedded images
* ---------------------------------- */
static unsigned char **imagetable[] = { NULL,
image1, image2, image3, image4, image5, image6,
image7, image8, image9, image10, image11, image12,
image13, image14, image15, NULL };
int imagesizes[] = { 0,
IMAGESIZE1, IMAGESIZE2, IMAGESIZE3, IMAGESIZE4, IMAGESIZE5, IMAGESIZE6,
IMAGESIZE7, IMAGESIZE8, IMAGESIZE9, IMAGESIZE10,IMAGESIZE11,IMAGESIZE12,
IMAGESIZE13,IMAGESIZE14,IMAGESIZE15,0 };
int imagetypes[] = { 0,
IMAGETYPE1, IMAGETYPE2, IMAGETYPE3, IMAGETYPE4, IMAGETYPE5, IMAGETYPE6,
IMAGETYPE7, IMAGETYPE8, IMAGETYPE9, IMAGETYPE10,IMAGETYPE11,IMAGETYPE12,
IMAGETYPE13,IMAGETYPE14,IMAGETYPE15,0 };
/* ---
* other variables
* --------------- */
static unsigned char image[8192]; /* returned image */
unsigned char **imagestrings = NULL; /* image1, image2, etc */
int istring = 0, /* imagestrings[] index */
imagesz = 0; /* sizeof entire image */
/* ---
* look up requested image (if we have it)
* --------------------------------------- */
if ( nbytes != NULL ) *nbytes = 0; /* init for error */
if ( imagenum<1 || imagenum>MAXEMBEDDED ) imagenum=1; /*out-of-bounds check*/
imagestrings = imagetable[imagenum]; /* ptr to array of image strings */
imagesz = imagesizes[imagenum]; /* total #bytes in image */
if ( imagestrings == NULL ) imagesz = 0; /* sanity check */
if ( nbytes != NULL ) *nbytes = imagesz; /* caller wants #bytes in image */
if ( imgtype != NULL ) *imgtype = imagetypes[imagenum]; /* and image type */
/* ---
* build up images from constituent strings
* ---------------------------------------- */
if ( imagesz > 8192 ) imagesz = 8192; /* don't overflow buffer */
memset(image,0,imagesz); /* zero out returned image buffer */
while ( imagesz > 0 ) { /* still need more bytes in image */
unsigned char *string = imagestrings[istring]; /*so get next image string*/
int thissz = min2(stringsz,imagesz); /*entire string or image's tail end*/
if ( string == NULL ) break; /* looks like a program error */
memcpy(image+(istring*stringsz),string,thissz); /* concat string to image*/
imagesz -= thissz; /* fewer remaining bytes */
istring++; /* get them from remaining strings */
} /* --- end-of-while(imagesz>0) --- */
return ( image );
} /* --- end-of-function embeddedimages() --- */
/* --- end-of-file mathtex.c --- */
|