home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / txcl552 / inc / tcxlhlp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-22  |  11.7 KB  |  194 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:   tcxlhlp.h     552.3   05 May 1991 16:50:20  $
  9.  |
  10.  | $Log:   tcxlhlp.h    $
  11.  *-D--------------------------------------------------------------------*
  12.  | <TCXLhlp.h> : External prototypes for TCXL Help-system (User level).
  13.  *-N-----------------------[ Notes and Caveats ]------------------------*
  14.  | 1) The TCXL Help-system is discrete from the other User-level TCXL
  15.  |    systems and is semaphored to prevent recursive entry.
  16.  | 2) Once Help is defined by calling HlpDef(), HlpGet() will be invoked
  17.  |    by the defined hot-key, unless the hot-key is explicitly defined as
  18.  |    0x0000.  HlpKey() can also be called to undefine the hot-key.
  19.  | 3) HlpAdd(), HlpClr(), HlpCur(), HlpDrop(), HlpOff(), HlpPop(),
  20.  |    HlpPush() and HlpSet() will return 1 (NOT an error) if help is not
  21.  |    defined and the global _HlpFlg help-active flag is FALSE. A caller
  22.  |    expecting help to be active MUST verify that any of these functions
  23.  |    return 0 (ERR_NUL) when called before proceeding under the
  24.  |    assumption that help is defined. The HlpAct() macro is used to test
  25.  |    _HlpFlg.
  26.  | 4) If no hot-key is defined, HlpGet() can be still be called directly
  27.  |    once help is defined by HlpDef().
  28.  | 5) The HdfXxx access macros REQUIRE a local pointer to the global
  29.  |    help-definition object declared and initialized as:
  30.  |       HdfP h = HctlDef.
  31.  | 6) Only the global help-active flag, _HlpFlg,  and help-control object
  32.  |    pointer, _HlpCtl, are valid if help is not defined.  _HlpCtl will
  33.  |    be NULL and _HlpFlg will be FALSE if help is not active.  HlpDef.C
  34.  |    declares these global data objects.
  35.  | 7) Data objects and functions marked internal are not intended for
  36.  |    user access.
  37.  | 8) To increase the maximum number of cross-references/page from the
  38.  |    default (currently 32), modify the HLP_MAX define here and
  39.  |    re-compile ALL of the help-system source files.  The only useful
  40.  |    values for HLP_MAX are 48 and 64.  The MakHlp help-file compiler
  41.  |    must also be advised of the change via the '-m48' or '-m64' option 
  42.  |    so that it will use a limit other than the default.
  43.  *======================================================================*/
  44. #ifndef  _TCXLhlp_
  45. #  define   _TCXLhlp_ 1                /* Only once!                    */
  46. #  ifndef   FILE
  47. #    include <stdio.h>                 /* we need compiler's file here! */
  48. #  endif
  49. #  ifndef   _TCXLwin_
  50. #    include <TCXLwin.h>               /* Window definitions            */
  51. #  endif
  52. #  ifndef   _TCXLeng_
  53. #    include <TCXLeng.h>               /* Page Selection Engine         */
  54. #  endif
  55.  
  56. #define  HLP_STK     16                /* Default help-stack depth      */
  57. #define  HLP_MAX     32                /* Maximum xrefs per screen      */
  58. #define  HLP_LEN     26                /* Significant length of xref    */
  59. #define  HLP_BFR     80                /* Input line-buffer size        */
  60.                               /*- Internal HdfFlg control bits ---------*/
  61. #define  HDF_BSY     0x80     /* Help busy                              */
  62. #define  HDF_XRF     0x01     /* Help-xrefs present                     */
  63. #define  HDF_VER     0x02     /* Vertical help-xrefs                    */
  64. #define  HDF_HOR     0x04     /* Horizontal help-xrefs                  */
  65. #define  HDF_QUT     0x08     /* [Quit] on bottom help bar              */
  66.  
  67. /*--------------[ Internal data objects and access macros ]-------------*/
  68.  
  69. TYP   struct   _Hctl HctlT, *HctlP;    /* Object, pointer types         */
  70. TYP   struct   _Hdf  HdfT,  *HdfP;
  71. TYP   struct   _Hfh  HfhT;
  72.  
  73. struct   _Hctl                /*-[ Help-control object ]----------------*/
  74. {  HdfP     hdef;             /* 00|00 : HctlDef : Definition object    */
  75.    IntT     hptr;             /* 02|04 : HctlPtr : Help stack pointer   */
  76.    TagT     hstk[HLP_STK];    /* 04|06 : HctlStk : Help stack           */
  77. };                            /* 24|26 ]--------------------------------*/
  78.  
  79. GBL   HctlP CDC   _HlpCtl;    /*- global help-control pointer ----------*/
  80. #define  HctlDef     (_HlpCtl->hdef)            /* Definition object    */
  81. #define  HctlPtr     (_HlpCtl->hptr)            /* Stack-pointer        */
  82. #define  HctlStk(i)  (_HlpCtl->hstk[i])         /* Stack-element[i]     */
  83.  
  84. struct   _Hfh                 /*-[ Help-file header-object ]------------*/
  85. {  TagT  htag;                /* 00 : HdrTag : Help-tag                 */
  86.    char  hcat[HLP_LEN];       /* 02 : HdrCat : Help-category            */
  87.    PosT  hofs;                /* 1C : HdrOfs : File-offset              */
  88. };                            /* 20 ]-----------------------------------*/
  89.  
  90. struct   _Hdf                 /*-[ Help-definition object ]-------------*/
  91. {  ChrP     hnam;             /* 00|00 : HdfNam : Help file pathname    */
  92.    VfvCP    hopn;             /* 02|04 : HdfOpn : User "open" function  */
  93.    FILE    *hfil;             /* 04|08 : HdfFil : File-descriptor       */
  94.    ChrP     hbfr;             /* 06|0C : HdfBfr : Input line-buffer     */
  95.    ElstP    heng;             /* 08|10 : HdfEng : Selection Engine      */
  96.    ChrI     hstr;             /* 0A|14 : HdfStr : Xref String Array     */
  97.    PosT     hoff[0x10];       /* 0C|18 : HdfOff : Alt-F1 Save Offsets   */
  98.    IntT     hndx;             /* 4C|58 : HdfNdx : Alt-F1 Save Index     */
  99.    TtlT     httl;             /* 4E|5A : HdfTtl : Title                 */
  100.    HfhT     hhdr;             /* 52|60 : HdfHdr : File-header buffer    */
  101.    VposT    hbeg;             /* 72|80 : HdfBeg : Window start pos      */
  102.    VposT    hend;             /* 74|82 : HdfEnd : Window end pos        */
  103.    BoxT     hfrm;             /* 76|84 : HdfFrm : Window frame          */
  104.    AtrT     hwat;             /* 78|86 : HdfWat : Window attribute      */
  105.    AtrT     htat;             /* 79|87 : HdfTat : Text attribute        */
  106.    AtrT     hxat;             /* 7A|88 : HdfXat : Xref attribute        */
  107.    AtrT     hbat;             /* 7B|89 : HdfBat : Bar attribute         */
  108.    BytT     hflg;             /* 7C|8A : HdfFlg : Control flag bits     */
  109.    BytT     hfut;             /* 7D|8B : HdfFut : Reserved for future   */
  110. };                            /* 7E|8C ]--------------------------------*/
  111.  
  112. #define  HdfNam      (h->hnam)                  /* Pathname             */
  113. #define  HdfOpn      (h->hopn)                  /* User "open" function */
  114. #define  HdfFil      (h->hfil)                  /* File-descriptor      */
  115. #define  HdfBfr      (h->hbfr)                  /* Input line-buffer    */
  116. #define  EndHlp      (*HdfBfr=='*'&&*(HdfBfr+1)=='E')    /* End mark    */
  117. #define  IniHlp      (*HdfBfr=='*'&&*(HdfBfr+1)=='I')    /* Init mark   */
  118. #define  PagHlp      (*HdfBfr=='*'&&*(HdfBfr+1)=='P')    /* Page mark   */
  119. #define  HdfEng      (h->heng)                  /* page selection engine*/
  120. #define  HdfStr      (h->hstr)                  /* Xref string array    */
  121. #define  HdfOff      (h->hoff)                  /* Xref Save Offsets    */
  122. #define  HdfNdx      (h->hndx)                  /* Xref Save Index      */
  123. #define  HdfTtl      (h->httl)                  /* Title                */
  124. #define  HdfTtlS     (TtlStr(HdfTtl))           /*   String             */
  125. #define  HdfTtlP     (TtlPos(HdfTtl))           /*   Position           */
  126. #define  HdfTtlA     (TtlAtr(HdfTtl))           /*   Attribute          */
  127. #define  HdfHdr      (h->hhdr)                  /* Header-buffer        */
  128. #define  HdfTag      (h->hhdr.htag)                /* Header-tag        */
  129. #define  HdfCat      (h->hhdr.hcat)                /* Header-category   */
  130. #define  HdfOfs      (h->hhdr.hofs)                /* Header-offset     */
  131. #define  HdfBeg      (h->hbeg)                  /* Window start pos     */
  132. #define  HdfBegW     (VposW(HdfBeg))               /* Word              */
  133. #define  HdfBegR     (VposR(HdfBeg))               /* Row               */
  134. #define  HdfBegC     (VposC(HdfBeg))               /* Col               */
  135. #define  HdfEnd      (h->hend)                  /* Window end pos       */
  136. #define  HdfEndW     (VposW(HdfEnd))               /* Word              */
  137. #define  HdfEndR     (VposR(HdfEnd))               /* Row               */
  138. #define  HdfEndC     (VposC(HdfEnd))               /* Col               */
  139. #define  HdfFrm      (h->hfrm)                  /* Window frame         */
  140. #define  HdfFrmT     (BoxTyp(HdfFrm))              /* Type              */
  141. #define  HdfFrmA     (BoxAtr(HdfFrm))              /* Attr              */
  142. #define  HdfWat      (h->hwat)                  /* Window attr          */
  143. #define  HdfTat      (h->htat)                  /* Text attr            */
  144. #define  HdfXat      (h->hxat)                  /* Xref attr            */
  145. #define  HdfBat      (h->hbat)                  /* Bar attr             */
  146. #define  HdfFlg      (h->hflg)                  /* Flag bits            */
  147. #define  HdfBsy      (0 != (HdfFlg & HDF_BSY))     /* Help-busy         */
  148. #define  HdfXrf      (0 != (HdfFlg & HDF_XRF))     /* Xrefs present     */
  149. #define  HdfVer      (0 != (HdfFlg & HDF_VER))     /* Vertical          */
  150. #define  HdfHor      (0 != (HdfFlg & HDF_HOR))     /* Horizontal        */
  151. #define  HdfQut      (0 != (HdfFlg & HDF_QUT))     /* Quit on Bottom Bar*/
  152.  
  153. GBL   FlgT  CDC   _HlpFlg;    /*- global help-active flag --------------*/
  154.  
  155. /*------------------------[ Function prototypes ]-----------------------*/
  156.  
  157. #ifdef __cplusplus                     /* No mangling, please           */
  158.    extern "C" {
  159. #endif
  160. FlgT        HlpAct(NOARG);             /* Test for help-active          */
  161. IntT  CTYP  HlpAdd(TagT ht);           /* Push current, set help-tag    */
  162. IntT  CTYP  HlpClr(NOARG);             /* Clear help-stack              */
  163. IntT  CTYP  HlpCur(NOARG);             /* Push current help-tag         */
  164. IntT  CTYP  HlpDef(ChrP fn, KeyT kc,   /* Define help-system, set file, */
  165.    AtrT wa, AtrT fa, AtrT ta, AtrT xa, /*    hot-key, colors, frame,    */
  166.    AtrT ba, BytT ft, VfvCP fo);        /*    user "open" function       */
  167. IntT  CTYP  HlpDrop(NOARG);            /* Drop last pushed help-tag     */
  168. VOID  CTYP  HlpGet(NOARG);             /* Interactive help-handler      */
  169. IntT  CTYP  HlpKey(KeyT kc);           /* Define/undefine help-key      */
  170. IntT  CTYP  HlpOff(NOARG);             /* Undefine help                 */
  171. IntT  CTYP  HlpPop(NOARG);             /* Pop help tag off stack        */
  172. IntT  CTYP  HlpPush(TagT ct);          /* Push help tag onto stack      */
  173. IntT  CTYP  HlpSet(TagT ct);           /* Set help category by help-tag */
  174. IntT  CTYP  HlpTtl(ChrP ts, BytT tp,   /* Define new title string,      */
  175.    AtrT ta);                           /*    position, attribute        */
  176. IntT  CTYP  HlpWind(IntT sr, IntT sc,  /* Re-define help window,        */
  177.    IntT er, IntT ec, BytT ft);         /*    frame-type                 */
  178.  
  179. IntT        HlpQutOn(NOARG);           /* [Quit] on bottom border       */
  180. IntT        HlpQutOff(NOARG);          /* remove [Quit] message         */
  181.  
  182.                               /*- Internals ----------------------------*/
  183. VOID  CTYP  _HlpErr(ChrP s);
  184. VOID  CTYP  _HlpPag(NOARG);
  185.                               /*- Implementation macros ----------------*/
  186. #define  HlpAct()       (_HlpFlg)
  187. #define  HlpQutOn()     (HctlDef->hflg |= HDF_QUT)
  188. #define  HlpQutOff()    (HctlDef->hflg &= ~HDF_QUT)
  189.  
  190. #ifdef __cplusplus
  191.    }
  192. #endif
  193. #endif   /*- _TCXLhlp_ : End of TCXLhlp.h ------------------------------*/
  194.