home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / rawed1_1.zip / WATCOM10.IO < prev   
Text File  |  1996-06-08  |  3KB  |  157 lines

  1. /* WATCOM10.IO --- Basic input-output routines for watcom 10.0 C++ compiler */
  2.  
  3. #include <conio.h>
  4. #include <stdarg.h>
  5. #include <graph.h>
  6. #include <mem.h>
  7. #include <ctype.h>
  8. #include <io.h>
  9.  
  10. #define io_clrscr()          _clearscreen(_GWINDOW) 
  11. #define io_gotoxy(col,row)   _settextposition(row,col)
  12. #define io_refresh()          
  13. #define io_flush_keyboard()   while(io_inkey())
  14. #define io_unlink             unlink
  15. #define io_puts              _outtext
  16. #define io_putc(a)           { char tmp_outtext_str[]=" "; \
  17.                                tmp_outtext_str[0] = a;     \
  18.                                _outtext(tmp_outtext_str); }
  19.  
  20. #define io_MAX_VALID_CHARACTER 255
  21. #define io_MIN_VALID_CHARACTER  32
  22. #define io_MIXED_CASE_FILENAMES 0
  23.  
  24. /* --------------------------------- **
  25. **  P R O T O T Y P E S              **
  26. ** --------------------------------- */
  27. void  io_printf( char *format, ... );
  28. short io_inkey(void);
  29. short io_inchar(void);
  30. void  io_init(void);
  31. void  io_end(void);
  32.  
  33. /* --------------------------------- **
  34. **  I / O   F U N C T I O N S        **
  35. ** --------------------------------- */
  36. void io_printf( char *format, ... )
  37. {
  38.     auto va_list arglist;
  39.     char tmp[1000];
  40.  
  41.     va_start( arglist, format );
  42.     vsprintf( tmp, format, arglist );
  43.     va_end( arglist );
  44.  
  45.     _outtext(tmp);
  46. }
  47.  
  48. short io_inkey(void)
  49. {
  50.   short return_val=0;
  51.   unsigned char ch;
  52.  
  53.   if (kbhit())
  54.   {
  55.     ch = getch();
  56.     if (ch)
  57.     {
  58.       return_val = (short)ch;
  59.     }
  60.     else
  61.     {
  62.       ch = getch();
  63.       return_val = -(short)ch;
  64.     }
  65.   }
  66.   else
  67.   {
  68.      return_val = 0;
  69.   }
  70.   return return_val;
  71. }
  72.  
  73. short io_inchar(void)
  74. {
  75.    short ch=0;
  76.  
  77.    while(!ch)
  78.    {
  79.      ch = io_inkey();
  80.    }
  81.    return ch;
  82. }
  83.  
  84. void io_init(void)
  85. {
  86.   io_clrscr();
  87. }
  88.  
  89. void io_end(void)
  90. {
  91.   io_gotoxy( 80, 24 );
  92.   io_printf( "\n\n" );
  93.   io_refresh();
  94. }
  95.  
  96.  
  97. /* --------------------------------- **
  98. **  C O N S T A N T S                **
  99. ** --------------------------------- */
  100.  
  101. #define io_BACKSPACE    8
  102. #define io_DELETE     -83
  103. #define io_DOWN       -80
  104. #define io_END        -79
  105. #define io_ENTER       13
  106. #define io_ESCAPE      27
  107. #define io_HOME       -71
  108. #define io_INSERT     -82
  109. #define io_LEFT       -75
  110. #define io_PAGEDOWN   -81
  111. #define io_PAGEUP     -73
  112. #define io_RIGHT      -77
  113. #define io_TAB          9
  114. #define io_UP         -72
  115.  
  116. #define io_SHIFT_TAB  -15
  117. #define io_BACKTAB    -15
  118.  
  119. #define io_CTRL_A       1
  120. #define io_CTRL_B       2
  121. #define io_CTRL_C       3
  122. #define io_CTRL_D       4
  123. #define io_CTRL_E       5
  124. #define io_CTRL_F       6
  125. #define io_CTRL_G       7
  126. #define io_CTRL_H       8
  127. #define io_CTRL_I       9
  128. #define io_CTRL_J      10
  129. #define io_CTRL_K      11
  130. #define io_CTRL_L      12
  131. #define io_CTRL_M      13
  132. #define io_CTRL_N      14
  133. #define io_CTRL_O      15
  134. #define io_CTRL_P      16
  135. #define io_CTRL_Q      17
  136. #define io_CTRL_R      18
  137. #define io_CTRL_S      19
  138. #define io_CTRL_T      20
  139. #define io_CTRL_U      21
  140. #define io_CTRL_V      22
  141. #define io_CTRL_W      23
  142. #define io_CTRL_X      24
  143. #define io_CTRL_Y      25
  144. #define io_CTRL_Z      26
  145.  
  146. #define io_F1         -59
  147. #define io_F2         -60
  148. #define io_F3         -61
  149. #define io_F4         -62
  150. #define io_F5         -63
  151. #define io_F6         -64
  152. #define io_F7         -65
  153. #define io_F8         -66
  154. #define io_F9         -67
  155. #define io_F10        -68
  156.  
  157.