xref: /onnv-gate/usr/src/cmd/eqn/move.c (revision 364:f36290b8cb0b)
1*364Sceastha /*
2*364Sceastha  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3*364Sceastha  * Use is subject to license terms.
4*364Sceastha  */
5*364Sceastha 
60Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
70Sstevel@tonic-gate /*	  All Rights Reserved  	*/
80Sstevel@tonic-gate 
90Sstevel@tonic-gate /*
100Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
110Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
120Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
130Sstevel@tonic-gate  */
14*364Sceastha 
15*364Sceastha #pragma ident	"%Z%%M%	%I%	%E% SMI"
160Sstevel@tonic-gate 
17*364Sceastha #include "e.h"
18*364Sceastha #include "e.def"
190Sstevel@tonic-gate 
20*364Sceastha void
move(int dir,int amt,int p)21*364Sceastha move(int dir, int amt, int p)
22*364Sceastha {
230Sstevel@tonic-gate 	int a;
240Sstevel@tonic-gate 
250Sstevel@tonic-gate 	yyval = p;
260Sstevel@tonic-gate #ifndef NEQN
270Sstevel@tonic-gate 	a = VERT(EM(amt/100.0, EFFPS(ps)));
28*364Sceastha #else	/* NEQN */
29*364Sceastha 	a = VERT((amt+49)/50);	/* nearest number of half-lines */
30*364Sceastha #endif	/* NEQN */
310Sstevel@tonic-gate 	printf(".ds %d ", yyval);
32*364Sceastha 	if (dir == FWD || dir == BACK)	/* fwd, back */
33*364Sceastha 		printf("\\h'%s%du'\\*(%d\n", (dir == BACK) ? "-" : "", a, p);
340Sstevel@tonic-gate 	else if (dir == UP)
350Sstevel@tonic-gate 		printf("\\v'-%du'\\*(%d\\v'%du'\n", a, p, a);
360Sstevel@tonic-gate 	else if (dir == DOWN)
370Sstevel@tonic-gate 		printf("\\v'%du'\\*(%d\\v'-%du'\n", a, p, a);
38*364Sceastha 	if (dbg)
39*364Sceastha 		printf(".\tmove %d dir %d amt %d; h=%d b=%d\n",
40*364Sceastha 		    p, dir, a, eht[yyval], ebase[yyval]);
410Sstevel@tonic-gate }
42