xref: /csrg-svn/lib/libplot/t4014/subr.c (revision 61408)
148524Sbostic /*-
2*61408Sbostic  * Copyright (c) 1983, 1993
3*61408Sbostic  *	The Regents of the University of California.  All rights reserved.
448524Sbostic  *
548524Sbostic  * %sccs.include.proprietary.c%
648524Sbostic  */
748524Sbostic 
813356Ssam #ifndef lint
9*61408Sbostic static char sccsid[] = "@(#)subr.c	8.1 (Berkeley) 06/04/93";
1048524Sbostic #endif /* not lint */
1113356Ssam 
1213356Ssam #include <stdio.h>
1313356Ssam float obotx = 0.;
1413356Ssam float oboty = 0.;
1513356Ssam float botx = 0.;
1613356Ssam float boty = 0.;
1713356Ssam float scalex = 1.;
1813356Ssam float scaley = 1.;
1913356Ssam int scaleflag;
2013356Ssam 
2113356Ssam int oloy = -1;
2213356Ssam int ohiy = -1;
2313356Ssam int ohix = -1;
2413356Ssam int oextra = -1;
cont(x,y)2513356Ssam cont(x,y){
2613356Ssam 	int hix,hiy,lox,loy,extra;
2713356Ssam 	int n;
2813356Ssam 	x = (x-obotx)*scalex + botx;
2913356Ssam 	y = (y-oboty)*scaley + boty;
3013356Ssam 	hix=(x>>7) & 037;
3113356Ssam 	hiy=(y>>7) & 037;
3213356Ssam 	lox = (x>>2)&037;
3313356Ssam 	loy=(y>>2)&037;
3431862Smckusick 	extra=(x&03)+((y<<2)&014);
3513356Ssam 	n = (abs(hix-ohix) + abs(hiy-ohiy) + 6) / 12;
3613356Ssam 	if(hiy != ohiy){
3713356Ssam 		putch(hiy|040);
3813356Ssam 		ohiy=hiy;
3913356Ssam 	}
4013356Ssam 	if(hix != ohix){
4113356Ssam 		if(extra != oextra){
4213356Ssam 			putch(extra|0140);
4313356Ssam 			oextra=extra;
4413356Ssam 		}
4513356Ssam 		putch(loy|0140);
4613356Ssam 		putch(hix|040);
4713356Ssam 		ohix=hix;
4813356Ssam 		oloy=loy;
4913356Ssam 	}
5013356Ssam 	else{
5113356Ssam 		if(extra != oextra){
5213356Ssam 			putch(extra|0140);
5313356Ssam 			putch(loy|0140);
5413356Ssam 			oextra=extra;
5513356Ssam 			oloy=loy;
5613356Ssam 		}
5713356Ssam 		else if(loy != oloy){
5813356Ssam 			putch(loy|0140);
5913356Ssam 			oloy=loy;
6013356Ssam 		}
6113356Ssam 	}
6213356Ssam 	putch(lox|0100);
6313356Ssam 	while(n--)
6413356Ssam 		putch(0);
6513356Ssam }
6613356Ssam 
putch(c)6713356Ssam putch(c){
6813356Ssam 	putc(c,stdout);
6913356Ssam }
70