#include "vaxconio.h"
#define false 0
#define true (!false)
int vx_top=1,vx_bot=24;
textattr()
{}
kbhit()
{return false;}
delay(int i)
{}

window(int left,int top, int right, int bottom)
{
	if (left==1 && top==1 && bottom==25) {
		printf("\x1b[%d;%dr",1,24);
	}
	vx_top = top;
	vx_bot = bottom;
}
scr_dots(int i)
{
}
scr_gets(char *x)
{
	gets(x);
}
clreol()
{
	printf("\x1b[K");
}
clrscr()
{
	printf("\x1b[2J");
}
cputs(char *line)
{
	printf("%s",line);
}
scr_left(int i)
{
	if (i<=0) return;
	printf("\x1b[%dD",i);
}
scr_right(int i)
{
	if (i<=0) return;
	printf("\x1b[%dC",i);
}
int vx_curx,vx_cury;
gotoxy(int x, int y)
{
	y = y + vx_top - 1;
	if (y>vx_bot) y=vx_bot;
	if (y<vx_top) y=vx_top;
	if (y>25) y=24;
	vx_curx = x; vx_cury = y;
	printf("\x1b[%d;%dH",y,x);
}
insline()
{
	scr_savexy();
	printf("\x1b[%d;%dr",vx_cury,vx_bot);
	printf("\x1b[%d;%dH\x1bM",vx_cury,1);
	scr_restorexy();
}
delline()
{
	scr_savexy();
	printf("\x1b[%d;%dr",vx_cury,vx_bot);
	printf("\x1b[%d;%dH\x1b%c",vx_bot,1,'D');
	scr_restorexy();
}
putch(int char_val)
{
	printf("%c",char_val);
}
scr_refresh()
{
}
int scr_getch()
{
	return getch();
}
scr_init()
{
	printf("\x1b=");
}

screen_save()
{}
screen_restore()
{
	clrscr();
	gotoxy(1,1);
}
int vx_topsave,vx_botsave;
scr_savexy()
{
	vx_topsave = vx_top;
	vx_botsave = vx_bot;
	printf("\x1b\x37");
}
scr_restorexy()
{
	printf("\x1b\x38");
	vx_top = vx_topsave;
	vx_bot = vx_botsave;
}
scr_end()
{
	printf("\x1b>");
}

gettextinfo(struct text_info *r)
{
	r->curx = 1;
	r->cury = 1;
	r->wintop = vx_top;
}


textbackground(int color_num)
{}
textcolor(int colornum)
{}

int vscrcolor = 0;
scr_norm()  /* yellow on blue */
{
	if (vscrcolor==1) return;
	vscrcolor = 1;
	printf("\x1b[0m");
}
scr_inv()   /* black on white */
{
	if (vscrcolor==2) return;
	if (vscrcolor != 1) printf("\x1b[0m");
	vscrcolor = 2;
	printf("\x1b[1m"); /* hiligh */
}
scr_grey()  /* black on grey */
{
	if (vscrcolor==3) return;
	if (vscrcolor != 1) printf("\x1b[0m");
	vscrcolor = 3;
	printf("\x1b[7m"); /* inverse */
}
scr_isblackwhite()
{
	return true;
}
scr_menubg()
{
	scr_norm();
}
scr_menuval()
{
	scr_inv();
}
scr_menuhi()
{
	scr_grey();
}

#include <descrip.h>
vax_edt(char *s) 	/* call the vax EDT editor */
{
	$DESCRIPTOR(sdesc,"");
	sdesc.dsc$a_pointer = s;
	sdesc.dsc$w_length = strlen(s);
	edt$edit(&sdesc,&sdesc);
}

                                                                                                         
