home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / cwt2.zip / C_WNDW.H < prev    next >
Text File  |  1989-09-06  |  12KB  |  327 lines

  1. /* header file for windowing system
  2. *
  3. *    Copr. (c) Marietta Systems, Inc.  1987,1988,1989
  4. *    All rights reserved
  5. *    Version 1.2x
  6. *
  7. *    This header file declares the functions for the windowing system
  8. *   Globals for the windowing system.
  9. *
  10. */
  11.  
  12. /*
  13. * * * * * * * * *
  14. *     Figure out which compiler is being used
  15. *
  16. */
  17. #ifdef _CDECL
  18. #define QUICKC
  19. #endif
  20. #ifdef _Cdecl
  21. #define TURBOC
  22. #endif
  23. #ifndef LATTICE
  24. typedef unsigned char byte;
  25. #define _STACK _stklen
  26. #endif
  27.  
  28. /*
  29. */
  30. enum fld_type {alphanum, graphic, flag, boolean, calendar, numeric, value,
  31.     real, chrono};
  32. enum COLOR_OF {Mblack,Mblue,Mgreen,Mcyan,Mred,Mmagenta,Myellow,Mwhite};
  33. enum _JUST {left, right, as_typed, center, code, decimal, db_number,
  34.      c_number, date, _time};
  35. enum ATTRIB {low,high,reverse,blink,blank,alt_low,alt_high,alt_reverse}
  36.     OLD_BRIG = low;
  37. enum F_READ {firstrec, previous, nextrec, lastrec, random, relative};
  38. enum F_MODE {append, readonly, recreate, update};
  39. enum F_TYPE {ascii, binary, dbase3, hashed, marietta};
  40. struct CURSR {int X,Y;} _CURSOR; /* Current cursor position in window */
  41.  
  42. struct WINDW {  /* window tracking struct */
  43.     void *sobj;  /* pointer to list of screen objects */
  44.     byte *SCREEN, *FUNCTION;
  45.     struct CURSR LOCN;
  46.     int X, Y;   /* location of top left corner of window */
  47.     int H, W;   /* height and width of window, including borders */
  48.     int P;
  49.     int CODE, K, Z, sequ, tx, ty;
  50.     } *WINDOW;
  51.  
  52. struct CLR_TYPE {
  53.     enum COLOR_OF FORE, BACK;
  54.     int ALT_CLR;
  55.     };
  56.  
  57. struct F_DEF { /* file definition control struct */
  58.     long prime;        /* size of file in records */
  59.     long location;
  60.     long r_count;      /* active (IN_USE) record count (set by program) */
  61.     byte *record;      /* pointer to start of record */
  62.     void *fnext;       /* pointer to data dictionary */
  63.     void *fptr[5];
  64.     enum F_TYPE ftype; /* type of file */
  65.     int key_len, offset; /* key info for hashed files */
  66.     int start;         /* size of header area at start of file */
  67.     unsigned rec_len;  /* record length */
  68.     unsigned fbloc;
  69.     int keycode;
  70.     int ismemo;        /* set 1 if .DBF file with associated memo file */
  71.     int write;
  72.     int ndx;
  73.     int realfile;      /* contains the real file handle of the file */
  74.     unsigned bufsize;
  75.     char fvol;         /* disk/volume code */
  76.     char fpath[61];    /* directory path */
  77.     char fname[13];    /* file name with extension */
  78.     } *FN;
  79.  
  80. struct DBF_DEF { /* dBase III Plus data dictionary struct */
  81.     void *dnext;
  82.     enum _JUST just;   /* justification code of field (modifyable) */
  83.     int dbf_len;       /* dBASE field length */
  84.     int dbf_dec;       /* decimals for an N type field */
  85.     int dbf_set;       /* Active field (set by program) */
  86.     int dbf_dig;       /* justify() and accept() 'len' parameter */
  87.     unsigned posn;     /* position of start of field in record */
  88.     unsigned ndxfield;
  89.     byte dbf_name[11]; /* field name in ASCIIZ format */
  90.     byte dbf_type;     /* Type (C, D, L, M, N) */
  91.     };
  92.  
  93. /*
  94. * * * * * * * * * * * *
  95. *   Initiation of globals for the windowing system.
  96. *
  97. */
  98. long _SIZMEM;
  99. unsigned SCRN_PTR, CLR_PTR = 0X0000, _DSEG, _DOFF, CLR_SEG = 0XB800,
  100.     MONO_SEG = 0XB000;
  101. unsigned short SCR_SIZE, OLD_CODE, _brkflag;
  102. unsigned INCHAR, INCHAR_F;
  103. int INS_FLAG = 1, W_NUM = 0, CLR_INIT = 0;
  104. int COLOR_SC, EGA_SCRN, CLR_CODE;
  105. byte *MEM_LINE;
  106. char *xgoodbye;
  107.  
  108. struct CLR_TYPE COLOR [7] = {    /* number of elements must match
  109.                                  * "_COLORS" configuration constant */
  110.         {Mgreen, Mblack, 6},    /* base window color, #0 */
  111.         {Mwhite, Mblue, 3},        /* color #1 */
  112.         {Mcyan, Mblack, 4},        /* color #2 */
  113.         {Mcyan, Mred, 5},        /* color #3 */
  114.         {Mwhite, Mmagenta, 2},  /* color #4 */
  115.         {Myellow, Mblack, 1},   /* color #5 */
  116.         {Mwhite, Mred, 0},        /* color #6 */
  117.                 };
  118. struct CLR_TYPE    TOP_CLR = {Myellow,Mblue,6}; /* top line color */
  119. struct CLR_TYPE    ER_COLOR = {Mgreen,Mred,6};  /* bottom line color */
  120.  
  121. unsigned KEYMATCH[8] /* the key match array which determines which
  122.                       * function keys are treated as 'end-of-field'
  123.                       * keys by the 'isendch' function */
  124.     = {0X0, 0X0, 0X0, 0X0, 0X0, 0X0, 0X0, 0X0};
  125.  
  126. byte *KEY_DISPLAY[7] = {"Srch", "Move", "Ins", "Del", "Zoom","Amnd", "AKey"};
  127.     /* meanings for function keys F3 through F9 displayed on bottom line */
  128.  
  129. byte *BANNER_MSG = /* Modifyable initial window display on software loading */
  130. " The \"c_wndw\" (tm) and \"c_ndx\" (tm) toolkits \n\
  131.  are the copyright of Marietta Systems, Inc. \n\
  132.  1987, 1988, 1989.  All rights reserved. \n\
  133.   Release Version 2.01 - 8/30/89 ";
  134.  
  135. /*
  136. * * * * * * * * * * * * *
  137. *    Configuration constants
  138. *
  139. *    Change their initial value to suit your set-up
  140. *        - but be careful!!
  141. *
  142. */
  143. int CLR_TONE = 25;   /* controls display of copywrite box by 'clr_scrn()' */
  144. int A_TRACK = -1;    /* used by 'accept()' function */
  145. int SAVEWAIT = 900; /* clock ticks before 'scrnsave(0)' flushes file buffers */
  146. enum ATTRIB ACC_DISP = reverse; /* Attribute of accept() fields after entry */
  147. int ERR_BEEP = 2;    /* For beep length with 'shortbeep()', 0 = tiny beep */
  148. int UP_NAME = 0;    /* 1 if names are to be in uppercase only */
  149. int FLD_FULL = 1;   /* 1 for auto ENTER on full field; 0 = ENTER required */
  150. int TAB_SET = 4;    /* size of tab increments on screen for '\t' code */
  151. int _WINDW = 10;    /* maximum number of windows */
  152. int _COLORS = 7;    /* maximum number of different color selections */
  153. int SCRN_LEN = 25;  /* screen length in lines */
  154. int SCRN_WID = 80;  /* screen width in columns */
  155. int TOP_LINE = 1;   /* lines dedicated to the "top-frame" at top of screen */
  156. int BOT_LINE = 1;   /* True if active keys to be displayed on bottom line */
  157. int MENULINE = 1;    /* True to display assist line for menus */
  158. int ERRORMSG = 1;   /* True to display non-critical errors with sys_wndw() */
  159. int GOODBYEMSG = 1; /* True to display end of program message */
  160. int MAXFILES = 9;   /* maximum number of files to create file buffers */
  161. int D_FORMAT = 'U'; /* U for USA format, E for european, I for intl */
  162. int D_PUNCT = '/';    /* punctuation character for date formats */
  163. int D_20XX = 10;    /* split between 20xx and 19xx in years */
  164. int PERIOD = '.';    /* decimal point character */
  165. int COMMA = ',';    /* thousands seperator */
  166. int BOOL_YES = 'Y'; /* The TRUE or YES boolean entry code */
  167. int BOOL_NO = 'N';  /* The FALSE or NO boolean entry code */
  168. int CLOCK24 = 0;    /* 0 for am/pm, or 1 for 24 hour european/military time */
  169. int QTRHOUR = 0;    /*  */
  170. int T_PUNCT = ':';  /* time punctuation character, default colon */
  171. unsigned DISCBLCK = 4100; /* maximum record size of any file to be opened,
  172.            * Minimum size is 512, but recommended minimum is 2060.
  173.            * if actual record size is less than one third of this size,
  174.            * the file access software will perform disk caching
  175.            * Maximum size is 65000 */
  176. short MEM_WARN = 1024; /* Warning will be issued when unused heap memory is
  177.                         * under this.  Maximum is 9999, minimum is 0 */
  178. long MAX_WIND = 15000L; /* maximum amount of heap space for windowing
  179.           * functions. The maximum size is 65000, and the minimum size
  180.           * of MAX_WIND should be 8500. To calculate, use the formula:-
  181.           * ((number of windows * average size * 2) + 2500)
  182.           * where 'average size' is (height * width)   */
  183. long _MNEED = 20000L; /* minimum heap space needed, which must be
  184.           * at least MAX_WIND + 5000. */
  185. unsigned _STACK = 10000; /* size of stack, (at least 7000) */
  186.  
  187. /*
  188. * * * * * * * * * * *
  189. *     This section contains the #define codes
  190. *
  191. */
  192. #define CTL_A     1 /* all the other CTL combinations can be defined here */
  193. #define PGDN      3
  194. #define CRS_RT    4 /* Right cursor */
  195. #define CRS_UP    5 /* Up cursor */
  196. #define DEL       7
  197. #define B_SPACE   8
  198. #define TAB       9
  199. #define CTL_ENT  10
  200. #define SFT_TAB  11
  201. #define ENTER    13
  202. #define PGUP     18
  203. #define CRS_LT   19 /* Left cursor */
  204. #define CTL_BSPC 20 /* Ctrl + backspace */
  205. #define INS      22
  206. #define HOME     23
  207. #define CRS_DN   24 /* Down cursor */
  208. #define END      26
  209. #define CTL_Z    26 /* 0X1A */
  210. #define ESC      27
  211. #define ALT_Q   129 /* The other ALT alpha keys can be defined here */
  212. #define ALT_P   138 /* Print translated screen */
  213. #define QUIT_NOW 158 /* Alt+X used for fast terminate of program */
  214. #define ALT_V   160 /* display version information */
  215. #define ALT_M   163
  216. #define HELP    168 /* F1 Key  */
  217. #define UNDO    169 /* F2 Key  */
  218. #define SEARCH  170 /* F3 Key  */
  219. #define MOVE    171 /* F4 Key  */
  220. #define INSERT  172 /* F5 Key  */
  221. #define DELETE  173 /* F6 Key  */
  222. #define ZOOM    174 /* F7 Key  */
  223. #define AMEND   175 /* F8 Key  */
  224. #define KEY_CH  176 /* F9 Key  */
  225. #define QUIT    177 /* F10 Key */
  226. /* 174 thru 218 reserved for standard graphics characters */
  227. #define SFT_F1  220 /* The other SHIFT+Fnn keys can be defined here */
  228. #define SFT_F10 229
  229. #define CTL_LT  248 /* Ctrl + left cursor */
  230. #define CTL_RT  249 /* Ctrl + right cursor */
  231. #define CTL_END 250
  232. #define CTL_PGDN 251
  233. #define CTL_HOME 252
  234. #define CTL_PGUP 254
  235. /*         */
  236. #define DELETED 0X2A /* '*' code has dBase 3+ compatibility */
  237. #define IN_USE  0X20 /* ' ' code has dBase 3+ compatibility */
  238. #define EMPTY   0X26 /* '&' code, for hashed files */
  239. #define SYS_REC 0X03 /* code has dBase 3+ compatibility */
  240. /*        */
  241. #define MFALSE  128
  242. #define MTRUE   129
  243.  
  244. /*
  245. * * * * * * * * * * * * * * * * *
  246. *    The prototypes of functions used by "c_wndw" (tm) software
  247. *
  248. */
  249.  int   accept (byte*,enum _JUST,enum ATTRIB,int,int);
  250.  int   acptbig (byte*, enum _JUST, enum ATTRIB, unsigned, unsigned);
  251.  int   acptchar (char*, enum _JUST, enum ATTRIB, unsigned);
  252.  int   acptdbl (double*, enum _JUST, enum ATTRIB, unsigned, unsigned);
  253.  int   acptint  (int*, enum _JUST, enum ATTRIB, unsigned);
  254.  int   acptlong (long*, enum _JUST, enum ATTRIB, unsigned);
  255.  int   acptmask (byte*, byte*, enum ATTRIB);
  256.  int   acptmenu (byte*, byte*, enum ATTRIB, unsigned);
  257.  void  clr_keys (void);
  258.  void  clr_scrn (char*);
  259.  void  clr_wndw (void);
  260.  byte* concat (byte*, int);
  261.  int   datecomp (char*, char*);
  262.  long  datelong (char*);
  263.  void  datemath (char*, int);
  264.  void  dateread (char*);
  265.  void  date_in (char*, char*);
  266.  void  date_out (char*, char*);
  267.  void  display (byte*, int, int, enum ATTRIB);
  268.  int   dispchar (char, int, int, enum ATTRIB, enum _JUST, unsigned);
  269.  int   dispdbl (double, int, int, enum ATTRIB, enum _JUST, unsigned, unsigned);
  270.  int   dispint (int, int, int, enum ATTRIB, enum _JUST, unsigned);
  271.  int   displong (long, int, int, enum ATTRIB, enum _JUST, unsigned);
  272.  void  dispkeys (void);
  273.  int   dispmask (byte*, int, int, enum ATTRIB, byte*);
  274.  int   dispwndw (unsigned, byte*, unsigned, unsigned, enum ATTRIB);
  275. #define disp_err(s,i)  err_wndw(s, i, 0)
  276. #define disp_msg(s,i)  err_wndw(s, i, 0)
  277. #define disp_qry(s)    qry_wndw(s)
  278.  int   err_wndw (byte*, int, int);
  279.  int   fileback (char*);
  280. #define fileclose fileclos
  281.  int   fileclos (int);
  282.  int   fileinit (int, unsigned, unsigned, long);
  283.  int   fileopen (char*, enum F_TYPE, enum F_MODE);
  284.  int   fileread (int, enum F_READ, long*);
  285.  long  filerecno (int);
  286.  int   fileseek (int, long);
  287. #define filewrite filewrit
  288.  int   filewrit (int, long*);
  289.  int   file_err (int, int);
  290.  int   fld_len (enum _JUST, unsigned, unsigned);
  291.  int   flt_wndw (unsigned, unsigned, byte*);
  292.  void  goodbye (short);
  293.  int   grabchar (void);
  294.  void  helpmenu (int);
  295.  int   helpscrn (byte*);
  296.  void  idleloop (int);
  297.  int   isendch (byte*, int, enum ATTRIB);
  298.  byte* justify (enum _JUST, byte*, byte*, unsigned, unsigned);
  299.  int   lastline (byte*, unsigned, enum ATTRIB);
  300.  int   maskfield (byte*, byte*, byte*);
  301.  int   maskvalid (byte*, byte*);
  302.  int   menu (char*, int, int, int);
  303.  int   mk_wndw (int, int, int, int, byte*);
  304.  long  primenbr (long);
  305.  void  prn_scrn (void);
  306.  int   qry_wndw (byte*);
  307.  void  read_kb (void);
  308.  int   rm_wndw (void);
  309.  void  scrnsave (int);
  310.  void  scrnline (byte*, unsigned, int);
  311.  void  scrn_map (byte*, int, int);
  312.  void  scroll (int, int);
  313.  void  set_clr (int, enum ATTRIB);
  314.  void  set_crsr (int, int);
  315.  void  set_keys (unsigned, unsigned, ...);
  316.  int   set_wndw (unsigned, enum _JUST, enum ATTRIB, unsigned);
  317.  void  shortbeep (int);
  318.  int   sys_wndw (byte*, int, int);
  319.  int   top_menu (char*, int, int);
  320.  void  top_spot (int);
  321.  void  unset_keys (unsigned, unsigned, ...);
  322.  int   validate (byte*, enum _JUST, unsigned, unsigned);
  323.  int   v_bool (int);
  324.  void  warble (int);
  325.  
  326. /*     end of header file */
  327.