home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / graph / wndwboss / windows.h < prev   
Encoding:
C/C++ Source or Header  |  1986-12-16  |  9.3 KB  |  310 lines

  1. /*
  2. ** WINDOWS - Simple but Elegant Window Functions 
  3. **           (Lattice, Computer Innovations, Microsoft, Mark Williams)
  4. **
  5. ** Copyright (c) 1984, 1985, 1986 - Philip A. Mongelluzzo
  6. ** All rights reserved.
  7. **
  8. */
  9.  
  10. /*
  11. ** Truth, Lies, and Compiler Options 
  12. **
  13. ** Various equates for the various compilers.
  14. **
  15. ** Basic compiler invocation is:
  16. **
  17. ** Microsoft 3.0 
  18. **
  19. **      MSC -dMSCV3 sourcefile_name;
  20. **
  21. ** Microsoft 4.0 
  22. **
  23. **      MSC -dMSCV4 sourcefile_name;
  24. **
  25. ** Lattice 2.XX 
  26. **
  27. **      LCS -dLC2 sourcefile_name
  28. **
  29. ** Lattice 3.XX
  30. **
  31. **      LCS -dLC3 sourcefile_name
  32. **
  33. ** Datalight
  34. **
  35. **      DLC1 -dDLC -mS sourcefile_name
  36. **      DLC2 sourcefile_name -S
  37. **
  38. ** Mark Williams "Lets C"
  39. **
  40. **      CC -DMWC sourcefile_name
  41. **
  42. ** Computer Innovations CI86
  43. **
  44. **      cc1 -cm -dC86 sourcefile_name
  45. **      cc2 ...
  46. **
  47. */
  48.  
  49. /*
  50. ** ONE of the following can be commented out if you prefer to
  51. ** use this method instead of the command line arg at compile time.
  52. **
  53. ** Registered Users Only: 
  54. **
  55. **   BE SURE TO MAKE CHANGES IN BOTH WINDOWS.C AND WINDOWS.H
  56. */
  57.  
  58. /* #define MSCV3 */
  59. /* #define MSCV4 */
  60. /* #define LC2   */
  61. /* #define LC3   */
  62. /* #define DLC   */
  63. /* #define MWC   */
  64. /* #define C86   */
  65.  
  66. /*
  67. ** Microsoft 3.00 
  68. */
  69.  
  70. #ifdef MSCV3
  71. #define MSC     1
  72. #define MSC4    0
  73. #define DLC     0
  74. #define MWC     0
  75. #define CI86    0
  76. #define LC2     0
  77. #define LC3     0
  78. #if M_I86SM                             /* small code, small data */
  79. #define SPTR    1
  80. #define LPTR    0
  81. #endif
  82. #if M_I86LM                             /* large code, large data */
  83. #define SPTR    0
  84. #define LPTR    1
  85. #endif
  86. #if M_I86CM                             /* small code, large data */
  87. #define SPTR    0
  88. #define LPTR    1
  89. #endif
  90. #if M_I86MM                             /* large code, small data */
  91. #define SPTR    1
  92. #define LPTR    0
  93. #endif
  94. #define LATTICE 1
  95. #endif
  96.  
  97. /*
  98. ** Microsoft 4.0
  99. */
  100.  
  101. #ifdef MSCV4
  102. #define MSC     1
  103. #define MSC4    1
  104. #define DLC     0
  105. #define MWC     0
  106. #define CI86    0
  107. #define LC2     0
  108. #define LC3     0
  109. #if M_I86SM                             /* small code, small data */
  110. #define SPTR    1
  111. #define LPTR    0
  112. #endif
  113. #if M_I86LM                             /* large code, large data */
  114. #define SPTR    0
  115. #define LPTR    1
  116. #endif
  117. #if M_I86CM                             /* small code, large data */
  118. #define SPTR    0
  119. #define LPTR    1
  120. #endif
  121. #if M_I86MM                             /* large code, small data */
  122. #define SPTR    1
  123. #define LPTR    0
  124. #endif
  125. #define LATTICE 1
  126. #endif
  127.  
  128. /*
  129. ** Computer Innovations
  130. */
  131.  
  132. #ifdef C86
  133. #define MSC     0
  134. #define MSC4    0
  135. #define DLC     0
  136. #define MWC     0
  137. #define CI86    1
  138. #define LC2     0
  139. #define LC3     0
  140. #define M_I86   0
  141. #ifdef _C86_BIG
  142. #define LPTR    1 
  143. #define SPTR    0
  144. #else
  145. #define LPTR    0
  146. #define SPTR    1
  147. #endif
  148. #define LATTICE 0 
  149. #endif 
  150. #define TRUE    1                       /* truth */
  151. #define FALSE   0                       /* lies */
  152. #define The_BOSS TRUE                   /* convienent equate */
  153.  
  154. #if M_I86                               /* Microsoft C */
  155. #define LINT_ARGS                       /* enforce type checking */
  156. #include "malloc.h"                     /* for malloc... */
  157. #else                                   /* if not Microsoft C */
  158. char *malloc(), *calloc();              /* keep everybody happy */
  159. #endif
  160.  
  161. #include "stdio.h"                      /* standard header */
  162. #include "dos.h"                        /* Lattice stuff */
  163. #include "ctype.h"                      /* character conversion stuff */
  164. #if MSC4
  165. #include "stdarg.h"                     /* variable arg list marcos */
  166. #endif
  167.  
  168. #if CI86     
  169. struct SREGS                            /* for segread */
  170.         {
  171.         unsigned es,cs,ss,ds;
  172.         };
  173. #endif
  174.  
  175. #define SAVE    TRUE                    /* similar truth */
  176. #define RESTORE FALSE                   /* fibs */
  177. #define REPLACE 1                       /* for flicker free */
  178. #define ERASE   0                       /* scroll w_sapd & w_sapu */
  179. #define FAST    0x01                    /* fast retrace */
  180. #define SLOW    0x08                    /* slow retrace */
  181.  
  182. #define NULPTR  (char *) 0              /* null pointer */
  183. #define BEL     0x07                    /* beep */
  184. #define BS      0x08                    /* backspace */
  185. #define NUL     '\0'                    /* NUL char */
  186. #define ESC     0x1b                    /* Escape */
  187. #define CR      0x0d                    /* carriage return */
  188. #define LF      0x0a                    /* linefeed */
  189. #define DEL     0x7f                    /* delete */
  190. #define NAK     0x15                    /* ^U */
  191. #define ETX     0x03                    /* ^C */
  192. #define CAN     0x18                    /* ^X */
  193. #define Del     0x53                    /* Del key scan code */
  194. #define ECHO    0x8000                  /* echo disable bit */
  195.  
  196. #define BIOS    0x01                    /* BIOS Scrolling */
  197. #define DMAS    0x02                    /* The BOSS's DMA Scrolling */
  198.  
  199. /*
  200. ** Externals
  201. */
  202.  
  203. extern int wn_dmaflg;                   /* dma flag */
  204. extern char wn_sbit;                    /* retrace test bit 8 slow, 1 fast */
  205. extern int wn_blank;                    /* vidon & vidoff control flag */
  206. extern int wns_bchars[];                /* box chars */
  207. extern unsigned int wns_mtflg;          /* monitor type flag */
  208. extern int wns_cflag;                   /* close in progress flag */
  209.  
  210. #if MSC | LATTICE | DLC | CI86          /* NOT for Mark Williams */
  211. extern struct SREGS wns_srp;            /* for segread */
  212. #endif
  213.  
  214. #if MWC                                 /* Mark Williams */
  215. #define strchr index
  216. #endif
  217.  
  218. #define BCUL  wns_bchars[0]             /* some shorthand for later */
  219. #define BCUR  wns_bchars[1]
  220. #define BCTB  wns_bchars[2]
  221. #define BCSD  wns_bchars[3]
  222. #define BCLL  wns_bchars[4]
  223. #define BCLR  wns_bchars[5]
  224.  
  225. /*
  226. ** Misc Stuff
  227. */
  228.  
  229. extern unsigned wns_mtype();            /* make everyone happy */
  230.  
  231. #define WMR   wn->bsize                 /* shorthand */
  232.  
  233. typedef struct wcb                      /* Window control block */
  234. {
  235. int ulx,                                /* upper left corner x coordinate */
  236.     uly,                                /* upper left corner y coordinate */
  237.     xsize,                              /* width of window - INSIDE dimension */
  238.     ysize,                              /* height of window -INSIDE dimension */
  239.     ccx,                                /* virtual cursor offset in window */
  240.     ccy,                                
  241.     style,                              /* attribute to be used in window */
  242.     bstyle,                             /* border attribute */
  243.     bsize;                              /* total border size 0 or 2 only */
  244. char *scrnsave;                         /* pointer to screen save buffer */
  245. int page,                               /* current video page being used */
  246.     oldx,                               /* cursor position when window was */
  247.     oldy,                               /* opened (used for screen restore) */
  248.     wrpflg,                             /* wrap flag */
  249.     synflg;                             /* cursor sync flag */
  250. char *handle;                           /* my own id */
  251.     char *prevptr;                      /* linked list - previous */
  252.     char *nextptr;                      /* linked list - next */
  253.     char *tmpscr;                       /* for activate */
  254.     int  smeth;                         /* scroll method to use */
  255. } WINDOW, *WINDOWPTR;
  256.  
  257. extern WINDOWPTR wns_last;              /* last window opened */
  258.  
  259. #if M_I86                               /* allow for LINT_ARGS */
  260. #ifndef GENFNS
  261. #include "windows.fns"                  /* enforce type checking */
  262. #endif
  263. #else                                   /* and almost lint args */
  264. unsigned int wns_mtype();
  265. struct wcb *wn_open();
  266. struct wcb *wn_move();
  267. struct wcb *wn_save();
  268. char *wn_gets();
  269. unsigned int wns_mtype();
  270. #endif
  271.  
  272. #define BLACK   0x00                    /* foreground */
  273. #define RED     0x04                    /* background */
  274. #define GREEN   0x02                    /* colors */
  275. #define YELLOW  0x06                    /* bg << 4 | fg */
  276. #define BLUE    0x01
  277. #define MAGENTA 0x05
  278. #define CYAN    0x03
  279. #define WHITE   0x07
  280. #define BLINK   0x80
  281. #define BOLD    0x08
  282. #define NDISPB  0x00                    /* non display black */
  283. #define NDISPW  0x77                    /* non display white */
  284. #define RVIDEO  0x70                    /* reverse video */
  285. #define UNLINE  0x01                    /* under line (BLUE) */
  286.  
  287. #define NVIDEO  0x07                    /* normal video */
  288. #define NORMAL  0x03                    /* cyan is normal for me */
  289.  
  290. /*
  291. ** Display Mode Atributes
  292. */
  293.  
  294. #define B4025  0                        /* black & white 40 x 25 */
  295. #define C4025  1                        /* color 40 x 25 */
  296. #define B8025  2                        /* black & white 80 x 25 */
  297. #define C8025  3                        /* color 80 x 25 */
  298. #define C320   4                        /* color graphics 320 x 200 */
  299. #define B320   5                        /* black & white graphics */
  300. #define HIRES  6                        /* B&W hi res 640 * 200 */
  301. #define MONO   7                        /* monocrome 80 x 25 */
  302.  
  303. /*
  304. ** Macro to set attribute byte
  305. */
  306.  
  307. #define v_setatr(bg,fg,blink,bold) ((blink|(bg<<4))|(fg|bold))
  308.  
  309. /* End */
  310.