xref: /titanic_44/usr/src/cmd/eqn/eqnbox.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
3*7c478bd9Sstevel@tonic-gate 
4*7c478bd9Sstevel@tonic-gate 
5*7c478bd9Sstevel@tonic-gate /*
6*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
7*7c478bd9Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
8*7c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
9*7c478bd9Sstevel@tonic-gate  */
10*7c478bd9Sstevel@tonic-gate 
11*7c478bd9Sstevel@tonic-gate /*
12*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13*7c478bd9Sstevel@tonic-gate  * All Rights Reserved.
14*7c478bd9Sstevel@tonic-gate  */
15*7c478bd9Sstevel@tonic-gate 
16*7c478bd9Sstevel@tonic-gate #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
17*7c478bd9Sstevel@tonic-gate 
18*7c478bd9Sstevel@tonic-gate # include "e.h"
19*7c478bd9Sstevel@tonic-gate 
20*7c478bd9Sstevel@tonic-gate eqnbox(p1, p2, lu) {
21*7c478bd9Sstevel@tonic-gate 	int b, h;
22*7c478bd9Sstevel@tonic-gate 	char *sh;
23*7c478bd9Sstevel@tonic-gate 
24*7c478bd9Sstevel@tonic-gate 	yyval = p1;
25*7c478bd9Sstevel@tonic-gate 	b = max(ebase[p1], ebase[p2]);
26*7c478bd9Sstevel@tonic-gate 	eht[yyval] = h = b + max(eht[p1]-ebase[p1],
27*7c478bd9Sstevel@tonic-gate 		eht[p2]-ebase[p2]);
28*7c478bd9Sstevel@tonic-gate 	ebase[yyval] = b;
29*7c478bd9Sstevel@tonic-gate 	if(dbg)printf(".\te:eb: S%d <- S%d S%d; b=%d, h=%d\n",
30*7c478bd9Sstevel@tonic-gate 		yyval, p1, p2, b, h);
31*7c478bd9Sstevel@tonic-gate 	if (rfont[p1] == ITAL && lfont[p2] == ROM)
32*7c478bd9Sstevel@tonic-gate 		sh = "\\|";
33*7c478bd9Sstevel@tonic-gate 	else
34*7c478bd9Sstevel@tonic-gate 		sh = "";
35*7c478bd9Sstevel@tonic-gate 	if (lu) {
36*7c478bd9Sstevel@tonic-gate 		printf(".nr %d \\w'\\s%d\\*(%d%s'\n", p1, ps, p1, sh);
37*7c478bd9Sstevel@tonic-gate 		printf(".ds %d \\h'|\\n(97u-\\n(%du'\\*(%d\n", p1, p1, p1);
38*7c478bd9Sstevel@tonic-gate 	}
39*7c478bd9Sstevel@tonic-gate 	printf(".as %d \"%s\\*(%d\n", yyval, sh, p2);
40*7c478bd9Sstevel@tonic-gate 	rfont[p1] = rfont[p2];
41*7c478bd9Sstevel@tonic-gate 	ofree(p2);
42*7c478bd9Sstevel@tonic-gate }
43