|
|
1.1 ! root 1: #include <errno.h> ! 2: #include <stdio.h> ! 3: /* ! 4: * Screen information. ! 5: * The externally-defined variables listed below comprise the ! 6: * information needed to manage a virtual 3277 screen. ! 7: */ ! 8: ! 9: #define MAXSCREENSIZE 1920 /* Max. # characters per screen */ ! 10: #define MAXFIELDS MAXSCREENSIZE/2 /* Max. # fields per screen */ ! 11: #define SCREENWIDTH 80 /* Width of screen */ ! 12: ! 13: int fldstart[MAXSCREENSIZE]; /* Index of starting position of each ! 14: field's first data character. ! 15: Attribute characters are immediately ! 16: before each field. */ ! 17: char fldattr[MAXSCREENSIZE]; /* Attribute of each field */ ! 18: int fldmax[MAXSCREENSIZE]; /* Maximum width of each field */ ! 19: int totfields; /* Total number of fields on screen */ ! 20: int curfield; /* Current field number */ ! 21: int bufaddr; /* Current buffer address, 0 to ! 22: MAXSCREENSIZE-1 */ ! 23: int cursaddr; /* Current cursor address, 0 to ! 24: MAXSCREENSIZE-1 */ ! 25: #define ROW cursaddr/SCREENWIDTH ! 26: #define COL cursaddr%SCREENWIDTH ! 27: ! 28: /* scrn_image is a replica of the current ASCII screen image, except that ! 29: attribute characters are replaced with x80's. */ ! 30: char scrn_image[MAXSCREENSIZE]; ! 31: #define ATTRCODE (char)0x80 ! 32: ! 33: /* scrn_xref is a cross-reference into scrn_image. It contains the current ! 34: field number corresponding to each screen location. ! 35: For example, a screen containing two fields, one beginning at screen ! 36: position 10 and the other beginning at screen position 30, can be ! 37: visualized as follows (top row of numbers represent screen positions): ! 38: 0 1 2 3 4 5 ! 39: 012345678901234567890123456789012345678901234567890... ! 40: 111111111122222222222222222222333333333333333333333... ! 41: ! 42: */ ! 43: int scrn_xref[MAXSCREENSIZE]; ! 44: ! 45: extern int unprotected; /* count of unprotected fields on the screen */ ! 46: ! 47: /* attribute codes for fldattr[]: */ ! 48: #define ATTRTYPE 0x30 /* protected, numeric attribute mask */ ! 49: #define ATTRNUM 0x10 /* (fldattr[x] & ATTRTYPE) == ATTRNUM ! 50: if attribute defines numeric field */ ! 51: #define ATTRPROT 0x20 /* (fldattr[x] & ATTRTYPE) == ATTRPROT ! 52: if attribute defines protected field */ ! 53: #define ATTRSKIP 0x30 /* protected and numeric -> autoskip */ ! 54: ! 55: #define num_attr(attr) ((attr & ATTRTYPE) == ATTRNUM) ! 56: #define prot_attr(attr) (attr & ATTRPROT) ! 57: #define invis_attr(attr) ((attr & ATTRDISP) == ATTRINVIS) ! 58: #define hl_attr(attr) ((attr & ATTRDISP) == ATTRHL) ! 59: #define skip_attr(attr) ((attr & ATTRSKIP) == ATTRSKIP) ! 60: ! 61: #define ATTRDISP 0x0c /* display mode mask: */ ! 62: #define ATTRINVIS 0x0c /* Invisible */ ! 63: #define ATTRHL 0x08 /* Highlight */ ! 64: #define ATTRMDT 0x01 /* Modified Data flag */ ! 65: ! 66: #define set_mdt fldattr[curfield] |= ATTRMDT ! 67: ! 68: ! 69: /* Write and Ewrite commands are followed by a WCC (write control character) */ ! 70: extern char wcc; ! 71: ! 72: /* Write Control Character (WCC) Layout: */ ! 73: #define WCCPRFMT 0x30 /* Print format mask: */ ! 74: #define WCCPRVAR 0x00 /* Variable-length to 132 chars */ ! 75: #define WCCPR40 0x10 /* 40-char. fixed */ ! 76: #define WCCPR64 0x20 /* 64-char. fixed */ ! 77: #define WCCPR80 0x30 /* 80-char. fixed */ ! 78: #define WCCSTPRT 0x08 /* Start Print (after command complete) */ ! 79: #define WCCALARM 0x04 /* Sound Alarm (after command complete) */ ! 80: #define WCCKYBDRST 0x02 /* Unlock Keyboard (after command complete) */ ! 81: #define WCCMDTRST 0x01 /* Immediate reset of MDT bit in all fields */ ! 82: ! 83: #define stprt(wc) (wc & WCCSTPRT) ! 84: #define walarm(wc) (wc & WCCALARM) ! 85: #define kbdrst(wc) (wc & WCCKYBDRST) ! 86: #define mdtrst(wc) (wc & WCCMDTRST)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.