|
|
1.1 root 1: static char s_em[] = "@(#)em.h 1.3 REL"; /*sccs id */
2: #include <curses.h>
3: #include <errno.h>
4: /*
5: * Screen information.
6: * The externally-defined variables listed below comprise the
7: * information needed to manage a virtual 3277 screen.
8: */
9:
10: #define MAXSCREENSIZE 1920 /* Max. # characters per screen */
11: #define MAXFIELDS MAXSCREENSIZE/2 /* Max. # fields per screen */
12: #define SCREENWIDTH 80 /* Width of screen */
13:
14: extern int do_screen; /* If this is non-zero, real crt will be kept
15: up to date (via curses window vterm_scr) */
16: WINDOW *vterm_scr; /* virtual window for 3277 screen */
17: WINDOW *sub_vterm; /* subwindow of vterm_scr */
18: WINDOW *cmd_scr; /* command window for 3277 screen */
19: WINDOW *help_scr; /* help window */
20:
21: extern int fldstart[]; /* Index of starting position of each
22: field's first data character.
23: Attribute characters are immediately
24: before each field. */
25: extern char fldattr[]; /* Attribute of each field */
26: extern int fldmax[]; /* Maximum width of each field */
27: extern int totfields; /* Total number of fields on screen */
28: extern int curfield; /* Current field number */
29: extern int bufaddr; /* Current buffer address, 0 to
30: MAXSCREENSIZE-1 */
31: extern int cursaddr; /* Current cursor address, 0 to
32: MAXSCREENSIZE-1 */
33: #define ROW cursaddr/SCREENWIDTH
34: #define COL cursaddr%SCREENWIDTH
35:
36: /* emputchar returns the following define values */
37: #define NORMAL 0
38: #define NUMERIC 1
39: #define PROTECTED 2
40: #define FLD_FULL 3
41: #define NON_DISP 4
42: #define ATTR_CHAR 5
43:
44: /* scrn_image is a replica of the current ASCII screen image, except that
45: attribute characters are replaced with x80's. */
46: extern char scrn_image[];
47: #define ATTRCODE (char)0x80
48:
49: /* scrn_xref is a cross-reference into scrn_image. It contains the current
50: field number corresponding to each screen location.
51: For example, a screen containing two fields, one beginning at screen
52: position 10 and the other beginning at screen position 30, can be
53: visualized as follows (top row of numbers represent screen positions):
54: 0 1 2 3 4 5
55: 012345678901234567890123456789012345678901234567890...
56: 111111111122222222222222222222333333333333333333333...
57:
58: */
59: extern int scrn_xref[];
60:
61: extern int unprotected; /* count of unprotected fields on the screen */
62: /* status indicates 3277 terminal status */
63: extern int status; /* As follows : */
64: #define SYS_AVAIL 0x8000 /* System Available, Online A */
65: #define ONLINEA 0x8000 /* Synonym for System Available */
66: #define ONLINE 0x4000 /* Online */
67: #define MYJOB 0x4000 /* My Job */
68: #define INPUT_INH 0x2000 /* Input Inhibited */
69: #define SYSTEM_LOCK 0x2000 /* Synonym for Input Inhibited */
70: #define COMM_CHK 0x1000 /* Communications Check */
71: #define PRTR_NW 0x0800 /* Printer Not Working */
72: #define GO_ELSE 0x0400 /* Go Elsewhere */
73: #define MORE_THAN 0x0200 /* More Than */
74: #define NUM_ONLY 0x0100 /* Numeric-Only Field */
75: #define INSERT_MODE 0x0080 /* Insert mode enabled */
76: #define PRTR_BUSY 0x0040 /* Printer Busy */
77: #define LOCK_OUT (INPUT_INH|COMM_CHK|PRTR_NW|GO_ELSE|MORE_THAN|NUM_ONLY)
78:
79: /* emgetchar returns the following defined values when the named characters are
80: encountered */
81: #define ENTER 129
82: #define PF1 ENTER+1
83: #define PF2 ENTER+2
84: #define PF3 ENTER+3
85: #define PF4 ENTER+4
86: #define PF5 ENTER+5
87: #define PF6 ENTER+6
88: #define PF7 ENTER+7
89: #define PF8 ENTER+8
90: #define PF9 ENTER+9
91: #define PF10 ENTER+10
92: #define PF11 ENTER+11
93: #define PF12 ENTER+12
94: #define PA1 ENTER+13
95: #define PA2 ENTER+14
96: #define PA3 ENTER+15
97: #define CLEAR ENTER+16
98: #define TESTREQ ENTER+17
99: #define TAB 150
100: #define BACKTAB 151
101: #define ERASE_INP 152
102: #define ERASE_EOF 153
103: #define INS 154
104: #define DELCHR 155
105: #define ESC 156
106: #define DUP 157
107: #define FM 158
108: #define UPAR 159
109: #define DOWN 160
110: #define LEFT 161
111: #define RIGHT 162
112: #define BACKSP 163
113: #define CARRET 164
114: #define RESET 165
115: #define HELP 166
116: #define STATS 167
117: #define PRINT 168
118: #define OTHER 170
119: #define NOCHAR 0 /* no character available/recognized at present */
120:
121: extern int COLS; /* number of columns */
122: extern int LINES; /* # lines on screen */
123:
124: /* attribute codes for fldattr[]: */
125: #define ATTRTYPE 0x30 /* protected, numeric attribute mask */
126: #define ATTRNUM 0x10 /* (fldattr[x] & ATTRTYPE) == ATTRNUM
127: if attribute defines numeric field */
128: #define ATTRPROT 0x20 /* (fldattr[x] & ATTRTYPE) == ATTRPROT
129: if attribute defines protected field */
130: #define ATTRSKIP 0x30 /* protected and numeric -> autoskip */
131:
132: #define num_attr(attr) ((attr & ATTRTYPE) == ATTRNUM)
133: #define prot_attr(attr) (attr & ATTRPROT)
134: #define invis_attr(attr) ((attr & ATTRDISP) == ATTRINVIS)
135: #define hl_attr(attr) ((attr & ATTRDISP) == ATTRHL)
136: #define skip_attr(attr) ((attr & ATTRSKIP) == ATTRSKIP)
137:
138: #define ATTRDISP 0x0c /* display mode mask: */
139: #define ATTRINVIS 0x0c /* Invisible */
140: #define ATTRHL 0x08 /* Highlight */
141: #define ATTRMDT 0x01 /* Modified Data flag */
142:
143: /* Write and Ewrite commands are followed by a WCC (write control character) */
144: extern char wcc;
145:
146: /* Write Control Character (WCC) Layout: */
147: #define WCCPRFMT 0x30 /* Print format mask: */
148: #define WCCPRVAR 0x00 /* Variable-length to 132 chars */
149: #define WCCPR40 0x10 /* 40-char. fixed */
150: #define WCCPR64 0x20 /* 64-char. fixed */
151: #define WCCPR80 0x30 /* 80-char. fixed */
152: #define WCCSTPRT 0x08 /* Start Print (after command complete) */
153: #define WCCALARM 0x04 /* Sound Alarm (after command complete) */
154: #define WCCKYBDRST 0x02 /* Unlock Keyboard (after command complete) */
155: #define WCCMDTRST 0x01 /* Immediate reset of MDT bit in all fields */
156:
157: #define stprt(wc) (wc & WCCSTPRT)
158: #define walarm(wc) (wc & WCCALARM)
159: #define kbdrst(wc) (wc & WCCKYBDRST)
160: #define mdtrst(wc) (wc & WCCMDTRST)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.