#include <gsxdef.h>
#include <gsxbuf.h>


       /* open workstation */

gropen(a)
int a;
{
	contrl [1] = OPEN_WKS;
	contrl [2] = 0 ;
	contrl [4] = 10;
       /* workstation identifier */
       /*  1 - 10  console	 */
       /* 11 - 20  plotter       */
       /* 21 - 30  printer	 */
	intin [1] = a ;
	intin [2] = 1 ;
	intin [3] = 1 ;
	intin [4] = 1;
	intin [5] = 1;
	intin [6] = 1;
	intin [7] = 1;
	intin [8] = 0;
	intin [9] = 1;
	intin [10] = 1;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	close workstation	*/

grclose()
{

	contrl [1] = 2;
	contrl [2] = 0;
	outg (contrl,intin,ptsin,intout,ptsout);
}  

/*	clear workstation	*/

grclear()
{
	contrl [1] = CLEAR_WKS;
	contrl [2] = 0;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	polyline		*/

polyline(a)
int a;
{
	contrl [1] = POLYLINE;
	contrl [2] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	polymarker		*/

polymarker(a)
int a;
{
	contrl [1] = POLYMARKER;
	contrl [2] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	text			*/

text(a,b,c)
int a,b,c;
{
	contrl [1] = 8;
	contrl [2] = 1;
	contrl [4] = length [a);
	do i = 0 to contrl [4);
	   d = substr [a,i+1,1);
	   intin [i+1] = rank(d);
	end;
	ptsin [1] = b;
	ptsin [2] = c;
	outg (contrl,intin,ptsin,intout,ptsout);	
}

/*	fill area		*/

filled_area(a)
int a;
{
	contrl [1] = FILL_AREA;
	contrl [2] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	bar gdp			*/

bar(a,b,c,d)
int a, b, c, d;
{
	contrl [1] = DRAWING_PRIM;
	contrl [2] = 2;
	contrl [6] = 1;
	ptsin [1] = a;
	ptsin [2] = b;
	ptsin [3] = c;
	ptsin [4] = d;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set character height	*/
 
set_character_height(a)
int a;
{
	contrl [1] = SET_CHAR_HEIGHT;
	contrl [2] = 1;
	ptsin [1] = 0;
	ptsin [2] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set character direction	*/

set_character_up_vector(a)
int a;
{
	contrl [1] = SET_CHAR_VECTOR;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set linetype		*/

set_polyline_linetype(a)
int a;
{
	contrl [1] = SET_LINE_TYPE;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set line color		*/

set_polyline_color_index(a)
int a;
{
	contrl [1] = SET_LINE_COLOR;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set polymarker type	*/

set_polymarker_type(a)
int a;
{
	contrl [1] = MARKER_TYPE;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set marker size		*/

set_polymarker_scale(a)
int a;
{
	contrl [1] = MARKER_SCALE;
	contrl [2] = 1;
	ptsin [1] = 0;
	ptsin [2] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set marker color	*/
	
set_polymarker_color_index(a)
int a;
{
	contrl [1] = MARKER_COLOR;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set text color		*/

set_text_color_index(a)
int a;
{
	contrl [1] = TEXT_COLOR;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set fill style		*/

set_fill_interior_style(a)
int a;
{
	contrl [1] = SET_FILL_STYLE;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/* set fill style of fill area	*/

set_fill_style_index(a)
int a;
{
	contrl [1] = SET_STYLE_INDEX; 		
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set fill color		*/

set_fill_color_index(a)
int a;
{
	contrl [1] = SET_FILL_COLOR;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}

/*	set draw mode		*/

set_writing_mode(a)
int a;
{
	contrl [1] = SET_DRAW_MODE;
	contrl [2] = 0;
	intin [1] = a;
	outg (contrl,intin,ptsin,intout,ptsout);
}
