File: ll-reportmanual.xml

package info (click to toggle)
lifelines 3.0.50-2etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 11,160 kB
  • ctags: 6,517
  • sloc: ansic: 57,468; xml: 8,014; sh: 4,489; makefile: 848; yacc: 601; perl: 170; sed: 16
file content (5351 lines) | stat: -rw-r--r-- 164,902 bytes parent folder | download | duplicates (2)
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
<?xml version='1.0' encoding='iso-8859-1'?>

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY llversion '3.0.50'>]>
<book id="docbook">

  <bookinfo>


<!--

    this is lifelines.xml

    To use this file with SGML software, replace the text above
    this comments section with the following:

_________________________________________________________

<!DOCTYPE BOOK PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
	<!entity llversion	"3.0.50"> 
]>	
	
<book id="docbook">
  <?dbhtml filename="ll-doc.htm">
  <bookinfo>
_________________________________________________________


    Rafal Prinke <rafalp@amu.edu.pl> 1-Apr-200
    - Converted original LifeLines Reference Guide to DocBook SGML.


    Marc Nozell <marc@nozell.com>  26-Jul-2001
    - Changed <simpara> to <para>.  Newer docbook likes it better.

    Marc Nozell <marc@nozell.com>  21-Sep-2000
    - updated license info
    - point to lifelines.sourceforge.net
    - change references from lines302 to llines
    - make most lines less than 80 characters wide

    Rafal Prinke <rafalp@amu.edu.pl> 30-Dec-2001
    - Converted to XML.
          - closed all <para> elements
          - defined and corrected llversion entity
          - closed empty tag <void />
          - converted all tags to lower case
          - replaced ampersands with entities
          - added space at end of line
          - parsed against DocBook 4.1.2 DTD

                                                       -->
<!-- ================================================= -->



<title>

THE <application>LIFELINES</application> PROGRAMMING SUBSYSTEM AND REPORT GENERATOR

</title>

    <authorgroup>
      <author>
     <firstname>Thomas T. </firstname>
     <surname>Wetmore </surname>
     <lineage>IV</lineage>
      </author>
    </authorgroup>

    <subtitle><application>LifeLines</application> Version &llversion;</subtitle>
  </bookinfo>

  <chapter>

<title>
Report Programming Manual
</title>

<sect1>
    
<title>
Introduction
</title>
    


<para>

     The <application>LifeLines</application> programming subsystem
     lets you produce reports in any style or layout. You may
     generate files in <application>troff</application>,
     <application>Postscript</application>,
     <application>TeX</application>, <acronym>SGML</acronym> or any
     other <acronym>ASCII</acronym>-based format, for further text
     processing and printing. You access the report generator by
     choosing the r command from the main menu. You may also use
     the programming subsystem to create query and other processing
     programs that write their results directly upon the
     screen. For example, there is a
     <application>LifeLines</application> program that computes the
     relationship between any two persons in a database.

</para>



<para>

     Each <application>LifeLines</application> program is written
     in the <application>LifeLines</application> programming
     language, and the programs are stored in normal files. When
     you direct <application>LifeLines</application> to run a
     program, it asks you for the name of the program file, asks
     you where you want the program's output written, and then runs
     the program.

</para>


</sect1><sect1>
    
<title>
Tutorial Ahnentafel report
</title>

<para>

     For example, say you want <application>LifeLines</application>
     to generate an ahnentafel. Such a report might look
     like:

<example>

<title>
Example of ahnentafel report   
</title>

<literallayout>
1. Thomas Trask WETMORE IV
b. 18 December 1949, New London, Connecticut
2. Thomas Trask WETMORE III
b. 15 October 1925, New London, Connecticut
3. Joan Marie HANCOCK
b. 6 June 1928, New London, Connecticut
4. Thomas Trask WETMORE Jr
b. 5 May 1896, New London, Connecticut
d. 8 November 1970, New London, Connecticut
5. Vivian Genevieve BROWN
b. 5 April 1896, Mondovi, Wisconsin
6. Richard James HANCOCK
b. 18 August 1904, New London, Connecticut
d. 24 December 1976, Waterford, Connecticut
7. Muriel Armstrong SMITH
b. 28 October 1905, New Haven, Connecticut
8. Thomas Trask WETMORE Sr
b. 13 March 1866, St. Mary's Bay, Nova Scotia
d. 17 February 1947, New London, Connecticut
9. Margaret Ellen KANEEN
b. 27 October 1859, Liverpool, England
d. 10 May 1900, New London, Connecticut
... lots more</literallayout></example>

</para>



<para>

     Here is a <application>LifeLines</application> program that
     generates this report:

<example>

<title>
Example of ahnentafel report script   
</title>

<programlisting>

/*
 * @progname        ahnentafel_tutorial.ll
 * @version         1.0
 * @author          Wetmore
 * @category        sample
 * @output          text
 * @description
 *
 * Generate an ahnentafel chart for the selected person (tutorial sample).
 */

proc main ()
  {
    getindi(indi)
    list(ilist)
    list(alist)
    enqueue(ilist, indi)
    enqueue(alist, 1)
    while (indi, dequeue(ilist)) {
      set(ahnen, dequeue(alist))
      d(ahnen) ". " name(indi) nl()
      if (e, birth(indi)) { " b. " long(e) nl() }
      if (e, death(indi)) { " d. " long(e) nl() }
      if (par, father(indi)) {
        enqueue(ilist, par)
        enqueue(alist, mul(2,ahnen))
      }
      if (par,mother(indi)) {
        enqueue(ilist, par)
        enqueue(alist, add(1,mul(2,ahnen)))
      }
    }
  }

</programlisting></example>

</para>



<para>

     Say this program is in the file
     <filename>ahnentafel_tutorial</filename>. When you choose the
     <keycap>r</keycap> option from the main menu,
     <application>LifeLines</application> asks:

<screen>
What is the name of the report program?
enter string:
</screen>

</para>

<para>

     You enter
     <userinput><literal>ahnentafel_tutorial</literal></userinput>. Since the
     program generates a report,
     <application>LifeLines</application> asks where to write that
     report:

<screen>
What is the name of the output file?
enter file name:
</screen>

</para>



<para>

     You enter a file name, say
     <userinput><filename>my.ahnen</filename></userinput>.
     <application>LifeLines</application> reads the program ahnen,
     executes the program, and writes the report output to
     <filename>my.ahnen</filename>. <application>LifeLines</application>
     reports any syntax or run-time errors found while trying to
     run the program.


</para>



<para>

     A <application>LifeLines</application> program is made up of
     <type>procedures</type> and <type>functions</type>; every
     program must contain at least one <type>procedure</type> named
     <literal>main</literal>. The <literal>main</literal>
     <type>procedure</type> runs first; it may call other
     <type>procedures</type>, <type>functions</type> and
     <type>built-in functions</type>. In the ahnentafel example
     there is only one <type>procedure</type>.

</para>

<para>
     In the example program, there are some comments at the top,
     to tell the reader a bit about the program. The comments run
     from <literal>/*</literal> to <literal>*/</literal>, and are
     not necessary (but are suggested).

</para>


<para>

     A <type>procedure</type> body is a sequence of
     <type>statements</type>. In the example program, the first five
     <type>statements</type> are:

<programlisting>
getindi(indi)
list(ilist)
list(alist)
enqueue(ilist, indi)
enqueue(alist, 1)
</programlisting>
</para>



<para>

     The first <type>statement</type> calls the
     <function>getindi</function> (get individual) <type>built-in
     function</type>, which causes
     <application>LifeLines</application> to ask you to identify a
     person using the zip browse style of identification:

<screen>
Identify person for interpreted report
enter name:
</screen>


</para>



<para>

     After you identify a person, he or she is assigned to the
     variable <varname>indi</varname>. The next two
     <type>statements</type> declare two <type>list
     variables</type>, <varname>ilist</varname> and
     <varname>alist</varname>. <type>Lists</type> hold sequences of
     things; there are operations for placing things on lists,
     taking things off, and iterating through the list elements. In
     the example, <varname>ilist</varname> holds a list of
     ancestors, in ahnentafel order, who have not yet been reported
     on, and <varname>alist</varname> holds their respective
     ahnentafel numbers.


</para>



<para>

     The next two statements call the <function>enqueue</function>
     function, adding the first members to both lists. The person
     identified by the <function>getindi</function> function is
     made the first member of <varname>ilist</varname>, and the
     number one, this person's ahnentafel number, is made the first
     member of <varname>alist</varname>.

</para>



<para>

The rest of the program is:

<programlisting>
while (indi, dequeue(ilist)) {
  set(ahnen, dequeue(alist))
  d(ahnen) ". " name(indi) nl()
  if (e, birth(indi)) { " b. " long(e) nl() }
  if (e, death(indi)) { " d. " long(e) nl() }
  if (par, father(indi)) {
    enqueue(ilist, par)
    enqueue(alist, mul(2,ahnen))
  }
  if (par, mother(indi)) {
    enqueue(ilist, par)
   enqueue(alist, add(1,mul(2,ahnen)))
  }
}
</programlisting>

</para>



<para>

     This is a loop that iteratively removes persons and their
     ahnentafel numbers from the two lists, and then prints their
     names and birth and death information. If the persons have
     parents in the database, their parents and their parents'
     ahnentafel numbers are then put at the ends of the lists. The
     loop iterates until the list is empty.

</para>



<para>

     The loop is a <type>while</type> loop statement. The line:
