171
186
set(gen,dequeue(work_g_list))
172
187
set(child,dequeue(work_c_list))
174
call locations(person)
189
if (not(lookup(ahn_table,key(person)))) { /* only do a person once */
190
insert(ahn_table,key(person),ahnen)
191
call locations(person)
175
192
/* test for inclusion of this individual as a root */
176
if (child) { set(include,0) } else { set(include,1) }
178
if (not(lookup(ahn_table,key(person)))) {
179
insert(ahn_table,key(person),ahnen)
181
if (strcmp(soundex(person),soundex(child))) {
186
if (or(father(child),
187
strcmp(soundex(person),soundex(child)))) {
195
if (strcmp(soundex(person),soundex(child))) {
197
} elsif (and(female(person),father(child))) {
200
} else { set(include,1) }
202
enqueue(i_list,person)
203
insert(i_table,save(key(person)),ahnen)
204
enqueue(a_list,ahnen)
206
enqueue(s_list,save(mysurname(person)))
194
enqueue(i_list,person)
195
insert(i_table,save(key(person)),ahnen)
196
enqueue(a_list,ahnen)
198
enqueue(s_list,save(surname(person)))
201
209
/* iterate into working lists */
203
set(ahnen,mul(ahnen,2))
204
if (f,father(person)) {
205
enqueue(work_i_list,f)
206
enqueue(work_a_list,ahnen)
207
enqueue(work_g_list,gen)
208
enqueue(work_c_list,person)
210
if (m,mother(person)) {
211
enqueue(work_i_list,m)
212
enqueue(work_a_list,add(ahnen,1))
213
enqueue(work_g_list,gen)
214
enqueue(work_c_list,person)
211
set(ahnen,mul(ahnen,2))
212
if (f,father(person)) {
213
enqueue(work_i_list,f)
214
enqueue(work_a_list,ahnen)
215
enqueue(work_g_list,gen)
216
enqueue(work_c_list,person)
218
if (m,mother(person)) {
219
enqueue(work_i_list,m)
220
enqueue(work_a_list,add(ahnen,1))
221
enqueue(work_g_list,gen)
222
enqueue(work_c_list,person)
218
227
call section("Orte")
220
call quicksort(locationsurname_list,index_list)
229
list(trans_locsur_list)
230
call translate(locationsurname_list,trans_locsur_list)
231
call quicksort(trans_locsur_list,index_list)
221
232
set(prevplace,"zzznowhere")
222
233
set(prevsurname,"zzznoone")
223
234
set(prevfirstplace,"zzznothere")
224
237
forlist(index_list,index,i) {
225
238
set(locationsurname,getel(locationsurname_list,index))
227
240
extracttokens(locationsurname,ls,nls,":")
228
241
set(location,getel(ls,1))
229
242
set(surname,getel(ls,2))
243
set(years,lookup(locationsurname_table,locationsurname))
230
244
if (strcmp(location,prevplace)) {
245
if (strcmp(prevplace,"zzznowhere")) {
248
if (ne(yearfrom,yearto)) {
255
set(yearfrom,getel(years,1))
256
set(yearto,getel(years,2))
232
257
list(placenamelist)
233
258
extracttokens(location,placenamelist,nplaces,",")
234
259
set(name,getel(placenamelist,1))
292
334
proc doline(person_index) {
293
335
set(person,getel(i_list,person_index))
294
if (not(lookup(prev_table,key(person)))) {
296
if (html) { "<H3>" } else { "\n" }
337
if (html) { "<H3>" } else { "\n" }
297
338
/* First pass to print out appropriate surnames */
298
table(prev_surname_table)
300
insert(prev_surname_table,save(surname(person)),1)
301
while (person,father(person)) {
302
set(prev_ahn,lookup(i_table,key(person)))
304
set(prev_ahn,lookup(prev_table,key(person)))
309
set(s,save(surname(person)))
310
if (not(lookup(prev_surname_table,s))) {
312
insert(prev_surname_table,s,1)
339
table(prev_surname_table)
340
autohtml(mysurname(person))
341
insert(prev_surname_table,save(mysurname(person)),1)
342
while (person,father(person)) {
343
if (lookup(i_table,key(person))) {
346
set(s,save(mysurname(person)))
347
if (not(lookup(prev_surname_table,s))) {
349
insert(prev_surname_table,s,1)
316
if (html) { "</H3>" }
353
if (html) { "</H3>" }
319
356
/* Second pass to print out detailed information */
320
set(person,getel(i_list,person_index))
321
set(gen,getel(g_list,person_index))
322
set(ahn,getel(a_list,person_index))
323
call doperson(person,gen,ahn)
324
while (person,father(person)) {
326
set(ahn,add(ahn,ahn))
327
set(prev_ahn,lookup(i_table,key(person)))
329
set(prev_ahn,lookup(prev_table,key(person)))
332
bold if (lt(gen,10)) { "0" } d(gen) " " d(ahn) unbold " "
333
fullname(person,0,1,80) " siehe "
334
set(gen2,ahn2gen(prev_ahn))
335
if (lt(gen2,10)) { "0" } d(gen2) " " d(prev_ahn) "." br
338
call doperson(person,gen,ahn)
339
insert(prev_table,key(person),ahn)
357
set(person,getel(i_list,person_index))
358
set(gen,getel(g_list,person_index))
359
set(ahn,getel(a_list,person_index))
360
call doperson(person,gen,ahn)
361
while (person,father(person)) {
363
set(ahn,add(ahn,ahn))
364
set(prev_ahn,lookup(i_table,key(person))) /* stop if person is a key... */
366
set(prev_ahn,lookup(ahn_table,key(person)))
367
if (eq(prev_ahn,ahn)) { set(prev_ahn,0) } /* or if we did them already */
370
bold if (lt(gen,10)) { "0" } d(gen) " " d(ahn) unbold " "
371
autohtml(fullname(person,0,1,80)) " siehe "
372
set(gen2,ahn2gen(prev_ahn))
373
if (lt(gen2,10)) { "0" } d(gen2) " " d(prev_ahn) "." br
376
call doperson(person,gen,ahn)
432
483
proc locations(person) {
433
call one_location(burial(person),surname(person))
434
call one_location(death(person),surname(person))
484
call one_location(burial(person),mysurname(person),death(person))
485
call one_location(death(person),mysurname(person),burial(person))
435
486
if (female(person)) {
436
families(person,family,husband,fnum) { "" } /* find last husband */
437
call one_location(burial(person),surname(husband))
438
call one_location(death(person),surname(husband))
487
families(person,family,husband,fnum) { set(lasthusband,husband) } /* find last husband */
488
call one_location(burial(person),mysurname(lasthusband),death(person))
489
call one_location(death(person),mysurname(lasthusband),burial(person))
440
491
families(person,family,spouse,fnum) {
441
call one_location(marriage(family),surname(person))
442
call one_location(marriage(family),surname(spouse))
492
call one_location(marriage(family),mysurname(person),0)
493
call one_location(marriage(family),mysurname(spouse),0)
444
call one_location(baptism(person),surname(person))
445
call one_location(birth(person),surname(person))
495
call one_location(baptism(person),mysurname(person),birth(person))
496
call one_location(birth(person),mysurname(person),baptism(person))
448
proc one_location(event,surname) {
499
proc one_location(event,surname,event2) {
450
501
set(loc,place(event))
502
set(yr,atoi(year(event)))
503
if (not(yr)) { set(yr,atoi(year(event2))) }
504
if (not(yr)) { set(yr,0) }
451
505
if (strlen(loc)) {
506
set(loc,locfilter(loc))
452
507
set(locsur,concat(loc,":",surname))
453
508
if (not(lookup(locationsurname_table,locsur))) {
454
insert(locationsurname_table,save(locsur),1)
510
setel(locsuryears,1,yr)
511
setel(locsuryears,2,yr)
512
insert(locationsurname_table,save(locsur),locsuryears)
455
513
enqueue(locationsurname_list,save(locsur))
515
set(locsuryears,lookup(locationsurname_table,locsur))
516
if (lt(yr,getel(locsuryears,1))) {
517
setel(locsuryears,1,yr)
518
} elsif (gt(yr,getel(locsuryears,2))) {
519
setel(locsuryears,2,yr)
521
if (eq(getel(locsuryears,1),0)) {
522
setel(locsuryears,1,yr)
529
/* remove unneeded location info from location name */
530
func locfilter(string) {
531
set(string,strfilterstart(string,"near "))
532
set(string,strfilter(string,"?"))
536
/* remove a string at the start of another string, if present */
537
func strfilterstart(string,start) {
538
if (strcmp(substring(string,1,strlen(start)),start)) {
541
return(substring(string,add(strlen(start),1),strlen(string)))
544
/* remove a string from another string, multiple times if needed */
545
func strfilter(string,sub) {
546
while (m,index(string,sub,1)) {
547
set(string,concat(substring(string,1,sub(m,1)),
548
substring(string,add(m,strlen(sub)),strlen(string))))
553
/* translate a string but only if html global is set */
554
func autohtml(string) {
555
if (html) { return(strxlat(html_xlat,string)) }
559
/* translate a whole list via sort_xlat to a sortable list */
560
proc translate(listin,listout) {
561
forlist(listin,element,i) {
562
enqueue(listout,strxlat(sort_xlat,element))
566
/* translate string according to xlat table */
567
func strxlat(xlat,string) {
569
set(pos,strlen(string))
571
set(char,substring(string,pos,pos))
572
if (special,lookup(xlat,char)) {
573
set(fixstring,concat(special,fixstring))
575
else { set(fixstring,concat(char,fixstring)) }
582
/* This initializes the various translation tables.
583
Note that these use the Macintosh encoding scheme!
586
/* Translation table for sorting purposes.
587
Note that this is mostly to handle German characters.
589
insert(sort_xlat,"�","oe")
590
insert(sort_xlat,"�","oe")
591
insert(sort_xlat,"�","ue")
592
insert(sort_xlat,"�","ue")
593
insert(sort_xlat,"�","ae")
594
insert(sort_xlat,"�","ae")
595
insert(sort_xlat,"�","ss")
596
insert(sort_xlat,"�","ss")
597
insert(sort_xlat,"�","Ae")
598
insert(sort_xlat,"�","Ae")
599
insert(sort_xlat,"�","Oe")
600
insert(sort_xlat,"�","Oe")
601
insert(sort_xlat,"�","Ue")
602
insert(sort_xlat,"�","Ue")
603
insert(sort_xlat,"�","e")
604
insert(sort_xlat,"�","e")
605
insert(sort_xlat,"�","y")
606
insert(sort_xlat,"�","y")
607
insert(sort_xlat,"�","e")
608
insert(sort_xlat,"�","e")
609
insert(sort_xlat,"�","n~")
610
insert(sort_xlat,"�","n~")
611
insert(sort_xlat,"�","oe")
612
insert(sort_xlat,"�","oe")
614
/* For the full list of HTML encodings for special characters, see
615
http://info.cern.ch/hypertext/WWW/MarkUp/ISOlat1.html
617
insert(html_xlat,"�","ö")
618
insert(html_xlat,"�","ö")
619
insert(html_xlat,"�","ü")
620
insert(html_xlat,"�","ü")
621
insert(html_xlat,"�","ä")
622
insert(html_xlat,"�","ä")
623
insert(html_xlat,"�","ß")
624
insert(html_xlat,"�","ß")
625
insert(html_xlat,"�","Ä")
626
insert(html_xlat,"�","Ä")
627
insert(html_xlat,"�","Ö")
628
insert(html_xlat,"�","Ö")
629
insert(html_xlat,"�","Ü")
630
insert(html_xlat,"�","Ü")
631
insert(html_xlat,"�","ë")
632
insert(html_xlat,"�","ë")
633
insert(html_xlat,"�","ÿ")
634
insert(html_xlat,"�","ÿ")
635
insert(html_xlat,"�","é")
636
insert(html_xlat,"�","é")
637
insert(html_xlat,"&","&")
638
insert(html_xlat,"�","ñ")
639
insert(html_xlat,"�","ñ")
640
insert(html_xlat,"�","œ")
641
insert(html_xlat,"�","œ")
643
/* ISO 8859 translation for the GENDEX.txt file
645
insert(ISO8859_xlat,"�","�")
646
insert(ISO8859_xlat,"�","�")
647
insert(ISO8859_xlat,"�","�")
648
insert(ISO8859_xlat,"�","�")
649
insert(ISO8859_xlat,"�","�")
650
insert(ISO8859_xlat,"�","�")
651
insert(ISO8859_xlat,"�","�")
652
insert(ISO8859_xlat,"�","�")
653
insert(ISO8859_xlat,"�","�")
654
insert(ISO8859_xlat,"�","�")
655
insert(ISO8859_xlat,"�","�")
656
insert(ISO8859_xlat,"�","�")
462
660
quicksort: Sort an input list by generating a permuted index list
463
661
Input: alist - list to be sorted