| 1 |
/* |
| 2 |
* @progname htmlahnen.ll |
| 3 |
* @version 2 |
| 4 |
* @author Tom Wetmore |
| 5 |
* @category |
| 6 |
* @output HTML |
| 7 |
* @description |
| 8 |
* |
| 9 |
* Generate an ahnentafel chart in HTML format |
| 10 |
*/ |
| 11 |
/* Version 2, 12/31/95 */ |
| 12 |
|
| 13 |
proc main () |
| 14 |
{ |
| 15 |
getindi(per, "Whose Ahnentafel do you want?") |
| 16 |
if (not(per)) { return() } |
| 17 |
|
| 18 |
set(title, concat("Ahnentafel of ", name(per, 0))) |
| 19 |
call htmlhead(title) |
| 20 |
call htmlheading(3, title) |
| 21 |
print("Ahnentafel of ", name(per), "\n") |
| 22 |
|
| 23 |
list(ilist) /* list of persons waiting to be output */ |
| 24 |
list(alist) /* ahnen numbers of those persons */ |
| 25 |
list(glist) /* generations of those persons */ |
| 26 |
table(ktab) /* table of all persons who have been output */ |
| 27 |
table(ctab) /* table of child links */ |
| 28 |
|
| 29 |
enqueue(ilist, per) /* initialize all structures */ |
| 30 |
enqueue(alist, 1) |
| 31 |
enqueue(glist, 1) |
| 32 |
set(cgen, 0) |
| 33 |
call addchild(ctab, 0, per) |
| 34 |
|
| 35 |
while(per, dequeue(ilist)) { |
| 36 |
set(ahnen, dequeue(alist)) |
| 37 |
set (tgen, dequeue(glist)) |
| 38 |
if (ne(cgen, tgen)) { |
| 39 |
"<HR><P>" call htmlstrong("Generation ") |
| 40 |
call htmlstrong(d(tgen)) "\n" |
| 41 |
set(cgen, tgen) |
| 42 |
} |
| 43 |
"<P>" |
| 44 |
set(old, lookup(ktab, key(per))) |
| 45 |
if (old) { |
| 46 |
call htmlstrong(d(ahnen)) " Same as " |
| 47 |
call htmlstrong(d(old)) |
| 48 |
call htmllink(concat("#", key(per)), " link") |
| 49 |
} else { |
| 50 |
call htmlname(key(per)) print(".") |
| 51 |
insert(ktab, save(key(per)), ahnen) |
| 52 |
call htmlstrong(d(ahnen)) " " |
| 53 |
call htmlstrong(name(per, 0)) "\n" |
| 54 |
set(lst, lookup(ctab, key(per))) |
| 55 |
set(comma, 0) |
| 56 |
forlist (lst, key, n) { |
| 57 |
if (comma) { ", " } |
| 58 |
else { set(comma, 1) } |
| 59 |
call htmllink(concat("#", key), "chld") |
| 60 |
} |
| 61 |
if (par,father(per)) { |
| 62 |
enqueue(ilist, par) |
| 63 |
call addchild(ctab, per, par) |
| 64 |
enqueue(alist, mul(2, ahnen)) |
| 65 |
enqueue(glist, add(cgen, 1)) |
| 66 |
if (comma) { ", " } |
| 67 |
else { set(comma, 1) } |
| 68 |
call htmllink(concat("#", key(par)), "fath") |
| 69 |
} |
| 70 |
if (par,mother(per)) { |
| 71 |
enqueue(ilist, par) |
| 72 |
call addchild(ctab, per, par) |
| 73 |
enqueue(alist, add(1, mul(2, ahnen))) |
| 74 |
enqueue(glist, add(cgen, 1)) |
| 75 |
if (comma) { ", " } |
| 76 |
else { set(comma, 1) } |
| 77 |
call htmllink(concat("#", key(par)), "moth") |
| 78 |
} |
| 79 |
if (e, birth(per)) { "<BR> b. " long(e) "\n" } |
| 80 |
if (e, death(per)) { "<BR> d. " long(e) "\n" } |
| 81 |
} |
| 82 |
"\n" |
| 83 |
} |
| 84 |
call htmltail() |
| 85 |
} |
| 86 |
|
| 87 |
proc addchild (ctab, per, par) |
| 88 |
{ |
| 89 |
set(lst, lookup (ctab, key(par))) |
| 90 |
if (not(lst)) { |
| 91 |
list(lst) |
| 92 |
if (per) { |
| 93 |
setel(lst, 1, save(key(per))) |
| 94 |
} |
| 95 |
insert(ctab, save(key(par)), lst) |
| 96 |
} else { |
| 97 |
setel(lst, add(1, length(lst)), save(key(per))) |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
proc htmlhead (title) |
| 102 |
{ |
| 103 |
"<HTML><HEAD><TITLE>" title "</TITLE></HEAD>\n<BODY>\n" |
| 104 |
} |
| 105 |
|
| 106 |
proc htmltail () |
| 107 |
{ |
| 108 |
"\n</BODY></HTML>\n" |
| 109 |
} |
| 110 |
|
| 111 |
proc htmlstrong (str) |
| 112 |
{ |
| 113 |
"<STRONG>" str "</STRONG>" |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
proc htmllink (href, link) |
| 118 |
{ |
| 119 |
"<A HREF=\"" href "\">" link "</A>" |
| 120 |
} |
| 121 |
|
| 122 |
proc htmlname (name) |
| 123 |
{ |
| 124 |
"<A NAME=\"" name "\"></A>" |
| 125 |
} |
| 126 |
|
| 127 |
proc htmlheading (lev, head) |
| 128 |
{ |
| 129 |
"<H" d(lev) ">" head "</H" d(lev) ">\n" |
| 130 |
} |