Debian Codegraph @

reports/desc-tree.ll

raw
1 /*
2 * @progname desc-tree.ll
3 * @version 8
4 * @author Dick Knowles, [email protected]
5 * @category
6 * @output Text
7 * @description
8 *
9 This report prints a descendant tree for an individual. A
10 line is printed for every spouse and child including name,
11 database key number, birth, marriage, and death information.
12 The user can set the number of generations or they can all be
13 done (up to a maximum of 20). The user can also, optionally,
14 include step children and family database numbers. There are
15 two slightly different output styles, tree and numbered. Here
16 are examples of each:
17
18
19 Dick Knowles, [email protected]
20 18 Feb 1993
21 18 Mar 1993 ver. 2 Add date to heading
22 19 Dec 1993 ver. 3 (partial) Changes for Cliff Manis
23 30 Dec 1993 ver. 4 Updates suggested by Cliff Manis
24 07 Mar 1994 ver. 5 Make 0 generations max at 20.
25 Add message when stopping for gen count.
26 10 Mar 1994 ver. 6 Add max line count to limit output.
27 10 Aug 1994 ver. 7 Bugfix (by Jim Eggert).
28 31 Aug 1997 ver. 8 Added old bugfix for incorrect printing of step
29 children. (Source of fix unknown at this time.)
30
31 ----------------- numbered:
32
33 Tree of descendants for Thomas Leo SARJEANT (19)
34
35 Dated: 30 Dec 1993
36
37 1- Thomas Leo SARJEANT (19) b. 27 Mar 1916 d. 1 Oct 1978
38 s- Rita LACROIX (59) b. 28 Aug 1918 m. 1936 d. 28 Sep 1974
39 2- Thomas Leo SARJEANT (60) b. 26 Feb 1936
40 s- Joan MERRIAM (69) m. 13 May 1961
41 3- Thomas John SARJEANT (70)
42 3- Marjorie SARJEANT (71)
43 3- James SARJEANT (72)
44 2- John Bernard SARJEANT (61) b. 8 Nov 1939
45 s- Bettye MCPHERSON (504) b. 18 Apr 1932 m. 2 Sep 1973
46 2- Beverly Ann SARJEANT (62) b. 28 Jul 1942
47 s- Steven JOHNSON (73) m. 10 Nov 1960
48 s- Joseph COSTA (74) b. 20 Apr 1926 m. 8 Oct 1963
49 3- Michael Angelo COSTA (75) b. 30 Jun 1965
50 s- Elaine CARTER (319) b. 4 Feb 1966 m. 26 May 1990
51 s- Charlotte Lois BENJAMIN (20) b. 29 Nov 1923 m. 12 Oct 1949
52 2- Kathleen SARJEANT (14) b. 23 Jan 1950
53 s- Richard James KNOWLES (3) b. 20 Nov 1949 m. 14 Aug 1971
54 3- Jennifer Danielle KNOWLES (15) b. 28 Oct 1974
55 3- Kevin Scott KNOWLES (16) b. 14 May 1976
56 3- James Michael KNOWLES (17) b. 13 Oct 1979
57 3- Brenda Marie KNOWLES (18) b. 7 Oct 1981
58
59
60 ----------------- tree (with stepchildren and family numbers):
61
62 Tree of descendants for Thomas Leo SARJEANT (19)
63
64 Dated: 30 Dec 1993
65
66 -Thomas Leo SARJEANT (19) b. 27 Mar 1916 d. 1 Oct 1978
67 s-Rita LACROIX (59) b. 28 Aug 1918 m. 1936 (17) d. 28 Sep 1974
68 |-Thomas Leo SARJEANT (60) b. 26 Feb 1936
69 | s-Joan MERRIAM (69) m. 13 May 1961 (20)
70 | |-(ST)Deborah CONNORS (295)
71 | |-(ST)Diane CONNORS (296)
72 | | s-John LIPSEY (482) b. m. (160)
73 | | |-John LIPSEY (479) b. 27 Oct 1979 d. 8 Mar 1993
74 | |-(ST)Gayle CONNORS (297)
75 | | |-Jennifer (483) b.
76 | |-Thomas John SARJEANT (70)
77 | |-Marjorie SARJEANT (71)
78 | |-James SARJEANT (72)
79 |-John Bernard SARJEANT (61) b. 8 Nov 1939
80 | s-Bettye MCPHERSON (504) b. 18 Apr 1932 m. 2 Sep 1973 (168)
81 | |-(ST)Tammarra Victoria WALL (505) b. 7 Jul 1963
82 |-Beverly Ann SARJEANT (62) b. 28 Jul 1942
83 | s-Steven JOHNSON (73) m. 10 Nov 1960 (21)
84 | s-Joseph COSTA (74) b. 20 Apr 1926 m. 8 Oct 1963 (22)
85 | |-Michael Angelo COSTA (75) b. 30 Jun 1965
86 | | s-Elaine CARTER (319) b. 4 Feb 1966 m. 26 May 1990 (89)
87 s-Charlotte Lois BENJAMIN (20) b. 29 Nov 1923 m. 12 Oct 1949 (3)
88 |-Kathleen SARJEANT (14) b. 23 Jan 1950
89 | s-Richard James KNOWLES (3) b. 20 Nov 1949 m. 14 Aug 1971 (2)
90 | |-Jennifer Danielle KNOWLES (15) b. 28 Oct 1974
91 | |-Kevin Scott KNOWLES (16) b. 14 May 1976
92 | |-James Michael KNOWLES (17) b. 13 Oct 1979
93 | |-Brenda Marie KNOWLES (18) b. 7 Oct 1981
94
95 */
96
97 global(MAXGENS)
98 global(MAXLINES)
99 global(linecount)
100 global(gens)
101 global(style)
102 global(dofami)
103 global(dostep)
104 global(mainpre)
105 global(spousepre)
106 global(indentpre)
107
108 proc main () {
109 set(MAXGENS,20) /* make "all" gens max at 20 */
110 set(MAXLINES,500) /* set max report lines */
111 set(linecount,0) /* initialize linecount */
112 set(nm," ")
113 getindi(nm) /* get individual */
114 getintmsg (gens,
115 concat("How many generations (0 for all, max ",
116 concat(d(MAXGENS),")?")))
117 if (eq(gens,0)) {set(gens,MAXGENS)} /* if 0, set max */
118 getintmsg (style,
119 "Choose style: 0 for tree, 1 for numbered.")
120 getintmsg (dofami,
121 "Include family indices? 0 for no, 1 for yes.")
122 getintmsg (dostep,
123 "Show stepchildren? 0 for no, 1 for yes.")
124
125 dayformat(0)
126 monthformat(4)
127 dateformat(0)
128
129 /* Headers */
130 "Tree of descendants for " name(nm) " (" call key_no_char(nm) ")\n\n"
131 "Dated: " stddate(gettoday()) "\n\n"
132
133 if (eq(style,0)) { /* if tree */
134 set(mainpre, "-")
135 set(spousepre, " s-")
136 set(indentpre, " |")
137 } else { /* if numbered */
138 set(mainpre, "- ")
139 set(spousepre, "s- ")
140 set(indentpre, " ")
141 }
142 call dofam(nm,"",1,0) /* start with first person */
143
144 }
145
146
147 /* startfam:
148 If we haven't reached the maximum or specified generation count,
149 call dofam for each child in this family.
150 Otherwise, print a message line if there are further descendants
151 at this point.
152 */
153
154 proc startfam (fam,prefix,level,isstep) {
155 if (le(level,gens)) { /* if not at last generation */
156 children (fam,child,num) { /* for each child */
157 call dofam (child, /* call dofam */
158 concat(prefix, indentpre),
159 add(level,1),
160 isstep)
161 }
162 } else { /* don't do this generation */
163 if (gt(nchildren(fam),0)) { /* but if there are children, */
164 /* issue message */
165 prefix " [[Reached gen count or max. Further descendants here"
166 if (eq(isstep,1)) {
167 " (stepchildren)"
168 }
169 ".]]\n"
170 incr(linecount)
171 }
172 }
173 }
174
175 /* dofam:
176 Write out a person and check for spouses and children.
177 Each spouse is written, then this routine is called
178 recursively for each child. An incremented level is passed along
179 in case the user specified a limited number of generations
180 */
181
182 proc dofam (nm,prefix,level,isstep) {
183 if (eq(style,0)) {
184 set(pre,mainpre)
185 } else {
186 set(pre,concat(d(level),mainpre))
187 }
188 if (eq(isstep,1)) {
189 call printpers(nm,
190 concat(prefix,concat(pre,"(ST)")),0,0) /* print this person */
191 } else {
192 call printpers(nm,concat(prefix,pre),0,0) /* print this person */
193 }
194 if (and(ge(linecount,MAXLINES),gt(nfamilies(nm),0))) {
195 prefix " [[Reached line count max."
196 " May be further descendants here."
197 "]]\n"
198 } else {
199 families(nm, fam, spouse, num) { /* do for each family */
200 if (ne(spouse,null)) { /* if there is a spouse */
201 call printpers( /* print spouse */
202 spouse,concat(prefix,spousepre),1,fam)
203 if (and(ge(linecount,MAXLINES),gt(nchildren(fam),0))) {
204 prefix " [[Reached line count max."
205 " May be further descendants here."
206 "]]\n"
207 } else {
208 families (spouse, spsfam, ospouse, num2) {
209 /* for each of the spouse families*/
210 if (eq(fam,spsfam)) {/* this is main family */
211 call startfam (spsfam,prefix,level,0)
212 } else { /* this is step-family*/
213 if (eq (dostep,1)) { /* if we're doing stepfams */
214 call startfam (spsfam,prefix,level,1)
215 } /*end if dostep */
216 } /*end else not stepfam*/
217 } /*end spouse's families*/
218 } /* end spouse not ge MAXLINES */
219 } else { /* there is no spouse */
220 call startfam (fam,prefix,level,0)
221 } /*end else no spouse*/
222 } /*end 'families'*/
223 } /* end MAXLINES else */
224 } /*end 'proc dofam'*/
225
226
227 /* printpers:
228 Write output line for one person.
229 Include birth and death dates if known.
230 For a spouse, include marriage date if known.
231 */
232 proc printpers (nm, prefix, spouse, fam) {
233 prefix name(nm) " (" call key_no_char(nm) ")"
234 if(e, birth(nm)) {
235 "\t b. " stddate(birth(nm))
236 }
237 if(e, marriage(fam)) {
238 if(eq(dofami,1)) {
239 "\t m. " stddate(e) " (" call key_no_char(fam) ")"
240 } else {
241 "\t m. " stddate(e)
242 }
243 }
244 if(e, death(nm)) {
245 "\t d. " stddate(death(nm))
246 }
247 "\n"
248 incr(linecount)
249 } /* end proc printpers */
250
251 /*
252 key_no_char:
253 Return string key of individual or family, without
254 leading 'I' or 'F'.
255 */
256 proc key_no_char (nm) {
257 set(k, key(nm))
258 substring(k,2,strlen(k))
259 } /* end proc key_no_char */