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

« back to all changes in this revision

Viewing changes to reports/htmlfam.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       htmlfam.ll
 
3
 * @version        3
 
4
 * @author         Tom Wetmore (ttw@shore.net)
 
5
 * @category       
 
6
 * @output         HTML
 
7
 * @description
 
8
 *
 
9
 * output family group summaries in HTML format
 
10
 */
 
11
 
 
12
/* third draft -- 12/27/95 -- Tom Wetmore -- ttw@shore.net */
 
13
 
 
14
global(pert)    /* person table */
 
15
global(showf)   /* families that have been shown */
 
16
 
 
17
proc main ()
 
18
{
 
19
        getindi(per0, "Who do you want to start with?")
 
20
        set(fam0, parents(per0))
 
21
        list(perq)
 
22
        list(famq)
 
23
        table(pert)
 
24
        list(lst)
 
25
        insert(pert, save(key(per0)), lst)
 
26
        table(showf)
 
27
 
 
28
        enqueue(perq, per0)
 
29
        while (per, dequeue(perq)) {
 
30
                if (fam, parents(per)) {
 
31
                        if (per, husband(fam)) {
 
32
                                call makelink(per, fam)
 
33
                                enqueue(perq, per)
 
34
                        }
 
35
                        if (per, wife(fam)) {
 
36
                                call makelink(per, fam)
 
37
                                enqueue(perq, per)
 
38
                        }
 
39
                }
 
40
        }
 
41
        call showhead()
 
42
        call showper(per0)
 
43
        enqueue(famq, fam0)
 
44
        while (fam, dequeue(famq)) {
 
45
                if (not(lookup(showf, key(fam)))) {
 
46
                        call showfam(fam)
 
47
                        insert(showf, save(key(fam)), 1)
 
48
                }
 
49
                set(husb, husband(fam))
 
50
                set(wife, wife(fam))
 
51
                if (fam, parents(husb)) { enqueue(famq, fam) }
 
52
                if (fam, parents(wife)) { enqueue(famq, fam) }
 
53
        }
 
54
        call showtail()
 
55
}
 
56
 
 
57
proc makelink (per, fam)
 
58
{
 
59
        if (lst, lookup(pert, key(per))) {
 
60
                call enqueueifnew(lst, key(fam))
 
61
        } else {
 
62
                list(lst)
 
63
                enqueue(lst, save(key(fam)))
 
64
                insert(pert, save(key(per)), lst)
 
65
        }
 
66
}
 
67
 
 
68
proc enqueueifnew (lst, key)
 
69
{
 
70
        forlist (lst, el, num) {
 
71
                if (eqstr(key, el)) { return() }
 
72
        }
 
73
        enqueue(lst, save(key))
 
74
}
 
75
 
 
76
proc showper (per)
 
77
{
 
78
        call showone(per)
 
79
        families(per, fam, sp, num) {
 
80
                call showone(sp)
 
81
                call showmarr(fam)
 
82
                call showchildren(fam)
 
83
        }
 
84
        "<HR>\n"
 
85
}
 
86
 
 
87
proc showfam (fam)
 
88
{
 
89
        "<A NAME=\"" key(fam) "\"></A>\n"
 
90
        call showone(husband(fam))
 
91
        call showone(wife(fam))
 
92
        call showmarr(fam)
 
93
        call showchildren(fam)
 
94
        "<HR>\n"
 
95
}
 
96
 
 
97
proc showone (per)
 
98
{
 
99
        if (not(per)) { return() }
 
100
        "<P><STRONG>"name(per, 0)"</STRONG>\n"
 
101
        if (evt, birth(per)) { "<BR>born "long(evt)"\n" }
 
102
        if (evt, death(per)) { "<BR>died "long(evt)"\n" }
 
103
        set(fam, parents(per))
 
104
        if (par, father(per)) {
 
105
                "<BR>father " call showlink(par, key(fam)) "\n"
 
106
        }
 
107
        if (par, mother(per)) {
 
108
                "<BR>mother " call showlink(par, key(fam)) "\n"
 
109
        }
 
110
}
 
111
 
 
112
proc showmarr (fam)
 
113
{
 
114
        if (evt, marriage(fam)) { "<BR>married "long(evt)"\n" }
 
115
}
 
116
 
 
117
proc showchildren (fam)
 
118
{
 
119
        if (eq(0, nchildren(fam))) { return() }
 
120
        "<P><STRONG>Children</STRONG>\n"
 
121
        children (fam, per, num) {
 
122
                "<BR>" d(num) " " call showchild(per) "\n"
 
123
        }
 
124
}
 
125
 
 
126
proc showlink (per, key) {
 
127
        set(lst, lookup(pert, key(per)))
 
128
        if (lst) { "<A HREF=\"#" key "\">" }
 
129
        name(per, 0)
 
130
        if (lst) { "</A>" }
 
131
        call showevents(per)
 
132
}
 
133
 
 
134
proc showchild (per) {
 
135
        if (lst, lookup(pert, key(per))) {
 
136
                call showlinks(per, lst)
 
137
        } else {
 
138
                name(per, 0)
 
139
                call showevents(per)
 
140
        }
 
141
}
 
142
 
 
143
proc showlinks (per, lst) /* LOOSEEND -- THIS ROUTINE NEEDS MORE */
 
144
{
 
145
        if (eq(0, length(lst))) {
 
146
                call showlink(per, "start")
 
147
        } else {
 
148
                call showlink(per, getel(lst, 1))
 
149
        }
 
150
}
 
151
 
 
152
proc showevents (per)
 
153
{
 
154
        set(evt, birth(per))
 
155
        if (and(evt, year(evt))) { ", b " year(evt) }
 
156
        set(evt, death(per))
 
157
        if (and(evt, year(evt))) { ", d " year(evt) }
 
158
}
 
159
 
 
160
proc showhead () {
 
161
        "<HTML><HEAD><TITLE>Genealogy Page</TITLE></HEAD>\n<BODY>\n"
 
162
        "<A NAME=\"start\"></A>\n"
 
163
}
 
164
 
 
165
proc showtail () {
 
166
        "</BODY></HTML>\n"
 
167
}