<programlisting>
while (indi, dequeue(ilist)) {
</programlisting>
removes (via <function>dequeue</function>) a person from <varname>ilist</varname>, and assigns the person to variable <varname>indi</varname>. As long as there
are persons on <varname>ilist</varname>, another iteration of the loop follows.

</para>



<para>

The statement:<programlisting>

set(ahnen, dequeue(alist))</programlisting>is an <type>assignment</type> statement. The second argument is evaluated; its value is assigned to the first
argument, which must be a variable. Here the next number in <varname>alist</varname> is removed and assigned to variable
<varname>ahnen</varname>. This is the ahnentafel number of the person just removed from <varname>ilist</varname>.

</para>



<para>

The line:<programlisting>

d(ahnen) ". " name(indi) nl()</programlisting>contains four <type>expression</type> statements; when expressions are used as statements, their values, if any, are
treated as strings and written directly to the report output file. The <function>d</function> function converts its integer
argument to a numeric string. The ". " is a literal (constant) string value. The <function>name</function> function returns the
default form of a person's name. The <function>nl</function> function returns a string containing the newline character.

</para>



<para>

The next two lines:

<programlisting>
if (e, birth(indi)) { " b. " long(e) nl() }
if (e, death(indi)) { " d. " long(e) nl() }
</programlisting>

write out basic birth and death information about a person. These
lines are <type>if</type> statements. The second argument in the
conditional is evaluated and assigned to the first argument, which
must be a variable.  The first <type>if</type> statement calls the
birth function, returning the first birth event in a person's
record. If the event exists it is assigned to variable
<varname>e</varname>, and the <type>body</type> (the items between the
curly brackets) of the <type>if</type> statement is executed. The
<type>body</type> consists of three <type>expression</type>
statements: a literal, and calls to the <function>long</function> and
<function>nl</function> functions. <function>Long</function> takes an
<parameter>event</parameter> and returns the values of
the first <structfield>DATE</structfield> and
<structfield>PLAC</structfield> lines in the <type>event</type>.

</para>



<para>

Finally in the program is:<programlisting>

if (par, father(indi)) {
enqueue(ilist,par)
enqueue(alist,mul(2,ahnen))
}
if (par,mother(indi)) {
enqueue(ilist,par)
enqueue(alist,add(1,mul(2,ahnen)))
}</programlisting>

</para>



<para>

These lines add the father and mother of the current person, if either or both are in the database, to
<varname>ilist</varname>. They also compute and add the parents' ahnentafel numbers to <varname>alist</varname>. A father's ahnentafel
number is twice that of his child. A mother's ahnentafel number is twice that of her child plus one.
These values are computed with the <function>mul</function> and <function>add</function> functions.

</para>

</sect1><sect1>

<title>
Template for creating new reports
</title>

<para>
The following is a good template to use when creating a new report from scratch.
</para>

<programlisting>
/*
 * @progname reportname
 * @version Version Number.
 * @author report author and possible email address
 * @category ????
 * @output Format of Report Output
 * @description The following paragraph is used to populate index.html.
 *
 * This report .... (Note, the text in the 1st paragraph following the @keyword
 * lines is used as a description in the automatically generated index.html 
 * file. The text following the @description is not used for this purpose.)
 * The description lines can be written with or without the *'s on the left
 * they will be removed when generating index.html.
 * 
 * Additional descriptive text
*/

proc main()
{

}
</programlisting>

</sect1>

</chapter><chapter>

<title>

<application>LIFELINES</application> PROGRAMMING REFERENCE

</title>



<para>

<application>LifeLines</application> programs are stored in files you edit with a screen editor. Programs are not edited from within
the <application>LifeLines</application> program; edit them as you would any text file. The programs may be stored in any
directories; they do not have to be kept in or associated with <application>LifeLines</application> databases. You may set the
<envar>LLPROGRAMS</envar> shell variable to hold a list of directories that <application>LifeLines</application> will use to automatically
search for programs when you request program execution.

</para>



<sect1>



<title>

Procedures and Functions

</title>



<para>

A <application>LifeLines</application> program is made up of one or more <type>procedures</type> and <type>functions</type>. A <type>procedure</type> has format:<synopsis>proc name(params) { statements }</synopsis>

</para>



<para>

<symbol>Name</symbol> is the name of the <type>procedure</type>, <symbol>params</symbol> is an optional list of <type>parameters</type> separated by commas,
and <symbol>statements</symbol> is a list of statements that make up the <type>procedure</type> body. Report generation begins with
the first <type>statement</type> in the <type>procedure</type> named <literal>main</literal>. <type>Procedures</type> may call other <type>procedures</type> and <type>functions</type>.
<type>Procedures</type> are called with the <type>call</type> statement described below.When a <type>procedure</type> is called, the
<type>statements</type> making up its <type>body</type> are executed.

</para>



<para>

A function has format:<synopsis>func name(params) { statements }</synopsis>

</para>



<para>

<symbol>Name</symbol>, <symbol>params</symbol> and <symbol>statements</symbol> are defined as in <type>procedures</type>. <type>Functions</type> may call other <type>procedures</type> and
<type>functions</type>. When a <type>function</type> is called the <type>statements</type> that make it up are executed. A <type>function</type> differs from
a <type>procedure</type> by returning a <type>value</type> to the <type>procedure</type> or <type>function</type> that calls it. Values are returned by the
<type>return</type> statement, described below. <type>Recursive functions</type> are allowed. A <type>function</type> is called by invoking it
in an <type>expression</type>.

</para>

<para>
<type>Function</type> and <type>procedure</type> parameters are passed
by value except for <type>list</type>, <type>set</type> and <type>table</type>
types which are passed by reference.
Redeclaration of a parameter instantiates a new variable of the
stated or implied type.  The previous instance continues to exist 
in the scope of the caller.
</para>

<para>
</para>

</sect1>



<sect1>



<title>

Comments

</title>



<para>

You may comment your <application>LifeLines</application> programs using the following notation:<programlisting>

/*...comment text including any characters except */... */</programlisting>

</para>

<para>
These comments may be inserted anywhere in the program file.
</para>

<para>
You should put in some report header comments, because they will provide useful text for your report
when it is included in the report list seen by the user who uses the lifelines pick report menu
function. Report header comments are some specific comments at the top of the report, with keywords
preceded by @ signs. The following is an illustration of report header comments, with explanations
inside them:
</para>

<programlisting>
/*
* @progname The name of the report without the
extension. This shows in the pick report option.
* @version Version Number of the report. This
is stored here and not in the report name.
* @author Name of the author of this report
and email address if he/she desires.
* @category ????
* @output Modifies Database | text | HTML |
GEDCOM | RTF | XML | PostScript | etc.
* @description The first paragraph after this is
used to generate the description in the index.html.

This report ....
*/
</programlisting>



<para>

Comments begin with a <literal>/*</literal> and end with a <literal>*/</literal>. Comments may appear on lines of their own or on lines
that have program constructs. Comments may span many lines. Comments may not be nested.

</para>



</sect1>



<sect1>



<title>

Statements

</title>



<para>

     There are a number of <type>statement</type> types. The
     simplest is an <type>expression</type> statement, an
     expression that is not part of any other
     <type>statement</type> or
     <type>expression</type>. <type>Expressions</type> are defined
     more fully below. An <type>expression</type> statement is
     evaluated, and if its value is
     <returnvalue>non-null</returnvalue> (non-zero), it is assumed
     to be a <type>string</type>, and written to the program output
     file. If its value is <returnvalue>null</returnvalue>, nothing
     is written to the output file. For example, the expression
     <synopsis>name(indi)</synopsis>, where <symbol>indi</symbol>
     is a person, returns the person's name and writes it to the
     output file. On the other hand, the expression
     <synopsis>set(n, nspouses(indi))</synopsis> assigns the
     variable <varname>n</varname> the number of spouses that
     person <varname>indi</varname> has, but since
     <function>set</function> returns
     <returnvalue>null</returnvalue>, nothing is written to the
     output file.

</para>



<para>

     The programming language includes <type>if</type> statements,
     <type>while</type> statements and <type>procedure call</type>
     statements, with the following formats:

     <synopsis>if ([varb,] expr) { statements }
               [ elsif ([varb], expr) { statements } ]*
                    [ else { statements } ]
     </synopsis>

     <synopsis>while ([varb,] expr ) { statements }</synopsis>

     <synopsis>call name(args)</synopsis>

</para>



<para>

Square brackets indicate optional parts of the statement syntax. An <type>if</type> statement is executed by first
evaluating the conditional expression in the <type>if</type> clause. If <returnvalue>non-zero</returnvalue>, the statements in the <type>if</type> clause are
evaluated, and the rest of the <type>if</type> statement, if any, is ignored. If the value is <returnvalue>zero</returnvalue>, and there is an <type>elsif</type>
clause following, the conditional in the <type>elsif</type> clause is evaluated, and if <returnvalue>non-zero</returnvalue>, the statements in
that clause are executed. <type>Conditionals</type> are evaluated until one of them is <returnvalue>non-zero</returnvalue>, or until there are no
more. If no conditional is <returnvalue>non-zero</returnvalue>, and if the <type>if</type> statement ends with an <type>else</type> clause, the statements in
the <type>else</type> clause are executed. There are two forms of <type>conditional</type> expressions. If the <type>conditional</type> is a
single <type>expression</type>, it is simply evaluated. If the <type>conditional</type> is a <type>variable</type> followed by an <type>expression</type>, the
<type>expression</type> is evaluated and its value is assigned to the variable.

</para>

<para>

Note that <type>if</type> treats null strings as false, but empty strings as true. This has the benefit that

<programlisting>
if (birth(indi))
</programlisting>

will return <returnvalue>true</returnvalue> if there is a BIRT record, even if it is empty, but will return false if there is no BIRT record
at all.

</para>

<para>

The <type>while</type> statement provides a looping mechanism. The <type>conditional</type> is evaluated, and if <returnvalue>non-zero</returnvalue>, the
<type>body</type> of the loop is executed. After each iteration the <type>expression</type> is reevaluated; as long as it remains
<returnvalue>non-zero</returnvalue>, the loop is repeated.


</para>



<para>

The <type>call</type> statement provides procedure calls. <symbol>Name</symbol> must match one of the <type>procedures</type> defined in the
report program. <symbol>Args</symbol> is a list of <type>argument</type> expressions separated by commas. <type>Recursion</type> is allowed.
When a <type>call</type> is executed, the values of its <type>arguments</type> are evaluated and used to initialize the
procedure's <type>parameters</type>. The <type>procedure</type> is then executed. When the <type>procedure</type> completes, execution
resumes with the first item after the call.

</para>



<para>

The following report language statements are commonly encountered only near the top of a report:
<synopsis>char_encoding(string)</synopsis>
<synopsis>require(string)</synopsis>
<synopsis>option(string)</synopsis>
<synopsis>include(string)</synopsis>
<synopsis>global(varb)</synopsis>

</para>



<para>

The <type>char_encoding</type> statement specifies what character encoding scheme is used by the report, so that the
report processor can correctly interpret bytes not in ASCII (e.g., accented letters). An example specifying a character
encoding common in Western Europe:


<programlisting>
char_encoding("ISO-8859-1")
</programlisting>

The <type>option</type> statement allows the report writer to specify options. The only option currently available is
"explicitvars", which causes any use of variables not previously declared or set to be reported as a parsing error. The
<type>require</type> statement allows the report writer to specify that this report needs a version of the report
interpreter no older than that specified.
The <type>include</type> statement includes the contents of another file into the current file; its <parameter>string</parameter> expression is
the name of another <application>LifeLines</application> program file. It is described in more detail below. The <type>global</type> statement
must be used outside the scope of any <type>procedure</type> or <type>function</type>; it declares a <parameter>variable</parameter> to have global scope.  The 
<parameter>variable</parameter> is initialized to 0.

</para>

<para>

The report language also includes the following statements, which mimic some common programming languages:

<synopsis>set(varb, expr)</synopsis>
<synopsis>continue()</synopsis>
<synopsis>break()</synopsis>
<synopsis>return([expr])</synopsis>

</para>




<para>

The <type>set</type> statement is the assignment statement; the <parameter>expression</parameter> is evaluated, and its value is assigned
to the <parameter>variable</parameter>. The <type>continue</type> statement jumps to the bottom of the current loop, but does not leave the
loop. The <type>break</type> statement breaks out of the most closely nested loop. The <type>return</type> statement returns from
the current <type>procedure</type> or <type>function</type>. <type>Procedures</type> have return statements without expressions; <type>functions</type>
have return statements with expressions. None of these statements return a value, so none has a direct
effect on program output.


</para>

</sect1>



<sect1>



<title>

Expressions

</title>



<para>

There are four types of expressions: <type>literals</type>, <type>numbers</type>, <type>variables</type> and built-in or user defined function
<type>calls</type>.


</para>



<para>

A <type>literal</type> is any string enclosed in double quotes; its value is 
itself. A <type>number</type> is any integer or floating point constant;
its value is itself. A <type>variable</type> is a named location that can be assigned different values during program
execution. The value of a <type>variable</type> is the last value assigned to it. <type>Variables</type> do not have fixed type; at
different times in a program, the same <type>variable</type> may be assigned data of completely different types. An
identifier followed by comma-separated list of expressions enclosed in parentheses, is either a <type>call</type> to a
built-in function or a <type>call</type> to a user-defined function.

</para>



</sect1>



<sect1>



<title>

Include Feature

</title>



<para>

The <application>LifeLines</application> programming language provides an <type>include</type> feature. Using this feature one <application>LifeLines</application>
program can refer to other <application>LifeLines</application> programs. This feature is provided by the include statement:<synopsis>include(string)</synopsis>where <symbol>string</symbol> is a quoted string that is the name of another <application>LifeLines</application> program file. When an include
statement is encountered, the program that it refers to is read at that point, exactly as if the contents of
included file had been in the body of the original file at that point. This allows you to create <application>LifeLines</application>
program library files that can be used by many programs. Included files may in turn contain <type>include</type>
statements, and so on to any depth. <application>LifeLines</application> will use the <envar>LLPROGRAMS</envar> shell variable, if set, to
search for the <type>include</type> files.  Each file included with a include
statement is only read once.  If multiple include statements are encountered
that include the same file, only the first statement has any effect.
</para>
<para>
The only main procedure actually executed is the one in the
report the user chose.  main procedures in other reports
which are included do not get run.  This allows a module intended
to be included in other programs to have a main procedure for test purposes.
If multiple functions or procedures with the same name are included 
(other than the name main) a runtime error is generated and the program
is not run.
</para>


</sect1>



<sect1>



<title>

Built-in Functions

</title>



<para>

There is a long list of <type>built-in functions</type>, and this list will continue to grow for some time. The first
subsection below describes the value types used in <application>LifeLines</application> programs; these are the types of <type>variables</type>,
<type>function parameters</type> and <type>function return values</type>. In the remaining sections the <type>built-in functions</type> are
separated into logical categories and described.

</para>



</sect1>



<sect1>



<title>
Value Types
</title>

<glosslist>
<glossentry><glossterm><type>ANY</type></glossterm><glossdef>
<para>
union of all types
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>BOOL</type></glossterm><glossdef>
<para>
boolean (0 represents false; anything else represents true)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>EVENT</type></glossterm><glossdef>
<para>
event; reference to substructure of nodes in a <acronym>GEDCOM</acronym> record (reference)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>FAM</type></glossterm><glossdef>
<para>
family; reference to a <acronym>GEDCOM</acronym> FAM record (reference)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>FLOAT</type></glossterm><glossdef>
<para>
floating point number (may be used anywhere an INT may be used)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>INDI</type></glossterm><glossdef>
<para>
person; reference to a <acronym>GEDCOM</acronym> INDI record (reference)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>INT</type></glossterm><glossdef>
<para>
integer (on most systems a 32-bit signed value)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>LIST</type></glossterm><glossdef>
<para>
arbitrary length list of any values (reference)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>NODE</type></glossterm><glossdef>
<para>
<acronym>GEDCOM</acronym> node; reference to a line in a <acronym>GEDCOM</acronym> tree/record (reference)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>NUMBER</type></glossterm><glossdef>
<para>
union of all arithmetic types (INT and FLOAT)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>SET</type></glossterm><glossdef>
<para>
a collection of persons each with a value (see person sets below).
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>STRING</type></glossterm><glossdef>
<para>
text string
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>TABLE</type></glossterm><glossdef>
<para>
keyed look-up table (reference)
</para>
</glossdef></glossentry>

<glossentry><glossterm><type>VOID</type></glossterm><glossdef>
<para>
type with no values
</para>
</glossdef></glossentry>
</glosslist>

<para>

In the summaries of <type>built-in functions</type> below, each function is shown with its <type>argument</type> types
and its <type>return</type> type.  The types are from the preceding list. Sometimes an <type>argument</type> to a
<type>built-in function</type> must be a <type>variable</type>; when this is so its type is given as
<varname>XXX_V</varname>, where <symbol>XXX</symbol> is one of the types above. The <type>built-ins</type> do not check
the types of their <type>arguments</type>. <type>Variables</type> can hold values of any type, though at any one time
they will hold values of only one type. Note that <type>EVENT</type> is a subtype of <type>NODE</type>, and
<type>BOOL</type> is a subtype of <type>INT</type>. Built-ins with type <type>VOID</type> actually return
<returnvalue>null</returnvalue> (zero) values.

</para>

<para>

Reference types (denoted above in parentheses) obey "pointer semantics", which is to say that assigning one to another
variable results in both variables pointing at the same data (no copy is made). Therefore, if you pass a string to a
function which changes the string, the caller does not see the change, because a string is not a reference type. On the
other hand, if you pass a table to a function which alters the table, the caller does see the change, because a table is
a reference type.

</para>

</sect1>

<sect1>

<title>
Iterators
</title>

<para>

The report generator provides a number of iterator statements
for looping through genealogical and other types of data.
For example, the <type>children</type> statement
iterates through the children of a family,
the <type>spouses</type> statement iterates through the spouses of a
person, and the <type>families</type> statement iterates through the families that a person is a spouse or parent in.
</para>
<para>
Usually the first argument to the iterator is an expression that evaluates to an
individual or a family.
The other arguments of the iterator are variable names that are set with values for each iteration.
The last argument is often a variable name used as a counter.
It starts with the value of one and is
increased by one for each iteration of the loop.  
After completion of the iteration, these variables have the value null.
</para>
<para>
     <synopsis>children(afam,indi,cnt) { commands }</synopsis>
For example, the first argument to
<type>children</type> is the family that the iterator will operate on.
This iterator will execute the block of commands for each child in the
specified family.  The second argument is set to each child in the family
in the order they are listed in the family and the third argument is the
loop counter which starts at one and is incremented by one each time the
the block of commands is executed.  The two variables indi and cnt will
have the value null after the iteration has completed.
</para>
<para>
All the iterators are described in more detail later in the section where
their definition occurs.
</para>

</sect1>

<sect1>

<title>
Arithmetic and Logic Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NUMBER <function>add</function></funcdef>
<paramdef><parameter>NUMBER</parameter>,
<parameter>NUMBER</parameter>
<parameter>...</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
addition - two to 32 arguments
</para>
</glossdef></glossentry>
	   
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NUMBER <function>sub</function></funcdef>
<paramdef><parameter>NUMBER</parameter>,
<parameter>NUMBER</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

subtraction

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NUMBER <function>mul</function></funcdef>
<paramdef><parameter>NUMBER</parameter>,
<parameter>NUMBER</parameter>
<parameter>...</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

multiplication - two to 32 arguments

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NUMBER <function>div</function></funcdef>
<paramdef><parameter>NUMBER</parameter>,
<parameter>NUMBER</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

division

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>mod</function></funcdef>
<paramdef><parameter>INT</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

modulus (remainder)

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NUMBER <function>exp</function></funcdef>
<paramdef><parameter>NUMBER</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

exponentiation

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NUMBER <function>neg</function></funcdef>
<paramdef><parameter>NUMBER</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

negation

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FLOAT <function>float</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

convert int to float

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>int</function></funcdef>
<paramdef><parameter>FLOAT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

convert float to int

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>incr</function></funcdef>
<paramdef><parameter>NUMBER</parameter>,<parameter>NUMBER</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

increment variable by second argument (or by 1 if no second argument)

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>decr</function></funcdef>
<paramdef><parameter>NUMBER</parameter>,<parameter>NUMBER</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

decrement variable by second argument (or by 1 if no second argument)

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>and</function></funcdef>
<paramdef><parameter>BOOL</parameter>,
<parameter>BOOL</parameter>
<parameter>...</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

logical and - two to 32 arguments

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>or</function></funcdef>
<paramdef><parameter>BOOL</parameter>,
<parameter>BOOL</parameter>
<parameter>...</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

logical or - two to 32 arguments

</para>
</glossdef></glossentry>

<glossentry><glossterm> <funcsynopsis><funcprototype>
<funcdef>BOOL <function>not</function></funcdef>
<paramdef><parameter>BOOL</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

logical not

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>eq</function></funcdef>
<paramdef><parameter>ANY</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

equality (not strings)

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>ne</function></funcdef>
<paramdef><parameter>ANY</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

non-equality

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>lt</function></funcdef>
<paramdef><parameter>ANY</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

less than

</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>gt</function></funcdef>
<paramdef><parameter>ANY</parameter>,
<parameter>ANY</parameter>
</paramdef></funcprototype></funcsynopsis></glossterm><glossdef>

<para>

greater than

</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>le</function></funcdef>
<paramdef><parameter>ANY</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

less than or equal

</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>ge</function></funcdef>
<paramdef><parameter>ANY</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>

greater than or equal

</para>

</glossdef></glossentry>

</glosslist>
<para>
<function>Add</function>, <function>sub</function>, <function>mul</function> 
and <function>div</function> do normal arithmetic of integer or floating values.
If any operand is float, the result is float.
Functions <function>add</function> and <function>mul</function> can have two to
32 arguments; the sum or product of the full set of arguments is computed.
Functions <function>sub</function> and <function>div</function> have 
two arguments each; <function>sub</function> subtracts its second argument
from its first, and <function>div</function> divides its first argument by its
second.
The <function>mod</function> function returns the remainder after dividing the
first parameter by the second. If the second argument to 
<function>div</function> or <function>mod</function> is zero,
these functions return 0 and generate a run time error.
<function>Exp</function> performs integer exponentiation.
<function>Neg</function> negates its argument.
The functions 
<function>float</function> and
<function>int</function>
can be used to explicitly convert a value to float or int where needed.
</para>



<para>
<function>Incr</function> and <function>decr</function> increment by one and decrement by one, respectively, the value of a variable. The
argument to both functions must be a variable.  These functions take an
optional second argument which is the amount to increment or decrement the
variable by. 
</para>



<para>
<function>And</function> and <function>or</function> do logical operations. Both functions take two to 32 arguments. All arguments are and'ed or
or'ed together, respectively. The arguments are evaluated from left to right, but only up to the point
where the final value of the function becomes known. <function>Not</function> does the logical not operation.
</para>



<para>
<function>Eq</function>, <function>ne</function>, <function>lt</function>, <function>le</function>, <function>gt</function> and <function>ge</function> evaluate the six ordering relationships between two integers.
</para>

</sect1>

<sect1>

<title>
Trigonometric and Spherical Calculations
</title>
<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FLOAT <function>sin</function></funcdef>
<paramdef><parameter>FLOAT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compute sine of argument in degrees
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FLOAT <function>cos</function></funcdef>
<paramdef><parameter>FLOAT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compute cosine of argument in degrees
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FLOAT <function>tan</function></funcdef>
<paramdef><parameter>FLOAT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compute tangent of argument in degrees
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FLOAT <function>arcsin</function></funcdef>
<paramdef><parameter>FLOAT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compute inverse sine of argument
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FLOAT <function>arccos</function></funcdef>
<paramdef><parameter>FLOAT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compute inverse cosine of argument
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FLOAT <function>arctan</function></funcdef>
<paramdef><parameter>FLOAT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compute inverse tangent of argument
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>dms2deg</function></funcdef>
<paramdef><parameter>INT degree</parameter>,
<parameter>INT minute</parameter>,
<parameter>INT second</parameter>,
<parameter>FLOAT_V decimal</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
convert (degree, minute, second) to decimal degrees
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>void <function>deg2dms</function></funcdef>
<paramdef><parameter>FLOAT decimal</parameter>,
<parameter>INT_V degree</parameter>,
<parameter>INT_V minute</parameter>,
<parameter>INT_V second</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
convert decimal degrees to (degree, minute, second)
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FLOAT <function>spdist</function></funcdef>
<paramdef><parameter>FLOAT lat0</parameter>,
<parameter>FLOAT long0</parameter>,
<parameter>FLOAT lat1</parameter>,
<parameter>FLOAT long1</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compute distance between two locations
</para>
</glossdef></glossentry>

</glosslist>

<para>
The trigonometric functions specify angles using degrees.  The functions
<function>deg2dms</function> and <function>dms2deg</function>
are provided to convert between (degree,minute,second) notation and decimal
degree representations for angles.
</para>
<para>
<function>spdist</function> estimates the distance between two spherical
coordinates.  The arguments provided are, in order, first latitude, first
longitude, second latitude, second longitude.  The result is in kilometers.

</para>

</sect1>

<sect1>

<title>
Person Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>name</function></funcdef>
<paramdef><parameter>INDI</parameter>,
<parameter><replaceable>BOOL</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis>
</glossterm><glossdef>

<para>
default name of
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>fullname</function></funcdef>
<paramdef><parameter>INDI</parameter>,
<parameter>BOOL</parameter>,
<parameter>BOOL</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
many name forms of
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>surname</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
surname of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>givens</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
given names of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>trimname</function></funcdef>
<paramdef><parameter>INDI</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
trimmed name of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>EVENT <function>birth</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first birth event of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>EVENT <function>death</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first death event of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>EVENT <function>burial</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first burial event of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>father</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first father of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>mother</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first mother of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>nextsib</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
next (younger) sibling of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>prevsib</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
previous (older) sibling of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>sex</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
sex of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>male</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
male predicate
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>female</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
female predicate
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>pn</function></funcdef>
<paramdef><parameter>INDI</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
pronoun referring to
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>nspouses</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number of spouses of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>nfamilies</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number of families (as spouse/parent) of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FAM <function>parents</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first parents' family of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>title</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first title of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>key</function></funcdef>
<paramdef><parameter>INDI|FAM</parameter>,
<parameter><replaceable>BOOL</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
internal key of (work for families also)
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>soundex</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
SOUNDEX code of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>inode</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
root GEDCOM node of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>root</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
root GEDCOM node of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>indi</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
find person with key value
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>firstindi</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first person in database in key order
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>lastindi</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
last person in database in key order
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>nextindi</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
next person in database in key order
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>previndi</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
previous person in database in key order
</para>
</glossdef></glossentry>

<glossentry><glossterm><synopsis><command>spouses</command> (<replaceable>INDI</replaceable>, <replaceable>INDI_V</replaceable>, <replaceable>FAM_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis>
</glossterm><glossdef>

<para>
loop through all spouses of
</para>
</glossdef></glossentry>

<glossentry><glossterm><synopsis><command>families</command> (<replaceable>INDI</replaceable>, <replaceable>FAM_V</replaceable>, <replaceable>INDI_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all families (as spouse) of
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>forindi</command> (<replaceable>INDI_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis>
</glossterm><glossdef>

<para>
loop through all persons in database
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>mothers</command> (<replaceable>INDI</replaceable>, <replaceable>INDI_V</replaceable>, <replaceable>FAM_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all female parents of a person
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>fathers</command> (<replaceable>INDI</replaceable>, <replaceable>INDI_V</replaceable>, <replaceable>FAM_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis>
</glossterm><glossdef>

<para>
loop through all male parents of a person
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>Parents</command> (<replaceable>INDI</replaceable>, <replaceable>FAM</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all familes a person is a child of
</para>

</glossdef></glossentry>
</glosslist>

<para>
These functions take a person as a parameter and return information about him or her.
</para>

<para>
<function>Name</function> returns the default name of a person; this is the name found on the first <structfield>1 NAME</structfield> line in the
person's record; the slashes are removed and the surname is made all capitals; <function>name</function> can take an
optional second parameter - if it is <returnvalue>true</returnvalue> the function acts as described above; if <returnvalue>false</returnvalue>, the surname is
kept exactly as it is in the record.
</para>

<para>
<function>Fullname</function> returns the name of a person in a variety of formats. If the second parameter is <returnvalue>true</returnvalue> the
surname is shown in upper case; otherwise the surname is as in the record. If the third parameter is
<returnvalue>true</returnvalue> the parts of the name are shown in the order as found in the record; otherwise the surname is given
first, followed by a comma, followed by the other name parts. The fourth parameter specifies the
maximum length field that can be used to show the name; various conversions occur if it is necessary to
shorten the name to fit this length.
</para>

<para>
<function>Surname</function> returns the surname of the person, as found in the first <structfield>1 NAME</structfield> line; the slashes are
removed. <function>Givens</function> returns the given names of the person in the same order and format as found in the
first <structfield>1 NAME</structfield> line of the record. <function>Trimname</function> returns the default name of the person trimmed to the
maximum character length given in the second variable.
</para>

<para>
<function>Birth</function>, <function>death</function>, and <function>burial</function> return the first birth, death, and burial event in the
person's record, respectively. An event is a level <structfield>1 GEDCOM</structfield> node. If there is no matching event these
functions return <returnvalue>null</returnvalue>.
</para>

<para>
<function>Father</function>, <function>mother</function>, <function>nextsib</function> and <function>prevsib</function> return the father, mother, next younger sibling and next older
sibling of the person, respectively. If the person has more than one father (mother) the <function>father</function>
(<function>mother</function>) function returns the first one. These functions return <returnvalue>null</returnvalue> if there is no person in the role.
</para>

<para>
<function>Sex</function> returns the person's sex as the string <returnvalue>M</returnvalue> if the person is male, <returnvalue>F</returnvalue> if the person is female, or <returnvalue>U</returnvalue> if the
sex of the person is not known. <function>Male</function> and <function>female</function> return <returnvalue>true</returnvalue> if the person is male or female,
respectively, or <returnvalue>false</returnvalue> if not.
</para>

<para>
<function>Pn</function> generates pronouns, useful when generating English text;
the second parameter selects the type of pronoun:
</para>

<informaltable pgwide='0' frame='none'>
<tgroup cols='2'>
<colspec colwidth='0.5in'></colspec>
<tbody>
<row>
<entry>0</entry>
<entry>He/She</entry>
</row>
<row>
<entry>1</entry>
<entry>he/she</entry>
</row>
<row>
<entry>2</entry>
<entry>His/Her</entry>
</row>
<row>
<entry>3</entry>
<entry>his/her</entry>
</row>
<row>
<entry>4</entry>
<entry>him/her</entry>
</row>
</tbody>
</tgroup>
</informaltable>

<para>
<function>Nspouses</function> returns the number of spouses the person has in the database, and <function>nfamilies</function> returns the
number of families the person is a parent/spouse in; these two values are not necessarily the same.
<function>Parents</function> returns the first family that the person is a child in.
</para>

<para>
<function>Title</function> returns the value of the first <structfield>1 TITL</structfield> line in the record. <function>Key</function> returns the key value of a person or
family; it there is a second parameter and it is non-null, the leading <literal>I</literal> or <literal>F</literal> will be stripped. <function>Soundex</function>
returns the Soundex code of the person.
</para>

<para>
<function>Root</function> and <function>Inode</function> return the root node of the person's <acronym>GEDCOM</acronym> node tree. Note that an <type>INDI</type> value is
not a <type>NODE</type> value. If you want to process the nodes within a person node tree, you must first use the
<function>root</function> or <function>inode</function> function to get the root of the person node tree. <function>Root</function> and <function>inode</function> are synonyms.
</para>

<para>
<function>Indi</function> returns the person who's key is passed as an argument;
if no person has the key <function>indi</function> returns
<returnvalue>null</returnvalue>.
INDI  keys are accepted either as Innn or @Innn@.
</para>

<para>
<function>Firstindi</function>, <function>nextindi</function> and <function>previndi</function> allow you to iterate through all persons in the database. <function>Firstindi</function>
returns the first person in the database in key order. <function>Nextindi</function> returns the next person after the
argument person in key order. <function>Previndi</function> returns the previous person before the argument person in key
order.
</para>

<para>
<function>Spouses</function> is an iterator that loops through each spouse a person has. The first argument is a person. The
second argument is a person variable that iterates through the first person's spouses. The third
argument is a family variable that iterates through the families the person and each spouse are in.
The fourth argument is an integer variable that counts the iterations.
The spouses iterator skips any family that has no spouse, whereas the
families iterator does not.
</para>

<para>
<function>Families</function> is an iterator that loops through the families a person was a spouse/parent in. The first
argument is a person. The second argument is a family variable that iterates through the families the
first person was a spouse/parent in. The third argument iterates through the spouses from the families;
if there is no spouse in a particular family, the variable is set to null for that iteration. The fourth
argument is an integer variable that counts the iterations.
</para>

<para>
<function>Families</function> and <function>Spouses</function> behave the same
except for one situation.  If the person is a spouse in a family that only has
one spouse identified,  that family does not show up with the 
<function>spouses</function> iterator, but it does show up with the
<function>families</function> iterator.  One caution, this situation causes
the 3rd argument of the <function>families</function> iterator to be set to
null.  You must check for this.
</para>

<para>
<function>Forindi</function> is an iterator that loops through every person in
the database in ascending key order. Its first
parameter is a variable that iterates through the persons; its second 
parameter is an integer counter
variable that counts the persons starting at one.
</para>

<para>
<function>mothers</function> is an iterator that loops through every female
parent of the specified individual. 
Its first parameter is a person;
its third parameter is a family variable that iterates through the familes
that the person is a child in;
its second parameter is a person variable that is the female parent
associated with the family in the third parameter;
The fourth parameter is a variable that counts the families returned starting at one.
</para>


<para>
<function>Parents</function> is an iterator that loops through every family
that a person is a child in.  Note: This iterator's name begins with a
capital P.  There is another function of the same name that begins with a
lower case p.
Its first parameter is a person;
its second parameter is a family variable that iterates through the familes
that the person is a child in; and
the third parameter is a variable that counts the families returned starting at one.
</para>

<para>
<function>Forindi</function> is an iterator that loops through every person in
the database in ascending key order. Its first
parameter is a variable that iterates through the persons; its second 
parameter is an integer counter
variable that counts the persons starting at one.
</para>

<para>
<function>fathers</function> and
<function>mothers</function> are iterators that loop through each family
the specified individual is in returns each father or mother found.
If a non-traditional family is processed, there will be separate iterations
for each father or mother found.
</para>

</sect1>

<sect1>

<title>
Family Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>EVENT <function>marriage</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first marriage event of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>husband</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first husband/father of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>wife</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first wife/mother of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>nchildren</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number of children in
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>firstchild</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first child of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>lastchild</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
last child of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>key</function></funcdef>
<paramdef><parameter>FAM|INDI</parameter>,
<parameter><replaceable>BOOL</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
internal key of (works for persons also)
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>fnode</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
root GEDCOM node of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>root</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
root GEDCOM node of
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FAM <function>fam</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
find family from key
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FAM <function>firstfam</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first family in database in key order
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FAM <function>lastfam</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
last family in database in key order
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FAM <function>nextfam</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
next family in database in key order
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FAM <function>prevfam</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
previous family in database in key order
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>children</command> (<replaceable>FAM</replaceable>, <replaceable>INDI_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through children of family
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>spouses</command> (<replaceable>FAM</replaceable>, <replaceable>INDI_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all husbands and wives of a family
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>forfam</command> (<replaceable>FAM_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all families in database
</para>

</glossdef></glossentry></glosslist>

<para>
These functions take a family as an argument and return information about it.
</para>

<para>
<function>Marriage</function> returns the first marriage event found in the family record, if any; it returns <returnvalue>null</returnvalue> if there is
no marriage event.
</para>

<para>
<function>Husband</function> returns the first husband/father of the family, if any; and <function>wife</function> returns the first
wife/mother of the family, if any. Each returns <returnvalue>null</returnvalue> if the requested person is not in the family.
</para>

<para>
<function>Nchildren</function> returns the number of children in the family.
</para>

<para>
<function>Firstchild</function> and <function>lastchild</function> return the first child and last child in a family, respectively.
</para>

<para>
<function>Key</function> was described in the section on person functions.
</para>

<para>
<function>Root</function> and <function>fnode</function> return the root node of a family <acronym>GEDCOM</acronym> node tree. Note that a <type>FAM</type> value is not a
<type>NODE</type> value. If you want to process the nodes within a family node tree, you must first use <function>root</function> or
<function>fnode</function> function to get the root of the family node tree. <function>Root</function> and <function>fnode</function> are synonyms.
</para>

<para>
<function>Fam</function> returns the family who's key is passed as an argument;
if no family has the key <function>fam</function> 
returns <returnvalue>null</returnvalue>.  Family keys are accepted
either as Fnnn or @Fnnn@.
</para>

<para>
<function>Firstfam</function>, <function>nextfam</function> and <function>prevfam</function> allow you to iterate through all families in the database. <function>Firstfam</function>
returns the first family in the database in key order. <function>Nextfam</function> returns the next family after the
argument family in key order. <function>Prevfam</function> returns the previous family before the argument family in key
order.
</para>

<para>
<function>Children</function> is an iterator that loops through the children in a family. Its first parameter is a family
expression; its second parameter is a variable that iterates through each child; its third parameter is
an integer counter variable that counts the children starting at one. These two variables may be used
within the loop body.
</para>

<para>
<function>spouses</function> is an iterator that loops through all the
husbands and wives of a family.
Its first parameter is a family expression; its second parameter is a
variable that iterates through each parent; its third parameter is
an integer counter variable that counts the parents starting at one.
These two variables may be used within the loop body.
</para>

<para>
<function>Forfam</function> is an iterator that loops through every family in the database in ascending key order. Its first
parameter is a variable that iterates through the families; its second parameter is an integer counter
variable that counts the families starting at one.
</para>

</sect1>


<sect1>

<title>
Other types of records
</title>

<glosslist>
<glossentry><glossterm><synopsis><command>forsour</command> (<replaceable>NODE_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all sources in database
</para>
</glossdef></glossentry>

<glossentry><glossterm><synopsis><command>foreven</command> (<replaceable>NODE_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all EVEN nodes in database
</para>
</glossdef></glossentry>

<glossentry><glossterm><synopsis><command>forothr</command> (<replaceable>NODE_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all other (notes, etc.) nodes in database
</para>
</glossdef></glossentry>
</glosslist>

<para>
<function>forsour</function> is an iterator that loops through all the Source
nodes in the database.  Its first argument is the SOUR record and its
second parameter is an integer counter variable that counts the sources
elements starting at one.
<function>foreven</function> is an iterator that loops through all the Event
nodes in the database.  Its first argument is the EVEN record and its
second parameter is an integer counter variable that counts the events
elements starting at one.
<function>forothr</function> is an iterator that loops through all the Other
nodes in the database.  Its first argument is the record (NOTE, etc.) and its
second parameter is an integer counter variable that counts the nodes
starting at one.
</para>

</sect1>

<sect1>

<title>
List Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>list</function></funcdef>
<paramdef><parameter>LIST_V</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
declare a list
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>clear</function></funcdef>
<paramdef><parameter>LIST</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
clear a list
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>empty</function></funcdef>
<paramdef><parameter>LIST</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
check if list is empty
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>length</function></funcdef>
<paramdef><parameter>LIST</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
length of list
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>enqueue</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
enqueue element on list
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>ANY <function>dequeue</function></funcdef>
<paramdef><parameter>LIST</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
dequeue and return element from list
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>requeue</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
requeue an element on list
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>push</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
push element on list
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>ANY <function>pop</function></funcdef>
<paramdef><parameter>LIST</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
pop and return element from list
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>setel</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter>INT</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
array element assignment
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>ANY <function>getel</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
array element selection
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>inlist</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
is second argument in list.
</para>

</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>sort</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter>LIST</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
sort list elements
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>rsort</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter>LIST</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
reverse sort list elements
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>LIST <function>dup</function></funcdef>
<paramdef><parameter>LIST</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
duplicate a list
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>forlist</command> (<replaceable>LIST</replaceable>, <replaceable>ANY_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all elements of list
</para>

</glossdef></glossentry></glosslist>

<para>
<application>LifeLines</application> provides general purpose lists that can be accessed as queues, stacks or arrays. A
list must be declared with the <function>list</function> function before it can be used. Redeclaring an existing
variable with the <function>list</function> clears it and restores it to being 
an empty list.  If the argument to list() is the name of a
parameter to the current routine, the reference to the calling routines
list is removed and a new list is created.
</para>

<para>
A list can have any number of elements. <function>Empty</function> returns <returnvalue>true</returnvalue> if the list
has no elements and <returnvalue>false</returnvalue> otherwise. <function>Length</function> returns the length of the
list. The only parameter to both is a list.  The following diagram
indicates how the various access functions for a list interact:
</para>
<para>
<inlinemediaobject>
<imageobject> <imagedata fileref="listops.jpg" format="JPG"/>
</imageobject>
</inlinemediaobject>
</para>

<para>
<function>Enqueue</function>, <function>dequeue</function> and <function>requeue</function> provide queue access to a
list.  <function>Enqueue</function> adds an element to the back of a queue, <function>dequeue</function> removes and
returns the element from the front of a queue, and <function>requeue</function> adds an element to the front of a queue.
The first parameter to all three is a list, and the second parameter to <function>enqueue</function> and
<function>requeue</function> is the value to be added to the queue and can be any value.
</para>

<para>
<function>Push</function> and <function>pop</function> provide stack access to a list. <function>Push</function> pushes
an element on the stack, and <function>pop</function> removes and returns the most recently pushed element from the
stack. The first parameter to both is a list, and the second parameter to <function>push</function> is the value to be
pushed on the stack and can be of any type.
</para>

<para>
<function>Setel</function> and <function>getel</function> provide array access to a list.  <function>Setel</function>
sets a value of an array element, and <function>getel</function> returns the value of an array element. The first
parameter to both is a list; the second parameter to both is an integer index into the array; and the third parameter to
<function>setel</function> is the value to assign to the array element and can be of any type. Array elements are
indexed starting at one. Unassigned elements are assumed to be <returnvalue>null</returnvalue>
(<returnvalue>0</returnvalue>). Arrays automatically grow in size to accommodate the largest index value that is used.
Passing 0 references the last element at the other end from 1, and -1 the one before it, etc. 
</para>

<para>
<function>inlist</function> compares the second argument with each element
in the list.  If it finds a match <function>inlist</function> returns
<returnvalue>true</returnvalue>.
</para>

<para>
<function>sort</function> and <function>rsort</function> sort a list, using the elements of the second array to
determine the new order. Both lists are reordered, so essentially both are sorted using the sort order of the second
argument. (If only one argument is given, it is sorted on its own elements.) 
rsort sorts in order reverse of sort.
The order that sort produces places the smallest element at position 1, and the
largest element at the end of the list, such that <function>dequeue</function> 
will remove the smallest element.
</para>

<para>
<function>dup</function> creates a copy of a <type>list</type>.  If b is a 
<type>list</type>, the function <function>set</function>(a,b) makes the variable a a reference 
to the <type>list</type> b.  If you
want to make a new <type>list</type>, you must use 
<function>set</function>(a,<function>dup</function>(b)).
</para>

<para>
<function>Forlist</function> is an iterator that loops through the element in a list. Its first parameter is a
<type>LIST</type> expression; its second parameter is a variable that iterates through the list elements; and its third
parameter is an integer counter variable that counts the list elements starting at one.
</para>

</sect1>

<sect1>

<title>
Table Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>table</function></funcdef>
<paramdef><parameter>TABLE_V</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
declare a table
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>insert</function></funcdef>
<paramdef><parameter>TABLE</parameter>,
<parameter>STRING</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
insert entry in table
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>ANY <function>lookup</function></funcdef>
<paramdef><parameter>TABLE</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
lookup and return entry from table
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>length</function></funcdef>
<paramdef><parameter>TABLE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
size of the table
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>empty</function></funcdef>
<paramdef><parameter>TABLE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
check if table is empty
</para>

</glossdef></glossentry></glosslist>

<para>
These functions provide general purpose, keyed tables. A table must be declared with the <function>table</function>
function before it can be used.
</para>

<para>
<function>Insert</function> adds an object and its key to a table. Its first parameter is a table; the second parameter
is the object's key; and the third parameter is the object itself. The key must be a string and the object can be any
value. If there already is an object in the table with that key, the old object is replaced with the new.
</para>

<para>
<function>Lookup</function> retrieves an object from a table. Its first parameter is a table, and the second parameter
is the object's key. The function returns the object with that key from the table; if there is no such object,
<returnvalue>null</returnvalue> is returned.
<function>length</function> returns the number of elements in the table.
</para>

</sect1>

<sect1>

<title>
GEDCOM Node Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>xref</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
cross reference index of
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>tag</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
tag of
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>value</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
value of
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>parent</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
parent node of
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>child</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first child of
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>sibling</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
next sibling of
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>savenode</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
copy a node structure
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>level</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
level of a node
</para>
</glossdef></glossentry>

<glossentry><glossterm><synopsis><command>fornodes</command> (<replaceable>NODE</replaceable>, <replaceable>NODE_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through child nodes
</para>
</glossdef></glossentry>

<glossentry><glossterm><synopsis><command>fornotes</command> (<replaceable>NODE</replaceable>, <replaceable>STRING_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through notes on a node
</para>

</glossdef></glossentry>
<glossentry><glossterm><synopsis><command>traverse</command> (<replaceable>NODE</replaceable>, <replaceable>NODE_V</replaceable>, <replaceable>INT_V</replaceable>) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all descendent nodes
</para>

</glossdef></glossentry></glosslist>

<para>

These functions provide access to the components of a <acronym>GEDCOM</acronym> node. All take a <acronym>GEDCOM</acronym> node as their
only parameter, and each returns a different value associated with the node.

</para>

<para>
<function>Xref</function> returns the cross reference index of the node, if any; <function>tag</function> returns the tag of the node; and <function>value</function>
returns the value of the node, if any. If there is no cross reference, <function>xref</function> returns <returnvalue>null</returnvalue>; if there is no value,
value returns <returnvalue>null</returnvalue>.
</para>

<para>
<function>Parent</function> returns the parent node of the node, if any; <function>child</function> returns the first child node of the node, if any;
and <function>sibling</function> returns the next sibling node of the node, if any. Whenever there is no such related node,
these functions return <returnvalue>null</returnvalue>. These three functions allow simple navigation through a <acronym>GEDCOM</acronym> node
tree.
</para>

<para>
<function>Savenode</function> makes a copy of the node, and the substructure of nodes below the node, that is passed to it.
Beware: the memory used to make the copy is never returned to the system.
</para>

<para>
The <function>level</function> function returns the level of the node.
</para>


<para>
<function>Fornodes</function> is an iterator that loops through the child nodes of a <acronym>GEDCOM</acronym> node. Its first argument is a
node expression, and its second parameter is a variable that iterates through each direct child node of
the first node.
</para>

<para>
<function>Fornotes</function> is an iterator that loops through the NOTE nodes 
of a <acronym>GEDCOM</acronym> node. Its first argument is a
node expression, and its second parameter is a variable that returns the
value of the NOTE.  The value includes processed sub CONC and CONT records.
</para>



<para>
<function>Traverse</function> is an iterator providing a general method for traversing <acronym>GEDCOM</acronym> trees. Its first parameter is
a node expression; its second parameter is a variable that iterates over every node under the first node
in a top down, left to right manner; and its third parameter is a variable that is set to the level of the
current node in the iteration.
</para>

</sect1>

<sect1>

<title>
Event and Date Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>date</function></funcdef>
<paramdef><parameter>EVENT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
date of, value of first <structfield>DATE</structfield> line
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>place</function></funcdef>
<paramdef><parameter>EVENT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
place of, value of first <structfield>PLAC</structfield> line
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>year</function></funcdef>
<paramdef><parameter>EVENT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
year or, 1st string of 3-4 digits in 1st <structfield>DATE</structfield> line
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>long</function></funcdef>
<paramdef><parameter>EVENT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
date and place, values of 1st <structfield>DATE</structfield> and <structfield>PLAC</structfield> lines
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>short</function></funcdef>
<paramdef><parameter>EVENT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
date and place of, abbreviated from
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>EVENT <function>gettoday</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
returns the `event' of the current date
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>dayformat</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set day format for stddate calls
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>monthformat</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set month format for stddate calls
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>yearformat</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set year format for stddate calls
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>eraformat</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set era format for stddate calls
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>dateformat</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set date format for stddate calls
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>datepic</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set custom date format for stddate calls
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>stddate</function></funcdef>
<paramdef><parameter>EVENT|STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
date of, in current format
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>complexformat</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set complex date format
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>complexpic</function></funcdef>
<paramdef><parameter>INT</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set custom complex date picture string
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>complexdate</function></funcdef>
<paramdef><parameter>EVENT|STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
date of, in current complex format
</para>
</glossdef></glossentry>

</glosslist>

<para>
These functions extract information about the dates and places of events.
</para>

<para>
<function>Date</function> returns the value of the first <structfield>DATE</structfield> line in an event, a node in a <acronym>GEDCOM</acronym> record tree. <function>Date</function>
finds the first <structfield>DATE</structfield> line one level deeper than the event node. <function>Place</function> returns the value of the first
<structfield>PLAC</structfield> line in an event. <function>Year</function> returns the first three or four digit number in the value of the first <structfield>DATE</structfield>
line in an event; this number is assumed to be the year of the event.
</para>

<para>
<function>Long</function> returns the verbatim values of the first <structfield>DATE</structfield> and <structfield>PLAC</structfield> lines in an event, concatenated together
and separated by a comma. <function>Short</function> abbreviates information from the first <structfield>DATE</structfield> and <structfield>PLAC</structfield> lines, concatenates the shortened information together with a comma separator and returns it. An abbreviated
date is its year; an abbreviated place is the last component in the value, further abbreviated if the
component has an entry in the place abbreviation table.
</para>

<para>
<function>Gettoday</function> creates an event that has today's date in the <structfield>DATE</structfield> line.
</para>

<para>
The next seven functions are used to format dates in a variety of ways.
<function>Dayformat</function>, <function>monthformat</function>,
<function>yearformat</function>, <function>eraformat</function>, and
<function>dateformat</function> select style options for formatting the day,
month, year, era, and overall date structure; <function>stddate</function>
returns dates in the selected style.
<function>datepic</function> allows specifying a custom pattern that overrides
the date format selected with <function>dateformat</function>.  The string
supplied specifies the placement of the day, month and year in the string with
%d, %m and %y.  A null argument disables the overrided format.
The argument to <function>stddate</function> is normally an event and the
date is extracted from the event and formatted. If the argument is a 
date string it is converted using the current date formats.
</para>

<para>
The next three functions provide for more complex formatting of dates. Taking
into account the abt, est, cal, bef, aft, fr and to qualifiers on GEDCOM dates. 
<function>complexformat</function> selects the format to use. The format
effects only the complex picture, not the format of the date itself.
The function
<function>complexpic</function> can be used to specify a custom picture string
for any or all of the 9 custom format strings.  The custom string can be
canceled by passing a null for the string.  When a custom picture string is
provided it overrides both the abbreviated and full word picture strings.
<function>complexdate</function>
formats the date similarly to <function>stddate</function>, but with the 
addition of the complex date format string selected.
</para>

<para>
The day format codes passed to <function>dayformat</function> are: 
</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2'>
<colspec colwidth='0.5in'></colspec>
<tbody>
<row>
<entry>0</entry>
<entry>leave space before single digit days</entry>
</row>
<row>
<entry>1</entry>
<entry>
use leading 0 before single digit days
</entry>
</row>
<row>
<entry>2</entry>
<entry>
no space or leading 0 before single digit days
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

<para>

The month format codes passed to <function>monthformat</function> are:
</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2'>
<colspec colwidth='0.5in'></colspec>
<tbody>
<row>
<entry>0</entry>
<entry>
number with space before single digit months
</entry>
</row>
<row>
<entry>1</entry>
<entry>
number with leading zero before single digit months
</entry>
</row>
<row>
<entry>2</entry>
<entry>
number with no space or zero before single digit months
</entry>
</row>
<row>
<entry>3</entry>
<entry>
upper case abbreviation (eg, JAN, FEB) (localized)
</entry>
</row>
<row>
<entry>4</entry>
<entry>
capitalized abbreviation (eg, Jan, Feb) (localized)
</entry>
</row>
<row>
<entry>5</entry>
<entry>
upper case full word (eg, JANUARY, FEBRUARY) (localized)
</entry>
</row>
<row>
<entry>6</entry>
<entry>
capitalized full word (eg, January, February) (localized)
</entry>
</row>
<row>
<entry>7</entry>
<entry>
lower case abbreviation (eg, jan, feb) (localized)
</entry>
</row>
<row>
<entry>8</entry>
<entry>
lower case full word (eg, january, february) (localized)
</entry>
</row>
<row>
<entry>9</entry>
<entry>
upper case abbreviation in English per GEDCOM (eg, JAN, FEB)
</entry>
</row>
<row>
<entry>10</entry>
<entry>
lower case roman letter (eg, i, ii)
</entry>
</row>
<row>
<entry>11</entry>
<entry>
upper case roman letter (eg, I, II)
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

<para>
The year format codes passed to <function>yearformat</function> are:
</para>

<informaltable pgwide='0' frame='none'>
<tgroup cols='2'>
<colspec colwidth='0.5in'></colspec>
<tbody>
<row>
<entry>0</entry>
<entry>
use leading spaces before years with less than four digits
</entry>
</row>
<row>
<entry>1</entry>
<entry>
use leading 0 before years with less than four digits
</entry>
</row>
<row>
<entry>2</entry>
<entry>
no space or leading 0 before years
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

<para>
The era format codes passed to <function>eraformat</function> are: 
</para>

<informaltable pgwide='0' frame='none'>
<tgroup cols='2'>
<colspec colwidth='0.5in'></colspec>
<tbody>
<row>
<entry>0</entry>
<entry>
no AD/BC markers
</entry>
</row>
<row>
<entry>1</entry>
<entry>
trailing B.C. if appropriate
</entry>
</row>
<row>
<entry>2</entry>
<entry>
trailing A.D. or B.C.
</entry>
</row>
<row>
<entry>11</entry>
<entry>
trailing BC if appropriate
</entry>
</row>
<row>
<entry>12</entry>
<entry>
trailing AD or BC
</entry>
</row>
<row>
<entry>21</entry>
<entry>
trailing B.C.E. if appropriate
</entry>
</row>
<row>
<entry>22</entry>
<entry>
trailing C.E. or B.C.E.
</entry>
</row>
<row>
<entry>31</entry>
<entry>
trailing BC if appropriate
</entry>
</row>
<row>
<entry>32</entry>
<entry>
trailing CE or BCE
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

<para>
The full date formats passed to <function>stddate</function> are:
</para>

<informaltable pgwide='0' frame='none'>
<tgroup cols='2'>
<colspec colwidth='0.5in'></colspec>
<tbody>
<row>
<entry>0</entry>
<entry>
da mo yr
</entry>
</row>
<row>
<entry>1</entry>
<entry>
mo da, yr
</entry>
</row>
<row>
<entry>2</entry>
<entry>
mo/da/yr
</entry>
</row>
<row>
<entry>3</entry>
<entry>
da/mo/yr
</entry>
</row>
<row>
<entry>4</entry>
<entry>
mo-da-yr
</entry>
</row>
<row>
<entry>5</entry>
<entry>
da-mo-yr
</entry>
</row>
<row>
<entry>6</entry>
<entry>
modayr
</entry>
</row>
<row>
<entry>7</entry>
<entry>
damoyr
</entry>
</row>
<row>
<entry>8</entry>
<entry>
yr mo da
</entry>
</row>
<row>
<entry>9</entry>
<entry>
yr/mo/da
</entry>
</row>
<row>
<entry>10</entry>
<entry>
yr-mo-da
</entry>
</row>
<row>
<entry>11</entry>
<entry>
yrmoda
</entry>
</row>
<row>
<entry>12</entry>
<entry>
yr  (year only, omitting all else)
</entry>
</row>
<row>
<entry>13</entry>
<entry>
da/mo yr
</entry>
</row>
<row>
<entry>14</entry>
<entry>
(As in GEDCOM)
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

<para>
The complex date formats selected by the <function>complexformat</function>
and used by <function>complexdate</function> are: 
</para>

<informaltable pgwide='0' frame='none'>
<tgroup cols='3'>
<colspec colwidth='0.5in'></colspec>
<tbody>
<row>
<entry> </entry>
<entry>
Mode
</entry>
<entry>
Example
</entry>
</row>
<row>
<entry>3</entry>
<entry>
use abbreviations in uppercase
</entry>
<entry>
ABT  1 JAN 2002
</entry>
</row>
<row>
<entry>4</entry>
<entry>
use abbreviations in titlecase
</entry>
<entry>
Abt  1 JAN 2002
</entry>
</row>
<row>
<entry>5</entry>
<entry>
use uppercased full words 
</entry>
<entry>
ABOUT  1 JAN 2002
</entry>
</row>
<row>
<entry>6</entry>
<entry>
use titlecased full words
</entry>
<entry>
About  1 JAN 2002
</entry>
</row>
<row>
<entry>7</entry>
<entry>
use abbreviations in lowercase
</entry>
<entry>
abt  1 JAN 2002
</entry>
</row>
<row>
<entry>8</entry>
<entry>
use lowercase full words
</entry>
<entry>
about  1 JAN 2002
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

<para>
The complex date string pictures that can be overridden with the
<function>complexpic</function> are:
</para>

<informaltable pgwide='0' frame='none'>
<tgroup cols='3'>
<colspec colwidth='0.5in'></colspec>
<tbody>
<row>
<entry> </entry>
<entry>
Abbreviation
</entry>
<entry>
Full word
</entry>
</row>
<row>
<entry>0</entry>
<entry>
abt %1
</entry>
<entry>
about %1
</entry>
</row>
<row>
<entry>1</entry>
<entry>
est %1
</entry>
<entry>
estimated %1
</entry>
</row>
<row>
<entry>2</entry>
<entry>
cal %1
</entry>
<entry>
calculated %1
</entry>
</row>
<row>
<entry>3</entry>
<entry>
bef %1
</entry>
<entry>
before %1
</entry>
</row>
<row>
<entry>4</entry>
<entry>
aft %1
</entry>
<entry>
after %1
</entry>
</row>
<row>
<entry>5</entry>
<entry>
bet %1 and %2
</entry>
<entry>
between %1 and %2
</entry>
</row>
<row>
<entry>6</entry>
<entry>
fr %1
</entry>
<entry>
from %1
</entry>
</row>
<row>
<entry>7</entry>
<entry>
to %1
</entry>
<entry>
to %1
</entry>
</row>
<row>
<entry>8</entry>
<entry>
fr %1 to %2
</entry>
<entry>
from %1 to $2
</entry>
</row>
</tbody>
</tgroup>
</informaltable>

</sect1>

<sect1>

<title>
Value Extraction Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>extractdate</function></funcdef>
<paramdef><parameter>NODE</parameter>,
<parameter>INT_V</parameter>,
<parameter>INT_V</parameter>,
<parameter>INT_V</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
extract a date
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>extractnames</function></funcdef>
<paramdef><parameter>NODE</parameter>,
<parameter>LIST_V</parameter>,
<parameter>INT_V</parameter>,
<parameter>INT_V</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
extract a name
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>extractplaces</function></funcdef>
<paramdef><parameter>NODE</parameter>,
<parameter>LIST_V</parameter>,
<parameter>INT_V</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
extract a place
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>extracttokens</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>LIST_V</parameter>,
<parameter>INT_V</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
extract tokens
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>extractdatestr</function></funcdef>
<paramdef><parameter>VARB</parameter>,
<parameter>VARB</parameter>,
<parameter>VARB</parameter>,
<parameter>VARB</parameter>,
<parameter>VARB</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
extract date from string
</para>
</glossdef></glossentry>

</glosslist>

<para>
Value extraction functions read the values of certain lines and return those values in extracted form.
</para>

<para>
<function>Extractdate</function> extracts date values from either an event node
or <structfield>DATE</structfield> node. The first parameter must be
a node; if its tag is <structfield>DATE</structfield>, the date is extracted 
from the value of that node; if its tag is not <structfield>DATE</structfield>,
the date is extracted from the first <structfield>DATE</structfield> line one 
level below the argument node. The remaining three arguments are variables.
The first is assigned the integer value of the extracted day; the second is
assigned the integer value of the extracted month; and the third is assigned
the integer value of the extracted year.
</para>

<para>
<function>Extractnames</function> extracts name components from a <structfield>NAME</structfield> line. Its first argument is either an <structfield>INDI</structfield> or a
<structfield>NAME</structfield> node. If it is a <structfield>NAME</structfield> line, the components are extracted from the value of that node; if it is an
<structfield>INDI</structfield> line, the components are extracted from the value of the first <structfield>NAME</structfield> line in the person record.
The second argument is a list that will hold the extracted components. The third argument is an integer
variable that is set to the number of extracted components. The fourth argument is a variable that is set
to the index (starting at one) of the surname component; the <literal>/</literal> characters are removed from around the
surname component. If there is no surname this argument variable is set to zero.
</para>

<para>
<function>Extractplaces</function> extracts place components
from a <structfield>PLAC</structfield> node. The first
argument is a node; if its tag is
<structfield>PLAC</structfield>, the places are extracted from
the value of the node; if its tag is not
<structfield>PLAC</structfield>, places are extracted from the
first <structfield>PLAC</structfield> line one level below the
argument node. The second parameter is a list that will hold
the extracted components. The third argument is an integer
variable that is set to the number of extracted
components. Place components are defined by the
comma-separated portions of the
<structfield>PLAC</structfield> value; leading and trailing
white space is removed from the components, while all internal
white space is retained.
</para>

<para>
<function>Extracttokens</function> extracts tokens from a
string and places them in a list. The first argument is the
string to extract tokens from. The second argument is the list
to hold the tokens. The third argument is an integer variable
that is set to the number of tokens extracted. The fourth
parameter is the string of delimiter characters that
<function>extracttokens</function> uses to break the input
string into tokens.
</para>

<para>
<function>extractdatestr</function> extracts date values from a .
<structfield>STRING</structfield>.  It is intended for internal verification
of date extraction code.
The remaining five arguments are variables.
The second is assigned the integer value of the extracted day; the third is
assigned the integer value of the extracted month; and the fourth is assigned
the integer value of the extracted year.
</para>


</sect1>

<sect1>

<title>
User Interaction Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>getindi</function></funcdef>
<paramdef><parameter>INDI_V</parameter>,
<parameter><replaceable>STRING</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
identify person through user interface
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>getindiset</function></funcdef>
<paramdef><parameter>SET_V</parameter>,
<parameter><replaceable>STRING</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
identify set of persons through user interface
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>getfam</function></funcdef>
<paramdef><parameter>FAM_V</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
identify family through user interface
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>getint</function></funcdef>
<paramdef><parameter>INT_V</parameter>,
<parameter><replaceable>STRING</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
get integer through user interface
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>getstr</function></funcdef>
<paramdef><parameter>STRING_V</parameter>,
<parameter><replaceable>STRING</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
get string through user interface
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>choosechild</function></funcdef>
<paramdef><parameter>INDI|FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
select child of person/family through user interface
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>FAM <function>choosefam</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
select family person is in as spouse
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>chooseindi</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
select person from set of persons
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INDI <function>choosespouse</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
select spouse of person
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>choosesubset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
select a subset of persons from set of persons
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>menuchoose</function></funcdef>
<paramdef><parameter>LIST</parameter>,
<parameter><replaceable>STRING</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
select from a list of options
</para>
</glossdef></glossentry>

</glosslist>

<para>
These functions interact with the user to get information needed by the program.
</para>

<para>
<function>Getindi</function> asks the user to identify a person. The first argument is a variable that is set to the person.
The second is an optional string to use as a prompt. <function>Getindiset</function> asks the user to identify a set of persons.
<function>Getfam</function> asks the user identify a family. <function>Getint</function> and <function>getstr</function> ask the user enter an integer and string,
respectively.
</para>

<para>
<function>Choosechild</function> asks the user select a child of a family or person; its single argument is a person or family;
it return the child. <function>Choosefam</function> has the user select a family that a person is in as a spouse; its argument
is a person; it returns the family. <function>Chooseindi</function> has the user select one person from a set of persons; its
argument in a set of persons; it returns the chosen person. <function>Choosespouse</function> has the user select a spouse of a
person; its argument is a person; it returns the chosen spouse. <function>Choosesubset</function> has the user select a subset of
persons from a set of persons; its argument is the chosen subset.
</para>

<para>
<function>Menuchoose</function> allows the user to select from an arbitrary menu. The first argument is a list of strings
making up the items in the menu; the second, optional argument is a prompt string for the menu;
<function>menuchoose</function> returns the integer index of the item selected by the user; if the user doesn't select an item,
<returnvalue>zero</returnvalue> is returned.
</para>

</sect1>

<sect1>

<title>
String Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>lower</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
convert to lower case
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>upper</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
convert to upper case
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>capitalize</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
capitalize first letter
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>titlecase</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
capitalize first letter of each word
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>trim</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
trim to length
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>rjustify</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
right justify in field
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>concat</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter><replaceable>STRING</replaceable></parameter>
<parameter><replaceable>...</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
catenate two strings
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>strconcat</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter><replaceable>STRING</replaceable></parameter>
<parameter><replaceable>...</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
catenate two strings
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>strlen</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number of characters in string
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>substring(</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>INT</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
substring function
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>index</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>STRING</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
index function
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>d</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number as decimal string
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>f</function></funcdef>
<paramdef><parameter>FLOAT</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number as floating point string
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>card</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number in cardinal form (<literal>one, two, ...</literal>)
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>ord</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number in ordinal form (<literal>first, second, ...</literal>)
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>alpha</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
convert number to Latin letter (<literal>a, b, ...</literal>)
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>roman</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
number in Roman numeral form (<literal>i, ii, ...</literal>)
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>strsoundex</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
find SOUNDEX value of arbitrary string
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>strtoint</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
convert numeric string to integer
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>atoi</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
convert numeric string to integer
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>strcmp</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
general string compare
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>eqstr</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compare strings for equality
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>nestr</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
compare strings for inequality
</para>
</glossdef></glossentry>

</glosslist>

<para>
These functions provide string handling. Prior to version 3.0.6, many of them used an approach to memory management
chosen for absolute minimal memory footprint. A function using this approach constructed its output string in its own string
buffer, reusing that buffer each time it was called. When a function using this approach returned a string
value it returned its buffer. In consequence the strings returned by these functions were to be either used or
saved before the function was called again.
</para>

<para>
<function>Lower</function> and <function>upper</function> convert the letters
in their arguments to lower or upper case, respectively.
<function>Capitalize</function> converts the first character of the argument,
if it is a letter, to upper case. <function>Lower</function> and
<function>upper</function> historically used the buffer return method;
<function>capitalize</function> operates on and returns its argument.
<function>titlecase</function> converts the first letter of each word if it is
a letter, to upper case and all other characters to lower case.
</para>

<para>
<function>Trim</function> shortens a string to the length specified by the second parameter. If the string is already of that
length or shorter the string is not changed. <function>Rjustify</function> right justifies a string into another string of the
length specified by the second parameter. If the original string is shorter than the justified string,
blanks are inserted to the left of the original string; if the string is longer than the justified string, the
original string is truncated on the right. <function>Trim</function> historically used the buffer return method; <function>rjustify</function> creates and returns
a new string.
</para>

<para>
<function>Concat</function> and <function>strconcat</function> catenate strings and return the result. They are identical functions. They may
take two to 32 string arguments; null arguments are allowed. The arguments are concatenated together into
a single, newly allocated string, which is returned.
</para>

<para>
<function>Strlen</function> returns the length of the string argument.
</para>

<para>
<function>Substring</function> returns a substring of the first argument string. The second and third arguments are the
indices of the first and last characters in the argument string to use to form the substring. The indexes are relative one.
<function>Substring</function> historically used the buffer return method.
</para>

<para>
<function>Index</function> returns the character index of the nth occurrence of a substring within a string. The index is the
relative one character offset to the beginning of the substring. The first argument is the string; the
second argument is the substring; and the third argument is the occurrence number.
</para>

<para>
<function>D</function>, <function>card</function>, <function>ord</function>,
<function>alpha</function> and <function>roman</function> convert integers
to strings. <function>D</function> converts an integer to a numeric string;
<function>card</function> converts an integer to a cardinal number string 
(eg, <literal>one, two, three</literal>); <function>ord</function> converts an
integer to an ordinal number (eg, <literal>first, second, third</literal>);
<function>alpha</function> converts an integer to a letter
(eg, <literal>a, b, c</literal>); and <function>roman</function> converts an 
integer to a Roman numeral (eg, <literal>i, ii, iii</literal>).
</para>

<para>
The <function>f</function> function converts a float to a string.  The
optional second argument specifies the precision of the output.  The default
precision is 2.
</para>
<para>
<function>Strsoundex</function> converts an arbitrary string to a SOUNDEX value. Non-ASCII text characters are ignored
in the string.
</para>

<para>
<function>Strtoint</function> converts a numeric string to an integer. <function>Atoi</function> is identical to <function>strtoint</function>.
</para>

<para>
<function>Strcmp</function> compares two strings and returns an integer that is less than zero, equal to zero, or greater than
zero, if, respectively, the first string is lexicographically less than, equal to, or greater than the second
string. <function>Eqstr</function> and <function>nestr</function> return whether two strings are equal or not equal, respectively.
<function>Strcmp</function>, <function>Eqstr</function>, and <function>nestr</function> all treat null strings as empty strings,
which is to say they pretend that a null string is actually "". This means that all null and empty strings compare as equal.
</para>

</sect1>

<sect1>

<title>
Output Mode Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>linemode</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
use line output mode
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>pagemode</function></funcdef>
<paramdef><parameter>INT</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
use page output mode with given page size
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>col</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
position to column in output
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>getcol</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
get current column in output
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>row</function></funcdef>
<paramdef><parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
position to row in output
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>pos</function></funcdef>
<paramdef><parameter>INT</parameter>,
<parameter>INT</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
position to (row, col) coordinate in output
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>pageout</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
output page buffer
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>nl</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
newline character
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>sp</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
space character
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>qt</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
double quote character
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>newfile</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>BOOL</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
send program output to this file
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>outfile</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
return name of current program output file
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>copyfile</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
copy file contents to program output file
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOLEAN <function>test</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
tests for characteristics of a file
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>print</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter><replaceable>STRING</replaceable></parameter>
<parameter><replaceable>...</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
print string to standard output window
</para>

</glossdef></glossentry></glosslist>

<para>
Reports can be generated in two modes, line mode and page mode. <function>Linemode</function> selects line mode and
<function>pagemode</function> selects page mode; line mode is the default. The first parameter to <function>pagemode</function> is the number
of rows per page; the second parameter is the number of columns per page. When in the line mode report
output is written directly to the output file as the program runs, line by line. When in page mode output
is buffered into pages which are written to the output file when <function>pageout</function> is called. Page mode is useful
for generating charts (eg, pedigree charts or box charts) where it is convenient to compute the two-dimensional
location of output.
</para>

<para>
<function>Col</function> positions output to the given column. If the current 
column is greater than the argument, col
positions output to the given column on the next line. <function>Col</function>
works in both modes.
<function>Getcol</function> returns the current column in the output.
</para>

<para>
<function>Row</function> positions output to the first character in the given row; <function>row</function> can only be used in page mode.
</para>

<para>
<function>Pos</function> positions output to a specified row and column coordinate; the first argument specifies the row, and
the second specifies the column. <function>Pos</function> can only be used in page mode.
</para>

<para>
<function>Nl</function> write a new line character to the output file; <function>sp</function> writes a space character to the output file; and <function>qt</function>
writes a quote character to the output file. Note that <literal>\n</literal> and <literal>\'</literal> can be used within string values to
represent the newline and double quote characters.
</para>

<para>
<function>Newfile</function> specifies the name of the report output file. Its first argument is the file's name; its second
argument is an append flag - if its value is non-zero the report appends to this file; if its value is zero
the report overwrites the contents of the file. <function>Newfile</function> can be called many times; this allows a single report program to generate many report output files during one execution. Programs are not required to
use <function>newfile</function>; if it is not used then <application>LifeLines</application> automatically asks for the name of the report output file.
</para>

<para>
<function>Outfile</function> returns the name of the current report output file.
</para>

<para>
<function>Copyfile</function> copies the contents of a file to the report output file; its argument is a string whose value is
the name of a file; if the file name is not absolute nor relative, then the <envar>LLPROGRAMS</envar> environment
variable, if set, will be used to search for the file; the file is opened and its contents copied to the report
output file.
</para>

<para>
<function>Test</function> will check for a specified property of the specified file.  The first argument is the property, the second argument is the filename.
Supported properties are:
r - file is readable
w - file is writeable
x - file is executable
s - file has non-zero size
z - file has zero size
e - file exists
f - check if argument is a file
d - check if argument is a directory

The return value is TRUE or FALSE, depending on whether the file had the specified property or not.
</para>

<para>
<function>Print</function> prints its argument string to the standard output window; <function>print</function> may have one to 32 arguments.
</para>

</sect1>

<sect1>

<title>
Person Set Functions and GEDCOM Extraction
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>indiset</function></funcdef>
<paramdef><parameter>SET_V</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
declare a set variable
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>addtoset</function></funcdef>
<paramdef><parameter>SET</parameter>,
<parameter>INDI</parameter>,
<parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
add a person to a set
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>deletefromset</function></funcdef>
<paramdef><parameter>SET</parameter>,
<parameter>INDI</parameter>,
<parameter>BOOL</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
remove a person from a set
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>length</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
size of a set
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>union</function></funcdef>
<paramdef><parameter>SET</parameter>,
<parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
union of two sets
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>intersect</function></funcdef>
<paramdef><parameter>SET</parameter>,
<parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
intersection of two sets
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>difference</function></funcdef>
<paramdef><parameter>SET</parameter>,
<parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
difference of two sets
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>parentset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set of all parents
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>childset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set of all children
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>spouseset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set of all spouses
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>siblingset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set of all siblings
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>ancestorset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set of all ancestors
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>descendentset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set of all descendents
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>descendantset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
same as descendentset; spelling
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>SET <function>uniqueset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
remove duplicates from set
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>namesort</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
sort indiset by name
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>keysort</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
sort indiset by key values
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>valuesort</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
sort indiset by auxiliary values
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>genindiset</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
generate indiset from GEDCOM name string
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>inset</function></funcdef>
<paramdef><parameter>SET</parameter>,
<parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
<returnvalue>true</returnvalue> if the Individual is in the set.
</para>
</glossdef></glossentry>


<glossentry><glossterm><synopsis><command>forindiset</command>( <replaceable>SET</replaceable>, <replaceable>INDI_V</replaceable>, <replaceable>ANY_V</replaceable>, <replaceable>INT_V</replaceable> ) { <replaceable>commands</replaceable> }</synopsis></glossterm><glossdef>

<para>
loop through all persons in person set
</para>

</glossdef></glossentry>
</glosslist>

<para>
These functions allow you to manipulate person sets. A person set is a potentially large set of persons;
each person may have an arbitrary value associated with him/her. A person set must be declared with
the <function>indiset</function> function before it can be used.
</para>

<para>
<function>Addtoset</function> adds a person to a set. The first argument is the set; the second argument is the person; and
the third argument may be any value. The same person may be added to a set more than once, each time
with a different value. <function>Deletefromset</function> removes a person from a set. The first argument is the set; the
second argument is the person; if the third parameter is <returnvalue>true</returnvalue> all of the person's entries are removed
from the set; if <returnvalue>false</returnvalue> only the first entry is removed. 
<function>Length</function> returns the number of persons in a person set.
</para>

<para>
<function>Union</function>, <function>intersect</function> and <function>difference</function>
return the set union, set intersection and set difference, respectively, of two person sets.
Each functions takes two person sets as arguments and returns a third person set. The
functions actually modify their argument sets, both reordering them into canonical key order
and removing any duplicates (these operations are necessary to easily implement these types
of set functions).
</para>

<para>
<function>Parentset</function>, <function>childset</function>, <function>spouseset</function> and <function>siblingset</function> return the set of all parents, set of all children, set of
all spouses and set of all siblings, respectively, of the set of persons in their argument. In all cases there
is no change to the argument person set.
</para>

<para>
<function>Ancestorset</function> returns the set all ancestors of all persons in the argument set. <function>Descendentset</function> returns the
set of all descendents of all persons in the argument set. <function>Descendantset</function> is the same as <function>descendentset</function>; it allows an alternate spelling.
</para>

<para>
<function>Uniqueset</function> sorts a person set by key value and then removes all entries with duplicate keys; the input
set is modified and returned.
</para>

<para>
<function>Namesort</function>, <function>keysort</function> and <function>valuesort</function> sort a set of persons by name, by key and by associated value,
respectively.
</para>

<para>
Each person in a person set has an associated value. When a person is added to a set with <function>addtoset</function>, the
value is explicitly assigned. When new sets are created by other functions, a number of rules are used to
associate values with persons as they are added to the new sets. For <function>parentset</function>, <function>childset</function> and
<function>spouseset</function> the values are copied from the first input set person that causes the new person to be added
to the set. For <function>union</function>, <function>intersect</function> and <function>difference</function>, the values are copied from the values in the first input
set, except in the case of <function>union</function>, when persons are taken from the second set alone, in which case the
values come from there. For <function>ancestorset</function> and <function>descendantset</function> the value is set to the number of generations
the new person is away from the <emphasis>first</emphasis> person in the input set that the new person is related to. If the
new person is related to more than one person in the input set, the value is set for the nearest
relationship; that is, the value is as low as possible. <function>Valuesort</function> sorts a person set by the values of these
auxiliary values.
</para>

<para>
<function>Genindiset</function> generates the set of persons that matches a string whose value is a name in <acronym>GEDCOM</acronym>
format. <function>Genindiset</function> uses the same algorithm that matches names entered at the browse prompt or by
the user interaction <function>getindiset</function> function.
</para>

<para>
<function>Inset</function> returns <returnvalue>true</returnvalue> if the
the specified individual is in the SET.
</para>

<para>
<function>Forindiset</function> is an iterator that loops through each person in an indiset. The first parameter is an indiset.
The second parameter is a variable that iterates through each person in the set. The third parameter
iterates through the values associated with the persons. The fourth parameter is an integer variable
that counts the iterations.
</para>

</sect1>

<sect1>

<title>
Record Update Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>createnode</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
create a GEDCOM node
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>addnode</function></funcdef>
<paramdef><parameter>NODE</parameter>,
<parameter>NODE</parameter>,
<parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
add a node to a GEDCOM tree
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>detachnode</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
delete a node from a GEDCOM tree
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>writeindi</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
write a person back to the database
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>writefam</function></funcdef>
<paramdef><parameter>FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
write a family back to the database
</para>

</glossdef></glossentry></glosslist>

<para>
These functions allow you to modify an internal <acronym>GEDCOM</acronym> node tree.
</para>

<para>
<function>Createnode</function> creates a <acronym>GEDCOM</acronym> node; the two arguments are tag and value strings,
respectively; the value string can be <returnvalue>null</returnvalue>. <function>Addnode</function> adds a node to a
node tree. The first argument is the new node; the second is the node in the tree that becomes the parent of the new
node; the third is the node in the tree that becomes the previous sibling of the new node; this argument is
<returnvalue>null</returnvalue> if the new node is to become the first child of the parent.
<function>Detachnode</function> removes a node from a node tree. <function>writeindi</function> writes an individual
record back to the database, and <function>writefam</function> writes a family record back to the database, allowing the
report to make permanent changes to the database.
</para>

<para>
The node functions only change data in memory; there is no effect on the database until and unless
<function>writeindi</function> or <function>writefam</function> are called.
</para>

</sect1>

<sect1>

<title>
Record Linking Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>BOOL <function>reference</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
determine if string is a cross reference
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>NODE <function>dereference</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
reference cross reference or key to node tree
</para>

</glossdef></glossentry></glosslist>

<para>
These functions allow you to recognize values that are cross references and to read the records they refer
to. <function>Reference</function> returns <returnvalue>true</returnvalue> if its string argument is a cross reference value, that is, the internal key of
one of the records in the database. <function>Dereference</function> returns the node tree of the record referred to by its cross-reference string argument.
</para>

</sect1>

<sect1>

<title>
Miscellaneous Functions
</title>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>lock</function></funcdef>
<paramdef><parameter>INDI|FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
lock a person or family in memory
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>unlock</function></funcdef>
<paramdef><parameter>INDI|FAM</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
unlock a person or family from memory
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>database</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
return name of current database
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>program</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
return name of current program
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>version</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
return version of <application>LifeLines</application> program
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>system</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
execute string as a UNIX shell command
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>heapused</function></funcdef><void/>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
amount of heap used for windows
</para>

</glossdef></glossentry>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>getproperty</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
extract system or user property.  Function available after v3.0.5.
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>setlocale</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set the locale
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>bytecode</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
encode a string in a codeset
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>convertcode</function></funcdef>
<paramdef><parameter>STRING</parameter>,
<parameter>STRING</parameter>,
<parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
convert string from one codeset to another
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>debug</function></funcdef>
<paramdef><parameter>BOOLEAN</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
set interperter debug mode
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>pvalue</function></funcdef>
<paramdef><parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
dump information about a pvalue
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>free</function></funcdef>
<paramdef><parameter>ANY</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
free space associated with a variable
</para>
</glossdef></glossentry>

</glosslist>

<para>

<function>Lock</function> and <function>unlock</function> are used to lock a
person or family into <acronym>RAM</acronym> memory, and to unlock a person or family
from <acronym>RAM</acronym> memory, respectively.

</para>

<para>
<function>Database</function> returns the name of the current database, useful
in titling reports. <function>program</function> returns the
name of the current report program. <function>Version</function> returns the
version of the running <application>LifeLines</application> program, eg, <literal>&llversion;</literal>.
</para>

<para>
<function>System</function> executes its string argument as a
<acronym>UNIX</acronym> (or <acronym>MS-Windows</acronym> as appropriate) shell
command, by invoking the system shell. This will not occur if the user has
chosen to disallow report system calls (via the DenySystemCalls user option).
</para>

<para>
The <function>heapused</function> function returns the amount of system heap
that is in use at the time.  This is implemented only on windows.
</para>

<para>
The <function>getproperty</function> function extracts system or user
properties.  Properties are named group.subgroup.property,
group.property or even property.  The keys are available at the moment can 
be found in the ll-userguide under System and User Properties.
</para>

<para>
The <function>setlocale</function> function sets the locale and returns
the previous setting of locale.
</para>

<para>
The <function>bytecode</function> function converts the supplied string
with escape codes to the current codeset from the internal codeset or
from the codeset specified by the
optional second parameter if specified.  A escaped code is a dollar sign ($)
followed by 2 hex characters, e.g. $C1.
</para>

<para>
The <function>convertcode</function> function converts a string to another
codeset.  In the two argument form, the second argument is the destination
codeset, and the source codeset is the internal codeset.  In the 3 argument
form, the second argument is the source codeset and the third argument is the
destination codeset.  (See the section of the LifeLines User Guide on codeset
conversions.)  For example, if your internal codeset is UTF-8, and the report 
codeset is UTF-8, the following code,
<programlisting>       "&lt;p&gt;\n"
       convertcode(str,"UTF-8//html")
</programlisting>
writes the first line of output as it is written, but will apply the html
sub-conversion to all the characters in the string str. The special
html codes, like the less than or greater than, will be escaped when printing
the second string, but not when printing the first string.
</para>

<para>
The <function>debug</function> function turns on or off programming debugging.
When enabled gobs of information is printed as a 
<application>LifeLines</application> program is run.  This can be useful
to figure out why a program is not behaving as expected.
</para>

<para>
The <function>pvalue</function> function returns a string that represents
the contents of a variable in the interpreter.  This is present for debug
purposes.
</para>

<para>
The function <function>free</function> deallocates space associated with the
variable provided as argument 1. Care must be taken when free is used in a
function on a variable which is a parameter to the function.  free will not
effect the variable in the calling program.
</para>


</sect1>

<sect1>

<title>
Deprecated Functions
</title>

<para>
The <function>baptism</function> finds christening (CHR) events.  The types of
events desired to be found, depend on the nature of the report being written.
It is recommended that custom access routines be used instead of 
<function>baptism</function>.
</para>
<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>EVENT <function>baptism</function></funcdef>
<paramdef><parameter>INDI</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
first baptism event of
</para>

<para>
If you want a routine that returns the first event for an individual that is a
baptism, LDS baptism, Christening or Adult Christening, the following routine
can be used.

    <synopsis>func get_baptism(indi) {
    fornodes(indi,node) {
        if (index(" BAPM BAPL CHR CHRA ",upper(tag(node)),1)) {
            return(node)
        }
	return(0)
    }
}</synopsis>
If you want to search for additional events or fewer events you can modify the
string in the index call acccordingly.  Likewise, if you want the to prioritize
the results, finding a christening event if one exists, else finding
a baptism event if one exists, then finding an LDS baptism event, and finally
a christening event, the following function is suggested.

    <synopsis>/* get_baptism(indi) returns a baptism event if found
   events CHR, BAPM, BAPL, and CHRA are considered, in that order
*/
func get_baptism(indi, prefs)
{
    set(chr, 0)
    set(bapm, 0)
    set(bapl, 0)
    set(chra, 0)
    fornodes(indi,node)
    {
	if (and(eq(upper(tag(node)), "CHR"), not(chr)) { set(chr, node) }
	if (and(eq(upper(tag(node)), "BAPM"), not(bapm)) { set(bapm, node) }
	if (and(eq(upper(tag(node)), "BAPL"), not(bapl)) { set(bapl, node) }
	if (and(eq(upper(tag(node)), "CHRA"), not(chra)) { set(chra, node) }
    }
    if (chr) { return(chr) }
    if (bapm) { return(bapm) }
    if (bapl) { return(bapl) }
    return(chra)
}</synopsis>

</para>
</glossdef></glossentry>
</glosslist>

<para>
The functionality of the following three functions,
<function>getindimsg</function>,
<function>getintmsg</function> and
<function>getstrmsg</function>
is now available using the optional parameter of
<function>getindi</function>,
<function>getint</function> and
<function>getstr</function>.
These functions should no longer be used as they will be removed from a future
version of <application>Lifelines</application>.
</para>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>getindimsg</function></funcdef>
<paramdef><parameter>INDI_V</parameter>,
<parameter><replaceable>STRING</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
identify person through user interface
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>getintmsg</function></funcdef>
<paramdef><parameter>INT_V</parameter>,
<parameter><replaceable>STRING</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
get integer through user interface
</para>
</glossdef></glossentry>


<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>getstrmsg</function></funcdef>
<paramdef><parameter>STRING_V</parameter>,
<parameter><replaceable>STRING</replaceable></parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
get string through user interface
</para>
</glossdef></glossentry>

</glosslist>

<para>
Three functions are available for to generate <acronym>GEDCOM</acronym>
format output to the report output file of all persons in the argument
person set.  These functions do not in most cases generate consistent
and usable output.  This can be done with a program, but it is 
suggested that these routines are probably not what you really wanted.
</para>
<para>
<function>Gengedcom</function> 
output contains a person record for each person in the set,
and all the family records that
link at least two of the persons in the set together.
This function is provided for backward compatibility. Source, Event and
Other(X) record pointers are output unmodified, but none of their records
are output - this yields an inconsistent output.
</para>

<para>
<function>Gengedcomweak</function> 
output does not contain Source, Event or Other(X) record pointers 
or their records.
<function>Gengedcomstrong</function> includes 
the Source, Event and Other(X) record pointers and all top-level nodes
referenced by them.
</para>

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>gengedcom</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
generate GEDCOM file from person set
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>gengedcomweak</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
generate GEDCOM file from person set
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>gengedcomstrong</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
generate GEDCOM file from person set
</para>
</glossdef></glossentry>
</glosslist>

<para>
By the release of version 3.0.6, all string values are local copies, and the <function>save</function> and
<function>strsave</function> functions should be entirely unnecessary.
<function>Save</function> is present only for compatibility reasons. Previously it duplicated its argument (to prevent strings
from becoming stale; this is not currently necessary (and this function no longer does anything).
 <function>Strsave</function> is the same function as <function>save</function>.
</para>



<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>save</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
save and return copy of string
</para>
</glossdef></glossentry>

<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>STRING <function>strsave</function></funcdef>
<paramdef><parameter>STRING</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
same as save function
</para>
</glossdef></glossentry>
</glosslist>

<para>
Use <function>detachnode</function> instead of
<function>deletenode</function>.
</para>
<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>VOID <function>deletenode</function></funcdef>
<paramdef><parameter>NODE</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
delete a node from a GEDCOM tree
</para>
</glossdef></glossentry>
</glosslist>

<para>
In releases after version 3.0.39, the 
<function>length</function> function accepts an argument of type 
<type>list</type>, <type>set</type> or <type>table</type>.  the
<function>lengthset</function> function is no longer needed.
</para> 

<glosslist>
<glossentry><glossterm><funcsynopsis><funcprototype>
<funcdef>INT <function>lengthset</function></funcdef>
<paramdef><parameter>SET</parameter></paramdef>
</funcprototype></funcsynopsis></glossterm><glossdef>

<para>
size of a set
</para>
</glossdef></glossentry>
</glosslist>


</sect1>

</chapter>
</book>