home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / INC.PAK / CONIO.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  9KB  |  314 lines

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