1*779fc935Sceastha /*
2*779fc935Sceastha * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3*779fc935Sceastha * Use is subject to license terms.
4*779fc935Sceastha */
5*779fc935Sceastha
67c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
77c478bd9Sstevel@tonic-gate /* All Rights Reserved */
87c478bd9Sstevel@tonic-gate
97c478bd9Sstevel@tonic-gate /*
107c478bd9Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California.
117c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement
127c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution.
137c478bd9Sstevel@tonic-gate */
147c478bd9Sstevel@tonic-gate
15*779fc935Sceastha #pragma ident "%Z%%M% %I% %E% SMI"
167c478bd9Sstevel@tonic-gate
177c478bd9Sstevel@tonic-gate #include "e.h"
187c478bd9Sstevel@tonic-gate
19*779fc935Sceastha void
fromto(int p1,int p2,int p3)20*779fc935Sceastha fromto(int p1, int p2, int p3)
21*779fc935Sceastha {
227c478bd9Sstevel@tonic-gate int b, h1, b1, pss;
237c478bd9Sstevel@tonic-gate yyval = oalloc();
247c478bd9Sstevel@tonic-gate lfont[yyval] = rfont[yyval] = 0;
257c478bd9Sstevel@tonic-gate h1 = eht[yyval] = eht[p1];
267c478bd9Sstevel@tonic-gate b1 = ebase[p1];
277c478bd9Sstevel@tonic-gate b = 0;
287c478bd9Sstevel@tonic-gate pss = EFFPS(ps);
297c478bd9Sstevel@tonic-gate ps += 3;
307c478bd9Sstevel@tonic-gate nrwid(p1, ps, p1);
317c478bd9Sstevel@tonic-gate printf(".nr %d \\n(%d\n", yyval, p1);
327c478bd9Sstevel@tonic-gate if (p2 > 0) {
337c478bd9Sstevel@tonic-gate nrwid(p2, pss, p2);
34*779fc935Sceastha printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n",
35*779fc935Sceastha p2, yyval, yyval, p2);
367c478bd9Sstevel@tonic-gate eht[yyval] += eht[p2];
377c478bd9Sstevel@tonic-gate b = eht[p2];
387c478bd9Sstevel@tonic-gate }
397c478bd9Sstevel@tonic-gate if (p3 > 0) {
407c478bd9Sstevel@tonic-gate nrwid(p3, pss, p3);
41*779fc935Sceastha printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n",
42*779fc935Sceastha p3, yyval, yyval, p3);
437c478bd9Sstevel@tonic-gate eht[yyval] += eht[p3];
447c478bd9Sstevel@tonic-gate }
457c478bd9Sstevel@tonic-gate printf(".ds %d ", yyval); /* bottom of middle box */
467c478bd9Sstevel@tonic-gate if (p2 > 0) {
477c478bd9Sstevel@tonic-gate printf("\\v'%du'\\h'\\n(%du-\\n(%du/2u'\\s%d\\*(%d\\s%d",
487c478bd9Sstevel@tonic-gate eht[p2]-ebase[p2]+b1, yyval, p2, pss, p2, EFFPS(ps));
497c478bd9Sstevel@tonic-gate printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\\n",
507c478bd9Sstevel@tonic-gate yyval, p2, -(eht[p2]-ebase[p2]+b1));
517c478bd9Sstevel@tonic-gate }
527c478bd9Sstevel@tonic-gate #ifndef NEQN
537c478bd9Sstevel@tonic-gate printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du/2u'\\\n",
547c478bd9Sstevel@tonic-gate yyval, p1, p1, yyval, p1);
55*779fc935Sceastha #else /* NEQN */
56*779fc935Sceastha printf("\\h'\\n(%du-\\n(%du/2u'\\*(%d\\h'\\n(%du-\\n(%du+2u/2u'\\\n",
57*779fc935Sceastha yyval, p1, p1, yyval, p1);
58*779fc935Sceastha #endif /* NEQN */
597c478bd9Sstevel@tonic-gate if (p3 > 0) {
60*779fc935Sceastha printf("\\v'%du'\\h'-\\n(%du-\\n(%du/2u'\\s%d\\*(%d\\s%d"
61*779fc935Sceastha "\\h'\\n(%du-\\n(%du/2u'\\v'%du'\\\n",
62*779fc935Sceastha -(h1-b1+ebase[p3]), yyval, p3, pss, p3, EFFPS(ps),
63*779fc935Sceastha yyval, p3, (h1-b1+ebase[p3]));
647c478bd9Sstevel@tonic-gate }
657c478bd9Sstevel@tonic-gate printf("\n");
667c478bd9Sstevel@tonic-gate ebase[yyval] = b + b1;
67*779fc935Sceastha if (dbg)
68*779fc935Sceastha printf(".\tfrom to: S%d <- %d f %d t %d; h=%d b=%d\n",
697c478bd9Sstevel@tonic-gate yyval, p1, p2, p3, eht[yyval], ebase[yyval]);
707c478bd9Sstevel@tonic-gate ofree(p1);
717c478bd9Sstevel@tonic-gate if (p2 > 0) ofree(p2);
727c478bd9Sstevel@tonic-gate if (p3 > 0) ofree(p3);
737c478bd9Sstevel@tonic-gate }
74