Debian Codegraph @

reports/cont.ll

raw
1 /*
2 * @progname cont.ll
3 * @version 1.0
4 * @author Väisänen
5 * @category
6 * @output Text
7 * @description
8
9 This program iterates over all persons and families in a database
10 and reports all records that have erroneous CONT lines.
11
12 It finds errors like
13
14 2 TAG blah 2 CONT blah 2 CONT blah
15 2 CONT blah 3 CONT blah 2 TAG blah
16
17 If the output is
18
19 These individuals may have problems with CONT lines
20 These families may have problems with CONT lines
21
22 then the program found no errors.
23
24
25 Written by Hannu Väisänen 22 September 1999.
26 */
27
28 proc main()
29 {
30 "These individuals may have problems with CONT lines\n"
31
32 forindi (person, m) {
33 print ("i")
34 call check (person, 0)
35 }
36
37 "These families may have problems with CONT lines\n"
38 forfam (family, m) {
39 print ("f")
40 call check (family, 1)
41 }
42 }
43
44 proc check (person, isfam)
45 {
46 set (prev_level, 0)
47 set (prev_tag, "xxxx")
48
49 traverse (root(person), node, n) {
50 if (eqstr(tag(node), "CONT")) {
51 if (eqstr(prev_tag, "CONT")) {
52 if (ne(prev_level, n)) {
53 if (eq(isfam,1)) {
54 "Husband " key(husband(person)) " " name(husband(person)) "\n"
55 "Wife " key(wife(person)) " " name(wife(person)) "\n\n"
56 }
57 else {
58 key(person) " " name(person) "\n"
59 }
60 }
61 }
62 else {
63 if (ne(add(prev_level,1), n)) {
64 if (eq(isfam,1)) {
65 "Husband " key(husband(person)) " " name(husband(person)) "\n"
66 "Wife " key(wife(person)) " " name(wife(person)) "\n\n"
67 }
68 else {
69 name(person) " " key(person) "\n"
70 }
71 }
72 }
73 }
74 set (prev_level, n)
75 set (prev_tag, tag(node))
76 }
77 }