home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / database / cdbms / sys.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-01  |  1.4 KB  |  81 lines

  1. /* ----------------- sys.c -------------------- */
  2. #include <stdio.h>
  3. #include "cdata.h"
  4. #include "keys.h"
  5.  
  6. #if COMPILER == AZTEC
  7. #define ci() scr_getc()
  8. #endif
  9. #if COMPILER == DATALIGHT
  10. #define ci() getch()
  11. #endif
  12. #if COMPILER == ECOC
  13. #define ci() getch()
  14. #endif
  15. #if COMPILER == LATTICE
  16. #define ci() getch()
  17. #endif
  18. #if COMPILER == LETSC
  19. #define ci() getcnb()
  20. #endif
  21. #if COMPILER == MICROSOFT
  22. #define ci() getch()
  23. #endif
  24. #if COMPILER == TURBOC
  25. #define ci() getch()
  26. #endif
  27.  
  28. /* ------------- get a keyboard character ----------------- */
  29. int get_char()
  30. {
  31.      int c;
  32.  
  33. #if COMPILER == CI_C86
  34.     c = key_getc();
  35.     if ((c & 255) == 0)
  36.         c = (c >> 8) | 128;
  37. #else
  38. #if COMPILER == WIZARD
  39.     c = bioskey(0);
  40.     if ((c & 255) == 0)
  41.         c = (c >> 8) | 128;
  42. #else
  43.     if (!(c = ci()))
  44.         c = ci() | 128;
  45. #endif
  46. #endif
  47.     return c & 255;
  48. }
  49.  
  50. /* -------- write a character to the screen ------------ */
  51. void put_char(c)
  52. int c;
  53. {
  54.     switch (c)    {
  55.         case FWD:    printf("\033[C");
  56.                     break;
  57.         case UP:    printf("\033[A");
  58.                     break;
  59.         default:    putchar(c);
  60.     }
  61.     fflush(stdout);
  62. }
  63.  
  64. /* ------------- set the cursor position -------------- */
  65. void cursor(x,y)
  66. int x, y;
  67. {
  68.     printf("\033[%02d;%02dH",y+1, x+1);
  69.     fflush(stdout);
  70. }
  71.  
  72. /* ------------------- clear the screen ------------------- */
  73. int screen_displayed = 0;
  74. void clear_screen()
  75. {
  76.     screen_displayed = 0;
  77.     printf("\033[2J");
  78.     fflush(stdout);
  79. }
  80.  
  81.