| 1 |
/* |
| 2 |
* @progname novel.ll |
| 3 |
* @version none |
| 4 |
* @author Wetmore, Manis, Stringer |
| 5 |
* @category |
| 6 |
* @output nroff |
| 7 |
* @description |
| 8 |
* |
| 9 |
* It will produce a report of all descendents and ancestors of a person |
| 10 |
* in book form. It understands a wide variety of gedcom records and |
| 11 |
* tries hard to produce a readable, personalised document. |
| 12 |
* |
| 13 |
* It prints a sorts listing of names, at the end of the report |
| 14 |
* of everyone in the report. All NOTE and CONT lines will |
| 15 |
* be printed in the this report. This report will produced |
| 16 |
* a paginated output. |
| 17 |
* |
| 18 |
* This report produces a nroff output, and to produce the |
| 19 |
* output, use: nroff -mm filename > filename.out |
| 20 |
* groff -mgm -Tascii filename >filename.out |
| 21 |
* groff -mgm filename >filename.ps [PostScript output] |
| 22 |
* |
| 23 |
* The report uses one additional file as input. |
| 24 |
* novel.intro is included at the beginning of the report and is where |
| 25 |
* you can put a general intoductory text. If you don't |
| 26 |
* provide this, it is skipped. A prototype is provided |
| 27 |
* along with this report. |
| 28 |
* |
| 29 |
* Original code by Tom Wetmore, [email protected] |
| 30 |
* with modifications by Cliff Manis |
| 31 |
* Extensively re-written by Phil Stringer [email protected] |
| 32 |
* Modified by Stephen Dum to remove external file dependencies and |
| 33 |
* to fix a y2k bug. |
| 34 |
* |
| 35 |
* This report works only with the LifeLines Genealogy program |
| 36 |
* |
| 37 |
*/ |
| 38 |
|
| 39 |
global(idex) |
| 40 |
global(curgen) |
| 41 |
global(glist) |
| 42 |
global(ilist) |
| 43 |
global(in) |
| 44 |
global(out) |
| 45 |
global(ftab) |
| 46 |
global(sid) |
| 47 |
global(lvd) |
| 48 |
global(enqc) |
| 49 |
global(enqp) |
| 50 |
global(stack) |
| 51 |
global(fac) /* First item after children */ |
| 52 |
global(itab) |
| 53 |
proc main () { |
| 54 |
getindi(indi) |
| 55 |
dayformat(2) |
| 56 |
monthformat(6) |
| 57 |
output_head() |
| 58 |
list(ilist) |
| 59 |
list(glist) |
| 60 |
list(stack) /* To hold function return values */ |
| 61 |
table(ftab) |
| 62 |
indiset(idex) |
| 63 |
table(sid) |
| 64 |
table(lvd) |
| 65 |
table(itab) |
| 66 |
enqueue(ilist,indi) |
| 67 |
enqueue(glist,0) |
| 68 |
set(curgen,0) |
| 69 |
set(out,1) |
| 70 |
set(in,2) |
| 71 |
".ds iN " name(indi) nl() |
| 72 |
".PH " qt() "''\\s+3\\fB" name(indi) sp() call fromto(indi) "\\s-3\\fR" qt() nl() |
| 73 |
|
| 74 |
if (test("f","novel.intro")) { |
| 75 |
copyfile("novel.intro") |
| 76 |
} |
| 77 |
|
| 78 |
print ("Descendants") print(nl()) |
| 79 |
".HU " qt() name(indi) " and " pn(indi,3) " descendants" qt() nl() |
| 80 |
set(enqc,1) set(enqp,0) |
| 81 |
call scan() |
| 82 |
|
| 83 |
print ("Ancestors") print(nl()) |
| 84 |
".HU " qt() "The ancestors of " name(indi) qt() nl() |
| 85 |
set(curgen,0) |
| 86 |
set(enqc,0) set(enqp,1) |
| 87 |
call enqpar(indi) |
| 88 |
call scan() |
| 89 |
|
| 90 |
call prindex() |
| 91 |
} |
| 92 |
|
| 93 |
proc enqpar(indi) { |
| 94 |
set(dad,father(indi)) |
| 95 |
if (dad) { |
| 96 |
set(g,sub(curgen,1)) |
| 97 |
enqueue(ilist,dad) |
| 98 |
enqueue(glist,g) |
| 99 |
insert(sid,key(dad),in) |
| 100 |
set(in,add(in,1)) |
| 101 |
} |
| 102 |
set(mom,mother(indi)) |
| 103 |
if (mom) { |
| 104 |
set(g,sub(curgen,1)) |
| 105 |
enqueue(ilist,mom) |
| 106 |
enqueue(glist,g) |
| 107 |
insert(sid,key(mom),in) |
| 108 |
set(in,add(in,1)) |
| 109 |
} |
| 110 |
} |
| 111 |
|
| 112 |
proc scan () { |
| 113 |
while (indi,dequeue(ilist)) { |
| 114 |
print(name(indi)) print(nl()) |
| 115 |
set(thisgen,dequeue(glist)) |
| 116 |
if (ne(curgen,thisgen)) { |
| 117 |
".GN " d(thisgen) nl() |
| 118 |
set(curgen,thisgen) |
| 119 |
} |
| 120 |
if (enqp) { |
| 121 |
call enqpar(indi) |
| 122 |
} |
| 123 |
".IN" nl() d(out) ". " |
| 124 |
call longvitals(indi,1,1) |
| 125 |
set(out,add(out,1)) |
| 126 |
} |
| 127 |
} |
| 128 |
|
| 129 |
proc longvitals(i,showc,showp) { |
| 130 |
if ( and(i,lookup(lvd,key(i))) ) { |
| 131 |
/* call shortvitals(i)*/ |
| 132 |
call nicename(i) "." nl() |
| 133 |
} else { |
| 134 |
set (fac,1) |
| 135 |
"\\fB" call nicename(i) "\\fR." nl() |
| 136 |
insert(sid,key(i),out) |
| 137 |
insert(lvd,key(i),out) |
| 138 |
call add_to_ix(i) |
| 139 |
call dobirth(i,showp) |
| 140 |
call doeduc(i) |
| 141 |
call domarr(i,showc) |
| 142 |
call dooccu(i) |
| 143 |
call doresi(i) |
| 144 |
call donotes(inode(i),1) |
| 145 |
call dotext(inode(i),1) |
| 146 |
call othernodes(inode(i)) |
| 147 |
call doreti(i) |
| 148 |
call dodeath(i) |
| 149 |
} |
| 150 |
} |
| 151 |
|
| 152 |
proc shortvitals(indi) { |
| 153 |
call nicename(indi) |
| 154 |
set(b,birth(indi)) set(d,death(indi)) |
| 155 |
if (and(b,short(b))) { ", b. " short(b) } |
| 156 |
if (and(d,short(d))) { ", d. " short(d) } |
| 157 |
"." nl() |
| 158 |
} |
| 159 |
|
| 160 |
proc famvitals (indi,fam,spouse,nfam,showc) { |
| 161 |
if (eq(0,nchildren(fam))) { |
| 162 |
call firstname(indi) |
| 163 |
if (spouse) { |
| 164 |
" and " call firstname(spouse) |
| 165 |
} |
| 166 |
" had no children" |
| 167 |
if (not(spouse)) { |
| 168 |
" from this marriage" |
| 169 |
} |
| 170 |
"." nl() |
| 171 |
} elsif (and(fam,lookup(ftab,key(fam)))) { |
| 172 |
set(par,indi(lookup(ftab,key(fam)))) |
| 173 |
"Children of " call firstname(indi) " and " call firstname(spouse) " are shown " |
| 174 |
"under " call nicename(par) "." nl() |
| 175 |
} elsif (showc) { |
| 176 |
"Children of " call firstname(indi) |
| 177 |
if (spouse) { |
| 178 |
" and " call firstname(spouse) |
| 179 |
} |
| 180 |
":" nl() |
| 181 |
".VL 0.4i" nl() |
| 182 |
insert(ftab,save(key(fam)),key(indi)) |
| 183 |
children(fam,child,nchl) { |
| 184 |
".LI " roman(nchl) nl() |
| 185 |
set(childhaschild,0) |
| 186 |
families(child,cfam,cspou,ncf) { |
| 187 |
if(ne(0,nchildren(cfam))) { set(childhaschild,1) } |
| 188 |
} |
| 189 |
".CH " nl() |
| 190 |
if (and(enqc,childhaschild)) { |
| 191 |
call enqch(child) |
| 192 |
call shortvitals(child) |
| 193 |
} else { |
| 194 |
call longvitals(child,0,0) |
| 195 |
} |
| 196 |
set(fac,1) |
| 197 |
} |
| 198 |
".LE" nl() |
| 199 |
".IN" nl() |
| 200 |
} else { |
| 201 |
call firstname(indi) |
| 202 |
if (spouse) { |
| 203 |
" and " call firstname(spouse) |
| 204 |
} |
| 205 |
" had " card(nchildren(fam)) |
| 206 |
if(eq(1,nchildren(fam))) { |
| 207 |
" child," |
| 208 |
set(andn,0) |
| 209 |
} else { |
| 210 |
" children," |
| 211 |
set(andn,sub(nchildren(fam),1)) |
| 212 |
} |
| 213 |
|
| 214 |
children(fam,child,nchl) { |
| 215 |
" " |
| 216 |
call firstname(child) |
| 217 |
call doadopts(child) |
| 218 |
call add_to_ix(child) |
| 219 |
if(ne(nchl,nchildren(fam))) { |
| 220 |
if(eq(nchl,andn)) { |
| 221 |
" and" |
| 222 |
} else { |
| 223 |
"," |
| 224 |
} |
| 225 |
} |
| 226 |
} |
| 227 |
"." nl() |
| 228 |
} |
| 229 |
} |
| 230 |
|
| 231 |
proc enqch (child) { |
| 232 |
enqueue(ilist,child) |
| 233 |
enqueue(glist,add(1,curgen)) |
| 234 |
insert(sid,key(child),in) |
| 235 |
set (in, add (in, 1)) |
| 236 |
} |
| 237 |
|
| 238 |
proc spousevitals (sp,fam) { |
| 239 |
if(e,marriage(fam)) { |
| 240 |
if (place(e)) { |
| 241 |
call wherewhen(e) "," |
| 242 |
} |
| 243 |
} |
| 244 |
" " |
| 245 |
call add_to_ix(sp) |
| 246 |
if (and(sp,lookup(sid,key(sp)))) { |
| 247 |
/*call shortvitals(sp)*/ call nicename(sp) "." nl() |
| 248 |
} else { |
| 249 |
call nicename(sp) |
| 250 |
set(e,birth(sp)) |
| 251 |
if(and(e,long(e))) { "," nl() "born" call wherewhen(e) } |
| 252 |
set(e,death(sp)) |
| 253 |
if(and(e,long(e))) { "," nl() pn(sp,1) " died" call wherewhen(e) } |
| 254 |
"." nl() |
| 255 |
call showparents(sp) |
| 256 |
} |
| 257 |
} |
| 258 |
|
| 259 |
proc showparents(sp) { |
| 260 |
set(dad,father(sp)) |
| 261 |
set(mom,mother(sp)) |
| 262 |
if (or(dad,mom)) { |
| 263 |
pn(sp,0) " " |
| 264 |
if (death(sp)) { "was the " } else { "is the " } |
| 265 |
if (male(sp)) { "son of " } |
| 266 |
elsif (female(sp)) { "daughter of " } |
| 267 |
else { "child of " } |
| 268 |
if (dad) { call nicename(dad) } |
| 269 |
if (and(dad,mom)) { nl() "and " } |
| 270 |
if (mom) { call nicename(mom) } |
| 271 |
if (dad) { call add_to_ix(dad) } |
| 272 |
if (mom) { call add_to_ix(mom) } |
| 273 |
set(nch,nchildren(parents(sp))) |
| 274 |
decr(nch) |
| 275 |
if (gt(nch,0)) { |
| 276 |
" who had " card(nch) " other " |
| 277 |
if (eq(1,nch)) { |
| 278 |
"child," |
| 279 |
set(andn,0) |
| 280 |
} else { |
| 281 |
"children," |
| 282 |
set(andn,sub(nch,1)) |
| 283 |
} |
| 284 |
set(cp,0) |
| 285 |
children(parents(sp),child,nchl) { |
| 286 |
if (ne(key(child),key(sp))) { |
| 287 |
" " |
| 288 |
call firstname(child) |
| 289 |
call doadopts(child) |
| 290 |
call add_to_ix(child) |
| 291 |
set(cp,add(cp,1)) |
| 292 |
if(ne(nch,cp)) { |
| 293 |
if(eq(cp,andn)) { |
| 294 |
" and" |
| 295 |
} else { |
| 296 |
"," |
| 297 |
} |
| 298 |
} |
| 299 |
} |
| 300 |
} |
| 301 |
". " nl() |
| 302 |
} |
| 303 |
"." nl() |
| 304 |
} |
| 305 |
} |
| 306 |
|
| 307 |
proc dobirth(i,showp) { |
| 308 |
set(e,birth(i)) |
| 309 |
if(and(e,long(e))) { |
| 310 |
".P" nl() |
| 311 |
call firstname(i) |
| 312 |
set(fac,0) |
| 313 |
" was born" call wherewhen(e) "." nl() |
| 314 |
} |
| 315 |
if(showp) { call showparents(i) } |
| 316 |
set(e,get_baptism(i)) |
| 317 |
if(and(e,long(e))) { |
| 318 |
if(not(birth(i))) {".P" nl()} |
| 319 |
call fn0(i) |
| 320 |
if (eqstr(tag(e),"BAPM")) { " was baptized" } |
| 321 |
elsif (eqstr(tag(e),"BAPL")) { " was baptized" } |
| 322 |
elsif (eqstr(tag(e),"CHR")) { " was christened" } |
| 323 |
elsif (eqstr(tag(e),"CHRA")) { " was christened" } |
| 324 |
call wherewhen(e) "." nl() |
| 325 |
} |
| 326 |
} |
| 327 |
|
| 328 |
proc domarr(i,showc) { |
| 329 |
set(j,1) |
| 330 |
families(i,f,s,n) { |
| 331 |
".P" nl() |
| 332 |
call fn0(i) |
| 333 |
if (or(not(s),marriage(f))) { |
| 334 |
" married" |
| 335 |
} else { |
| 336 |
" lived with" |
| 337 |
} |
| 338 |
if (ne(1,nfamilies(i))) { " " ord(j) ", " } |
| 339 |
set(j,add(j,1)) |
| 340 |
if (s) { |
| 341 |
call spousevitals(s,f) |
| 342 |
} else { |
| 343 |
if (male(i)) { |
| 344 |
" but his wife's name is not known. " |
| 345 |
} else { |
| 346 |
" but her husband's name is not known. " |
| 347 |
} |
| 348 |
nl() |
| 349 |
} |
| 350 |
call dowitness(fnode(f)) |
| 351 |
call donotes(fnode(f),1) |
| 352 |
call othernodes(fnode(f)) |
| 353 |
call famvitals(i,f,s,n,showc) |
| 354 |
set(fac,1) |
| 355 |
} |
| 356 |
} |
| 357 |
|
| 358 |
proc dodeath(i) { |
| 359 |
set(e,death(i)) |
| 360 |
if(and(e,long(e))) { |
| 361 |
".P" nl() |
| 362 |
call fn0(i) |
| 363 |
" died" |
| 364 |
call wherewhen(e) "." nl() |
| 365 |
call addtostack(e,"CAUS") |
| 366 |
if(not(empty(stack))) { |
| 367 |
"The cause of death was " |
| 368 |
dequeue(stack) "." nl() |
| 369 |
} |
| 370 |
call donotes(e,0) |
| 371 |
} |
| 372 |
set(e,burial(i)) |
| 373 |
if(and(e,long(e))) { |
| 374 |
if(not(long(death(i)))) {".P" nl()} |
| 375 |
call fn0(i) |
| 376 |
if (p,place(e)) { |
| 377 |
if( ne(0,index(upper(p),"CREMAT",1)) ) { |
| 378 |
" was laid to rest" |
| 379 |
} else { |
| 380 |
" was buried" |
| 381 |
} |
| 382 |
} |
| 383 |
else { |
| 384 |
" was buried" |
| 385 |
} |
| 386 |
call wherewhen(e) "." nl() |
| 387 |
call donotes(e,0) |
| 388 |
call dotext(e,1) |
| 389 |
} |
| 390 |
} |
| 391 |
|
| 392 |
proc donotes(in,subpara) { |
| 393 |
fornodes(in, node) { |
| 394 |
if (eq(0,strcmp("NOTE", tag(node)))) { |
| 395 |
if (subpara) { |
| 396 |
".P" nl() |
| 397 |
} |
| 398 |
value(node) nl() |
| 399 |
call addtostack(node,"CONT") |
| 400 |
while(it,dequeue(stack)) { |
| 401 |
it nl() |
| 402 |
} |
| 403 |
} |
| 404 |
} |
| 405 |
} |
| 406 |
|
| 407 |
proc dotext(in,subpara) { |
| 408 |
fornodes(in, node) { |
| 409 |
if (eq(0,strcmp("TEXT", tag(node)))) { |
| 410 |
if (subpara) { |
| 411 |
".P" nl() |
| 412 |
} |
| 413 |
call addtostack(node,"SOUR") |
| 414 |
if(not(empty(stack))) { |
| 415 |
"The following information was found in " |
| 416 |
while(it,dequeue(stack)) { |
| 417 |
it nl() |
| 418 |
} |
| 419 |
".I :" nl() |
| 420 |
".P" nl() |
| 421 |
} |
| 422 |
value(node) nl() |
| 423 |
call addtostack(node,"CONT") |
| 424 |
while(it,dequeue(stack)) { |
| 425 |
it nl() |
| 426 |
} |
| 427 |
".R" nl() |
| 428 |
} |
| 429 |
} |
| 430 |
} |
| 431 |
|
| 432 |
proc dowitness(snode) { |
| 433 |
set(mult,0) |
| 434 |
call addtostack(snode,"WITN") |
| 435 |
if (not(empty(stack))) { |
| 436 |
"Witnessed by " |
| 437 |
while(it,dequeue(stack)) { |
| 438 |
if (mult) { |
| 439 |
" and " |
| 440 |
} else { |
| 441 |
set(mult,1) |
| 442 |
} |
| 443 |
it |
| 444 |
} |
| 445 |
"." nl() |
| 446 |
} |
| 447 |
} |
| 448 |
|
| 449 |
proc dooccu(in) { |
| 450 |
set(first,1) |
| 451 |
fornodes(inode(in), node) { |
| 452 |
if (eq(0,strcmp("OCCU", tag(node)))) { |
| 453 |
if(first) { |
| 454 |
".P" nl() |
| 455 |
call fn2(in) |
| 456 |
" occupation was " |
| 457 |
set(first,0) |
| 458 |
} else { |
| 459 |
"Then " |
| 460 |
} |
| 461 |
value(node) |
| 462 |
call wherewhen(node) |
| 463 |
"." nl() |
| 464 |
} |
| 465 |
} |
| 466 |
} |
| 467 |
|
| 468 |
proc doresi(in) { |
| 469 |
set(first,1) |
| 470 |
fornodes(inode(in), node) { |
| 471 |
if (eq(0,strcmp("RESI", tag(node)))) { |
| 472 |
if(first) { |
| 473 |
".P" nl() |
| 474 |
call fn0(in) |
| 475 |
" lived" |
| 476 |
set(first,0) |
| 477 |
} else { |
| 478 |
"Subsequently" |
| 479 |
} |
| 480 |
call wherewhen(node) |
| 481 |
"." nl() |
| 482 |
} |
| 483 |
} |
| 484 |
} |
| 485 |
|
| 486 |
proc doeduc(in) { |
| 487 |
set(first,1) |
| 488 |
fornodes(inode(in), node) { |
| 489 |
if (eq(0,strcmp("EDUC", tag(node)))) { |
| 490 |
if(first) { |
| 491 |
".P" nl() |
| 492 |
call fn0(in) |
| 493 |
" was educated" |
| 494 |
set(first,0) |
| 495 |
} else { |
| 496 |
"Also" |
| 497 |
} |
| 498 |
call wherewhen(node) |
| 499 |
"." nl() |
| 500 |
} |
| 501 |
} |
| 502 |
} |
| 503 |
|
| 504 |
proc doreti(in) { |
| 505 |
fornodes(inode(in), node) { |
| 506 |
if (eq(0,strcmp("RETI", tag(node)))) { |
| 507 |
".P" nl() |
| 508 |
call fn0(in) |
| 509 |
" retired" |
| 510 |
call wherewhen(node) |
| 511 |
"." nl() |
| 512 |
} |
| 513 |
} |
| 514 |
} |
| 515 |
|
| 516 |
/* Short version of adoption */ |
| 517 |
proc doadopts(in) { |
| 518 |
fornodes(inode(in), node) { |
| 519 |
if (eq(0,strcmp("ADOP", tag(node)))) { |
| 520 |
" (adopted)" |
| 521 |
} |
| 522 |
} |
| 523 |
} |
| 524 |
|
| 525 |
proc addtostack(stnode,ntype) { |
| 526 |
fornodes(stnode, subnode) { |
| 527 |
if (eq(0,strcmp(ntype, tag(subnode)))) { |
| 528 |
enqueue(stack,value(subnode)) |
| 529 |
} |
| 530 |
} |
| 531 |
} |
| 532 |
|
| 533 |
proc addtostackc(stnode,ntype) { |
| 534 |
fornodes(stnode, subnode) { |
| 535 |
if (eq(0,strcmp(ntype, tag(subnode)))) { |
| 536 |
enqueue(stack,value(subnode)) |
| 537 |
call addtostack(subnode,"CONT") |
| 538 |
} |
| 539 |
} |
| 540 |
} |
| 541 |
|
| 542 |
proc stackaddr(e) { |
| 543 |
call addtostackc(e,"ADDR") |
| 544 |
} |
| 545 |
|
| 546 |
proc stackplace(stnode) { |
| 547 |
fornodes(stnode, subnode) { |
| 548 |
if (eq(0,strcmp("PLAC", tag(subnode)))) { |
| 549 |
call stackaddr(subnode) |
| 550 |
enqueue(stack,value(subnode)) |
| 551 |
} |
| 552 |
} |
| 553 |
} |
| 554 |
|
| 555 |
proc fromto(indi) { |
| 556 |
set(e,birth(indi)) |
| 557 |
set(f,death(indi)) |
| 558 |
if (or(year(e),year(f))) { |
| 559 |
"(" |
| 560 |
if (year(e)) {year(e)} else { "?" } |
| 561 |
"-" |
| 562 |
year(f) |
| 563 |
")" |
| 564 |
} |
| 565 |
} |
| 566 |
|
| 567 |
proc when(e) { |
| 568 |
if(d,stddate(e)) { |
| 569 |
set(i,index(d," ",1)) |
| 570 |
if(eq(0,i)) { |
| 571 |
" in " |
| 572 |
} elsif(eq(i,1)) { |
| 573 |
" in" |
| 574 |
} elsif(lt(i,4)) { |
| 575 |
" on " |
| 576 |
} else { " in " } |
| 577 |
d |
| 578 |
} |
| 579 |
call doperi(e) |
| 580 |
call addtostack(e,"AGE") |
| 581 |
if (not(empty(stack))) { |
| 582 |
", at the age of " dequeue(stack) |
| 583 |
} |
| 584 |
} |
| 585 |
|
| 586 |
proc where(e) { |
| 587 |
call addtostack(e,"CORP") |
| 588 |
call addtostack(e,"SITE") |
| 589 |
call stackaddr(e) |
| 590 |
call stackplace(e) |
| 591 |
if (not(empty(stack))) { |
| 592 |
" at " dequeue(stack) |
| 593 |
while (elem,dequeue(stack)) { |
| 594 |
", " |
| 595 |
elem |
| 596 |
/* if (not(empty(stack))) { |
| 597 |
", " |
| 598 |
}*/ |
| 599 |
} |
| 600 |
} |
| 601 |
} |
| 602 |
|
| 603 |
proc wherewhen(e) { |
| 604 |
call where(e) |
| 605 |
call when(e) |
| 606 |
} |
| 607 |
|
| 608 |
proc whenwhere(e) { |
| 609 |
call when(e) |
| 610 |
call where(e) |
| 611 |
} |
| 612 |
|
| 613 |
proc doperi(node) { |
| 614 |
call addtostack(node,"PERI") |
| 615 |
if(not(empty(stack))) { |
| 616 |
" from " |
| 617 |
set(notfirst,0) |
| 618 |
/* if(not(getel(stack,2))) { |
| 619 |
dequeue(stack) |
| 620 |
} else {*/ |
| 621 |
while(it,dequeue(stack)) { |
| 622 |
if(getel(stack,1)) { |
| 623 |
it ", " |
| 624 |
} else { |
| 625 |
if(notfirst) {"and " set(notfirst,1)} |
| 626 |
it |
| 627 |
} |
| 628 |
} |
| 629 |
/* }*/ |
| 630 |
} |
| 631 |
} |
| 632 |
|
| 633 |
proc nicename(i) { |
| 634 |
if(eq(0,strlen(givens(i)))) { "____" } else { givens(i) } |
| 635 |
sp() |
| 636 |
if(surname(i)) {upper(surname(i))} else { "____" } |
| 637 |
if(sect,lookup(sid,key(i))) { |
| 638 |
if(ne(sect,out)) {" [" d(sect) "]"} |
| 639 |
} |
| 640 |
} |
| 641 |
|
| 642 |
/* Print the firstname or He/She depending whether the fac flag is set */ |
| 643 |
proc fn0(i) { |
| 644 |
if (fac) { |
| 645 |
call firstname(i) |
| 646 |
set(fac,0) |
| 647 |
} else { |
| 648 |
pn(i,0) |
| 649 |
} |
| 650 |
} |
| 651 |
|
| 652 |
/* Print the firstname or His/Her depending whether the fac flag is set */ |
| 653 |
proc fn2(i) { |
| 654 |
if (fac) { |
| 655 |
call firstname(i) "'s" |
| 656 |
set(fac,0) |
| 657 |
} else { |
| 658 |
pn(i,2) |
| 659 |
} |
| 660 |
} |
| 661 |
|
| 662 |
proc firstname(i) { |
| 663 |
if (i) { |
| 664 |
call addtostack(inode(i),"CNAM") |
| 665 |
if (not(empty(stack))) { |
| 666 |
dequeue(stack) |
| 667 |
} else { |
| 668 |
list(parts) |
| 669 |
extractnames(inode(i),parts,elems,sn) |
| 670 |
if(eq(1,elems)) { |
| 671 |
"____ " pop(parts) |
| 672 |
} else { |
| 673 |
set(nf,1) |
| 674 |
forlist(parts,it,n) { |
| 675 |
if(ne(sn,n)) { |
| 676 |
if(nf) { set(ans,it) set(nf,0) } |
| 677 |
/* if( ne(0,index(it,qt(),1)) ) { |
| 678 |
set(ans,substring(it,2,sub(strlen(it),1))) |
| 679 |
}*/ |
| 680 |
} |
| 681 |
} |
| 682 |
ans |
| 683 |
} |
| 684 |
} |
| 685 |
} |
| 686 |
} |
| 687 |
|
| 688 |
proc othernodes(i) { |
| 689 |
fornodes(i, node) { |
| 690 |
if (index(" BAPM BAPL BIRT BURI CHIL CHR CHRA CNAM CONF DEAT DIVI EDUC FAMC FAMS HUSB MARR NAME NOTE RESI RETI OBJE OCCU SEX TEXT WIFE WITN ", |
| 691 |
concat(" ",upper(tag(node))," "),1)) { |
| 692 |
set(null,0) /* lifelines noop */ |
| 693 |
} elsif (eq(0,strcmp("FILE", tag(node)))) { |
| 694 |
copyfile(value(node)) |
| 695 |
} elsif (eq(0,strcmp("DIVI", tag(node)))) { |
| 696 |
"The marriage ended in divorce." nl() |
| 697 |
} else { |
| 698 |
".P" nl() |
| 699 |
tag(node) sp() value(node) |
| 700 |
call wherewhen(node) nl() |
| 701 |
call subnode(node) |
| 702 |
} |
| 703 |
} |
| 704 |
} |
| 705 |
|
| 706 |
proc subnode(i) { |
| 707 |
fornodes(i, subn) { |
| 708 |
if (index(" ADDR AGE CORP DATE PERI PLAC SITE ", |
| 709 |
concat(" ",upper(tag(subn))," "),1)) { |
| 710 |
set(null,0) |
| 711 |
} else { |
| 712 |
".br" nl() |
| 713 |
tag(subn) sp() value(subn) nl() |
| 714 |
call subnode(subn) |
| 715 |
} |
| 716 |
} |
| 717 |
} |
| 718 |
|
| 719 |
proc prindex () { |
| 720 |
print("Index") print(nl()) |
| 721 |
namesort(idex) |
| 722 |
monthformat(4) |
| 723 |
".IX" nl() |
| 724 |
forindiset(idex,indi,v,n) { |
| 725 |
".br" nl() |
| 726 |
fullname(indi,1,0,24) |
| 727 |
" " |
| 728 |
call fromto(indi) " " |
| 729 |
lookup(itab,key(indi)) |
| 730 |
nl() |
| 731 |
set(tp,n) |
| 732 |
} |
| 733 |
print(d(tp)) print(" individuals were mentioned in this report") print(nl()) |
| 734 |
".P" nl() "There are " d(tp) " individuals mentioned in this report." |
| 735 |
nl() |
| 736 |
} |
| 737 |
|
| 738 |
proc add_to_ix(i) { |
| 739 |
/* print("IX ") print(name(i)) print(" ") print(d(out)) print(nl())*/ |
| 740 |
addtoset(idex,i,d(out)) |
| 741 |
if (l,lookup(itab,key(i))) { |
| 742 |
/* print(" - already got ") print(l) print(nl())*/ |
| 743 |
insert(itab,key(i),save(concat(concat(l,","),d(out)))) |
| 744 |
} else { |
| 745 |
insert(itab,key(i),save(d(out))) |
| 746 |
} |
| 747 |
} |
| 748 |
|
| 749 |
func get_baptism(indi) { |
| 750 |
list(ev) |
| 751 |
fornodes(indi,node) { |
| 752 |
if (index(" BAPM BAPL CHR CHRA ",concat(" ",upper(tag(node))," "),1)) { |
| 753 |
return(node) |
| 754 |
} |
| 755 |
} |
| 756 |
return(0) |
| 757 |
} |
| 758 |
|
| 759 |
func get_tags(indi,str) { |
| 760 |
list(ev) |
| 761 |
fornodes(indi,node) { |
| 762 |
if (index(str,concat(" ",upper(tag(node))," "),1)) { |
| 763 |
push(ev,node) |
| 764 |
} |
| 765 |
} |
| 766 |
return(ev) |
| 767 |
} |
| 768 |
|
| 769 |
func output_head() |
| 770 |
{ |
| 771 |
/* this is really ugly. back slash is already overused in *roff code |
| 772 |
* but to include this here we have to escape the backslashs (that were |
| 773 |
* already escaped in the *roff code. However, it is better here, |
| 774 |
* than the hassels of a separate file for the header info. |
| 775 |
*/ |
| 776 |
".if t .pl 10.9i \\\" Page length" nl() |
| 777 |
".if n .pl 10.7i" nl() |
| 778 |
".if t .ll 6.75i \\\" Line length" nl() |
| 779 |
".if n .ll 7.25i" nl() |
| 780 |
".\\\".if t .lt 6.75i \\\" Title length" nl() |
| 781 |
".\\\".if n .lt 7.25i" nl() |
| 782 |
".if t .lt 7.75i \\\" Title length" nl() |
| 783 |
".if n .lt 9.25i" nl() |
| 784 |
".po 0.5i \\\" Left margin" nl() |
| 785 |
".ls 1 \\\" Line spacing" nl() |
| 786 |
".\\\".nr Ej 1 \\\" New page before chapter headings" nl() |
| 787 |
".nr Hb 1 \\\" Line break after all headings" nl() |
| 788 |
".nr Hs 6 \\\" Blank line after all headings" nl() |
| 789 |
".\\\".nr Hc 1 \\\" Centre chapter headings" nl() |
| 790 |
".nr Hu 1 \\\" Un-numbered headings are at level 1" nl() |
| 791 |
".nr Hi 1 \\\" Indent after head same as paras" nl() |
| 792 |
".nr Pt 0 \\\" Don't indent paras" nl() |
| 793 |
".nr Cl 6 \\\" Heads in table of contents up to level 6" nl() |
| 794 |
".nr Yr \\n(yr+1900 \\\" the year for we are printing this" nl() |
| 795 |
".if t .ds HF 3 3 3 3 3 3 2 \\\" Heading fonts" nl() |
| 796 |
".ds HP +6 +6 +2 +2 +2 +2 +1 \\\" Heading point sizes" nl() |
| 797 |
".ds pB " getproperty("user.fullname") nl() |
| 798 |
".rm )k \\\" Remove cut marks at top of page" nl() |
| 799 |
".if \"\\nd\"0\" .nr m \\n(mo-1" nl() |
| 800 |
".if \"\\nm\"0\" .ds mO January" nl() |
| 801 |
".if \"\\nm\"1\" .ds mO February" nl() |
| 802 |
".if \"\\nm\"2\" .ds mO March" nl() |
| 803 |
".if \"\\nm\"3\" .ds mO April" nl() |
| 804 |
".if \"\\nm\"4\" .ds mO May" nl() |
| 805 |
".if \"\\nm\"5\" .ds mO June" nl() |
| 806 |
".if \"\\nm\"6\" .ds mO July" nl() |
| 807 |
".if \"\\nm\"7\" .ds mO August" nl() |
| 808 |
".if \"\\nm\"8\" .ds mO September" nl() |
| 809 |
".if \"\\nm\"9\" .ds mO October" nl() |
| 810 |
".if \"\\nm\"10\" .ds mO November" nl() |
| 811 |
".if \"\\nm\"11\" .ds mO December" nl() |
| 812 |
".PF \"'\\fIProduced by \\*(pB\\fR'- \\\\\\\\nP -'\\fI\\n(dy \\*(mO \\n(Yr \\fR'\"" nl() |
| 813 |
".PH" nl() |
| 814 |
".de GN" nl() |
| 815 |
".br" nl() |
| 816 |
".ne 2i" nl() |
| 817 |
".sp 2" nl() |
| 818 |
".in 0" nl() |
| 819 |
".ce" nl() |
| 820 |
".if t \\s+3\\fHGENERATION \\\\$1\\fH\\s-3" nl() |
| 821 |
".if n GENERATION \\\\$1" nl() |
| 822 |
".." nl() |
| 823 |
".de CH" nl() |
| 824 |
".." nl() |
| 825 |
".de IN" nl() |
| 826 |
".sp" nl() |
| 827 |
".in 0" nl() |
| 828 |
".." nl() |
| 829 |
".de IX" nl() |
| 830 |
".SK" nl() |
| 831 |
".HU Index" nl() |
| 832 |
"All the people mentioned in this report are given below. Please note that" nl() |
| 833 |
"the numbers printed after the name are not page numbers. They are the section" nl() |
| 834 |
"number(s) in which that person is mentioned. " nl() |
| 835 |
".if t .2C" nl() |
| 836 |
".." nl() |
| 837 |
".de .I" nl() |
| 838 |
".if t \\fI\\\\$1" nl() |
| 839 |
".if n \\\\$1" nl() |
| 840 |
".." nl() |
| 841 |
".de .R" nl() |
| 842 |
".if t \\fR" nl() |
| 843 |
".." nl() |
| 844 |
} |