Debian Codegraph @

reports/desc-henry.ll

raw
1 /*
2 * @progname desc-henry.ll
3 * @version 8
4 * @author Eggert
5 * @category
6 * @output Text
7 * @description
8
9 This program prints out a descendants report, assigning a d'Aboville,
10 Henry, modified Henry, or modern Henry code to the individuals. The
11 chosen ancestor, and all of his/her spouses, descendants, and
12 descendants' spouses are included in the report.
13
14 desc-henry - a LifeLines descendants listing program using Henry codes
15 by Jim Eggert ([email protected])
16 Versions 1-3 1992
17 Version 4, 7 Jan 1993 (added generation limit)
18 Version 5, 22 Dec 1993 (added header, trailer, and optional keys)
19 Version 6, ???????????
20 Version 7, 17 Mar 1995 (added grouped code option)
21 Version 8, 6 Jun 1995 (added numbering options)
22
23 Some sample codes are:
24 d'Aboville Henry modified Henry modern Henry
25 root 1 1 1 1
26 child 1 1.1 11 11 11
27 child 10 1.10 1X 1(10) 1A
28 child 11 1.11 1A 1(11) 1B
29 child 20 1.20 1J 1(20) 1K
30 g-child 1.20.1 1J1 1(20)1 1K1
31 gg-child 1.20.1.4 1J14 1(20)14 1K14
32 ggg-child 1.20.1.4.15 1J14E 1(20)14(15) 1K14F
33 gggg-child 1.20.1.4.15.3 1J14E3 1(20)14(15)3 1K14F3
34
35 Spouses codes, if requested, are indicated by appending .sn, where n
36 indicates which spouse is meant, and is omitted if there is only one
37 spouse. The root code is user selectable so that you can have
38 arbitrary code prefixes.
39
40 I use the latter feature when my database indicates that person X was
41 not a descendant of Y, but I want to rig up a report which indicates X
42 is to be included in Y's descendancy. I make two reports, one of Y's
43 real descendancy, and the second of X's giving X the number he would
44 have in Y's descendancy. Then I need merely edit the two files to
45 achieve the desired result.
46
47 The program can also generate grouped codes, where the generation
48 separator (if any) is replace by a comma every three generations. The
49 choice of arbitrary roots indicates that an additional parameter, the
50 initial comma location, be selectable. The grouped format is
51 sometimes used in published genealogies, using a single capital letter
52 for the root symbol.
53
54 The user can elect to include only male descendance lines. This is
55 useful for single-name studies. In this case, spouses are not printed
56 as separate entries, but are indicated with the descendant. For
57 female descendants, an indication of the number of children is also
58 printed.
59
60 The user can select whether no dates, simple dates (birth - death), or
61 dates and places (birth, baptism, death, burial, one per line) are to
62 be printed. Also top-level notes can be optionally printed. The
63 program only understands PAF-like events and notes. Printing simple
64 dates and no notes gives a useful one-line-per-person outline.
65
66 The user can also elect to limit the number of generations to be printed
67 out. Selecting 0 means all generations will be printed out.
68
69 The user can also elect to include keys for each individual in the report.
70
71 The user can also elect to exclude, with annotation, repeated individuals.
72
73 The report will include a header and a trailer. You may easily modify the
74 do_header() and do_trailer() procedures to alter or eliminate these if
75 you wish.
76
77 */
78
79 global(do_notes)
80 global(do_dates)
81 global(do_keys)
82 global(generations)
83 global(written_people)
84 global(this_indi_already_done)
85 global(notation)
86 global(grouped)
87 global(code_sep)
88 global(group_sep)
89 global(comma_separation)
90 global(first_comma)
91 global(malesonly)
92
93 proc main ()
94 {
95 table(written_people)
96 dayformat(1)
97 monthformat(4)
98 getindimsg(indi_root,
99 "Enter root individual for report generation")
100 getstrmsg(root,
101 "Enter Henry code string for root individual (usually 1)")
102 list(henry_list)
103 push(henry_list,save(root))
104
105 list(choices)
106 enqueue(choices,save(concat("d'Aboville ",root,".5.12.10")))
107 enqueue(choices,save(concat("Henry ",root,"5BX")))
108 enqueue(choices,save(concat("modified Henry ",root,"5(12)(10)")))
109 enqueue(choices,save(concat("modern Henry ",root,"5CA")))
110 set(notation,menuchoose(choices,"Select notation:"))
111
112 if (eq(notation,1)) { set(code_sep,".") } else { set(code_sep,"") }
113 getintmsg(grouped,
114 "Enter 0 for ungrouped notation, 1 for grouped notation")
115 if (grouped) {
116 getintmsg(comma_separation,
117 "Enter comma separation, usually 3")
118 getintmsg(first_comma,
119 "Enter comma offset (0-2, default=0)")
120 set(group_sep,",")
121 } else {
122 set(group_sep,"")
123 set(comma_separation,999)
124 set(first_comma,0)
125 }
126 getintmsg(do_dates,
127 "Enter 0 for no dates, 1 for dates, 2 for dates+places")
128 getintmsg(do_notes,"Enter 0 for no notes, 1 for notes")
129 getintmsg(do_keys,"Enter 0 for no keys, 1 for keys")
130 getintmsg(malesonly,
131 "Enter 0 for all descendants, 1 for male lines only")
132 getintmsg(generations,"Enter number of generations (0=all)")
133 call do_header(indi_root)
134 call desc_sub(indi_root,henry_list)
135 call do_trailer(indi_root)
136 }
137
138 proc do_header(indi_root)
139 {
140 "desc-henry: Descendant report for " fullname(indi_root,0,1,80)
141 if (do_keys) { " (" key(indi_root) ")" }
142 "\nGenerated by the LifeLines Genealogical System on "
143 stddate(gettoday()) ".\n\n"
144 }
145
146 proc do_trailer(indi_root)
147 {
148 "\nEnd of Report\n"
149 }
150
151 proc do_name(person,henry_list,marr)
152 {
153 set(h,"")
154 set(c,sub(first_comma,1))
155 /* less one for the root symbol */
156 forlist(henry_list,l,li) {
157 if (not(strcmp(trim(l,1),"s"))) {
158 set(h,save(concat(h,".",l)))
159 }
160 else {
161 if (eq(li,1)) { set(h,concat(h,l)) }
162 elsif (and(grouped,eq(c,0))) { set(h,concat(h,group_sep,l)) }
163 else { set(h,concat(h,code_sep,l)) }
164 incr(c)
165 set(c,mod(c,comma_separation))
166 }
167 }
168 h ". "
169 if (person) { fullname(person,0,1,80) } else { "<SPOUSE>" }
170 if (and(person,eq(do_keys,1))) { " (" key(person) ")" }
171 if (l,lookup(written_people,key(person))) {
172 " appears above as " l "\n"
173 }
174 else {
175 if (person) { insert(written_people,save(key(person)),h) }
176 if (and(person,eq(do_dates,1))) {
177 " ("
178 set(e,birth(person))
179 if (and(e,date(e))) { date(e) }
180 else {
181 set(e,baptism(person))
182 if (and(e,date(e))) { "bap." date(e) }
183 }
184 " - "
185 set(e,death(person))
186 if (and(e,date(e))) { date(e) }
187 else {
188 set(e,burial(person))
189 if (and(e,date(e))) { "bur." date(e) }
190 }
191 ")"
192 }
193 "\n"
194 if (eq(do_dates,2)) {
195 if (person) {
196 if (e,birth(person)) { " b: " long(e) "\n" }
197 if (e,baptism(person)) { " bap: " long(e) "\n" }
198 }
199 if (marr) { " m: " long(marr) "\n"}
200 if (malesonly) {
201 set(nfam,nfamilies(person))
202 families(person,fam,sp,spi) {
203 if (gt(nfam,1)) { " m" d(spi) }
204 else { " m" }
205 ": " long(marriage(fam))
206 " to " if (sp) { fullname(sp,0,1,80) } else { "<SPOUSE>" }
207 if (female(person)) {
208 ", "
209 set(nc,nchildren(fam))
210 if (not(nc)) { "no children" }
211 else {
212 card(nc) " child" if (gt(nc,1)) { "ren" }
213 }
214 }
215 "\n"
216 }
217 }
218 if (person) {
219 if (e,death(person)) { " d: " long(e) "\n" }
220 if (e,burial(person)) { " bur: " long(e) "\n" }
221 }
222 }
223 if (and(person,eq(do_notes,1))) {
224 fornodes(inode(person), node) {
225 if (eq(0,strcmp("FILE", tag(node)))) {
226 copyfile(value(node)) }
227 elsif (eq(0,strcmp("NOTE", tag(node)))) {
228 " " value(node) "\n"
229 fornodes(node, subnode) {
230 if (eq(0,strcmp("CONT", tag(subnode)))) {
231 " " value(subnode) "\n" }
232 }
233 }
234 }
235 fornodes(inode(person), node) {
236 if (eq(0,strcmp("REFN", tag(node)))) {
237 " SOURCE: " value(node) "\n"
238 }
239 }
240 }
241 if (or(eq(do_dates,2),eq(do_notes,1))) { "\n" }
242 }
243 }
244
245 func desc_code(number)
246 {
247 if (eq(notation,1)) { return(d(number)) }
248 if (eq(notation,2)) {
249 if (lt(number,10)) { return(d(number)) }
250 if (eq(number,10)) { return("X") }
251 return(upper(alpha(sub(number,10))))
252 }
253 if (eq(notation,3)) {
254 if (lt(number,10)) { return(d(number)) }
255 return(concat("(",d(number),")"))
256 }
257 if (eq(notation,4)) {
258 if (lt(number,10)) { return(d(number)) }
259 return(upper(alpha(sub(number,9))))
260 }
261 return("?")
262 }
263
264
265 proc desc_sub(person,henry_list)
266 {
267 call do_name(person,henry_list,0)
268 set(nfam,nfamilies(person))
269 set(chi,0)
270 families(person,fam,sp,spi) {
271 if (not(malesonly)) {
272 if (gt(nfam,1)) { push(henry_list,save(concat("s",d(spi)))) }
273 else { push(henry_list,"s") }
274 call do_name(sp,henry_list,marriage(fam))
275 set(junk,pop(henry_list))
276 }
277 if (or(eq(generations,0),
278 lt(length(henry_list),generations))) {
279 if (or(not(malesonly),male(person))) {
280 children (fam,ch,famchi) {
281 incr(chi)
282 push(henry_list,save(desc_code(chi)))
283 call desc_sub(ch,henry_list)
284 set(junk,pop(henry_list))
285 }
286 }
287 }
288 }
289 }