home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / HDR / FIELD.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-28  |  5.7 KB  |  144 lines

  1. /* ==( memo/field.h )== */
  2.  
  3. /* ----------------------------------------------- */
  4. /* Pro-C  Copyright (C) 1989 - 1990 Vestronix Inc. */
  5. /* Modification to this source is not supported    */
  6. /* by Vestronix Inc.                               */
  7. /*            All Rights Reserved                  */
  8. /* ----------------------------------------------- */
  9. /* Written   JPK   1-May-89                        */
  10. /* Modified  Geo  12-Dec-89  See comments below    */
  11. /* ----------------------------------------------- */
  12. /* %W%  (%H% %T%) */
  13.  
  14. /*
  15.  *  Modifications
  16.  *
  17.  *  12-Dec-89  Geo - V2 version
  18.  *
  19. */
  20.  
  21. /* mask characters used for field input */
  22. # define MASK_I           'I'    /* anything goes, international stuff */
  23. # define MASK_C        'C'    /* alphabetic, convert to lower case */
  24. # define MASK_c        'c'    /* alphanumeric, convert to lower case */
  25. # define MASK_P        'P'    /* alphanumeric & space, convert to upper case */
  26. # define MASK_Q        'Q'    /* alphanumeric & space, convert to lower case */
  27. # define MASK_p          'p'        /* alphanumeric & space */
  28. # define MASK_x        'x'    /* any character */
  29. # define MASK_X        'X'    /* any character, convert to upper case */
  30. # define MASK_Y        'V'    /* any character, convert to lower case */
  31. # define MASK_a        'a'    /* alphabetic character */
  32. # define MASK_A        'A'    /* alphabetic character, convert to upper case */
  33. # define MASK_B        'B'    /* alphabetic character, convert to lower case */
  34. # define MASK_8        '8'    /* numeric, l to r, floating decimal */
  35. # define MASK_MONEY    '$'    /* numeric, l to r, fill dollar sign */
  36. # define MASK_9        '9'    /* numeric input, left to right, fill zeros */
  37. # define MASK_Z        'Z'    /* numeric input, left to right */
  38. # define MASK_z        'z'    /* numeric input, left to right */
  39. # define MASK_AT       '@'    /* set NUMLOCK on for this numeric field */
  40. # define MASK_PSWD     '!'    /* password input, input is echoed with '*' */
  41. # define MASK_SPECIAL  '^'    /* delimits special characters */
  42.  
  43. /* mask characters used specically for date field input */
  44. # define MASK_YEAR        'Y'
  45. # define MASK_MONTH       'M'
  46. # define MASK_DAY         'D'
  47. # define MASK_HOUR        'H'
  48. # define MASK_MINUTE      'N'
  49. # define MASK_SECOND      'S'
  50. # define MASK_WEEKDAY     'W'
  51. # define MASK_DAY_SUFFIX  'T'
  52.  
  53. /* character to display in place of password text */
  54. # define PASSWORD_CHAR '*'
  55.  
  56. /* field types */
  57. # define F_NULL           (short *)0
  58. # define F_TEXT        0
  59. # define F_NUMERIC     1
  60. # define F_CALCULATOR  2
  61. # define F_DATE        3
  62. # define F_TIME        4
  63. # define F_FTEXT       5
  64.  
  65. /* classes of mask characters */
  66. # define SPECIAL   0
  67. # define TEMPLATE  1
  68. # define FILL      2
  69. # define PASSWORD  3
  70.  
  71. /* field control bits; combine them with an OR '|' */
  72. # define CONFIRM_NEEDED   1  /* control bit for field confirmation */
  73. # define BLANK_FIELD      2  /* control bit for blanking field on first key  */
  74. # define NUMLOCK_FIELD    4  /* set numlock when on field, restore when done */
  75. # define OVERFLOW_RETURN  8  /* return if field overflows */
  76. # define NO_OVERFLOW      16 /* field is not allowed to overflow (inserting) */
  77. # define NO_HOME_END      32 /* Home and End keys cause return on field level*/
  78. # define NO_BLANK         64 /* IP_BLANK & IP_RESTORE keys are disabled */
  79.  
  80. # define HARDSPACE  ' '      /* this is the display of a true space */
  81. # define ASTERISK_FILL    '*'
  82. # define DOLLAR_SIGN    '$'
  83.  
  84. /* macro definitions for formatting dates and numeric fields */
  85. #define fmt_numeric  fmt_text
  86. #define date_input   text_input
  87.  
  88. /* these typedefs should be in bench.c - JPK */
  89. typedef int ATTR;
  90. typedef int KEY;
  91. typedef unsigned short USHORT;
  92.  
  93. /* data entry field description */
  94. typedef struct field {
  95.     USHORT frow;             /* row to display field on                 */
  96.     USHORT fcol;             /* column to start field on                */
  97.     int fx;                    /* runnning column, starts at 0 */
  98.     char *fbuff;             /* field buffer                            */
  99.     char *fmask;             /* field data entry mask                   */
  100.     USHORT fhelp;            /* field help number                       */
  101.     USHORT fieldlen;         /* field length                    */
  102.     USHORT ftype;            /* field data type                         */
  103.     ATTR fattrib_on;         /* attribute when editing field            */
  104.     ATTR fattrib_off;        /* attribute when not editing field        */
  105.     short fcontrol;          /* control word for field                  */
  106. # ifdef ANSI
  107.     int (*f_pre)(struct field *);    /* points to pre input function  */
  108.     int (*f_input)(struct field *);  /* points to input routine       */
  109.     int (*f_val)(struct field *);    /* points to validation function */
  110.     int (*f_post)(struct field *);   /* points to post input function */
  111. # else
  112.     int (*f_pre)();        /* points to pre input function            */
  113.     int (*f_input)();      /* points to input routine                 */
  114.     int (*f_val)();        /* points to validation function           */
  115.     int (*f_post)();       /* points to post input function           */
  116. # endif
  117. } FIELD;
  118.  
  119. # define INSERTING TRUE    /* initial Insert mode */
  120. # define MAX_MASK 256
  121.  
  122. /* prototyping */
  123. # ifdef ANSI
  124. char *fmt_text(struct field *);
  125. int  input_wx(struct field *, int, ...);
  126. int  text_input(struct field *);
  127. void disp_text(struct field *, int);
  128. int length_mask(FIELD *);
  129. void home_field(FIELD *);
  130. void memo_input(int, int, int, int, int, char *);
  131. void move_text(char *, char *, int);
  132. void clean_buffer(FIELD *);
  133. # else /* if !ANSI */
  134. char *fmt_text();
  135. int  input_wx();
  136. int text_input();
  137. void disp_text();
  138. int length_mask();
  139. void home_field();
  140. void memo_input();
  141. void move_text();
  142. void clean_buffer();
  143. # endif
  144.