xref: /illumos-gate/usr/src/cmd/eqn/size.c (revision 2a8bcb4e)
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 #include "e.h"
167c478bd9Sstevel@tonic-gate 
17*779fc935Sceastha void
setsize(char * p)18*779fc935Sceastha setsize(char *p)	/* set size as found in p */
197c478bd9Sstevel@tonic-gate {
207c478bd9Sstevel@tonic-gate 	if (*p == '+')
217c478bd9Sstevel@tonic-gate 		ps += atoi(p+1);
227c478bd9Sstevel@tonic-gate 	else if (*p == '-')
237c478bd9Sstevel@tonic-gate 		ps -= atoi(p+1);
247c478bd9Sstevel@tonic-gate 	else
257c478bd9Sstevel@tonic-gate 		ps = atoi(p);
26*779fc935Sceastha 	if (dbg) printf(".\tsetsize %s; ps = %d\n", p, ps);
277c478bd9Sstevel@tonic-gate }
287c478bd9Sstevel@tonic-gate 
29*779fc935Sceastha void
size(int p1,int p2)30*779fc935Sceastha size(int p1, int p2)
31*779fc935Sceastha {
32*779fc935Sceastha 	/* old size in p1, new in ps */
33*779fc935Sceastha 
347c478bd9Sstevel@tonic-gate 	int effps, effp1;
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate 	yyval = p2;
37*779fc935Sceastha 	if (dbg)
38*779fc935Sceastha 		printf(".\tb:sb: S%d <- \\s%d S%d \\s%d; b=%d, h=%d\n",
39*779fc935Sceastha 		    yyval, ps, p2, p1, ebase[yyval], eht[yyval]);
407c478bd9Sstevel@tonic-gate 	effps = EFFPS(ps);
417c478bd9Sstevel@tonic-gate 	effp1 = EFFPS(p1);
42*779fc935Sceastha 	printf(".ds %d \\s%d\\*(%d\\s%d\n", yyval, effps, p2, effp1);
437c478bd9Sstevel@tonic-gate 	ps = p1;
447c478bd9Sstevel@tonic-gate }
457c478bd9Sstevel@tonic-gate 
46*779fc935Sceastha void
globsize(void)47*779fc935Sceastha globsize(void)
48*779fc935Sceastha {
497c478bd9Sstevel@tonic-gate 	char temp[20];
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate 	getstr(temp, 20);
527c478bd9Sstevel@tonic-gate 	if (temp[0] == '+')
537c478bd9Sstevel@tonic-gate 		gsize += atoi(temp+1);
547c478bd9Sstevel@tonic-gate 	else if (temp[0] == '-')
557c478bd9Sstevel@tonic-gate 		gsize -= atoi(temp+1);
567c478bd9Sstevel@tonic-gate 	else
577c478bd9Sstevel@tonic-gate 		gsize = atoi(temp);
587c478bd9Sstevel@tonic-gate 	yyval = eqnreg = 0;
597c478bd9Sstevel@tonic-gate 	setps(gsize);
607c478bd9Sstevel@tonic-gate 	ps = gsize;
617c478bd9Sstevel@tonic-gate 	if (gsize >= 12)	/* sub and sup size change */
627c478bd9Sstevel@tonic-gate 		deltaps = gsize / 4;
637c478bd9Sstevel@tonic-gate 	else
647c478bd9Sstevel@tonic-gate 		deltaps = gsize / 3;
657c478bd9Sstevel@tonic-gate }
66