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

« back to all changes in this revision

Viewing changes to reports/famrep.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       famrep.ll
 
3
 * @version        6.3
 
4
 * @author         James P. Jones (jjones@nas.nasa.gov)
 
5
 * @category       
 
6
 * @output         nroff
 
7
 * @description    
 
8
 *
 
9
 *   This report program produces a Family Group Sheet for the selected
 
10
 *   individual, with options for generating sheets for married children
 
11
 *   of the individual, and their children, etc.
 
12
 *
 
13
 *   This report works only with the LifeLines Genealogy program
 
14
 *
 
15
 *   version two:    1 Nov 1992
 
16
 *   version three: 28 Mar 1993 bug fixes
 
17
 *   version four:  25 Apr 1993 added sources
 
18
 *   version five:  26 Sep 1993 added multiple indi's, bug fix
 
19
 *   version six:    3 Oct 1993 bug fixes
 
20
 *
 
21
 *   This report program produces a Family Group Sheet for the selected
 
22
 *   individual. User is given the choice of having sheets generated for
 
23
 *   married children of individual, and the children of the children, etc.
 
24
 *   Sources of information are indicated with end-note style
 
25
 *   references. The report produces 'roff output, which I suggest you
 
26
 *   convert to postscript for the highest quality report. Following are
 
