xref: /titanic_50/usr/src/cmd/eqn/size.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
setsize(char * p)20*779fc935Sceastha setsize(char *p)	/* set size as found in p */
217c478bd9Sstevel@tonic-gate {
227c478bd9Sstevel@tonic-gate 	if (*p == '+')
237c478bd9Sstevel@tonic-gate 		ps += atoi(p+1);
247c478bd9Sstevel@tonic-gate 	else if (*p == '-')
257c478bd9Sstevel@tonic-gate 		ps -= atoi(p+1);
267c478bd9Sstevel@tonic-gate 	else
277c478bd9Sstevel@tonic-gate 		ps = atoi(p);
287c478bd9Sstevel@tonic-gate 	if (dbg) printf(".\tsetsize %s; ps = %d\n", p, ps);
297c478bd9Sstevel@tonic-gate }
307c478bd9Sstevel@tonic-gate 
31*779fc935Sceastha void
size(int p1,int p2)32*779fc935Sceastha size(int p1, int p2)
33*779fc935Sceastha {
347c478bd9Sstevel@tonic-gate 	/* old size in p1, new in ps */
35*779fc935Sceastha 
367c478bd9Sstevel@tonic-gate 	int effps, effp1;
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate 	yyval = p2;
39*779fc935Sceastha 	if (dbg)
40*779fc935Sceastha 		printf(".\tb:sb: S%d <- \\s%d S%d \\s%d; b=%d, h=%d\n",
417c478bd9Sstevel@tonic-gate 		    yyval, ps, p2, p1, ebase[yyval], eht[yyval]);
427c478bd9Sstevel@tonic-gate 	effps = EFFPS(ps);
437c478bd9Sstevel@tonic-gate 	effp1 = EFFPS(p1);
44*779fc935Sceastha 	printf(".ds %d \\s%d\\*(%d\\s%d\n", yyval, effps, p2, effp1);
457c478bd9Sstevel@tonic-gate 	ps = p1;
467c478bd9Sstevel@tonic-gate }
477c478bd9Sstevel@tonic-gate 
48*779fc935Sceastha void
globsize(void)49*779fc935Sceastha globsize(void)
50*779fc935Sceastha {
517c478bd9Sstevel@tonic-gate 	char temp[20];
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate 	getstr(temp, 20);
547c478bd9Sstevel@tonic-gate 	if (temp[0] == '+')
557c478bd9Sstevel@tonic-gate 		gsize += atoi(temp+1);
567c478bd9Sstevel@tonic-gate 	else if (temp[0] == '-')
577c478bd9Sstevel@tonic-gate 		gsize -= atoi(temp+1);
587c478bd9Sstevel@tonic-gate 	else
597c478bd9Sstevel@tonic-gate 		gsize = atoi(temp);
607c478bd9Sstevel@tonic-gate 	yyval = eqnreg = 0;
617c478bd9Sstevel@tonic-gate 	setps(gsize);
627c478bd9Sstevel@tonic-gate 	ps = gsize;
637c478bd9Sstevel@tonic-gate 	if (gsize >= 12)	/* sub and sup size change */
647c478bd9Sstevel@tonic-gate 		deltaps = gsize / 4;
657c478bd9Sstevel@tonic-gate 	else
667c478bd9Sstevel@tonic-gate 		deltaps = gsize / 3;
677c478bd9Sstevel@tonic-gate }
68