File: eol.ll

package info (click to toggle)
lifelines 3.0.50-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 11,140 kB
  • ctags: 6,517
  • sloc: ansic: 57,468; xml: 8,014; sh: 4,255; makefile: 848; yacc: 601; perl: 170; sed: 16
file content (322 lines) | stat: -rw-r--r-- 9,292 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
/*
 * @progname    eol.ll
 * @version     4 of 1995-01
 * @author      Tom Wetmore and John Chandler
 * @category
 * @output      Text, 80 cols
 * @description
 *
Say you want to know who all of your end-of-line ancestors are, that
is, your direct ancestors whose parents you have not yet discovered;
these are the people most of us spend most of our time on researching.
Here is a program that will produce the list.  Any ancestor will be
listed at most once, even in cases where lines cross.  Each person
is shown with date and place of birth and death -- a "guess" is made
for the year of birth if it is not known.

Set the Do_all variable to 1 if you want the end-of-line list to
include even persons with an unknown surname.

This program shares the birth-guessing subroutine with tinytafel.
*/

global(plist)
global(abbvtab)

/* Global definitions for birth-guessing subroutine */
global(pdate)
global(pplace)
global(datemod) /* value returned by get_modifier */
global(pdmax)
global(pdmin)

/* Assumptions for guessing year of birth */
global(Minpar)	/* assumed minimum age of parenthood */
global(Typicl)	/* typical age for parenthood or marriage */
global(Menopa)	/* assumed maximum age of motherhood */
global(Oldage)	/* assumed age at death */

proc main () {
	set(Do_all,0)	/* if 0, then ignore surnameless persons */

	/* Assumptions for guessing year of birth */
	set(Minpar,14)	/* assumed minimum age of parenthood */
	set(Typicl,20)	/* typical age for parenthood or marriage */
	set(Menopa,50)	/* assumed maximum age of motherhood */
	set(Oldage,60)	/* assumed age at death */

	list(ilist)
	list(plist)
	list(pnlist)
	table(seen)
	table(abbvtab)
	indiset(set)
	getindi(indi)
	monthformat(4)
	"END OF LINE ANCESTORS OF " fullname(indi,1,1,30) "\n\n"
	call setupabbvtab()
	enqueue(ilist, indi)
	while(indi, dequeue(ilist)) {
		set(show, 1)
		if (par, father(indi)) {
			set(do_this,Do_all)
			if(not(Do_all)) {
				extractnames (inode(par),pnlist,n,s)
				set(do_this, strcmp(getel(pnlist,s),""))
			}
			if(do_this) {
				enqueue(ilist, par)
				set(show, 0)
			}
		}
		if (par, mother(indi)) {
			set(do_this,Do_all)
			if(not(Do_all)) {
				extractnames (inode(par),pnlist,n,s)
				set(do_this, strcmp(getel(pnlist,s),""))
			}
			if(do_this) {
				enqueue(ilist, par)
				set(show, 0)
			}
		}
		if (show) {
			set(pkey, key(indi))
			if(not(lookup(seen,pkey))) {
				insert(seen,pkey,1)
				addtoset(set, indi, pkey)
			}
		}
	}
	namesort(set)
	forindiset (set, indi, val, num) {
		col(1) fullname(indi,1,0,27)
		call set_year_place(indi)
		call showevent(29, birth(indi), pdate, pplace)
		call showevent(55, death(indi), 0, 0)
		nl()
	}
}

proc showevent (column, event, apdate, applace)
{
	col(column)
	set(column, add(column, 12))
	if(year(event)) {
		stddate(event) sp()
	}
	elsif(apdate) { "      c" apdate " " }
	extractplaces(event, plist, num)
	if (and(applace,eq(num,0))) {
		call extractstr(applace,plist)
		set(num,length(plist))
	}
	if (gt(num, 0)) {
		col(column)
		set(last, getel(plist, num))
		if (yes, lookup(abbvtab, last)) {
			set(last, yes)
		}
		trim(last, 10)
	}
}

