home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c003 / 1.ddi / WFC_DEFS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1987-04-01  |  10.7 KB  |  216 lines

  1. /* wfc_defs.h -- definitions for Windows for C
  2.  
  3.     ************* Copyright 1985 by Vermont Creative Software **************
  4.  
  5. DATE:      April 2, 1987
  6. VERSION:  v4.12
  7.  
  8. */
  9.  
  10. typedef int (*PFI)();            /*PFI - pointer to a function          */
  11.                     /*    returning an integer          */
  12.  
  13. /*----------------------------------------------------------------------------*/
  14. /*  If not already defined by wfc_comp.h, then define NULLP, NULLFP and NULL  */
  15. /*----------------------------------------------------------------------------*/
  16. #ifndef NULLP
  17. #define NULLP (char *) 0        /*NULL pointer to data              */
  18. #endif
  19.  
  20. #ifndef NULLFP
  21. #define NULLFP (int(*)()) 0        /*NULL pointer to function returning  */
  22. #endif
  23.  
  24. #define TAB '\t'                        /*C definition of ASCII tab number    */
  25. #define NEWLINE '\n'                    /*C definition of ASCII newline       */
  26. #define BACKSPACE '\b'                  /*C definition of ASCII backspace     */
  27.  
  28. #define VPSTMAXLEN 133            /*buffer size for use with v_printf() */
  29.  
  30. /*----------------------------------------------------------------------------*/
  31. /*  Definitions for use with mv_rws()                          */
  32. /*----------------------------------------------------------------------------*/
  33. #define UP   6                /*moves rows up (mv_rws)          */
  34. #define DOWN 7                /*moves rows down (mv_rws)          */
  35.  
  36. /*----------------------------------------------------------------------------*/
  37. /*  Definitions for mf_scrl()                            */
  38. /*----------------------------------------------------------------------------*/
  39. #define ALL_ROWS -1            /*scroll all rows in file          */
  40.  
  41. /*----------------------------------------------------------------------------*/
  42. /*  Definitions for mf_rwins()                              */
  43. /*----------------------------------------------------------------------------*/
  44. #define LAST_ROW -1            /*insert line at last row in file     */
  45.  
  46. /*----------------------------------------------------------------------------*/
  47. /*  Bit switch definitions for use with v_st(), v_st_rw(), v_plst(), etc.     */
  48. /*----------------------------------------------------------------------------*/
  49. #define NO_WRAP   0            /*No wrap, cs adv, clear in v_st_rw   */
  50. #define WRAP      1            /*Specifies word-wrap in v_st_rw, etc */
  51. #define NO_CLEAR  2            /*disable auto clear to end row       */
  52. #define NO_CS_ADV 4            /*disable cs advance on v_st_rw       */
  53. #define PL_CSR      8            /*enable auto place of csr at cs      */
  54.  
  55. /*----------------------------------------------------------------------------*/
  56. /*  Definitions for use with v_mov(), v_mova()                      */
  57. /*----------------------------------------------------------------------------*/
  58. #define CH    0            /*size definition for v_mov, etc      */
  59. #define ENDROW    1            /*size definition for v_mov, etc      */
  60. #define ROW    2            /*      ditto               */
  61. #define ENDWIND 3            /*      ditto               */
  62. #define WIND    4            /*      ditto               */
  63. #define ENDCOL    5            /*      ditto               */
  64. #define COL    6            /*      ditto               */
  65.  
  66. #define OUT 0                /*type definition for v_mov, etc      */
  67. #define IN  1                /*      ditto               */
  68.  
  69. /*----------------------------------------------------------------------------*/
  70. /*  The following definitions are for possible cursor shapes              */
  71. /*----------------------------------------------------------------------------*/
  72. #define LINE    0            /* a line at the bottom           */
  73. #define BLOCK    1            /* a full block               */
  74. #define BOT_BLK 2            /* a block in the bottom half of the  */
  75.                     /* character box              */
  76. #define TOP_BLK 3            /* a block in the top half of the     */
  77.                     /* character box              */
  78.  
  79. /*----------------------------------------------------------------------------*/
  80. /*  Definitions for border pointers                          */
  81. /*----------------------------------------------------------------------------*/
  82. #define BDR_0P     &bdr_0         /*No border                  */
  83. #define BDR_LNP  &bdr_ln        /*Single line border              */
  84. #define BDR_DLNP &bdr_dln        /*Double line border              */
  85. #define BDR_REVP &bdr_rev        /*Reverse border              */
  86. #define BDR_DOTP &bdr_dot        /*Dot border                  */
  87. #define BDR_STARP &bdr_star        /*Star border                  */
  88.  
  89. /*----------------------------------------------------------------------------*/
  90. /*  Different move types for internal low-level move function              */
  91. /*----------------------------------------------------------------------------*/
  92. #define VM_MOVE 0            /*video to user-memory type of move   */
  93. #define MV_MOVE 1            /*user-memory to video type of move   */
  94. #define VV_MOVE 2            /*video to video type move          */
  95. #define MM_MOVE 3            /*user-memory to user-memory type move*/
  96.  
  97. /*----------------------------------------------------------------------------*/
  98. /*  Definitions for use with dim_wn()                          */
  99. /*----------------------------------------------------------------------------*/
  100. #define INSIDE 1            /* def for wn.setsw, copy_wn, dim_wn  */
  101. #define FULL 0                /*      ditto               */
  102.  
  103. /*----------------------------------------------------------------------------*/
  104. /*  Definitions for use with ki_buf()                          */
  105. /*----------------------------------------------------------------------------*/
  106. #define SAVE 1                /*push key read back on input buffer  */
  107. #define TOSS 0                /*don't push key back                 */
  108.  
  109. /*----------------------------------------------------------------------------*/
  110. /*  Definitions for use with copy_wc()                          */
  111. /*----------------------------------------------------------------------------*/
  112. #define FREAD "r"                       /*fopen() mode for read open          */
  113. #define FWRITE "w"                      /*fopen() mode for write open         */
  114. #define FAPPEND "a"                     /*fopen() mode for append open        */
  115.  
  116. /*----------------------------------------------------------------------------*/
  117. /*  Definitions for use with boolean parameters                   */
  118. /*----------------------------------------------------------------------------*/
  119. #define YES 1                /*for use with boolean parameters     */
  120. #define NO 0                /*        ditto              */
  121. #define ON 1                /*        ditto              */
  122. #define OFF 0                /*        ditto              */
  123. #define TRUE 1                /*        ditto              */
  124. #define FALSE 0             /*        ditto              */
  125.  
  126. /*----------------------------------------------------------------------------*/
  127. /*  Centers a window on the screen - for use with defs_wn()              */
  128. /*----------------------------------------------------------------------------*/
  129. #define CENTER_WN -1            /*centers the window on the screen    */
  130.  
  131. /*----------------------------------------------------------------------------*/
  132. /*  Definitions for use with v_plst()                          */
  133. /*----------------------------------------------------------------------------*/
  134. #define LEFT_TEXT   0            /*left justfies text in window          */
  135. #define CENTER_TEXT -1            /*centers text in window          */
  136. #define RIGHT_TEXT  -2            /*right justifies text in window      */
  137.  
  138. /*----------------------------------------------------------------------------*/
  139. /*  Definitions for use in specifying position of window name in border       */
  140. /*----------------------------------------------------------------------------*/
  141. #define TOPLEFT 1
  142. #define TOPCENTER 2
  143. #define TOPRIGHT 3
  144. #define BOTTOMLEFT 4
  145. #define BOTTOMCENTER 5
  146. #define BOTTOMRIGHT 6
  147.  
  148. /*----------------------------------------------------------------------------*/
  149. /*  Macro definitions                                  */
  150. /*----------------------------------------------------------------------------*/
  151. #ifndef min
  152. #define min(a,b) ((a) <=(b) ? (a): (b))      /*minimum value function          */
  153. #endif
  154. #ifndef max
  155. #define max(a,b) ((a) >=(b) ? (a): (b))      /*maximum value function          */
  156. #endif
  157.  
  158. #define col_qty(wnp) ((wnp)->ce - (wnp)->cb + 1)  /*number of col in window   */
  159. #define row_qty(wnp) ((wnp)->re - (wnp)->rb + 1)  /*number of rows in window  */
  160.  
  161. #define hi_byte(a)  (((a) >> 8) & 0x00ff)      /*returns high byte of word    */
  162. #define lo_byte(a)  ((a) & 0x00ff)           /*returns low byte of word     */
  163.  
  164. #define c_att(fground,bground)    ((bground << 4) + fground)
  165.  
  166. #define isset_wn(wnp)           ((wnp)->setsw)
  167. #define smf_filespec(p, mfp)       ((mfp)->fn = p)
  168. #define wnerrmsg(a)           (_wnemsg[(a)])
  169.  
  170. /*----------------------------------------------------------------------------*/
  171. /*  Macros for setting environment variables                      */
  172. /*----------------------------------------------------------------------------*/
  173. #define se_errorfp(p)           (_errfp = (p))
  174. #define se_keyloop(p)           (_wfckifp = (p))
  175. #define se_mfmsg(a)           (tbf_msg = (a))
  176. #define se_mncharselect(a)       (_mnuchar = (a))
  177.  
  178. /*----------------------------------------------------------------------------*/
  179. /* Macros for setting members of the WINDOW structure                  */
  180. /*----------------------------------------------------------------------------*/
  181. #define sw_att(attrib, wnp)       ((wnp)->att = (attrib))
  182. #define sw_bdratt(att, wnp)       ((wnp)->bdratt = (att))
  183. #define sw_border(borderp, wnp)    ((wnp)->bdrp = (borderp))
  184. #define sw_cleor(a, wnp)       ((wnp)->wrap = ((a) == ON ? (wnp)->wrap\
  185. &~NO_CLEAR : (wnp)->wrap | NO_CLEAR))
  186. #define sw_csadv(a, wnp)       ((wnp)->wrap = ((a) == ON ? (wnp)->wrap\
  187. & ~NO_CS_ADV : (wnp)->wrap | NO_CS_ADV))
  188. #define sw_latt(a, wnp)        ((wnp)->larray = (a))
  189. #define sw_margin(l, r, wnp)       ((wnp)->l_mg = (l), (wnp)->r_mg = (r))
  190. #define sw_mf(a, wnp)           ((wnp)->frp = (a))
  191. #define sw_name(name, wnp)       ((wnp)->wname = (name))
  192. #define sw_namelocation(loc, wnp)  ((wnp)->wnameloc = (loc))
  193. #define sw_plcsr(a, wnp)       ((wnp)->wrap = ((a) == ON ? (wnp)->wrap\
  194. | PL_CSR : (wnp)->wrap & ~PL_CSR))
  195. #define sw_popup(a, wnp)       ((wnp)->popup = (a))
  196. #define sw_scroll(a, wnp)       ((wnp)->scr_q = (a))
  197. #define sw_wwrap(a, wnp)       ((wnp)->wrap = ((a) == ON ? (wnp)->wrap\
  198. | WRAP : (wnp)->wrap & ~WRAP))
  199.  
  200. /*----------------------------------------------------------------------------*/
  201. /*  String images of maximum signed integer and signed long integer          */
  202. /*----------------------------------------------------------------------------*/
  203. #define MAXLONGSTR "2147483647"         /* (2**31) - 1                        */
  204. #define MAXINTSTR  "32767"              /* (2**16) - 1                        */
  205. #define MAXEXP       307            /*  Maximum floating point exponent   */
  206.  
  207. /*----------------------------------------------------------------------------*/
  208. /*  used for error handling with trace back buffer                  */
  209. /*----------------------------------------------------------------------------*/
  210. #define TRACE_BUF 256            /* size of trace back buffer          */
  211. #define WNLOGSIZE 20            /* size of call log              */
  212. #define INIT_MACRO(p) if(_wndebug == ON) (*_finitfp)(p)
  213. #define EXIT_MACRO(p)  if(_wndebug == ON) (*_fexitfp)(p); if(_errfp != NULLFP && _wn_err != 0) (*_errfp)(p)
  214. #define INIT_MODULE(p) _modinit(p)
  215. #define EXIT_MODULE(p) _modexit(p)
  216.