File: simpleged.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 (113 lines) | stat: -rw-r--r-- 3,589 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * @progname       simpleged.ll
 * @version        1.0
 * @author         Wetmore
 * @category       
 * @output         GEDCOM
 * @description    

This program generates a simple GEDCOM file from a database.  It can
be modified to convert your own LifeLines database formats to other
GEDCOM formats.

simpleged

Written by Tom Wetmore, July 1993.
*/

proc main ()
{
        "0 HEAD \n"
        "1 SOUR LIFELINES\n"
        forindi(indi, num) {
                print("i")
                call outindi(indi)
        }
        forfam(fam, num) {
                print("f")
                call outfam(fam)
        }
        "0 TRLR \n"
}

proc outindi (indi)
{
        set(root, inode(indi))
        set(noname, 1)
        set(nosex, 1)
        set(nobirt, 1)
        set(nobapt, 1)
        set(nodeat, 1)
        set(noburi, 1)
        "0 " xref(root) " " tag(root) nl()
        set(node, child(root))
        while (node) {
                if (and(noname, not(strcmp("NAME", tag(node))))) {
                        "1 NAME " value(node) nl()
                        set(noname, 0)
                } elsif (and(nosex, not(strcmp("SEX", tag(node))))) {
                        "1 SEX " value(node) nl()
                        set(nosex, 0)
                } elsif (and(nobirt, not(strcmp("BIRT", tag(node))))) {
                        call outevent(node)
                        set(nobirt, 0)
                } elsif (and(nobapt, not(strcmp("CHR", tag(node))))) {
                        call outevent(node)
                        set(nobapt, 0)
                } elsif (and(nodeat, not(strcmp("DEAT", tag(node))))) {
                        call outevent(node)
                        set(nodeat, 0)
                } elsif (and(noburi, not(strcmp("BURI", tag(node))))) {
                        call outevent(node)
                        set(noburi, 0)
                } elsif (not(strcmp("FAMC", tag(node)))) {
                        "1 FAMC " value(node) nl()
                } elsif (not(strcmp("FAMS", tag(node)))) {
                        "1 FAMS " value(node) nl()
                }
                set(node, sibling(node))
        }
}

proc outfam (fam)
{
        set(nomarr, 1)
        set(root, fnode(fam))
        "0 " xref(root) " " tag(root) nl()
        set(node, child(root))
        while (node) {
                if (not(strcmp("HUSB", tag(node)))) {
                        "1 HUSB " value(node) nl()
                } elsif (not(strcmp("WIFE", tag(node)))) {
                        "1 WIFE " value(node) nl()
                } elsif (not(strcmp("CHIL", tag(node)))) {
                        "1 CHIL " value(node) nl()
                } elsif (and(nomarr, not(strcmp("MARR", tag(node))))) {
                        call outevent(node)
                        set(nomarr, 0)
                }
                set(node, sibling(node))
        }
}

proc outevent (evt)
{
        set(nodate, 1)
        set(noplac, 1)
        set(nosour, 1)
        "1 " tag(evt) "\n"
        set(evt, child(evt))
        while (evt) {
                if (and(nodate, not(strcmp("DATE", tag(evt))))) {
                        "2 DATE " value(evt) nl()
                        set(nodate, 0)
                } elsif (and(noplac, not(strcmp("PLAC", tag(evt))))) {
                        "2 PLAC " value(evt) nl()
                        set(noplac, 0)
                } elsif (and(nosour, not(strcmp("SOUR", tag(evt))))) {
                        "2 SOUR " value(evt) nl()
                        set(nosour, 0)
                }
                set(evt, sibling(evt))
        }
}