File: cont.ll

package info (click to toggle)
lifelines 3.0.50-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 11,140 kB
  • ctags: 6,517
  • sloc: ansic: 57,468; xml: 8,014; sh: 4,255; makefile: 848; yacc: 601; perl: 170; sed: 16
file content (77 lines) | stat: -rw-r--r-- 1,756 bytes parent folder | download | duplicates (5)
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
/*
 * @progname    cont.ll
 * @version     1.0
 * @author      Väisänen
 * @category
 * @output      Text
 * @description

This program iterates over all persons and families in a database
and reports all records that have erroneous CONT lines.

It finds errors like

2 TAG  blah     2 CONT blah     2 CONT blah
2 CONT blah       3 CONT blah   2 TAG  blah

If the output is

  These individuals may have problems with CONT lines
  These families may have problems with CONT lines

then the program found no errors.


Written by Hannu Väisänen 22 September 1999.
*/

proc main()
{
  "These individuals may have problems with CONT lines\n"

  forindi (person, m) {
    print ("i")
    call check (person, 0)
  }

  "These families may have problems with CONT lines\n"
  forfam (family, m) {
    print ("f")
    call check (family, 1)
  }
}

proc check (person, isfam)
{
  set (prev_level, 0)
  set (prev_tag, "xxxx")

  traverse (root(person), node, n) {
    if (eqstr(tag(node), "CONT")) {
      if (eqstr(prev_tag, "CONT")) {
        if (ne(prev_level, n)) {
          if (eq(isfam,1)) {
            "Husband " key(husband(person)) " " name(husband(person)) "\n"
            "Wife    " key(wife(person))    " " name(wife(person)) "\n\n"
          }
          else {
            key(person) " " name(person) "\n"
          }
        }
      }
      else {
        if (ne(add(prev_level,1), n)) {
          if (eq(isfam,1)) {
            "Husband " key(husband(person)) " " name(husband(person)) "\n"
            "Wife    " key(wife(person))    " " name(wife(person)) "\n\n"
          }
          else {
            name(person) " " key(person) "\n"
          }
        }
      }
    }
    set (prev_level, n)
    set (prev_tag, tag(node))
  }
}