| 1 |
/* |
| 2 |
* @progname anniver.ll |
| 3 |
* @version 4.0 |
| 4 |
* @author Stephen Dum |
| 5 |
* @category |
| 6 |
* @output HTML |
| 7 |
* @description |
| 8 |
|
| 9 |
Generate calendar of birth, death, marriage events arranged by the month |
| 10 |
and day that they occurred. Generates a top level index calendar, with actual |
| 11 |
events stored in a separate html file for each month. |
| 12 |
Some properties must be set in your lifelines configuration file for this |
| 13 |
report to run, see comments at beginning of the report for details. |
| 14 |
|
| 15 |
Warning, this report requires lifelines version 3.0.50 or later. |
| 16 |
|
| 17 |
by Stephen Dum ([email protected]) |
| 18 |
Version 1 March 2003 |
| 19 |
Version 2 November 2005 Support privitizing data |
| 20 |
Version 3 December 2005 Do html char set encoding |
| 21 |
Version 4 June 2006 incorporated mods by Dave Eaton ([email protected]) May 2006 |
| 22 |
|
| 23 |
This program was inspired by similar efforts by Mitch Blank ([email protected]) |
| 24 |
but without ever seeing the code he used to do a similar thing. |
| 25 |
|
| 26 |
Originally this program used getel and setel to access the dates and events |
| 27 |
lists and to sort them. It ran about 400 seconds on 11850 element lists. |
| 28 |
Conversations between myself and Perry Rapp about sorting the large lists |
| 29 |
created by this program led to the sort and rsort functions being added to |
| 30 |
the report language. This program uses them. Also care was taken to avoid |
| 31 |
using getel or setel functions on the dates and events lists as random access |
| 32 |
to very large lists is very slow. With these changes run time dropped to 10 |
| 33 |
seconds. |
| 34 |
|
| 35 |
Before using, there are a few properties that need to be customized for your |
| 36 |
own environment so add them to your .linesrc ( or for windows lines.cfg) file. |
| 37 |
You can also set them on the command line (like -Ianniver.htmldir=/tmp/foo) |
| 38 |
The properties that are looked up are: |
| 39 |
user.fullname -- name of the database owner |
| 40 |
user.email -- email address of the db owner |
| 41 |
anniver.htmldir -- path to the directory to store results in |
| 42 |
e.g. /home/joe/genealogy/html |
| 43 |
(program expects a subdir in this directory with the name |
| 44 |
of the database in it.) |
| 45 |
anniver.backgroundimage -- path to the background image, |
| 46 |
no image if not defined. |
| 47 |
e.g. ../../image/crink.jpg |
| 48 |
this places image at the same level as /home/joe/genealogy/html |
| 49 |
privatization: This report respects 2 levels of privatization |
| 50 |
1. if a record "RESN confidential" exists on an individual they are |
| 51 |
skipped (as this report is designed to be shared, this seems |
| 52 |
like a reasonable default) |
| 53 |
2. skip anyone estimated to be living |
| 54 |
|
| 55 |
History. |
| 56 |
Version 2 Add code to allow respecting privatized data. |
| 57 |
Version 3 switch from baptism() to get_baptism() for wider coverage |
| 58 |
use translation tables to convert data to properly |
| 59 |
escaped html. This is very codeset dependent. |
| 60 |
Version 4 added changes by Dave Eaton ([email protected]) |
| 61 |
Added "firstyear" that events may be on the calendar |
| 62 |
Added "includedeath" check to drop deaths if those are not desired |
| 63 |
Added ability to generate report for descendants of more than one |
| 64 |
individual |
| 65 |
Added ability to generate report only for living people |
| 66 |
(omitting confidential if desired) |
| 67 |
*/ |
| 68 |
|
| 69 |
/* customization globals */ |
| 70 |
char_encoding("ASCII") |
| 71 |
option("explicitvars") |
| 72 |
|
| 73 |
global(base_filename) /* where to store the results */ |
| 74 |
global(background) /* path of background image relative to final html |
| 75 |
* location, or "" */ |
| 76 |
global(hi_bg_color) /* highlighted year background color */ |
| 77 |
global(lo_bg_color) /* non-highlighted year background color */ |
| 78 |
|
| 79 |
global(db_owner) /* name of database owner - from config file */ |
| 80 |
global(owner_email) /* email of database owner - from config file */ |
| 81 |
global(justliving) /* should we generate a report only for living people? */ |
| 82 |
global(privatize) /* should we privatize the data |
| 83 |
* 0 = display all data |
| 84 |
* 1 = skip confidential records |
| 85 |
* 2 = skip confidential and living |
| 86 |
*/ |
| 87 |
global(withkey) /* should we include key's in the output */ |
| 88 |
global(cutoff_year) /* 100 years before today */ |
| 89 |
/* birth >= cutoff_year is about 101 years, |
| 90 |
* and we consider person living */ |
| 91 |
|
| 92 |
global(firstyear) /* earliest year for which entries should be included */ |
| 93 |
global(includedeath) /* if set, then include the death events on the calendar */ |
| 94 |
|
| 95 |
global(month_name) /* names of the months */ |
| 96 |
global(events) /* list of events to print */ |
| 97 |
global(dates) /* list of dates of the events */ |
| 98 |
global(keynames) /* name(s) of the key individuals for this report */ |
| 99 |
|
| 100 |
proc main () |
| 101 |
{ |
| 102 |
/* initialization of globals */ |
| 103 |
|
| 104 |
set(hi_bg_color,"\"#ddb99f\"") |
| 105 |
set(lo_bg_color,"\"#e5d3c5\"") |
| 106 |
|
| 107 |
set(db_owner, getproperty("user.fullname")) |
| 108 |
set(owner_email, concat("mailto:",getproperty("user.email"))) |
| 109 |
set(background,getproperty("anniver.backgroundimage")) |
| 110 |
set(base_filename,concat(getproperty("anniver.htmldir"),"/",database(),"/")) |
| 111 |
if (not(test("d",base_filename))) { |
| 112 |
print("Error, property anniver.htmldir=",base_filename, |
| 113 |
", is not a directory,aborting\n") |
| 114 |
print("Please read comments at beginning of report about setting properties\n") |
| 115 |
return() |
| 116 |
} |
| 117 |
|
| 118 |
/* other globals*/ |
| 119 |
list(month_name) |
| 120 |
enqueue(month_name,"January") |
| 121 |
enqueue(month_name,"February") |
| 122 |
enqueue(month_name,"March") |
| 123 |
enqueue(month_name,"April") |
| 124 |
enqueue(month_name,"May") |
| 125 |
enqueue(month_name,"June") |
| 126 |
enqueue(month_name,"July") |
| 127 |
enqueue(month_name,"August") |
| 128 |
enqueue(month_name,"September") |
| 129 |
enqueue(month_name,"October") |
| 130 |
enqueue(month_name,"November") |
| 131 |
enqueue(month_name,"December") |
| 132 |
|
| 133 |
extractdate(gettoday(),day,mon,cutoff_year) |
| 134 |
decr(cutoff_year,100) |
| 135 |
set(cs,getproperty("codeset")) |
| 136 |
if (eqstr(cs,"UTF-8")) { |
| 137 |
set(srccs,"UTF-8") |
| 138 |
set(dstcs,"UTF-8//html") |
| 139 |
} elsif (eqstr(cs,"ISO-8859-15")) { |
| 140 |
set(srccs,"ISO-8859-15//html") |
| 141 |
set(dstcs,"UTF-8") |
| 142 |
} else { |
| 143 |
print("\nDatabase codeset ",cs," not supported, exiting\n") |
| 144 |
} |
| 145 |
|
| 146 |
/* end of initialization of globals */ |
| 147 |
|
| 148 |
getint(justliving,"Enter 1 to include only living people, 0 otherwise") |
| 149 |
if (justliving) { |
| 150 |
/* Default the choices which conflict with "justliving" */ |
| 151 |
set(includedeath,0) |
| 152 |
/* We want living people, so see if we also want confidental */ |
| 153 |
getint(noconfidential,"Enter 1 to omit confidential living people, 0 otherwise") |
| 154 |
if (noconfidential) { |
| 155 |
set(privatize,1) |
| 156 |
} else { |
| 157 |
set(privatize,0) |
| 158 |
} |
| 159 |
} else { |
| 160 |
getint(privatize,"\nPrivatization: 0 print all data; 1 skip confidential records; 2 skip confidential and living") |
| 161 |
getint(includedeath,"Enter 1 to include deaths on calendar, 0 otherwise") |
| 162 |
} |
| 163 |
getint(withkey,"Enter 1 to include keys, 0 otherwise") |
| 164 |
getint(firstyear,"Enter oldest year to be on calendar, 0 for no limit") |
| 165 |
getindi(person,"Enter person for whom to find descendants (return for all)") |
| 166 |
indiset(thisgen) |
| 167 |
indiset(allgen) |
| 168 |
list(events) |
| 169 |
list(dates) |
| 170 |
list(keynames) |
| 171 |
set(firstpass,1) |
| 172 |
/* if a person is entered, the generated list of people include |
| 173 |
* person and spouse, and all the children of either |
| 174 |
* and then recursively the people, their spouses and all the children |
| 175 |
* thereof |
| 176 |
*/ |
| 177 |
if (person) { |
| 178 |
while (person) { |
| 179 |
addtoset(thisgen, person, 0) |
| 180 |
addtoset(allgen, person, 0) |
| 181 |
print("Computing descendants of ", name(person), " ") |
| 182 |
enqueue(keynames,concat(name(person))) |
| 183 |
set(thisgensize,1) |
| 184 |
set(gen,neg(1)) |
| 185 |
while(thisgensize) { |
| 186 |
set(gen,add(gen,1)) |
| 187 |
print("adding ",d(thisgensize)," individuals for generation ",d(gen),"\n") |
| 188 |
indiset(spouse) |
| 189 |
set(spouse,spouseset(thisgen)) |
| 190 |
set(thisgen,childset(union(thisgen,spouse))) |
| 191 |
set(allgen,union(allgen,spouse)) |
| 192 |
set(allgen,union(allgen,thisgen)) |
| 193 |
set(thisgensize,length(thisgen)) |
| 194 |
/* the following check prevents looping if the |
| 195 |
* database has been corrupted and a parent is listed |
| 196 |
* as a child of that parent, and diagnoses the fault |
| 197 |
*/ |
| 198 |
if (eq(length(intersect(allgen,thisgen)),thisgensize)) { |
| 199 |
set(thisgensize,0) |
| 200 |
print("Warning child is listed as its own parent\n") |
| 201 |
forindiset(thisgen,indi,val,i) { |
| 202 |
print (name(indi)," ") |
| 203 |
} |
| 204 |
print("\n") |
| 205 |
} |
| 206 |
} |
| 207 |
if (firstpass) { |
| 208 |
print ("Total of ") |
| 209 |
set(firstpass,0) |
| 210 |
} else { |
| 211 |
print ("New total of ") |
| 212 |
} |
| 213 |
print (d(length(allgen))," individuals",nl()) |
| 214 |
getindi(person,"Enter next person for whom to find descendants") |
| 215 |
} |
| 216 |
/* now generate list of events */ |
| 217 |
forindiset(allgen,indi,val,i) { |
| 218 |
if (not(mod(i,100))) { |
| 219 |
print(".") |
| 220 |
} |
| 221 |
call add_indi(indi) |
| 222 |
} |
| 223 |
print("\n") |
| 224 |
} else { |
| 225 |
print("Traversing all individuals ") |
| 226 |
forindi (indi, val) { |
| 227 |
if (not(mod(val,100))) { |
| 228 |
print(".") |
| 229 |
} |
| 230 |
call add_indi(indi) |
| 231 |
set(max,val) |
| 232 |
} |
| 233 |
print (nl(), "Total of ",d(max)," individuals",nl()) |
| 234 |
} |
| 235 |
print( d(length(dates))," events generated",nl()) |
| 236 |
|
| 237 |
print("sorting data") |
| 238 |
rsort(events,dates) |
| 239 |
|
| 240 |
/* Now print out all the data for each month |
| 241 |
*/ |
| 242 |
print(nl()) |
| 243 |
|
| 244 |
list(daymask) |
| 245 |
set(dm_day,1) /* last day dealt with */ |
| 246 |
set(mask,1) /* mask for this day */ |
| 247 |
set(lastday,-1) |
| 248 |
set(lastmonth,-1) |
| 249 |
set(in_day,0) |
| 250 |
while(length(dates)) { |
| 251 |
set(val,pop(dates)) |
| 252 |
set(event,pop(events)) |
| 253 |
set(month,div(val,1000000)) |
| 254 |
set(year,mod(val,1000000)) |
| 255 |
set(day,div(year,10000)) |
| 256 |
set(year,mod(val,10000)) |
| 257 |
|
| 258 |
if (ne(lastmonth,month)) { |
| 259 |
if (ne(lastmonth,-1)) { |
| 260 |
if (in_day) { |
| 261 |
"</table>\n" |
| 262 |
} |
| 263 |
call write_tail() |
| 264 |
setel(daymask,lastmonth,dm) |
| 265 |
} |
| 266 |
set(lastday,-1) |
| 267 |
set(dm,0) |
| 268 |
set(dm_day,1) |
| 269 |
set(mask,1) |
| 270 |
set(m_name, getel(month_name,month)) |
| 271 |
call openfile(lower(m_name),concat(m_name," Anniversary Dates")) |
| 272 |
set(lastmonth,month) |
| 273 |
} |
| 274 |
if (ne(lastday,day)) { |
| 275 |
if (ne(lastday,-1)) { |
| 276 |
if (in_day) { |
| 277 |
"</table>\n" |
| 278 |
} |
| 279 |
} |
| 280 |
if (lastday,day) { |
| 281 |
while(lt(dm_day,day)) { |
| 282 |
incr(dm_day) |
| 283 |
set(mask,add(mask,mask)) |
| 284 |
} |
| 285 |
set(dm,add(dm,mask)) |
| 286 |
"<p><a name=" d(day) "><B>" m_name " " d(day) "</b></a>\n" |
| 287 |
"<table>\n" |
| 288 |
} else { |
| 289 |
/* don't know day, so just generic month */ |
| 290 |
"<p><B>" m_name "</b>\n" |
| 291 |
"<table>\n" |
| 292 |
} |
| 293 |
set(in_day,1) |
| 294 |
} |
| 295 |
"<tr>\n<td width=\"70\" valign=top align=center><font size=4><b>" |
| 296 |
if (year) { |
| 297 |
d(year) |
| 298 |
} else { |
| 299 |
" " |
| 300 |
} |
| 301 |
"</b></font>" nl() |
| 302 |
"<td><font size=4>" |
| 303 |
if (srccs) { |
| 304 |
convertcode(event,srccs,dstcs) |
| 305 |
} else { |
| 306 |
event |
| 307 |
} |
| 308 |
"</font></td>" nl() |
| 309 |
} |
| 310 |
if (ne(lastmonth,-1)) { |
| 311 |
if (in_day) { |
| 312 |
"</table>\n" |
| 313 |
} |
| 314 |
call write_tail() |
| 315 |
setel(daymask,lastmonth,dm) |
| 316 |
} |
| 317 |
|
| 318 |
/* Now print out the calendar page indexing the individual month files */ |
| 319 |
|
| 320 |
/* debug print out month masks |
| 321 |
set(i,1) |
| 322 |
while(le(i,12)) { |
| 323 |
set(dm,getel(daymask,i)) |
| 324 |
print( "Month ",d(i)," ") |
| 325 |
while(dm) { |
| 326 |
print( d(mod(dm,2))) |
| 327 |
set(dm,div(dm,2)) |
| 328 |
} |
| 329 |
print(nl()) |
| 330 |
incr(i) |
| 331 |
} |
| 332 |
*/ |
| 333 |
|
| 334 |
call openfile("annver","Calendar of Anniversary Dates") |
| 335 |
"<p>This calendar of anniversary dates lists events" nl() |
| 336 |
if (firstyear) { |
| 337 |
"since " d(firstyear) nl() |
| 338 |
} |
| 339 |
if (justliving) { |
| 340 |
"of living people" nl() |
| 341 |
} |
| 342 |
"arranged by the" nl() |
| 343 |
"month and day that they occurred." nl() |
| 344 |
if (not(includedeath)) { |
| 345 |
"<!-- Diagnostic: death events not included -->" nl() |
| 346 |
} |
| 347 |
if (length(keynames)) { |
| 348 |
"<br>Events listed are for descendants of:" nl() |
| 349 |
while(length(keynames)) { |
| 350 |
set(nxtname,pop(keynames)) |
| 351 |
set(nameout,length(keynames)) |
| 352 |
nxtname |
| 353 |
if (nameout) { |
| 354 |
"," |
| 355 |
} else { |
| 356 |
"." |
| 357 |
} |
| 358 |
nl() |
| 359 |
} |
| 360 |
} |
| 361 |
"</p>" nl() |
| 362 |
"<p>Click on the month name or any highlighted day to see the events" nl() |
| 363 |
"for that time.</p>" nl() |
| 364 |
"<hr>" nl() |
| 365 |
"<table border=4 width=\"99%\">" nl() |
| 366 |
|
| 367 |
/* The calendar is arranged with 4 months across |
| 368 |
* so we need to process 4 months at a time */ |
| 369 |
list(month_len) |
| 370 |
enqueue(month_len,31) |
| 371 |
enqueue(month_len,29) |
| 372 |
enqueue(month_len,31) |
| 373 |
enqueue(month_len,30) |
| 374 |
enqueue(month_len,31) |
| 375 |
enqueue(month_len,30) |
| 376 |
enqueue(month_len,31) |
| 377 |
enqueue(month_len,31) |
| 378 |
enqueue(month_len,30) |
| 379 |
enqueue(month_len,31) |
| 380 |
enqueue(month_len,30) |
| 381 |
enqueue(month_len,31) |
| 382 |
list(inds) |
| 383 |
set(i,0) /* i iterates over 3 chunks of 4 months */ |
| 384 |
while(le(i,2)) { |
| 385 |
/* generate the headings */ |
| 386 |
"<tr>" nl() |
| 387 |
set(j,1) |
| 388 |
while(le(j,4)) { |
| 389 |
"<td bgcolor=" hi_bg_color |
| 390 |
" colspan=7 align=center><font size=5>" nl() |
| 391 |
set(m_name,getel(month_name,add(mul(i,4),j))) |
| 392 |
"<a href=\"" lower(m_name) ".html\">" m_name "</a>" nl() |
| 393 |
"</font></td>" nl() |
| 394 |
"<td></td>" nl() |
| 395 |
incr(j) |
| 396 |
} |
| 397 |
"</tr>" nl() |
| 398 |
|
| 399 |
/* now compute the starting indexes for each month */ |
| 400 |
|
| 401 |
set(wk,0) |
| 402 |
while(le(wk,4)) { /* for each of the 5 weeks in the months */ |
| 403 |
|
| 404 |
"<tr>" nl() /* start a row in the table */ |
| 405 |
set(k,0) |
| 406 |
while(le(k,3)) { /* for each of the 4 months in this line */ |
| 407 |
set(mon,add(mul(i,4),k,1)) |
| 408 |
set(m_name,getel(month_name,mon)) |
| 409 |
set(m_len,getel(month_len,mon)) |
| 410 |
set(ind,getel(daymask,mon)) |
| 411 |
set(day,add(mul(wk,7),1)) |
| 412 |
|
| 413 |
set(l,1) |
| 414 |
while(le(l,7)) { /* for each of the 7 days in a week */ |
| 415 |
|
| 416 |
/* do a day */ |
| 417 |
if (gt(day,m_len)) { |
| 418 |
/* empty square */ |
| 419 |
"<td></td>" nl() |
| 420 |
} elsif(mod(ind,2)) { |
| 421 |
/* linked square */ |
| 422 |
"<td bgcolor=" hi_bg_color |
| 423 |
" align=center><font size=4><a href=\"" |
| 424 |
lower(m_name) ".html#" d(day) "\">" |
| 425 |
d(day) "</a>" nl() |
| 426 |
"</font></td>" nl() |
| 427 |
} else { |
| 428 |
/* output transparent number */ |
| 429 |
"<td bgcolor=" lo_bg_color |
| 430 |
" align=center><font size=4>" |
| 431 |
d(day) "</font></td>" nl() |
| 432 |
} |
| 433 |
incr(day) |
| 434 |
incr(l) |
| 435 |
set(ind,div(ind,2)) |
| 436 |
} |
| 437 |
if (ne(k,3)) { /* add separator between months */ |
| 438 |
"<td></td>" nl() |
| 439 |
} |
| 440 |
setel(daymask,mon,ind) /* save away latest day mask */ |
| 441 |
incr(k) |
| 442 |
} |
| 443 |
"</tr>" nl() |
| 444 |
incr(wk) |
| 445 |
} |
| 446 |
"<tr><td colspan=31></td></tr>" nl() |
| 447 |
incr(i) |
| 448 |
} |
| 449 |
"</table>\n" |
| 450 |
call write_tail() |
| 451 |
} |
| 452 |
|
| 453 |
/* openfile(filename, title_to_use) |
| 454 |
* open output file and write out header information |
| 455 |
*/ |
| 456 |
proc openfile(name,title) { |
| 457 |
set(filename, concat(base_filename,name,".html")) |
| 458 |
print("Writing ", filename, "\n") |
| 459 |
newfile(filename, 0) |
| 460 |
|
| 461 |
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 462 |
"<!DOCTYPE html public \"-//W3C//DTD HTML 4.01 Transitional//EN\" >\n" |
| 463 |
"<html>\n<head>\n" |
| 464 |
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n" |
| 465 |
"<title> " title " </title>\n" |
| 466 |
"<style type=\"text/css\">\n" |
| 467 |
"p.hindent { margin-top: 0.2em; margin-bottom:0em;\n" |
| 468 |
" text-indent: -2em; padding-left: 2em;}\n" |
| 469 |
"p.indent { margin-top: 0.2em; margin-bottom:0em;\n" |
| 470 |
" text-indent: 0em; padding-left: 2em;}\n" |
| 471 |
"</style>\n" |
| 472 |
"</head>\n" |
| 473 |
if (eqstr(background,"")) { |
| 474 |
"<body bgcolor=" lo_bg_color ">\n" |
| 475 |
} else { |
| 476 |
"<body bgcolor=" lo_bg_color " background=\"" background "\">\n" |
| 477 |
} |
| 478 |
"<center><h1>" title "</h1></center>\n<hr>\n" |
| 479 |
} |
| 480 |
|
| 481 |
/* write_tail() |
| 482 |
* write out common footer information for file. |
| 483 |
*/ |
| 484 |
proc write_tail() { |
| 485 |
"<br><hr><address>\n" |
| 486 |
monthformat(6) |
| 487 |
"This page was created " stddate(gettoday()) |
| 488 |
"<br>\n" |
| 489 |
"Database maintained by " |
| 490 |
"<a href=\"" owner_email "\">\n" |
| 491 |
db_owner |
| 492 |
"</a></address>\n" |
| 493 |
"<!- generated by lifelines (http://lifelines.sourceforge.net/) with a" nl() |
| 494 |
"script written by Stephen Dum -->" nl() |
| 495 |
|
| 496 |
"</body></html>\n" |
| 497 |
} |
| 498 |
|
| 499 |
/* add_indi(individual) |
| 500 |
* check a given individual and see if there are any events to add |
| 501 |
* at the moment we do birth, death and marriage events. |
| 502 |
* Additional events can be added here |
| 503 |
*/ |
| 504 |
proc add_indi(indi) { |
| 505 |
set(birth_type,0) |
| 506 |
if (birth,birth(indi)) { |
| 507 |
set(birth,get_date(birth)) |
| 508 |
set(birth_type," born") |
| 509 |
} elsif (birth, get_baptism(indi)) { |
| 510 |
set(birth,get_date(birth)) |
| 511 |
set(birth_type," baptized") |
| 512 |
} |
| 513 |
set(death_type,0) |
| 514 |
if (death,death(indi)) { |
| 515 |
set(death,get_date(death)) |
| 516 |
set(death_type," died") |
| 517 |
} elsif (death, burial(indi)) { |
| 518 |
set(death,get_date(death)) |
| 519 |
set(death_type," buried") |
| 520 |
} |
| 521 |
/* skip confidential records and living people */ |
| 522 |
if (privatize) { |
| 523 |
if (confidential(indi)) { return() } |
| 524 |
|
| 525 |
/* living - birth, no death, and birth < 101 years ago */ |
| 526 |
if (and(ge(privatize,2),birth,not(death))) { |
| 527 |
if (ge(mod(birth,10000),cutoff_year)) { return()} |
| 528 |
} |
| 529 |
} |
| 530 |
if (birth) { |
| 531 |
/* Make certain that if we only want living people that this is |
| 532 |
(or at least may be) */ |
| 533 |
if (not(or(and(justliving,death),and(justliving,lt(mod(birth,10000),cutoff_year))))) { |
| 534 |
if (withkey) { |
| 535 |
enqueue(events,concat(name(indi),"(",key(indi),")",birth_type)) |
| 536 |
} else { |
| 537 |
enqueue(events,concat(name(indi),birth_type)) |
| 538 |
} |
| 539 |
enqueue(dates,birth) |
| 540 |
} |
| 541 |
} |
| 542 |
if (and(includedeath,death)) { |
| 543 |
if (withkey) { |
| 544 |
enqueue(events,concat(name(indi),"(",key(indi),")",death_type)) |
| 545 |
} else { |
| 546 |
enqueue(events,concat(name(indi),death_type)) |
| 547 |
} |
| 548 |
enqueue(dates,death) |
| 549 |
} |
| 550 |
|
| 551 |
families(indi,famly, spouse, cnt) { |
| 552 |
/* skip confidential families */ |
| 553 |
if (confidential(famly)) { continue() } |
| 554 |
if (and(privatize,spouse)) { |
| 555 |
if (confidential(spouse)) { continue() } |
| 556 |
} |
| 557 |
if (justliving) { |
| 558 |
/* make sure the person is living: no death, birth and |
| 559 |
birth < 101 years ago */ |
| 560 |
/* Nope, we know they have died */ |
| 561 |
if (death) { return() } |
| 562 |
if (birth) { |
| 563 |
/* Nope, estimated they would be too old now */ |
| 564 |
if (lt(mod(birth,10000),cutoff_year)) { return() } |
| 565 |
} |
| 566 |
} |
| 567 |
/* living - birth, no death, and birth < 101 years ago */ |
| 568 |
if (ge(privatize,2)) { |
| 569 |
if (and(birth(spouse),not(death(spouse)))) { |
| 570 |
if (ge(mod(get_date(birth(spouse)),10000),cutoff_year)) { continue()} |
| 571 |
} |
| 572 |
} |
| 573 |
/* to avoid duplication, only enter data |
| 574 |
* if indi is male, or there is no spouse |
| 575 |
*/ |
| 576 |
if (or(male(indi),not(spouse))) { |
| 577 |
fornodes(fnode(famly), node) { |
| 578 |
if(eqstr(tag(node),"MARR")) { |
| 579 |
if (spouse) { |
| 580 |
set(names,concat(name(indi)," and ",name(spouse))) |
| 581 |
set(keys,concat("(",key(indi),",",key(spouse),")")) |
| 582 |
} else { |
| 583 |
set(names,name(indi)) |
| 584 |
set(keys,concat("(",key(indi),")")) |
| 585 |
} |
| 586 |
set(marr,get_date(node)) |
| 587 |
if (marr) { |
| 588 |
/* Make sure date is plausible for living or that we don't care */ |
| 589 |
if (or(not(justliving),ge(mod(marr,10000),cutoff_year))) { |
| 590 |
if (withkey) { |
| 591 |
enqueue(events,concat(names,keys," married")) |
| 592 |
} else { |
| 593 |
enqueue(events,concat(names," married")) |
| 594 |
} |
| 595 |
enqueue(dates,marr) |
| 596 |
} |
| 597 |
} |
| 598 |
} |
| 599 |
} |
| 600 |
} |
| 601 |
} |
| 602 |
} |
| 603 |
|
| 604 |
/* get_date(node) |
| 605 |
* if event node has a date associated with it return it encoded as |
| 606 |
* (mon * 100 + day) * 10000 + yr |
| 607 |
* These values facilitate sorting. |
| 608 |
*/ |
| 609 |
func get_date(node) |
| 610 |
{ |
| 611 |
extractdate(node,day,mon,yr) |
| 612 |
if (mon) { |
| 613 |
if (ge(yr,firstyear)) { |
| 614 |
return(add(mul(add(mul(mon,100),day),10000),yr)) |
| 615 |
} else { |
| 616 |
/* Nope, this one should not be on the calendar */ |
| 617 |
return(0) |
| 618 |
} |
| 619 |
} |
| 620 |
return(0) |
| 621 |
} |
| 622 |
|
| 623 |
func confidential(n) |
| 624 |
{ |
| 625 |
fornodes(n,node) { |
| 626 |
if (eqstr(tag(node),"RESN")) { |
| 627 |
if (eqstr(value(node),"confidential")) { |
| 628 |
return(1) |
| 629 |
} |
| 630 |
} |
| 631 |
} |
| 632 |
return(0) |
| 633 |
} |
| 634 |
func get_baptism(ind) |
| 635 |
{ |
| 636 |
fornodes(ind,node) { |
| 637 |
if (index(" BAPM BAPL CHR CHRA ",concat(" ",upper(tag(node))," "),1)) { |
| 638 |
return(node) |
| 639 |
} |
| 640 |
} |
| 641 |
return(0) |
| 642 |
} |