xref: /titanic_51/usr/src/cmd/eqn/size.c (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
1 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2 /*	  All Rights Reserved  	*/
3 
4 
5 /*
6  * Copyright (c) 1980 Regents of the University of California.
7  * All rights reserved. The Berkeley software License Agreement
8  * specifies the terms and conditions for redistribution.
9  */
10 
11 /*
12  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13  * All Rights Reserved.
14  */
15 
16 #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
17 
18 # include "e.h"
19 
20 setsize(p)	/* set size as found in p */
21 char *p;
22 {
23 	if (*p == '+')
24 		ps += atoi(p+1);
25 	else if (*p == '-')
26 		ps -= atoi(p+1);
27 	else
28 		ps = atoi(p);
29 	if(dbg)printf(".\tsetsize %s; ps = %d\n", p, ps);
30 }
31 
32 size(p1, p2) int p1, p2; {
33 		/* old size in p1, new in ps */
34 	int effps, effp1;
35 
36 	yyval = p2;
37 	if(dbg)printf(".\tb:sb: S%d <- \\s%d S%d \\s%d; b=%d, h=%d\n",
38 		yyval, ps, p2, p1, ebase[yyval], eht[yyval]);
39 	effps = EFFPS(ps);
40 	effp1 = EFFPS(p1);
41 	printf(".ds %d \\s%d\\*(%d\\s%d\n",
42 		yyval, effps, p2, effp1);
43 	ps = p1;
44 }
45 
46 globsize() {
47 	char temp[20];
48 
49 	getstr(temp, 20);
50 	if (temp[0] == '+')
51 		gsize += atoi(temp+1);
52 	else if (temp[0] == '-')
53 		gsize -= atoi(temp+1);
54 	else
55 		gsize = atoi(temp);
56 	yyval = eqnreg = 0;
57 	setps(gsize);
58 	ps = gsize;
59 	if (gsize >= 12)	/* sub and sup size change */
60 		deltaps = gsize / 4;
61 	else
62 		deltaps = gsize / 3;
63 }
64