Debian Codegraph @

reports/hp-anc.ll

raw
1 /*
2 * @progname hp-anc.ll
3 * @version 1 of 1995-12-01
4 * @author Dennis Nicklaus ([email protected])
5 * @category
6 * @output HPGL
7 * @description
8 *
9 * This LifeLines report program generates autoscaling HPGL ancestral and
10 * descendant charts. The ancestral charts can include the siblings
11 * of all direct ancestors (aunts, uncles, great-aunts, great-uncles, etc.)
12 * The chart format is based on the program GedChart, by Tom Blumer.
13 *
14 ** hp-anc was developed by modifying the output portion (print_person
15 ** function) of ps-anc3 (from ps-anc2). Thus most features of ps-anc3 are
16 ** still supported, except for the multi-page output option.
17 **
18 ** CAVEATS/FEATURES:
19 ** 1. You might find it useful to be familiar with ps-anc3 first.
20 ** 2. The HPGL text scaling here is very inadequate.
21 ** I just picked a couple of scale factors which work for the
22 ** paper size (usu 24x36 inches (E)) and chart depths (15-18 gen)
23 ** which I needed it for and typically use. The scale factors I
24 ** picked make the text still readable (if you use a 0.25 plotter pen)
25 ** but let you stuff a lot of information onto one chart.
26 ** Gedchart does a better job, but I don't know how.
27 ** And sometimes Gedchart scales the text down too far so it is
28 ** too small to read. These fixed scales avoid that,
29 ** but there is no guarantee that text lines won't run together
30 ** vertically or exceed it's "generation width".
31 **
32 ** 3. All the scaling & placement is done exactly as in ps-anc3, as
33 ** if we were generating postscript output. Then at the end,
34 ** that scale is just adjusted to an HPGL autoscale. This may
35 ** give you less than perfect results. I certainly haven't
36 ** tried all cases.
37 **
38 ** 4. Like Gedchart does, hp-anc includes a line of text on the
39 ** chart if you have a note which begins with the keyword tag GEDCHART.
40 ** For instance:
41 ** GEDCHART Fought in the Rev. War
42 ** will result in a line of text "Fought in the Rev. War"
43 ** on the chart for that person.
44 **
45 ** 5. ps-anc3 didn't have that note capability, and so the extra
46 ** line of text that requires is NOT built into the placement
47 ** algorithm for ancestor charts (but it does work for desc. charts).
48 ** Thus, you might end up with a note line which
49 ** comes out overwriting the next person down on the chart.
50 ** This will generally only be a problem with tightly packed siblings
51 ** or with people with no ancestors in an ancestor plot.
52 **
53 ** 6. I recommend you use a previewer for the output before
54 ** you waste a nice sheet of vellum and 30 min. on the plotter.
55 ** I run my HPGL output through hpgl2ps-v2 by Dan McCormick,
56 ** then view the postscript using pageview (Sun postscript
57 ** previewer) or ghostscript. hpgl2ps does not do the text scaling
58 ** conversion perfectly. So even though it looks like a line of text
59 ** is too long under the postscript viewer, it may be fine
60 ** when plotted out. You'll have to use some trial and error.
61 **
62 ** 7. A have added a couple extra date/place style options beyond
63 ** what ps-anc2 had. My favorite is the date+2places(#5)
64 ** which will turn Madison,DaneCo,WI into Madison,WI
65 ** or "Sitter,bei Ankum,Lower Saxony,Germany" into "Sitter,Germany"
66 ** You still may want to look at and edit the HPGL output before
67 ** you print it out to make sure everything is what you want.
68 **
69 ** 8. Has some rudimentary "print birth & death on same line" option.
70 **
71 ** 9. Jumped through a lot of hoops to save a little space when
72 ** moving from one generation to the next in do_des.
73 **
74 ** WISH LIST
75 ** 1. Use multiple colors? (but it already takes a long time to plot.
76 ** it'd be even longer if it has to switch pens)
77 ** 2. Take note line into account for placement of anc. charts.
78 ** 3. Better text scaling
79 ** 4. Figure out how to make characters like a-umlaut, o-umlaut,... in HPGL
80 ** (I currently do these with e<backspace>" but it isn't great.
81 ** 5. Change dates like "Aft 1990" to "Aft 1990" (remove extra spaces).
82 ** (I currently do this by hand with a text editor)
83 **
84 ** After you use this program a few times, you might wish to edit the
85 ** function interrogate_user(). This is the first function after
86 ** these comments and the global variable declarations. This
87 ** function is set up to make it easy for you to configure what
88 ** questions this program should ask you each time and what default
89 ** values it should use for questions not asked.
90 **
91 ** Please contact me if you like this program, find any bugs, have
92 ** any bug fixes, or want to suggest improvements. I am also always
93 ** on the lookout for better ancestral/descendant chart generating
94 ** programs. If you know of a program that generates charts which
95 ** you like better than those generated by this program, please drop
96 ** me a line.
97 **
98 ** This report program works with the LifeLines Genealogical database
99 ** program only. (see ftp://ftp.cac.psu.edu/pub/genealogy/lines/*)
100 **
101 ** hp-anc, 1 December 1995, by Dennis Nicklaus ([email protected])
102 ** heavily based on ps-anc3, which is a derivative of :
103 ** ps-anc2, 16 August 1994, by Fred Wheeler ([email protected])
104 **
105 ** CHANGE LOG
106 **
107 ** This is version 1
108 **
109 ** CREDITS
110 ** Many thanks to Fred Wheeler developer of ps-anc2
111 **
112 ** ABOUT GEDCHART (a different program)
113 **
114 ** I got some of the HPGL plotter setup commands from HPGL output
115 ** of the GEDCHART program written by Tom Blumner
116 ** ([email protected]). It is used here without his permission.
117 ** The report is very much like that generated by GedChart using the
118 ** -Sa or -Sd option. GEDCHART has some features this program does not.
119 **
120 ** GedChart is DOS program that generates ancestral and descendant
121 ** charts like this report program, and also fan charts. GedChart
122 ** works directly from a GEDCOM file and is completely independent of
123 ** LifeLines. It is currently up to version 1.6, which is a beta
124 ** version that may lead to a commercial product. You can find
125 ** GedChart at ftp:oak.oakland.edu/pub/msdos/genealgy/gedcht16.zip
126 **
127 */
128
129 global (high_pos_gen) /* array, highest so far in each generation */
130 global (high_pos_all) /* highest position so far for any generation */
131 global (last_child_pos) /* place where last child was enqueued on desc. chart */
132
133 global (name_height) /* height of name text on chart */
134 global (generation_height) /* space from parent to child on desc. chart */
135 global (date_height) /* height of birth/death/marriage date text */
136
137 global (no_parent_extra) /* constant, extra vert. line when no parent */
138
139 /* variables prompted from or configured by the user */
140
141 global (chart_type) /* int, 0: ancestral, 1: descendant */
142 global (all_same_line) /* int, 0: separate name, b,d lines,
143 1: name,b.d. all same line,name
144 2: name sep.,b.d. on same line
145 is NOT supported in HP format */
146
147 global (root_person) /* indi, person for whom to generate the chart */
148 global (font_name) /* string, name of font */
149 global (max_depth) /* int, maximum number of generations */
150 global (chart_label) /* string, label for corner of chart */
151 global (color_chart) /* boolean, is chart in color */
152 global (multi_page) /* boolean, is chart many page poster type */
153 global (x_pages) /* int, number of horizontal pages */
154 global (y_pages) /* int, number of vertical pages */
155 global (name_letters) /* int, maximum number of letters in a name */
156 global (title_method) /* int, code for how to insert titles */
157 global (depth_siblings) /* int, number of generations to show siblings */
158 global (dateplace_birth) /* int, date style for birth/death/marriage */
159 global (dateplace_death)
160 global (dateplace_marriage)
161 global (dennis)
162
163 /* variables to return values from procedures to make them functions */
164 global (do_anc_stack) /* stack, function do_anc is recursive */
165 global (person_height_return)
166 global (is_prefix_title_return)
167 global (dateplace_return)
168
169 /* these three constants define how close branches of the tree can get */
170 global (branch_dist_prev) /* minimum distance from previous generation */
171 global (branch_dist_same) /* minimum distance from same generation */
172 global (branch_dist_next) /* minimum distance from next generation */
173
174 /* stacks for storing the information for each person on the chart */
175 /* see proc's enqueue_person and dequeue_all_persons */
176
177 global (plist_person) /* the person (to extract name, birth, death) */
178 global (plist_depth) /* generation depth */
179 global (plist_pos) /* vertical position */
180 global (plist_line) /* 0,1 boolean, is direct ancestor? */
181 global (plist_mdate) /* marriage date */
182 global (plist_note) /* marriage date */
183
184 /* stacks for storing the information for each vertical line on the chart */
185 /* see proc's enqueue_vertical and dequeue_all_verticals */
186
187 global (llist_depth) /* generation depth */
188 global (llist_low) /* starting point */
189 global (llist_high) /* finishing point */
190
191 global (shortname_scale)
192 global (longname_scale)
193
194 global (shortdate_scale)
195 global (longdate_scale)
196 global (longname_cutoff)
197 global (longdate_cutoff)
198 /*
199 ** procedure: interrogate_user
200 **
201 ** This procedure is designed to be modified by the user. It asks
202 ** many questions about how to configure the charts. If your answer
203 ** to one of the questions is always the same, you can easily
204 ** hardwire your answer here so that you are never asked again.
205 **
206 ** An 'if' statement is wrapped around each question. The 'if (1)'
207 ** can be changed to an 'if (0)' to make the program use the default
208 ** value defined in the 'else' clause instead of asking every time.
209 **
210 */
211
212 proc interrogate_user ()
213 {
214
215 /*
216 ** QUESTION: What type of chart?
217 **
218 ** This should always be asked, unless you never use one of the two
219 ** types of charts.
220 **
221 */
222
223 if (1) {
224 getintmsg (chart_type,
225 "Enter 0 for ancestral, 1 for descendant chart")
226 } else {
227 set (chart_type, 1)
228 }
229
230 /*
231 ** QUESTION: Who is the root person?
232 **
233 ** This question should always be asked, unless you always use the same
234 ** person, which is not likely. If you do set a default, it is a string
235 ** representation of that persons number.
236 **
237 */
238
239 if (1) {
240 set (root_person, 0)
241 while ( not (root_person) ) {
242 getindimsg (root_person, "Identify root person for chart")
243 }
244 } else {
245 set (root_person, indi ("1"))
246 }
247
248 /*
249 ** QUESTION: How many generations should be shown?
250 **
251 ** This should always be explicitly asked.
252 **
253 */
254
255 if (1) {
256 getintmsg (max_depth, "Maximum number of generations")
257 } else {
258 set (max_depth, 6)
259 }
260 if (gt (max_depth,15)) {
261 set (shortname_scale,";SR0.166,0.266;")
262 set (longname_scale,";SR0.136,0.216;")
263 set (shortdate_scale,";SR0.136,0.216;LB")
264 } else {
265 set (shortname_scale,";SR0.201,0.322;")
266 set (longname_scale,";SR0.166,0.266;")
267 set (shortdate_scale,";SR0.151,0.241;LB")
268 }
269 set (longdate_scale,";SR0.100,0.161;LB")
270 if (lt (max_depth,8)) {
271 set (longname_cutoff,40)
272 set (longdate_cutoff,60)
273 }
274 else {
275 set (longname_cutoff,20)
276 set (longdate_cutoff,36)
277 }
278
279 /*
280 ** QUESTION: How many lines per person.
281 */
282 if (1) {
283 getintmsg (all_same_line,
284 "birth & death lines: 0=Sep.;1= with name.")
285 } else {
286 set (all_same_line, 0)
287 }
288
289 /*
290 ** QUESTION: How many generations should show siblings?
291 **
292 ** If you want to show siblings in all generations, set this default to 999.
293 ** This question is only asked for ancestral charts.
294 **
295 */
296
297 if (eq (chart_type, 0)) {
298
299 if (1) {
300 getintmsg (depth_siblings, "How many generations to show siblings")
301 } else {
302 set (depth_siblings, 1)
303 }
304
305 }
306
307 /*
308 ** QUESTION: What message should be shown in the corner of the chart?
309 **
310 ** I suggest not asking this question, and setting a default credit with
311 ** your name. The advantage of this is that you can have the date
312 ** automatically inserted.
313 **
314 */
315
316 if (1) {
317 getstrmsg (chart_label, "Label for corner of chart (your name, date)")
318 set (chart_label, save (chart_label))
319 } else {
320 dayformat (2)
321 monthformat (6)
322 dateformat (0)
323 set (chart_label,
324 concat ("by Dennis J. Nicklaus, ", save (stddate (gettoday ()))))
325 }
326
327 /*
328 ** QUESTION: What font should be used?
329 **
330 ** Because it is such a pain to enter a font name, and a spelling mistake
331 ** will get you an ugly default font, this should be set to a default. I
332 ** suggest one of: Times-Roman, NewCenturySchlbk-Roman, or ZapfChancery.
333 ** Search the Postscript code at bottom of this file for a longer list.
334 **
335 */
336
337 if (0) {
338 getstrmsg (font_name,
339 "Font (Times-Roman, NewCenturySchlbk-Roman, ZapfChancery, etc.")
340 set (font_name, save (font_name))
341 } else {
342 set (font_name, "Times-Roman")
343 }
344
345 /*
346 ** QUESTION: Should color be used?
347 **
348 ** If you don't have access to a color printer, you should probably turn
349 ** off this question.
350 **
351 */
352
353 if (0) {
354 getintmsg (color_chart, "Enter 0 for black/white, 1 for color")
355 } else {
356 set (color_chart, 0)
357 }
358
359 /*
360 ** QUESTION: Do you want multi-page poster output?
361 **
362 ** So that I am not hassled with this question everytime I run this
363 ** program, I turn this question off, but change the default on the
364 ** special occasion that I want a poster chart.
365 **
366 */
367
368 if (0) {
369 getintmsg (multi_page, "Enter 0 for single page, 1 for multipage")
370 } else {
371 set (multi_page, 0)
372 }
373
374 /*
375 ** QUESTION: How many pages make up the poster?
376 **
377 ** You will probably want to always ask this question. This question is
378 ** asked if a poster chart is requested.
379 **
380 */
381
382 if (multi_page) {
383
384 if (1) {
385 getintmsg (x_pages, "Number of horizontal pages")
386 getintmsg (y_pages, "Number of vertical pages")
387 } else {
388 set (x_pages, 3)
389 set (y_pages, 3)
390 }
391
392 } else {
393 set (x_pages, 1)
394 set (y_pages, 1)
395 }
396
397 /*
398 ** QUESTION: How should titles be used?
399 **
400 ** I would leave this default set to 'guess' (3), or 'none' (0), if you
401 ** don't want the titles. If find a title that is guessed incorrectly,
402 ** please send an e-mail to [email protected].
403 **
404 */
405
406 if (0) {
407 getintmsg (title_method,
408 "Title method (0:none,1:prefix,2:suffix,3:guess)")
409 } else {
410 set (title_method, 3)
411 }
412
413 /*
414 ** QUESTION: What is the maximum length for names?
415 **
416 ** It is best to just set a default maximum name length. If you want
417 ** to always show the complete name, just set the default to 999.
418 **
419 */
420
421 if (0) {
422 getintmsg (name_letters, "Maximum name length")
423 } else {
424 set (name_letters, 40)
425 }
426
427 /*
428 ** QUESTION: How should dates/places of birth/death/marriage be shown?
429 **
430 ** This is actually three questions, or the same question for birth
431 ** death and marriage dates. The codes cause the dates to be printed
432 ** as follows.
433 **
434 ** 0: do not show date
435 ** 1: full date only
436 ** [ LifeLines date() function ]
437 ** 2: date and place, just year and State/Country
438 ** [ LifeLines short() function ]
439 ** 3: full date and full place, can get very long and thus smushed
440 ** [ LifeLines long() function ]
441 ** 4: full date and 1st place field
442 ** 5: full date and 1st and last place fields (useful for picking
443 ** up the city, country or city,state without the county).
444 **
445 */
446
447 if (1) {
448 set (dateplace_birth, 99)
449 while (or (lt (dateplace_birth, 0), ge (dateplace_birth, 6))) {
450 getintmsg (dateplace_birth,
451 "Birth date style (0:no,1:date,2:short,3:long,4:date+1st place,5:+2pl)")
452 }
453 set (dateplace_death, 99)
454 while (or (lt (dateplace_death, 0), ge (dateplace_death, 6))) {
455 getintmsg (dateplace_death,
456 "Death date style (0:no,1:date,2:short,3:long,4:date+1st place,5:+2pl)")
457 }
458 set (dateplace_marriage, 99)
459 while (or (lt (dateplace_marriage, 0),
460 ge (dateplace_marriage, 6))) {
461 getintmsg (dateplace_marriage,
462 "Marriage date style (0:no,1:date,2:short,3:long,4:date+1st place,5:+2pl)")
463 }
464 } else {
465 set (dateplace_birth, 5)
466 set (dateplace_death, 5)
467 set (dateplace_marriage, 5)
468 }
469
470 /*
471 ** END OF QUESTIONS
472 **
473 */
474
475 }
476
477 /*
478 ** procedure: main
479 **
480 ** The main procedure.
481 **
482 */
483
484 proc main ()
485 {
486
487 /* set constants */
488
489 set (name_height, 1300) /* height to allow for name text */
490 set (date_height, 750) /* height to allow for date text */
491 set (generation_height, 1300) /* space from parent to child in des. chart */
492
493 set (branch_dist_prev, 1200) /* previous generation */
494 set (branch_dist_same, 1500) /* same generation */
495 set (branch_dist_next, 1200) /* next generation */
496
497 set (no_parent_extra, 600) /* a little extra line when no parent */
498
499 /* initialize other global variables and declare global stacks */
500
501 set (high_pos_all, 0)
502
503 list (high_pos_gen)
504 list (do_anc_stack)
505
506 list (plist_person)
507 list (plist_depth)
508 list (plist_pos)
509 list (plist_line)
510 list (plist_mdate)
511 list (plist_note)
512
513 list (llist_depth)
514 list (llist_low)
515 list (llist_high)
516
517 call interrogate_user ()
518
519 /* covert the numerical response for color to "true" or "false" */
520
521 if (eq (color_chart, 0)) {
522 set (color_true_false, "false")
523 } else {
524 set (color_true_false, "true")
525 }
526
527 /* start iteration that creates the chart */
528
529 if (eq (chart_type, 0)) {
530 call do_anc (root_person, 1, 0, 0)
531 } else {
532 call do_des (root_person, 1)
533 }
534
535 /* put the pieces together to make the output file */
536
537 set (xi, 1)
538 while ( le (xi, x_pages)) {
539 set (yi, 1)
540 while ( le (yi, y_pages)) {
541
542 call print_header (font_name, max_depth, high_pos_all,
543 color_true_false, chart_label,
544 xi, x_pages, yi, y_pages)
545 call dequeue_all_persons ()
546 call dequeue_all_verticals ()
547 call print_tailer()
548 set (yi, add (yi, 1))
549 }
550 set (xi, add (xi, 1))
551 }
552
553 }
554
555 /*
556 ** procedure: do_anc
557 **
558 ** A recursive function to position persons on an ancestral chart.
559 ** First, a recursive call is made to put the father on the chart.
560 ** Where he is put on the chart determines the minimum position for
561 ** the mother. Once the father and mother are put on the chart, the
562 ** siblings are put on the chart.
563 **
564 ** The position of the person is returned via the global stack
565 ** do_anc_stack. A stack is necessary since this procedure is
566 ** reentrant.
567 **
568 */
569
570 proc do_anc (person, depth, min_pos_arg, marriage_date)
571 {
572 /* don't want to modify procedure argument variable, so copy it */
573
574 set (min_pos, min_pos_arg)
575
576 /* figure out number of siblings and total sibling height */
577 /* done differently, depending on whether the parents family exists */
578
579 set (fam, parents (person))
580 if ( and ( fam, le (depth, depth_siblings) ) ) {
581
582 set (sibling_height, 0)
583 children (fam, child, unused_number) {
584 call person_height (child)
585 set (sibling_height, add (sibling_height, person_height_return))
586 }
587 set (num_siblings, nchildren (fam))
588
589 } else {
590
591 call person_height (child)
592 set (sibling_height, person_height_return)
593 set (num_siblings, 1)
594
595 }
596
597 /* add extra width for marriage date of male ancestor, if it is known */
598
599 if (marriage_date) {
600 set (sibling_height, add (sibling_height, date_height))
601 }
602
603 /* make sure minimum position is greater than zero */
604
605 if (lt (min_pos, 0)) {
606 set (min_pos, 0)
607 }
608
609 /* do not overlap another branch at the younger generation */
610
611 if (gt (depth, 1)) {
612 if (high, getel (high_pos_gen, sub (depth, 1))) {
613 if (lt (min_pos, add (high, branch_dist_prev))) {
614 set (min_pos, add (high, branch_dist_prev))
615 }
616 }
617 }
618
619 /* do not overlap another branch at the same generation */
620
621 if (high, getel (high_pos_gen, depth)) {
622 if (lt (min_pos, add (high, branch_dist_same))) {
623 set (min_pos, add (high, branch_dist_same))
624 }
625 }
626
627 /* do not overlap another branch at the older generation */
628
629 if (lt (depth, max_depth)) {
630 if (high, getel (high_pos_gen, add (depth, 1))) {
631 if (lt (min_pos, add (high, branch_dist_next))) {
632 set (min_pos, add (high, branch_dist_next))
633 }
634 }
635 }
636
637 /* do father if he exists and is not too deep */
638
639 set (dad_min_pos, sub (min_pos, name_height))
640 set (dad_pos, dad_min_pos)
641 set (did_dad, 0) /* boolean, is dad on the chart */
642
643 if (lt (depth, max_depth)) {
644 if (par, father (person)) {
645 call dateplace (marriage (parents (person)), dateplace_marriage)
646 if (dateplace_return) {
647 call do_anc (par, add (depth, 1), dad_min_pos, dateplace_return)
648 } else {
649 call do_anc (par, add (depth, 1), dad_min_pos, 0)
650 }
651 set (dad_pos, pop (do_anc_stack))
652 set (did_dad, 1)
653 }
654 }
655
656 if (lt (min_pos, add (dad_pos, name_height))) {
657 set (min_pos, add (dad_pos, name_height))
658 }
659
660 /* do mother if she exists and is not too deep */
661
662 set (mom_min_pos, add (add (dad_pos, name_height), sibling_height))
663 set (mom_pos, mom_min_pos)
664 set (did_mom, 0) /* boolean, is mom on the chart */
665
666 if (lt (depth, max_depth)) {
667 if (par, mother (person)) {
668 call do_anc (par, add (depth, 1), mom_min_pos, 0)
669 set (mom_pos, pop (do_anc_stack))
670 set (did_mom, 1)
671 }
672 }
673
674 /* find the spacer needed to line up siblings between parents */
675
676 set (delta, sub (mom_pos, add (dad_pos, name_height)))
677 set (extra, sub (delta, sibling_height))
678 set (spacer, div (extra, add (num_siblings, 1)))
679
680 set (pos, add (dad_pos, name_height))
681 set (pos, add (pos, spacer))
682
683 /* position siblings, differently depending on whether parents exist */
684
685 if (fam, parents (person)) {
686
687 if ( le (depth, depth_siblings)) {
688
689 children (fam, child, number) {
690
691 /* if this is the ancestor, return the position and use marriage */
692
693 if (eq (child, person)) {
694 call enqueue_person (child, depth, pos, 1, marriage_date)
695 push (do_anc_stack, pos)
696 } else {
697 call enqueue_person (child, depth, pos, 0, 0)
698 }
699
700 /* store the positions of the first and last children */
701
702 if (eq (number, 1)) {
703 set (first_pos, pos)
704 }
705 if (eq (number, nchildren (fam))) {
706 set (last_pos, pos)
707 }
708
709 /* increment position by height of person plus the spacer */
710
711 call person_height (child)
712 set (pos, add (pos, person_height_return))
713 if (and (eq (child, person), marriage_date)) {
714 set (pos, add (pos, date_height))
715 }
716 set (pos, add (pos, spacer))
717 }
718
719 } else {
720
721 call enqueue_person (person, depth, pos, 1, marriage_date)
722 push (do_anc_stack, pos)
723
724 /* this may cause a line of zero length to be drawn */
725 set (first_pos, pos)
726 set (last_pos, pos)
727
728 /* increment position by height of person plus the spacer */
729
730 call person_height (person)
731 set (pos, add (pos, person_height_return))
732 if (marriage_date) {
733 set (pos, add (pos, date_height))
734 }
735 set (pos, add (pos, spacer))
736 }
737
738 /* if father is on the chart, he determines the vertical line start */
739 /* otherwise, the oldest sibling does */
740
741 if (eq (did_dad, 1)) {
742 set (line_start, dad_pos)
743 } else {
744 set (line_start, sub (first_pos, no_parent_extra))
745 }
746
747 /* note: line_start may be < 0, that is OK */
748
749 /* if mother is on the chart, she determines the vertical line end */
750 /* otherwise, the youngest sibling does */
751
752 if (eq (did_mom, 1)) {
753 set (line_end, mom_pos)
754 } else {
755 set (line_end, add (last_pos, no_parent_extra))
756 }
757
758 /* print vert. line if parent or any siblings are on the chart */
759
760 if (or (or (did_mom, did_dad), gt (nchildren (fam), 1))) {
761 call enqueue_vertical (depth, line_start, line_end)
762 /* update highest overall position */
763 if (lt (high_pos_all, add (line_end, name_height))) {
764 set (high_pos_all, add (line_end, name_height))
765 }
766 }
767
768 } else {
769
770 /* else, if the person has no visible siblings */
771
772 call enqueue_person (person, depth, pos, 1, marriage_date)
773 push (do_anc_stack, pos)
774
775 /* increment position by height of person plus the spacer */
776
777 call person_height (person)
778 set (pos, add (pos, person_height_return))
779 if (marriage_date) {
780 set (pos, add (pos, date_height))
781 }
782 set (pos, add (pos, spacer))
783 }
784
785 /* update the highest position array, or set it for the first time */
786
787 if (high, getel (high_pos_gen, depth)) {
788 if (lt (high, pos)) {
789 setel (high_pos_gen, depth, pos)
790 }
791 } else {
792 setel (high_pos_gen, depth, pos)
793 }
794
795 /* update the overall highest position */
796
797 if (lt (high_pos_all, pos)) {
798 set (high_pos_all, pos)
799 }
800 }
801
802 /*
803 ** procedure: do_des
804 **
805 ** A recursive function to position persons on a descendant chart.
806 **
807 */
808
809 proc do_des (person, depth)
810 {
811 /* don't want to modify procedure argument variable, so copy it */
812
813 set (min_pos, min_pos_arg)
814
815 set (make_line, 0)
816 set (this_persons_fams,nfamilies(person))
817 set (spouse_number,0)
818
819 if (female (person)) {
820 families (person, fam, spouse, num) {
821 set (make_line, 1)
822 if (eq (num, 1)) {
823 set (line_top, high_pos_all)
824 }
825 call dateplace (marriage (fam), dateplace_marriage)
826 set (mdate, dateplace_return)
827 if (spouse) {
828 set (spouse_number,add(1,spouse_number))
829 call enqueue_person (spouse, depth, high_pos_all, 0, mdate)
830 call person_height (spouse)
831 set (high_pos_all, add (high_pos_all, generation_height))
832 set (saw_female_family,0)
833 set (extra_height, sub (person_height_return,generation_height))
834 if (mdate) {
835 set (extra_height, add (extra_height, date_height))
836 }
837 } else {
838 set (high_pos_all, add (high_pos_all, generation_height))
839 }
840 if (lt (depth, max_depth)) {
841 children (fam, child, cn) {
842 set (saw_female_family,1)
843 call do_des (child, add (depth, 1))
844 }
845 }
846 /* if it is not the last spouse, then if there were no kids,
847 make sure we leave sufficient space below him */
848 if (ne(spouse_number,this_persons_fams)){
849 if (eq(0,saw_female_family)){
850 set (high_pos_all, add (high_pos_all, extra_height))
851 set(extra_height,0)
852 }
853 }
854 }/* end families loop */
855 if (eq(0,saw_female_family)){
856 set (high_pos_all, add (high_pos_all, extra_height))
857 set(saw_female_family,2)
858 }
859
860 if (eq(1,saw_female_family)){
861 set(high_pos_all,add(last_child_pos,generation_height))
862 }
863 set(last_child_pos,high_pos_all)
864 call enqueue_person (person, depth, high_pos_all, 1, 0)
865 set (line_bot, high_pos_all)
866 call person_height (person)
867 set (high_pos_all, add (high_pos_all, person_height_return))
868
869 } else {
870 set(last_child_pos,high_pos_all)
871 call enqueue_person (person, depth, high_pos_all, 1, 0)
872 set (line_top, high_pos_all)
873 call person_height (person)
874 set (high_pos_all, add (high_pos_all, generation_height))
875 set (extra_height, sub (person_height_return,generation_height))
876
877 families (person, fam, spouse, num) {
878 set (saw_male_family,0)
879 set (make_line, 1)
880 if (lt (depth, max_depth)) {
881 children (fam, child, cn) {
882 set(saw_male_family,1)
883 call do_des (child, add (depth, 1))
884 }
885 }
886 if (eq(0,saw_male_family)){
887 set (high_pos_all, add (high_pos_all, extra_height))
888 set(saw_male_family,2)
889 }
890 call dateplace (marriage (fam), dateplace_marriage)
891 set (mdate, dateplace_return)
892 set (line_bot, high_pos_all)
893 if (spouse) {
894 if (eq(1,saw_male_family)){
895 set(high_pos_all,add(last_child_pos,generation_height))
896 set (line_bot, high_pos_all)
897 set(extra_height,0)
898 }
899 set(last_child_pos,high_pos_all)
900 call enqueue_person (spouse, depth, high_pos_all, 0, mdate)
901 call person_height (spouse)
902 set (high_pos_all, add (high_pos_all, person_height_return))
903 if (mdate) {
904 set (high_pos_all, add (high_pos_all, date_height))
905 }
906 } else {
907 set (high_pos_all, add (high_pos_all, name_height))
908 }
909 }
910 /* add in the rest of this male's height if he has no family (no kids) */
911 if (eq(0,saw_male_family)){
912 set (high_pos_all, add (high_pos_all, extra_height))
913 set(saw_male_family,1)
914 }
915
916 }
917
918 if (make_line) {
919 call enqueue_vertical (depth, line_top, line_bot)
920 }
921 }
922 /*
923 ** procedure: do_des_oldone
924 **
925 ** older version of do_des
926 **
927 */
928 proc do_des_oldone (person, depth)
929 {
930 /* don't want to modify procedure argument variable, so copy it */
931
932 set (min_pos, min_pos_arg)
933
934 set (make_line, 0)
935
936 if (female (person)) {
937
938 families (person, fam, spouse, num) {
939 set (make_line, 1)
940 if (eq (num, 1)) {
941 set (line_top, high_pos_all)
942 }
943 call dateplace (marriage (fam), dateplace_marriage)
944 set (mdate, dateplace_return)
945
946
947 if (spouse) {
948 call enqueue_person (spouse, depth, high_pos_all, 0, mdate)
949 call person_height (spouse)
950 set (high_pos_all, add (high_pos_all, person_height_return))
951 if (mdate) {
952 set (high_pos_all, add (high_pos_all, date_height))
953 }
954 } else {
955 set (high_pos_all, add (high_pos_all, name_height))
956 }
957 if (lt (depth, max_depth)) {
958 children (fam, child, cn) {
959 call do_des (child, add (depth, 1))
960 }
961 }
962 }
963 call enqueue_person (person, depth, high_pos_all, 1, 0)
964 set (line_bot, high_pos_all)
965 call person_height (person)
966 set (high_pos_all, add (high_pos_all, person_height_return))
967
968 } else {
969
970 call enqueue_person (person, depth, high_pos_all, 1, 0)
971 set (line_top, high_pos_all)
972 call person_height (person)
973 set (high_pos_all, add (high_pos_all, person_height_return))
974 families (person, fam, spouse, num) {
975 set (make_line, 1)
976 if (lt (depth, max_depth)) {
977 children (fam, child, cn) {
978 call do_des (child, add (depth, 1))
979 }
980 }
981 call dateplace (marriage (fam), dateplace_marriage)
982 set (mdate, dateplace_return)
983 set (line_bot, high_pos_all)
984 if (spouse) {
985 call enqueue_person (spouse, depth, high_pos_all, 0, mdate)
986 call person_height (spouse)
987 set (high_pos_all, add (high_pos_all, person_height_return))
988 if (mdate) {
989 set (high_pos_all, add (high_pos_all, date_height))
990 }
991 } else {
992 set (high_pos_all, add (high_pos_all, name_height))
993 }
994 }
995 }
996
997 if (make_line) {
998 call enqueue_vertical (depth, line_top, line_bot)
999 }
1000 }
1001
1002 /*
1003 ** procedure: dateplace
1004 **
1005 ** Get the date of an event in the appropriate style (which may include
1006 ** the place. Return via global variable.
1007 **
1008 */
1009
1010 proc dateplace (ev, style)
1011 {
1012 list(placeList)
1013 if (eq (style, 0)) {
1014 set (dateplace_return, 0)
1015 }
1016 if (eq (style, 1)) {
1017 set (dateplace_return, save (date (ev)))
1018 }
1019 if (eq (style, 2)) {
1020 set (dateplace_return, save (short (ev)))
1021 }
1022 if (eq( style, 3)) {
1023 set (dateplace_return, save (long (ev)))
1024 }
1025 if (eq (style, 4)) { /* date + first place field */
1026 extractplaces(ev,placeList,nPlaces)
1027 /* we want to find the first non-empty place.
1028 We have to use this placeEq thing here to let
1029 us skip past leading commas, effectively.
1030 We look at the first place field initially,
1031 but if it is blank, then we incr placeEq so
1032 that we check the next place field for a value */
1033 set (placeEq,1)
1034 forlist (placeList, theplace, placeN) {
1035 if (eq(strlen(theplace),0)){
1036 incr(placeEq)
1037 }
1038 if (eq(placeN,placeEq)){
1039 set (dennis,save(theplace))
1040 }
1041 }
1042 /* if there was no place info, just return the date.
1043 But if there was some place info, concatenate it
1044 onto the date, with a space in between. */
1045 if (eq (nPlaces,0)){
1046 set (dateplace_return, save (date (ev)))
1047 }
1048 else {
1049 set (dateplace_return, save (concat (date (ev),concat(" ",dennis))))
1050 }
1051 }
1052 if (eq (style, 5)) { /* date + first + last place fields */
1053 extractplaces(ev,placeList,nPlaces)
1054 /* we want to find the first non-empty place.
1055 We have to use this placeEq thing here to let
1056 us skip past leading commas, effectively.
1057 We look at the first place field initially,
1058 but if it is blank, then we incr placeEq so
1059 that we check the next place field for a value */
1060 set (placeincr_once_already,0)
1061 set (dennislast,"")
1062 set (placeEq,1)
1063 forlist (placeList, theplace, placeN) {
1064 if (eq(strlen(theplace),0)){
1065 incr(placeEq)
1066 }
1067 else{
1068 if (eq(placeN,placeEq)){
1069 if (eq(placeincr_once_already,0)){
1070 set (dennis,save(theplace))
1071 set (placeincr_once_already,1)
1072 }
1073 else {
1074 set (dennislast,save(theplace))
1075 }
1076 incr(placeEq)
1077 } /* end if eq */
1078 } /* end else non-null */
1079 } /* end forlist */
1080 if (ge (strlen(dennislast),0)){
1081 set (dennisfirst,save(dennis))
1082 set (dennis,save(concat(concat(dennisfirst,","),dennislast)))
1083 }
1084 /* if there was no place info, just return the date.
1085 But if there was some place info, concatenate it
1086 onto the date, with a space in between. */
1087 if (eq (nPlaces,0)){
1088 set (dateplace_return, save (date (ev)))
1089 }
1090 else {
1091 set (dateplace_return, save (concat (date (ev),concat(" ",dennis))))
1092 }
1093 }
1094 if (ge (style, 6)) {
1095 print ("error: invalid date style code")
1096 }
1097 }
1098
1099 /*
1100 ** procedure: person_height
1101 **
1102 ** Return the height of a single persons entry. Only the name, and
1103 ** birth and death dates are considered. The name is assumed to be in
1104 ** the database, the dates are checked for. The marriage date is not
1105 ** checked for here. It is more tricky since it is only put below the
1106 ** father's name and you have to make sure you have the date from the
1107 ** right marriage.
1108 **
1109 ** The height of the person is returned via the global variable
1110 ** person_height_return. This global variable is used since LifeLines
1111 ** does not yet provide user-defined functions.
1112 **
1113 */
1114
1115 proc person_height (person)
1116 {
1117 set (person_height_return, name_height)
1118
1119 call dateplace (birth (person), dateplace_birth)
1120 if (eq(0,all_same_line)){ /* count b. & d. both */
1121 if (dateplace_return) {
1122 set (person_height_return, add (person_height_return, date_height))
1123 }
1124
1125 call dateplace (death (person), dateplace_death)
1126 if (dateplace_return) {
1127 set (person_height_return, add (person_height_return, date_height))
1128 }
1129 }
1130 if (eq(2,all_same_line)){ /* only count b. or death, not both */
1131 if (dateplace_return) {
1132 set (person_height_return, add (person_height_return, date_height))
1133 }
1134 else{
1135 call dateplace (death (person), dateplace_death)
1136 if (dateplace_return) {
1137 set (person_height_return, add (person_height_return, date_height))
1138 }
1139 }
1140 }
1141 /* The gedchart note location doesn't work for anc. chart. I don't know why.
1142 I guess it runs out of space or something?
1143 I guess it is OK since they don't usually matter for space
1144 in anc. charts (unless siblings are included or at end generations)*/
1145 if (eq(chart_type,1)){
1146 set(hadgednote,0)
1147 fornotes(inode(person),note){
1148 set (i, index(note,"GEDCHART",1))
1149 if (gt(i,0)){
1150 set(hadgednote,1)
1151 }
1152 }
1153 if (eq(hadgednote,1)){
1154 set (person_height_return, add (person_height_return, date_height))
1155 }
1156 }
1157
1158 }
1159
1160 /*
1161 ** procedure: is_prefix_title
1162 **
1163 ** Decide if the given title is a prefix type title. Returns boolean
1164 ** response in global variable is_prefix_title_return.
1165 **
1166 */
1167
1168 proc is_prefix_title (t)
1169 {
1170 set (is_prefix_title_return, 0)
1171
1172 if (index (t, "Mr", 1)) { set (is_prefix_title_return, 1) }
1173 if (index (t, "Mrs", 1)) { set (is_prefix_title_return, 1) }
1174 if (index (t, "Ms", 1)) { set (is_prefix_title_return, 1) }
1175 if (index (t, "Miss", 1)) { set (is_prefix_title_return, 1) }
1176 if (index (t, "Dr", 1)) { set (is_prefix_title_return, 1) }
1177 if (index (t, "Prof", 1)) { set (is_prefix_title_return, 1) }
1178 if (index (t, "Hon", 1)) { set (is_prefix_title_return, 1) }
1179 if (index (t, "Judge", 1)) { set (is_prefix_title_return, 1) }
1180 if (index (t, "Brot", 1)) { set (is_prefix_title_return, 1) }
1181 if (index (t, "Sis", 1)) { set (is_prefix_title_return, 1) }
1182 if (index (t, "Deacon", 1)) { set (is_prefix_title_return, 1) }
1183 if (index (t, "Fr", 1)) { set (is_prefix_title_return, 1) }
1184 if (index (t, "Father", 1)) { set (is_prefix_title_return, 1) }
1185 if (index (t, "Rev", 1)) { set (is_prefix_title_return, 1) }
1186 if (index (t, "Mons", 1)) { set (is_prefix_title_return, 1) }
1187 if (index (t, "Msgr", 1)) { set (is_prefix_title_return, 1) }
1188 if (index (t, "Arch", 1)) { set (is_prefix_title_return, 1) }
1189 if (index (t, "Bish", 1)) { set (is_prefix_title_return, 1) }
1190 if (index (t, "Card", 1)) { set (is_prefix_title_return, 1) }
1191 if (index (t, "Pope", 1)) { set (is_prefix_title_return, 1) }
1192 if (index (t, "Lord", 1)) { set (is_prefix_title_return, 1) }
1193 if (index (t, "Baron", 1)) { set (is_prefix_title_return, 1) }
1194 if (index (t, "Duke", 1)) { set (is_prefix_title_return, 1) }
1195 if (index (t, "Princ", 1)) { set (is_prefix_title_return, 1) }
1196 if (index (t, "Lady", 1)) { set (is_prefix_title_return, 1) }
1197 if (index (t, "Queen", 1)) { set (is_prefix_title_return, 1) }
1198 if (index (t, "King", 1)) { set (is_prefix_title_return, 1) }
1199 if (index (t, "Pres", 1)) { set (is_prefix_title_return, 1) }
1200 if (index (t, "Sen", 1)) { set (is_prefix_title_return, 1) }
1201 if (index (t, "Cong", 1)) { set (is_prefix_title_return, 1) }
1202 if (index (t, "Rep", 1)) { set (is_prefix_title_return, 1) }
1203 }
1204
1205 /*
1206 ** procedure: enqueue_person
1207 **
1208 ** Store the data for a person in the global lists. It will be
1209 ** printed later.
1210 **
1211 */
1212 global(chartnote)
1213 proc enqueue_person (person, depth, pos, line, mdate)
1214 {
1215 enqueue (plist_person, person)
1216 enqueue (plist_depth, depth)
1217 enqueue (plist_pos, pos)
1218 enqueue (plist_line, line)
1219 enqueue (plist_mdate, mdate)
1220
1221 /* Inserted by D. Nicklaus. Find the GEDCHART NOTE and enqueue it, too */
1222 set(chartnote,"")
1223 fornotes(inode(person),note){
1224 set (i, index(note,"GEDCHART",1))
1225 if (gt(i,0)){
1226 set(chartnote,save(substring(note,add(9,i),strlen(note))))
1227 }
1228
1229
1230 }
1231 enqueue (plist_note, chartnote)
1232
1233
1234
1235 }
1236
1237 /*
1238 ** procedure: dequeue_all_persons
1239 **
1240 ** Dequeue and print all persons stored in the global lists. The
1241 ** lines are stored in a second queue as they are printed and then
1242 ** placed back in the original, global, queue.
1243 **
1244 */
1245
1246 proc dequeue_all_persons ()
1247 {
1248 list (tlist_person)
1249 list (tlist_depth)
1250 list (tlist_pos)
1251 list (tlist_line)
1252 list (tlist_mdate)
1253 list (tlist_note)
1254
1255 while (person, dequeue (plist_person)) {
1256 set (depth, dequeue (plist_depth))
1257 set (pos, dequeue (plist_pos))
1258 set (line, dequeue (plist_line))
1259 set (mdate, dequeue (plist_mdate))
1260 set (noteprint, dequeue (plist_note))
1261
1262 call print_person (person, depth, pos, line, mdate,noteprint)
1263
1264 enqueue (tlist_person, person)
1265 enqueue (tlist_depth, depth)
1266 enqueue (tlist_pos, pos)
1267 enqueue (tlist_line, line)
1268 enqueue (tlist_mdate, mdate)
1269 enqueue (tlist_note, noteprint)
1270 }
1271
1272 while (person, dequeue (tlist_person)) {
1273 set (depth, dequeue (tlist_depth))
1274 set (pos, dequeue (tlist_pos))
1275 set (line, dequeue (tlist_line))
1276 set (mdate, dequeue (tlist_mdate))
1277 set (noteprint, dequeue (tlist_note))
1278
1279 enqueue (plist_person, person)
1280 enqueue (plist_depth, depth)
1281 enqueue (plist_pos, pos)
1282 enqueue (plist_line, line)
1283 enqueue (plist_mdate, mdate)
1284 enqueue (plist_note, noteprint)
1285 }
1286 }
1287
1288 /*
1289 ** procedure: print_person
1290 **
1291 ** Print a line of data for a person in postscript format. Each line
1292 ** printed is essentially a call to a postscript function defined in the
1293 ** header.
1294 **
1295 */
1296
1297 proc print_person (person, depth, pos, line, mdate,noteprint)
1298 {
1299 /* since there is no floating point, multiply everything by another
1300 1000/1000 to not lose too much precision*/
1301 set(normpos,div(mul(high_pos_all,1000),9950))
1302 /* I really want to divide by 10020 there, but I need extra room for
1303 the birth and death lines of the lowest person */
1304 set(pos, sub(high_pos_all,pos))
1305 set(pos, div(mul(pos,1000),normpos))
1306
1307 /* extra offset for b. & d. lines of lowest person */
1308 set(pos, add(pos,70))
1309
1310 if (eq (title_method, 0)) {
1311 set (prefix_title, 0)
1312 set (suffix_title, 0)
1313 }
1314 if (eq (title_method, 1)) {
1315 set (prefix_title, title (person))
1316 set (suffix_title, 0)
1317 }
1318 if (eq (title_method, 2)) {
1319 set (prefix_title, 0)
1320 set (suffix_title, title (person))
1321 }
1322 if (eq (title_method, 3)) {
1323 set (prefix_title, 0)
1324 set (suffix_title, 0)
1325 if (t, title (person)) {
1326 call is_prefix_title (t)
1327 if (is_prefix_title_return) {
1328 set (prefix_title, t)
1329 } else {
1330 set (suffix_title, t)
1331 }
1332 }
1333 }
1334 set (xposdennis,add(64,mul(div (8000,max_depth),sub(depth,1))))
1335 /* First draw the horiz. line */
1336 /* 1=direct ancestor, 0=sibling, the "line" variable controls this */
1337 /* chart_type "0 for ancestral, 1 for descendant chart" */
1338 set (xposdennis_siboff,0) /* initial setting */
1339 /* if (eq(chart_type,0)){*/
1340 if (eq(line,0)){
1341 set (xposdennis_siboff,25)
1342 }/*}*/
1343 "PA"
1344 d (add(xposdennis,xposdennis_siboff))
1345 ","
1346 d (pos)
1347 ";PD;PA"
1348 d (add(xposdennis,div (8000,max_depth)))
1349 ","
1350 d (pos)
1351 ";PU;"
1352
1353 /* now draw the text */
1354 set(pos, add(pos,9))
1355 set (xposdennis,add(12,xposdennis))
1356 "PA"
1357 d (add(xposdennis,xposdennis_siboff))
1358 ","
1359 d (pos)
1360 if (gt(strlen(name (person)),longname_cutoff)){
1361 longname_scale
1362 }
1363 else{
1364 shortname_scale
1365 }
1366 "LB"
1367 set (nlet, name_letters)
1368 if (prefix_title) {
1369 set (nlet, sub (nlet, strlen (prefix_title)))
1370 }
1371 if (suffix_title) {
1372 set (nlet, sub (nlet, strlen (suffix_title)))
1373 }
1374
1375 /* print name and title, if it exists */
1376
1377 if (prefix_title) {
1378 prefix_title " "
1379 }
1380 fullname (person, 0, 1, nlet)
1381 if (suffix_title) {
1382 " " suffix_title
1383 }
1384 if(eq(all_same_line,1)){
1385 /* print birth date, if it exists */
1386 call dateplace (birth (person), dateplace_birth)
1387 if (dateplace_return) {
1388 " b. " dateplace_return
1389 }
1390 call dateplace (death (person), dateplace_death)
1391 if (dateplace_return) {
1392 " d. " dateplace_return
1393 }
1394 }
1395
1396 "PU;"
1397 set (mypos,sub(pos,40))
1398
1399 if(ne(all_same_line,1)){
1400 /* print birth date, if it exists */
1401 call dateplace (birth (person), dateplace_birth)
1402 if (dateplace_return) {
1403 "PA"
1404 d (add(xposdennis,xposdennis_siboff))
1405 ","
1406 d (mypos)
1407 if (gt(strlen(dateplace_return),longdate_cutoff)){
1408 longdate_scale
1409 }
1410 else{
1411 shortdate_scale
1412 }
1413 "b. "
1414 dateplace_return
1415
1416 "PU;"
1417 set (mypos,sub(mypos,35))
1418 }
1419 }
1420
1421 /* print marriage date, if it exists */
1422 if (mdate) {
1423 "PA"
1424 d (add(xposdennis,xposdennis_siboff))
1425 ","
1426 d (mypos)
1427 if (gt(strlen(mdate),longdate_cutoff)){
1428 longdate_scale
1429 }
1430 else{
1431 shortdate_scale
1432 }
1433 "m. "
1434 mdate
1435 "PU;"
1436 set (mypos,sub(mypos,35))
1437 }
1438
1439 if(ne(all_same_line,1)){
1440 /* print death date, if it exists */
1441 call dateplace (death (person), dateplace_death)
1442 if (dateplace_return) {
1443 "PA"
1444 d (add(xposdennis,xposdennis_siboff))
1445 ","
1446 d (mypos)
1447 if (gt(strlen(dateplace_return),longdate_cutoff)){
1448 longdate_scale
1449 }
1450 else{
1451 shortdate_scale
1452 }
1453 "d. "
1454 dateplace_return
1455 "PU;"
1456 set (mypos,sub(mypos,35))
1457 }
1458 }
1459 /* optional special tagged note */
1460 if (noteprint) { /* make sure it exists */
1461 if (gt(strlen(noteprint),0)){ /* make sure it is non-null */
1462 "PA"
1463 d (add(xposdennis,xposdennis_siboff))
1464 ","
1465 d (mypos)
1466 if (gt(strlen(noteprint),longdate_cutoff)){
1467 longdate_scale
1468 }
1469 else{
1470 shortdate_scale
1471 }
1472 noteprint
1473 "PU;"
1474 set (mypos,sub(mypos,35))
1475 }}
1476
1477
1478
1479 nl()
1480 }
1481
1482 /*
1483 ** procedure: enqueue_vertical
1484 **
1485 ** Enqueue the data for a single vertical line onto the global lists.
1486 **
1487 */
1488
1489 proc enqueue_vertical (depth, low, high)
1490 {
1491 enqueue (llist_depth, depth)
1492 enqueue (llist_low, low)
1493 enqueue (llist_high, high)
1494 }
1495
1496 /*
1497 ** procedure: dequeue_all_verticals
1498 **
1499 ** Dequeue and print all vertical lines. The lines are stored in a
1500 ** second queue as they are printed and then placed back in the
1501 ** original, global, queue.
1502 **
1503 */
1504
1505 proc dequeue_all_verticals ()
1506 {
1507 list (tlist_depth)
1508 list (tlist_low)
1509 list (tlist_high)
1510
1511 while (depth, dequeue (llist_depth)) {
1512 set (low, dequeue (llist_low))
1513 set (high, dequeue (llist_high))
1514
1515 call print_vertical (depth, low, high)
1516
1517 enqueue (tlist_depth, depth)
1518 enqueue (tlist_low, low)
1519 enqueue (tlist_high, high)
1520 }
1521
1522 while (depth, dequeue (tlist_depth)) {
1523 set (low, dequeue (tlist_low))
1524 set (high, dequeue (tlist_high))
1525
1526 enqueue (llist_depth, depth)
1527 enqueue (llist_low, low)
1528 enqueue (llist_high, high)
1529 }
1530 }
1531
1532 /*
1533 ** procedure: print_vertical
1534 **
1535 ** Print a single vertical line to link a married couple or siblings.
1536 **
1537 */
1538
1539 proc print_vertical (depth, low, high)
1540 {
1541 /* do same normalizations as in print_person */
1542 /* since there is no floating point, multiply everything by another
1543 1000/1000 to not lose too much precision*/
1544 set(normpos,div(mul(high_pos_all,1000),9950))
1545 set(low, sub(high_pos_all,low))
1546 set(low, div(mul(low,1000),normpos))
1547 set(high, sub(high_pos_all,high))
1548 set(high, div(mul(high,1000),normpos))
1549 /* extra offset for b. & d. lines of lowest person */
1550 set(low, add(low,70))
1551 set(high, add(high,70))
1552
1553
1554 set (xposdennis,add(64,mul(div (8000,max_depth),depth)))
1555
1556 "PA"
1557 d (xposdennis)
1558 ","
1559 d(low)
1560 ";PD;PA"
1561 d (xposdennis)
1562 ","
1563 d(high)
1564 ";PU;"
1565 }
1566
1567 /*
1568 ** procedure: print_thousandths
1569 **
1570 ** Since LifeLines does not offer a floating point type, decimal
1571 ** computation is done using integers that represent thousands. This
1572 ** procedure converts a number in thousandths to decimal notation and
1573 ** prints it. The length of the decimal part is checked to make sure
1574 ** it is padded with zeros correctly.
1575 **
1576 */
1577
1578 proc print_thousandths (n_arg)
1579 {
1580
1581 /* don't want to modify proc argument, so copy it */
1582 set (n, n_arg)
1583
1584 if (lt (n, 0)) {
1585 "-"
1586 set (n, neg (n))
1587 }
1588 d (n)
1589
1590 }
1591
1592 /*
1593 ** procedure: print_header
1594 **
1595 ** Arguments:
1596 ** fn: font name
1597 ** md: maximum level, integer
1598 ** mp: maximum position, integer in thousandths
1599 ** ctf: color true/false, string "true" or "false"
1600 ** cl: chart label, string
1601 ** xi: which horizontal page
1602 ** xn: number of horizontal pages
1603 ** yi: which vertical page
1604 ** yn: number of vertical pages
1605 **
1606 ** Print the initial postscript code. This code will likely be the
1607 ** bulk of the output file. It prints the border, defines postscript
1608 ** functions for printing peoples names, dates and the lines on the
1609 ** chart, and more. It will be followed by the data.
1610 **
1611 ** This postscript code was written by Thomas P. Blumer ([email protected]).
1612 ** The only modification is where data from the arguments is inserted.
1613 **
1614 */
1615
1616 proc print_header (fn, ml, mp, ctf, cl, xi, xn, yi, yn)
1617 {
1618 "IN;SP1;RO90;TD1;IP;SC0,8128,0,10160;PW0.88;PU;PA17,17;PD;PA8111,17;PA8111,10143;PA17,10143;PA17,17;PW;PW0.25;PU;PA60,60;PD;PA8068,60;PA8068,10100;PA60,10100;PA60,60;PW;WU1;PW0.0255;PU;"
1619 }
1620 /*
1621 ** procedure: print_tailer
1622 **
1623 ** Print the terminating code HPGL. This code will likely be the
1624 ** bulk of the output file. It prints the border, defines postscript
1625 ** functions for printing peoples names, dates and the lines on the
1626 ** chart, and more. It will be followed by the data.
1627 **
1628 **
1629 ** This HPGL code was written by Thomas P. Blumer ([email protected]).
1630 ** The only modification is where data from the arguments is inserted.
1631
1632 */
1633
1634 proc print_tailer ()
1635 {
1636 "PU;PA0,0;SP;EC1;PG1;EC1"
1637 }