~ubuntu-branches/ubuntu/trusty/lifelines/trusty

« back to all changes in this revision

Viewing changes to reports/dump-ances.ll

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Augusto van de Wiel (faw)
  • Date: 2007-05-23 23:49:53 UTC
  • mfrom: (3.1.3 edgy)
  • Revision ID: james.westby@ubuntu.com-20070523234953-ogno9rnbmth61i7p
Tags: 3.0.50-2etch1
* Changing docs/ll-reportmanual.xml and docs/ll-userguide.xml to fix
  documentation build problems (Closes: #418347).

* lifelines-reports
  - Adding a dependency to lifelines >= 3.0.50 to prevent file conflict.
    (Closes: #405500).

* Updating French translation. Thanks to Bernard Adrian. (Closes: #356671).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * @progname    dump-ances.ll
 
3
 * @version     1992-11
 
4
 * @author      Stephen Woodbridge
 
5
 * @category
 
6
 * @output      Text, 80 cols
 
7
 * @description
 
8
 *
 
9
 *      Program walks thru one's ancestors and dumps information
 
10
 *      about each family. It prunes the tree so an individual is
 
11
 *      only output once. It is a simple program that is easy to
 
12
 *      make changes to, if you want more or less info printed. I
 
13
 *      have included three date routines get_dates(), get_sdates(),
 
14
 *      and get_ldates for variations in the amount of event info that
 
15
 *      gets output to the file. The program lists all children of the
 
16
 *      families as it walks the tree. The ">>>>" marker on a child
 
17
 *      signifies the line of descent.
 
18
 *
 
19
 *      Writen by Stephen Woodbridge, Nov 1992
 
20
 */
 
21
global(UNKNOWN)
 
22
global(DONE)
 
23
global(ILIST)
 
24
global(NLIST)
 
25
global(RVAL)
 
26
 
 
27
proc main()
 
28
{
 
29
        table(DONE)
 
30
        list(ILIST)
 
31
        list(NLIST)
 
32
        list(RVAL)
 
33
        set(UNKNOWN, "____?____")
 
34
 
 
35
        getindi(me)
 
36
        getintmsg(max, " Maximum Depth :")
 
37
        enqueue(ILIST, me)
 
38
        enqueue(NLIST, 1)
 
39
        set(i, 1)
 
40
        while (me, dequeue(ILIST))
 
41
        {
 
42
                set(depth, dequeue(NLIST))
 
43
                if (not(lookup(DONE, key(me))))
 
44
                {
 
45
                        call do_me(me, depth, max)
 
46
                }
 
47
        }
 
48
}
 
49
 
 
50
proc do_me(me, depth, max)
 
51
{
 
52
        call out_me(me, depth)
 
53
        insert(DONE, save(key(me)), 1)
 
54
        if (le(add(depth, 1), max))
 
55
        {
 
56
                if (dad, father(me))
 
57
                {
 
58
                        enqueue(ILIST, dad)
 
59
                        enqueue(NLIST, add(depth, 1))
 
60
                }
 
61
                if (mom, mother(me))
 
62
                {
 
63
                        enqueue(ILIST, mom)
 
64
                        enqueue(NLIST, add(depth, 1))
 
65
                }
 
66
        }
 
67
}
 
68
 
 
69
proc out_me(me, depth)
 
70
{
 
71
        "-------------------- " d(depth) " --------------------\n"
 
72
        if (dad, father(me))
 
73
        {
 
74
                call get_sdates(dad)
 
75
                call print_name(dad, 1)
 
76
                pop(RVAL) col(45) pop(RVAL) "\n"
 
77
        }
 
78
        else { UNKNOWN "\n"}
 
79
 
 
80
        if (mom, mother(me))
 
81
        {
 
82
                call get_sdates(mom)
 
83
                call print_name(mom, 1)
 
84
                pop(RVAL) col(45) pop(RVAL) "\n"
 
85
        }
 
86
        else { UNKNOWN "\n"}
 
87
 
 
88
        if (fam, parents(me))
 
89
        {
 
90
                "  m. " long(marriage(fam)) "\n"
 
91
 
 
92
                children( fam, child, nchild)
 
93
                {
 
94
                        if (eq(me, child)) { ">>>> " } else { "     " }
 
95
                        call get_sdates(child)
 
96
                        call print_name(child, 1)
 
97
                        pop(RVAL) col(50) pop(RVAL) "\n"
 
98
                }
 
99
        }
 
100
        else
 
101
        {
 
102
                " m.\n"
 
103
                ">>>> "
 
104
                call get_sdates(me)
 
105
                call print_name(me, 1)
 
106
                pop(RVAL) col(50) pop(RVAL) "\n"
 
107
        }
 
108
}
 
109
 
 
110
proc print_name (me, last)
 
111
{
 
112
    call get_title(me)
 
113
    push(RVAL, save(concat(fullname(me, 1, not(last), 45), pop(RVAL))))
 
114
}
 
115
 
 
116
proc get_title (me)
 
117
{
 
118
    fornodes(inode(me), node)
 
119
    {
 
120
        if (not(strcmp("TITL", tag(node)))) { set(n, node) }
 
121
    }
 
122
    if (n) { push(RVAL, save(concat(" ", value(n)))) }
 
123
        else { push(RVAL, "") }
 
124
}
 
125
 
 
126
proc get_sdates (me)
 
127
{
 
128
    if (e, birth(me)) { set(b, save(concat("( ", short(e)))) }
 
129
        else { set(b, "( ") }
 
130
    if (e, death(me)) { set(d, save(concat(" - " , short(e)))) }
 
131
        else { set(d, " - ") }
 
132
    push(RVAL, save(concat(b, concat(d, " )"))))
 
133
}
 
134
 
 
135
proc get_ldates (me)
 
136
{
 
137
    if (e, birth(me)) { set(b, save(concat("( ", long(e)))) }
 
138
        else { set(b, "( ") }
 
139
    if (e, death(me)) { set(d, save(concat(" - " , long(e)))) }
 
140
        else { set(d, " - ") }
 
141
    push(RVAL, save(concat(b, concat(d, " )"))))
 
142
}
 
143
 
 
144
proc get_dates (me)
 
145
{
 
146
    if (e, birth(me)) { set(b, save(concat("( ", date(e)))) }
 
147
        else { set(b, "( ") }
 
148
    if (e, death(me)) { set(d, save(concat(" - " , date(e)))) }
 
149
        else { set(d, " - ") }
 
150
    push(RVAL, save(concat(b, concat(d, " )"))))
 
151
}
 
152