xref: /onnv-gate/usr/src/cmd/eqn/eqnbox.c (revision 364:f36290b8cb0b)
1*364Sceastha /*
2*364Sceastha  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3*364Sceastha  * Use is subject to license terms.
4*364Sceastha  */
5*364Sceastha 
60Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
70Sstevel@tonic-gate /*	  All Rights Reserved  	*/
80Sstevel@tonic-gate 
90Sstevel@tonic-gate /*
100Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
110Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
120Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
130Sstevel@tonic-gate  */
14*364Sceastha 
15*364Sceastha #pragma ident	"%Z%%M%	%I%	%E% SMI"
160Sstevel@tonic-gate 
17*364Sceastha #include "e.h"
180Sstevel@tonic-gate 
19*364Sceastha void
eqnbox(int p1,int p2,int lu)20*364Sceastha eqnbox(int p1, int p2, int lu)
21*364Sceastha {
220Sstevel@tonic-gate 	int b, h;
230Sstevel@tonic-gate 	char *sh;
240Sstevel@tonic-gate 
250Sstevel@tonic-gate 	yyval = p1;
260Sstevel@tonic-gate 	b = max(ebase[p1], ebase[p2]);
27*364Sceastha 	eht[yyval] = h = b + max(eht[p1]-ebase[p1], eht[p2]-ebase[p2]);
280Sstevel@tonic-gate 	ebase[yyval] = b;
29*364Sceastha 	if (dbg)
30*364Sceastha 		printf(".\te:eb: S%d <- S%d S%d; b=%d, h=%d\n",
31*364Sceastha 		    yyval, p1, p2, b, h);
320Sstevel@tonic-gate 	if (rfont[p1] == ITAL && lfont[p2] == ROM)
330Sstevel@tonic-gate 		sh = "\\|";
340Sstevel@tonic-gate 	else
350Sstevel@tonic-gate 		sh = "";
360Sstevel@tonic-gate 	if (lu) {
370Sstevel@tonic-gate 		printf(".nr %d \\w'\\s%d\\*(%d%s'\n", p1, ps, p1, sh);
380Sstevel@tonic-gate 		printf(".ds %d \\h'|\\n(97u-\\n(%du'\\*(%d\n", p1, p1, p1);
390Sstevel@tonic-gate 	}
400Sstevel@tonic-gate 	printf(".as %d \"%s\\*(%d\n", yyval, sh, p2);
410Sstevel@tonic-gate 	rfont[p1] = rfont[p2];
420Sstevel@tonic-gate 	ofree(p2);
430Sstevel@tonic-gate }
44