home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / code / bcpp / file12 / pcwproto.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  8.7 KB  |  264 lines

  1. /*$no list *//*$no trace <<<pcwproto.h>>> */
  2. /***********************************************************/
  3. /* File Id.                  Pcwproto.H                    */
  4. /* Author.                   Stan Milam.                   */
  5. /*                                                         */
  6. /*          (c) Copyright 1989, 1990 by Stan Milam         */
  7. /*                                                         */
  8. /* Comments: This file contains definitions to be used int */
  9. /* the screen management library.  The library will support*/
  10. /* Microsoft C V5.10, Turbo C V2.0, Power C V1.60.         */
  11. /*                                                         */
  12. /***********************************************************/
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17.  
  18. extern  int Vbump;
  19. extern  int mpresent;
  20. extern  int _monitor;
  21. extern  int _adaptor;
  22. extern  int _video_ram;
  23.  
  24. #ifdef MSC
  25. #   define MK_FP(seg, off) ((void far *)(((long)(seg)<<16) | (off)))
  26. #   define outportb outp
  27. #   define inportb inp
  28.     struct REGPACK {
  29.         unsigned r_ax, r_bx, r_cx, r_dx, r_bp;
  30.         unsigned r_si, r_di, r_ds, r_es, r_flags;
  31.     };
  32. #define int86 _int86
  33. #define int86x _int86x
  34. #endif
  35.  
  36. #ifdef __ZTC__
  37. #   define outportb outp
  38. #   define inportb inp
  39.     struct REGPACK {
  40.         unsigned r_ax, r_bx, r_cx, r_dx, r_bp;
  41.         unsigned r_si, r_di, r_ds, r_es, r_flags;
  42.     };
  43. #endif
  44.  
  45. #define ischar(c) ((int)(c) > -1 && (int)(c) < 256)
  46. #define peekc(s,o)   ((char far *)((MK_FP((s),(o))))
  47. #define peekw(a,b)   ((int  far *)((MK_FP((s),(o))))
  48. #define pokec(s,o,v) ((char far *)((MK_FP((s),(o)))) = (char) (v)
  49. #define pokew(s,o,v) ((int  far *)((MK_FP((s),(o)))) = (int)  (v)
  50.  
  51. #define MK_SCRNOFF(r,c) ((unsigned)(((r)-1)*Vbump)+(((c)-1)*2)+(page*pagesize))
  52. #define MK_ATTR(fc,bc) ((((bc) << 4) | (fc)) << 8)
  53.  
  54. #ifndef WNDPTR
  55. #  define WNDPTR void
  56. #endif
  57.  
  58. /* Define the Text Colors */
  59.  
  60. #define BLACK         0
  61. #define BLUE          1
  62. #define GREEN         2
  63. #define CYAN          3
  64. #define RED           4
  65. #define MAGENTA       5
  66. #define BROWN         6
  67. #define LIGHTGRAY     7
  68. #define DARKGRAY      8
  69. #define LIGHTBLUE     9
  70. #define LIGHTGREEN   10
  71. #define LIGHTCYAN    11
  72. #define LIGHTRED     12
  73. #define LIGHTMAGENTA 13
  74. #define YELLOW       14
  75. #define WHITE        15
  76. #define BLINK       128
  77.  
  78. /* Define the Border Types */
  79.  
  80. #define DOUBLEALL     0
  81. #define SINGLEALL     1
  82. #define SINGLESIDES   2
  83. #define DOUBLESIDES   3
  84. #define NOSIDES       4
  85.  
  86. /* Defines of Where Window Titles go */
  87.  
  88. #define TOP           0                /* Title located at top */
  89. #define BOTTOM        1                /* Title located at botton */
  90. #define LEFT          0                /* Left side of Window */
  91. #define RITE          1                /* Right side of window */
  92. #define MIDDLE        2                /* Or in the middle  */
  93.  
  94. /* Used to specify which button for the mouse */
  95.  
  96. #define LEFTM         0                /* Left Mouse Button */
  97. #define RITEM         1                /* Rite Mouse Button */
  98.  
  99. /* Defines for Reordering the Windows */
  100.  
  101. #define NORMAL        0
  102. #define POP           1                /* Do NOT USE!!!! */
  103. #define PUSH          2                /* Do NOT USE!!!! */
  104. #define HIDE          3                /* Do NOT USE!!!! */
  105. #define SHOW          4                /* Do NOT USE!!!! */
  106.  
  107. /* Define scrolling parms */
  108.  
  109. #define DOWN          0
  110. #define UP            1
  111.  
  112. /* Define values for monitor and adaptor */
  113.  
  114. #define MDA           1
  115. #define CGA           2
  116. #define EGA           3
  117. #define VGA           4
  118.  
  119. #define MONO          0
  120. #define COLOR         1
  121.  
  122. #define CGA200        0
  123. #define EGA350        1
  124. #define VGA400        2
  125. #define EGA14        14
  126. #define VGA16        16
  127.  
  128. /* Define values to initialize PCW with pcwinit() */
  129.  
  130. #define AUTOEXIT      1
  131. #define NOEXIT        0
  132.  
  133. /*  Miscellaneous Defines */
  134.  
  135. #define CENTER       99                            /* qputs & wputs */
  136. #define SPACES       32
  137.  
  138. /* Default EGA & VGA Palette */
  139.  
  140. #define DFTL_PALETTE 22
  141.  
  142. /*     Window Functions    */
  143.  
  144. WNDPTR *wpop(WNDPTR *wnd);
  145. WNDPTR *get_active_wnd(void);
  146. WNDPTR *wframe(int ur,int uc,int lr,int lc, int fclr, int bclr);
  147. WNDPTR *wpush(int urow, int ucol, int lrow, int lcol);
  148. WNDPTR *wexplode(int urow,int ucol,int lrow,int lcol,int fclr,int bclr);
  149. int    wprintf(WNDPTR *wnd, int row, int col, char *format,...);
  150. int    wputs(WNDPTR *wnd, int row, int col, char str[]);
  151. int    wprints(WNDPTR *wnd,int row,int col,int fclr,int bclr,char *str);
  152. int    wtitle(WNDPTR *wnd, int tb, int mlr, char *s);
  153. int    whide(WNDPTR *wnd);
  154. int    wshow(WNDPTR *wnd);
  155. int    wndmove(WNDPTR *wnd, int row, int col);
  156. int    w_chg_attr(WNDPTR *wnd,int row,int col,int fclr,int blclr,int cols);
  157. int    wscroll(WNDPTR *wnd, int action, int count);
  158. int    w_block_write(WNDPTR *wnd, int row, int col, char *block[]);
  159. int    clr_wnd(WNDPTR *wnd, int action);
  160. void   pcwinit(int action);
  161. void   _pcw_exit(void);
  162. void   re_order(WNDPTR *wnd, int attribute);
  163.  
  164. /*     Quick Screen Writing Routines     */
  165.  
  166. int  qputchar(int row, int col, int fcolor, int bcolor, unsigned char ch);
  167. int  qfill(int urow,int ucol,int lrow,int lcol,int fcolor,int bcolor,int ch);
  168. int  qbox(int urow, int ucol, int lrow, int lcol);
  169. int  qvchar(int row, int col, int fcolor, int bcolor, unsigned char ch, int count);
  170. int  qhchar(int row, int col, int fcolor, int bcolor, unsigned char ch, int count);
  171. int  qputs (int row, int col, int fcolor, int bcolor, char *s);
  172. int  qvputs(int row, int col, int fcolor, int bcolor, char *s);
  173. int  qprintf(int row, int col, int fcolor, int bcolor, char *format, ...);
  174. int  qvprintf(int row, int col, int fcolor, int bcolor, char *format, ...);
  175. int  q_block_write(int row,int col,int fclr,int bclr, char *block[]);
  176. int  scroll(int ur,int uc,int lr,int lc,int fg,int bg,int count);
  177. int  chg_attr(int row, int col, int fcolor, int bcolor, int count);
  178. int  getattr(int row, int col);
  179. int  getchr(int row, int col);
  180.  
  181. /* Some Miscellaneous Function related to quick writes & windows */
  182.  
  183. void titlecolor(int fcolor, int bcolor);
  184. void bordercolor(int fcolor, int bcolor);
  185. void setborder(int type);
  186. void set_wnd_attr(WNDPTR *wnd, int foreground, int background);
  187.  
  188. /* Miscellaneous Functions */
  189.  
  190. void _sound(unsigned freq);
  191. void _nosound(void);
  192. void rest(unsigned ticks);
  193. void swait(unsigned seconds);
  194. void far _delay(unsigned ms);
  195. void farcopy(void far *dest, void far *srce, unsigned count);
  196.  
  197. /* Environment functions */
  198.  
  199. int  getpage(void);                         /* Gets logical CRT page */
  200. int  getpagesize(void);                     /* Returns size of CRT page */
  201. int  setpage(int page);                     /* Sets logical CRT page */
  202. int  ispcwinit(void);                       /* Is the library intialized? */
  203. int  chk_video_state(int *rw, int *cl);     /* Returns max rows & cols */
  204. unsigned int getscrnseg(void);              /* Returns Segment of video mem */
  205.  
  206. /* BIOS dependent functions */
  207.  
  208. int  vgetattr(void);
  209. int  vgetchr(void);
  210. void get_cursor_size(int *tline, int *bline);
  211. void set_cursor_size(int tline, int bline);
  212. void get_cursor_pos(int *row, int *col);
  213. void set_cursor_pos(int row, int col);
  214. void switchpage(int page);
  215. void vcls(void);
  216. void vgetmode(int *cols, int *mode, int *activepage);
  217. void vsetmode(int mode);
  218.  
  219. /*  Mouse Functions  */
  220.  
  221. int  init_mouse(void);
  222. int  get_mpressed(int button);
  223. int  get_mreleased(int button);
  224. void show_mouse(void);
  225. void hide_mouse(void);
  226. void get_mpos(int *row, int *col, int *bstatus);
  227. void set_mpos(int  row, int  col);
  228. void mframe(int urow, int ucol, int lrow, int lcol);
  229. void set_mtype(int ctype, int arg1, int arg2);
  230. char *save_mouse_state(void);
  231. void restore_mouse_state(char *buffer);
  232.  
  233. /*  Keyboard Functions */
  234.  
  235. int  keypressed(void);                      /* Was a key pressed */
  236. int  readkey(void);                         /* Read keyboard character */
  237. int  isxkeybd(void);                        /* Extended keyboard BIOS? */
  238. int  keywait(int seconds);                  /* Wait or keypressed */
  239. int  get_chars(int rw,int cl,int fc,int bc,int len,char *buffer);
  240. int keyin(void);                           /* Read char/handles spcl keys */
  241. void keybrd_flush(void);                    /* Flush the keyboard */
  242.  
  243. /*  EGA/VGA specific functions */
  244.  
  245. int  download_rom_font(int font, char *buffer);
  246. int  load_user_font(int bpc,int blk,int nchars,int fchar,char *buffer);
  247. char *get_ega_palette(int mode);
  248. void set_palette(int preg, int color);
  249. void load_ega_palette(void);
  250. void set_load_palette(int preg, int color);
  251. void fload(int block, int font);
  252. void set_vga_scan_lines(int arg);
  253.  
  254. /* Interrupt Handlers & Such */
  255.  
  256. int  set_int24(void);
  257. int  set_int29(void);
  258. void reset_int29(void);
  259.  
  260. #ifdef __cplusplus
  261. }
  262. #endif
  263. /*$list *//*$trace <<<pcwproto.h>>> */
  264.