xref: /original-bsd/lib/libplot/t4014/subr.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1983, 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 int oextra = -1;
25 cont(x,y){
26 	int hix,hiy,lox,loy,extra;
27 	int n;
28 	x = (x-obotx)*scalex + botx;
29 	y = (y-oboty)*scaley + boty;
30 	hix=(x>>7) & 037;
31 	hiy=(y>>7) & 037;
32 	lox = (x>>2)&037;
33 	loy=(y>>2)&037;
34 	extra=(x&03)+((y<<2)&014);
35 	n = (abs(hix-ohix) + abs(hiy-ohiy) + 6) / 12;
36 	if(hiy != ohiy){
37 		putch(hiy|040);
38 		ohiy=hiy;
39 	}
40 	if(hix != ohix){
41 		if(extra != oextra){
42 			putch(extra|0140);
43 			oextra=extra;
44 		}
45 		putch(loy|0140);
46 		putch(hix|040);
47 		ohix=hix;
48 		oloy=loy;
49 	}
50 	else{
51 		if(extra != oextra){
52 			putch(extra|0140);
53 			putch(loy|0140);
54 			oextra=extra;
55 			oloy=loy;
56 		}
57 		else if(loy != oloy){
58 			putch(loy|0140);
59 			oloy=loy;
60 		}
61 	}
62 	putch(lox|0100);
63 	while(n--)
64 		putch(0);
65 }
66 
67 putch(c){
68 	putc(c,stdout);
69 }
70