home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / conio.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  5.9 KB  |  227 lines

  1. /*  conio.h
  2.  
  3.     Direct MSDOS console input/output.
  4. */
  5.  
  6. /*
  7.  *      C/C++ Run Time Library - Version 10.0
  8.  *
  9.  *      Copyright (c) 1987, 2000 by Inprise Corporation
  10.  *      All Rights Reserved.
  11.  *
  12.  */
  13.  
  14. /* $Revision:   9.4  $ */
  15.  
  16. #if !defined(__CONIO_H)
  17. #define __CONIO_H
  18.  
  19. #ifndef ___STDDEF_H
  20. #include <_stddef.h>
  21. #endif
  22.  
  23. #if !defined(RC_INVOKED)
  24.  
  25. #if defined(__STDC__)
  26. #pragma warn -nak
  27. #endif
  28.  
  29. #pragma pack(push, 1)
  30.  
  31. #endif  /* !RC_INVOKED */
  32.  
  33.  
  34. #define _NOCURSOR      0
  35. #define _SOLIDCURSOR   1
  36. #define _NORMALCURSOR  2
  37.  
  38. struct text_info {
  39.     unsigned char winleft;
  40.     unsigned char wintop;
  41.     unsigned char winright;
  42.     unsigned char winbottom;
  43.     unsigned char attribute;
  44.     unsigned char normattr;
  45.     unsigned char currmode;
  46.     unsigned char screenheight;
  47.     unsigned char screenwidth;
  48.     unsigned char curx;
  49.     unsigned char cury;
  50. };
  51.  
  52. #if !defined(__COLORS)
  53. #define __COLORS
  54.  
  55. enum COLORS {
  56.     BLACK,          /* dark colors */
  57.     BLUE,
  58.     GREEN,
  59.     CYAN,
  60.     RED,
  61.     MAGENTA,
  62.     BROWN,
  63.     LIGHTGRAY,
  64.     DARKGRAY,       /* light colors */
  65.     LIGHTBLUE,
  66.     LIGHTGREEN,
  67.     LIGHTCYAN,
  68.     LIGHTRED,
  69.     LIGHTMAGENTA,
  70.     YELLOW,
  71.     WHITE
  72. };
  73. #endif
  74.  
  75. #define BLINK       128 /* blink bit */
  76.  
  77. enum text_modes
  78. {
  79.     /* DOS-compatible modes */
  80.  
  81.     LASTMODE = -1,
  82.     BW40     = 0,
  83.     C40,
  84.     BW80,
  85.     C80,
  86.     MONO     = 7,
  87.     C4350    = 64,
  88.  
  89.     /* New Color modes */
  90.  
  91.     C40X14   = 8,
  92.     C40X21,
  93.     C40X28,
  94.     C40X43,
  95.     C40X50,
  96.     C40X60,
  97.  
  98.     C80X14,
  99.     C80X21,
  100.     C80X28,
  101.     C80X43,
  102.     C80X50,
  103.     C80X60,
  104.  
  105.     /* New Black & White modes */
  106.  
  107.     BW40X14,
  108.     BW40X21,
  109.     BW40X28,
  110.     BW40X43,
  111.     BW40X50,
  112.     BW40X60,
  113.  
  114.     BW80X14,
  115.     BW80X21,
  116.     BW80X28,
  117.     BW80X43,
  118.     BW80X50,
  119.     BW80X60,
  120.  
  121.     /* New Monochrome modes */
  122.  
  123.     MONO14,             /* Invalid VGA mode */
  124.     MONO21,
  125.     MONO28,
  126.     MONO43,
  127.     MONO50,
  128.     MONO60,
  129.  
  130.     _ORIGMODE = 65      /* original mode at program startup */
  131. };
  132.  
  133.  
  134. #define PASS_MAX    8   /* max. no. of chars returned by getpass */
  135.  
  136.  
  137. extern   int _RTLENTRY _EXPDATA _directvideo;
  138.  
  139. extern   int _RTLENTRY _EXPDATA _wscroll;
  140.  
  141. #ifdef __cplusplus
  142. extern "C" {
  143. #endif
  144.  
  145. void        _RTLENTRY _EXPFUNC clreol( void );
  146. void        _RTLENTRY _EXPFUNC clrscr( void );
  147. void        _RTLENTRY _EXPFUNC delline( void );
  148. int         _RTLENTRY _EXPFUNC gettext( int __left, int __top,
  149.                             int __right, int __bottom,
  150.                             void *__destin);
  151. void        _RTLENTRY _EXPFUNC gettextinfo (struct text_info *__r );
  152. void        _RTLENTRY _EXPFUNC gotoxy( int __x, int __y );
  153. void        _RTLENTRY _EXPFUNC highvideo( void );
  154. void        _RTLENTRY _EXPFUNC insline( void );
  155. void        _RTLENTRY _EXPFUNC lowvideo( void );
  156. int         _RTLENTRY _EXPFUNC movetext( int __left, int __top,
  157.                              int __right, int __bottom,
  158.                              int __destleft, int __desttop );
  159. void        _RTLENTRY _EXPFUNC normvideo( void );
  160. int         _RTLENTRY _EXPFUNC puttext( int __left, int __top,
  161.                             int __right, int __bottom,
  162.                             void *__source );
  163. void        _RTLENTRY _EXPFUNC textattr( int __newattr );
  164. void        _RTLENTRY _EXPFUNC textbackground( int __newcolor );
  165. void        _RTLENTRY _EXPFUNC textcolor( int __newcolor );
  166. void        _RTLENTRY _EXPFUNC textmode( int __newmode );
  167. void        _RTLENTRY _EXPFUNC window( int __left, int __top, int __right, int __bottom);
  168.  
  169. void        _RTLENTRY _EXPFUNC _setcursortype( int __cur_t );
  170. char *      _RTLENTRY _EXPFUNC cgets( char *__str );
  171. int         _RTLENTRY _EXPFUNC cprintf( const char *__format, ... );
  172. int         _RTLENTRY _EXPFUNC cputs( const char *__str );
  173. int         _RTLENTRY _EXPFUNC cscanf( const char *__format, ... );
  174. int         _RTLENTRY _EXPFUNC getch( void );
  175. int         _RTLENTRY _EXPFUNC getche( void );
  176. char *      _RTLENTRY _EXPFUNC getpass( const char *__prompt );
  177. int         _RTLENTRY _EXPFUNC kbhit( void );
  178. int         _RTLENTRY _EXPFUNC putch( int __c );
  179. int         _RTLENTRY _EXPFUNC ungetch( int __ch );
  180. int         _RTLENTRY _EXPFUNC wherex( void );
  181. int         _RTLENTRY _EXPFUNC wherey( void );
  182.  
  183. __inline int _getch( void ) { return getch(); } /* for MSC compatibility */
  184.  
  185. /*
  186.   This function will remove from the console event queue, any key-up events
  187.   that are pending. under Win95 key-up events will incorrectly be translated
  188.   into real key presses by the OS ReadFile() API call, which scanf() uses.
  189.   The WinNT version of ReadFile() correctly ignores them, of course. The
  190.   problem can occur when getch() is called to get a key, then scanf() is
  191.   called to obtain more input from stdin.  On Win95 the key-up event that is
  192.   still left in the event queue will cause ReadFile() to think that the same
  193.   key was pressed again.  Although, good programming practice dictates that
  194.   one shouldn't use both getch() and scanf() near each other in the same
  195.   program, the following function could help alleviate this key-up problem.
  196.   cscanf() does NOT suffer from this problem since it gets its input via
  197.   getch() and not ReadFile().  __flush_win95_keyup_events() should be called
  198.   before scanf() is called. Keep in mind that you must allow sufficient time
  199.   for the user to release the key so that the key-up event is inserted
  200.   before flushing the key-up events.  Otherwise, the key-up event will occur
  201.   after scanf() is blocked and waiting inside ReadFile().
  202.  
  203.   __flush_win95_keyup_events() returns the number of key-up events that it
  204.   removed from the queue.
  205.  
  206. */
  207. int         _RTLENTRY _EXPFUNC __flush_win95_keyup_events (void);
  208.  
  209.  
  210. #ifdef __cplusplus
  211. }
  212. #endif
  213.  
  214. #if !defined(RC_INVOKED)
  215.  
  216. /* restore default packing */
  217. #pragma pack(pop)
  218.  
  219. #if defined(__STDC__)
  220. #pragma warn .nak
  221. #endif
  222.  
  223. #endif  /* !RC_INVOKED */
  224.  
  225.  
  226. #endif  /* __CONIO_H */
  227.