/******************************************************************************

             Console Input/Output routines for BZ language

           Copyright 1993-1997, Kim Heino and Tapani T. Salmi

******************************************************************************/

int clreol() {
  printf("\e[K");
}

int clrscr() {
  printf("\e[1;1H\e[2J");
}

int delline() {
  printf("\e[1M");
}

int gotoxy(int x, int y) {
  printf("\e[%u;%uH",y,x);
}

int textattr(int a) {
  printf("\e[%sm",a);
}

int highvideo() {
  textattr("1");
}

int insline() {
  printf("\e[1L");
}

int lowvideo() {
  textattr("0");
}

int movetext() {
// requires VT320
}

int normvideo() {
  textattr("0");
}

int textbackground(char a) {
  printf("\e[4%sm",a);
}

int textcolor(char a) {
  printf("\e[3%sm",a);
}

int wherex() {
// requires VT320, or you can ask it with \e[6n and parse result
}

int wherey() {
// requires VT320, or you can ask it with \e[6n and parse result
}

int window() {
// requires VT320
}

int cgets() {
  return(input("",79,0));
}

#define cprintf printf

int cputs(char s) {
  printf("%s\n",s);
}

int putch(char e) {
  printf("%c",e);
}

int getche() {
  int e;

  e=getch();
  putch(e);
  return(e);
}

