xref: /csrg-svn/old/eqn/common_source/size.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 
814486Ssam #ifndef lint
9*48252Sbostic static char sccsid[] = "@(#)size.c	4.3 (Berkeley) 04/17/91";
10*48252Sbostic #endif /* not lint */
1111017Sshannon 
1211017Sshannon # include "e.h"
1311017Sshannon 
setsize(p)1411017Sshannon setsize(p)	/* set size as found in p */
1511017Sshannon char *p;
1611017Sshannon {
1711017Sshannon 	if (*p == '+')
1811017Sshannon 		ps += atoi(p+1);
1911017Sshannon 	else if (*p == '-')
2011017Sshannon 		ps -= atoi(p+1);
2111017Sshannon 	else
2211017Sshannon 		ps = atoi(p);
2311017Sshannon 	if(dbg)printf(".\tsetsize %s; ps = %d\n", p, ps);
2411017Sshannon }
2511017Sshannon 
size(p1,p2)2611017Sshannon size(p1, p2) int p1, p2; {
2711017Sshannon 		/* old size in p1, new in ps */
2811017Sshannon 	int effps, effp1;
2911017Sshannon 
3011017Sshannon 	yyval = p2;
3111017Sshannon 	if(dbg)printf(".\tb:sb: S%d <- \\s%d S%d \\s%d; b=%d, h=%d\n",
3211017Sshannon 		yyval, ps, p2, p1, ebase[yyval], eht[yyval]);
3311017Sshannon 	effps = EFFPS(ps);
3411017Sshannon 	effp1 = EFFPS(p1);
3511017Sshannon 	printf(".ds %d \\s%d\\*(%d\\s%d\n",
3611017Sshannon 		yyval, effps, p2, effp1);
3711017Sshannon 	ps = p1;
3811017Sshannon }
3911017Sshannon 
globsize()4011017Sshannon globsize() {
4111017Sshannon 	char temp[20];
4211017Sshannon 
4311017Sshannon 	getstr(temp, 20);
4411017Sshannon 	if (temp[0] == '+')
4511017Sshannon 		gsize += atoi(temp+1);
4611017Sshannon 	else if (temp[0] == '-')
4711017Sshannon 		gsize -= atoi(temp+1);
4811017Sshannon 	else
4911017Sshannon 		gsize = atoi(temp);
5011017Sshannon 	yyval = eqnreg = 0;
5111017Sshannon 	setps(gsize);
5211017Sshannon 	ps = gsize;
5311017Sshannon 	if (gsize >= 12)	/* sub and sup size change */
5411017Sshannon 		deltaps = gsize / 4;
5511017Sshannon 	else
5611017Sshannon 		deltaps = gsize / 3;
5711017Sshannon }
58