home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / S12264.ZIP / HELLO1.H < prev   
C/C++ Source or Header  |  1989-01-19  |  3KB  |  120 lines

  1. /* hello1.h    RHS    12/14/88
  2.  *
  3.  * OS/2    and    1988 version of    K&R's hello.c
  4.  * demonstrates    multiple threads
  5.  */
  6.  
  7.  
  8.     /* Defines and Typedefs    *********************************/
  9. #if    !defined(TRUE)
  10. #define    TRUE                1
  11. #endif
  12.  
  13. #if    !defined(FALSE)
  14. #define    FALSE                0
  15. #endif
  16.  
  17. #define    LINES25                4                    /* height in lines of frames*/
  18. #define    LINES43                6
  19. #define    LINES50                7
  20.  
  21. #define    RANDOMIZER            5
  22. #define    MAXFRAMES            28                    /* limit to    max    possible    */
  23. #define    RAND()                (rand()    % maxframes);
  24. #define    THREADSTACK            400                    /* size    of stack each thread*/
  25. #define    IDCOL                15
  26. #define    ESC                    0x1b
  27. #define    BLINKING            0x80
  28. #define    NOBLINKING            (~BLINKING)
  29. #define    BRIGHT                0x08
  30. #define    NORMAL                (~BRIGHT)
  31. #define    VIOHDL                0
  32. #define    KBDHDL                0
  33. #define    MAXUSERNAME            40
  34. #define    BLANK                ' '
  35. #define    LEFTMARKER            16
  36. #define    RIGHTMARKER            17
  37. #define    BACKGROUND(n)        (n << 4)
  38. #define    COLORS(foreground,background)    (foreground    | BACKGROUND(background))
  39. #define    FIELDROW            10
  40. #define    FIELDCOL            20
  41. #define    BACKGROUNDMASK        0x70
  42. #define    UPARROW                72
  43. #define    DOWNARROW            80
  44. #define    SAVE                TRUE
  45. #define    RESTORE                FALSE
  46. #define    SAVECUR                0x0001
  47. #define    RESTORECUR            0x0002
  48. #define    HIDECUR                0x0004
  49. #define    BYTES_PER_ROW        40
  50. #define    CGA_MAGENTA            2
  51. #define    UPPER_START_PIXEL    85
  52. #define    LEFT_START_PIXEL    130
  53. #define    BANK2OFFSET            8192
  54. #define    CGABUFSIZE            16384
  55. #define    MAPSIZE                31
  56.  
  57. #define    Sizeof(stru)        (stru.cb = sizeof(stru))
  58.  
  59. #define    C0                    (COLORS(BLACK,WHITE))
  60. #define    C1                    (COLORS(BLUE, CYAN)    | BRIGHT)
  61. #define    C2                    (COLORS(GREEN,MAGENTA) | BRIGHT)
  62. #define    C3                    (COLORS(CYAN,BLUE) | BRIGHT)
  63. #define    C4                    (COLORS(BROWN, GREEN) |    BRIGHT)
  64. #define    C5                    (COLORS(WHITE, MAGENTA)    | BRIGHT)
  65. #define    C6                    (COLORS(RED, BLUE) | BRIGHT)
  66. #define    C7                    (COLORS(BLACK,BLACK))
  67.  
  68. enum _colors
  69.     {
  70.     BLACK, BLUE, GREEN,    CYAN, RED, MAGENTA,    BROWN, WHITE
  71.     };
  72.  
  73. typedef    struct _cell
  74.     {
  75.     char character;
  76.     char attribute;
  77.     } CELL;
  78.  
  79. typedef    struct _frame                            /* frame structure            */
  80.     {
  81.     unsigned    frame_cleared;
  82.     unsigned    row;
  83.     unsigned    col;
  84.     unsigned    threadid;
  85.     long        startSem;
  86.     unsigned char attr;
  87.     char        filler;                            /* insures stack on    even byte*/
  88.     char        threadstack[THREADSTACK];
  89.     } FRAME;
  90.  
  91.  
  92.     /* Function    Prototypes ***************************/
  93. void hello_thread(FRAME    far    *frameptr);
  94. void box_thread(FRAME far *frameptr);
  95. void keyboard_thread(void);
  96. void main(int argc,    char **argv);
  97. void termination(void);
  98. void initialization(void);
  99. void startup(int argc, char    **argv);
  100. void flicker_frames(void);
  101. void chasing_frames(void);
  102. void WaitForThreadDeath(int    i);
  103. char *adapter(unsigned n);
  104. char *display(unsigned n);
  105. void Background(int    n);
  106. void Screen(int    save);
  107. void Cursor(unsigned hide);
  108. int     get_user_name(void);
  109. void displayconfig(void);
  110. void togglebackground(void);
  111. void putpixel(int row, int col,    unsigned color);
  112. void clear_graphics_screen(register    unsigned char far *bank1);
  113. void SaveRestoreScreen(void);
  114. void graphics(void);
  115.  
  116.  
  117.  
  118.     /************ end of hello1.h ********************/
  119.  
  120.