Debian Codegraph @

reports/regvital.ll

raw
1 /*
2 * @progname regvital.ll
3 * @version 3.0
4 * @author Wetmore, Manis, Chandler
5 * @category
6 * @output nroff
7 * @description
8
9 This program produces a report of all descendents of a given person,
10 and is presently designed for 12 pitch, HP laserjet III, for printing
11 a book about that person. All NOTE and CONT lines are included in the
12 report, along with the vital statistics, occupations, immigrations,
13 attributes, and wills.
14 At the end of the report is a sorted listing of names of everyone
15 mentioned, with reference numbers giving the first occurrences of all
16 the names.
17
18
19 regvital
20
21 version 1 by Tom Wetmore
22 version 2 by Cliff Manis
23 version 3 by John Chandler, 1994
24
25 This program has paginated output with a footer and header.
26
27 This report produces a nroff output, and to produce the
28 output, use: nroff filename > filename.out
29 or: troff -t filename | lpr -t
30
31 */
32
33 global(bold)
34 global(idex)
35 global(srcs)
36 global(curref)
37 global(months)
38 global(dtform)
39 global(footn)
40 global(begnote)
41 global(endnote)
42
43 proc main () {
44
45 /* Customize the following: */
46 set(head,"Family History")
47 /* set(foot,"your name and address or whatever") */
48 set(foot,concat("Created ",stddate(gettoday())," by ",
49 getproperty("user.fullname"), " ",getproperty("user.email")))
50 set(ll,"8.5i") /* line length for headers */
51 set(dtform,0) /* date format: 0=dmy, 8=ymd, etc. */
52 set(footn,1) /* if 1, then do footnote-style sources */
53 set(fancy,0) /* if 1, then do superscript note refs */
54 set(bold,0) /* if 1, use boldface for names */
55
56 list(months)
57 enqueue(months,"Jan") enqueue(months,"Feb")
58 enqueue(months,"Mar") enqueue(months,"Apr")
59 enqueue(months,"May") enqueue(months,"Jun")
60 enqueue(months,"Jul") enqueue(months,"Aug")
61 enqueue(months,"Sep") enqueue(months,"Oct")
62 enqueue(months,"Nov") enqueue(months,"Dec")
63
64 if(fancy){
65 set(begnote,"\\u\\s-2") /* or use left-bracket for ASCII version */
66 set(endnote,"\\s0\\d") /* or use right-bracket */
67 } else {
68 set(begnote,"[")
69 set(endnote,"]")
70 }
71 dateformat(dtform)
72 if(or(eq(dtform,0),eq(dtform,8))){dayformat(0) monthformat(4)}
73 elsif(eq(dtform,1)){dayformat(2) monthformat(4)}
74 else{dayformat(1) monthformat(1)}
75
76 getindi(indi)
77 getintmsg(maxgen,"Enter max generations to include (0 if no limit)")
78 set(maxgen,sub(maxgen,1))
79
80 set(tday, gettoday())
81 ".de hd\n" /* header */
82 ".ev 1\n"
83 ".sp 2\n"
84 ".tl '" head "''%'\n"
85 ".tl ''" stddate(tday) "''\n"
86 "\n"
87 "'sp 3\n"
88 ".ev\n"
89 "..\n"
90 ".de fo\n" /* footer */
91 ".ev 1\n"
92 ".sp\n"
93 ".tl '" foot "'''\n"
94 ".sp\n"
95 ".ev\n"
96 "'bp\n"
97 "..\n"
98 ".wh 0 hd\n"
99 ".wh -.8i fo\n"
100 ".de CH\n" /* CHild number macro */
101 ".sp\n"
102 ".in 14n\n"
103 ".ti 0\n"
104 "\\h'5n'\\h'-\\w'\\\\$1'u'\\\\$1\\h'6n'\\h'-\\w'\\\\$2'u'\\\\$2\\h'2n'\n"
105 "..\n"
106 ".de II\n" /* Index Item macro */
107 ".br\n"
108 "\\\\$1\\h'-\\w'\\\\$1'u'\\h'35n'"
109 "\\\\$2\\h'-\\w'\\\\$2'u'\\h'13n'"
110 "\\\\$3\\h'-\\w'\\\\$3'u'\\h'13n'"
111 "\\\\$4\n"
112 "..\n"
113 ".de IN\n" /* Individual Number macro */
114 ".sp\n"
115 ".in 0\n"
116 "..\n"
117 ".de GN\n" /* Generation Number macro */
118 ".br\n"
119 ".ne 2i\n"
120 ".sp 2\n"
121 ".in 0\n"
122 ".ce\n"
123 "..\n"
124 ".de P\n" /* Paragraph macro */
125 ".sp\n"
126 ".in 0\n"
127 ".ti 5n\n" /* indent 1st line */
128 "..\n"
129 ".ev 1\n"
130 ".ll " ll nl() /* line length */
131 ".ev\n"
132 ".po 9\n" /* left margin */
133 ".ls 1\n"
134 ".na\n"
135 list(ilist) list(glist)
136 table(stab) indiset(idex)
137 enqueue(ilist,indi) enqueue(glist,1)
138 set(curgen,0) set(out,1) set(in,2)
139 if(footn) {list(srcs)}
140
141 while (indi,dequeue(ilist)) {
142 print("OUT: ") print(d(out))
143 print(" ") print(name(indi)) print(nl())
144 set(thisgen,dequeue(glist))
145 if (ne(curgen,thisgen)) {
146 if(or(lt(maxgen,0),gt(maxgen,1))){".GN\nGENERATION " d(thisgen) "\n\n"}
147 set(curgen,thisgen)
148 }
149 ".IN\n" d(out) ". "
150 insert(stab,save(key(indi)),out)
151 set(curref,out)
152 call longvitals(indi,curgen)
153 addtoset(idex,indi,curref)
154 set(out,add(out,1))
155 families(indi,fam,spouse,nfam) {
156 ".P\n"
157 if (spouse) { set(sname, save(name(spouse))) }
158 else { set(sname, "_____") }
159 if(eq(0,strcmp("",sname))) { set(sname, "_____") }
160 if (eq(0,nchildren(fam))) {
161 name(indi) " and " sname
162 " had no children.\n"
163 } elsif (and(spouse,lookup(stab,key(spouse)))) {
164 "Children of " name(indi) " and " sname " are shown "
165 "under " sname " (" d(lookup(stab,key(spouse))) ").\n"
166 } else {
167 "Children of " name(indi) " and " sname ":\n"
168 children(fam,child,nchl) {
169 set(haschild,0)
170 families(child,cfam,cspou,ncf) {
171 if (ne(0,nchildren(cfam))) { set(haschild,1) }
172 }
173 if(and(haschild,or(gt(maxgen,curgen),lt(maxgen,0)))) {
174 print("IN: ") print(d(in))
175 print(" ") print(name(child)) print(nl())
176 enqueue(ilist,child)
177 enqueue(glist,add(1,curgen))
178 ".CH " d(in) " " roman(nchl) nl()
179 set (in, add (in, 1))
180 call shortvitals(child)
181 } else {
182 ".CH " qt() qt() " " roman(nchl) nl()
183 call longvitals(child,0)
184 addtoset(idex,child,curref)
185 }
186 }
187 }
188 }
189 }
190 if(and(footn,length(srcs))){
191 "\n.in 0\n.sp 2\n---------------\n.sp\nSources of information:\n"
192 forlist(srcs,s,n){ if(gt(n,1)){";\n"} "[" d(n) "] " s }
193 ".\n"
194 }
195 if(or(lt(maxgen,0),gt(maxgen,1))){
196 print("begin sorting\n")
197 namesort(idex)
198 print("done sorting\n")
199 ".bp\n"
200 ".in 0\n"
201 "Index of Persons in this Report (first occurrence)\n\n"
202 ".II Name Birth Death #\n\n"
203 forindiset(idex,indi,v,n) {
204 ".II " qt()fullname(indi,1,0,30)qt()
205 " " qt()stddate(birth(indi))qt()
206 " " qt()stddate(death(indi))qt()
207 " " d(v) nl()
208 print(".")
209 }
210 nl()
211 print(nl())
212 }}
213
214 proc shortvitals(indi){
215 name(indi)
216 set(b,birth(indi)) set(d,death(indi))
217 if (and(b,short(b))) { ", b. " short(b) }
218 if (and(d,short(d))) { ", d. " short(d) }
219 nl()
220 }
221
222 proc longvitals(i,flag){ /* all data and notes for individual */
223 if(not(footn)) {list(srcs)}
224 if (bold) { "\\f3" }
225 name(i)
226 if (bold) { "\\f1" }
227 set(e,birth(i))
228 if(and(e,long(e))) { ",\nborn " call displong(e) }
229 if(not(and(e,place(e)))) {
230 set(e,baptism(i))
231 if(and(e,long(e))) { ",\nbaptized " call displong(e) }
232 }
233 if(eq(flag,1)) { call printparents(i) }
234 ".\n"
235 set(e,death(i))
236 if(and(e,long(e))) { "Died " call displong(e) ".\n" }
237 if(not(and(e,place(e)))) {
238 set(e,burial(i))
239 if(and(e,long(e))) {"Buried " call displong(e) ".\n"}
240 }
241 if (eq(1,nspouses(i))) {
242 spouses(i,s,f,n) {
243 if(e,marriage(f)) {
244 "Married"
245 } else {
246 /* "Lived with " */
247 "Married"
248 }
249 set(nocomma,1)
250 call spousevitals(s,f)
251 }
252 } else {
253 set(j,1)
254 spouses(i,s,f,n) {
255 if(e,marriage(f)) {
256 "Married " ord(j) ","
257 set(j,add(j,1))
258 } else {
259 "Married"
260 }
261 call spousevitals(s,f)
262 }
263 }
264 fornodes(inode(i), node) {
265 set(ntag, save(tag(node)))
266 if (eq(0,strcmp("FILE", ntag))) {
267 copyfile(value(node))
268 } elsif (eq(0,strcmp("NOTE", ntag))) {
269 value(node)
270 fornodes(node, subnode) {
271 if (eq(0,strcmp("CONT", tag(subnode)))) {
272 nl() value(subnode)
273 }
274 }
275 call setsrc(node) nl()
276 } elsif (eq(0,strcmp("OCCU", ntag))) {
277 "Occupation: " value(node)
278 call setsrc(node)
279 ".\n"
280 } elsif (eq(0,strcmp("ATTR", ntag))) {
281 "Attributes: " value(node)
282 call setsrc(node)
283 ".\n"
284 } elsif (eq(0,strcmp("IMMI", ntag))) {
285 if(long(node)) {
286 "Immigrated " call displong(node)
287 fornodes(node, subnode) {
288 if(eq(0,strcmp("NOTE",tag(subnode)))) {
289 ",\n" value(subnode)
290 }
291 }
292 ".\n"
293 }
294 } elsif (eq(0,strcmp("WILL", ntag))) {
295 if(long(node)) { "Made a will " call displong(node) ".\n" }
296 } elsif (eq(0,strcmp("PROB", ntag))) {
297 if(long(node)) { "Will proved " call displong(node) ".\n" }
298 }
299 }
300 if(and(not(footn),length(srcs))){
301 "\nSources of information:\n"
302 forlist(srcs,s,n){ if(gt(n,1)){";\n"} s }
303 ".\n"
304 }}
305
306 proc displong(e) { /* display full date, place, and age for an event */
307 /* long(e) */
308 extractdate(e,da,mo,yr)
309 if(mod,date(e)){
310 if(or(da,or(mo,yr))){
311 set(mod,trim(mod,3))
312 if(eq(0,strcmp(mod,"ABT"))) {"about "}
313 elsif(eq(0,strcmp(mod,"abo"))) {"about "}
314 elsif(eq(0,strcmp(mod,"AFT"))) {"after "}
315 elsif(eq(0,strcmp(mod,"aft"))) {"after "}
316 elsif(eq(0,strcmp(mod,"BEF"))) {"before "}
317 elsif(eq(0,strcmp(mod,"bef"))) {"before "}
318 elsif(eq(0,strcmp(mod,"BET"))) {"beginning "}
319 if(or(eq(1,dtform),le(8,dtform))){
320 if(yr){ d(yr) if(mo){" "}}
321 if(mo){ getel(months,mo) if(da){" "d(da)}}
322 } else{
323 if(da){ d(da) if(mo){" "}}
324 if(mo){ getel(months,mo) if(yr){" "}}
325 if(yr){d(yr)}
326 }
327 } else { mod }
328 if(place(e)){ ", "}
329 }
330 if(mod,place(e)) { mod }
331 fornodes(e,subnode) {
332 if(eq(0,strcmp("AGE",tag(subnode)))) {
333 ",\naged " value(subnode)
334 }
335 }
336 call setsrc(e)
337 }
338
339 proc setsrc(node) { /* collect source reference, if any */
340 fornodes(node,subnode){
341 if(eq(0,strcmp("SOUR",tag(subnode)))){
342 if(n,length(srcs)){
343 set(i,0)
344 while(lt(i,n)){
345 set(i,add(i,1))
346 if(eq(0,strcmp(getel(srcs,i),value(subnode)))){
347 set(n,i) set(skip,1)
348 }
349 }
350 }
351 if(not(skip)){
352 enqueue(srcs,save(value(subnode)))
353 set(i,add(n,1))
354 }
355 if(footn){
356 if(not(started)){begnote set(started,1)}
357 else{","}
358 d(i)}
359 }
360 }
361 if(started){endnote}
362 }
363
364 proc spousevitals (sp,fam) {
365 list(names)
366 addtoset(idex,sp,curref)
367 set(e,marriage(fam))
368 if (and(e,long(e))) { nl() call displong(e) "," }
369 "\n"
370 if (bold) { "\\f3" }
371 if(strcmp("",name(sp))) {name(sp)} else {"_____"}
372 if (bold) { "\\f1" }
373 if(e){
374 fornodes(e,subnode) {
375 if(eq(0,strcmp("NAME",tag(subnode)))){
376 extractnames(subnode,names,n,s)
377 if(s) {"\n(under the name " getel(names,s) ")"}
378 }
379 }
380 }
381 set(e,birth(sp))
382 if(and(e,long(e))) { ",\nborn " call displong(e) }
383 set(e,death(sp))
384 if(and(e,long(e))) { ",\ndied " call displong(e) }
385 call printparents(sp)
386 }
387
388 proc printparents(ind) { /* print only if non-blank */
389 if(dad,father(ind)) {if(ndad,name(dad)) {set(nbld,strcmp("",ndad))}}
390 if(mom,mother(ind)) {if(nmom,name(mom)) {set(nblm,strcmp("",nmom))}}
391 if (or(nbld,nblm)) {
392 ",\n"
393 if (male(ind)) { "son of " }
394 elsif (female(ind)) { "daughter of " }
395 else { "child of " }
396 }
397 if (nbld) { name(dad) }
398 if (and(nbld,nblm)) { "\nand " }
399 if (nblm) { name(mom) }
400 ".\n"
401 if (nbld) { addtoset(idex,dad,curref) }
402 if (nblm) { addtoset(idex,mom,curref) }
403 }
404
405 /* Sample printout of the report, plus also prints a names index.
406
407 Manes - Manis - Maness Family History
408 14 Jan 1993
409
410 GENERATION 1
411
412
413 1. William Bowers MANES, born 6 Jan 1868, Hamblen Co, TN ?, died 5
414 May 1933, Sevier Co, TN. Married 13 Apr 1892, White Pine, TN,
415 Cordelia "Corda" F. CANTER, born 7 Dec 1869, Jonesboro, Washington
416 Co, TN, died 18 Apr 1960, Knoxville, Knox Co, TN, daughter of James
417 H. CANTER and Martha Marie WHITEHORN. He died of pneumonia at his
418 homeplace in Union Valley, Sevier Co, TN He was buried at the Knob
419 Creek Baptist Church cemetery in Sevier County, TN.
420
421 Children of William Bowers MANES and Cordelia "Corda" F. CANTER:
422
423 2 i Nellie V. MANES, b. 1893, TN, d. 1984, TN
424
425 ii Emery H. MANES, born 24 Oct 1894, White Pine,
426 Jefferson Co, TN, died 26 Jul 1926, Knob Creek,
427 Sevier Co., TN. Died in auto accident, when he
428 and a brother were going in his truck with a load
429 of vegetables, and going to market in Knoxville.
430 He is buried at Knob Creek Cem. Sevier Co, TN.
431
432 3 iii Walter C. MANES, b. 1896, TN, d. 1989, TN
433
434 4 iv William Lee MANES, b. 1897, TN, d. 1969, TN
435
436 v George MANES, born 29 Oct 1898, Union Valley,
437 Sevier Co, TN, died 17 Jun 1899, Knob Creek,
438 Sevier Co, TN. Single, died as a infant, and is
439 buried at Knob Creek Cem, Sevier Co, TN.
440
441 5 vi Fuller Ruben MANES, b. 1902, TN, d. 1980, TN
442
443 6 vii Mabel E. MANES, b. 1905, TN
444
445 7 viii Lena G. MANES, b. 1906, TN, d. 1987, TN
446
447 8 ix Wade Preston MANES, b. 1910, TN
448
449 9 x Newman Clarence MANES, b. 1912, TN
450
451 //end of sample// */
452