xref: /illumos-gate/usr/src/cmd/eqn/move.c (revision 012e6ce759c490003aed29439cc47d3d73a99ad3)
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 #include "e.h"
16 #include "e.def"
17 
18 void
19 move(int dir, int amt, int p)
20 {
21 	int a;
22 
23 	yyval = p;
24 #ifndef NEQN
25 	a = VERT(EM(amt/100.0, EFFPS(ps)));
26 #else	/* NEQN */
27 	a = VERT((amt+49)/50);	/* nearest number of half-lines */
28 #endif	/* NEQN */
29 	printf(".ds %d ", yyval);
30 	if (dir == FWD || dir == BACK)	/* fwd, back */
31 		printf("\\h'%s%du'\\*(%d\n", (dir == BACK) ? "-" : "", a, p);
32 	else if (dir == UP)
33 		printf("\\v'-%du'\\*(%d\\v'%du'\n", a, p, a);
34 	else if (dir == DOWN)
35 		printf("\\v'%du'\\*(%d\\v'-%du'\n", a, p, a);
36 	if (dbg)
37 		printf(".\tmove %d dir %d amt %d; h=%d b=%d\n",
38 		    p, dir, a, eht[yyval], ebase[yyval]);
39 }
40