xref: /titanic_44/usr/src/cmd/eqn/eqnbox.c (revision 779fc935796a940997d18b31d64a9fec9c6b40f6)
1*779fc935Sceastha /*
2*779fc935Sceastha  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3*779fc935Sceastha  * Use is subject to license terms.
4*779fc935Sceastha  */
5*779fc935Sceastha 
67c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
77c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate /*
107c478bd9Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
117c478bd9Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
127c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
137c478bd9Sstevel@tonic-gate  */
147c478bd9Sstevel@tonic-gate 
15*779fc935Sceastha #pragma ident	"%Z%%M%	%I%	%E% SMI"
167c478bd9Sstevel@tonic-gate 
177c478bd9Sstevel@tonic-gate #include "e.h"
187c478bd9Sstevel@tonic-gate 
19*779fc935Sceastha void
eqnbox(int p1,int p2,int lu)20*779fc935Sceastha eqnbox(int p1, int p2, int lu)
21*779fc935Sceastha {
227c478bd9Sstevel@tonic-gate 	int b, h;
237c478bd9Sstevel@tonic-gate 	char *sh;
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate 	yyval = p1;
267c478bd9Sstevel@tonic-gate 	b = max(ebase[p1], ebase[p2]);
27*779fc935Sceastha 	eht[yyval] = h = b + max(eht[p1]-ebase[p1], eht[p2]-ebase[p2]);
287c478bd9Sstevel@tonic-gate 	ebase[yyval] = b;
29*779fc935Sceastha 	if (dbg)
30*779fc935Sceastha 		printf(".\te:eb: S%d <- S%d S%d; b=%d, h=%d\n",
317c478bd9Sstevel@tonic-gate 		    yyval, p1, p2, b, h);
327c478bd9Sstevel@tonic-gate 	if (rfont[p1] == ITAL && lfont[p2] == ROM)
337c478bd9Sstevel@tonic-gate 		sh = "\\|";
347c478bd9Sstevel@tonic-gate 	else
357c478bd9Sstevel@tonic-gate 		sh = "";
367c478bd9Sstevel@tonic-gate 	if (lu) {
377c478bd9Sstevel@tonic-gate 		printf(".nr %d \\w'\\s%d\\*(%d%s'\n", p1, ps, p1, sh);
387c478bd9Sstevel@tonic-gate 		printf(".ds %d \\h'|\\n(97u-\\n(%du'\\*(%d\n", p1, p1, p1);
397c478bd9Sstevel@tonic-gate 	}
407c478bd9Sstevel@tonic-gate 	printf(".as %d \"%s\\*(%d\n", yyval, sh, p2);
417c478bd9Sstevel@tonic-gate 	rfont[p1] = rfont[p2];
427c478bd9Sstevel@tonic-gate 	ofree(p2);
437c478bd9Sstevel@tonic-gate }
44