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

« back to all changes in this revision

Viewing changes to reports/timeline2.ll

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Augusto van de Wiel (faw)
  • Date: 2007-08-14 00:02:04 UTC
  • mfrom: (1.1.4 upstream) (3.1.4 gutsy)
  • Revision ID: james.westby@ubuntu.com-20070814000204-mpv5faygl0dgq3qi
Tags: 3.0.61-1
* New upstream release. (Closes: #387856).
* Fixing documentation build problems also fixes FTBFS if built twice in a
  row. (Closes: #424543).
* Adding lynx as a build dependency. This is necessary to generate txt files
  from html, discovered while fixing #424543.
* Upstream fix: charset for gedcom file in unicode. (Closes: #396206).
* Upstream fim: updating documentation about desc-tex2. (Closes: #405501).
* Bumping Standards-Version to 3.7.2 without package changes.
* Dropping local debian patches added upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * @progname       timeline2.ll
3
 
 * @version        2.0
4
 
 * @author         Jones
5
 
 * @category       
6
 
 * @output         Text, 80/132 cols
7
 
 * @description    
8
 
 *
9
 
 *   This report creates one of the following timeline charts:
10
 
 *      1. Ascii timeline graph showing birth, marriage, and death events of
11
 
 *         selected individuals; shows which individuals were contemporaies.
12
 
 *      2. Ascii timeline chart data with the above information for use with
13
 
 *         the my timeline generation program or the today program.
14
 
 *
15
 
 *   timeline2 - create a timeline of select individuals
16
 
 *
17
 
 *   version one:  4 Sept 1993
18
 
 *   version two:  9 Sept 1993
19
 
 *
20
 
 *   Code by James P. Jones, jjones@nas.nasa.gov
21
 
 *
22
 
 *       Contains code from:
23
 
 *       "famrep4"  - By yours truly, jjones@nas.nasa.gov
24
 
 *       "tree1"    - By yours truly, jjones@nas.nasa.gov
25
 
 *
26
 
 *   This report works only with the LifeLines Genealogy program.
27
 
 *
28
 
 *   This report creates one of the following timeline charts:
29
 
 *
30
 
 *      1. Ascii timeline graph showing birth, marriage, and death events of
31
 
 *         selected individuals; shows which individuals were contemporaies.
32
 
 *
33
 
 *      2. Ascii timeline chart data with the above information for use with
34
 
 *         the my timeline generation program or the today program.
35
 
 *
36
 
 *      3. IN PROGRESS (postscript version of #1 above)
37
 
 *
38
 
 *   User selects individual to base the chart on; then selects from
39
 
 *   the following sets:
40
 
 *
41
 
 *              parents,
42
 
 *              children,
43
 
 *              spouses,
44
 
 *              ancestors,
45
 
 *              descendents,
46
 
 *              everyone
47
 
 *
48
 
 *   User selects start date (e.g. 1852) and end date for graph; graph size
49
 
 *   (80 or 132 col); and various options regarding who to display.
50
 
 *
51
 
 *   Note: If an indi is "alive" for more than MAXAGE years, this is flagged as
52
 
 *   "uncertain" with a question mark in graph after MAXAGE years from birth.
53
 
 *   One should check these individuals to determine where they are really
54
 
 *   that old, or if one can determine an approxmate date of death, etc.
55
 
 *
56
 
 *   Additional functionality will be added as soon as LL version 2.3.5
57
 
 *   is released. See comments below for details.
58
 
 *
59
 
 *   Sample output (#1 above) follows (start=1800; end=2000; 80 col; sort by
60
 
 *   name; show people with dates only):
61
 
 
62
 
         Name           1800 1820 1840 1860 1880 1900 1920 1940 1960 1980 2000
63
 
________________________|____|____|____|____|____|____|____|____|____|____|
64
 
AUSTIN, George W        |                    B****M************D
65
 
AUSTIN, Velma Cleo      |                              B***M*M**M**M***M*
66
 
BLAKE, Nancy Elizabeth  |              B****M***********D
67
 
HEFLIN, Wyatt           |**************D
68
 
HUNTER, Rebecca A.      |     B****M************D
69
 
JONES, Arvel Fred Jr.   |                                  B******M******
70
 
JONES, Arvel Fred Sr.   |                          B****M*************D
71
 
JONES, Charles Columbus |                  B*******************D
72
 
JONES, Sarah Frances    |                  B*****D
73
 
JONES, Wesley           |            B************************?
74
 
JORDAN, Mary Cardine    |             B****D
75
 
PHIPPEN, Rose Marie     |                                    B****M***M**
76
 
WILDE, Charles          |      B************************?
77
 
____, Sarah A           |********************?
78
 
 
79
 
Scale: 1 point = 4 years
80
 
Key: B=birthdate, M=marriage, D=deathdate, *=living, ?=uncertainity
81
 
 
82
 
 *
83
 
 *   Output from #1 can be sorted using the sort(1) command, for example, the
84
 
 *   following command will sort the above output by birthdate:
85
 
 *
86
 
 *              sort -t\| +1 filename
87
 
 *
88
 
 *   where FILENAME is a file contain the above sample data, would produce:
89
 
 
90
 
PHIPPEN, Rose Marie     |                                    B****M***M**
91
 
JONES, Arvel Fred Jr.   |                                  B******M******
92
 
AUSTIN, Velma Cleo      |                              B***M*M**M**M***M*
93
 
JONES, Arvel Fred Sr.   |                          B****M*************D
94
 
AUSTIN, George W        |                    B****M************D
95
 
JONES, Charles Columbus |                  B*******************D
96
 
JONES, Sarah Frances    |                  B*****D
97
 
BLAKE, Nancy Elizabeth  |              B****M***********D
98
 
JORDAN, Mary Cardine    |             B****D
99
 
JONES, Wesley           |            B************************?
100
 
WILDE, Charles          |      B************************?
101
 
HUNTER, Rebecca A.      |     B****M************D
102
 
____, Sarah A           |********************?
103
 
HEFLIN, Wyatt           |**************D
104
 
 
105
 
 *
106
 
 *
107
 
 */
108
 
 
109
 
/*
110
 
 * timeline
111
 
 */
112
 
 
113
 
global(startdate)
114
 
global(enddate)
115
 
global(curyear)
116
 
global(linnum)
117
 
global(linpos)
118
 
global(offset)
119
 
global(years)
120
 
global(scale)
121
 
global(count)
122
 
global(indnum)
123
 
global(showall)
124
 
global(MAXYEAR)
125
 
global(MAXAGE)
126
 
 
127
 
proc main ()
128
 
{
129
 
        set(MAXYEAR, 2020)   /* the distant future */
130
 
        set(MAXAGE, 90)      /* if birth/death dates unknown, guess age */
131
 
        set(indnum,0)
132
 
        set(startdate, 0)
133
 
        set(enddate, 0)
134
 
        set(linnum, 1)
135
 
        set(linpos, 1)
136
 
        list(plist)
137
 
        while (eq(indi, NULL)) {
138
 
            getindi(indi)
139
 
        }
140
 
        while (and(ne(gra,1), ne(gra,2))) {
141
 
                getintmsg(gra,"Select timeline (1) graph, (2) chart:")
142
 
        }
143
 
        set(valid,0)
144
 
        while (eq(valid,0)) {
145
 
            print("Graph (1) parents, (2) children, (3) spouses")
146
 
            print(nl())
147
 
            print("      (4) ancestors, (5) descendents, (6) everyone")
148
 
            print(nl())
149
 
            getintmsg(ltype,"Choose subset of individuals: ")
150
 
            if (and(ge(ltype,1), le(ltype,6))) {
151
 
                set (valid, 1)
152
 
            }
153
 
        }
154
 
        while (and(ne(showall,1), ne(showall,2))) {
155
 
            getintmsg(showall,"Include people without dates (1) no, (2) yes: ")
156
 
        }
157
 
        if (eq(gra,1)) {
158
 
            pagemode(1, 200)
159
 
            set(startdate,0)
160
 
            set(enddate,0)
161
 
            while(le(enddate, startdate)) {
162
 
                set(startdate,0)
163
 
                set(enddate,0)
164
 
                while (or(le(startdate,0),gt(startdate,MAXYEAR))) {
165
 
                  getintmsg(startdate,"Enter start date for graph, e.g. 1800: ")
166
 
                }
167
 
                while (or(le(enddate,0),gt(startdate,MAXYEAR))) {
168
 
                    getintmsg(enddate, "Enter end date for graph, e.g. 1950: ")
169
 
                }
170
 
                if (le(enddate, startdate)) {
171
 
                        print("End date exceeds start date. Re-enter dates.")
172
 
                        print(nl())
173
 
                }
174
 
            }
175
 
            while (and(ne(size,1), ne(size,2))) {
176
 
                getintmsg(size,"Select graph size (1) 80 col, (2) 132 col: ")
177
 
            }
178
 
            while (and(ne(order,1), ne(order,2))) {
179
 
                getintmsg(order,"Order by (1) family group, (2) last name: ")
180
 
            }
181
 
            if (eq(size, 1)) {
182
 
                set(offset, sub(80, 26))
183
 
            }
184
 
            else {
185
 
                set(offset, sub(130, 26))
186
 
            }
187
 
            set(years, sub(enddate, startdate))
188
 
 
189
 
            set(scale, div(years, offset))
190
 
            if (gt(mod(years, offset), 0)) {
191
 
                set(scale, add(scale, 1))
192
 
            }
193
 
            if (le(scale, 0)) {
194
 
                set(scale, 1)
195
 
            }
196
 
 
197
 
            print("Scale: 1 point = ")
198
 
            print(d(scale))
199
 
            print(" years")
200
 
 
201
 
            call datelin()
202
 
            pageout()
203
 
 
204
 
            call header()
205
 
            pageout()
206
 
        }
207
 
 
208
 
        indiset(idx)
209
 
        addtoset(idx,indi,n)
210
 
 
211
 
        if (eq(ltype, 1)) {
212
 
            set(idx, parentset(idx))
213
 
            addtoset(idx,indi,n)
214
 
        }
215
 
        if (eq(ltype, 2)) {
216
 
            set(idx, childset(idx))
217
 
            addtoset(idx,indi,n)
218
 
        }
219
 
        if (eq(ltype, 3)) {
220
 
            set(idx, spouseset(idx))
221
 
            addtoset(idx,indi,n)
222
 
        }
223
 
        /* this will work in LL version 2.3.5 ...
224
 
        if (eq(ltype, 4)) {
225
 
            set(idx, siblingset(idx))
226
 
            addtoset(idx,indi,n)
227
 
        }*/
228
 
        if (eq(ltype, 4)) {
229
 
            set(idx, ancestorset(idx))
230
 
            addtoset(idx,indi,n)
231
 
        }
232
 
        if (eq(ltype, 5)) {
233
 
            set(idx, descendentset(idx))
234
 
            addtoset(idx,indi,n)
235
 
        }
236
 
        if (eq(ltype, 6)) {
237
 
            forindi(indiv,n) {
238
 
                    addtoset(idx,indiv,n)
239
 
            }
240
 
        }
241
 
        if (eq(gra,1)) {
242
 
            /* this will work in LL version 2.3.5 ...
243
 
            if (eq(lengthset(idx), 0)) {
244
 
                print("This set contains no individuals, please try again.")
245
 
                print(" ")
246
 
            }
247
 
            else {
248
 
            */
249
 
                if (eq(order, 2)) {
250
 
                        namesort(idx)
251
 
                }
252
 
                forindiset(idx,indiv,v,n) {
253
 
                        set(indnum, add(indnum,1))
254
 
                        call graph(indiv) /* outputs a 1 line "page" for each */
255
 
                }
256
 
                linemode()
257
 
                call printkey()
258
 
 
259
 
            /*}*/
260
 
        }
261
 
        else {
262
 
                linemode()
263
 
                forindiset(idx,indiv,v,n) {
264
 
                        call timeline(indiv)
265
 
                }
266
 
        }
267
 
}
268
 
 
269
 
proc datelin()
270
 
{
271
 
        set(linpos, 10)
272
 
        pos(linnum, linpos)
273
 
        "Name"
274
 
        set(linpos, 25)
275
 
        set(count, mul(scale, 5))
276
 
        set(curyear, sub(startdate, mod(startdate, count)))
277
 
        while (le(curyear, enddate)) {
278
 
                pos(linnum, linpos)
279
 
                d(curyear)
280
 
                set(curyear, add(curyear,count))
281
 
                set(linpos, add(linpos, 5))
282
 
        }
283
 
        set(curyear, sub(curyear,count))
284
 
}
285
 
 
286
 
proc header()
287
 
{
288
 
        set(tmpyear, sub(startdate, mod(startdate, count)))
289
 
        pos(linnum, 1)
290
 
        "________________________"
291
 
        set(linpos, 25)
292
 
        set(i, 25)
293
 
        while (le(tmpyear, curyear)) {
294
 
                set(j, 0)
295
 
                while (lt(j, count)) {
296
 
                        pos(linnum, linpos)
297
 
                        if (or(eq(i, 25), eq(mod(i, 5),0))) { "|" }
298
 
                        else {
299
 
                                if (lt(tmpyear, curyear)) { "_" }
300
 
                        }
301
 
                        set(j, add(j,scale))
302
 
                        set(linpos, add(linpos, 1))
303
 
                        set(i, add(i,scale))
304
 
                }
305
 
                set(tmpyear, add(tmpyear,count))
306
 
        }
307
 
}
308
 
 
309
 
proc graph(indi)
310
 
{
311
 
        set(NOINFO, 0)
312
 
        set(showit, 0)
313
 
        set(linnum, 1)
314
 
        set(linpos, 1)
315
 
        pos(linnum, linpos)
316
 
 
317
 
        if (eq(mod(indnum,10),0)) { print(".") }
318
 
 
319
 
        /* birth event */
320
 
        set(start, strtoint(year(birth(indi))))
321
 
        if (eq(start, 0)) {
322
 
                set(start, strtoint(year(baptism(indi))))
323
 
        }
324
 
 
325
 
        /* marriage event(s) */
326
 
        list(mlist)
327
 
        spouses(indi, svar, fvar, no) {
328
 
                set(tdate, strtoint(year(marriage(fvar))))
329
 
                if (ne(tdate,0)) {
330
 
                        enqueue(mlist, tdate)
331
 
                }
332
 
        }
333
 
        set(myear, dequeue(mlist))
334
 
 
335
 
        /* death event */
336
 
        set(end, strtoint(year(death(indi))))
337
 
        if (eq(end, 0)) {
338
 
                set(end, strtoint(year(burial(indi))))
339
 
        }
340
 
 
341
 
 
342
 
        /* do we have enough info to continue? */
343
 
        set(Bunknown, 0)
344
 
        set(Dunknown, 0)
345
 
        if (and(eq(start, 0),eq(end, 0))) { set(NOINFO,1) }
346
 
        else {
347
 
                if (eq(start, 0)) {
348
 
                        set(start,sub(end, MAXAGE))
349
 
                        set(Bunknown, 1)
350
 
                }
351
 
                if (eq(end, 0)) {
352
 
                        set(end, add(start, MAXAGE))
353
 
                        set(Dunknown, 1)
354
 
                }
355
 
        }
356
 
 
357
 
        if (or(eq(showall,2),eq(NOINFO,0))) {
358
 
            fullname(indi, 1, 0, 24)
359
 
            set(linpos, 25)
360
 
        }
361
 
        if (eq(NOINFO, 0)) {
362
 
 
363
 
            set(year, startdate)
364
 
            set(loop, 1)
365
 
            set(thisyear, strtoint(year(gettoday())))
366
 
            if (le(thisyear, enddate)) {
367
 
                set(stopdate, thisyear)
368
 
            }
369
 
            else { set(stopdate, enddate) }
370
 
            set(last, 0)
371
 
            while (le(year, stopdate)) {
372
 
                pos(linnum, linpos)
373
 
                if (lt(year, start)) {
374
 
                        if (eq(last,0)) { " " }
375
 
                }
376
 
                if (gt(year, end)) {
377
 
                        if (eq(last,0)) { " " }
378
 
                }
379
 
                if (eq(year, start)) {
380
 
                        if (eq(Bunknown,1)) { "?" }
381
 
                        else { "B" }
382
 
                        set(last, 1)
383
 
                }
384
 
                if (eq(year, end)) {
385
 
                        if (eq(Dunknown,1)) { "?" }
386
 
                        else { "D" }
387
 
                        set(last, 1)
388
 
                }
389
 
                if (and(gt(year, start), le(year, end))) {
390
 
                        if (eq(year, myear)) {
391
 
                                "M"
392
 
                                set(last, 1)
393
 
                                set(myear, dequeue(mlist))
394
 
                        }
395
 
                }
396
 
                if (and(gt(year, start), lt(year, end))) {
397
 
                    if (eq(last,0)) { "*" }
398
 
                }
399
 
 
400
 
                set(year, add(year, 1))
401
 
                if (eq(loop, scale)) {
402
 
                        set(loop, 1)
403
 
                        set(last, 0)
404
 
                        set(linpos, add(linpos, 1))
405
 
                }
406
 
                else {
407
 
                        set(loop, add(loop, 1))
408
 
                }
409
 
            }
410
 
            set(showit, 1)
411
 
        }
412
 
        if (or(eq(showall,2),eq(showit,1))) {
413
 
            set(linpos, 25)
414
 
            pos(linnum,linpos)
415
 
            "|"
416
 
            pageout()
417
 
        }
418
 
}
419
 
 
420
 
proc printkey()
421
 
{
422
 
        nl()
423
 
        "Scale: 1 point = " d(scale)
424
 
        if (eq(scale,1)) { " year" }
425
 
        else { " years" }
426
 
        nl()
427
 
        "Key: B=birthdate, M=marriage, D=deathdate, *=living, ?=uncertainity"
428
 
        nl()
429
 
}
430
 
 
431
 
 
432
 
proc timeline(indi)
433
 
{
434
 
        dayformat(1)
435
 
        monthformat(1)
436
 
        dateformat(6)
437
 
 
438
 
        set(tdate, date(birth(indi)))
439
 
        if (strcmp(tdate,NULL)) {
440
 
                "B" stddate(birth(indi)) " " name(indi) nl()
441
 
        }
442
 
        set(tdate, date(baptism(indi)))
443
 
        if (strcmp(tdate,NULL)) {
444
 
                "C" stddate(baptism(indi)) " " name(indi) nl()
445
 
        }
446
 
 
447
 
 
448
 
        spouses(indi, svar, fvar, no) {
449
 
                set(tdate, date(marriage(fvar)))
450
 
                if (strcmp(tdate,NULL)) {
451
 
                        "M" stddate(marriage(fvar)) " "
452
 
                        if (eq(strcmp(sex(indi), "M"),0)) {
453
 
                                name(indi) " to " name(svar) nl()
454
 
                        }
455
 
                        else {
456
 
                                name(svar) " to " name(indi) nl()
457
 
                        }
458
 
                }
459
 
        }
460
 
 
461
 
        set(tdate, date(death(indi)))
462
 
        if (strcmp(tdate,NULL)) {
463
 
                "D" stddate(death(indi)) " " name(indi) nl()
464
 
        }
465
 
        set(tdate, date(burial(indi)))
466
 
        if (strcmp(tdate,NULL)) {
467
 
                "F" stddate(burial(indi)) " " name(indi) nl()
468
 
        }
469
 
}