home *** CD-ROM | disk | FTP | other *** search
- /*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
- | Copyright (c) 1987-1991, Innovative Data Concepts, Inc.
- | All Rights Reserved.
- |
- | This Library is part of IDC's TesSeRact Development Tools product
- | line. For information about other IDC products, call 1-215-443-9705.
- *-V--------------------------------------------------------------------*
- | $Header: tcxlvid.h 552.2 21 Apr 1991 12:58:44 $
- |
- | $Log: tcxlvid.h $
- *-D--------------------------------------------------------------------*
- | <TCXLvid.h> : Definitions and prototypes for TCXL video functions.
- *-N-----------------------[ Notes and Caveats ]------------------------*
- | 1) Included by <TCXLwin.h> and <TCXLvUV.h>. All MS/PC-DOS UltraVision
- | definitions and prototypes are in <TCXLvUV.h>.
- | 2) The VposT and VcelT data-objects and access macros are defined by
- | <TCXLdef.h>.
- | 3) The Vput?() direct output macros/functions are used internally by
- | many of the higher-level TCXL functions and ASSUME the caller has:
- | a) Done any monochrome attribute mapping.
- | b) Hidden the mouse-cursor, if visible.
- | 4) The VposDec() and VposInc() portability macros decrement/increment
- | BOTH the row and column of a VposT object in a portable fashion.
- | 5) Functions with trailing underscores are undocumented, internal and
- | implementation-specific. They exist to permit passing structures as
- | arguments and are NOT for public use! Use the defined macro forms
- | prototyped just before each of them, not the internal functions!
- | 6) Functions prototyped as internal are not for general use!
- | 7) _VidInit(), _VidSize(), _VidTerm() and _VidType() are internal and
- | must NOT be called by user code! Call TcxlInit() to initialize
- | TCXL, NOT the subsystem intializers.
- *======================================================================*/
- #ifndef _TCXLvid_
- # define _TCXLvid_ 1 /* Only once! */
- # ifndef _TCXLdef_
- # include <TCXLdef.h> /* Standard definitions */
- # endif
- # ifndef _TCXLatr_
- # include <TCXLatr.h> /* Attribute definitions */
- # endif
-
- #define V_NONE 0x00 /*- Supported adapter types (MS-DOS) -----*/
- #define V_MDA 0x01 /* Vanilla MDA/mono */
- #define V_EGAMONO 0x02 /* EGA/mono */
- #define V_MCGAMONO 0x03 /* MCGA/mono */
- #define V_VGAMONO 0x04 /* VGA/mono */
- #define V_HGC 0x05 /* Hercules */
- #define V_HGCPLUS 0x06 /* Hercules Plus */
- #define V_INCOLOR 0x07 /* Hercules Incolor */
- #define V_CGA 0x08 /* Vanilla CGA */
- #define V_EGA 0x09 /* EGA/color */
- #define V_MCGA 0x0A /* MCGA/color */
- #define V_VGA 0x0B /* VGA/color */
- #define V_SERIAL 0x80 /* Serial TTY device jpl */
- #define V_XTERM 0x81 /* some generic X-Terminal jpl */
-
- /*- VidParm() video parameters (MS-DOS) --*/
- #define VP_DMA 0x00 /* Direct screen writes */
- #define VP_CGA 0x01 /* Direct writes, no CGA snow */
- #define VP_BIO 0x02 /* BIOS screen writes */
- #define VP_MON 0x03 /* Mono attribute translate on */
- #define VP_COL 0x04 /* Mono attribute translate off */
- /*- VidFlg bits (MS-DOS) -----------------*/
- #define VF_MON 0x01 /* Monochrome */
- #define VF_MAP 0x02 /* Map to mono */
- #define VF_CGA 0x04 /* Suppress CGA snow */
- #define VF_BIO 0x08 /* Use video BIOS */
- #define VF_DQV 0x10 /* DesqView/Windows installed */
- /*- Box-border types ---------------------*/
- #define BOX_SNG 0x00 /* all single */
- #define BOX_DBL 0x01 /* all double */
- #define BOX_VER 0x02 /* horiz single, vert double */
- #define BOX_HOR 0x03 /* horiz double, vert single */
- #define BOX_HVY 0x04 /* heavy lines */
- #define BOX_SPA 0x05 /* spaces [no box] */
- #define BOX_EXP 0x80 /* exploding Wopen()/WpopUp() */
-
- /*------------------[ Data objects and access macros ]------------------*/
-
- TYP struct _Vctl VctlT; /* Object, pointer types */
- TYP union _Vcse VcseT, *VcseP;
-
- union _Vcse /*-[ Video cursor object ]----------------*/
- { WrdT cwrd; /* 00 : VcseW : Overlay word */
- #ifdef __WORDSWAP__ /* jpl */
- struct /* */
- { BytT end; /* 00 : VcseE : Stop line */
- BytT beg; /* 01 : VcseB : Start line */
- } c; /* */
- #else /* jpl */
- struct /* jpl */
- { BytT beg; /* 00 : VcseB : Start line jpl */
- BytT end; /* 01 : VcseE : Stop line jpl */
- } c; /* jpl */
- #endif /* jpl */
- }; /* 02 ]-----------------------------------*/
- #define VcseW(x) ((x).cwrd) /* Overlay word */
- #define VcseE(x) ((x).c.end) /* Stop line */
- #define VcseB(x) ((x).c.beg) /* Start line */
-
- struct _Vctl /*-[ Video-control object ]---------------*/
- { WrdT vseg; /* 00|00 : VidSeg : Buffer segment */
- BytT vhdw; /* 02|02 : VidHdw : Adapter type */
- BytT vmod; /* 03|03 : VidMod : Display-mode */
- BytT vflg; /* 04|04 : VidFlg : Flag byte */
- BytT vpag; /* 05|05 : VidPag : Display-page */
- IntT vwid; /* 06|06 : VidWid : Columns wide */
- IntT vdep; /* 08|08 : VidDep : Rows deep */
- VcseT vcur; /* 0A|0A : VidCur : Cursor-save */
- VposT vpos; /* 0C|0C : VidPos : Line-position */
- WrdT vlen; /* 0E|0E : VidLen : Line-length */
- VcelP vbfr; /* 10|10 : VidBfr : Line-buffer */
- }; /* 12|14 ]--------------------------------*/
-
- GBL VctlT CDC _VidCtl; /*- Global video-control object ----------*/
- #define VidSeg (_VidCtl.vseg) /* Buffer segment */
- #define VidHdw (_VidCtl.vhdw) /* Adapter type */
- #define VidMod (_VidCtl.vmod) /* Display mode */
- #define VidFlg (_VidCtl.vflg) /* Flags */
- #define VidMon (0 != (VidFlg & VF_MON)) /* Monochrome */
- #define VidMap (0 != (VidFlg & VF_MAP)) /* Map to mono */
- #define VidCga (0 != (VidFlg & VF_CGA)) /* CGA snow */
- #define VidBio (0 != (VidFlg & VF_BIO)) /* Use BIOS */
- #define VidDqv (0 != (VidFlg & VF_DQV)) /* DesQview */
- #define VidPag (_VidCtl.vpag) /* Display page */
- #define VidWid (_VidCtl.vwid) /* Columns wide */
- #define VidDep (_VidCtl.vdep) /* Rows deep */
- #define VidCur (_VidCtl.vcur) /* Cursor save */
- #define VidPos (_VidCtl.vpos) /* Line-position */
- #define VidPosW (VposW(VidPos)) /* Word */
- #define VidPosC (VposC(VidPos)) /* Column */
- #define VidPosR (VposR(VidPos)) /* Row */
- #define VidLen (_VidCtl.vlen) /* Line-length */
- #define VidBfr (_VidCtl.vbfr) /* Line-buffer */
- #define VidBfrW(b) ((b)->cwrd) /* Word (b => cell) */
- #define VidBfrC(b) ((b)->c.chr) /* Char */
- #define VidBfrA(b) ((b)->c.atr) /* Attr */
-
- GBL VcelP CDC _VidBfr; /*- Global video line-buffer -------------*/
-
- /*------------------------[ Function prototypes ]-----------------------*/
-
- #ifdef __cplusplus /* No mangling, please */
- extern "C" {
- #endif
- /*- Video control ------------------------*/
- BytT PAS VidMode(IntT m); /* Get/set display mode */
- WrdT VidOfs(IntT r, IntT c); /* Calculate screen offset */
- IntT CTYP VidParm(IntT p); /* Set video parameter */
- VOID VposDec(VposT v); /* Decrement row/col of VposT */
- VOID VposInc(VposT v); /* Increment row/col of VposT */
- IntT CTYP VsetLin(IntT n); /* Set screen lines */
- /*- Attributes ---------------------------*/
- AtrT PAS VatrInv(AtrT a); /* Invert attr <a> */
- AtrT CTYP VatrMap(AtrT a); /* Map attr <a> to mono */
- VOID CTYP VatrRev(IntT n); /* Reverse <n> attrs */
- VOID CTYP VatrSet(AtrT a, IntT n); /* Set <n> attrs */
- ChrP CTYP VatrTxt(AtrT a); /* Text description of attr <a> */
- IntT Vattrib(IntT f, IntT b, /* Construct attr */
- IntT i, IntT h);
- /*- Clear, save/restore screen, etc.------*/
- VOID CTYP Vclear(AtrT a); /* Clear screen to attr <a> */
- VOID VclrBox(VposT s, VposT e); /* Clear box on screen */
- VOID CTYP VclrBx_(WrdT s, WrdT e);
- VOID CTYP VclrEol(NOARG); /* Clear cursor to EOL */
- VOID CTYP VclrScr(NOARG); /* Clear screen */
- IntT CTYP VlodBox(ChrP f); /* Load box image from disk */
- IntT VlodScr(ChrP f); /* Load screen image from disk */
- VOID Vrestore(VcelP b); /* Restore screen from buffer */
- IntT VsavBox(VposT s, VposT e, /* Save box image to disk */
- ChrP f);
- IntT CTYP VsavBx_(WrdT s, WrdT e, ChrP f);
- VcelP Vsave(NOARG); /* Save screen to buffer */
- IntT VsavScr(ChrP f); /* Save screen image to disk */
- /*- Cursor control -----------------------*/
- VOID VcurGet(VposT v); /* Get cursor position */
- WrdT PAS VcurGt_(NOARG);
- FlgT CTYP VcurHid(IntT s); /* Hide/show cursor, return state*/
- VOID VcurPut(VposT v); /* Put cursor */
- VOID PAS VcurPt_(WrdT v);
- VOID CTYP VcurSet(IntT s); /* Set large/small cursor */
- VOID VcurSiz(VcseT c); /* Size cursor */
- WrdT PAS VcurSz_(WrdT c);
- VOID PAS Vgotoxy(IntT r, IntT c); /* Put cursor at row,col */
- VOID CTYP VposGet(IntP r, IntP c); /* Get cursor position as <r,c> */
- /*- Line and box drawing/filling ---------*/
- VOID VdrwBox(VposT s, VposT e, /* Draw box on screen */
- BytT b, AtrT a);
- VOID CTYP VdrwBx_(WrdT s, WrdT e, BytT b, AtrT a);
- VOID VdrwHor(VposT s, IntT l, /* Draw horizontal line */
- BytT c, AtrT a);
- VOID CTYP VdrwHo_(WrdT s, IntT l, BytT c, AtrT a);
- VOID VdrwVer(VposT s, IntT l, /* Draw vertical line */
- BytT c, AtrT a);
- VOID CTYP VdrwVe_(WrdT s, IntT l, BytT c, AtrT a);
- VOID VexpBox(VposT sp, /* Draw/fill *exploding* box */
- VposT ep, BytT bt, AtrT ba, ChrT fc,
- AtrT fa);
- VOID CTYP VexpBx_(WrdT sp, WrdT ep, BytT bt, AtrT ba, ChrT fc,
- AtrT fa);
- VOID VfilBox(VposT s, VposT e, /* Fill box on screen */
- ChrT c, AtrT a);
- VOID CTYP VfilBx_(WrdT s, WrdT e, ChrT c, AtrT a);
- VOID Vscroll(IntT d, VposT s, /* Scroll box on screen */
- VposT e, IntT n, AtrT a);
- VOID PAS Vscrol_(IntT d, WrdT s, WrdT e, IntT n, AtrT a);
- /*- Video input --------------------------*/
- VOID Vgetw(IntT r, IntT c, /* Get VcelT at r,c */
- VcelT x);
- VOID Vgetc(IntT r, IntT c, /* Get char at r,c */
- ChrT x);
- VOID CTYP Vgets(IntT r, IntT c, /* Get row of chars at r,c for */
- ChrP b, IntT l); /* len l */
- VOID CTYP Vgetb(IntT r, IntT c, /* Get row array of VcelT at r,c */
- VcelP p, IntT l);
- VOID CTYP Vgetv(IntT r, IntT c, /* Get column array of VcelT at */
- VcelP p, IntT l, FlgT f); /* r,c */
- VOID CTYP Vgetsv(IntT r, IntT c, /* Get column of chars at r,c */
- ChrP b, IntT l); /* for len l */
- /*- Video output (direct) ----------------*/
- VOID CTYP Vputc(IntT r, IntT c, /* Put char/attr at r,c */
- ChrT x, AtrT a);
- VOID CTYP Vputs(IntT r, IntT c, /* Put string/attr at r,c */
- ChrP s, AtrT a);
- VOID CTYP Vputn(IntT r, IntT c, /* Put filled string/attr at r,c */
- ChrP s, AtrT a, IntT l);
- VOID Vputw(IntT r, IntT c, /* Put VcelT at r,c */
- VcelT x);
- VOID CTYP Vputb(IntT r, IntT c, /* Put row array of VcelT at r,c */
- VcelP b, IntT l);
- VOID CTYP Vputv(IntT r, IntT c, /* Put column array of VcelT at */
- VcelP p, IntT l, FlgT f); /* r,c */
- VOID Vputx(IntT r, IntT c, /* Put Vcelt (or char or atr) */
- VcelT x, IntT l); /* at r,c */
- VOID CTYP Vputx_(IntT r, IntT c,
- WrdT x, IntT l);
- /*- Video output (mapping/mouse) ---------*/
- VOID CTYP Vprintc(IntT r, IntT c, /* Put char/attr at <r,c> */
- AtrT a, ChrT x);
- VOID CTYP Vprints(IntT r, IntT c, /* Put string/attr at <r,c> */
- AtrT a, ChrP s);
- VOID CTYP Vprintn(IntT r, IntT c, /* Put filled str/attr at <r,c> */
- AtrT a, ChrP s, IntT l);
- VOID Vprintw(IntT r, IntT c, /* Put VcelT at r,c */
- VcelT x);
- VOID CTYP Vprintb(IntT r, IntT c, /* Put row array of VcelT at r,c */
- VcelP b, IntT l);
- /*- Video output at cursor ---------------*/
- VOID PAS Vputnca(ChrT c, AtrT a, /* Put <n> char/attr at cursor */
- IntT n);
- VOID PAS VputSpa(IntT n); /* Put <n> spaces */
- /*- Internal functions -------------------*/
- VOID PAS _VegaCu(WrdT s, WrdT e);
- WrdT PAS _VgetDv(WrdT v);
- BytT PAS _VidHgc(NOARG);
- VOID CTYP _VidInit(NOARG);
- VOID CTYP _VidSize(NOARG);
- VOID CTYP _VidTerm(NOARG);
- IntT PAS _VidTyp(NOARG);
- BytT CTYP _VidType(NOARG);
- VOID PAS _VlbAtr(AtrT a);
- VOID PAS _VlbChr(ChrT a);
- VOID PAS _VlbGet(NOARG);
- VOID PAS _VlbMap(NOARG);
- VOID PAS _VlbPut(NOARG);
- VOID PAS _VlbWrd(WrdT w);
- VOID PAS _VlvGet(FlgT f);
- VOID PAS _VlvPut(FlgT f);
- VcelP CTYP _Vsave_(FlgT m, VcelP b);
- IntT CTYP _VsavScr_(FlgT m, ChrP f);
- VOID PAS _VsetCh(WrdT f);
- /*- Portability macros -------------------*/
- #define VposDec(v) (VposW(v) -= 0x0101)
- #define VposInc(v) (VposW(v) += 0x0101)
- /*- Implementation macros ----------------*/
- #define Vattrib(f,b,i,h) ((b<<4)|(f)|(i<<3)|(h<<7))
- #define VclrBox(s,e) (VclrBx_(VposW(s),VposW(e)))
- #define VcurGet(v) (VposW(v)=VcurGt_())
- #define VcurPut(v) (VcurPt_(VposW(v)))
- #define VcurSiz(c) (VcseW(c)=VcurSz_(VcseW(c)))
- #define VdrwBox(s,e,b,a) (VdrwBx_(VposW(s),VposW(e),(b),(a)))
- #define VdrwHor(s,l,c,a) (VdrwHo_(VposW(s),(l),(c),(a)))
- #define VdrwVer(s,l,c,a) (VdrwVe_(VposW(s),(l),(c),(a)))
- #define VexpBox(s,e,t,b,c,a) (VexpBx_(VposW(s),VposW(e),(t),(b),(c),(a)))
- #define VfilBox(s,e,c,a) (VfilBx_(VposW(s),VposW(e),(c),(a)))
- #define Vgetc(r,c,x) (Vgets((r),(c),(&x),1))
- #define Vgetw(r,c,x) (Vgetb((r),(c),(&x),1))
- #define VidOfs(r,c) ((((r)*VidWid)+(c))<<1)
- #define VlodScr(f) (_VsavScr_(0,(f)))
- #define Vprintw(r,c,x) (Vprintc((r),(c),VcelA(x)),VcelC(x))
- #define Vputw(r,c,x) (Vputc((r),(c),VcelC(x),VcelA(x)))
- #define Vputx(r,c,x,l) (Vputx_((r),(c),VcelW(x),(l)))
- #define Vrestore(b) ((VOID)_Vsave_(0,(b)))
- #define VsavBox(s,e,f) (VsavBx_(VposW(s),VposW(e),(f)))
- #define Vsave() (_Vsave_(1,NULL))
- #define VsavScr(f) (_VsavScr_(1,(f)))
- #define Vscroll(d,s,e,n,a) (Vscrol_((d),VposW(s),VposW(e),(n),(a)))
- #ifdef __cplusplus
- }
- #endif
-
- #if defined(__TERMINAL__) && !defined(_TCXLtty_) /* jpl */
- # include <TCXLtty.h> /* Need TTY access defs jpl */
- #endif /* jpl */
-
- #endif /*- _TCXLvid_ : End of TCXLvid.h ------------------------------*/