Debian Codegraph @

reports/ps-pedigree.ll

raw
1 /*
2 * @progname ps-pedigree.ll
3 * @version 1.1.0
4 * @author Stephen Woodbridge, [email protected]
5 * @category
6 * @output PostScript
7 * @description
8 *
9 * This report generates Multiple linked Pedigree Charts
10 * Each chart is 7 or 8 generations and as a line moves off
11 * a chart the new chart number is referenced. The output
12 * of this report is a POSTSCRIPT file. The text size is very
13 * small but readable (it seams less readable as I age!) on
14 * 8.5x11 paper with 8 generations and larger but somewhat
15 * compressed at 7 generations per chart. And an index of all
16 * persons on the charts is also created.
17 *
18 * Code by Stephen Woodbridge, [email protected]
19 * Copyright 1992 by Stephen Woodbridge
20 *
21 * Version one of this report was written in XLISP and this is a
22 * direct translation of that Lisp code.
23 *
24 * --- Version control info ---
25 *
26 * 10/22/92 - First Release 1.0.0
27 * 10/28/92 - changed box width to expand the text font
28 * added CENTER_LAST global to center names in last boxes
29 * 11/05/92 - Release 1.1.0 Added name sorted index and misc. other
30 * features and enhancements.
31 * 11/03/03 - Included into LifeLines standard distribution.
32 * ps-pedi.ps renamed to ps-pedigree.ps
33 *
34 * --- Comments about the program ---
35 *
36 * There are lots of global flags that control whether or not aspects
37 * of the output are generated. These are set in "init_globals" and
38 * the comments there will explain them. The title string for the
39 * index is also set here. The program will also generate an index of
40 * just the people in the pedigree OR all people in the database. This
41 * is controlled by the flag INDEX_ALL.
42 *
43 * All global are in capitals. Global constants are set in
44 * init_globals and are not changed as the program runs. The global
45 * variables are used throughout the execution.
46 * There is a global TRACE which will print most proc names as they
47 * are executed. This is helpful in tracking down SEGV crashes. There
48 * is a global LIST which will print the name of each person or a "."
49 * as it is processed. The enqueueing of people to be processed is
50 * done in plot_me.
51 *
52 * You can adjust the margins on the paper. This has the effect of
53 * pushing the plot off the top/bottom/left/right. See M_TOP/M_BOT/
54 * M_LEFT/M_RIGHT in init_globals. The current setting leaves a
55 * margin at the top for three-hole punching or binding.
56 *
57 * --- Comments about the PostScript output ---
58 *
59 * You can change the paper size without regenerating the output.
60 * The plot will scale to fit the paper. A ledger size paper makes
61 * the plots much easier to read. This can be done by editing line
62 * 66 in the output file. Just above this line are definitions for
63 * "a-size","a4-size" and "b4-size" paper. You can add your own paper
64 * sizes and reference them on line 66.
65 *
66 * Changing the small text font size will not nessasarily change the
67 * output on the paper because I compute an x and y scale factor the
68 * forces the chart into the bounds of the paper. Feel free to
69 * experiment and let me know if you get a good combination.
70 *
71 */
72
73 /* global variables */
74
75 global(RVAL) /* stack used to return values from procs */
76 global(ILIST) /* indi's to be done in next depth of charts */
77 global(NLIST) /* chart num of indi's above */
78 global(WHICH_CHART) /* table xrefs of indi to chart number */
79 global(FROM_CHART)
80 global(INDXSET)
81
82 global(CHART_NO)
83 global(CURRENT_CHART_NO)
84 global(PAGE) /* postscript page number being outputed */
85 global(PAGE_INDX)
86
87 /* global constants */
88
89 global(M_BOT)
90 global(M_LEFT)
91 global(M_RIGHT)
92 global(M_TOP)
93
94 global(LF_HGT)
95 global(LF_WDT)
96 global(SF_HGT)
97 global(SF_WDT)
98
99 global(BOX_H)
100 global(BOX_DH)
101
102 global(BOX_NC_1)
103 global(BOX_NC_2)
104
105 global(BOX_W)
106 global(BOX_WW)
107 global(BOX_SP)
108 global(BOX_DW)
109
110 global(CHART_PREFIX)
111 global(LEN_CHART_PREFIX)
112
113 global(TEXT_HGT)
114 global(TEXT_WDT)
115
116 global(INDEX_SIZE)
117 global(INDEX_LPP)
118 global(HEADER_SIZE)
119
120 global(LINE_COUNT)
121
122 global(PLOT_INUMS)
123 global(PLOT_DATE)
124 global(CENTER_LAST)
125 global(INDEX_ALL)
126 global(TITLE)
127
128 global(TRACE)
129 global(LIST)
130 global(PS_HDR_FILE)
131
132 /*
133 *--------------------------------------------------------*
134 */
135
136 proc main ()
137 {
138 set(TRACE, 0) /* trace proc calling sequence to trace down
139 SEGV: signal 11 crashes */
140
141 set(LIST, 0) /* list names as they are processed */
142
143 call init_globals()
144
145 list(RVAL)
146 list(ILIST)
147 list(NLIST)
148 table(WHICH_CHART)
149 table(FROM_CHART)
150 indiset(INDXSET)
151
152 getindi(me)
153
154 /*
155 * The program can make 3 thru n generation charts
156 * but only the 7 and 8 have good aspect ratios that
157 * make them usable.
158 */
159 getintmsg(max, "Enter max generations per chart [7 or 8]")
160 if (or( eq(max, 7), eq(max, 8)))
161 {
162 getintmsg(dmax, "Enter max depth of charts:")
163
164 enqueue(ILIST, me)
165 enqueue(NLIST, 1)
166
167 call plot_init(max, TITLE)
168 set(i, 1)
169 while(le(i, dmax))
170 {
171 set (jlist, ILIST)
172 set (mlist, NLIST)
173 list(ILIST)
174 list(NLIST)
175 while (me, dequeue (jlist))
176 {
177 set(cno, dequeue(mlist))
178 set(CURRENT_CHART_NO, cno)
179 call new_plot_page(cno)
180 call do_ancestors(me, 1, 0, max)
181 call title_chart(cno, me, max)
182 }
183 set(i, add(i, 1))
184 }
185 call plot_fini()
186
187 call do_index()
188 call index_fini()
189 }
190 }
191
192 proc init_globals()
193 {
194 /* initialize global constants */
195
196 /* Paper margins for output in points */
197 set(M_TOP, 27) /* 0.375in*72points/in */
198 set(M_BOT, 0)
199 set(M_LEFT, 0)
200 set(M_RIGHT, 0)
201
202 /* Large and small font sizes in points */
203 set(LF_HGT, 18)
204 set(LF_WDT, 12)
205 set(SF_HGT, 5)
206 set(SF_WDT, 4)
207
208 /* Size of text in boxes */
209 set(TEXT_HGT, SF_HGT)
210 set(TEXT_WDT, SF_WDT)
211
212 /* height of box and vertical spacing */
213 set(BOX_H, add(1, TEXT_HGT))
214 set(BOX_DH, add(1, BOX_H))
215
216 /* width of boxes in number of characters */
217 set(BOX_NC_1, 42)
218 set(BOX_NC_2, 30)
219
220 /* width of boxes and horizontal spacing */
221 set(BOX_W, mul(BOX_NC_2, TEXT_WDT))
222 set(BOX_WW, mul(BOX_NC_1, TEXT_WDT))
223 set(BOX_SP, div( mul(BOX_W, 3), 20)) /* BOX_W*0.15 */
224 set(BOX_DW, add(BOX_W, BOX_SP))
225
226 /* controls for the index */
227 set(INDEX_SIZE, 8)
228 set(INDEX_LPP, 80)
229 set(HEADER_SIZE, 10)
230
231 /* controls for what and how the charts appear */
232 set(CHART_PREFIX, "") /* if CHART_PREFIX=0 then don't number charts */
233 set(LEN_CHART_PREFIX, 0)
234 set(PLOT_INUMS, 1) /* bool 0=don't plot inums, 1=plot inums */
235 set(PLOT_DATE, 1) /* bool 0=don't date charts, 1=date charts */
236 set(CENTER_LAST, 1) /* bool 0=don't center names in last column,
237 1=center names */
238 set(INDEX_ALL, 0) /* bool 0=only index names on charts,
239 1=index all names in database */
240
241 /* global variables used to keep track of which chart */
242
243 set(CHART_NO, 1)
244 set(CURRENT_CHART_NO, 0)
245 set(PAGE, 0)
246 set(PAGE_INDX, 1)
247
248 set(PS_HDR_FILE, "ps-pedigree.ps") /* PostScript Header file name */
249
250 set(TITLE, "Pedigree Index") /* Title string for Index pages */
251
252 dayformat(0)
253 monthformat(3)
254 dateformat(0)
255 }
256
257 proc do_ancestors (me, depth, width, max)
258 {
259 if (TRACE) { print("do_ancestors ") }
260 if (me)
261 {
262 if (LIST) {
263 print(fullname(me,1,0,40)) print(" -")
264 print(key(me)) print(sp()) print(d(depth))
265 print(sp()) print(d(width)) print(nl())
266 } else
267 { print(".") }
268
269 set(my_tag, lookup(WHICH_CHART, key(me)))
270 call plot_me(me, depth, width, max)
271 if ( and( or( eq(1, depth), not(my_tag)), lt(depth, max)))
272 {
273 if (dad, father(me))
274 {
275 call get_width(1, width)
276 set(nwid, pop(RVAL))
277 call do_ancestors(dad, add(1, depth), nwid, max)
278 call connect_boxes( me, depth, width, nwid, max)
279 }
280 if (mom, mother(me))
281 {
282 call get_width(neg(1), width)
283 set(nwid, pop(RVAL))
284 call do_ancestors(mom, add(1, depth), nwid, max)
285 call connect_boxes( me, depth, width, nwid, max)
286 }
287 }
288 else
289 {
290 call box_org(depth, width, max)
291 call draw_ext(me, pop(RVAL), pop(RVAL), my_tag, eq(depth, max))
292 }
293 }
294 }
295
296 proc plot_me (me, depth, width, max)
297 {
298 if (TRACE) { print("plot_me ") }
299 set(last, eq(max, depth))
300 set(first, eq(1, depth))
301 set(style, ge(add(1, depth), max))
302 call box_org(depth, width, max)
303 set(my_x, pop(RVAL))
304 set(my_y, pop(RVAL))
305 /*
306 * This if controls whether or not siblings are plotted
307 */
308 if (first) { call do_sibs(me, my_x, my_y, last) }
309 else { call box_me(me, my_x, my_y, last) }
310
311 if (not(lookup(WHICH_CHART, key(me))))
312 {
313 set(ntag, CURRENT_CHART_NO)
314 if (and( last, parents(me)))
315 {
316 set(CHART_NO, add(1, CHART_NO))
317 set(ntag, CHART_NO)
318 call draw_ext(me, my_x, my_y, ntag, last)
319 enqueue(ILIST, me)
320 enqueue(NLIST, ntag)
321 insert(FROM_CHART, save(d(CHART_NO)), CURRENT_CHART_NO)
322 }
323 insert(WHICH_CHART, save(key(me)), ntag)
324 addtoset(INDXSET, me, ntag)
325 }
326 }
327
328 proc box_me (me, x, y, last)
329 {
330 if (TRACE) { print("box_me ") }
331 call get_dates(me)
332 call print_name(me, 0)
333 if (PLOT_INUMS) { set(num, save(concat("-", key(me)))) }
334 else { set(num, "") }
335 call draw_box_text(x, y, pop(RVAL), pop(RVAL), num, last)
336 }
337
338 proc do_sibs (me, x, y, last)
339 {
340 if (TRACE) { print("do_sibs ") }
341 set(nkids, nchildren(parents(me)))
342 set(bdh, mul(2, BOX_DH))
343 set(sy, div(mul(sub(nkids, 1), bdh), 2))
344 children( parents(me), child, nchild)
345 {
346 set(yy, add(y, sy))
347 call box_me(child, x, yy, last)
348 set(sy, sub(sy, bdh))
349 }
350 }
351
352 proc do_index()
353 {
354 if (TRACE) { print("do_index ") }
355 print(nl()) print("Collecting Index ...")
356 if (INDEX_ALL)
357 {
358 forindi(me, num)
359 {
360 if (not(lookup(WHICH_CHART, key(me)))) { addtoset(INDXSET, me, 0) }
361 }
362 }
363 print(nl()) print("Sorting Index ...")
364 namesort(INDXSET)
365 print(nl()) print("Outputing Index ")
366 forindiset(INDXSET, me, chart, num)
367 { call index_out(me, chart) print(".") }
368 }
369
370 /*
371 * -------- Postscript output routines ---------
372 */
373
374 proc plot_init (max, title)
375 {
376 if (TRACE) { print("plot_init ") }
377 set(PAGE, 0)
378 copyfile(PS_HDR_FILE)
379 call expt(2, sub(max, 2))
380 set(h, mul( add( pop(RVAL), 1), mul(2, BOX_DH)))
381 set(w, div( mul( add(max, 1), BOX_W), 2))
382 set(w, add(w, add( mul(max, BOX_SP), BOX_WW)))
383 if (CHART_PREFIX)
384 { set(w, add(w, mul( add(LEN_CHART_PREFIX, 3), TEXT_WDT))) }
385
386 "%%BeginSetup" nl()
387
388 "/pointsize " d(INDEX_SIZE) " def" nl()
389 "/headerpointsize "d(HEADER_SIZE) " def" nl()
390 "/filename (" title ") def" nl()
391 "/noheader false def" nl()
392 "/date (" date(gettoday()) ") def" nl()
393
394 "/nc-1 " d(BOX_NC_1) " def" nl()
395 "/nc-2 " d(BOX_NC_2) " def" nl()
396 "/margin-l " d(M_LEFT) " def" nl()
397 "/margin-r " d(M_RIGHT) " def" nl()
398 "/margin-t " d(M_TOP) " def" nl()
399 "/margin-b " d(M_BOT) " def" nl()
400 "/width-needed " d(w) " def" nl()
401 "/height-needed " d(h) " def" nl()
402 "/text-wdt " d(TEXT_WDT) " def" nl()
403 "/text-hgt " d(TEXT_HGT) " def" nl()
404 "setup" nl()
405 "/newpagesetup save def" nl()
406 "mark" nl()
407
408 "%%EndSetup" nl()
409
410 set(LINE_COUNT, 0)
411 }
412
413
414 proc new_plot_page (page_no)
415 {
416 if (TRACE) { print("new_plot_page ") }
417 set(PAGE, add(1, PAGE))
418 "%%Page: " d(page_no) " " d(PAGE) nl() "mark plotpagesetup" nl()
419 }
420
421 proc plot_fini ()
422 {
423 set(PAGE, add(1, PAGE))
424 }
425
426 proc draw_box_text (x, y, name, date, num, last)
427 {
428 if (TRACE) { print("draw_box_text ") }
429 if (last)
430 { "(" name " " date " " num ") "
431 if(CENTER_LAST) { set(t, " ct1") } else { set(t, " t1")}
432 }
433 else
434 { "(" name " " num ") (" date ") " set(t, " t2") }
435 d(x) " " d(y) t nl()
436 }
437
438 proc draw_ext (me, x, y, chartno, last)
439 {
440 if (TRACE) { print("draw_ext ") }
441 if (parents(me))
442 {
443 if (last) { set(bw, div(BOX_WW, 2)) }
444 else { set(bw, div(BOX_W, 2)) }
445 "np " d(add(x, bw)) " " d(y)
446 " mto " d(div(BOX_SP, 3)) " 0 rlto drw" nl()
447 if (and( chartno, CHART_PREFIX))
448 {
449 d( add(x, add(bw, add(TEXT_WDT, div(BOX_SP, 3))))) " "
450 d( sub(y, div(TEXT_HGT, 2))) " mto ("
451 CHART_PREFIX d(chartno) ") show" nl()
452 }
453 }
454 }
455
456 proc connect_boxes (me, depth, width1, width2, max)
457 {
458 if (TRACE) { print("connect_boxes ") }
459 call box_org(depth, width1, max)
460 set(x1, pop(RVAL))
461 set(y1, pop(RVAL))
462 call box_org(add(1, depth), width2, max)
463 set(x2, pop(RVAL))
464 set(y2, pop(RVAL))
465 set(dx, div( add(x1, x2), 2))
466 set(w2, div(BOX_W, 2))
467 set(w3, div(BOX_WW, 2))
468 set(dh, 0)
469 set(dw, w2)
470 set(rad, BOX_H)
471 set(style, 0)
472 if (eq(depth, 1))
473 {
474 set(nkids, nchildren(parents(me)))
475 set(sy, div( mul( sub(nkids, 1), mul(2, BOX_DH)), 2))
476 if (gt(width2, 0))
477 { set(y1, add(y1, sy)) } else { set(y1, sub(y1, sy)) }
478 }
479 if (lt(y1, y2))
480 { set(dh, BOX_H) } else { set(dh, neg(BOX_H)) }
481 if (eq( sub(max, depth), 1))
482 {
483 set(dw, w3)
484 set(style, 1)
485 set(rad, div(rad, 2))
486 set(dx, div( sub( add(x1, add(w2, x2)), w3), 2))
487 }
488 elsif( eq( sub(max, depth), 2))
489 {
490 set(dw, w2)
491 set(style, 1)
492 }
493 if (style)
494 {
495 d(div(rad, 2)) " gr np " d(add(x1, w2)) " " d(y1) " mto "
496 d(dx) " " d(y1) " " d(dx) " " d(y2) " pto "
497 d(sub(x2, dw)) " " d(y2) " pto lto drw" nl()
498 }
499 else
500 {
501 d(rad) " gr np " d(x1) " " d(add(y1, dh)) " mto "
502 d(x1) " " d(y2) " " d(sub(x2, w2)) " " d(y2) " pto lto drw" nl()
503 }
504 }
505
506 proc title_chart (chart_no, me, max)
507 {
508 if (TRACE) { print("title_chart ") }
509 if (gt( sub(max, 2), 0))
510 {
511 set(x, 0)
512 call expt(2, sub(max, 2))
513 set(y, mul( add( pop(RVAL), 1), mul(2, BOX_DH)))
514 set(w, div( mul( add(max, 1), BOX_W), 2))
515 set(w, add(w, add( mul(max, BOX_SP), BOX_WW)))
516 if (CHART_PREFIX)
517 { set(w, add(w, mul( add(4, LEN_CHART_PREFIX), TEXT_WDT))) }
518 d(y) " " d(w) " " d(x) " 0 mbox 18 1 rbox" nl()
519 if (PLOT_DATE)
520 {
521 d(add(x, LF_WDT)) " 1.2 mul " d(div(SF_HGT,2)) " mto ("
522 date(gettoday()) ") show" nl()
523 }
524 d(LF_WDT) " " d(LF_HGT) " mfont" nl()
525 call get_dates(me)
526 call print_name(me, 1)
527 d(add(x, mul(2, LF_WDT))) " "
528 d(sub(y, add(LF_HGT, div(LF_HGT, 2)))) " mto ("
529 pop(RVAL) ") show" nl()
530 d(add(x, mul(2, LF_WDT))) " "
531 d(sub(y, add( mul(LF_HGT, 2), div(LF_HGT,2)))) " mto ("
532 pop(RVAL) ") show" nl()
533 if (CHART_PREFIX)
534 {
535 d(add(x, LF_WDT)) " " d(div(LF_HGT,2)) " mto (Chart: "
536 CHART_PREFIX d(chart_no)
537 if (e, lookup(FROM_CHART, d(chart_no)))
538 { " From: " d(e) }
539 ") show" nl()
540 }
541 "cleartomark showpage" nl()
542 "%%EndPage: " d(PAGE) " " d(PAGE) nl()
543 }
544 }
545
546 /*
547 * -------- Postscript output routines for index ---------
548 */
549
550 proc index_fini()
551 {
552 if (TRACE) { print("index_fini ") }
553 "cleartomark showpage" nl()
554 "%%EndPage: " d(PAGE) " " d(PAGE) nl()
555 "%%Trailer" nl()
556 "%%Pages: " d(PAGE) nl()
557 }
558
559 proc index_out (me, chart)
560 {
561 if (TRACE) { print("index_out ") }
562 set(blanks, " ")
563 if (not(mod(LINE_COUNT, INDEX_LPP)))
564 {
565 "%%Page: " d(PAGE) " " d(PAGE) nl()
566 "mark indexpagesetup " d(PAGE_INDX) " pagesetup" nl()
567 }
568
569 "("
570 if (chart) { call rjt(chart, 5) pop(RVAL) } else { " " }
571 " " trim( save( concat( key(me)," ")), 6)
572 call get_dates(me)
573 call print_name(me, 1)
574 " " trim( save( concat(pop(RVAL),blanks)), 50) " " sex(me)
575 " " pop(RVAL) ")l" nl()
576
577 set(LINE_COUNT, add(LINE_COUNT,1))
578 if (not(mod(LINE_COUNT, INDEX_LPP)))
579 {
580 "cleartomark showpage" nl()
581 "%%EndPage: " d(PAGE) " " d(PAGE) nl()
582 set(PAGE, add(PAGE, 1))
583 set(PAGE_INDX, add(PAGE_INDX, 1))
584 set(LINE_COUNT, 0)
585 }
586 }
587
588 /*
589 * -------- Utility routines ---------
590 */
591
592 proc print_name (me, last)
593 {
594 if (TRACE) { print("print_name ") }
595 call get_title(me)
596 push(RVAL, save(concat(fullname(me, 1, not(last), 45), pop(RVAL))))
597 }
598
599 proc get_title (me)
600 {
601 if (TRACE) { print("get_title ") }
602 fornodes(inode(me), node)
603 {
604 if (not(strcmp("TITL", tag(node)))) { set(n, node) }
605 }
606 if (n) { push(RVAL, save(concat(" ", value(n)))) }
607 else { push(RVAL, "") }
608 }
609
610 proc get_dates (me)
611 {
612 if (TRACE) { print("get_dates ") }
613 if (e, birth(me)) { set(b, save(concat("( ", date(e)))) }
614 else { set(b, "( ") }
615 if (e, death(me)) { set(d, save(concat(" - " , date(e)))) }
616 else { set(d, " - ") }
617 push(RVAL, save(concat(b, concat(d, " )"))))
618 }
619
620 proc box_org (depth, width, max)
621 {
622 if (TRACE) { print("box_org ") }
623 set(xx, div( mul(BOX_W, 9), 16))
624 call expt(2, sub(max, 2))
625 set(yy, mul( add( pop(RVAL), 1), BOX_DH))
626 if ( eq(depth, 1))
627 { push(RVAL, yy) push(RVAL, xx) }
628 else
629 {
630 call expt(2, sub(max, depth))
631 set(dy, mul( pop(RVAL), BOX_DH))
632 call abs(width)
633 set(y, sub( mul(pop(RVAL), dy), div(dy, 2)))
634 set(dx, add(BOX_SP, div(BOX_W, 2)))
635 set(dd, sub( sub(max, 2), depth))
636 set(x, 0)
637 if ( eq(dd, neg(1)))
638 { set(dxx, div(BOX_W, 2)) }
639 elsif (eq(dd, neg(2)))
640 { set(dxx, add( div(BOX_W, 2), div(BOX_WW, 2))) }
641 else
642 { set(dxx, 0) }
643 set(x, add(dxx, add(xx, mul(dx, sub(depth, 1)))))
644 if ( lt(width, 0)) { set(y, neg(y)) }
645 push(RVAL, add(yy, y))
646 push(RVAL, x)
647 }
648 }
649
650 proc get_width (sign, width)
651 {
652 if (TRACE) { print("get_width ") }
653 if (eq(width, 0))
654 { push(RVAL, sign) }
655 else
656 {
657 call abs(width)
658 set(awidth, pop(RVAL))
659 set(s2, div(width, awidth))
660 if (eq(s2, sign))
661 { push(RVAL, mul(width, 2)) }
662 else
663 { push(RVAL, mul( sub( mul(awidth, 2), 1), s2)) }
664 }
665 }
666
667 proc abs (int)
668 {
669 if (TRACE) { print("abs ") }
670 if (lt(int, 0))
671 { push(RVAL, neg(int)) }
672 else
673 { push(RVAL, int) }
674 }
675
676 proc rjt(n, w)
677 {
678 if (lt(n, 10)) { set(d, 1) }
679 elsif (lt(n, 100)) { set(d, 2) }
680 elsif (lt(n, 1000)) { set(d, 3) }
681 elsif (lt(n, 10000)) { set(d, 4) }
682 else { set(d, 5) }
683 if (lt(d, w))
684 { set(pad, save( trim(" ", sub(w, d)))) }
685 else
686 { set(pad, "") }
687 push(RVAL, save( concat(pad, save(d(n)))))
688 }
689
690 proc expt(x, y)
691 {
692 if (TRACE) { print("expt ") }
693 if (le(y, 0)) { set(result, 1) }
694 else
695 {
696 set(result, x)
697 while (y, sub(y,1))
698 { set(result, mul(result, x)) }
699 }
700 push(RVAL, result)
701 }
702