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