27
 *   several examples how to process and print the report (assuming the
 
28
 *   output file name is "fam.out":
 
29
 *
 
30
 *        tbl fam.out | xroff -me -tstdout | ipr -Pim7 -D"jobheader off"
 
31
 *        tbl fam.out | xroff -me -PprinterName
 
32
 *        tbl fam.out | groff -me | your_postscript_printer
 
33
 *        tbl fam.out | troff -me | dpost | lp -dps
 
34
 *
 
35
 *   The data in "compiler" table in main() is initialized with property's
 
36
 *   obtained from the lifelines config file (~/.linesrc on unix else 
 
37
 *   lines.cfg) with values from
 
38
 *   user.fullname
 
39
 *   user.email 
 
40
 *   user.address
 
41
 *   user.phone 
 
42
 */
 
43
 
 
44
global(sourcelist)                      /* list of all sources used */
 
45
global(sourcestr)
 
46
global(compiler)
 
47
global(TRUE)
 
48
global(FALSE)
 
49
global(ONCE)
 
50
 
 
51
proc main ()
 
52
{
 
53
    monthformat(4)
 
54
    dateformat(0)
 
55
    set(TRUE, 1)
 
56
    set(FALSE, 0)
 
57
    set(ONCE, TRUE)
 
58
    list(sourcelist)
 
59
 
 
60
    table(compiler)
 
61
    insert(compiler, "name", getproperty("user.fullname"))
 
62
    insert(compiler, "addr", getproperty("user.address"))
 
63
    insert(compiler, "phone", getproperty("user.phone"))
 
64
    insert(compiler, "email", getproperty("user.email"))
 
65
 
 
66
    set(indi, NULL)
 
67
    while (eq(strcmp(name(indi), NULL), 0)) {
 
68
        getindi(indi)                   /* select individual for report */
 
69
        if (eq(strcmp(name(indi), NULL), 0)) {
 
70
            print("Individual not found in database.")
 
71
            print(nl())
 
72
        }
 
73
    }
 
74
    while (or(lt(ionly,1), gt(ionly,2))) {
 
75
      getintmsg(ionly,"Choose (1) Individual only, (2) + Married Descendents: ")
 
76
    }
 
77
    if (eq(ionly, 2)) {
 
78
        set(sonly,0)
 
79
        while (or(lt(sonly,1), gt(sonly,2))) {
 
80
            getintmsg(sonly,"Choose (1) Select Spouse, (2) All Spouses: ")
 
81
        }
 
82
    }
 
83
    else {
 
84
        set(sonly, 1)
 
85
    }
 
86
    call FGsheet(indi, ionly, sonly)
 
87
    print("Report Done, ")
 
88
}
 
89
 
 
90
/* Select the individual's spouse for the Family Group Sheet.
 
91
 */
 
92
proc FGsheet(indi, ionly, sonly)
 
93
{
 
94
    if (eq(sonly, 1)) {
 
95
        set(i, nspouses(indi))
 
96
        spouses(indi, svar, fvar, no) { /* display spouses */
 
97
            if (gt(i, 1)) {
 
98
                if (gt(no, 7)) {                /* leave space for prompt */
 
99
                    print(nl())
 
100
                    print(nl())
 
101
                    print(nl())
 
102
                    print(nl())
 
103
                }
 
104
                print(d(no))
 
105
                print(". ")
 
106
                print(fullname(svar,TRUE,FALSE,50))
 
107
                print(nl())
 
108
            }
 
109
        }
 
110
        if (gt(i, 1)) {                 /* select a spouse */
 
111
            getintmsg(num, "Choose which spouse for Family Report: ")
 
112
        }
 
113
        else {
 
114
            set(num, 1)
 
115
        }
 
116
        if (lt(i, 1)) {
 
117
            print(name(indi))
 
118
            print(" has no spouse in database...")
 
119
            print(nl())
 
120
        }
 
121
        else {
 
122
            if (eq(ONCE, TRUE)) {
 
123
                ".po 0.8i" nl()
 
124
                ".ll 6.8i" nl()
 
125
                ".pl +1.5i" nl()
 
126
                ".nf" nl()
 
127
 
 
128
                set(ONCE, FALSE)
 
129
            }
 
130
        }
 
131
    }
 
132
    spouses(indi, svar, fvar, no) {
 
133
        if (or(and(eq(sonly,1), eq(no, num)), eq(sonly,2))) {
 
134
            if (eq(strcmp(sex(indi), "F"), 0)) {
 
135
                set(tmp, indi)          /* Check sex of individual,*/
 
136
                set(tindi, svar)        /* if Female, replace with */
 
137
                set(tsvar, tmp)         /* information on husband. */
 
138
                set(i, nspouses(tindi)) /* Easier if assume head-  */
 
139
                set(num, 1)             /* of-household is male... */
 
140
                if (gt(i, 1)) {
 
141
                    spouses(tindi, tmps, tmpf, no) {
 
142
                        if (eq(name(tsvar), name(tmps))) {
 
143
                            set(num, no)
 
144
                        }
 
145
                    }
 
146
                }
 
147
                call doform(tindi, tsvar, fvar, i, num)
 
148
            }
 
149
            else {
 
150
                call doform(indi, svar, fvar, i, num)
 
151
            }
 
152
            call printsources(sourcelist)
 
153
            while (not(empty(sourcelist))) {    /* NULL out sources each time */
 
154
                set(nil, dequeue(sourcelist))
 
155
                set(sourcestr, NULL)
 
156
            }
 
157
            ".bp" nl()
 
158
 
 
159
            if (eq(ionly, 2)) {
 
160
                children(fvar, kid, j) {
 
161
                    if(or(ge(nspouses(kid),1), ge(nfamilies(kid),1))) {
 
162
                        call FGsheet(kid, ionly, 2)
 
163
                    }
 
164
                }
 
165
            }
 
166
        }
 
167
    }
 
168
}
 
169
 
 
170
/* Produce the Family Group Sheet form.
 
171
 */
 
172
proc doform(indi, svar, fvar, numsp, cursp)
 
173
{
 
174
    ".ps 16" nl()
 
175
    ".(b C" nl()
 
176
    if (e, surname(indi)) { upper(surname(indi)) }
 
177
    "\\0FAMILY\\0GROUP\\0SHEET" nl()
 
178
    ".ps 10" nl()
 
179
    "Compiled by: \\fI" lookup(compiler, "name") "\\fR\\0on\\0\\fI"
 
180
    stddate(gettoday())
 
181
    "\\fR" nl()
 
182
    ".vs 10" nl()
 
183
    "\\fI" lookup(compiler, "addr") "\\fR" nl()
 
184
    "\\fIPhone:\\0" lookup(compiler, "phone") "\\0\\0\\0E-mail:\\0"
 
185
    lookup(compiler, "email") "\\fR" nl()
 
186
    ".)b" nl()
 
187
    ".ps 8" nl()
 
188
    ".TS" nl()
 
189
    "tab(+) expand box;" nl()
 
190
    "l s s." nl()
 
191
    "Husband's Full Name:\\0\\fI"
 
192
    if (e, name(indi)) { name(indi) "\\fR" nl() }
 
193
    else { "\\fR" }
 
194
    "_" nl()
 
195
    ".T&" nl()
 
196
    "l | l | l." nl()
 
197
    "Husband's Data+Day Month Year+City,\\0\\0Town or Place\\0\\0County or Province\\0\\0State or Country" nl()
 
198
    "_" nl()
 
199
    "\\0Birth+\\fI"
 
200
    set(aday, birth(indi))
 
201
    if (e, stddate(aday)) { stddate(aday) }
 
202
    "+"
 
203
    if (e, place(aday)) { place(aday) } "\\fR"
 
204
    if (aday) { call dosource(aday) } nl()      /* note: first call to source */
 
205
    "_" nl()
 
206
    "\\0Christened+\\fI"
 
207
    set(aday, baptism(indi))
 
208
    if (e, stddate(aday)) { stddate(aday) }
 
209
    "+"
 
210
    if (e, place(aday)) { place(aday) } "\\fR"
 
211
    if (aday) { call dosource(aday) } nl()
 
212
    "_" nl()
 
213
    "\\0Married+\\fI"
 
214
    set(aday, marriage(fvar))
 
215
    if (e, stddate(aday)) { stddate(aday) }
 
216
    "+"
 
217
    if (e, place(aday)) { place(aday) } "\\fR"
 
218
    if (aday) { call dosource(aday) } nl()
 
219
    "_" nl()
 
220
    "\\0Death+\\fI"
 
221
    set(aday, death(indi))
 
222
    if (e, stddate(aday)) { stddate(aday) }
 
223
    "+"
 
224
    if (e, place(aday)) { place(aday) } "\\fR"
 
225
    if (aday) { call dosource(aday) } nl()
 
226
    "_" nl()
 
227
    "\\0Burial+\\fI"
 
228
    set(aday, burial(indi))
 
229
    if (e, stddate(aday)) { stddate(aday) }
 
230
    "+"
 
231
    if (e, place(aday)) { place(aday) } "\\fR"
 
232
    if (aday) { call dosource(aday) } nl()
 
233
    "_" nl()
 
234
    ".T&" nl()
 
235
    "l | l s." nl()
 
236
    "\\0Father's Name:+\\fI"
 
237
    if (e, name(father(indi))) { name(father(indi)) "\\fR" nl() }
 
238
    else { "\\fR" nl() }
 
239
    "_" nl()
 
240
    "\\0Mother's Maiden Name:+\\fI"
 
241
    if (e, name(mother(indi))) { name(mother(indi)) "\\fR" nl() }
 
242
    else { "\\fR" nl() }
 
243
    "_" nl()
 
244
    "\\0Other Wives:\\fI"
 
245
    set(f, 0)
 
246
    set(spstr, save(name(wife(fvar))))
 
247
    spouses(indi, wifenm, tmpfvar, no) {
 
248
        set(wstr, save(name(wifenm)))
 
249
        if (ne(strcmp(spstr, wstr), 0)) {
 
250
            "\\fI+"
 
251
            name(wifenm)
 
252
            "\\fR" nl()
 
253
            set(f,1)
 
254
        }
 
255
    }
 
256
    if (eq(f, 0)) { "\\fR" nl() }
 
257
    "_" nl()
 
258
    ".TE" nl()
 
259
    ".TS" nl()
 
260
    "tab(+) expand box;" nl()
 
261
    "l s s." nl()
 
262
    "Wife's Full Maiden Name:\\0\\fI"
 
263
    if (e, name(svar)) { name(svar) }
 
264
    "\\fR" nl()
 
265
    "_" nl()
 
266
    ".T&" nl()
 
267
    "l | l | l." nl()
 
268
    "Wife's Data   +Day Month Year+City,\\0\\0Town or Place\\0\\0County or Province\\0\\0State or Country" nl()
 
269
    "_" nl()
 
270
    "\\0Birth+\\fI"
 
271
    set(aday, birth(svar))
 
272
    if (e, stddate(aday)) { stddate(aday) }
 
273
    "+"
 
274
    if (e, place(aday)) { place(aday) } "\\fR"
 
275
    if (aday) { call dosource(aday) } nl()
 
276
    "_" nl()
 
277
    "\\0Christened+\\fI"
 
278
    set(aday, baptism(svar))
 
279
    if (e, stddate(aday)) { stddate(aday) }
 
280
    "+"
 
281
    if (e, place(aday)) { place(aday) } "\\fR"
 
282
    if (aday) { call dosource(aday) } nl()
 
283
    "_" nl()
 
284
    "\\0Death+\\fI"
 
285
    set(aday, death(svar))
 
286
    if (e, stddate(aday)) { stddate(aday) }
 
287
    "+"
 
288
    if (e, place(aday)) { place(aday) } "\\fR"
 
289
    if (aday) { call dosource(aday) } nl()
 
290
    "_" nl()
 
291
    "\\0Burial+\\fI"
 
292
    set(aday, burial(svar))
 
293
    if (e, stddate(aday)) { stddate(aday) }
 
294
    "+"
 
295
    if (e, place(aday)) { place(aday) } "\\fR"
 
296
    if (aday) { call dosource(aday) } nl()
 
297
    "_" nl()
 
298
    ".T&" nl()
 
299
    "l | l s." nl()
 
300
    "\\0Father's Name:+\\fI"
 
301
    if (e, name(father(svar))) { name(father(svar)) "\\fR" nl() }
 
302
    else { "\\fR" nl() }
 
303
    "_" nl()
 
304
    "\\0Mother's Maiden Name:+\\fI"
 
305
    if (e, name(mother(svar))) { name(mother(svar)) "\\fR" nl() }
 
306
    else { "\\fR" nl() }
 
307
    "_" nl()
 
308
    "\\0Other Husbands:\\fI"
 
309
    set(f, 0)
 
310
    set(spstr, save(name(indi)))
 
311
    spouses(svar, hubby, tmpfvar, no) {
 
312
        set(hstr, save(name(hubby)))
 
313
        if (ne(strcmp(spstr, hstr), 0)) {
 
314
            "\\fI+"
 
315
            name(hubby)
 
316
            "\\fR" nl()
 
317
            set(f,1)
 
318
        }
 
319
    }
 
320
    if (eq(f, 0)) { "\\fR" nl() }
 
321
    "_" nl()
 
322
    ".TE" nl()
 
323
                                                /* now for the children... */
 
324
    set(haschild, 1)
 
325
    children(fvar, cvar, no) {
 
326
        if (eq(haschild, 1)) {
 
327
            ".TS" nl()
 
328
            "tab(+) expand box;" nl()
 
329
            "l |l| l | l | l." nl()
 
330
            "Complete Names of All Children+Sex+Event+Date+"
 
331
            "City, Town, County, State or Country" nl()
 
332
            "_" nl()
 
333
            set(haschild, 2)
 
334
        }
 
335
 
 
336
        if (or(eq(no, 4), eq(no, 12))) {        /* If 4th or 12th kid, start  */
 
337
            ".TE" nl()                          /* a new page. There was an   */
 
338
            ".bp" nl()                          /* old woman, who lived in a  */
 
339
            ".TS" nl()                       /* shoe, she had so many kids... */
 
340
            "tab(+) expand box;" nl()
 
341
            "l |l| l | l | l." nl()
 
342
            "Complete Names of All Children+Sex+Event+Date+"
 
343
            "City, Town, County/Province, State, Country" nl()
 
344
            "_" nl()
 
345
        }
 
346
        "T{" nl()
 
347
        "\\fI("
 
348
        d(no)
 
349
        ") "
 
350
        if (e, name(cvar)) { name(cvar) }
 
351
        "\\fR" nl()
 
352
        "T}+\\fI"
 
353
        sex(cvar)
 
354
        "\\fR+Birth+\\fI"
 
355
        set(aday, birth(cvar))
 
356
        if (e, stddate(aday)) { stddate(aday) }
 
357
        "+"
 
358
        if (e, place(aday)) { place(aday) } "\\fR"
 
359
        if (aday) { call dosource(aday) } nl()
 
360
        "_" nl()
 
361
        "\\^+\\^+Death+\\fI"
 
362
        set(aday, death(cvar))
 
363
        if (e, stddate(aday)) { stddate(aday) }
 
364
        "+"
 
365
        if (e, place(aday)) { place(aday) } "\\fR"
 
366
        if (aday) { call dosource(aday) } nl()
 
367
        "_" nl()
 
368
        "\\^+\\^+Burial+\\fI"
 
369
        set(aday, burial(cvar))
 
370
        if (e, stddate(aday)) { stddate(aday) }
 
371
        "+"
 
372
        if (e, place(aday)) { place(aday) } "\\fR"
 
373
        if (aday) { call dosource(aday) } nl()
 
374
 
 
375
        families(cvar, cfvar, csvar, no) {              /* spouses */
 
376
            "_" nl()
 
377
            "\\^+\\^+Marriage+\\fI"
 
378
            set(aday, marriage(cfvar))
 
379
            if (e, stddate(aday)) { stddate(aday) }
 
380
            "+"
 
381
            if (e, name(csvar)) { name(csvar) }
 
382
            if (aday) { call dosource(aday) }
 
383
            "\\fR" nl()
 
384
        }
 
385
        "=" nl()
 
386
    }
 
387
    if (eq(haschild, 2)) {
 
388
        ".TE" nl()
 
389
    }
 
390
}
 
391
 
 
392
 
 
393
/* Short macro procedure to combine SOURCE and SOURCENUM calls, to shorten
 
394
 * above report code.
 
395
 */
 
396
proc dosource(eventnode)
 
397
{
 
398
    call source(eventnode)              /* get source of data */
 
399
    if (sourcestr) {                    /* if source not NULL */
 
400
        call sourcenum()                /* print source number */
 
401
    }
 
402
}
 
403
 
 
404
/* Retrieve source from a given event (EVENTNODE), and save it in the global
 
405
 * string SOURCESTR.
 
406
 */
 
407
proc source(eventnode)
 
408
{
 
409
    set(sourcestr, NULL)
 
410
    traverse(eventnode, node, lev) {
 
411
       if (eq(strcmp(tag(node), "SOUR"), 0)) {
 
412
           set(sourcestr, value(node))
 
413
       }
 
414
    }
 
415
}
 
416
 
 
417
/* Create a "List of Sources" table for the report; in the report itself,
 
418
 * print only a footnote number, and later the list these number refer to
 
419
 * can be printed (via PRINTSOURCES).
 
420
 */
 
421
proc sourcenum()
 
422
{
 
423
    set(found,0)
 
424
    forlist(sourcelist, item, i) {
 
425
        set(numsources,i)
 
426
        if (eq(strcmp(item, sourcestr), 0)) {   /* if source in list */
 
427
            " \\s7(" d(i) ")\\s8"               /* print out source index */
 
428
            set(found, 1)
 
429
        }
 
430
    }
 
431
    if (not(eq(found, 1))) {
 
432
        push(sourcelist, sourcestr)             /* otherwise add it to list */
 
433
        " \\s7(" d(add(numsources,i,1)) ")\\s8" /* and print source index */
 
434
    }
 
435
}
 
436
 
 
437
/* Print a list of all the sources refered to in the document. The numbers
 
438
 * preceeding each source entry are what the in-line references refer to.
 
439
 */
 
440
proc printsources(slist)
 
441
{
 
442
    if (not(empty(slist))) {
 
443
        ".(b C" nl()
 
444
        "LIST OF SOURCES REFERENCED IN THIS REPORT" nl()
 
445
        ".)b" nl()
 
446
        forlist(slist, item, i) {
 
447
            "(" d(i) ")  " item nl()
 
448
        }
 
449
    }
 
450
}
 
451
 
 
452
/* End of Report
 
453
 */