xref: /original-bsd/old/eqn/common_source/over.c (revision 95b555db)
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[] = "@(#)over.c	4.4 (Berkeley) 04/17/91";
10 #endif /* not lint */
11 
12 # include "e.h"
13 
14 boverb(p1, p2) int p1, p2; {
15 	int h, b, treg, d;
16 
17 	treg = oalloc();
18 	yyval = p1;
19 #ifndef NEQN
20 	d = VERT((ps*6*3) / 10);	/* 0.3m */
21 	h = eht[p1] + eht[p2] + d;
22 #else NEQN
23 	d = VERT(1);
24 	h = eht[p1] + eht[p2];
25 #endif NEQN
26 	b = eht[p2] - d;
27 	if(dbg)printf(".\tb:bob: S%d <- S%d over S%d; b=%d, h=%d\n",
28 		yyval, p1, p2, b, h);
29 	nrwid(p1, ps, p1);
30 	nrwid(p2, ps, p2);
31 	printf(".nr %d \\n(%d\n", treg, p1);
32 	printf(".if \\n(%d>\\n(%d .nr %d \\n(%d\n", p2, treg, treg, p2);
33 #ifndef NEQN
34 	printf(".nr %d \\n(%d+\\s%d.5m\\s0\n", treg, treg, EFFPS(ps));
35 #endif NEQN
36 	printf(".ds %d \\v'%du'\\h'\\n(%du-\\n(%du/2u'\\*(%d\\\n",
37 		yyval, eht[p2]-ebase[p2]-d, treg, p2, p2);
38 	printf("\\h'-\\n(%du-\\n(%du/2u'\\v'%du'\\*(%d\\\n",
39 #ifndef NEQN
40 		p2, p1, -(eht[p2]-ebase[p2]+d+ebase[p1]), p1);
41 	printf("\\h'-\\n(%du-\\n(%du/2u+.1m'\\v'%du'\\l'\\n(%du-.2m'\\h'.1m'\\v'%du'\n",
42 		 treg, p1, ebase[p1]+d, treg, d);
43 #else NEQN
44 		p2, p1, -eht[p2]+ebase[p2]-ebase[p1], p1);
45 	printf("\\h'-\\n(%du-\\n(%du-2u/2u'\\v'%du'\\l'\\n(%du'\\v'%du'\n",
46 		 treg, p1, ebase[p1], treg, d);
47 #endif NEQN
48 	ebase[yyval] = b;
49 	eht[yyval] = h;
50 	lfont[yyval] = rfont[yyval] = 0;
51 	ofree(p2);
52 	ofree(treg);
53 }
54