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