xref: /onnv-gate/usr/src/cmd/eqn/over.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
3*0Sstevel@tonic-gate 
4*0Sstevel@tonic-gate 
5*0Sstevel@tonic-gate /*
6*0Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
7*0Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
8*0Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
9*0Sstevel@tonic-gate  */
10*0Sstevel@tonic-gate 
11*0Sstevel@tonic-gate /*
12*0Sstevel@tonic-gate  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13*0Sstevel@tonic-gate  * All Rights Reserved.
14*0Sstevel@tonic-gate  */
15*0Sstevel@tonic-gate 
16*0Sstevel@tonic-gate #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate # include "e.h"
19*0Sstevel@tonic-gate 
20*0Sstevel@tonic-gate boverb(p1, p2) int p1, p2; {
21*0Sstevel@tonic-gate 	int h, b, treg, d;
22*0Sstevel@tonic-gate 
23*0Sstevel@tonic-gate 	treg = oalloc();
24*0Sstevel@tonic-gate 	yyval = p1;
25*0Sstevel@tonic-gate #ifndef NEQN
26*0Sstevel@tonic-gate 	d = VERT(EM(0.3, ps));
27*0Sstevel@tonic-gate 	h = eht[p1] + eht[p2] + d;
28*0Sstevel@tonic-gate #else NEQN
29*0Sstevel@tonic-gate 	d = VERT(1);
30*0Sstevel@tonic-gate 	h = eht[p1] + eht[p2];
31*0Sstevel@tonic-gate #endif NEQN
32*0Sstevel@tonic-gate 	b = eht[p2] - d;
33*0Sstevel@tonic-gate 	if(dbg)printf(".\tb:bob: S%d <- S%d over S%d; b=%d, h=%d\n",
34*0Sstevel@tonic-gate 		yyval, p1, p2, b, h);
35*0Sstevel@tonic-gate 	nrwid(p1, ps, p1);
36*0Sstevel@tonic-gate 	nrwid(p2, ps, p2);
37*0Sstevel@tonic-gate 	printf(".nr %d \\n(%d\n", treg, p1);
38*0Sstevel@tonic-gate 	printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, treg, treg, p2);
39*0Sstevel@tonic-gate #ifndef NEQN
40*0Sstevel@tonic-gate 	printf(".nr %d \\n(%d+\\s%d.5m\\s0\n", treg, treg, EFFPS(ps));
41*0Sstevel@tonic-gate #endif NEQN
42*0Sstevel@tonic-gate 	printf(".ds %d \\v'%du'\\h'\\n(%du-\\n(%du/2u'\\*(%d\\\n",
43*0Sstevel@tonic-gate 		yyval, eht[p2]-ebase[p2]-d, treg, p2, p2);
44*0Sstevel@tonic-gate 	printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\*(%d\\\n",
45*0Sstevel@tonic-gate #ifndef NEQN
46*0Sstevel@tonic-gate 		p2, p1, -(eht[p2]-ebase[p2]+d+ebase[p1]), p1);
47*0Sstevel@tonic-gate 	printf("\\h'-\\n(%du-\\n(%du/2u+.1m'\\v'%du'\\l'\\n(%du-.2m'\\h'.1m'\\v'%du'\n",
48*0Sstevel@tonic-gate 		 treg, p1, ebase[p1]+d, treg, d);
49*0Sstevel@tonic-gate #else NEQN
50*0Sstevel@tonic-gate 		p2, p1, -eht[p2]+ebase[p2]-ebase[p1], p1);
51*0Sstevel@tonic-gate 	printf("\\h'-\\n(%du-\\n(%du-2u/2u'\\v'%du'\\l'\\n(%du'\\v'%du'\n",
52*0Sstevel@tonic-gate 		 treg, p1, ebase[p1], treg, d);
53*0Sstevel@tonic-gate #endif NEQN
54*0Sstevel@tonic-gate 	ebase[yyval] = b;
55*0Sstevel@tonic-gate 	eht[yyval] = h;
56*0Sstevel@tonic-gate 	lfont[yyval] = rfont[yyval] = 0;
57*0Sstevel@tonic-gate 	ofree(p2);
58*0Sstevel@tonic-gate 	ofree(treg);
59*0Sstevel@tonic-gate }
60