home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / include / local / ansi.h next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1.9 KB  |  82 lines

  1. /*
  2.  *  ansi.h -- header file for ANSI driver information and
  3.  *          macro versions of the ANSI control sequences
  4.  */
  5.  
  6. /*****************/
  7. /** ANSI macros **/
  8. /*****************/
  9.  
  10. /* cursor position */
  11. #define    ANSI_CUP(r, c)    printf("\x1B[%d;%dH", r, c)
  12. #define    ANSI_HVP(r, c)    printf("\x1B[%d;%df", r, c)
  13.  
  14. /* cursor up, down, forward, back */
  15. #define    ANSI_CUU(n)    printf("\x1B[%dA", n)
  16. #define    ANSI_CUD(n)    printf("\x1B[%dB", n)
  17. #define    ANSI_CUF(n)    printf("\x1B[%dC", n)
  18. #define    ANSI_CUB(n)    printf("\x1B[%dD", n)
  19.  
  20. /* device status report (dumps position data into keyboard buffer) */
  21. #define    ANSI_DSR    printf("\x1B[6n")    
  22.  
  23. /* save and restore cursor position */
  24. #define    ANSI_SCP    fputs("\x1B[s", stdout)
  25. #define    ANSI_RCP    fputs("\x1B[u", stdout)
  26.  
  27. /* erase display and line */
  28. #define    ANSI_ED        fputs("\x1B[2J", stdout);
  29. #define    ANSI_EL        fputs("\x1B[K", stdout)
  30.  
  31. /* set graphic rendition */
  32. #define    ANSI_SGR(a)    printf("\x1B[%dm", a)    
  33.  
  34. /* set and reset modes */
  35. #define    ANSI_SM(m)    printf("\x1B[=%dh", m)
  36. #define    ANSI_RM(m)    printf("\x1B[=%dl", m)
  37.  
  38.  
  39. /**********************/
  40. /** ANSI color codes **/
  41. /**********************/
  42.  
  43. /* special settings */
  44. #define ANSI_NORMAL    0
  45. #define ANSI_BOLD    1
  46. #define ANSI_BLINK    5
  47. #define ANSI_REVERSE    7
  48. #define ANSI_INVISIBLE    8
  49.  
  50. /* shift values */
  51. #define ANSI_FOREGROUND    30
  52. #define ANSI_BACKGROUND    40
  53.  
  54. /* basic colors */
  55. #define ANSI_BLACK    0
  56. #define ANSI_RED    1
  57. #define ANSI_GREEN    2
  58. #define ANSI_BROWN    3
  59. #define ANSI_BLUE    4
  60. #define ANSI_MAGENTA    5
  61. #define ANSI_CYAN    6
  62. #define ANSI_WHITE    7
  63.  
  64.  
  65. /*****************************/
  66. /** modes for set and reset **/
  67. /*****************************/
  68.  
  69. #define ANSI_M40    0
  70. #define ANSI_C40    1
  71. #define ANSI_M80    2
  72. #define ANSI_C80    3
  73. #define ANSI_C320    4
  74. #define ANSI_M320    5
  75. #define ANSI_M640    6
  76. #define ANSI_WRAP    7
  77.  
  78. /* attribute "position" type */
  79. typedef enum {
  80.     FGND, BKGND, BDR
  81. } POSITION;
  82.