Debian Codegraph @

reports/desc_html.ll

raw
1 /*
2 * @progname desc_html.ll
3 * @version 1.4
4 * @author Dick Knowles, Scott McGee, anon
5 * @category
6 * @output HTML
7 * @description
8
9 This program is designed to be used in a cgi based genweb site to produce
10 a descendant chart for a specified individual. It is based on the desc-tree
11 program by Dick Knowles as modified by Scott McGee. A line is printed for
12 every spouse and child including name, database key number, birth, marriage,
13 and death information.
14
15 @(#)desc_html.ll 1.4 10/4/95
16 */
17
18 include("cgi_html.li")
19
20 global(MAXGENS)
21 global(MAXLINES)
22 global(linecount)
23 global(gens)
24 global(mainpre)
25 global(spousepre)
26 global(indentpre)
27
28 proc main () {
29 call set_cgi_html_globals()
30
31 set(MAXGENS,20) /* make "all" gens max at 20 */
32 set(MAXLINES,500) /* set max report lines */
33 set(linecount,0) /* initialize linecount */
34 set(nm," ")
35 getindi(nm) /* get individual */
36
37 set(gens, 3)
38
39 dayformat(0)
40 monthformat(4)
41 dateformat(0)
42
43 set(mainpre, "-")
44 set(spousepre, " s-")
45 set(indentpre, " |")
46
47 call do_chart_head(nm, "Descendant")
48 "<PRE>\n"
49 call dofam(nm,"",1,0) /* start with first person */
50 "</PRE>\n"
51 call do_tail(nm)
52 }
53
54
55 /* startfam:
56 If we haven't reached the maximum or specified generation count,
57 call dofam for each child in this family.
58 Otherwise, print a message line if there are further descendants
59 at this point.
60 */
61 proc startfam (fam,prefix,level,isstep) {
62 if (le(level,gens)) { /* if not at last generation */
63 children (fam,child,num) { /* for each child */
64 call dofam (child, /* call dofam */
65 concat(prefix, indentpre),
66 add(level,1),
67 isstep)
68 }
69 } else { /* don't do this generation */
70 if (gt(nchildren(fam),0)) { /* but if there are children, */
71 /* issue message */
72 prefix " [[Further descendants here"
73 if (eq(isstep,1)) {
74 " (stepchildren)"
75 }
76 ".]]\n"
77 incr(linecount)
78 }
79 }
80 }
81
82 /* dofam:
83 Write out a person and check for spouses and children.
84 Each spouse is written, then this routine is called
85 recursively for each child. An incremented level is passed along
86 in case the user specified a limited number of generations
87 */
88
89 proc dofam (nm,prefix,level,isstep) {
90 set(pre,mainpre)
91 call printpers(nm,concat(prefix,pre),0,0) /* print this person */
92 if (and(ge(linecount,MAXLINES),gt(nfamilies(nm),0))) {
93 prefix " [[Reached line count max."
94 " May be further descendants here."
95 "]]\n"
96 } else {
97 families(nm, fam, spouse, num) { /* do for each family */
98 if (ne(spouse,null)) { /* if there is a spouse */
99 /* print spouse */
100 call printpers(spouse,concat(prefix,spousepre),1,fam)
101 if (and(ge(linecount,MAXLINES),gt(nchildren(fam),0))) {
102 prefix " [[Reached line count max."
103 " May be further descendants here."
104 "]]\n"
105 } else {
106 families (spouse, spsfam, ospouse, num2) {
107 /* for each of the spouse families*/
108 if(eq(fam,spsfam)){ /* only non-step families */
109 call startfam (spsfam,prefix,level,0)
110 }
111 } /*end spouse's families*/
112 } /* end spouse not ge MAXLINES */
113 } else { /* there is no spouse */
114 call startfam (fam,prefix,level,0)
115 } /*end else no spouse*/
116 } /*end 'families'*/
117 } /* end MAXLINES else */
118 } /*end 'proc dofam'*/
119
120
121 /* printpers:
122 Write output line for one person.
123 Include birth and death dates if known.
124 For a spouse, include marriage date if known.
125 */
126 proc printpers (nm, prefix, spouse, fam) {
127 prefix
128 if(nfamilies(nm)){
129 set(hasChildren, 0)
130 families(nm, f, s, n){
131 if(nchildren(f)){
132 set(hasChildren, 1)
133 }
134 }
135 }
136 href(nm, "Descendant")
137 if(e, birth(nm)) {
138 "\t b. " stddate(birth(nm))
139 }
140 if(e, marriage(fam)) {
141 "\t m. " stddate(e)
142 }
143 if(e, death(nm)) {
144 "\t d. " stddate(death(nm))
145 }
146 "\n"
147 incr(linecount)
148 } /* end proc printpers */
149
150
151 /*
152 key_no_char:
153 Return string key of individual or family, without
154 leading 'I' or 'F'.
155 */
156 proc key_no_char (nm) {
157 set(k, key(nm))
158 substring(k,2,strlen(k))
159 } /* end proc key_no_char */