1*364Sceastha /*
2*364Sceastha * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3*364Sceastha * Use is subject to license terms.
4*364Sceastha */
5*364Sceastha
60Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
70Sstevel@tonic-gate /* All Rights Reserved */
80Sstevel@tonic-gate
90Sstevel@tonic-gate /*
100Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California.
110Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement
120Sstevel@tonic-gate * specifies the terms and conditions for redistribution.
130Sstevel@tonic-gate */
14*364Sceastha
15*364Sceastha #pragma ident "%Z%%M% %I% %E% SMI"
160Sstevel@tonic-gate
17*364Sceastha #include "e.h"
180Sstevel@tonic-gate
19*364Sceastha void
fromto(int p1,int p2,int p3)20*364Sceastha fromto(int p1, int p2, int p3)
21*364Sceastha {
220Sstevel@tonic-gate int b, h1, b1, pss;
230Sstevel@tonic-gate yyval = oalloc();
240Sstevel@tonic-gate lfont[yyval] = rfont[yyval] = 0;
250Sstevel@tonic-gate h1 = eht[yyval] = eht[p1];
260Sstevel@tonic-gate b1 = ebase[p1];
270Sstevel@tonic-gate b = 0;
280Sstevel@tonic-gate pss = EFFPS(ps);
290Sstevel@tonic-gate ps += 3;
300Sstevel@tonic-gate nrwid(p1, ps, p1);
310Sstevel@tonic-gate printf(".nr %d \\n(%d\n", yyval, p1);
32*364Sceastha if (p2 > 0) {
330Sstevel@tonic-gate nrwid(p2, pss, p2);
34*364Sceastha printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n",
35*364Sceastha p2, yyval, yyval, p2);
360Sstevel@tonic-gate eht[yyval] += eht[p2];
370Sstevel@tonic-gate b = eht[p2];
380Sstevel@tonic-gate }
39*364Sceastha if (p3 > 0) {
400Sstevel@tonic-gate nrwid(p3, pss, p3);
41*364Sceastha printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n",
42*364Sceastha p3, yyval, yyval, p3);
430Sstevel@tonic-gate eht[yyval] += eht[p3];
440Sstevel@tonic-gate }
450Sstevel@tonic-gate printf(".ds %d ", yyval); /* bottom of middle box */
46*364Sceastha if (p2 > 0) {
47*364Sceastha printf("\\v'%du'\\h'\\n(%du-\\n(%du/2u'\\s%d\\*(%d\\s%d",
48*364Sceastha eht[p2]-ebase[p2]+b1, yyval, p2, pss, p2, EFFPS(ps));
49*364Sceastha printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\\n",
50*364Sceastha yyval, p2, -(eht[p2]-ebase[p2]+b1));
510Sstevel@tonic-gate }
520Sstevel@tonic-gate #ifndef NEQN
53*364Sceastha printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du/2u'\\\n",
54*364Sceastha yyval, p1, p1, yyval, p1);
55*364Sceastha #else /* NEQN */
56*364Sceastha printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du+2u/2u'\\\n",
57*364Sceastha yyval, p1, p1, yyval, p1);
58*364Sceastha #endif /* NEQN */
59*364Sceastha if (p3 > 0) {
60*364Sceastha printf("\\v'%du'\\h'-\\n(%du-\\n(%du/2u'\\s%d\\*(%d\\s%d"
61*364Sceastha "\\h'\\n(%du-\\n(%du/2u'\\v'%du'\\\n",
62*364Sceastha -(h1-b1+ebase[p3]), yyval, p3, pss, p3, EFFPS(ps),
63*364Sceastha yyval, p3, (h1-b1+ebase[p3]));
640Sstevel@tonic-gate }
650Sstevel@tonic-gate printf("\n");
660Sstevel@tonic-gate ebase[yyval] = b + b1;
67*364Sceastha if (dbg)
68*364Sceastha printf(".\tfrom to: S%d <- %d f %d t %d; h=%d b=%d\n",
69*364Sceastha yyval, p1, p2, p3, eht[yyval], ebase[yyval]);
700Sstevel@tonic-gate ofree(p1);
71*364Sceastha if (p2 > 0) ofree(p2);
72*364Sceastha if (p3 > 0) ofree(p3);
730Sstevel@tonic-gate }
74