/*
 *  plot.c : PD implementation of the UNIX plot package.
 *
 * by Joel Swank 4-20-88
 */

#include <stdio.h>

openpl()
{
/* nothing for it to do */
}

erase()
{
	putchar('e');
}

label(s)
char *s;
{
	putchar('t');
	puts(s);
}

line(x1,y1,x2,y2)
int x1,y1,x2,y2;
{
	putchar('l');
	put_xy(x1,y1);
	put_xy(x2,y2);
}

circle(x,y,r)
int x,y,r;
{
	putchar('c');
	put_xy(x,y);
	put_int(r);
}

arc(x,y,x0,y0,x1,y1)
int x,y,x0,y0,x1,y1;
{
	putchar('a');
	put_xy(x,y);
	put_xy(x0,y0);
	put_xy(x1,y1);
}

move(x,y)
int x,y;
{
	putchar('m');
	put_xy(x,y);
}

cont(x,y)
int x,y;
{
	putchar('n');
	put_xy(x,y);
}

point(x,y)
int x,y;
{
	putchar('p');
	put_xy(x,y);
}

linemod(s)
char *s;
{
	putchar('f');
	puts(s);
}

space(x1,y1,x2,y2)
int x1,y1,x2,y2;
{
	putchar('s');
	put_xy(x1,y1);
	put_xy(x2,y2);
}

closepl()
{
	fclose(stdout);
}

put_xy(x,y)
int x,y;
{
	put_int(x);
	put_int(y);
}

put_int(i)
int i;
{
	putchar(i & 0xff);
	putchar((i >> 8) & 0xff);
}
