home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / txcl552 / inc / tcxlvid.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-22  |  17.8 KB  |  307 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:   tcxlvid.h     552.2   21 Apr 1991 12:58:44  $
  9.  |
  10.  | $Log:   tcxlvid.h    $
  11.  *-D--------------------------------------------------------------------*
  12.  | <TCXLvid.h> : Definitions and prototypes for TCXL video functions.
  13.  *-N-----------------------[ Notes and Caveats ]------------------------*
  14.  | 1) Included by <TCXLwin.h> and <TCXLvUV.h>. All MS/PC-DOS UltraVision
  15.  |    definitions and prototypes are in <TCXLvUV.h>.
  16.  | 2) The VposT and VcelT data-objects and access macros are defined by
  17.  |    <TCXLdef.h>.
  18.  | 3) The Vput?() direct output macros/functions are used internally by
  19.  |    many of the higher-level TCXL functions and ASSUME the caller has:
  20.  |    a) Done any monochrome attribute mapping.
  21.  |    b) Hidden the mouse-cursor, if visible.
  22.  | 4) The VposDec() and VposInc() portability macros decrement/increment
  23.  |    BOTH the row and column of a VposT object in a portable fashion.
  24.  | 5) Functions with trailing underscores are undocumented, internal and
  25.  |    implementation-specific. They exist to permit passing structures as
  26.  |    arguments and are NOT for public use! Use the defined macro forms
  27.  |    prototyped just before each of them, not the internal functions!
  28.  | 6) Functions prototyped as internal are not for general use!
  29.  | 7) _VidInit(), _VidSize(), _VidTerm() and _VidType() are internal and
  30.  |    must NOT be called by user code!  Call TcxlInit() to initialize
  31.  |    TCXL, NOT the subsystem intializers.
  32.  *======================================================================*/
  33. #ifndef  _TCXLvid_
  34. #  define   _TCXLvid_ 1                /* Only once!                    */
  35. #  ifndef   _TCXLdef_
  36. #     include  <TCXLdef.h>             /* Standard definitions          */
  37. #  endif
  38. #  ifndef   _TCXLatr_
  39. #     include  <TCXLatr.h>             /* Attribute definitions         */
  40. #  endif
  41.  
  42. #define  V_NONE      0x00     /*- Supported adapter types (MS-DOS) -----*/
  43. #define  V_MDA       0x01              /* Vanilla MDA/mono              */
  44. #define  V_EGAMONO   0x02              /* EGA/mono                      */
  45. #define  V_MCGAMONO  0x03              /* MCGA/mono                     */
  46. #define  V_VGAMONO   0x04              /* VGA/mono                      */
  47. #define  V_HGC       0x05              /* Hercules                      */
  48. #define  V_HGCPLUS   0x06              /* Hercules Plus                 */
  49. #define  V_INCOLOR   0x07              /* Hercules Incolor              */
  50. #define  V_CGA       0x08              /* Vanilla CGA                   */
  51. #define  V_EGA       0x09              /* EGA/color                     */
  52. #define  V_MCGA      0x0A              /* MCGA/color                    */
  53. #define  V_VGA       0x0B              /* VGA/color                     */
  54. #define  V_SERIAL    0x80              /* Serial TTY device         jpl */
  55. #define  V_XTERM     0x81              /* some generic X-Terminal   jpl */
  56.  
  57.                               /*- VidParm() video parameters (MS-DOS) --*/
  58. #define  VP_DMA      0x00              /* Direct screen writes          */
  59. #define  VP_CGA      0x01              /* Direct writes, no CGA snow    */
  60. #define  VP_BIO      0x02              /* BIOS screen writes            */
  61. #define  VP_MON      0x03              /* Mono attribute translate on   */
  62. #define  VP_COL      0x04              /* Mono attribute translate off  */
  63.                               /*- VidFlg bits (MS-DOS) -----------------*/
  64. #define  VF_MON      0x01              /* Monochrome                    */
  65. #define  VF_MAP      0x02              /* Map to mono                   */
  66. #define  VF_CGA      0x04              /* Suppress CGA snow             */
  67. #define  VF_BIO      0x08              /* Use video BIOS                */
  68. #define  VF_DQV      0x10              /* DesqView/Windows installed    */
  69.                               /*- Box-border types ---------------------*/
  70. #define  BOX_SNG  0x00                 /* all single                    */
  71. #define  BOX_DBL  0x01                 /* all double                    */
  72. #define  BOX_VER  0x02                 /* horiz single, vert double     */
  73. #define  BOX_HOR  0x03                 /* horiz double, vert single     */
  74. #define  BOX_HVY  0x04                 /* heavy lines                   */
  75. #define  BOX_SPA  0x05                 /* spaces [no box]               */
  76. #define  BOX_EXP  0x80                 /* exploding    Wopen()/WpopUp() */
  77.  
  78. /*------------------[ Data objects and access macros ]------------------*/
  79.  
  80. TYP   struct   _Vctl VctlT;            /* Object, pointer types         */
  81. TYP   union    _Vcse VcseT, *VcseP;
  82.  
  83. union    _Vcse                /*-[ Video cursor object ]----------------*/
  84. {  WrdT     cwrd;             /* 00 : VcseW : Overlay word              */
  85. #ifdef __WORDSWAP__           /*                                    jpl */
  86.    struct                     /*                                        */
  87.    {  BytT  end;              /* 00 : VcseE : Stop line                 */
  88.       BytT  beg;              /* 01 : VcseB : Start line                */
  89.    }  c;                      /*                                        */
  90. #else                         /*                                    jpl */
  91.    struct                     /*                                    jpl */
  92.    {  BytT  beg;              /* 00 : VcseB : Start line            jpl */
  93.       BytT  end;              /* 01 : VcseE : Stop line             jpl */
  94.    }  c;                      /*                                    jpl */
  95. #endif                        /*                                    jpl */
  96. };                            /* 02 ]-----------------------------------*/
  97. #define  VcseW(x)  ((x).cwrd)                /* Overlay word            */
  98. #define  VcseE(x)  ((x).c.end)               /* Stop line               */
  99. #define  VcseB(x)  ((x).c.beg)               /* Start line              */
  100.  
  101. struct   _Vctl                /*-[ Video-control object ]---------------*/
  102. {  WrdT     vseg;             /* 00|00 : VidSeg : Buffer segment        */
  103.    BytT     vhdw;             /* 02|02 : VidHdw : Adapter type          */
  104.    BytT     vmod;             /* 03|03 : VidMod : Display-mode          */
  105.    BytT     vflg;             /* 04|04 : VidFlg : Flag byte             */
  106.    BytT     vpag;             /* 05|05 : VidPag : Display-page          */
  107.    IntT     vwid;             /* 06|06 : VidWid : Columns wide          */
  108.    IntT     vdep;             /* 08|08 : VidDep : Rows deep             */
  109.    VcseT    vcur;             /* 0A|0A : VidCur : Cursor-save           */
  110.    VposT    vpos;             /* 0C|0C : VidPos : Line-position         */
  111.    WrdT     vlen;             /* 0E|0E : VidLen : Line-length           */
  112.    VcelP    vbfr;             /* 10|10 : VidBfr : Line-buffer           */
  113. };                            /* 12|14 ]--------------------------------*/
  114.  
  115. GBL   VctlT CDC   _VidCtl;    /*- Global video-control object ----------*/
  116. #define  VidSeg      (_VidCtl.vseg)             /* Buffer segment       */
  117. #define  VidHdw      (_VidCtl.vhdw)             /* Adapter type         */
  118. #define  VidMod      (_VidCtl.vmod)             /* Display mode         */
  119. #define  VidFlg      (_VidCtl.vflg)             /* Flags                */
  120. #define  VidMon      (0 != (VidFlg & VF_MON))      /* Monochrome        */
  121. #define  VidMap      (0 != (VidFlg & VF_MAP))      /* Map to mono       */
  122. #define  VidCga      (0 != (VidFlg & VF_CGA))      /* CGA snow          */
  123. #define  VidBio      (0 != (VidFlg & VF_BIO))      /* Use BIOS          */
  124. #define  VidDqv      (0 != (VidFlg & VF_DQV))      /* DesQview          */
  125. #define  VidPag      (_VidCtl.vpag)             /* Display page         */
  126. #define  VidWid      (_VidCtl.vwid)             /* Columns wide         */
  127. #define  VidDep      (_VidCtl.vdep)             /* Rows deep            */
  128. #define  VidCur      (_VidCtl.vcur)             /* Cursor save          */
  129. #define  VidPos      (_VidCtl.vpos)             /* Line-position        */
  130. #define  VidPosW     (VposW(VidPos))               /* Word              */
  131. #define  VidPosC     (VposC(VidPos))               /* Column            */
  132. #define  VidPosR     (VposR(VidPos))               /* Row               */
  133. #define  VidLen      (_VidCtl.vlen)             /* Line-length          */
  134. #define  VidBfr      (_VidCtl.vbfr)             /* Line-buffer          */
  135. #define  VidBfrW(b)  ((b)->cwrd)                   /* Word (b => cell)  */
  136. #define  VidBfrC(b)  ((b)->c.chr)                  /* Char              */
  137. #define  VidBfrA(b)  ((b)->c.atr)                  /* Attr              */
  138.  
  139. GBL   VcelP CDC   _VidBfr;    /*- Global video line-buffer -------------*/
  140.  
  141. /*------------------------[ Function prototypes ]-----------------------*/
  142.  
  143. #ifdef __cplusplus                     /* No mangling, please           */
  144.    extern   "C"   {
  145. #endif
  146.                               /*- Video control ------------------------*/
  147. BytT  PAS   VidMode(IntT m);           /* Get/set display mode          */
  148. WrdT        VidOfs(IntT r, IntT c);    /* Calculate screen offset       */
  149. IntT  CTYP  VidParm(IntT p);           /* Set video parameter           */
  150. VOID        VposDec(VposT v);          /* Decrement row/col of VposT    */
  151. VOID        VposInc(VposT v);          /* Increment row/col of VposT    */
  152. IntT  CTYP  VsetLin(IntT n);           /* Set screen lines              */
  153.                               /*- Attributes ---------------------------*/
  154. AtrT  PAS   VatrInv(AtrT a);           /* Invert attr <a>               */
  155. AtrT  CTYP  VatrMap(AtrT a);           /* Map attr <a> to mono          */
  156. VOID  CTYP  VatrRev(IntT n);           /* Reverse <n> attrs             */
  157. VOID  CTYP  VatrSet(AtrT a, IntT n);   /* Set <n> attrs                 */
  158. ChrP  CTYP  VatrTxt(AtrT a);           /* Text description of attr <a>  */
  159. IntT        Vattrib(IntT f, IntT b,    /* Construct attr                */
  160.    IntT i, IntT h);
  161.                               /*- Clear, save/restore screen, etc.------*/
  162. VOID  CTYP  Vclear(AtrT a);            /* Clear screen to attr <a>      */
  163. VOID        VclrBox(VposT s, VposT e); /* Clear box on screen           */
  164. VOID  CTYP  VclrBx_(WrdT s, WrdT e);
  165. VOID  CTYP  VclrEol(NOARG);            /* Clear cursor to EOL           */
  166. VOID  CTYP  VclrScr(NOARG);            /* Clear screen                  */
  167. IntT  CTYP  VlodBox(ChrP f);           /* Load box image from disk      */
  168. IntT        VlodScr(ChrP f);           /* Load screen image from disk   */
  169. VOID        Vrestore(VcelP b);         /* Restore screen from buffer    */
  170. IntT        VsavBox(VposT s, VposT e,  /* Save box image to disk        */
  171.    ChrP f);
  172. IntT  CTYP  VsavBx_(WrdT s, WrdT e, ChrP f);
  173. VcelP       Vsave(NOARG);              /* Save screen to buffer         */
  174. IntT        VsavScr(ChrP f);           /* Save screen image to disk     */
  175.                               /*- Cursor control -----------------------*/
  176. VOID        VcurGet(VposT v);          /* Get cursor position           */
  177. WrdT  PAS   VcurGt_(NOARG);
  178. FlgT  CTYP  VcurHid(IntT s);           /* Hide/show cursor, return state*/
  179. VOID        VcurPut(VposT v);          /* Put cursor                    */
  180. VOID  PAS   VcurPt_(WrdT v);
  181. VOID  CTYP  VcurSet(IntT s);           /* Set large/small cursor        */
  182. VOID        VcurSiz(VcseT c);          /* Size cursor                   */
  183. WrdT  PAS   VcurSz_(WrdT c);
  184. VOID  PAS   Vgotoxy(IntT r, IntT c);   /* Put cursor at row,col         */
  185. VOID  CTYP  VposGet(IntP r, IntP c);   /* Get cursor position as <r,c>  */
  186.                               /*- Line and box drawing/filling ---------*/
  187. VOID        VdrwBox(VposT s, VposT e,  /* Draw box on screen            */
  188.    BytT b, AtrT a);
  189. VOID  CTYP  VdrwBx_(WrdT s, WrdT e, BytT b, AtrT a);
  190. VOID        VdrwHor(VposT s, IntT l,   /* Draw horizontal line          */
  191.    BytT c, AtrT a);
  192. VOID  CTYP  VdrwHo_(WrdT s, IntT l, BytT c, AtrT a);
  193. VOID        VdrwVer(VposT s, IntT l,   /* Draw vertical line            */
  194.    BytT c, AtrT a);
  195. VOID  CTYP  VdrwVe_(WrdT s, IntT l, BytT c, AtrT a);
  196. VOID        VexpBox(VposT sp,          /* Draw/fill *exploding* box     */
  197.    VposT ep, BytT bt, AtrT ba, ChrT fc,
  198.    AtrT fa);
  199. VOID  CTYP  VexpBx_(WrdT sp, WrdT ep, BytT bt, AtrT ba, ChrT fc,
  200.    AtrT fa);
  201. VOID        VfilBox(VposT s, VposT e,  /* Fill box on screen            */
  202.    ChrT c, AtrT a);
  203. VOID  CTYP  VfilBx_(WrdT s, WrdT e, ChrT c, AtrT a);
  204. VOID        Vscroll(IntT d, VposT s,   /* Scroll box on screen          */
  205.    VposT e, IntT n, AtrT a);
  206. VOID  PAS   Vscrol_(IntT d, WrdT s, WrdT e, IntT n, AtrT a);
  207.                               /*- Video input --------------------------*/
  208. VOID        Vgetw(IntT r, IntT c,      /* Get VcelT at r,c              */
  209.    VcelT x);
  210. VOID        Vgetc(IntT r, IntT c,      /* Get char at r,c               */
  211.    ChrT x);
  212. VOID  CTYP  Vgets(IntT r, IntT c,      /* Get row of chars at r,c for   */
  213.    ChrP b, IntT l);                    /* len l                         */
  214. VOID  CTYP  Vgetb(IntT r, IntT c,      /* Get row array of VcelT at r,c */
  215.    VcelP p, IntT l);
  216. VOID  CTYP  Vgetv(IntT r, IntT c,      /* Get column array of VcelT at  */
  217.    VcelP p, IntT l, FlgT f);           /* r,c                           */
  218. VOID  CTYP  Vgetsv(IntT r, IntT c,     /* Get column of chars at r,c    */
  219.    ChrP b, IntT l);                    /* for len l                     */
  220.                               /*- Video output (direct) ----------------*/
  221. VOID  CTYP  Vputc(IntT r, IntT c,      /* Put char/attr at r,c          */
  222.    ChrT x, AtrT a);
  223. VOID  CTYP  Vputs(IntT r, IntT c,      /* Put string/attr at r,c        */
  224.    ChrP s, AtrT a);
  225. VOID  CTYP  Vputn(IntT r, IntT c,      /* Put filled string/attr at r,c */
  226.    ChrP s, AtrT a, IntT l);
  227. VOID        Vputw(IntT r, IntT c,      /* Put VcelT at r,c              */
  228.    VcelT x);
  229. VOID  CTYP  Vputb(IntT r, IntT c,      /* Put row array of VcelT at r,c */
  230.    VcelP b, IntT l);
  231. VOID  CTYP  Vputv(IntT r, IntT c,      /* Put column array of VcelT at  */
  232.    VcelP p, IntT l, FlgT f);           /* r,c                           */
  233. VOID        Vputx(IntT r, IntT c,      /* Put Vcelt (or char or atr)    */
  234.    VcelT x, IntT l);                   /* at r,c                        */
  235. VOID  CTYP  Vputx_(IntT r, IntT c,
  236.    WrdT x, IntT l);
  237.                               /*- Video output (mapping/mouse) ---------*/
  238. VOID  CTYP  Vprintc(IntT r, IntT c,    /* Put char/attr at <r,c>        */
  239.    AtrT a, ChrT x);
  240. VOID  CTYP  Vprints(IntT r, IntT c,    /* Put string/attr at <r,c>      */
  241.    AtrT a, ChrP s);
  242. VOID  CTYP  Vprintn(IntT r, IntT c,    /* Put filled str/attr at <r,c>  */
  243.    AtrT a, ChrP s, IntT l);
  244. VOID        Vprintw(IntT r, IntT c,    /* Put VcelT at r,c              */
  245.    VcelT x);
  246. VOID  CTYP  Vprintb(IntT r, IntT c,    /* Put row array of VcelT at r,c */
  247.    VcelP b, IntT l);
  248.                               /*- Video output at cursor ---------------*/
  249. VOID  PAS   Vputnca(ChrT c, AtrT a,    /* Put <n> char/attr at cursor   */
  250.    IntT n);
  251. VOID  PAS   VputSpa(IntT n);           /* Put <n> spaces                */
  252.                               /*- Internal functions -------------------*/
  253. VOID  PAS   _VegaCu(WrdT s, WrdT e);
  254. WrdT  PAS   _VgetDv(WrdT v);
  255. BytT  PAS   _VidHgc(NOARG);
  256. VOID  CTYP  _VidInit(NOARG);
  257. VOID  CTYP  _VidSize(NOARG);
  258. VOID  CTYP  _VidTerm(NOARG);
  259. IntT  PAS   _VidTyp(NOARG);
  260. BytT  CTYP  _VidType(NOARG);
  261. VOID  PAS   _VlbAtr(AtrT a);
  262. VOID  PAS   _VlbChr(ChrT a);
  263. VOID  PAS   _VlbGet(NOARG);
  264. VOID  PAS   _VlbMap(NOARG);
  265. VOID  PAS   _VlbPut(NOARG);
  266. VOID  PAS   _VlbWrd(WrdT w);
  267. VOID  PAS   _VlvGet(FlgT f);
  268. VOID  PAS   _VlvPut(FlgT f);
  269. VcelP CTYP  _Vsave_(FlgT m, VcelP b);
  270. IntT  CTYP  _VsavScr_(FlgT m, ChrP f);
  271. VOID  PAS   _VsetCh(WrdT f);
  272.                               /*- Portability macros -------------------*/
  273. #define  VposDec(v)  (VposW(v) -= 0x0101)
  274. #define  VposInc(v)  (VposW(v) += 0x0101)
  275.                               /*- Implementation macros ----------------*/
  276. #define  Vattrib(f,b,i,h)     ((b<<4)|(f)|(i<<3)|(h<<7))
  277. #define  VclrBox(s,e)         (VclrBx_(VposW(s),VposW(e)))
  278. #define  VcurGet(v)           (VposW(v)=VcurGt_())
  279. #define  VcurPut(v)           (VcurPt_(VposW(v)))
  280. #define  VcurSiz(c)           (VcseW(c)=VcurSz_(VcseW(c)))
  281. #define  VdrwBox(s,e,b,a)     (VdrwBx_(VposW(s),VposW(e),(b),(a)))
  282. #define  VdrwHor(s,l,c,a)     (VdrwHo_(VposW(s),(l),(c),(a)))
  283. #define  VdrwVer(s,l,c,a)     (VdrwVe_(VposW(s),(l),(c),(a)))
  284. #define  VexpBox(s,e,t,b,c,a) (VexpBx_(VposW(s),VposW(e),(t),(b),(c),(a)))
  285. #define  VfilBox(s,e,c,a)     (VfilBx_(VposW(s),VposW(e),(c),(a)))
  286. #define  Vgetc(r,c,x)         (Vgets((r),(c),(&x),1))
  287. #define  Vgetw(r,c,x)         (Vgetb((r),(c),(&x),1))
  288. #define  VidOfs(r,c)          ((((r)*VidWid)+(c))<<1)
  289. #define  VlodScr(f)           (_VsavScr_(0,(f)))
  290. #define  Vprintw(r,c,x)       (Vprintc((r),(c),VcelA(x)),VcelC(x))
  291. #define  Vputw(r,c,x)         (Vputc((r),(c),VcelC(x),VcelA(x)))
  292. #define  Vputx(r,c,x,l)       (Vputx_((r),(c),VcelW(x),(l)))
  293. #define  Vrestore(b)          ((VOID)_Vsave_(0,(b)))
  294. #define  VsavBox(s,e,f)       (VsavBx_(VposW(s),VposW(e),(f)))
  295. #define  Vsave()              (_Vsave_(1,NULL))
  296. #define  VsavScr(f)           (_VsavScr_(1,(f)))
  297. #define  Vscroll(d,s,e,n,a)   (Vscrol_((d),VposW(s),VposW(e),(n),(a)))
  298. #ifdef __cplusplus
  299.    }
  300. #endif
  301.  
  302. #if defined(__TERMINAL__) && !defined(_TCXLtty_)  /*                jpl */
  303. #  include <TCXLtty.h>                 /* Need TTY access defs      jpl */
  304. #endif                                 /*                           jpl */
  305.  
  306. #endif   /*- _TCXLvid_ : End of TCXLvid.h ------------------------------*/
  307.