Partial merge of I/O management.
[super-star-trek.git] / conio.h
1 /***************************************************************************/
2 /** File: conio.h     Date: 03/09/1997       Version: 1.02                **/
3 /** --------------------------------------------------------------------- **/
4 /** CONIO.H an implementation of the conio.h for Linux based on ncurses.  **/
5 /** This is copyright (c) 1996,97 by Fractor / Mental EXPlosion.          **/
6 /** If you want to copy it you must do this following the terms of the    **/
7 /** GNU Library Public License                                            **/
8 /** Please read the file "README" before using this library.              **/
9 /** --------------------------------------------------------------------- **/
10 /** To use this thing you must have got the curses library.               **/
11 /** This thing was tested on Linux Kernel 2.0.29, GCC 2.7.2 and           **/
12 /** ncurses 1.9.9e which is (c) 1992-1995 by Zeyd M. Ben-Halim and Eric S.**/
13 /** Raymond.                                                              **/
14 /** Please also read the copyright notices for ncurses before using this !**/
15 /***************************************************************************/             
16
17 #ifndef __linux__
18 #error This conio.h was only tested to work under LINUX !
19 #endif
20
21 #ifndef __LINUXCONIO_H
22 #define __LINUXCONIO_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #include <ncurses.h>
29
30 #define linux_conio_version 1.04
31
32 extern int directvideo; /* ignored by linux conio.h */
33 extern char color_warning; /* Tell the users when terminal can't display colors ? */
34 extern WINDOW *conio_scr;
35  
36 #define _NOCURSOR      0
37 #define _NORMALCURSOR  1
38
39 struct text_info {
40     unsigned char winleft;
41     unsigned char wintop;
42     unsigned char winright;
43     unsigned char winbottom;
44     unsigned char attribute;
45     unsigned char normattr;
46     unsigned char currmode;
47     unsigned char screenheight;
48     unsigned char screenwidth;
49     unsigned char curx;
50     unsigned char cury;
51 };
52
53 enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
54
55 enum COLORS {
56    BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY,
57    DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE
58 };
59
60 #define BLINK 128    
61
62 extern void initconio(void); /* Please run this function before any other */ 
63 extern void doneconio(void); /* Please run this function before exiting your program */
64
65 extern int wherex(void);
66 extern int wherey(void);
67 extern int putch(int c);
68 extern int getche(void); 
69 extern int kbhit(void);
70 extern void _setcursortype(int);
71 extern int cprintf(char *format, ...);
72 extern int cscanf(const char *format, ...); 
73
74 extern unsigned inp(unsigned port);
75 extern unsigned inpw(unsigned port);
76 extern unsigned outp(unsigned port, unsigned value);
77 extern unsigned outpw(unsigned port,unsigned value);
78 extern unsigned inpd(unsigned port);
79 extern unsigned outpd(unsigned port, unsigned value);
80
81 extern void clreol(void);
82 extern void clrscr(void);
83 extern void gotoxy(int x, int y);
84 extern void delline(void);
85 extern void gettextinfo(struct text_info *r);
86 extern void highvideo(void);
87 extern void insline(void);
88 extern void lowvideo(void);
89 extern void normvideo(void);
90 extern void textattr(int attribute);
91 extern void textbackground(int color);
92 extern void textcolor(int color);
93 extern void textmode(int unused_mode);
94 extern void window(int left, int top, int right, int bottom);
95 extern void cputs(char *str);
96
97 extern char *cgets(char *str); 
98
99 #ifdef  __cplusplus
100 }
101 #endif
102
103 #endif