xref: /csrg-svn/lib/libplot/t4014/subr.c (revision 13356)
1*13356Ssam #ifndef lint
2*13356Ssam static char sccsid[] = "@(#)subr.c	4.1 (Berkeley) 06/27/83";
3*13356Ssam #endif
4*13356Ssam 
5*13356Ssam #include <stdio.h>
6*13356Ssam float obotx = 0.;
7*13356Ssam float oboty = 0.;
8*13356Ssam float botx = 0.;
9*13356Ssam float boty = 0.;
10*13356Ssam float scalex = 1.;
11*13356Ssam float scaley = 1.;
12*13356Ssam int scaleflag;
13*13356Ssam 
14*13356Ssam int oloy = -1;
15*13356Ssam int ohiy = -1;
16*13356Ssam int ohix = -1;
17*13356Ssam int oextra = -1;
18*13356Ssam cont(x,y){
19*13356Ssam 	int hix,hiy,lox,loy,extra;
20*13356Ssam 	int n;
21*13356Ssam 	x = (x-obotx)*scalex + botx;
22*13356Ssam 	y = (y-oboty)*scaley + boty;
23*13356Ssam 	hix=(x>>7) & 037;
24*13356Ssam 	hiy=(y>>7) & 037;
25*13356Ssam 	lox = (x>>2)&037;
26*13356Ssam 	loy=(y>>2)&037;
27*13356Ssam 	extra=x&03+(y<<2)&014;
28*13356Ssam 	n = (abs(hix-ohix) + abs(hiy-ohiy) + 6) / 12;
29*13356Ssam 	if(hiy != ohiy){
30*13356Ssam 		putch(hiy|040);
31*13356Ssam 		ohiy=hiy;
32*13356Ssam 	}
33*13356Ssam 	if(hix != ohix){
34*13356Ssam 		if(extra != oextra){
35*13356Ssam 			putch(extra|0140);
36*13356Ssam 			oextra=extra;
37*13356Ssam 		}
38*13356Ssam 		putch(loy|0140);
39*13356Ssam 		putch(hix|040);
40*13356Ssam 		ohix=hix;
41*13356Ssam 		oloy=loy;
42*13356Ssam 	}
43*13356Ssam 	else{
44*13356Ssam 		if(extra != oextra){
45*13356Ssam 			putch(extra|0140);
46*13356Ssam 			putch(loy|0140);
47*13356Ssam 			oextra=extra;
48*13356Ssam 			oloy=loy;
49*13356Ssam 		}
50*13356Ssam 		else if(loy != oloy){
51*13356Ssam 			putch(loy|0140);
52*13356Ssam 			oloy=loy;
53*13356Ssam 		}
54*13356Ssam 	}
55*13356Ssam 	putch(lox|0100);
56*13356Ssam 	while(n--)
57*13356Ssam 		putch(0);
58*13356Ssam }
59*13356Ssam 
60*13356Ssam putch(c){
61*13356Ssam 	putc(c,stdout);
62*13356Ssam }
63