Debian Codegraph @

reports/tinytafel1.ll

raw
1 /*
2 * @progname tinytafel1.ll
3 * @version 3.1
4 * @author Wetmore, Eggert, Chandler
5 * @category
6 * @output TinyTafel
7 * @description
8
9 This report will produce a tinytafel report on a person.
10
11 tinytafel1
12
13 Based on tinytafel1 by Tom Wetmore, [email protected]
14
15 Version 1, 1991, by Tom Wetmore.
16 Version 2, 11 Jan 1993, by Jim Eggert, [email protected],
17 added header, trailer, sorting, date fixing,
18 and default moderate interest. Modified
19 empty surname recognition.
20 Version 3, Jan 1994, J. F. Chandler, fixed count, enhanced date/place guessing.
21 Version 3.1 Mark guessed places with "?"
22
23 This report will produce a tinytafel report on a person.
24
25 Output is an ASCII file. It should be edited to translate any
26 non-ASCII characters, to shorten long place names (to 14-16
27 characters), and to indicate interest level after each year:
28 [space] No interest (level 0)
29 . Low interest (level 1)
30 : Moderate interest (level 2) (default)
31 * Highest interest (level 3)
32
33 You will want to modify the write_tafel_header() procedure to
34 include your name, address, etc.
35
36 Empty surnames or those starting with "_" or " " will not
37 be written to the report.
38
39 See the end of this report for an example of a tinytafel report.
40 */
41
42 global(tafelset)
43 global(fdatelist)
44 global(ldatelist)
45 global(fplacelist)
46 global(lplacelist)
47 global(line_count)
48
49 global(fdate)
50 global(ldate)
51 global(pdate)
52 global(fplace)
53 global(lplace)
54 global(pplace)
55 global(sname)
56 global(datemod) /* value returned by get_modifier */
57 global(pdmax)
58 global(pdmin)
59
60 /* Assumptions for guessing year of birth */
61 global(Minpar) /* assumed minimum age of parenthood */
62 global(Typicl) /* typical age for parenthood or marriage */
63 global(Menopa) /* assumed maximum age of motherhood */
64 global(Oldage) /* assumed age at death */
65
66 proc write_tafel_header() {
67 forindiset(tafelset,person,index,snum) {set(lines,snum)}
68 "N John Q. Public\n" /* your name, mandatory */
69 "A 1234 North Maple\n" /* address, 0-5 lines */
70 "A Homesville, OX 12345-6789\n"
71 "A USA\n"
72 "T 1 (101) 555-1212\n" /* telephone number */
73 "C 19.2 Baud, Unix System\n" /* communications */
74 "C Send any Email to: [email protected]\n"
75 "B SoftRoots/1-101-555-3434\n" /* BBS system/phone number */
76 "D Unix Operating System\n" /* diskette formats */
77 "F LifeLines Genealogy Program for Unix\n" /* file format */
78 "R This is a default header, please ignore.\n" /* comments */
79 "Z " d(lines) "\n"
80 }
81
82 proc main ()
83 {
84 /* Assumptions for guessing year of birth */
85 set(Minpar,14) /* assumed minimum age of parenthood */
86 set(Typicl,20) /* typical age for parenthood or marriage */
87 set(Menopa,50) /* assumed maximum age of motherhood */
88 set(Oldage,60) /* assumed age at death */
89
90 list(plist)
91 indiset(tafelset)
92 list(fdatelist)
93 list(ldatelist)
94 list(fplacelist)
95 list(lplacelist)
96 set(line_count,0)
97
98 getindi(person)
99 enqueue(plist, person)
100 while (person, dequeue(plist)) {
101 call process_line(person, plist)
102 }
103 namesort(tafelset)
104 call write_tafel_header()
105 call write_tafelset()
106 call write_tafel_trailer()
107 }
108
109 proc write_tafelset() {
110 forindiset(tafelset,person,index,snum) {
111 soundex(person) " "
112 getel(ldatelist,index) ":" /* moderate interest by default */
113 getel(fdatelist,index) ":"
114 surname(person)
115 if (lplace,getel(lplacelist,index)) { "\\" lplace }
116 if (fplace,getel(fplacelist,index)) { "/" fplace }
117 "\n"
118 }
119 }
120
121 proc write_tafel_trailer() {
122 "W " date(gettoday()) "\n"
123 }
124
125 proc process_line (person, plist)
126 {
127 call first_in_line(person)
128 set(initial,trim(sname,1))
129 if (and(and(strcmp(initial, "_"),
130 strcmp(initial, " ")),
131 strcmp(sname,""))) {
132 set(last, 0)
133 while (person) {
134 print(".")
135 if (moth, mother(person)) {
136 enqueue(plist, moth)
137 }
138 set(last, person)
139 set(person, father(person))
140 if (strcmp(sname, surname(person))) {
141 call last_in_line(last)
142 if(person) {call first_in_line(person)}
143 }
144 }
145 }
146 }
147
148 proc first_in_line (person)
149 {
150 call set_year_place(person)
151 set(fdate, pdate)
152 set(pl, pplace)
153 if (not(pl)) { /* try for a supportable guess */
154 list(places)
155 if(fath,father(person)) {
156 if(pl,place(death(fath))) {enqueue(places,save(pl))}
157 if(pl,place(birth(fath))) {enqueue(places,save(pl))}
158 families(fath,fam,sp,spi) {
159 if(pl,place(marriage(fam))) {enqueue(places,save(pl))}
160 }
161 }
162 if(moth,mother(person)) {
163 if(pl,place(death(moth))) {enqueue(places,save(pl))}
164 if(pl,place(birth(moth))) {enqueue(places,save(pl))}
165 }
166 families(person,fam,sp,spi) {
167 if(pl,place(marriage(fam))) {enqueue(places,save(pl))}
168 }
169 /* the person's place of death is often misleading */
170 /* if(pl,place(death(person))) {enqueue(places,save(pl))} */
171 set(npl,length(places))
172 while (gt(npl,1)) {
173 set(pl,dequeue(places))
174 set(npl,sub(npl,1))
175 set(ind,1)
176 while(le(ind,npl)) {
177 if(not(strcmp(pl,getel(places,ind)))) {set(npl,neg(1))}
178 set(ind,add(ind,1))
179 }
180 }
181 if(ge(npl,0)) {set(pl,0)}
182 if(pl) {set(pl,concat(pl,"?"))}
183 }
184 set(fplace,save(pl))
185 set(sname,save(surname(person)))
186 }
187
188 proc last_in_line (person)
189 {
190 call set_year_place(person)
191 set(ldate, pdate)
192 set(lplace, pplace)
193 set(line_count,add(line_count,1))
194 addtoset(tafelset,person,line_count)
195 if (and(strcmp(ldate,"????"), gt(strcmp(ldate,fdate),0))) {
196 print("\nInconsistent dates for surname ")
197 print(sname)
198 }
199 enqueue(ldatelist,save(ldate))
200 enqueue(fdatelist,save(fdate))
201 enqueue(lplacelist,save(lplace))
202 enqueue(fplacelist,save(fplace))
203 }
204
205 /* set global variable datemod to +1 if event's date is marked AFT,
206 -1 if marked BEF, and 0 otherwise */
207
208 proc get_modifier(event)
209 { set (datemod,0)
210 if (junk,date(event)) {
211 set (junk,trim(junk,3))
212 if(not(strcmp(junk,"AFT"))) { set (datemod,1) }
213 elsif(not(strcmp(junk,"BEF"))) { set (datemod,neg(1)) }
214 }
215 }
216
217 /* get birth-year for given person -- use whatever clues available, in
218 this order. The culture-dependent limits are defined in "main".
219
220 1. birth
221 2. baptism
222 3. birth of older sibling (+2)
223 4. birth of younger sibling (-2)
224 5. baptism of younger sibling (upper limit only)
225 6. birth of parent (+14: lower limit only)
226 7. death of parent (upper limit only)
227 8. marriage or birth of first child (-20: recursive)
228 9. marriage or birth of first child (-14: recursive upper limit)
229 9. birth of last child (-50: lower limit only)
230 10. death, known to be a parent (-60)
231 11. death, not known to be a parent
232 */
233 proc set_year (person)
234 { set (maxyr,9999) /* set upper bound */
235 set (minyr,0) /* and lower bound */
236 set (guess,0) /* clear "best" guess */
237 if (yr, year(birth(person))) { /* solid data */
238 call get_modifier(birth(person))
239 set (iyr,atoi(yr))
240 if(ge(datemod,0)) {set(minyr,iyr)}
241 if(le(datemod,0)) {set(maxyr,iyr)}
242 if(datemod) {set (yr,0)}
243 }
244 if (not(yr)) {
245 if (yr, year(baptism(person))) { /* pretty good guess */
246 set(iyr,atoi(yr))
247 call get_modifier(baptism(person))
248 if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
249 set (guess, iyr)
250 }
251
252 if(sibl,prevsib(person)) { /* try older sibling */
253 if (yr, year(birth(sibl))) {
254 call get_modifier(birth(sibl))
255 if(ge(datemod,0)) {
256 set (iyr,atoi(yr))
257 if(gt(iyr,minyr)) {set(minyr,iyr)}
258 if(not(or(guess,datemod))) {set(guess,add(iyr,2))}
259 }
260 }
261 }
262 if(sibl,nextsib(person)) { /* try younger sibling */
263 if (yr, year(birth(sibl))) {
264 call get_modifier(birth(sibl))
265 if(le(datemod,0)) {
266 set (iyr,atoi(yr))
267 if(lt(iyr,maxyr)) {set(maxyr,iyr)}
268 if(not(or(guess,datemod))) {set(guess,sub(iyr,2))}
269 } else {set(yr,0)}
270 }
271 if (not(yr)) {
272 if (yr, year(baptism(sibl))) {
273 set(iyr,atoi(yr))
274 call get_modifier(baptism(sibl))
275 if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
276 }
277 }
278 }
279
280 if(sp,mother(person)) { /* set limits from mother */
281 if(yr,year(birth(sp))) {
282 call get_modifier(birth(sp))
283 set(iyr,add(atoi(yr),Minpar))
284 if(and(ge(datemod,0),gt(iyr,minyr))) {set(minyr,iyr)}
285 }
286 if(yr,year(death(sp))) {
287 call get_modifier(death(sp))
288 set(iyr,atoi(yr))
289 if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
290 }
291 }
292
293
294 if(sp,father(person)) { /* set limits from father */
295 if(yr,year(birth(sp))) {
296 call get_modifier(birth(sp))
297 set(iyr,add(atoi(yr),Minpar))
298 if(and(ge(datemod,0),gt(iyr,minyr))) {set(minyr,iyr)}
299 }
300 if(yr,year(death(sp))) {
301 call get_modifier(death(sp))
302 set(iyr,add(atoi(yr),1))
303 if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
304 }
305 }
306
307 set(maryr,9999) /* marriage date or upper limit */
308 set(marbest,9999) /* best guess at marriage date */
309 set(lastbirth,0)
310 families(person,fam,sp,spi) { /* check on marriage/chidren */
311 if(yr, year(marriage(fam))) {
312 call get_modifier(marriage(fam))
313 set(iyr,atoi(yr)) /* go by marriage date */
314 if(and(le(datemod,0),lt(iyr,maryr))) {set(maryr,iyr)}
315 if(and(le(datemod,0),lt(iyr,marbest))) {set(marbest,iyr)}
316 }
317 if(or(eq(maryr,9999),female(person))) {
318 children (fam,child,famchi) {
319 call set_year(child) /* recurse on children */
320 if(lt(pdmax,maryr)) {set(maryr,pdmax)}
321 if(strcmp(pdate,"????")) {
322 set(iyr,atoi(pdate))
323 if(lt(iyr,marbest)) {set(marbest,iyr)}
324 }
325 if(gt(pdmin,lastbirth)) {set(lastbirth,pdmin)}
326 /* get earliest & latest child */
327 }
328 }
329 }
330 if(eq(marbest,9999)) {set(marbest,maryr)}
331 if(lt(maryr,9999)) {
332 set(iyr,sub(maryr,Minpar)) /* assume biological limit */
333 if(lt(iyr,maxyr)) {set(maxyr,iyr)}
334 if(not(guess)) {set(guess,sub(marbest,Typicl))} /* typical age */
335 }
336 if(gt(lastbirth,0)) {
337 set(iyr,sub(lastbirth,Menopa)) /* another biological limit */
338 if(gt(iyr,minyr)) {set(minyr,iyr)}
339 }
340 if (yr, year(death(person))) {call get_modifier(death(person))}
341 elsif (yr, year(burial(person))) {call get_modifier(burial(person))}
342 if (yr) {
343 set (iyr, atoi(yr))
344 if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
345 if(not(guess)) { /* still need a guess? */
346 if(nfamilies(person)) {
347 set(guess,sub(iyr,Oldage))} /* died old */
348 else {set(guess,iyr)} /* no family => died young */
349 }
350 }
351
352 if (gt(guess,maxyr)) { set(guess,maxyr) } /* apply limit, in case... */
353 if (lt(guess,minyr)) { set(guess,minyr) }
354 if (gt(guess,0)) {set (yr,d(guess))}
355 }
356 if (not(yr)) { set (yr, "????") }
357 set(pdate, save(yr)) /* values returned */
358 set(pdmin,minyr)
359 set(pdmax,maxyr)
360 }
361
362 proc set_year_place (person)
363 {
364 call set_year (person)
365 set(pl, place(birth(person)))
366 if (not(pl)) {set(pl, place(baptism(person)))}
367 set(pplace, save(pl))
368 }
369
370
371 /*
372
373 Here is an example of a tiny tafel by Cliff Manis.
374
375 Note that the "Z" line is the number of actual data lines.
376
377 N Alda Clifford Manis
378 A P. O. Box 33937
379 A San Antonio
380 A Texas
381 A 78265-3937
382 T 1 (512) 654-9912
383 C 19.2 Baud, Unix System
384 C Send any Email to: [email protected]
385 D Unix Operating System
386 F LifeLines Genealogy Program for Unix
387 Z 16
388 M520 1939 1939 Manis\Knoxville, Knox Co, TN/Knoxville, Knox Co, TN
389 M520 1780 1902 Manes\Sevier Co, TN ?/Union Valley, Sevier Co, TN
390 M520 1770 1770 Maness\Sevier Co, Tennessee ?/Sevier Co, Tennessee ?
391 M520 1805 1914 Manis\North Carolina ?/Dandridge, Jefferson Co, TN
392 C536 1820 1869 Canter\VA/Jonesboro, Washington Co, TN
393 B620 1765 1829 Bowers/TN
394 N550 1730 1881 Newman\Monroe Co., WV/Jefferson Co, TN
395 B630 1760 1845 Bird\Frederick Co, VA/Sevier Co, TN
396 B630 1730 1730 Barth\Germany/Germany
397 F652 1745 1810 Francis\Augusta Co, VA ?/Rutherford Co, NC
398 W365 1860 1846 Whitehorn\VA/Washington Co, TN ?
399 C500 1700 1808 Cowan/TN
400 C613 1720 1843 Corbett\Scotch-Irish Dec/Jefferson Co, TN
401 R525 1750 1806 Rankin\Scotland/Jefferson Co., TN
402 S636 1776 1799 Shrader\Virginia/Sevier Co, TN ?
403 B300 1772 1772 Boyd\Boyd's Creek, Sevier Co, TN/Boyd's Creek, Sevier Co, TN
404 W 24 September 1992
405
406 */
407
408 /* End of Report */