File: afn_match.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 (75 lines) | stat: -rw-r--r-- 1,475 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
/*
 * @progname    afn_match.ll
 * @version     1.0 of 1995-08-25
 * @author      Scott McGee
 * @category
 * @output      Text
 * @description
 *
 * Find individuals with matching Ancestral File numbers, report matches.
 *

This program is designed to search a database and find individuals with
the same AFN's. The output is a report of such matching individuals.

Last updated 25 Aug, 1995 by Scott McGee (smcgee@microware.com)
*/

global(first)

proc main (){
  table(t)

  set(first, 1)
  print("Processing database ")
  set(cnt, 0)
  forindi(indi, n){
    if(afn, get_afn(indi)){
      if(match, lookup(t, afn)){
        call found_match(indi, save(afn), match)
      }else{
        insert(t, save(afn), indi)
      }
    }
    incr(cnt)
    if(eq(cnt, 100)){
      set(cnt, 0)
      print(".")
    }
  }
}

func get_afn(indi){
  if(indi){
    fornodes(inode(indi), subnode){
      if(eqstr(tag(subnode), "AFN")){
        return(value(subnode))
      }
    }
  }
  return(0)
}

proc found_match(i2, afn, i1){
  if(first){
    set(first, 0)
    "Ancestral File Number match report\n\n"
    "produced by afn_match.ll version 1.0\n"
    "by Scott McGee (smcgee@microware.com)\n\n"
    "Database: "
    database()
    "\nDate:     "
    long(gettoday())
    "\n\n"
    "AFN      Key1      Key2      Name1\n"
    "_________________________________________________________________________\n"
  }
  afn
  col(10)
  key(i1)
  col(20)
  key(i2)
  col(30)
  name(i1, 0)
  "\n"
}