proc extractstr (string,list) {
	list(list)
	call ext_step(list,string,1,strlen(string),0)
}
proc ext_step(list,string,start,len,nth) {
	if(gt(start,len)) {return()}
	set(nth,add(1,nth))
	if (not(strcmp(substring(string,start,start)," "))) {
		set(start,add(1,start))
	}
	set(end, sub(index(string, ",", nth),1))
	if(lt(end,0)) {set(end,len)}
	enqueue (list, substring(string,start,end))
	if (lt(end,len)) {call ext_step(list,string,add(end,2),len,nth)}
}

proc setupabbvtab ()
{
	insert(abbvtab, "Connecticut", "CT")
	insert(abbvtab, "Connecticut Colony", "CT")
	insert(abbvtab, "New Haven Colony", "CT")
	insert(abbvtab, "Massachusetts", "MA")
	insert(abbvtab, "Plymouth Colony", "MA")
	insert(abbvtab, "New York", "NY")
	insert(abbvtab, "England", "ENG")
	insert(abbvtab, "Holland", "HOL")
	insert(abbvtab, "Maryland", "MD")
	insert(abbvtab, "Wales", "WLS")
	insert(abbvtab, "Isle of Man", "IOM")
	insert(abbvtab, "Nova Scotia", "NS")
	insert(abbvtab, "Ireland", "IRE")
	insert(abbvtab, "Rhode Island", "RI")
	insert(abbvtab, "prob England", "ENG?")
}

/* set global variable datemod to +1 if event's date is marked AFT,
   -1 if marked BEF, and 0 otherwise */

proc get_modifier(event)
{   set (datemod,0)
    if (junk,date(event)) {
	set (junk,trim(junk,3))
	if(not(strcmp(junk,"AFT"))) { set (datemod,1) }
	elsif(not(strcmp(junk,"BEF"))) { set (datemod,neg(1)) }
    }
}

