xref: /original-bsd/lib/libplot/t4013/subr.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1985, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)subr.c	8.1 (Berkeley) 06/04/93";
10 #endif /* not lint */
11 
12 #include <stdio.h>
13 float obotx = 0.;
14 float oboty = 0.;
15 float botx = 0.;
16 float boty = 0.;
17 float scalex = 1.;
18 float scaley = 1.;
19 int scaleflag;
20 
21 int oloy = -1;
22 int ohiy = -1;
23 int ohix = -1;
24 cont(x,y){
25 	int hix,hiy,lox,loy;
26 	int n;
27 	x = (x-obotx)*scalex + botx;
28 	y = (y-oboty)*scaley + boty;
29 	hix=(x>>5) & 037;
30 	hiy=(y>>5) & 037;
31 	lox = x & 037;
32 	loy = y & 037;
33 	n = (abs(hix-ohix) + abs(hiy-ohiy) + 6) / 12;
34 	if(hiy != ohiy){
35 		putch(hiy|040);
36 		ohiy=hiy;
37 	}
38 	if(hix != ohix){
39 		putch(loy|0140);
40 		putch(hix|040);
41 		ohix=hix;
42 		oloy=loy;
43 	}
44 	else if(loy != oloy){
45 		putch(loy|0140);
46 		oloy=loy;
47 	}
48 	putch(lox|0100);
49 	while(n--)
50 		putch(0);
51 }
52 
53 putch(c){
54 	putc(c,stdout);
55 }
56