File: outsources.li

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 (63 lines) | stat: -rw-r--r-- 1,216 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
/*
 * @progname       outsources.li
 * @version        1.3
 * @author         Scott McGee (smcgee@microware.com)
 * @category       
 * @output         GEDCOM
 * @description    

This is a library of functions and proc to output GEDCOM. It is most useful
to output source records and potentially some info from custom tags.
The proc outsources() will take an indi set and output all the source
structures that are referenced.

@(#)gedcom.li	1.3 10/13/95
*/


proc outsources (s){
  table(t)
  list(q)
  forindiset (s, i, a, n) {
    traverse(root(i), m, l) {
      if (nestr("SOUR", tag(m))) {
        continue()
      }
      if (not(reference(value(m)))) {
        continue()
      }
      if (eq(1, lookup(t, value(m)))) {
        continue()
      }
      set(v, save(value(m)))
      insert(t, v, 1)
      enqueue(q, v)
    }
  }
  if(q){
    forlist(q, k, n) {
      set(r, dereference(k))
      call outrecord(r)
    }
  }
}

proc outrecord(r){
/* good general purpose procedure that outputs
   any LifeLines record in its pure GEDCOM form */

  traverse(r, s, l) {
    d(l)
    if (xref(s)) {
      " "
      xref(s)
    }
    " "
    tag(s)
    if (value(s)) {
      " "
      value(s)
    }
    "\n"
  }
}