home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / txcl552 / inc / tcxlent.h < prev    next >
Encoding:
Text File  |  1991-04-22  |  30.7 KB  |  469 lines

  1. /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
  2.  | Copyright (c) 1987-1991, Innovative Data Concepts, Inc.
  3.  | All Rights Reserved.
  4.  |
  5.  | This Library is part of IDC's TesSeRact Development Tools product
  6.  | line. For information about other IDC products, call 1-215-443-9705.
  7.  *-V--------------------------------------------------------------------*
  8.  | $Header:   tcxlent.h     552.5   15 Apr 1991 15:20:10  $
  9.  |
  10.  | $Log:   tcxlent.h    $
  11.  *-D--------------------------------------------------------------------*
  12.  | <TCXLent.h> : Definitions and prototypes for the TCXL Data-entry
  13.  | system (User level).
  14.  *-N-----------------------[ Notes and Caveats ]------------------------*
  15.  | 1) All Data-entry system functions set TcxlErr and return negative
  16.  |    ERR_??? values on errors.  Check return values before proceeding
  17.  |    with processing a form!
  18.  | 2) The Ebld and Fbld Form-build and Field-build data-objects are used
  19.  |    to specify a complete entry form and its component fields to be
  20.  |    built by EntBuild(). A call to EntBuild() with the requisite set of
  21.  |    objects replaces the sequence of calls normally needed to define an
  22.  |    entry form and it fields, as given in 4), which normally consists
  23.  |    of: EntDef(), EntKey(), EntOpt(), EntDis(), EntWrp(), EntFld(),
  24.  |    FldKey(), and FldFun(). This is a first step toward pre-compiled,
  25.  |    tokenized forms. Notes about function arguments give the equivalent
  26.  |    Ebld or Fbld element access macros in [].
  27.  | 3) The <nf> field-count argument to EntDef() [EbldCnt] is the number
  28.  |    of fields in the current form.  Its value is used to allocate space
  29.  |    and to verify the definition of the form.
  30.  | 4) A complete form definition and display cycle consists of the
  31.  |    following sequence of calls:
  32.  |    a) Wopen() to define and open the form window.
  33.  |    a) EntDef() to define the form.
  34.  |    b) EntKey() to assign a user getkey() function and/or terminating
  35.  |       key buffer (optional).
  36.  |    c) EntSep() to assign a user word-separator string (optional).
  37.  |    d) EntOpt() to enable global insert-mode and/or [Up]/[Down] arrow
  38.  |       keys (optional).
  39.  |    e) EntDis() to define an input-disabled field attribute (optional).
  40.  |    f) EntWrp() to cause wrapping from last to first field instead of
  41.  |       the default exit from form on [Enter] in last field (optional).
  42.  |    g) EntFld() <nf> times to define all fields in form.
  43.  |       i) FldKey() to assign a user hot-key to the field (optional).
  44.  |       ii) FldFun() to assign user "before"\"after" functions to the
  45.  |          field (optional).
  46.  |    h) EntSav() to preserve the form for reuse (optional).
  47.  |    i) EntGet() to display, process and dispose of (unless EntSav()
  48.  |       has been called) the form.
  49.  |    j) EntFree() to dispose of the form (if EntSav() was called).
  50.  |    k) Wclose() to close the form window.
  51.  | 5) To simply display a form without input processing or child forms,
  52.  |    use the following alternate sequence of calls:
  53.  |    a) Wopen() to define and open the form window.
  54.  |    b) EntBuild() or EntDef() and EntFld(), etc. to define the form
  55.  |       and its fields.
  56.  |    c) EntDsp() to format and display the form.
  57.  |    d) Perform any user processing while form is displayed, such as
  58.  |       "browsing" through a database to select a record to update.
  59.  |    e) EntSav() to preserve the form for reuse (optional).
  60.  |    f) EntGet() to update the record and dispose the form -OR-
  61.  |       EntFree() to dispose of the form.
  62.  |    g) EntFree() to dispose of the form (if EntSav() was called).
  63.  |    h) Wclose() to close the form window.
  64.  | 6) Multiple records with identical layouts may be "browsed", once
  65.  |    EntBuild() or  the EntDef(), EntFld() sequence and EntDsp() have
  66.  |    been initially called by updating the contents of the FdfStr(),
  67.  |    etc., elements of the Fdf Field-definition objects and again
  68.  |    calling EntDsp() for each new record.  However, either EntFree()
  69.  |    or EntGet() MUST be called to dispose of the form. If EntSav() is
  70.  |    called BEFORE calling EntGet() for an entry form, the form will
  71.  |    be preserved (not disposed of) and can then be serially reused for
  72.  |    multiple records.  EntFree() MUST then be called to dispose of the
  73.  |    form after EntGet() returns.
  74.  | 7) The <fm> feature-mask argument to EntFld() [FbldMsk] is an ORed
  75.  |    combination of the FLD_NUL ... FLD_DIS constants. These special
  76.  |    cases apply:
  77.  |    a) If FLD_DIS (input disabled) is set, at least ONE field must be
  78.  |       enabled.  Obviously both FLD_DIS and FLD_REQ cannot be set for a
  79.  |       field.  FLD_REQ takes precedence and will override FLD_DIS as
  80.  |       an initial setting.  If a disabled field is made required by
  81.  |       calling FldReq(), it will also be enabled.
  82.  |    b) If FLD_REQ (input reqired) is set, the user will not be able to
  83.  |       exit the form until the field has contents, either inserted by
  84.  |       the caller or entered by the user and validated.  If a required
  85.  |       field is disabled by calling FldDis(), it will also no longer be
  86.  |       a required field (see above).
  87.  |    c) If FLD_SUB (nested child form) is set, a user "before" function
  88.  |       for the child form MUST be defined via a call to FldFun()
  89.  |       following the EntFld() call for the parent field. Up to ENT_MAX
  90.  |       (currently 8) levels of child forms can be nested.
  91.  | 8) To define, display and process a child form, define a user "before"
  92.  |    function for the parent field with FldFun(), that, at a minimum,
  93.  |    performs the following sequence of calls before returning to
  94.  |    EntGet() to resume processing of the parent field and form:
  95.  |    a) EntPush() to preserve the parent form. ALWAYS check for
  96.  |       error-returns from EntPush()!!!
  97.  |    b) Wopen() to define and open the child's window.
  98.  |    c) EntBuild() or EntDef() and EntFld(), etc., to define the child
  99.  |       form and its component fields and make it current.
  100.  |    d) EntGet() to display, process and dispose of the child form -OR-
  101.  |       EntDsp() to display and EntFree() to dispose of the child form
  102.  |       without processing.
  103.  |    e) Wclose() to close the child's window.
  104.  |    f) EntPop() to restore the parent form and make it current.
  105.  |    After EntPop() returns, the parent field can be filled in or other
  106.  |    appropriate action taken before returning to EntGet(). If the
  107.  |    parent field is changed, FldChg() MUST be called to signal the
  108.  |    change to EntGet().
  109.  | 9) If a user "before", "valid" or "after" field function modifies the
  110.  |    contents of the current field in ANY way, the FldInp() or FldPnd()
  111.  |    macro MUST be called to signal the change.  FldInp() signals valid
  112.  |    input and FldPnd() signals input pending validation.
  113.  | 10) The global EctlCur pointer and EntCur() are valid and the data
  114.  |    objects exist ONLY when a current entry-form is defined (i.e.,
  115.  |    after EntDef() is called and before EntGet() or EntFree() returns).
  116.  |    Between EntPsh() and EntDef() calls for a child form, NO current
  117.  |    form is defined and EctlCur is NULL!
  118.  | 11) EntGet() disposes of the current form and frees all of its data
  119.  |    objects before returning (unless EntSav() has been called) so there
  120.  |    is NO current entry-form defined and EctlCur is NULL!
  121.  | 12) A user getkey() and last-key buffer, as assigned by EntKey(), can
  122.  |    be used to filter input keystrokes.  The getkey() is called for all
  123.  |    input and returns a K_C_Ent (Ctl[Enter]) to signal an exit from the
  124.  |    form.  EntGet() will put the exiting keycode seen (K_Ctl_Ent) in
  125.  |    the assigned last-key buffer ONLY if the buffer contains 0u. To
  126.  |    place another keycode in the last-key buffer for EntGet()'s caller,
  127.  |    do the following:
  128.  |    a) Write a user getkey() function that calls KeyGetc() to get input
  129.  |       and test for user-defined exit keycodes.  When a user-defined
  130.  |       exit key is detected, call EntTrm() to put it in the last-key
  131.  |       buffer and the return K_C_Ent to signal an exit from the form.
  132.  |    b) Declare a KeyT as a last-key buffer and initialize it to 0u
  133.  |       before each call to EntGet().
  134.  |    c) Assign your getkey() function and last-key buffer when the form
  135.  |       is defined by EntBuild() or EntDef().
  136.  | 13) The field-movement bits in FdfFlg(f) are ONLY valid within a user
  137.  |    "before", "valid" or "after" function called by EntGet(). NO bits
  138.  |    are set if a field is selected by the mouse in other than MOU_KEYS
  139.  |    mode.
  140.  | 14) The EdfXxx access macros defined below REQUIRE a local pointer to
  141.  |    the current entry-form definition object declared and initialized
  142.  |    as: EdfP  e = EctlCur;
  143.  | 15) To change the number of entry-form nesting levels, EntDef.C, which
  144.  |    contains the declaration of the global _EntCtl object, MUST be
  145.  |    re-compiled after modifying ENT_MAX here.
  146.  | 16) The fields and defines labeled internal or transient are not for
  147.  |    access or use by user code!
  148.  | 17) The data-entry system relies heavily on the internal TCXL format
  149.  |    string field-input/output subsystem.
  150.  | 18) The FMT_??? constants are defined by <TCXLfmt.h>.
  151.  *======================================================================*/
  152. #ifndef  _TCXLent_
  153. #  define   _TCXLent_ 1                /* only once!                    */
  154. #  ifndef   _TCXLfmt_
  155. #    include <TCXLfmt.h>               /* Format-string definitions     */
  156. #  endif
  157. #  ifndef   _TCXLwin_
  158. #    include <TCXLwin.h>               /* Window definitions            */
  159. #  endif
  160. #define  ENT_MAX     8        /*- Maximum child form nesting level -----*/
  161.  
  162.                               /*- EbldOpt option flag bits -------------*/
  163. #define  ENT_WRP     0x01     /* Wrap last to first field on [Enter]    */
  164. #define  ENT_SAV     0x02     /* Preserve current form (no dispose)     */
  165. #define  ENT_DIR     0x04     /* [Up]/[Down] keys ON                    */
  166. #define  ENT_GLB     0x08     /* Global insert mode ON                  */
  167.                               /*- Field feature-mask bits --------------*/
  168. #define  FLD_NUL     0x0000   /* No special features defined            */
  169. #define  FLD_LWR     0x0001   /* Convert input to lowercase             */
  170. #define  FLD_MIX     0x0002   /* Convert input to mixed case            */
  171. #define  FLD_UPR     0x0004   /* Convert input to uppercase             */
  172. #define  FLD_PAS     0x0008   /* Password - masked display              */
  173. #define  FLD_DEC     0x0010   /* Decimal field                          */
  174. #define  FLD_NUM     FLD_DEC  /* ... compatibility alias for 5.51       */
  175. #define  FLD_CUR     0x0020   /* Currency field                         */
  176. #define  FLD_NWR     0x0100   /* No auto-wrap to next field             */
  177. #define  FLD_LJS     0x0200   /* Left justify result                    */
  178. #define  FLD_RJS     0x0400   /* Right justify result                   */
  179. #define  FLD_TRM     0x0800   /* Trim end spaces from result            */
  180. #define  FLD_SUB     0x1000   /* Nested child form                      */
  181. #define  FLD_REQ     0x2000   /* Input required                         */
  182. #define  FLD_DIS     0x4000   /* Input disabled                         */
  183.                               /*- Field edit-modes ---------------------*/
  184. #define  FLD_INI     0x00     /* Initial - clear field for input        */
  185. #define  FLD_CHG     0x01     /* Change - display field for edit        */
  186. #define  FLD_CND     0x02     /* Conditional-update                     */
  187.                               /*- Internal EdfCtl form-control flags ---*/
  188. #define  EDF_WRP     0x01     /* Wrap last to first field on [Enter]    */
  189. #define  EDF_SAV     0x02     /* Preserve current form (no dispose)     */
  190. #define  EDF_HIL     0x08     /* Highlight current field                */
  191. #define  EDF_DSP     0x10     /* Form has beew displayed once           */
  192. #define  EDF_DIR     0x20     /* [Up]/[Down] keys ON                    */
  193. #define  EDF_GLB     0x40     /* Global insert mode ON                  */
  194. #define  EDF_KEY     0x80     /* Field hot-keys assigned                */
  195.                               /*- Internal FdfCtl field-control bits ---*/
  196. #define  FDF_NWR     0x01     /* No auto-wrap to next field             */
  197. #define  FDF_LJS     0x02     /* Left justify result                    */
  198. #define  FDF_RJS     0x04     /* Right justify result                   */
  199. #define  FDF_TRM     0x08     /* Trim end spaces from result            */
  200. #define  FDF_SUB     0x10     /* Nested child form                      */
  201. #define  FDF_REQ     0x20     /* Input required                         */
  202. #define  FDF_DIS     0x40     /* Input disabled                         */
  203. #define  FDF_OPT     0x0F     /*- FdfOpt valid bit mask ----------------*/
  204.                               /*- Transient FdfFlg flags ---------------*/
  205. #define  FDF_MOV     0x70     /* Movement mask                          */
  206. #define  FDF_BEG     0x10     /*    To first field                      */
  207. #define  FDF_END     0x20     /*    To last field                       */
  208. #define  FDF_PRV     0x30     /*    To previous field                   */
  209. #define  FDF_NXT     0x40     /*    To next field                       */
  210. #define  FDF_UP      0x50     /*    Upward               [if EdfDir ON] */
  211. #define  FDF_DWN     0x60     /*    Downward             [if EdfDir ON] */
  212. #define  FDF_MOD     0x03     /* Display-mode bits                      */
  213. #define  FDF_DSP     0x04     /* Re-display field                       */
  214.  
  215. /*------------------[ Data objects and access macros ]------------------*/
  216.  
  217. TYP   struct   _Ebld EbldT, *EbldP, **EbldI;
  218. TYP   struct   _Ectl EctlT, *EctlP;    /* object, pointer types         */
  219. TYP   struct   _Edf  EdfT,  *EdfP;
  220. TYP   struct   _Fbld FbldT, *FbldP, **FbldI;
  221. TYP   struct   _Fdf  FdfT,  *FdfP;
  222.  
  223. struct   _Ebld                /*-[ Entry form-build object ]------------*/
  224. {  FbldP    efld;             /* 00|00 : EbldFld : Field-build list     */
  225.    IntT     ecnt;             /* 02|04 : EbldCnt : Field-count          */
  226.    KfvCP    eget;             /* 04|06 : EbldGet : User getkey() func   */
  227.    KeyP     etrm;             /* 06|0A : EbldTrm : User last-key buffer */
  228.    WrdT     eusr;             /* 08|0E : EbldUsr : User form-descriptor */
  229.    BytT     eopt;             /* 0A|10 : EbldOpt : Form option flags    */
  230.    AtrT     epat;             /* 0B|11 : EbldPat : Prompt attribute     */
  231.    AtrT     efat;             /* 0C|12 : EbldFat : Field attribute      */
  232.    AtrT     ehat;             /* 0D|13 : EbldHat : Highlight attribute  */
  233.    AtrT     edat;             /* 0E|14 : EbldDat : Disabled attribute   */
  234.    BytT     efut;             /* 0F|15 : EbldFut : Reserved for future  */
  235. };                            /* 10|16 ]--------------------------------*/
  236. #define  EbldFld(e)  ((e)->efld)                /* Field-build list     */
  237. #define  EbldCnt(e)  ((e)->ecnt)                /* Field-count          */
  238. #define  EbldGet(e)  ((e)->eget)                /* User getkey()        */
  239. #define  EbldTrm(e)  ((e)->etrm)                /* User last-key buffer */
  240. #define  EbldUsr(e)  ((e)->eusr)                /* User descriptor      */
  241. #define  EbldOpt(e)  ((e)->eopt)                /* Option flags         */
  242. #define  EbldGlb(e)  (0 != ((e)->eopt & ENT_GLB))  /* Global-insert     */
  243. #define  EbldDir(e)  (0 != ((e)->eopt & ENT_DIR))  /* [Up]/[Down]       */
  244. #define  EbldSav(e)  (0 != ((e)->eopt & ENT_SAV))  /* Preserve form     */
  245. #define  EbldWrp(e)  (0 != ((e)->eopt & ENT_WRP))  /* Wrap last field   */
  246. #define  EbldPat(e)  ((e)->epat)                /* Prompt attribute     */
  247. #define  EbldFat(e)  ((e)->efat)                /* Field attribute      */
  248. #define  EbldHat(e)  ((e)->ehat)                /* Highlight attribute  */
  249. #define  EbldDat(e)  ((e)->edat)                /* Disabled attribute   */
  250.  
  251. struct   _Fbld                /*-[ Entry field-build object ]-----------*/
  252. {  ChrP     fpmt;             /* 00|00 : FbldPmt : Prompt string        */
  253.    BytT     fpmr;             /* 02|04 : FbldPmr : Prompt window row    */
  254.    BytT     fpmc;             /* 03|05 : FbldPmc : Prompt window col    */
  255.    ChrP     fstr;             /* 04|06 : FbldStr : Field input string   */
  256.    BytT     frow;             /* 06|0A : FbldRow : Field window row     */
  257.    BytT     fcol;             /* 07|0B : FbldCol : Field window col     */
  258.    ChrP     ffmt;             /* 08|0C : FbldFmt : Format string        */
  259.    VfvCP    fbef;             /* 0A|10 : FbldBef : "Before" function    */
  260.    IfcpCP   fval;             /* 0C|14 : FbldVal : "Valid" function     */
  261.    VfvCP    faft;             /* 0E|18 : FbldAft : "After" function     */
  262.    KeyT     fkey;             /* 10|1C : FbldKey : Hot-key              */
  263.    TagT     ftag;             /* 12|1E : FbldTag : Field TagId          */
  264.    TagT     fhlp;             /* 14|20 : FbldHlp : Help TagId           */
  265.    WrdT     fmsk;             /* 16|22 : FbldMsk : Feature mask         */
  266.    WrdT     fusr;             /* 18|24 : FbldUsr : User descriptor      */
  267.    BytT     fmod;             /* 1A|26 : FbldMod : Input mode           */
  268.    BytT     ffut;             /* 1B|27 : FbldFut : Reserved for future  */
  269. };                            /* 1C|28 ]--------------------------------*/
  270. #define  FbldPmt(f)   ((f)->fpmt)               /* Prompt string        */
  271. #define  FbldPmr(f)   ((f)->fpmr)               /* Prompt window row    */
  272. #define  FbldPmc(f)   ((f)->fpmc)               /* Prompt window col    */
  273. #define  FbldStr(f)   ((f)->fstr)               /* Field input string   */
  274. #define  FbldRow(f)   ((f)->frow)               /* Field window row     */
  275. #define  FbldCol(f)   ((f)->fcol)               /* Field window col     */
  276. #define  FbldFmt(f)   ((f)->ffmt)               /* Field format string  */
  277. #define  FbldVal(f)   ((f)->fval)               /* "Valid" function     */
  278. #define  FbldBef(f)   ((f)->fbef)               /* "Before" function    */
  279. #define  FbldAft(f)   ((f)->faft)               /* "After"  function    */
  280. #define  FbldKey(f)   ((f)->fkey)               /* Field hotkey         */
  281. #define  FbldTag(f)   ((f)->ftag)               /* Field TagId          */
  282. #define  FbldHlp(f)   ((f)->fhlp)               /* Help TagId           */
  283. #define  FbldMsk(f)   ((f)->fmsk)               /* Feature mask         */
  284. #define  FbldUsr(f)   ((f)->fusr)               /* User descriptor      */
  285. #define  FbldMod(f)   ((f)->fmod)               /* Input mode           */
  286.  
  287. struct   _Ectl                /*- Entry-control object -----------------*/
  288. {  EdfP     ecur;             /* 00|00 : EctlCur : Current entry-form   */
  289.    EdfP     estk[ENT_MAX];    /* 02|04 : EctlStk : Entry-form stack     */
  290.    FmtP     efmt[ENT_MAX];    /* 12|24 : EctlFmt : Format-control stack */
  291.    IntT     elvl;             /* 22|44 : EctlLvl : Entry-form level     */
  292.    TagT     etag;             /* 24|46 : EctlTag : Current field TagId  */
  293. };                            /* 26|48 }--------------------------------*/
  294.  
  295. GBL   EctlT CDC   _EntCtl;    /*- Global entry-control object ----------*/
  296. #define  EctlCur     (_EntCtl.ecur)             /* Current entry-form   */
  297. #define  EctlStk(i)  (_EntCtl.estk[i])          /* Entry-form stack     */
  298. #define  EctlFmt(i)  (_EntCtl.efmt[i])          /* Format-control stack */
  299. #define  EctlLvl     (_EntCtl.elvl)             /* Entry-form level     */
  300. #define  EctlTag     (_EntCtl.etag)             /* Current field TagId  */
  301.  
  302. struct   _Edf                 /*-[ Entry-form definition object ]-------*/
  303. {  FdfP     etop;             /* 00|00 : EdfTop : Field-list head       */
  304.    FdfP     ebot;             /* 02|04 : EdfBot : Field-list tail       */
  305.    FdfP     ecur;             /* 04|08 : EdfCur : Current field         */
  306.    KfvCP    eget;             /* 06|0C : EdfGet : User getkey() func    */
  307.    KeyP     etrm;             /* 08|10 : EdfTrm : User last-key buffer  */
  308.    ChrP     ebfr;             /* 0A|14 : EdfBfr : Input buffer-pool     */
  309.    VposP    epos;             /* 0C|18 : EdfPos : Field-position list   */
  310.    BytP     elen;             /* 0E|1C : EdfLen : Field-length list     */
  311.    IntT     ecnt;             /* 10|20 : EdfCnt : Field-count           */
  312.    VposT    eorg;             /* 12|22 : EdfOrg : Window image-origin   */
  313.    BytT     ectl;             /* 14|24 : EdfCtl : Control flags         */
  314.    AtrT     efat;             /* 15|25 : EdfFat : Field attribute       */
  315.    AtrT     ehat;             /* 16|26 : EdfTat : Highlight attribute   */
  316.    BytT     edat;             /* 17|27 : EdfDat : Disabled attribute    */
  317.    WrdT     eusr;             /* 18|28 : EdfUsr : User descriptor       */
  318. };                            /* 1A|2A ]--------------------------------*/
  319. #define  EdfTop      ((e)->etop)                /* Field-list head      */
  320. #define  EdfFld(i)   ((e->etop + (i)))          /* Field-list element   */
  321. #define  EdfBot      ((e)->ebot)                /* Field-list tail      */
  322. #define  EdfCur      ((e)->ecur)                /* Current field        */
  323. #define  EdfGet      ((e)->eget)                /* User getkey()        */
  324. #define  EdfTrm      ((e)->etrm)                /* User last-key buffer */
  325. #define  EdfBfr      ((e)->ebfr)                /* Buffer-pool          */
  326. #define  EdfPos      ((e)->epos)                /* Field-position list  */
  327. #define  EdfLen      ((e)->elen)                /* Field-length list    */
  328. #define  EdfCnt      ((e)->ecnt)                /* Field-count          */
  329. #define  EdfOrg      ((e)->eorg)                /* Window image origin  */
  330. #define  EdfOrgW     (VposW(EdfOrg))               /* Word              */
  331. #define  EdfCol      (VposC(EdfOrg))               /* Col               */
  332. #define  EdfRow      (VposR(EdfOrg))               /* Row               */
  333. #define  EdfCtl      ((e)->ectl)                /* Control flags        */
  334. #define  EdfWrp      (0 != (EdfCtl & EDF_WRP))     /* Last-field wrap   */
  335. #define  EdfSav      (0 != (EdfCtl & EDF_SAV))     /* Preserve form     */
  336. #define  EdfHil      (0 != (EdfCtl & EDF_HIL))     /* Highlight current */
  337. #define  EdfDsp      (0 != (EdfCtl & EDF_DSP))     /* Form displayed    */
  338. #define  EdfDir      (0 != (EdfCtl & EDF_DIR))     /* [Up]/[Down] keys  */
  339. #define  EdfGlb      (0 != (EdfCtl & EDF_GLB))     /* Global insert     */
  340. #define  EdfKey      (0 != (EdfCtl & EDF_KEY))     /* Hot-keys defined  */
  341. #define  EdfFat      ((e)->efat)                /* Field attribute      */
  342. #define  EdfHat      ((e)->ehat)                /* Highlight attribute  */
  343. #define  EdfDat      ((e)->edat)                /* Disabled attribute   */
  344. #define  EdfUsr      ((e)->eusr)                /* User descriptor      */
  345.  
  346. struct   _Fdf                 /*-[ Entry-field-definition object ]------*/
  347. {  ChrP     fstr;             /* 00|00 : FdfStr : Input string          */
  348.    ChrP     fbfr;             /* 02|04 : FdfBfr : Buffer string         */
  349.    ChrP     ffmt;             /* 04|08 : FdfFmt : Format string         */
  350.    IfcpCP   fval;             /* 06|0C : FdfVal : "Valid" function      */
  351.    VfvCP    fbef;             /* 08|10 : FdfBef : "Before" function     */
  352.    VfvCP    faft;             /* 0A|14 : FdfAft : "After" function      */
  353.    KeyT     fkey;             /* 0C|18 : FdfKey : Hot-key               */
  354.    TagT     ftag;             /* 0E|1A : FdfTag : Field TagId           */
  355.    TagT     fhlp;             /* 10|1C : FdfHlp : Help TagId            */
  356.    VposT    fpos;             /* 12|1E : FdfPos : Window position       */
  357.    BytT     fopt;             /* 14|20 : FdfOpt : Format options        */
  358.    BytT     fuse;             /* 15|21 : FdfUse : Format usage          */
  359.    BytT     fctl;             /* 16|22 : FdfCtl : Field-control flags   */
  360.    BytT     fflg;             /* 17|23 : FdfFlg : Transient flags       */
  361.    BytT     flen;             /* 18|24 : FdfLen : Field length          */
  362.    BytT     fext;             /* 19|25 : FdfExt : Input extent          */
  363.    BytT     fdot;             /* 1A|26 : FdfDot : Decimal offset        */
  364.    BytT     ffut;             /* 1B|27 : FdfFut : Reserved for future   */
  365.    WrdT     fusr;             /* 1C|28 : FdfUsr : User descriptor       */
  366. };                            /* 1E|2A ]--------------------------------*/
  367. #define  FdfStr(f)   ((f)->fstr)                /* Input string         */
  368. #define  FdfBfr(f)   ((f)->fbfr)                /* Buffer pointer       */
  369. #define  FdfFmt(f)   ((f)->ffmt)                /* Format string        */
  370. #define  FdfVal(f)   ((f)->fval)                /* "Valid" function     */
  371. #define  FdfBef(f)   ((f)->fbef)                /* "Before" function    */
  372. #define  FdfAft(f)   ((f)->faft)                /* "After"  function    */
  373. #define  FdfKey(f)   ((f)->fkey)                /* Hotkey               */
  374. #define  FdfTag(f)   ((f)->ftag)                /* Field TagId          */
  375. #define  FdfHlp(f)   ((f)->fhlp)                /* Help TagId           */
  376. #define  FdfPos(f)   ((f)->fpos)                /* Window position      */
  377. #define  FdfPosW(f)  (VposW(FdfPos(f)))            /* Word              */
  378. #define  FdfCol(f)   (VposC(FdfPos(f)))            /* Col               */
  379. #define  FdfRow(f)   (VposR(FdfPos(f)))            /* Row               */
  380. #define  FdfOpt(f)   ((f)->fopt)                /* Format option bits   */
  381. #define  FdfUse(f)   ((f)->fuse)                /* Format usage bits    */
  382. #define  FdfDec(f)   (0 != (FdfUse(f) & FMT_DEC))  /* Decimal field     */
  383. #define  FdfCur(f)   (0 != (FdfUse(f) & FMT_CUR))  /* Currency field    */
  384. #define  FdfInp(f)   (0 != (FdfUse(f) & FMT_INP))  /* Input to field    */
  385. #define  FdfChk(f)   (0 != (FdfUse(f) & FMT_CHK))  /* Validation pending*/
  386. #define  FdfPnd(f)   (0 != (FdfUse(f) & FMT_PND))  /* Input pending     */
  387. #define  FdfCtl(f)   ((f)->fctl)                /* Field-control flags  */
  388. #define  FdfNwr(f)   (0 != (FdfCtl(f) & FDF_NWR))  /* No-wrap           */
  389. #define  FdfLjs(f)   (0 != (FdfCtl(f) & FDF_LJS))  /* Left-justify      */
  390. #define  FdfRjs(f)   (0 != (FdfCtl(f) & FDF_RJS))  /* Right-justify     */
  391. #define  FdfTrm(f)   (0 != (FdfCtl(f) & FDF_TRM))  /* Trim blanks       */
  392. #define  FdfSub(f)   (0 != (FdfCtl(f) & FDF_SUB))  /* Child form        */
  393. #define  FdfReq(f)   (0 != (FdfCtl(f) & FDF_REQ))  /* Input required    */
  394. #define  FdfDis(f)   (0 != (FdfCtl(f) & FDF_DIS))  /* Input disabled    */
  395. #define  FdfFlg(f)   ((f)->fflg)                /* Transient flags      */
  396. #define  FdfMov(f)   (FdfFlg(f) & FDF_MOV)         /* Movement flags    */
  397. #define  FdfBeg(f)   (FDF_BEG == FdfMov(f))        /*    To first       */
  398. #define  FdfEnd(f)   (FDF_END == FdfMov(f))        /*    To last        */
  399. #define  FdfPrv(f)   (FDF_PRV == FdfMov(f))        /*    To previous    */
  400. #define  FdfNxt(f)   (FDF_NXT == FdfMov(f))        /*    To next        */
  401. #define  FdfUp(f)    (FDF_UP  == FdfMov(f))        /*    Upwards        */
  402. #define  FdfDwn(f)   (FDF_DWN == FdfMov(f))        /*    Downwards      */
  403. #define  FdfMod(f)   (FdfFlg(f) & FMT_MOD)         /* Display mode      */
  404. #define  FdfIni(f)   (FMT_INI == FdfMod(f))        /*    Initial        */
  405. #define  FdfChg(f)   (FMT_CHG == FdfMod(f))        /*    Change         */
  406. #define  FdfCnd(f)   (FMT_CND == FdfMod(f))        /*    Conditional    */
  407. #define  FdfDsp(f)   (0 != (FdfFlg(f) & FMT_DSP))  /* Re-display        */
  408. #define  FdfLen(f)   ((f)->flen)                /* Field length         */
  409. #define  FdfExt(f)   ((f)->fext)                /* Input extent         */
  410. #define  FdfDot(f)   ((f)->fdot)                /* Decimal offset       */
  411. #define  FdfUsr(f)   ((f)->fusr)                /* User descriptor      */
  412.  
  413. /*------------------------[ Function prototypes ]-----------------------*/
  414.  
  415. #ifdef __cplusplus                     /* no mangling, please           */
  416.    extern "C" {
  417. #endif
  418.                               /*- Build complete entry form ------------*/
  419. IntT  CTYP  EntBuild(EbldP e);         /* Build current entry form      */
  420.                               /*- Entry-form/field definition ----------*/
  421. IntT  CTYP  EntDef(AtrT fa, AtrT ha,   /* Define current entry form     */
  422.    IntT nf);
  423. IntT  CTYP  EntDis(AtrT da);           /* Assign disabled attribute     */
  424. IntT  CTYP  EntKey(KfvCP gk,           /* Assign user getkey() function */
  425.    KeyP tk);                           /*    and last-key buffer        */
  426. IntT  CTYP  EntOpt(FlgT gi, FlgT ud);  /* Assign user entry options     */
  427. VOID        EntSav(NOARG);             /* Preserve current form         */
  428. VOID        EntSep(ChrP ws);           /* Assign word-separator string  */
  429. VOID        EntWrp(NOARG);             /* Wrap last-to-first field      */
  430. IntT  CTYP  EntFld(BytT wr, BytT wc,   /* Define field in current form  */
  431.    ChrP ps, ChrP fs, WrdT fm, TagT id,
  432.    BytT md, IfcpCP vf, TagT ht);
  433. IntT  CTYP  FldFun(VfvCP bf,           /* Assign "before" and "after"   */
  434.    VfvCP af);                          /*    user functions for field   */
  435. IntT  CTYP  FldKey(KeyT hk);           /* Assign field hot-key          */
  436.                               /*- Entry-form processing ----------------*/
  437. EdfP        EntCur(NOARG);             /* Return current form pointer   */
  438. IntT  CTYP  EntDsp(NOARG);             /* Display current form/fields   */
  439. VOID  CTYP  EntFree(NOARG);            /* Dispose of current form       */
  440. TagT  CTYP  EntGet(TagT id);           /* Process current form          */
  441. IntT  CTYP  EntPop(NOARG);             /* Restore previous form         */
  442. IntT  CTYP  EntPush(NOARG);            /* Preserve current form         */
  443. VOID        EntTrm(KeyT kc);           /* Put keycode in last-key buffer*/
  444.                               /*- Entry-field processing ---------------*/
  445. VOID  CTYP  FldChg(NOARG);             /* Signal changed parent field   */
  446. FdfP        FldCur(NOARG);             /* Return current field pointer  */
  447. VOID  CTYP  FldDis(FdfP fp, FlgT df);  /* Disable/enable field input    */
  448. VOID        FldInp(NOARG);             /* Signal valid field input      */
  449. FdfP  CTYP  FldLoc(TagT id);           /* Find entry-field by tag <id>  */
  450. VOID        FldPnd(NOARG);             /* Signal pending field input    */
  451. VOID  CTYP  FldReq(FdfP fp, FlgT rf);  /* Field input required/optional */
  452.                               /*- Internals ----------------------------*/
  453. VOID  CTYP  _FldPut(FdfP f, FlgT h);
  454. VOID  CTYP  _FldSet(FdfP f);
  455.                               /*- Implementation macros ----------------*/
  456. #define  EntCur()    (EctlCur)
  457. #define  EntSav()    (EctlCur->ectl |= EDF_SAV)
  458. #define  EntSep(ws)  (_FmtSeps(ws))
  459. #define  EntTrm(kc)  (*(EctlCur->etrm) = (kc))
  460. #define  EntWrp()    (EctlCur->ectl |= EDF_WRP)
  461. #define  FldCur()    (EctlCur->ecur)
  462. #define  FldInp()    (FdfUse(EctlCur->ecur) |= FMT_INP)
  463. #define  FldPnd()    (FdfUse(EctlCur->ecur) |= FMT_PND)
  464. #define  EntShow()   (EntGet(0))
  465. #ifdef __cplusplus
  466.    }
  467. #endif
  468. #endif   /*- _TCXLent_ : End of TCXLent.h ------------------------------*/
  469.