1 /*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.proprietary.c%
6 */
7
8 #ifndef lint
9 static char sccsid[] = "@(#)fromto.c 4.4 (Berkeley) 04/17/91";
10 #endif /* not lint */
11
12 # include "e.h"
13
fromto(p1,p2,p3)14 fromto(p1, p2, p3) int p1, p2, p3; {
15 int b, h1, b1, pss;
16 yyval = oalloc();
17 lfont[yyval] = rfont[yyval] = 0;
18 h1 = eht[yyval] = eht[p1];
19 b1 = ebase[p1];
20 b = 0;
21 pss = EFFPS(ps);
22 ps += 3;
23 nrwid(p1, ps, p1);
24 printf(".nr %d \\n(%d\n", yyval, p1);
25 if( p2>0 ) {
26 nrwid(p2, pss, p2);
27 printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, yyval, yyval, p2);
28 eht[yyval] += eht[p2];
29 b = eht[p2];
30 }
31 if( p3>0 ) {
32 nrwid(p3, pss, p3);
33 printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p3, yyval, yyval, p3);
34 eht[yyval] += eht[p3];
35 }
36 printf(".ds %d ", yyval); /* bottom of middle box */
37 if( p2>0 ) {
38 printf("\\v'%du'\\h'\\n(%du-\\n(%du/2u'\\s%d\\*(%d\\s%d",
39 eht[p2]-ebase[p2]+b1, yyval, p2, pss, p2, EFFPS(ps));
40 printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\\n",
41 yyval, p2, -(eht[p2]-ebase[p2]+b1));
42 }
43 #ifndef NEQN
44 printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du/2u'\\\n",
45 #else NEQN
46 printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du+2u/2u'\\\n",
47 #endif NEQN
48 yyval, p1, p1, yyval, p1);
49 if( p3>0 ) {
50 printf("\\v'%du'\\h'-\\n(%du-\\n(%du/2u'\\s%d\\*(%d\\s%d\\h'\\n(%du-\\n(%du/2u'\\v'%du'\\\n",
51 -(h1-b1+ebase[p3]), yyval, p3, pss, p3, EFFPS(ps), yyval, p3, (h1-b1+ebase[p3]));
52 }
53 printf("\n");
54 ebase[yyval] = b + b1;
55 if(dbg)printf(".\tfrom to: S%d <- %d f %d t %d; h=%d b=%d\n",
56 yyval, p1, p2, p3, eht[yyval], ebase[yyval]);
57 ofree(p1);
58 if( p2>0 ) ofree(p2);
59 if( p3>0 ) ofree(p3);
60 }
61