Debian Codegraph @

reports/verify.ll

raw
1 /*
2 * @progname verify.ll
3 * @version 12.0
4 * @author Eggert
5 * @category
6 * @output Text
7 * @description
8
9 This LifeLines report program generates a text file which lists
10 exceptions to assertions or checks about the database. There are two
11 forms of the output report, terse or verbose, selectable at runtime.
12 See text at beginning of report for more details.
13
14 verify - a LifeLines database verification report program
15 by Jim Eggert ([email protected])
16 Version 1 3 Nov 1992 (unreleased, first simple try)
17 2 7 Nov 1992 (added lots of checks, verbose mode)
18 3 12 Nov 1992 (minor bugfix, parameter tuning,
19 added mrbbpm, unkgen, and hommar checks,
20 and more heuristics for birth and marriage years)
21 4 17 Nov 1992 (minor bugfix,
22 added femhus, malwif, cbspan, lngwdw, oldunm checks)
23 5 2 Dec 1992 (added mmnsnk check, improved morder)
24 6 26 Mar 1993 (improved paternity checks, added hermaf check)
25 7 2 Sep 1993 (added noprnt check, bug fix for parentless families)
26 8 2 Dec 1994 (added mulpar check)
27 9 28 Apr 1995 (added nofams check)
28 10 7 Sep 1995 (added mrabsm check, periodic printing to screen)
29 11 15 Jan 1997 (added infamp, mulhus, mulwif, mulchl checks)
30 12 15 Sep 2000 (added samgiv check)
31 13 2 Apr 2007 (changed jundec to maydec, added nomems check,
32 changed infamp to husfam, famhus, wiffam, famwif,
33 chlfam, famchl checks)
34
35 This LifeLines report program generates a text file which lists
36 exceptions to assertions or checks about the database. There are two
37 forms of the output report, terse or verbose, selectable at runtime.
38
39 In the terse report, the assertions tested are labeled with a
40 six-character label at the beginning of each line, followed by the
41 instance of the exception. The assertions tested, with the terse
42 syntax of the report output, are of five types, and are listed below.
43
44 The verbose report is more English-like, and requires less
45 explanation. It contains the same information in the same order as
46 the terse report, with words added to make it read easier. The lines
47 are often longer than 80 characters.
48
49 Before using this report, you may want to edit the first bunch of
50 set() calls in the main() procedure to adjust the various parameters.
51
52 Only one individual key is printed out per line, anyone else is
53 given by relation to this first person.
54
55 All age and date checks use only the year field of the date. Thus
56 they are a bit inaccurate. In particular, any use of ABT (about), BEF
57 (before), AFT (after), split dates, or similar devices will be lost on
58 this program. Sorry.
59
60 Normal and Irish twins are indistinguishable. For the cspace
61 assertion, intervening children with no known birthyear are treated
62 intelligently. Unknown birthyears and deathyears are assumed equal to
63 the baptism years and burial years, respectively, if those are
64 available. Unknown marriage years are estimated from the children's
65 birth or baptism years.
66
67 For a large database, this program will likely generate a lot of
68 output. I suggest that you go through this large output once to make
69 sure that everything is correct in the database. After correcting any
70 errors, run this program again, creating a reference report, which
71 will still contain a lot of messages. Then use diff to compare any
72 later reports to the reference report to catch any new errors.
73
74 You can sort the output report against the first field to sort against
75 the check type. This actually makes the report look nicer too. Then
76 you can sort subsets of the output against other fields to look for
77 the oldest person or the youngest father in the database, for example.
78
79 Parameters
80 Settable parameters are denoted by _parameter_ in this documentation.
81 These parameters are set in the first few lines of the procedure
82 main(), and can be changed by editing the program before running.
83
84 Assertions or checks
85 individual checks:
86 person's age at death is older than _oldage_
87 oldage key name birth death age
88 person is baptized before birth
89 bpbefb key person birth baptism
90 person dies before birth
91 dbefb key person birth death
92 person is buried before birth
93 bubefb key person birth burial
94 person dies before baptism
95 dbefbp key person baptism death
96 person is buried before baptism
97 bubfbp key person baptism burial
98 person is buried before death
99 bubefd key person death burial
100 person is baptised after birth year
101 bpspac key person birth baptism
102 person is buried after death year
103 buspac key person death burial
104 person has unkown gender
105 unkgen key person
106 person has ambiguous gender
107 hermaf key person
108 person has multiple parentage
109 mulpar key person familynum familynum
110 person has no family pointers
111 nofams key person
112
113 marriage checks:
114 person marries before birth
115 unbmar key person birth marriage spouse
116 person marries after death
117 dedmar key person death marriage spouse
118 person has more than _wedder_ spouses
119 wedder key person nspouses
120 person marries someone more than _maydec_ years older
121 maydec key person birth family spouse spouse_birth
122 person marries younger than _yngmar_
123 yngmar key person age spouse
124 person marries older than _oldmar_
125 oldmar key person age spouse
126 marriage out of order
127 morder key person spouse
128 marriage before birth from previous marriage
129 mrbbpm key person marriage spouse previous_birth
130 marriage after birth from subsequent marriage
131 mrabsm key person marriage spouse subsequent_birth
132 homosexual marriage
133 hommar key person marriage spouse
134 person is a female husband
135 femhus key person marriage
136 person is a male wife
137 malwif key person marriage
138 person was a widow(er) longer than _lngwdw_ years
139 lngwdw key person years
140 person lived more than _oldunm_ years and never married
141 oldunm key person years
142 person has multiple marriages, this one with no spouse and no children
143 mmnsnk key person family
144 person has same surname as spouse
145 samnam key person marriage spouse
146
147 parentage checks:
148 mother has more than _fecmom_ children
149 fecmom key person nkids nfamilies
150 mother is older than _oldmom_ at time of birth of child
151 oldmom key person age familynum childnum child
152 child is born before mother
153 unbmom key person birth familynum childnum child child_birth
154 mother is younger than _yngmom_
155 yngmom key person age familynum childnum child
156 mother is dead at birth of child
157 dedmom key person death familynum childnum child birth
158 same as above, but for father
159 [fecdad, olddad, unbdad, yngdad, deddad]
160 child doesn't inherit father's surname
161 nonpat key person familynum childnum child
162
163 children checks:
164 child is born out of order with respect to a previous child
165 corder key person familynum childnum child child_birth
166 prev_child_birth
167 child is born in the same year as a previous child
168 ctwins key person familynum childnum child child_birth
169 child is born more than _cspace_ years after previous child
170 cspace key person familynum childnum child birthspace
171 children's births span more than _cbspan_ years
172 cbspan key person birthspan
173 child is born before parents' marriage
174 illeg key person familynum maryear childnum child child_birth
175 child has same given name as sibling
176 samgiv key person sibling
177
178 family checks:
179 family has no members
180 nomems fkey
181 family has no parents
182 noprnt fkey firstchild nchildren
183 husband missing pointer to family
184 husfam key person fkey
185 family missing pointer to husband
186 famhus key person fkey
187 wife missing pointer to family
188 wiffam key person fkey
189 family missing pointer to wife
190 famwif key person fkey
191 child missing pointer to family
192 chlfam key person fkey
193 family missing pointer to child
194 famchl key person fkey
195 family has multiple husbands
196 mulhus fkey key husband
197 family has multiple wives
198 mulwif fkey key wife
199 child is in family multiple times
200 mulchl fkey key child
201
202 */
203
204 global(birthyear) /* calculated by get_birthyear */
205
206 proc get_birthyear(someone)
207 {
208 set(birthyear,0)
209 if (bth,birth(someone)) {
210 extractdate(bth,birthday,birthmonth,birthyear)
211 }
212 if (eq(birthyear,0)) {
213 if (bap,baptism(someone)) {
214 extractdate(bap,bapday,bapmonth,birthyear)
215 }
216 }
217 }
218
219
220 proc main ()
221 {
222 /* Main settable parameters */
223 set(oldage,90) /* maximum approximate age */
224 set(maydec,20) /* maximum husband-wife age difference */
225 set(yngmar,18) /* minimum age to marry */
226 set(oldmar,50) /* maximum age to marry */
227 set(fecmom,8) /* maximum number of children for a woman */
228 set(oldmom,45) /* maximum age for a woman to bear a child */
229 set(yngmom,18) /* minimum age for a woman to bear a child */
230 set(fecdad,10) /* maximum number of children for a man */
231 set(olddad,60) /* maximum age for a man to father a child */
232 set(yngdad,18) /* minimum age for a man to father a child */
233 set(wedder,2) /* maximum number of spouses for a person */
234 set(cspace,8) /* maximum number of years between children */
235 set(cbspan,25) /* maximum span of years for all children */
236 set(nonpat,0) /* 0 = compare child=father surnames by Soundex code,
237 1 = require strict surname equality */
238 set(oldunm,40) /* maximum age at death for unmarried person */
239 set(lngwdw,20) /* maximum number of consecutive years of widowhood */
240 set(print_interval,100) /* how often to print status to the screen */
241
242 getintmsg(verbose,"Enter 0 for terse, 1 for verbose output")
243 if (verbose) {
244 set(oldagestr,"Old age ")
245 set(namestr," ")
246 set(bornstr," born ")
247 set(bapstr," baptized ")
248 set(buriedstr," buried ")
249 set(diedstr," died ")
250 set(agestr," age ")
251 set(dbefbstr,"Died before birth ")
252 set(bpbefbstr,"Baptized before birth ")
253 set(bpspacstr,"Baptized late ")
254 set(bubefdstr,"Buried before death ")
255 set(buspacstr,"Buried late ")
256 set(dbefbpstr,"Death before baptism ")
257 set(bubfbpstr,"Buried before baptism ")
258 set(bubefbstr,"Buried before birth ")
259 set(wedderstr,"Married often ")
260 set(marriedstr," married ")
261 set(timesstr," times")
262 set(momstr,"mother ")
263 set(dadstr,"father ")
264 set(oldstr,"Old ")
265 set(unbstr,"Unborn ")
266 set(deadstr,"Dead ")
267 set(yngstr,"Young ")
268 set(fecundstr,"Fecund ")
269 set(hadstr," had ")
270 set(kidsinstr," children in ")
271 set(familystr," family")
272 set(familiesstr," families")
273 set(maydecstr,"May-December marriage ")
274 set(unbmarstr,"Married before birth ")
275 set(dedmarstr,"Married after death ")
276 set(yngmarstr,"Young marriage ")
277 set(oldmarstr,"Old marriage ")
278 set(marriedagestr," married at age ")
279 set(tostr," to ")
280 set(morderstr,"Marriage out of order ")
281 set(familynostr," family ")
282 set(illegstr,"Child born before parents' marriage ")
283 set(corderstr,"Child out of order ")
284 set(childnostr," child ")
285 set(prevbornstr," previous child born ")
286 set(ctwinstr,"Possible twin ")
287 set(cspacestr,"Widely spaced births ")
288 set(laterstr," years later")
289 set(nonpatstr,"Nonpatrilineal surname inheritance ")
290 set(mrbbpmstr,"Marriage before birth from previous family ")
291 set(mrabsmstr,"Marriage after birth from subsequent family ")
292 set(prevmarbirthstr," previous birth ")
293 set(subsmarbirthstr," subsequent birth ")
294 set(unkgenstr,"Unknown gender ")
295 set(hermafstr,"Ambiguous gender ")
296 set(mulparstr,"Multiple parentage ")
297 set(nofamsstr,"No family ")
298 set(parentstr,"parent ")
299 set(hommarstr,"Homosexual marriage ")
300 set(femhusstr,"Female husband ")
301 set(malwifstr,"Male wife ")
302 set(cbspanstr,"Widely spanning births ")
303 set(childrenspanstr," children's births span ")
304 set(yearsstr," years")
305 set(oldunmstr,"Old and unmarried ")
306 set(diedunmarriedstr," died unmarried aged ")
307 set(lngwdwstr,"Long widowhood ")
308 set(waswidowstr," was a widow ")
309 set(waswidowerstr," was a widower ")
310 set(beforefamilynostr," before family ")
311 set(mmnsnkstr,"Multiple marriages no spouse no kids ")
312 set(samnamstr,"Husband and wife with same surname ")
313 set(samgivstr,"Siblings with same given name ")
314 set(prevchildstr," previous child ")
315 set(nomemsstr,"Family with no members ")
316 set(noprntstr,"Family with no parents ")
317 set(firstchildstr," first child ")
318 set(numchildrenstr," of ")
319 set(husfamstr,"Husband missing pointer to family ")
320 set(famhusstr,"Family missing pointer to husband ")
321 set(wiffamstr,"Wife missing pointer to family ")
322 set(famwifstr,"Family missing pointer to wife ")
323 set(chlfamstr,"Child missing pointer to family ")
324 set(famchlstr,"Family missing pointer to child ")
325 set(mulhusstr,"Family has multiple husbands ")
326 set(mulwifstr,"Family has multiple wives ")
327 set(mulchlstr,"Child is in family multiple times ")
328 set(nl,".\n")
329 }
330 else {
331 set(oldagestr,"oldage ")
332 set(namestr," ")
333 set(bornstr," ")
334 set(bapstr," ")
335 set(buriedstr," ")
336 set(diedstr," ")
337 set(agestr," ")
338 set(dbefbstr, "dbefb ")
339 set(bpbefbstr,"bpbefb ")
340 set(bpspacstr,"bpspac ")
341 set(bubefdstr,"bubefd ")
342 set(buspacstr,"buspac ")
343 set(dbefbpstr,"dbefbp ")
344 set(bubfbpstr,"bubfbp ")
345 set(bubefbstr,"bubefb ")
346 set(wedderstr,"wedder ")
347 set(marriedstr," ")
348 set(timesstr,"")
349 set(momstr,"mom ")
350 set(dadstr,"dad ")
351 set(oldstr,"old")
352 set(unbstr,"unb")
353 set(deadstr,"ded")
354 set(yngstr,"yng")
355 set(fecundstr,"fec")
356 set(hadstr," ")
357 set(kidsinstr," ")
358 set(familystr,"")
359 set(familiesstr,"")
360 set(maydecstr,"maydec ")
361 set(unbmarstr,"unbmar ")
362 set(dedmarstr,"dedmar ")
363 set(yngmarstr,"yngmar ")
364 set(oldmarstr,"oldmar ")
365 set(marriedagestr," ")
366 set(tostr," ")
367 set(morderstr,"morder ")
368 set(familynostr," ")
369 set(illegstr,"illeg ")
370 set(corderstr,"corder ")
371 set(childnostr," ")
372 set(prevbornstr," ")
373 set(ctwinstr,"ctwins ")
374 set(cspacestr,"cspace ")
375 set(laterstr,"")
376 set(nonpatstr,"nonpat ")
377 set(mrbbpmstr,"mrbbpm ")
378 set(mrabsmstr,"mrabsm ")
379 set(prevmarbirthstr," ")
380 set(subsmarbirthstr," ")
381 set(unkgenstr,"unkgen ")
382 set(hermafstr,"hermaf ")
383 set(mulparstr,"mulpar ")
384 set(nofamsstr,"nofams ")
385 set(parentstr,"par ")
386 set(hommarstr,"hommar ")
387 set(femhusstr,"femhus ")
388 set(malwifstr,"malwif ")
389 set(cbspanstr,"cbspan ")
390 set(childrenspanstr," ")
391 set(yearsstr,"")
392 set(oldunmstr,"oldunm ")
393 set(diedunmarriedstr," ")
394 set(lngwdwstr,"lngwdw ")
395 set(beforefamilynostr,"")
396 set(waswidowstr," ")
397 set(waswidowerstr," ")
398 set(mmnsnkstr,"mmnsnk ")
399 set(samnamstr,"samnam ")
400 set(samgivstr,"samgiv ")
401 set(prevchildstr," ")
402 set(nomemsstr,"nomems ")
403 set(noprntstr,"noprnt ")
404 set(firstchildstr," ")
405 set(numchildrenstr," ")
406 set(husfamstr,"husfam ")
407 set(famhusstr,"famhus ")
408 set(wiffamstr,"wiffam ")
409 set(famwifstr,"famwif ")
410 set(chlfamstr,"chlfam ")
411 set(famchlstr,"famchl ")
412 set(mulhusstr,"mulhus ")
413 set(mulwifstr,"mulwif ")
414 set(mulchlstr,"mulchl ")
415 set(nl,"\n")
416 }
417
418 set(next_print,0)
419 print("Scanning individuals: I")
420 forindi(person, number) {
421 set(idstr,concat(key(person),namestr,name(person)))
422 /* individual checks */
423 set(byear,0)
424 if (bth,birth(person)) {
425 extractdate(bth,bday,bmonth,byear)
426 }
427 set(bapyear,0)
428 if (bap,baptism(person)) {
429 extractdate(bap,bapday,bapmonth,bapyear)
430 }
431 set(dyear,0)
432 if (dth,death(person)) {
433 extractdate(dth,dday,dmonth,dyear)
434 }
435 set(buryear,0)
436 if (bur,burial(person)) {
437 extractdate(bur,burday,burmonth,buryear)
438 }
439 if (and(byear,bapyear)) {
440 if (gt(byear,bapyear)) {
441 bpbefbstr idstr
442 bornstr d(byear) bapstr d(bapyear) nl
443 }
444 if (lt(byear,bapyear)) {
445 bpspacstr idstr
446 bornstr d(byear) bapstr d(bapyear) nl
447 }
448 }
449 if (and(dyear,buryear)) {
450 if (gt(dyear,buryear)) {
451 bubefdstr idstr
452 diedstr d(dyear) buriedstr d(buryear) nl
453 }
454 if (lt(dyear,buryear)) {
455 buspacstr idstr
456 diedstr d(dyear) buriedstr d(buryear) nl
457 }
458 }
459 if (and(dyear,gt(byear,dyear))) {
460 dbefbstr idstr bornstr
461 d(byear) diedstr d(dyear) nl
462 }
463 if (and(dyear,gt(bapyear,dyear))) {
464 dbefbpstr idstr bapstr
465 d(bapyear) diedstr d(dyear) nl
466 }
467 if (and(buryear,gt(bapyear,buryear))) {
468 bubfbpstr idstr bapstr
469 d(bapyear) buriedstr d(buryear) nl
470 }
471 if (and(buryear,gt(byear,buryear))) {
472 bubefbstr idstr bornstr
473 d(byear) buriedstr d(buryear) nl
474 }
475
476 if (eq(byear,0)) { set(byear,bapyear) } /* guess baptism = birth */
477 if (eq(dyear,0)) { set(dyear,buryear) } /* guess burial = death */
478 if (and(byear,dyear)) { set(ageatdeath,sub(dyear,byear)) }
479 else { set(ageatdeath,0) }
480 if (gt(ageatdeath,oldage)) {
481 oldagestr idstr
482 bornstr d(byear) diedstr d(dyear)
483 agestr d(ageatdeath) nl
484 }
485
486 /* gender checks */
487 if (female(person)) {
488 set(parstr,momstr)
489 set(oldpar,oldmom)
490 set(yngpar,yngmom)
491 set(fecpar,fecmom)
492 set(waswidstr,waswidowstr)
493 }
494 if (male(person)) {
495 set(parstr,dadstr)
496 set(oldpar,olddad)
497 set(yngpar,yngdad)
498 set(fecpar,fecdad)
499 set(waswidstr,waswidowerstr)
500 }
501 if (not(or(female(person),male(person)))) {
502 unkgenstr idstr nl
503 set(parstr,parentstr)
504 set(oldpar,olddad)
505 set(yngpar,yngdad)
506 set(fecpar,fecdad)
507 set(waswidstr,waswidowstr)
508 }
509 if (and(male(person),female(person))) {
510 hermafstr idstr nl
511 set(parstr,parentstr)
512 set(oldpar,olddad)
513 set(yngpar,yngdad)
514 set(fecpar,fecdad)
515 set(waswidstr,waswidowstr)
516 }
517
518 /* multiple parentage and family pointer check */
519 set(nfamc,0)
520 set(famstr,"")
521 fornodes(inode(person),node) {
522 if (eqstr(tag(node),"FAMC")) {
523 incr(nfamc)
524 if (eq(nfamc,1)) { set(famstr,value(node)) }
525 elsif (eq(nfamc,2)) { mulparstr idstr famstr }
526 if (ge(nfamc,2)) { " " value(node) }
527 }
528 }
529 if (gt(nfamc,1)) { nl }
530 fornodes(inode(person),node) {
531 if (eqstr(tag(node),"FAMC")) {
532 set(fxref,value(node))
533 set(found,0)
534 if (reference(fxref)) {
535 fornodes(dereference(fxref),famnode) {
536 if (eqstr(tag(famnode),"CHIL")) {
537 set(cxref,value(famnode))
538 if (reference(cxref)) {
539 if (eqstr(xref(dereference(cxref)),
540 xref(inode(person)))) {
541 set(found,1)
542 break()
543 }
544 }
545 }
546 }
547 }
548 if (not(found)) { famchlstr idstr " " key(fam(fxref)) nl }
549 }
550 if (eqstr(tag(node),"FAMS")) {
551 set(fxref,value(node))
552 set(found,0)
553 if (reference(fxref)) {
554 if (male(person)) {
555 set(spse,"HUSB")
556 set(tagstr,famhusstr)
557 }
558 else {
559 set(spse,"WIFE")
560 set(tagstr,famwifstr)
561 }
562 fornodes(dereference(fxref),famnode) {
563 if (eqstr(tag(famnode),spse)) {
564 set(sxref,value(famnode))
565 if (reference(sxref)) {
566 if (eqstr(xref(dereference(sxref)),
567 xref(inode(person)))) {
568 set(found,1)
569 break()
570 }
571 }
572 }
573 }
574 }
575 if (not(found)) { tagstr idstr " " key(fam(fxref)) nl }
576 }
577 }
578 if (gt(nfamc,1)) { nl }
579
580 /* no families check */
581 if (and(not(parents(person)), eq(0,nfamilies(person)))) {
582 nofamsstr idstr nl
583 }
584
585 set(nkids,0)
586
587 /* marriage checks */
588 set(nfam,nfamilies(person))
589 if (gt(nfam,wedder)) {
590 wedderstr idstr
591 marriedstr d(nfam) timesstr nl
592 }
593 if (and(gt(ageatdeath,oldunm),eq(nfam,0))) {
594 oldunmstr idstr diedunmarriedstr d(ageatdeath) yearsstr nl
595 }
596 set(first_cbyear,99999)
597 set(last_cbyear,0)
598 set(prev_cbyear,0)
599 set(prev_cbyfnum,0)
600 set(prev_cbyind,0)
601 set(prev_maryear,0)
602 set(prev_sdyear,0)
603 set(prev_spouse,0)
604 families(person,fam,spouse,fnum) {
605 if (eqstr(sex(person),sex(spouse))) {
606 hommarstr idstr familynostr d(fnum)
607 namestr name(spouse) nl
608 }
609 if (and(eq(person,husband(fam)),female(person))) {
610 femhusstr idstr familynostr d(fnum) nl
611 }
612 if (and(eq(person,wife(fam)),male(person))) {
613 malwifstr idstr familynostr d(fnum) nl
614 }
615 if (spouse) {
616 if (and(male(person),
617 eqstr(surname(person),surname(spouse)))) {
618 samnamstr idstr familynostr d(fnum)
619 namestr name(spouse) nl
620 }
621 }
622 if (and(byear,spouse)) {
623 call get_birthyear(spouse)
624 if (gt(sub(birthyear,byear),maydec)) {
625 maydecstr idstr
626 bornstr d(byear) familynostr d(fnum)
627 namestr name(spouse)
628 bornstr d(birthyear) nl
629 }
630 }
631 set(sdyear,0)
632 if (sdth,death(spouse)) {
633 extractdate(sdth,sdthday,sdmonth,sdyear)
634 }
635 if (eq(sdyear,0)) {
636 if (sbur,burial(spouse)) {
637 extractdate(sbur,sburday,sburmonth,sdyear)
638 }
639 }
640 set(maryear,0)
641 if (mar,marriage(fam)) {
642 extractdate(mar,marday,marmonth,maryear)
643 }
644 if (eq(maryear,0)) { /* estimate marriage year */
645 children(fam,child,cnum) {
646 if (eq(maryear,0)) {
647 call get_birthyear(child)
648 if (birthyear) {
649 set(maryear,sub(birthyear,cnum))
650 }
651 }
652 }
653 }
654 if (or(and(maryear,lt(maryear,prev_maryear)),
655 and(sdyear,lt(sdyear,prev_maryear)))) {
656 morderstr idstr
657 tostr name(spouse) nl
658 }
659 if (maryear) {
660 if (byear) {
661 set(marage,sub(maryear,byear))
662 if (lt(marage,0)) {
663 unbmarstr idstr
664 bornstr d(byear) marriedstr d(maryear)
665 tostr name(spouse) nl
666 }
667 elsif (lt(marage,yngmar)) {
668 yngmarstr idstr
669 marriedagestr d(marage) tostr
670 name(spouse) nl
671 }
672 elsif (gt(marage,oldmar)) {
673 oldmarstr idstr
674 marriedagestr d(marage) tostr
675 name(spouse) nl
676 }
677 }
678 if (and(dyear,gt(maryear,dyear))) {
679 dedmarstr idstr
680 diedstr d(dyear) marriedstr d(maryear)
681 tostr name(spouse) nl
682 }
683 if (gt(prev_cbyear,maryear)) {
684 mrbbpmstr idstr
685 marriedstr d(maryear)
686 tostr name(spouse)
687 prevmarbirthstr d(prev_cbyear) nl
688 }
689 }
690 else { set(maryear,prev_maryear) }
691 if (and(maryear,prev_sdyear)) {
692 set(wdwyear,sub(maryear,prev_sdyear))
693 if (gt(wdwyear,lngwdw)) {
694 lngwdwstr idstr waswidstr
695 d(wdwyear) yearsstr
696 beforefamilynostr d(fnum) nl
697 }
698 }
699 if (and(eq(fnum,nfam),and(dyear,sdyear))) {
700 set(wdwyear,sub(dyear,sdyear))
701 if (gt(wdwyear,lngwdw)) {
702 lngwdwstr idstr waswidstr
703 d(wdwyear) yearsstr nl
704 }
705 }
706 if (and(and(gt(nfam,1),not(spouse)),eq(nchildren(fam),0))) {
707 mmnsnkstr idstr familynostr d(fnum) nl
708 }
709 children(fam,child,cnum) {
710 incr(nkids)
711 call get_birthyear(child)
712 set(cbyear,birthyear)
713 if (and(cbyear,lt(cbyear,first_cbyear)))
714 { set(first_cbyear,cbyear) }
715 if (gt(cbyear,last_cbyear)) { set(last_cbyear,cbyear) }
716 /* parentage checks */
717 if (and(byear,cbyear)) {
718 set(bage,sub(cbyear,byear))
719 if (gt(bage,oldpar)) {
720 oldstr parstr idstr
721 agestr d(bage) familynostr d(fnum)
722 childnostr d(cnum) namestr
723 name(child) nl
724 }
725 elsif (lt(bage,0)) {
726 unbstr parstr idstr
727 bornstr d(byear)
728 familynostr d(fnum) childnostr d(cnum)
729 namestr name(child)
730 bornstr d(cbyear) nl
731 }
732 elsif (lt(bage,yngpar)) {
733 yngstr parstr idstr
734 agestr d(bage)
735 familynostr d(fnum) childnostr d(cnum)
736 namestr name(child) nl
737 }
738 }
739 if (and(dyear,gt(cbyear,dyear))) {
740 deadstr parstr idstr
741 diedstr d(dyear)
742 familynostr d(fnum) childnostr d(cnum)
743 namestr name(child)
744 bornstr d(cbyear) nl
745 }
746 if (male(person)) {
747 if (or(and(eq(nonpat,0),
748 strcmp(soundex(person),soundex(child))),
749 and(eq(nonpat,1),
750 strcmp(surname(person),surname(child))))) {
751 nonpatstr idstr familynostr d(fnum)
752 childnostr d(cnum) namestr
753 name(child) nl }
754 }
755 if (and(prev_maryear,cbyear)) {
756 if (gt(prev_maryear,cbyear)) {
757 mrabsmstr idstr
758 marriedstr d(prev_maryear)
759 tostr name(prev_spouse)
760 subsmarbirthstr d(cbyear) nl
761 }
762 }
763 /* children checks */
764 if (cbyear) {
765 set(main_parent,or(female(person),not(wife(fam))))
766 if (main_parent) {
767 if (gt(maryear,cbyear)) {
768 illegstr idstr
769 familynostr d(fnum) marriedstr d(maryear)
770 childnostr d(cnum) namestr
771 name(child)
772 bornstr d(cbyear) nl
773 }
774 }
775 if (and(prev_cbyear,
776 or(main_parent,ne(fnum,prev_cbyfnum)))) {
777 if (gt(prev_cbyear,cbyear)) {
778 corderstr idstr
779 familynostr d(fnum) childnostr d(cnum)
780 namestr name(child)
781 bornstr d(cbyear) prevbornstr d(prev_cbyear) nl
782 }
783 elsif (eq(cbyear,prev_cbyear)) {
784 ctwinstr idstr
785 familynostr d(fnum) childnostr d(cnum)
786 namestr name(child)
787 bornstr d(cbyear) nl
788 }
789 elsif (gt(cbyear,
790 add(prev_cbyear,
791 mul(cspace,sub(nkids,prev_cbyind))))) {
792 cspacestr idstr
793 familynostr d(fnum) childnostr d(cnum)
794 namestr name(child)
795 bornstr d(sub(cbyear,prev_cbyear)) laterstr nl
796 }
797 }
798 set(prev_cbyear,cbyear)
799 set(prev_cbyind,nkids)
800 set(prev_cbyfnum,fnum)
801 }
802 if (strlen(givens(child))) {
803 children(fam,child2,cnum2) {
804 if (lt(cnum2,cnum)) {
805 if (not(strcmp(givens(child),givens(child2)))) {
806 samgivstr idstr " "
807 name(child) prevchildstr name(child2) nl
808 }
809 }
810 }
811 }
812 }
813 set(prev_spouse,spouse)
814 if (maryear) { set(prev_maryear,maryear) }
815 }
816 set(prev_sdyear,sdyear)
817
818 /* other parentage checks */
819 set(cbdiff,sub(last_cbyear,first_cbyear))
820 if (gt(cbdiff,cbspan)) {
821 cbspanstr idstr childrenspanstr d(cbdiff) yearsstr nl
822 }
823 if (gt(nkids,fecpar)) {
824 fecundstr parstr idstr
825 hadstr d(nkids) kidsinstr d(nfam)
826 if (eq(nfam,1)) { familystr } else { familiesstr } nl
827 }
828 if (ge(number,next_print)) {
829 print(d(number)," ")
830 set(next_print,add(next_print,print_interval))
831 }
832 }
833
834 /* family checks, including handling families with no parents */
835 set(next_print,0)
836 print("\nScanning families: F")
837 forfam(fam,number) {
838 if (not(or(husband(fam),wife(fam)))) {
839 set(first_cbyear,99999)
840 set(last_cbyear,0)
841 set(prev_cbyear,0)
842 set(prev_cbyind,0)
843 set(maryear,0)
844 if (mar,marriage(fam)) {
845 extractdate(mar,marday,marmonth,maryear)
846 }
847 children(fam,child,cnum) {
848 if (eq(cnum,1)) { set(firstchild,child) }
849 call get_birthyear(child)
850 set(cbyear,birthyear)
851 if (and(cbyear,lt(cbyear,first_cbyear)))
852 { set(first_cbyear,cbyear) }
853 if (gt(cbyear,last_cbyear)) { set(last_cbyear,cbyear) }
854 if (cbyear) {
855 if (gt(maryear,cbyear)) {
856 illegstr
857 key(fam) marriedstr d(maryear)
858 childnostr d(cnum) namestr
859 name(child)
860 bornstr d(cbyear) nl
861 }
862 if (prev_cbyear) {
863 if (gt(prev_cbyear,cbyear)) {
864 corderstr
865 key(fam) childnostr d(cnum)
866 namestr name(child)
867 bornstr d(cbyear) prevbornstr d(prev_cbyear) nl
868 }
869 elsif (eq(cbyear,prev_cbyear)) {
870 ctwinstr
871 key(fam) childnostr d(cnum)
872 namestr name(child)
873 bornstr d(cbyear) nl
874 }
875 elsif (gt(cbyear,
876 add(prev_cbyear,
877 mul(cspace,sub(cnum,prev_cbyind))))) {
878 cspacestr
879 key(fam) childnostr d(cnum)
880 namestr name(child)
881 bornstr d(sub(cbyear,prev_cbyear)) laterstr nl
882 }
883 }
884 set(prev_cbyear,cbyear)
885 set(prev_cbyind,cnum)
886 }
887 }
888 set(cbdiff,sub(last_cbyear,first_cbyear))
889 if (gt(cbdiff,cbspan)) {
890 cbspanstr key(fam)
891 childrenspanstr d(cbdiff) yearsstr nl
892 }
893 if (nchildren(fam)) {
894 noprntstr key(fam)
895 firstchildstr key(firstchild) namestr name(firstchild)
896 numchildrenstr d(nchildren(fam)) nl
897 } else {
898 nomemsstr key(fam) nl
899 }
900 }
901 /* check family pointers */
902 list(chillist)
903 fornodes(fnode(fam),node) {
904 set(nhus,0)
905 set(nwif,0)
906 set(match,"")
907 if (eqstr(tag(node),"CHIL")) {
908 set(match,"FAMC")
909 set(tagstr,chlfamstr)
910 forlist(chillist,prevc,cnum) {
911 if (eqstr(value(node),prevc)) {
912 set(child,indi(value(node)))
913 mulchlstr " " key(fam) " "
914 key(child) " " name(child) nl
915 }
916 }
917 enqueue(chillist,value(node))
918 }
919 elsif (eqstr(tag(node),"HUSB")) {
920 set(match,"FAMS")
921 set(tagstr,husfamstr)
922 incr(nhus)
923 if (eq(nhus,2)) {
924 mulhusstr key(fam) " "
925 key(husband(fam)) " " name(husband(fam)) nl
926 }
927 }
928 elsif (eqstr(tag(node),"WIFE")) {
929 set(match,"FAMS")
930 set(tagstr,wiffamstr)
931 incr(nwif)
932 if (eq(nwif,2)) {
933 mulwifstr key(fam) " "
934 key(wife(fam)) " " name(wife(fam)) nl
935 }
936 }
937 if (strlen(match)) {
938 set(pxref,value(node))
939 set(found,0)
940 if (reference(pxref)) {
941 fornodes(dereference(pxref),pnode) {
942 if (eqstr(tag(pnode),match)) {
943 set(fxref,value(pnode))
944 if (reference(fxref)) {
945 if (eqstr(xref(dereference(fxref)),
946 xref(fnode(fam)))) {
947 set(found,1)
948 break()
949 }
950 }
951 }
952 }
953 }
954 if (not(found)) {
955 tagstr key(indi(pxref))
956 namestr name(indi(pxref)) " " key(fam) nl
957 }
958 }
959 }
960 if (ge(number,next_print)) {
961 print(d(number)," ")
962 set(next_print,add(next_print,print_interval))
963 }
964 }
965 print("\nDone.")
966 }