/* get birth-year for given person -- use whatever clues available, in
this order.  The culture-dependent limits are defined in "main".

	1. birth
	2. baptism
	3. birth of older sibling (+2)
	4. birth of younger sibling (-2)
	5. baptism of younger sibling (upper limit only)
	6. birth of parent (+14: lower limit only)
	7. death of parent (upper limit only)
	8. marriage or birth of first child (-20: recursive)
	9. marriage or birth of first child (-14: recursive upper limit)
	9. birth of last child (-50: lower limit only)
	10. death, known to be a parent (-60)
	11. death, not known to be a parent
*/
proc set_year (person)
{   set (maxyr,9999)			/* set upper bound */
    set (minyr,0)			/* and lower bound */
    set (guess,0)			/* clear "best" guess */
    if (yr, year(birth(person))) {	/* solid data */
	call get_modifier(birth(person))
	set (iyr,atoi(yr))
	if(ge(datemod,0)) {set(minyr,iyr)}
	if(le(datemod,0)) {set(maxyr,iyr)}
	if(datemod) {set (yr,0)}
    }
    if (not(yr)) {
	if (yr, year(baptism(person))) {	/* pretty good guess */
	    set(iyr,atoi(yr))
	    call get_modifier(baptism(person))
	    if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
	    set (guess, iyr)
	}

	if(sibl,prevsib(person)) {	/* try older sibling */
	    if (yr, year(birth(sibl))) {
		call get_modifier(birth(sibl))
		if(ge(datemod,0)) {
		    set (iyr,atoi(yr))
		    if(gt(iyr,minyr)) {set(minyr,iyr)}
		    if(not(or(guess,datemod))) {set(guess,add(iyr,2))}
		}
	    }
	}
	if(sibl,nextsib(person)) {	/* try younger sibling */
	    if (yr, year(birth(sibl))) {
		call get_modifier(birth(sibl))
		if(le(datemod,0)) {
		    set (iyr,atoi(yr))
		    if(lt(iyr,maxyr)) {set(maxyr,iyr)}
		    if(not(or(guess,datemod))) {set(guess,sub(iyr,2))}
		} else {set(yr,0)}
	    }
	    if (not(yr)) {
		if (yr, year(baptism(sibl))) {
		    set(iyr,atoi(yr))
		    call get_modifier(baptism(sibl))
		    if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
		}
	    }
	}

	if(sp,mother(person)) {		/* set limits from mother */
	    if(yr,year(birth(sp))) {
		call get_modifier(birth(sp))
		set(iyr,add(atoi(yr),Minpar))
		if(and(ge(datemod,0),gt(iyr,minyr))) {set(minyr,iyr)}
	    }
	    if(yr,year(death(sp))) {
		call get_modifier(death(sp))
		set(iyr,atoi(yr))
		if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
	    }
	}


	if(sp,father(person)) {		/* set limits from father */
	    if(yr,year(birth(sp))) {
		call get_modifier(birth(sp))
		set(iyr,add(atoi(yr),Minpar))
		if(and(ge(datemod,0),gt(iyr,minyr))) {set(minyr,iyr)}
	    }
	    if(yr,year(death(sp))) {
		call get_modifier(death(sp))
		set(iyr,add(atoi(yr),1))
		if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
	    }
	}

	set(maryr,9999)			/* marriage date or upper limit */
	set(marbest,9999)		/* best guess at marriage date */
	set(lastbirth,0)
	families(person,fam,sp,spi) {	/* check on marriage/chidren */
	    if(yr, year(marriage(fam))) {
	        call get_modifier(marriage(fam))
	        set(iyr,atoi(yr))	/* go by marriage date */
	        if(and(le(datemod,0),lt(iyr,maryr))) {set(maryr,iyr)}
	        if(and(le(datemod,0),lt(iyr,marbest))) {set(marbest,iyr)}
	    }
	    if(or(eq(maryr,9999),female(person))) {
	        children (fam,child,famchi) {
	    	call set_year(child)	/* recurse on children */
	    	if(lt(pdmax,maryr)) {set(maryr,pdmax)}
	    	if(strcmp(pdate,"????")) {
	    	    set(iyr,atoi(pdate))
	    	    if(lt(iyr,marbest)) {set(marbest,iyr)}
	    	}
	    	if(gt(pdmin,lastbirth)) {set(lastbirth,pdmin)}
	    			/* get earliest & latest child */
	        }
	    }
	}
	if(eq(marbest,9999)) {set(marbest,maryr)}
	if(lt(maryr,9999)) {
	    set(iyr,sub(maryr,Minpar))	/* assume biological limit */
	    if(lt(iyr,maxyr)) {set(maxyr,iyr)}
	    if(not(guess)) {set(guess,sub(marbest,Typicl))}  /* typical age */
	}
	if(gt(lastbirth,0)) {
	    set(iyr,sub(lastbirth,Menopa))	/* another biological limit */
	    if(gt(iyr,minyr)) {set(minyr,iyr)}
	}
	if (yr, year(death(person))) {call get_modifier(death(person))}
	elsif (yr, year(burial(person))) {call get_modifier(burial(person))}
	if (yr) {
	    set (iyr, atoi(yr))
	    if(and(le(datemod,0),lt(iyr,maxyr))) {set(maxyr,iyr)}
	    if(not(guess)) {			/* still need a guess? */
		if(nfamilies(person)) {
		    set(guess,sub(iyr,Oldage))} /* died old */
		else {set(guess,iyr)}		/* no family => died young */
	    }
	}

	if (gt(guess,maxyr)) { set(guess,maxyr) } /* apply limit, in case... */
	if (lt(guess,minyr)) { set(guess,minyr) }
	if (gt(guess,0)) {set (yr,d(guess))}
    }
    if (not(yr)) { set (yr, "????") }
    set(pdate, yr)		/* values returned */
    set(pdmin,minyr)
    set(pdmax,maxyr)
}

proc set_year_place (person)
{
    call set_year (person)
    set(pl, place(birth(person)))
    if (not(pl)) {set(pl, place(baptism(person)))}
    set(pplace, pl)
}