home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / CONIO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-18  |  8.5 KB  |  311 lines

  1. /*  conio.h
  2.  
  3.     Direct MSDOS console input/output.
  4. */
  5.  
  6. /* $Copyright: 1987$ */
  7. /* $Revision:   8.1  $ */
  8.  
  9. #if !defined(__CONIO_H)
  10. #define __CONIO_H
  11.  
  12. #if !defined(___DEFS_H)
  13. #include <_defs.h>
  14. #endif
  15.  
  16.  
  17. #if !defined(RC_INVOKED)
  18.  
  19. #if defined(__STDC__)
  20. #pragma warn -nak
  21. #endif
  22.  
  23. #pragma pack(push, 1)
  24.  
  25. #endif  /* !RC_INVOKED */
  26.  
  27.  
  28. #define _NOCURSOR      0
  29. #define _SOLIDCURSOR   1
  30. #define _NORMALCURSOR  2
  31.  
  32. struct text_info {
  33.     unsigned char winleft;
  34.     unsigned char wintop;
  35.     unsigned char winright;
  36.     unsigned char winbottom;
  37.     unsigned char attribute;
  38.     unsigned char normattr;
  39.     unsigned char currmode;
  40.     unsigned char screenheight;
  41.     unsigned char screenwidth;
  42.     unsigned char curx;
  43.     unsigned char cury;
  44. };
  45.  
  46. #if !defined(__COLORS)
  47. #define __COLORS
  48.  
  49. enum COLORS {
  50.     BLACK,          /* dark colors */
  51.     BLUE,
  52.     GREEN,
  53.     CYAN,
  54.     RED,
  55.     MAGENTA,
  56.     BROWN,
  57.     LIGHTGRAY,
  58.     DARKGRAY,       /* light colors */
  59.     LIGHTBLUE,
  60.     LIGHTGREEN,
  61.     LIGHTCYAN,
  62.     LIGHTRED,
  63.     LIGHTMAGENTA,
  64.     YELLOW,
  65.     WHITE
  66. };
  67. #endif
  68.  
  69. #define BLINK       128 /* blink bit */
  70.  
  71. #if !defined(__FLAT__)
  72.  
  73. enum text_modes {  LASTMODE=-1,
  74.                    BW40=0,
  75.                    C40,
  76.                    BW80,
  77.                    C80,
  78.                    MONO=7,
  79.                    C4350=64 };
  80.  
  81. #if defined(__DPMI16__) || !defined(_Windows)
  82.  
  83. #if !defined(__STDC__)  /*  NON-ANSI  */
  84. #define directvideo  _directvideo
  85. #endif
  86.  
  87. extern   int _RTLENTRY _directvideo;
  88.  
  89. #endif  /* __DPMI16__ || !_Windows */
  90.  
  91. extern   int _RTLENTRY _wscroll;
  92.  
  93. #ifdef __cplusplus
  94. extern "C" {
  95. #endif
  96.  
  97. void        _RTLENTRY clreol( void );
  98. void        _RTLENTRY clrscr( void );
  99. void        _RTLENTRY gotoxy( int __x, int __y );
  100. int         _RTLENTRY getch( void );
  101. int         _RTLENTRY getche( void );
  102. int         _RTLENTRY kbhit( void );
  103. int         _RTLENTRY putch( int __c );
  104. int         _RTLENTRY wherex( void );
  105. int         _RTLENTRY wherey( void );
  106.  
  107. #ifndef _PORT_DEFS
  108. unsigned char   _RTLENTRY inportb( unsigned __portid );
  109. unsigned        _RTLENTRY inport ( unsigned __portid );
  110. int             _RTLENTRY inp( unsigned __portid );
  111. unsigned        _RTLENTRY inpw( unsigned __portid );
  112. void            _RTLENTRY outportb( unsigned __portid, unsigned char __value );
  113. void            _RTLENTRY outport ( unsigned __portid, unsigned __value );
  114. int             _RTLENTRY outp( unsigned __portid, int __value );
  115. unsigned        _RTLENTRY outpw( unsigned __portid, unsigned __value );
  116. #endif  /* !_PORT_DEFS */
  117.  
  118. #if defined(__DPMI16__) || !defined(_Windows)
  119.  
  120. void        _RTLENTRY delline( void );
  121. int         _RTLENTRY gettext( int __left, int __top,
  122.                            int __right, int __bottom,
  123.                            void *__destin);
  124. void        _RTLENTRY gettextinfo (struct text_info *__r );
  125. void        _RTLENTRY highvideo( void );
  126. void        _RTLENTRY insline( void );
  127. void        _RTLENTRY lowvideo( void );
  128. int         _RTLENTRY movetext( int __left, int __top,
  129.                             int __right, int __bottom,
  130.                             int __destleft, int __desttop );
  131. void        _RTLENTRY normvideo( void );
  132. int         _RTLENTRY puttext( int __left, int __top,
  133.                            int __right, int __bottom,
  134.                            void *__source );
  135. void        _RTLENTRY textattr( int __newattr );
  136. void        _RTLENTRY textbackground( int __newcolor );
  137. void        _RTLENTRY textcolor( int __newcolor );
  138. void        _RTLENTRY textmode( int __newmode );
  139. void        _RTLENTRY window( int __left, int __top, int __right, int __bottom);
  140.  
  141. void        _RTLENTRY _setcursortype( int __cur_t );
  142. char *      _RTLENTRY cgets( char *__str );
  143. int         _RTLENTRY cprintf( const char *__format, ... );
  144. int         _RTLENTRY cputs( const char *__str );
  145. int         _RTLENTRY cscanf( const char *__format, ... );
  146. char *      _RTLENTRY getpass( const char *__prompt );
  147. int         _RTLENTRY ungetch( int __ch );
  148.  
  149. #endif /* __DPMI16__ || !_Windows */
  150.  
  151. #ifndef _PORT_DEFS
  152. #define _PORT_DEFS
  153.  
  154.     /* These are in-line functions.  These prototypes just clean up
  155.        some syntax checks and code generation.
  156.      */
  157. unsigned char   _RTLENTRY  __inportb__ (unsigned __portid);
  158. unsigned        _RTLENTRY  __inportw__ (unsigned __portid);
  159. unsigned char   _RTLENTRY  __outportb__(unsigned __portid, unsigned char __value);
  160. unsigned        _RTLENTRY  __outportw__(unsigned __portid, unsigned __value);
  161.  
  162. #define inportb(__portid)           __inportb__(__portid)
  163. #define outportb(__portid, __value) ((void) __outportb__(__portid, __value))
  164. #define inport(__portid)            __inportw__(__portid)
  165. #define outport(__portid, __value)  ((void) __outportw__(__portid, __value))
  166.  
  167. /* MSC-compatible macros for port I/O */
  168. #define inp(__portid)               __inportb__ (__portid)
  169. #define outp(__portid, __value)     __outportb__(__portid, (unsigned char)(__value))
  170. #define inpw(__portid)              __inportw__ (__portid)
  171. #define outpw(__portid, __value)    __outportw__(__portid, __value)
  172.  
  173. #endif  /* _PORT_DEFS */
  174.  
  175. #ifdef __cplusplus
  176. }
  177. #endif
  178.  
  179. #else  /* __FLAT__ */
  180.  
  181. enum text_modes
  182. {
  183.     /* DOS-compatible modes */
  184.  
  185.     LASTMODE = -1,
  186.     BW40     = 0,
  187.     C40,
  188.     BW80,
  189.     C80,
  190.     MONO     = 7,
  191.     C4350    = 64,
  192.  
  193.     /* New Color modes */
  194.  
  195.     C40X14   = 8,
  196.     C40X21,
  197.     C40X28,
  198.     C40X43,
  199.     C40X50,
  200.     C40X60,
  201.  
  202.     C80X14,
  203.     C80X21,
  204.     C80X28,
  205.     C80X43,
  206.     C80X50,
  207.     C80X60,
  208.  
  209.     /* New Black & White modes */
  210.  
  211.     BW40X14,
  212.     BW40X21,
  213.     BW40X28,
  214.     BW40X43,
  215.     BW40X50,
  216.     BW40X60,
  217.  
  218.     BW80X14,
  219.     BW80X21,
  220.     BW80X28,
  221.     BW80X43,
  222.     BW80X50,
  223.     BW80X60,
  224.  
  225.     /* New Monochrome modes */
  226.  
  227.     MONO14,             /* Invalid VGA mode */
  228.     MONO21,
  229.     MONO28,
  230.     MONO43,
  231.     MONO50,
  232.     MONO60,
  233.  
  234.     _ORIGMODE = 65      /* original mode at program startup */
  235. };
  236.  
  237.  
  238. #define PASS_MAX    8   /* max. no. of chars returned by getpass */
  239.  
  240. #if !defined(__STDC__)  /*  NON-ANSI  */
  241. #define directvideo  _directvideo
  242. #define _getch       getch             /* for MSC compatibility */
  243. #endif
  244.  
  245. extern   int _RTLENTRY _EXPDATA _directvideo;
  246.  
  247. extern   int _RTLENTRY _EXPDATA _wscroll;
  248.  
  249. #ifdef __cplusplus
  250. extern "C" {
  251. #endif
  252.  
  253. void        _RTLENTRY _EXPFUNC clreol( void );
  254. void        _RTLENTRY _EXPFUNC clrscr( void );
  255. void        _RTLENTRY _EXPFUNC delline( void );
  256. int         _RTLENTRY _EXPFUNC gettext( int __left, int __top,
  257.                             int __right, int __bottom,
  258.                             void *__destin);
  259. void        _RTLENTRY _EXPFUNC gettextinfo (struct text_info *__r );
  260. void        _RTLENTRY _EXPFUNC gotoxy( int __x, int __y );
  261. void        _RTLENTRY _EXPFUNC highvideo( void );
  262. void        _RTLENTRY _EXPFUNC insline( void );
  263. void        _RTLENTRY _EXPFUNC lowvideo( void );
  264. int         _RTLENTRY _EXPFUNC movetext( int __left, int __top,
  265.                              int __right, int __bottom,
  266.                              int __destleft, int __desttop );
  267. void        _RTLENTRY _EXPFUNC normvideo( void );
  268. int         _RTLENTRY _EXPFUNC puttext( int __left, int __top,
  269.                             int __right, int __bottom,
  270.                             void *__source );
  271. void        _RTLENTRY _EXPFUNC textattr( int __newattr );
  272. void        _RTLENTRY _EXPFUNC textbackground( int __newcolor );
  273. void        _RTLENTRY _EXPFUNC textcolor( int __newcolor );
  274. void        _RTLENTRY _EXPFUNC textmode( int __newmode );
  275. void        _RTLENTRY _EXPFUNC window( int __left, int __top, int __right, int __bottom);
  276.  
  277. void        _RTLENTRY _EXPFUNC _setcursortype( int __cur_t );
  278. char *      _RTLENTRY _EXPFUNC cgets( char *__str );
  279. int         _RTLENTRY _EXPFUNC cprintf( const char *__format, ... );
  280. int         _RTLENTRY _EXPFUNC cputs( const char *__str );
  281. int         _RTLENTRY _EXPFUNC cscanf( const char *__format, ... );
  282. int         _RTLENTRY _EXPFUNC getch( void );
  283. int         _RTLENTRY _EXPFUNC getche( void );
  284. char *      _RTLENTRY _EXPFUNC getpass( const char *__prompt );
  285. int         _RTLENTRY _EXPFUNC kbhit( void );
  286. int         _RTLENTRY _EXPFUNC putch( int __c );
  287. int         _RTLENTRY _EXPFUNC ungetch( int __ch );
  288. int         _RTLENTRY _EXPFUNC wherex( void );
  289. int         _RTLENTRY _EXPFUNC wherey( void );
  290.  
  291. #ifdef __cplusplus
  292. }
  293. #endif
  294.  
  295. #endif  /* __FLAT__  */
  296.  
  297.  
  298. #if !defined(RC_INVOKED)
  299.  
  300. /* restore default packing */
  301. #pragma pack(pop)
  302.  
  303. #if defined(__STDC__)
  304. #pragma warn .nak
  305. #endif
  306.  
  307. #endif  /* !RC_INVOKED */
  308.  
  309.  
  310. #endif  /* __CONIO_H */
  311.