xref: /csrg-svn/old/eqn/common_source/eqnbox.c (revision 48252)
1*48252Sbostic /*-
2*48252Sbostic  * Copyright (c) 1991 The Regents of the University of California.
3*48252Sbostic  * All rights reserved.
4*48252Sbostic  *
5*48252Sbostic  * %sccs.include.proprietary.c%
6*48252Sbostic  */
7*48252Sbostic 
814485Ssam #ifndef lint
9*48252Sbostic static char sccsid[] = "@(#)eqnbox.c	4.3 (Berkeley) 04/17/91";
10*48252Sbostic #endif /* not lint */
1111001Sshannon 
1211001Sshannon # include "e.h"
1311001Sshannon 
eqnbox(p1,p2,lu)1411001Sshannon eqnbox(p1, p2, lu) {
1511001Sshannon 	int b, h;
1611001Sshannon 	char *sh;
1711001Sshannon 
1811001Sshannon 	yyval = p1;
1911001Sshannon 	b = max(ebase[p1], ebase[p2]);
2011001Sshannon 	eht[yyval] = h = b + max(eht[p1]-ebase[p1],
2111001Sshannon 		eht[p2]-ebase[p2]);
2211001Sshannon 	ebase[yyval] = b;
2311001Sshannon 	if(dbg)printf(".\te:eb: S%d <- S%d S%d; b=%d, h=%d\n",
2411001Sshannon 		yyval, p1, p2, b, h);
2511001Sshannon 	if (rfont[p1] == ITAL && lfont[p2] == ROM)
2611001Sshannon 		sh = "\\|";
2711001Sshannon 	else
2811001Sshannon 		sh = "";
2911001Sshannon 	if (lu) {
3011001Sshannon 		printf(".nr %d \\w'\\s%d\\*(%d%s'\n", p1, ps, p1, sh);
3111001Sshannon 		printf(".ds %d \\h'|\\n(97u-\\n(%du'\\*(%d\n", p1, p1, p1);
3211001Sshannon 	}
3311001Sshannon 	printf(".as %d \"%s\\*(%d\n", yyval, sh, p2);
3411001Sshannon 	rfont[p1] = rfont[p2];
3511001Sshannon 	ofree(p2);
3611001Sshannon }
37