xref: /illumos-gate/usr/src/cmd/eqn/move.c (revision e86372a01d2d16a5dd4a64e144ed978ba17fe7dd)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 /*
10  * Copyright (c) 1980 Regents of the University of California.
11  * All rights reserved. The Berkeley software License Agreement
12  * specifies the terms and conditions for redistribution.
13  */
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 #include "e.h"
18 #include "e.def"
19 
20 void
21 move(int dir, int amt, int p)
22 {
23 	int a;
24 
25 	yyval = p;
26 #ifndef NEQN
27 	a = VERT(EM(amt/100.0, EFFPS(ps)));
28 #else	/* NEQN */
29 	a = VERT((amt+49)/50);	/* nearest number of half-lines */
30 #endif	/* NEQN */
31 	printf(".ds %d ", yyval);
32 	if (dir == FWD || dir == BACK)	/* fwd, back */
33 		printf("\\h'%s%du'\\*(%d\n", (dir == BACK) ? "-" : "", a, p);
34 	else if (dir == UP)
35 		printf("\\v'-%du'\\*(%d\\v'%du'\n", a, p, a);
36 	else if (dir == DOWN)
37 		printf("\\v'%du'\\*(%d\\v'-%du'\n", a, p, a);
38 	if (dbg)
39 		printf(".\tmove %d dir %d amt %d; h=%d b=%d\n",
40 		    p, dir, a, eht[yyval], ebase[yyval]);
41 }
42