xref: /original-bsd/lib/libplot/grn/subr.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1980, 1986, 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 "grnplot.h"
13 
14 
15 /*---------------------------------------------------------
16  *	This local routine outputs an x-y coordinate pair in the standard
17  *	format required by the grn file.
18  *
19  *	Results:	None.
20  *
21  *	Side Effects:
22  *
23  *	Errors:		None.
24  *---------------------------------------------------------
25  */
26 outxy(x, y)
27 int x, y;			/* The coordinates to be output.  Note:
28 				 * these are world coordinates, not screen
29 				 * ones.  We scale in this routine.
30 				 */
31 {
32     printf("%.2f %.2f\n", (x - xbot)*scale,(y - ybot)*scale);
33 }
34 
35 outcurxy()
36 {
37 	outxy(curx,cury);
38 }
39 
40 startvector()
41 {
42 	if (!ingrnfile) erase();
43 	if (invector) return;
44 	invector = 1;
45 	printf("VECTOR\n");
46 	outcurxy();
47 }
48 
49 endvector()
50 {
51 	if (!invector) return;
52 	invector = 0;
53 	printf("*\n%d 0\n0\n",linestyle);
54 }
55