/* pseudo curses */
#include <sys/process.h>
#include "tscreen.h"
#include "keyb.h"
static TScreenIL tscreenIL;
static KeybIL keybIL;

void move(int y, int x) {
  tscreenIL.move(y, x);
}
int getcurx() {
  return tscreenIL.getcurx();
}
int getcury() {
  return tscreenIL.getcury();
}
void addch(int c) {
  tscreenIL.addch(c);
}
void insch(int c) {
  tscreenIL.insch(c);
}
void delch() {
  tscreenIL.delch();
}
void addstr(char *string) {
  tscreenIL.addstr((char far *)string);
}
void insertln() {
  tscreenIL.insertln();
}
void deleteln() {
  tscreenIL.deleteln();
}

int initscr() {
  if (ilibIL->_open("@tscreen", (IL far*) &tscreenIL) != E_FS_SUCCESS) 
    return -1;
  if (ilibIL->_open("@keyb", (IL far*) &keybIL) != E_FS_SUCCESS) 
    return -1;

  if (tscreenIL.initscr() || keybIL.init())
    return -1;
  return 0;
}

int getch() {
  return keybIL.getch();
}
void endwin(){
  tscreenIL.endwin();
  keybIL.close();
}



int keyb_setmode(int mode) {
  return keybIL.setmode(mode);
}
void set_stdout_flag(int flag){
  tscreenIL.set_stdout_flag(flag);
}
int get_stdout_flag() {
  return tscreenIL.get_stdout_flag();
}
int getscr() {
  if (ilibIL->_open("@tscreen", (IL far*) &tscreenIL) != E_FS_SUCCESS)
    return -1;
  if (ilibIL->_open("@keyb", (IL far*) &keybIL) != E_FS_SUCCESS) 
    return -1;

  if (tscreenIL.getscr() || keybIL.init())
    return -1;
  return 0;
}

