| 1 |
/* |
| 2 |
* @progname fami-grps.ll |
| 3 |
* @version 1993-01-12 |
| 4 |
* @author Stephen Woodbridge ([email protected]) |
| 5 |
* @category |
| 6 |
* @output Text, 80 cols |
| 7 |
* @description |
| 8 |
* |
| 9 |
* Program walks thru one's families and dumps information |
| 10 |
* about each family. It prunes the tree so an individual is |
| 11 |
* only output once. The program lists all children of the |
| 12 |
* families as it walks the tree. The "*" marker on a child |
| 13 |
* signifies the line of descent/ascent. |
| 14 |
* |
| 15 |
* Output assumes 132 characters wide and 80 lines per page. |
| 16 |
* |
| 17 |
* Issues: |
| 18 |
* |
| 19 |
* o only one child is marked in line of descent regardless |
| 20 |
* of the actual number of children one may descend from |
| 21 |
* o notes or family group records grater than LPP are NOT |
| 22 |
* paginated correctly |
| 23 |
* o program does not walk thru descendants yet |
| 24 |
* o does not output baptism or burial records |
| 25 |
* o does not list other spouses of HUSBAND or WIFE |
| 26 |
* |
| 27 |
* Copyright 1993 Stephen Woodbridge |
| 28 |
*/ |
| 29 |
global(UNKNOWN) |
| 30 |
global(DONE) |
| 31 |
global(ILIST) |
| 32 |
global(NLIST) |
| 33 |
global(RVAL) |
| 34 |
global(nl) |
| 35 |
global(ff) |
| 36 |
global(PAGED) |
| 37 |
global(PAGENO) |
| 38 |
global(INDEXT) |
| 39 |
global(INDEXS) |
| 40 |
global(LPP) |
| 41 |
global(LC) |
| 42 |
global(NLF) |
| 43 |
global(NLH) |
| 44 |
global(NLW) |
| 45 |
global(ONCE) |
| 46 |
|
| 47 |
proc main() |
| 48 |
{ |
| 49 |
table(DONE) |
| 50 |
table(INDEXT) |
| 51 |
indiset(INDEXS) |
| 52 |
list(ILIST) |
| 53 |
list(NLIST) |
| 54 |
list(RVAL) |
| 55 |
set(nl, "\n") |
| 56 |
set(ff, "\f") |
| 57 |
set(PAGED, 1) |
| 58 |
set(PAGENO, 0) |
| 59 |
set(LPP, 80) |
| 60 |
set(LC, 0) |
| 61 |
set(NLF, 0) |
| 62 |
set(NLH, 0) |
| 63 |
set(NLW, 0) |
| 64 |
set(ONCE, 1) |
| 65 |
|
| 66 |
getindi(me) |
| 67 |
getintmsg(max, " Maximum Depth :") |
| 68 |
enqueue(ILIST, me) |
| 69 |
enqueue(NLIST, 1) |
| 70 |
set(i, 1) |
| 71 |
while (me, dequeue(ILIST)) |
| 72 |
{ |
| 73 |
set(depth, dequeue(NLIST)) |
| 74 |
if (not(lookup(DONE, key(me)))) |
| 75 |
{ |
| 76 |
call do_me(me, depth, max) |
| 77 |
} |
| 78 |
} |
| 79 |
if (PAGED) { call print_index() } |
| 80 |
} |
| 81 |
|
| 82 |
proc do_me(me, depth, max) |
| 83 |
{ |
| 84 |
call fam_group(parents(me), 1, me, depth) |
| 85 |
if (le(add(depth, 1), max)) |
| 86 |
{ |
| 87 |
if (dad, father(me)) |
| 88 |
{ |
| 89 |
enqueue(ILIST, dad) |
| 90 |
enqueue(NLIST, add(depth, 1)) |
| 91 |
} |
| 92 |
if (mom, mother(me)) |
| 93 |
{ |
| 94 |
enqueue(ILIST, mom) |
| 95 |
enqueue(NLIST, add(depth, 1)) |
| 96 |
} |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
proc fam_group(fam, notes, mchild, depth) |
| 101 |
{ |
| 102 |
if (fam) |
| 103 |
{ |
| 104 |
call count_fgrp(fam, notes) |
| 105 |
call fg_hdr(fam, depth) |
| 106 |
call pparent(husband(fam), "HUSBAND:") |
| 107 |
col(6) "M: " long(marriage(fam)) nl |
| 108 |
call pparent(wife(fam), " WIFE:") |
| 109 |
"CHILDREN:" nl |
| 110 |
children(fam, ch, nc) |
| 111 |
{ |
| 112 |
insert(DONE, save(key(ch)), 1) |
| 113 |
call pchild(nc, ch, mchild) |
| 114 |
} |
| 115 |
if (notes) |
| 116 |
{ |
| 117 |
call print_notes(husband(fam), "\nHusband: ", NLH) |
| 118 |
call print_notes(wife(fam), "\n Wife: ", NLW) |
| 119 |
} |
| 120 |
} |
| 121 |
else |
| 122 |
{ |
| 123 |
if (mchild) |
| 124 |
{ |
| 125 |
call fg_hdr(fam, depth) |
| 126 |
call pparent(0, "HUSBAND:") |
| 127 |
col(6) "M:" nl |
| 128 |
call pparent(0, " WIFE:") |
| 129 |
"CHILDREN:" nl |
| 130 |
insert(DONE, save(key(mchild)), 1) |
| 131 |
call pchild(1, mchild, mchild) |
| 132 |
if (notes) |
| 133 |
{ |
| 134 |
call print_notes(mchild, "\n Child: ", 0) |
| 135 |
} |
| 136 |
} |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
proc addtoindex(me) |
| 141 |
{ |
| 142 |
addtoset(INDEXS, me, 1) |
| 143 |
if (l, lookup(INDEXT, key(me))) |
| 144 |
{ |
| 145 |
enqueue(l, PAGENO) |
| 146 |
insert(INDEXT, save(key(me)), l) |
| 147 |
} |
| 148 |
else |
| 149 |
{ |
| 150 |
list(l) |
| 151 |
enqueue(l, PAGENO) |
| 152 |
insert(INDEXT, save(key(me)), l) |
| 153 |
} |
| 154 |
} |
| 155 |
|
| 156 |
proc print_index() |
| 157 |
{ |
| 158 |
"\f------------------------ INDEX -----------------------------\n" |
| 159 |
nl |
| 160 |
namesort(INDEXS) |
| 161 |
forindiset(INDEXS, me, v, n) |
| 162 |
{ |
| 163 |
call print_name(me, 1) |
| 164 |
pop(RVAL) col(50) |
| 165 |
set(first, 1) |
| 166 |
set(last, 0) |
| 167 |
forlist(lookup(INDEXT, key(me)), pg, n) |
| 168 |
{ |
| 169 |
if (ne(last, pg)) |
| 170 |
{ |
| 171 |
if(first) { set(first, 0) } |
| 172 |
else { "," } |
| 173 |
d(pg) |
| 174 |
set(last, pg) |
| 175 |
} |
| 176 |
} |
| 177 |
nl |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
proc fg_hdr(fam, depth) |
| 182 |
{ |
| 183 |
set(dash, " --------------------------- ") |
| 184 |
if (PAGED) |
| 185 |
{ |
| 186 |
if (and(gt(NLF, LC), lt(NLF, LPP))) |
| 187 |
{ |
| 188 |
set(PAGENO, add(PAGENO, 1)) |
| 189 |
if (ONCE) { set(ONCE, 0) } else { ff } |
| 190 |
dash d(depth) dash col(80) "Page: " d(PAGENO) nl |
| 191 |
set(LC, sub(LPP, NLF)) |
| 192 |
} |
| 193 |
else |
| 194 |
{ |
| 195 |
dash d(depth) dash nl |
| 196 |
set(LC, sub(LC, NLF)) |
| 197 |
} |
| 198 |
} |
| 199 |
else |
| 200 |
{ |
| 201 |
dash d(depth) dash nl |
| 202 |
} |
| 203 |
} |
| 204 |
|
| 205 |
proc count_fgrp(fam, notes) |
| 206 |
{ |
| 207 |
set(cnt, 13) |
| 208 |
children(fam, ch, nc) |
| 209 |
{ |
| 210 |
set(cnt, add(cnt, 3)) |
| 211 |
set(cnt, add(cnt, nspouses(ch))) |
| 212 |
} |
| 213 |
set(NLF, cnt) |
| 214 |
|
| 215 |
call cnt_notes(husband(fam), notes) |
| 216 |
set(NLH, pop(RVAL)) |
| 217 |
|
| 218 |
call cnt_notes(wife(fam), notes) |
| 219 |
set(NLW, pop(RVAL)) |
| 220 |
} |
| 221 |
|
| 222 |
proc cnt_notes(me, notes) |
| 223 |
{ |
| 224 |
set(c, 0) |
| 225 |
if (and(me, notes)) |
| 226 |
{ |
| 227 |
fornodes(inode(me), node) |
| 228 |
{ |
| 229 |
if (not(strcmp("NOTE", tag(node)))) |
| 230 |
{ |
| 231 |
set(c, add(c, 1)) |
| 232 |
fornodes(node, next) |
| 233 |
{ |
| 234 |
set(c, add(c, 1)) |
| 235 |
} |
| 236 |
} |
| 237 |
} |
| 238 |
} |
| 239 |
if (c) { set(c, add(c, 2)) } |
| 240 |
push(RVAL, c) |
| 241 |
} |
| 242 |
|
| 243 |
proc pparent(me, hdr) |
| 244 |
{ |
| 245 |
if(me) |
| 246 |
{ |
| 247 |
call get_refn(me) |
| 248 |
call print_name(me, 1) |
| 249 |
hdr col(10) pop(RVAL) col(55) "[" key(me) "]" col(62) pop(RVAL) nl |
| 250 |
col(6) "B:" col(10) long(birth(me)) nl |
| 251 |
col(6) "D:" col(10) long(death(me)) nl |
| 252 |
call addtoindex(me) |
| 253 |
if (fam, parents(me)) |
| 254 |
{ |
| 255 |
if (i, husband(fam)) |
| 256 |
{ |
| 257 |
call get_sdates(i) |
| 258 |
call print_name(i, 1) |
| 259 |
col(10) "FA:" col(15) pop(RVAL) col(60) pop(RVAL) nl |
| 260 |
call addtoindex(i) |
| 261 |
} |
| 262 |
if (i, wife(fam)) |
| 263 |
{ |
| 264 |
call get_sdates(i) |
| 265 |
call print_name(i, 1) |
| 266 |
col(10) "MO:" col(15) pop(RVAL) col(60) pop(RVAL) nl |
| 267 |
call addtoindex(i) |
| 268 |
} |
| 269 |
} |
| 270 |
} |
| 271 |
else |
| 272 |
{ |
| 273 |
hdr nl col(6) "B:" nl col(6) "D:" nl |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
proc pchild(num, me, markme) |
| 278 |
{ |
| 279 |
if (eq(me, markme)) { set(m, "*") } else { set(m, " ") } |
| 280 |
call print_name(me, 1) |
| 281 |
call rjt(num, 2) |
| 282 |
pop(RVAL) m sex(me) col(8) pop(RVAL) col(55) "[" key(me) "]" nl |
| 283 |
col(6) "B:" col(10) long(birth(me)) nl |
| 284 |
call addtoindex(me) |
| 285 |
spouses(me, sp, fam, nf) |
| 286 |
{ |
| 287 |
call print_name(sp, 0) |
| 288 |
call addtoindex(sp) |
| 289 |
col(6) "M:" d(nf) col(10) long(marriage(fam)) |
| 290 |
" TO " pop(RVAL) " [" key(sp) "]" nl |
| 291 |
} |
| 292 |
col(6) "D:" col(10) long(death(me)) nl |
| 293 |
} |
| 294 |
|
| 295 |
proc print_notes(me, string, nlines) |
| 296 |
{ |
| 297 |
if (me) |
| 298 |
{ |
| 299 |
call paginate_notes(nlines) |
| 300 |
call addtoindex(me) |
| 301 |
set(hdr, 1) |
| 302 |
fornodes( inode(me), node) |
| 303 |
{ |
| 304 |
if (not(strcmp("NOTE", tag(node)))) |
| 305 |
{ |
| 306 |
if (hdr) |
| 307 |
{ |
| 308 |
call print_name(me, 1) |
| 309 |
string pop(RVAL) " [" key(me) "]" nl |
| 310 |
set(hdr, 0) |
| 311 |
} |
| 312 |
col(8) value(node) nl |
| 313 |
fornodes(node, next) |
| 314 |
{ |
| 315 |
col(8) value(next) nl |
| 316 |
} |
| 317 |
} |
| 318 |
} |
| 319 |
} |
| 320 |
} |
| 321 |
|
| 322 |
proc paginate_notes(nlines) |
| 323 |
{ |
| 324 |
if (PAGED) |
| 325 |
{ |
| 326 |
if (and(gt(nlines, LC), lt(nlines, LPP))) |
| 327 |
{ |
| 328 |
set(PAGENO, add(PAGENO, 1)) |
| 329 |
ff col(80) "Page: " d(PAGENO) nl |
| 330 |
set(LC, sub(LPP, add(nlines, 1))) |
| 331 |
} |
| 332 |
else |
| 333 |
{ |
| 334 |
set(LC, sub(LC, nlines)) |
| 335 |
} |
| 336 |
} |
| 337 |
} |
| 338 |
|
| 339 |
|
| 340 |
proc print_name (me, last) |
| 341 |
{ |
| 342 |
call get_title(me) |
| 343 |
push(RVAL, save(concat(fullname(me, 1, not(last), 45), pop(RVAL)))) |
| 344 |
} |
| 345 |
|
| 346 |
proc get_refn (me) |
| 347 |
{ |
| 348 |
fornodes( inode(me), node) |
| 349 |
{ |
| 350 |
if (not(strcmp("REFN", tag(node)))) |
| 351 |
{ |
| 352 |
set(refn, node) |
| 353 |
} |
| 354 |
} |
| 355 |
if (refn) { push(RVAL, save(value(refn))) } |
| 356 |
else { push(RVAL, "") } |
| 357 |
} |
| 358 |
|
| 359 |
|
| 360 |
proc get_title (me) |
| 361 |
{ |
| 362 |
fornodes(inode(me), node) |
| 363 |
{ |
| 364 |
if (not(strcmp("TITL", tag(node)))) { set(n, node) } |
| 365 |
} |
| 366 |
if (n) { push(RVAL, save(concat(" ", value(n)))) } |
| 367 |
else { push(RVAL, "") } |
| 368 |
} |
| 369 |
|
| 370 |
proc get_sdates (me) |
| 371 |
{ |
| 372 |
if (e, birth(me)) { set(b, save(concat("( ", short(e)))) } |
| 373 |
else { set(b, "( ") } |
| 374 |
if (e, death(me)) { set(d, save(concat(" - " , short(e)))) } |
| 375 |
else { set(d, " - ") } |
| 376 |
push(RVAL, save(concat(b, concat(d, " )")))) |
| 377 |
} |
| 378 |
|
| 379 |
proc get_ldates (me) |
| 380 |
{ |
| 381 |
if (e, birth(me)) { set(b, save(concat("( ", long(e)))) } |
| 382 |
else { set(b, "( ") } |
| 383 |
if (e, death(me)) { set(d, save(concat(" - " , long(e)))) } |
| 384 |
else { set(d, " - ") } |
| 385 |
push(RVAL, save(concat(b, concat(d, " )")))) |
| 386 |
} |
| 387 |
|
| 388 |
proc get_dates (me) |
| 389 |
{ |
| 390 |
if (e, birth(me)) { set(b, save(concat("( ", date(e)))) } |
| 391 |
else { set(b, "( ") } |
| 392 |
if (e, death(me)) { set(d, save(concat(" - " , date(e)))) } |
| 393 |
else { set(d, " - ") } |
| 394 |
push(RVAL, save(concat(b, concat(d, " )")))) |
| 395 |
} |
| 396 |
|
| 397 |
proc rjt(n, w) |
| 398 |
{ |
| 399 |
if (lt(n, 10)) { set(d, 1) } |
| 400 |
elsif (lt(n, 100)) { set(d, 2) } |
| 401 |
elsif (lt(n, 1000)) { set(d, 3) } |
| 402 |
elsif (lt(n, 10000)) { set(d, 4) } |
| 403 |
else { set(d, 5) } |
| 404 |
if (lt(d, w)) |
| 405 |
{ set(pad, save( trim(" ", sub(w, d)))) } |
| 406 |
else |
| 407 |
{ set(pad, "") } |
| 408 |
push(RVAL, save( concat(pad, save(d(n))))) |
| 409 |
} |