File: refn.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 (79 lines) | stat: -rw-r--r-- 2,257 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
78
79
/*
 * @progname       refn.ll
 * @version        1.0
 * @author         Larry Hamilton
 * @category     
 * @output         Text
 * @description    Report of all User Reference Numbers (REFN).

 Prints out the value of all the lines in your database with the REFN tag,
 along with enough information so you can find the line easily. The purpose
 of this report is so you can find all the REFNs, and double-check them for
 duplicates.

 *                Modified from Olsen, Eggert - places.ll
 *
 *                by Larry Hamilton (lmh@hamiltongensociety.org)
 *                Version 1.0, November 10, 2005
 *
 * The REFNs are printed out in the order that they appear in the database.
 *
 *                  To sort the output:
 * on Unix\Linux: sort -f originalfilename -o sortedfilename
 * on Windows:    sort originalfilename /O sortedfilename
 *
 */

proc main()
{
  list(tag_stack)

  print("Printing all REFNs.\n")
  print("Be patient. This may take a while.\n\n")
  print("If there are no REFNs in the database,\nthere will not be a prompt for an output file name.\n")

  forindi (person, id) {

    traverse (inode(person), node, level) {

      setel(tag_stack, add(level, 1), tag(node))

      if (eq(strcmp(tag(node), "REFN"), 0)) {
        tag(node) " " value(node) " | " key(person) " " name(person)
        forlist (tag_stack, tag, tag_number) {
          if (and(gt(tag_number, 1), le(tag_number, level))) { " " tag }
        }
        "\n"
      }
    }
  }

  forfam (fam, fnum) {

    traverse (fnode(fam), node, level) {
      setel(tag_stack, add(level, 1), tag(node))

      if (eq(strcmp(tag(node), "REFN"), 0)) {
       tag(node) " " value(node) " | " key(fam) " ("
        if (person,husband(fam)) { set(relation,", husb") }
        elsif (person,wife(fam)) { set(relation,", wife") }
        else {
          children(fam,child,cnum) {
            if (eq(cnum,1)) {
              set(person,child)
              set(relation,", chil")
            }
          }
        }
        if (person) {
          key(person) " " name(person) relation
        }
        ") |"
        forlist (tag_stack, tag, tag_number) {
          if (and(gt(tag_number, 1), le(tag_number, level))) { " " tag }
        }
        "\n"
      }
    }
  }
}