Debian Codegraph @

reports/est_life_span.ll

raw
1 /*
2 * @progname est_life_span.ll
3 * @version none
4 * @author Rafal Prinke
5 * @category
6 * @output Text
7 * @description
8
9 The program below finds the widest possible span of life, estimating
10 the uncertain and some unknown dates on the basis of user defined
11 values in the table for various combinations of date modifiers etc.
12 Then it compares the midpoints of this with midpoints of others'
13 life spans and if they fall within a user defined range, the two
14 are considered "possibly identical". This is actually just one procedure
15 of several that should be in a program like that - but perhaps the
16 most important one as people may change names, occupations, etc.
17 but they cannot change the time period. I added two arbitrary tags:
18 FAPP and LAPP for "first/last appearance" in sources.
19
20 At present the program compares only the life midpoints and surnames
21 (exactly as they are recorded). Adding other elements for comparison
22 should not be a problem - but there should be a more complicated
23 procedure for comparing names. I do not like soundex as it is misleading
24 (and my bias is founded on the fact that two spellings of my own
25 surname - Prinke and Brinke - never match under the standard soundex :-)
26 Perhaps a soundex that would INCLUDE conversion of the first character
27 into number would nee to be considered? That does not solve many problems
28 of non-English name, either. So perhaps a user defined soundex? This
29 might be possible with user defined functions!
30
31 The procedure below does not deal with BETWEEN dates for death yet.
32 Also people who have no dates at all are not dealt with properly -
33 they should be compared with everyone (generating a lot of rubbish
34 output) or their life span should be found out from children or spouses.
35 */
36
37 global(year1) /* earliest possible */
38 global(year2) /* latest possible */
39 global(diffs)
40 global(someone)
41 global(another)
42
43 proc life_span(someone)
44 {
45 set(year1,0)
46 if (bt,birth(someone)) {
47 set(year1,atoi(year(bt)))
48 if (ne(index(upper(date(bt)),"BEF",1),0)) {
49 set(year1,sub(year1,lookup(diffs,"bef_birt")))
50 }
51 if (and(ne(index(upper(date(bt)),"ABT",1),0),ne(index(upper(date(bt)),"EST",1),0)))
52 {
53 set(year1,sub(year1,lookup(diffs,"abt_birt")))
54 }
55 }
56 if (eq(year1,0)) {
57 if (bp,baptism(someone)) {
58 set(year1,atoi(year(bp)))
59 if (ne(index(upper(date(bp)),"BEF",1),0)) {
60 set(year1,sub(year1,lookup(diffs,"bef_birt")))
61 }
62 if (and(ne(index(upper(date(bp)),"ABT",1),0),ne(index(upper(date(bp)),"EST",1),0)))
63 {
64 set(year1,sub(year1,lookup(diffs,"abt_birt")))
65 }
66 }
67 }
68 if (eq(year1,0)) {
69 set(r, inode(someone))
70 fornodes (r, n) {
71 if (eq(0, strcmp("FAPP", tag(n)))) {
72 extractdate(n,da,mo,ye)
73 set(year1,ye)
74 set(year1,sub(year1,lookup(diffs,"app1")))
75 }
76 }
77 }
78 if (and(eq(year1,0),ne(nfamilies(someone),0))) {
79 set(myear,2000)
80 families(someone,fm,sp,mnr) {
81 set(fyear,atoi(year(marriage(fm))))
82 if (lt(fyear,myear)) {
83 set (myear,fyear)
84 set(mar,marriage(fm))
85 }
86 }
87 if (and(ne(myear,2000),ne(myear,0))) {
88 set(year1,sub(myear,lookup(diffs,"f_marr")))
89 if (ne(index(upper(date(mar)),"BEF",1),0)) {
90 set(year1,sub(year1,lookup(diffs,"bef_marr")))
91 }
92 if (and(ne(index(upper(date(mar)),"ABT",1),0),ne(index(upper(date(bp)),"EST",1),0)))
93 {
94 set(year1,sub(year1,lookup(diffs,"abt_marr")))
95 }
96 }
97 }
98
99 set(year2,0)
100 if (dt,death(someone)) {
101 set(year2,atoi(year(dt)))
102 if (ne(index(upper(date(dt)),"AFT",1),0)) {
103 set(year2,add(year2,lookup(diffs,"aft_deat")))
104 }
105 if (and(ne(index(upper(date(dt)),"ABT",1),0),ne(index(upper(date(dt)),"EST",1),0)))
106 {
107 set(year2,add(year2,lookup(diffs,"abt_deat")))
108 }
109 }
110 if (eq(year2,0)) {
111 if (br,burial(someone)) {
112 set(year2,atoi(year(br)))
113 if (ne(index(upper(date(br)),"AFT",1),0)) {
114 set(year2,add(year2,lookup(diffs,"aft_deat")))
115 }
116 if (and(ne(index(upper(date(br)),"ABT",1),0),ne(index(upper(date(br)),"EST",1),0)))
117 {
118 set(year2,add(year2,lookup(diffs,"abt_deat")))
119 }
120 }
121 }
122 if (eq(year2,0)) {
123 set(r, inode(someone))
124 fornodes (r, n) {
125 if (eq(0, strcmp("LAPP", tag(n)))) {
126 extractdate(n,da,mo,ye)
127 set(year2,ye)
128 set(year2,add(year2,lookup(diffs,"app2")))
129 }
130 }
131 }
132 if (and(eq(year2,0),ne(nfamilies(someone),0))) {
133 set(myear,0)
134 families(someone,fm,sp,mnr) {
135 set(lyear,atoi(year(marriage(fm))))
136 if (gt(lyear,myear)) {
137 set (myear,lyear)
138 set(mar,marriage(fm))
139 }
140 }
141 if (ne(myear,0)) {
142 set(year2,add(myear,lookup(diffs,"l_marr")))
143 if (ne(index(upper(date(mar)),"AFT",1),0)) {
144 set(year2,add(year2,lookup(diffs,"aft_marr")))
145 }
146 if (and(ne(index(upper(date(mar)),"ABT",1),0),ne(index(upper(date(mar)),"EST",1),0)))
147 {
148 set(year2,add(year2,lookup(diffs,"abt_marr")))
149 }
150 }
151 }
152 if (ne(add(year1,year2),0)) {
153 if (and(eq(year1,0),ne(year2,0))) {
154 set(year1,sub(year2,lookup(diffs,"birt_deat")))
155 }
156 if (and(eq(year2,0),ne(year1,0))) {
157 set(year2,add(year1,lookup(diffs,"birt_deat")))
158 }
159 }
160 }
161
162 proc main()
163 {
164 table(diffs) /* values for range of date modifiers etc. */
165 insert(diffs,"bef_birt", 10)
166 insert(diffs,"abt_birt", 10)
167 insert(diffs,"aft_deat", 10)
168 insert(diffs,"abt_deat", 10)
169 insert(diffs,"f_marr",25)
170 insert(diffs,"l_marr",13)
171 insert(diffs,"bef_marr", 10)
172 insert(diffs,"abt_marr", 8)
173 insert(diffs,"aft_marr", 2)
174 insert(diffs,"app1", 10)
175 insert(diffs,"app2", 10)
176 insert(diffs,"birt_deat", 88)
177 insert(diffs,"dist", 50)
178
179 forindi(someone,n1) {
180 call life_span(someone)
181 set(pb1,surname(someone))
182 set(pb1,save(pb1))
183 set(midspan1,div(add(year1,year2),2))
184 forindi(another,n2) {
185 print(d(n1)," ",d(n2),"\n")
186 if (gt(n2,n1)) {
187 call life_span(another)
188 set(pb2,surname(another))
189 set(pb2,save(pb2))
190 set(midspan2,div(add(year1,year2),2))
191 set(cont,0)
192 if (ge(midspan1,midspan2)) {
193 if (lt(sub(midspan1,midspan2),lookup(diffs,"dist"))) {
194 set(cont,1)
195 }
196 }
197 if (ge(midspan2,midspan1)) {
198 if (lt(sub(midspan2,midspan1),lookup(diffs,"dist"))) {
199 set(cont,1)
200 }
201 }
202 if (and(eq(cont,1),eq(strcmp(pb1,pb2),0))) {
203 " possibly contemporary: " nl()
204 key(someone) " " name(someone) " " d(midspan1) " " pb1 nl()
205 key(another) " " name(another) " " d(midspan2) " " pb2 nl()
206
207 }
208 }
209 }
210 }
211 }