// conio.h  klone
#include <stdio.h>

//COLORS (text mode)
//        Constant    Val
#define   BLACK         0
#define   BLUE          1
#define   GREEN         2
#define   CYAN          3
#define   RED           4
#define   MAGENTA       5
#define   BROWN         6
#define   LIGHTGRAY     7
#define   DARKGRAY      8
#define   LIGHTBLUE     9
#define   LIGHTGREEN   10
#define   LIGHTCYAN    11
#define   LIGHTRED     12
#define   LIGHTMAGENTA 13
#define   YELLOW       14
#define   WHITE        15
#define   BLINK       128

//   * _NOCURSOR     (turns off the cursor)
//   * _SOLIDCURSOR  (solid block cursor)
//   * _NORMALCURSOR (normal underscore cursor)
#define _NOCURSOR     0
#define _SOLIDCURSOR  1
#define _NORMALCURSOR 2

#define  cgets    gets
#define  cputs    puts
#define  clrscr() printf("\x1B[2J")
#define  clreol() printf("\x1B[K")
#define  cprintf  printf
// TODO ??
#define  cputs    puts
// TODO ??
#define  cscanf   scanf
// TODO ??
#define  delline00() printf( "\x1b[%dM", 1 )
#define  delline()   printf( "\x1b[%dA", 1 ); printf( "\x1b[%dM", 1 )
#define  getch    getchar
// TODO
#define  getche   getchar
// TODO
//#define  getpass    LINUX   #include <pwd.h> 
//#define  gettext  __SORRY
//#define  gettextinfo  __SORRY
#define  gotoxy(x,y)  printf("\x1B[%i;%iH",(y),(x))
#define  highvideo()  printf("\x1B[1m")
#define  insline00()  printf( "\x1b[%dL", 1 )
#define  insline()    printf( "\x1b[%dA", 1 ); printf( "\x1b[%dL", 1 )
//#define  inp      __SORRY  
//#define  inport   __SORRY
//#define  inpw     __SORRY
// LINUX   ioperm()  iopl()
// inb, inw, inl, insb, insw, insl
//#define  kbhit    __SORRY
#define  lowvideo()   printf("\x1B[2m")
//#define  movetext  __SORRY
#define  normvideo()  printf("\x1B[0m")
//#define  outp      __SORRY
//#define  outport   __SORRY
//#define  outportb  __SORRY
//#define  outpw     __SORRY
// LINUX   ioperm()  iopl()   
// outb, outw, outl, outsb, outsw, outsl, 
// outb_p, outw_p, outl_p, inb_p, inw_p, inl_p
#define  putch     putchar
#define _setcursortype(cursor_type) {\
( cursor_type < 1 ?  printf( "\x1b[>5h" )  : printf( "\x1b[>5l" )  ); }
// TODO
#define  textattr(attr)      printf("\x1B[%dm",(int)(attr))
#define  textbackground(bc)  printf("\x1B[%dm",(int)(bc)+40)
#define  textcolor(fc)       printf("\x1B[%dm",(int)(fc)+30)
#define  ungetch  ungetc
// ?? TODO
//#define  wherex   __SORRY
//#define  wherey   __SORRY
//#define  window   __SORRY  // curses.h




//  =========
//   CONIO.H
//  =========
//  Functions
//  =========
//   cgets         
//   clreol        
//   clrscr        
//   cprintf       
//   cputs         
//   cscanf        
//   delline       
//   getch         
//   getche        
//   getpass       
//   gettext       
//   gettextinfo   
//   gotoxy        
//   highvideo     
//   insline       
//   inp           
//   inport        
//   inportb       
//   inpw          
//   kbhit         
//   lowvideo      
//   movetext      
//   normvideo     
//   outp          
//   outport       
//   outportb      
//   outpw         
//   putch         
//   puttext       
//   _setcursortype
//   textattr      
//   textbackground
//   textcolor     
//   textmode      
//   ungetch       
//   wherex        
//   wherey        
//   window        
// 
//  Constants, data types, and global variables
//  ============================================
//   BLINK        
//   COLORS       
//   directvideo  
//   _NOCURSOR    
//   _NORMALCURSOR
//   _SOLIDCURSOR 
//   text_info    
//   text_modes   
//   _wscroll     
