1 #ifndef cntrl
2 #   define cntrl(c)    (c & 037)
3 #endif
4 #ifndef meta
5 #   define meta(c)     (c | 0400)
6 #endif
7 
8 typedef struct {
9 	short cury, curx;
10 	short flgs;
11 	char clear;
12 	short **y;
13 	short *firstch;
14 	short *lastch;
15 	short *lnum;
16 } WINDOW;
17 
18 typedef struct {
19 	short y, x;
20 	short ny, nx;
21 	short *mem;
22 } BOX;
23 
24 typedef long CURSOR;
25 
26 extern LINES, COLS;
27 extern WINDOW VScreen;
28 
29 #define VMPutChar(y,x,ch) (VMove (y,x), VPutChar (ch))
30 #define VMPutString(y,x,str) (VMove (y,x), VPutString (str))
31 #define VMGetChar(yy,x) (VMove (yy,x), (VScreen.y[VScreen.cury][VScreen.curx] & 0377))
32 
33 int VInit (void);
34 void VOpen (void);
35 void VReopen (void);
36 void VClose (void);
37 void VRestore (void);
38 void VRedraw (void);
39 void VSyncLine (int wy);
40 void VSync (void);
41 void VInsLine (int n);
42 void VDelLine (int n);
43 void VMove (int y, int x);
44 void VClearLine (void);
45 void VClear (void);
46 void VPutString (char *str);
47 void VPrint (char *fmt, ...);
48 void VSetPalette (int n, int nb, int nr, int nrb, int b, int bb,
49 	int br, int brb, int d, int db, int dr, int drb);
50 int VStandOut (void);
51 void VStandEnd (void);
52 void VSetNormal (void);
53 void VSetPrev (void);
54 int VSetDim (void);
55 int VSetBold (void);
56 void VPutChar (int c);
57 void VFlush (void);
58 void VBeep (void);
59 BOX *VGetBox (int y, int x, int ny, int nx);
60 CURSOR VGetCursor (void);
61 void VSetCursor (CURSOR c);
62 void VUngetBox (BOX *box);
63 void VPrintBox (BOX *box);
64 void VFreeBox (BOX *box);
65 void VClearBox (int r, int c, int nr, int nc);
66 void VFillBox (int r, int c, int nr, int nc, int sym);
67 void VHorLine (int r, int c, int nc);
68 void VVertLine (int c, int r, int nr);
69 void VCorner (int r, int c, int n);
70 void VDrawBox (int r, int c, int nr, int nc);
71 void VExpandString (char *s, char *d);
72 void _prscreen (void);
73 
74 struct KeyMap {
75 	char *tcap;
76 	char *str;
77 	short val;
78 };
79 
80 void KeyInit (struct KeyMap *map, void (*flushproc) (void));
81 int KeyGetChar (void);
82 int KeyGet (void);
83 void KeyUnget (int key);
84 
85 #define CAPNUM 1
86 #define CAPFLG 2
87 #define CAPSTR 3
88 
89 struct CapTab {
90 	char tname [3];
91 	char ttype;
92 	char tdef;
93 	char *tc;
94 	int *ti;
95 	char **ts;
96 };
97 
98 int CapInit (char *bp);
99 void CapGet (struct CapTab *t);
100 char *CapGoto (char *CM, int destcol, int destline);
101 
102 void TtySet (void);
103 void TtyReset (void);
104 void TtyFlushInput (void);
105