Debian Codegraph @

reports/outsources.li

raw
1 /*
2 * @progname outsources.li
3 * @version 1.3
4 * @author Scott McGee ([email protected])
5 * @category
6 * @output GEDCOM
7 * @description
8
9 This is a library of functions and proc to output GEDCOM. It is most useful
10 to output source records and potentially some info from custom tags.
11 The proc outsources() will take an indi set and output all the source
12 structures that are referenced.
13
14 @(#)gedcom.li 1.3 10/13/95
15 */
16
17
18 proc outsources (s){
19 table(t)
20 list(q)
21 forindiset (s, i, a, n) {
22 traverse(root(i), m, l) {
23 if (nestr("SOUR", tag(m))) {
24 continue()
25 }
26 if (not(reference(value(m)))) {
27 continue()
28 }
29 if (eq(1, lookup(t, value(m)))) {
30 continue()
31 }
32 set(v, save(value(m)))
33 insert(t, v, 1)
34 enqueue(q, v)
35 }
36 }
37 if(q){
38 forlist(q, k, n) {
39 set(r, dereference(k))
40 call outrecord(r)
41 }
42 }
43 }
44
45 proc outrecord(r){
46 /* good general purpose procedure that outputs
47 any LifeLines record in its pure GEDCOM form */
48
49 traverse(r, s, l) {
50 d(l)
51 if (xref(s)) {
52 " "
53 xref(s)
54 }
55 " "
56 tag(s)
57 if (value(s)) {
58 " "
59 value(s)
60 }
61 "\n"
62 }
63 }