home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / BEEHIVE / UTILITYS / CHX8012B.ARC / CHECKS.H < prev    next >
Text File  |  1990-07-21  |  9KB  |  191 lines

  1. /*  checks.h -- header file for check register program                       */
  2.  
  3. /*  copyright (c) 1986 by Jim Woolley and WoolleyWare, San Jose, CA          */
  4.  
  5. /*  vers. 1.0, 12/85 thru 5/86
  6.  *
  7.  *  vers. 1.2, 7/86
  8.  *  revised ROWS to avoid writing last column of last row w/ auto scrolling
  9.  *  reduced PAGE
  10.  *  added _Keymap, _Leadin, _Funkey, _Newkey, and _Savech
  11.  *  integrated CLEARS using #ifdef
  12.  */
  13.  
  14. #include    "a:bdscio.h"
  15.  
  16. #ifdef  CLEARS
  17.  
  18. #define     BBF             "SUMMARY BROUGHT FORWARD"
  19. #define     USECHEX         "Use CHECKS program to "
  20. #define     ENTRYSIZE       384              /*  max entries (see Entry)     */
  21. #define     MAXFIELD        2                /*  number of displayed fields  */
  22. #define     CLRFIELD        ( MAXFIELD - 1)  /*  Entry->clear field          */
  23. #define     CATFIELD        ( MAXFIELD - 2)  /*  Entry->category field       */
  24.  
  25. #else   /*  not CLEARS  */
  26.  
  27. #define     BBF             "BALANCE BROUGHT FORWARD"
  28. #define     ENTRYSIZE       128              /*  max entries (see Entry)     */
  29. #define     MAXFIELD        8                /*  number of displayed fields  */
  30. #define     CLRFIELD        ( MAXFIELD - 1)  /*  Entry->clear field          */
  31. #define     DEPFIELD        ( MAXFIELD - 2)  /*  Entry->deposit field        */
  32. #define     AMTFIELD        ( MAXFIELD - 3)  /*  Entry->amount field         */
  33. #define     CATFIELD        ( MAXFIELD - 4)  /*  Entry->category field       */
  34. #define     PAYFIELD        ( MAXFIELD - 5)  /*  Entry->payee field          */
  35. #define     YYFIELD         ( MAXFIELD - 6)  /*  Entry->year field           */
  36. #define     DDFIELD         ( MAXFIELD - 7)  /*  Entry->date field           */
  37. #define     MMFIELD         ( MAXFIELD - 8)  /*  Entry->month field          */
  38.  
  39. #endif
  40.  
  41. #define     PAYEEFILL       '_'         /*  used to fill Payee               */
  42. #define     DEPCLRFIL       "    "      /*  used to fill DEP and CLR         */
  43. #define     DEFCAT          ' '         /*  default category code            */
  44. #define     CLRCOM          "     "     /*  clear command display            */
  45.  
  46. #define     PAYEESIZE       43          /*  max chars in Entry->payee        */
  47. #define     HASHSIZE        64          /*  size of abrev. hash table        */
  48. #define     FNAMSIZE        15          /*  max chars in Filename            */
  49. #define     CLRSIZE         384         /*  max records in CLR file          */
  50. #define     COLS            80          /*  number of screen columns         */
  51. #define     ROWS            23          /*  number of screen rows minus 1 to */
  52.                                         /*  avoid writing last row and col   */
  53. #define     HEAD            6           /*  number of heading rows           */
  54. #define     LAST            ( ROWS - HEAD - 1)
  55. #define     PAGE            ( ROWS - HEAD - 4)
  56. #define     BALCOL          ( COLS - 9) /*  where Balance display starts     */
  57. #define     AMTCOL          54          /*  where amount display starts      */
  58. #define     DLOOP           250         /*  loops for 100 msec on 4 MHz Z80  */
  59. #define     MAXDOLLAR       999         /*  max dollar entry (see edamount)  */
  60.  
  61. #define     CTRLA           0x01        /*  ASCII definitions                */
  62. #define     CTRLB           0x02
  63. #define     CTRLC           0x03
  64. #define     CTRLD           0x04
  65. #define     CTRLE           0x05
  66. #define     CTRLF           0x06
  67. #define     CTRLG           0x07
  68. #define     BEL             0x07
  69. #define     CTRLH           0x08
  70. #define     BS              0x08
  71. #define     CTRLI           0x09
  72. #define     HT              0x09
  73. #define     CTRLJ           0x0a
  74. #define     LF              0x0a
  75. #define     CTRLK           0x0b
  76. #define     CTRLL           0x0c
  77. #define     FF              0x0c
  78. #define     CTRLM           0x0d
  79. #define     CR              0x0d
  80. #define     CTRLN           0x0e
  81. #define     CTRLO           0x0f
  82. #define     CTRLP           0x10
  83. #define     CTRLQ           0x11
  84. #define     CTRLR           0x12
  85. #define     CTRLS           0x13
  86. #define     CTRLT           0x14
  87. #define     CTRLU           0x15
  88. #define     CTRLV           0x16
  89. #define     CTRLW           0x17
  90. #define     CTRLX           0x18
  91. #define     CTRLY           0x19
  92. #define     CTRLZ           0x1a
  93. #define     CTRL_           0x1f
  94. #define     ESC             0x1b
  95. #define     DEL             0x7f
  96. #define     CTRLTOA         0x40        /*  offset CTRL to upper case alpha  */
  97.  
  98. #define     DEFNAM          "CHECKS."   /*  default filename                 */
  99. #define     SCRTYP          "SCR"       /*  screen controls/messages         */
  100. #define     DATTYP          "DAT"       /*  Entry data                       */
  101. #define     BAKTYP          "BAK"       /*  Entry data backup                */
  102. #define     CLRTYP          "CLR"       /*  cleared entries                  */
  103. #define     TMPTYP          "$$$"       /*  temporary file                   */
  104. #define     INFTYP          "INF"       /*  TITLE, ABREV, and AUTOM info     */
  105.  
  106. #define     NO              FALSE
  107. #define     YES             TRUE
  108.  
  109. #define     isprint( c)     !iscntrl( c)
  110. #define     FOREVER         for ( ; ; )                /*  loop forever      */
  111.  
  112. /*  define additional global variables and data structures                   */
  113.  
  114. struct calendar                         /*  month, day, year                 */
  115.     {
  116.     char mm, dd, yy;
  117.     } Today;
  118.  
  119. struct money                            /*  example:  $1234.56               */
  120.     {                                   /*      dollar = 12, cent = 3456     */
  121.     int dollar;                         /*  $/100 (range of signed int)      */
  122.     int cent;                           /*  $%100 + cents (-9999 to +9999)   */
  123.     } Memory, Balance[ ENTRYSIZE];
  124.  
  125. struct record                           /*  one entry                        */
  126.     {
  127.     struct calendar date;
  128.     char payee[ PAYEESIZE], category;
  129.     struct money amount;
  130.     char deposit, clear;
  131.     } Entry[ ENTRYSIZE], Entryundo;
  132.  
  133. #define     RECSIZ          ( sizeof( Entry[ 0]))
  134.  
  135. char *alloc(), *index(), *skipspace(), *strsave(), witch(), help();
  136. char putcommand(), putcntrl(), putnext(), doscroll();
  137. char eddate(), edamount(), eddeposit(), edclear(), edcategory(), edpayee();
  138.  
  139. #ifdef  CLEARS
  140.  
  141. char Modified, Ctrlyundo, Printing, Inserton, *Usechex;
  142. char Filename[ FNAMSIZE], Ftoc[ MAXFIELD];
  143. char Title[ COLS - FNAMSIZE - 2];       /*  (COLS-1) - (5+2+FNAMSIZE-5) + 1  */
  144.  
  145. int First, Last, Maxentry, Recno, Field, Oldfield, Speed;
  146. int Dloop;
  147.  
  148. #else   /*  not CLEARS  */
  149.  
  150. char Modified, Ctrlyundo, Printing, Inserton;
  151. char Filename[ FNAMSIZE], Savpayee[ PAYEESIZE], Ftoc[ MAXFIELD];
  152. char Title[ COLS - FNAMSIZE - 2];       /*  (COLS-1) - (5+2+FNAMSIZE-5) + 1  */
  153.  
  154. int First, Last, Maxentry, Recno, Field, Oldfield, Character, Speed, Savrecno;
  155. int Dloop;
  156.  
  157. struct nlist                            /*  ref. K & R, p. 135               */
  158.     {
  159.     char *abrev, *fullname;
  160.     struct nlist *next;
  161.     } *Hashtab[ HASHSIZE], *install(), *lookup();
  162.  
  163. #endif
  164.  
  165. /*  the following global variables mimic WordStar cursor/screen controls     */
  166.  
  167. char Clead1[ 9], Clead2[ 5], Ctrail[ 5], Cb4flg, Linoff, Coloff, Ascur;
  168. char Eraeol[ 7], Lindel[ 7], Linins[ 7], Ivon[ 7], Ivoff[ 7], Trmini[ 9];
  169.  
  170. /*  The functions getchar(), ungetch( c), putchar( c), and kbhit() are defined
  171.  *  in checkx.c to provide char I/O without BDOS interaction; therefore, ^C, ^S,
  172.  *  ^Q, and ^P will have no effect during console I/O.  For putchar( c), the
  173.  *  global variable _Outdev MUST be initialized to CONOUT for screen output;
  174.  *  _Outdev may be temporarily set to LSTOUT for printer output, then reset to
  175.  *  CONOUT.  For getchar() and ungetch( c), the global variable _Lastch MUST be
  176.  *  initialized to 0.  Note that getc( 0) may NOT be equivalent to getchar()
  177.  *  and putc( c, 1) may NOT be equivalent to putchar( c); however, each may be
  178.  *  expected to function normally (using BDOS).  The object file checkx.crl MUST
  179.  *  be linked with the Check Register Program.
  180.  */
  181.  
  182. #define     CONOUT          4           /*  BIOS console output              */
  183. #define     LSTOUT          5           /*  BIOS list output                 */
  184. char        _Outdev;                    /*  global variable for putchar( c)  */
  185. char        _Lastch;                    /*  global for getchar()/ungetch()   */
  186. char        _Keymap[ 32];               /*  CTRL key translation table       */
  187. char        _Leadin;                    /*  function key lead character      */
  188. char        _Funkey[ 10][ 2];           /*  function key table               */
  189. char        _Newkey[ 10][ 2];           /*  result of function key           */
  190. char        _Savech[ 2];                /*  stack of previous characters     */
  191.