home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 12sbuf / sbuf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1.4 KB  |  62 lines

  1. /*
  2.  *    sbuf.h -- header file for buffered screen interface
  3.  */
  4.  
  5. #define SB_OK    0
  6. #define SB_ERR    (-1)
  7.  
  8. /* screen buffer constants */
  9. #define SB_ROWS    25
  10. #define SB_COLS    80
  11. #define SB_SIZ    SB_ROWS * SB_COLS
  12.  
  13. /* screen character/attribute buffer element definition */
  14. struct BYTEBUF {
  15.     unsigned char ch;    /* character */
  16.     unsigned char attr;    /* attribute */
  17. };
  18.  
  19. union CELL {
  20.     struct BYTEBUF b;
  21.     unsigned short cap;    /* character/attribute pair */
  22. };
  23.  
  24. /* screen buffer control structure */
  25. struct BUFFER {
  26.     /* current position */
  27.     short row, col;
  28.  
  29.     /* pointer to screen buffer array */
  30.     union CELL *bp;
  31.  
  32.     /* changed region per screen buffer row */
  33.     short lcol[SB_ROWS];    /* left end of changed region */
  34.     short rcol[SB_ROWS];    /* right end of changed region */
  35.  
  36.     /* buffer status */
  37.     unsigned short flags;
  38. };
  39.  
  40. /* buffer flags values */
  41. #define SB_DELTA    0x01
  42. #define SB_RAW        0x02
  43. #define SB_DIRECT    0x04
  44. #define SB_SCROLL    0x08
  45.  
  46. /* coordinates of a window (rectangular region) on the screen buffer */
  47. struct REGION {
  48.     /* current position */
  49.     short row, col;
  50.  
  51.     /* window boundaries */
  52.     short r0, c0;    /* upper-left corner */
  53.     short r1, c1;    /* lower-right corner */
  54.  
  55.     /* scrolling region boundaries */
  56.     short sr0, sc0;    /* upper-left corner */
  57.     short sr1, sc1;    /* lower-right corner */
  58.     
  59.     /* window buffer flags */
  60.     unsigned short wflags;
  61. };
  62.