Debian Codegraph @

reports/maritalinfo.ll

raw
1 /*
2 * @progname maritalinfo.ll
3 * @version 1.0 (2002-11-13)
4 * @author Perry Rapp
5 * @category sample
6 * @output screen
7 * @description
8 *
9 * Simple example of looping through marital (& divorce) info
10 */
11
12 /* get marital & divorce lists, and then display them */
13 proc main() {
14
15 getfam(family)
16 list(marriages)
17 getmarriages(family, marriages)
18 if (not(empty(marriages))) {
19 print("Marital events:", nl())
20 forlist (marriages, node, offset) {
21 if (eq(tag(node), "ENGA")) {
22 call event_out("Engagement: ", node)
23 }
24 if (eq(tag(node), "MARR")) {
25 call event_out("Marriage: ", node)
26 }
27 }
28 }
29 list(divorces)
30 getdivorces(family, divorces)
31 if (not(empty(divorces))) {
32 print("Divorce events:", nl())
33 forlist (divorces, node, offset) {
34 if (eq(tag(node), "ANUL")) {
35 call event_out("Annulment: ", node)
36 }
37 if (eq(tag(node), "DIV")) {
38 call event_out("Divorce: ", node)
39 }
40 if (eq(tag(node), "DIVF")) {
41 call event_out("DivorceFiling: ", node)
42 }
43 }
44 }
45
46 }
47
48 /* send out event info with header, to screen right now */
49 proc event_out(hdr, event) {
50 print(event_string(hdr, event), nl())
51 }
52
53 /* make a display string out of an event and a header */
54 func event_string(hdr, event) {
55 set(outstr, concat(hdr, short(event)))
56 return(outstr)
57 }
58
59 /* get list of all marital events in family */
60 func getmarriages(family, evlist) {
61 fornodes (root(family), node) {
62 if (eq(tag(node), "MARR")) { push(evlist, node) }
63 if (eq(tag(node), "ENGA")) { push(evlist, node) }
64 }
65 }
66
67 /* get list of all divorce-style events in family */
68 func getdivorces(family, evlist) {
69 fornodes (root(family), node) {
70 if (eq(tag(node), "ANUL")) { push(evlist, node) }
71 if (eq(tag(node), "DIV")) { push(evlist, node) }
72 if (eq(tag(node), "DIVF")) { push(evlist, node) }
73 }
74 }