File: dump-ances.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 (152 lines) | stat: -rw-r--r-- 4,104 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
 * @progname    dump-ances.ll
 * @version     1992-11
 * @author      Stephen Woodbridge
 * @category
 * @output      Text, 80 cols
 * @description
 *
 *      Program walks thru one's ancestors and dumps information
 *      about each family. It prunes the tree so an individual is
 *      only output once. It is a simple program that is easy to
 *      make changes to, if you want more or less info printed. I
 *      have included three date routines get_dates(), get_sdates(),
 *      and get_ldates for variations in the amount of event info that
 *      gets output to the file. The program lists all children of the
 *      families as it walks the tree. The ">>>>" marker on a child
 *      signifies the line of descent.
 *
 *      Writen by Stephen Woodbridge, Nov 1992
 */
global(UNKNOWN)
global(DONE)
global(ILIST)
global(NLIST)
global(RVAL)

proc main()
{
        table(DONE)
        list(ILIST)
        list(NLIST)
        list(RVAL)
        set(UNKNOWN, "____?____")

        getindi(me)
        getintmsg(max, " Maximum Depth :")
        enqueue(ILIST, me)
        enqueue(NLIST, 1)
        set(i, 1)
        while (me, dequeue(ILIST))
        {
                set(depth, dequeue(NLIST))
                if (not(lookup(DONE, key(me))))
                {
                        call do_me(me, depth, max)
                }
        }
}

proc do_me(me, depth, max)
{
        call out_me(me, depth)
        insert(DONE, save(key(me)), 1)
        if (le(add(depth, 1), max))
        {
                if (dad, father(me))
                {
                        enqueue(ILIST, dad)
                        enqueue(NLIST, add(depth, 1))
                }
                if (mom, mother(me))
                {
                        enqueue(ILIST, mom)
                        enqueue(NLIST, add(depth, 1))
                }
        }
}

proc out_me(me, depth)
{
        "-------------------- " d(depth) " --------------------\n"
        if (dad, father(me))
        {
                call get_sdates(dad)
                call print_name(dad, 1)
                pop(RVAL) col(45) pop(RVAL) "\n"
        }
        else { UNKNOWN "\n"}

        if (mom, mother(me))
        {
                call get_sdates(mom)
                call print_name(mom, 1)
                pop(RVAL) col(45) pop(RVAL) "\n"
        }
        else { UNKNOWN "\n"}

        if (fam, parents(me))
        {
                "  m. " long(marriage(fam)) "\n"

                children( fam, child, nchild)
                {
                        if (eq(me, child)) { ">>>> " } else { "     " }
                        call get_sdates(child)
                        call print_name(child, 1)
                        pop(RVAL) col(50) pop(RVAL) "\n"
                }
        }
        else
        {
                " m.\n"
                ">>>> "
                call get_sdates(me)
                call print_name(me, 1)
                pop(RVAL) col(50) pop(RVAL) "\n"
        }
}

proc print_name (me, last)
{
    call get_title(me)
    push(RVAL, save(concat(fullname(me, 1, not(last), 45), pop(RVAL))))
}

proc get_title (me)
{
    fornodes(inode(me), node)
    {
        if (not(strcmp("TITL", tag(node)))) { set(n, node) }
    }
    if (n) { push(RVAL, save(concat(" ", value(n)))) }
        else { push(RVAL, "") }
}

proc get_sdates (me)
{
    if (e, birth(me)) { set(b, save(concat("( ", short(e)))) }
        else { set(b, "( ") }
    if (e, death(me)) { set(d, save(concat(" - " , short(e)))) }
        else { set(d, " - ") }
    push(RVAL, save(concat(b, concat(d, " )"))))
}

proc get_ldates (me)
{
    if (e, birth(me)) { set(b, save(concat("( ", long(e)))) }
        else { set(b, "( ") }
    if (e, death(me)) { set(d, save(concat(" - " , long(e)))) }
        else { set(d, " - ") }
    push(RVAL, save(concat(b, concat(d, " )"))))
}

proc get_dates (me)
{
    if (e, birth(me)) { set(b, save(concat("( ", date(e)))) }
        else { set(b, "( ") }
    if (e, death(me)) { set(d, save(concat(" - " , date(e)))) }
        else { set(d, " - ") }
    push(RVAL, save(concat(b, concat(d, " )"))))
}