File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / usr.bin / bsc / cmd / 3270 / em.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:26:11 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v121, HEAD
Power 6/32 Unix version 1.21

static char s_em[] = "@(#)em.h	1.3 REL";	/*sccs id */
#include <curses.h>
#include <errno.h>
/*
 * Screen information.
 * The externally-defined variables listed below comprise the
 * information needed to manage a virtual 3277 screen.
 */

#define MAXSCREENSIZE 1920		/* Max. # characters per screen */
#define MAXFIELDS MAXSCREENSIZE/2	/* Max. # fields per screen */
#define SCREENWIDTH 80			/* Width of screen */

extern int do_screen;	/* If this is non-zero, real crt will be kept
			   up to date (via curses window vterm_scr) */
WINDOW *vterm_scr;	/* virtual window for 3277 screen */
WINDOW *sub_vterm;	/* subwindow of vterm_scr */
WINDOW *cmd_scr;	/* command window for 3277 screen */
WINDOW *help_scr;	/* help window */

extern int fldstart[];	/* Index of starting position of each
			   field's first data character.
			   Attribute characters are immediately
			   before each field. */
extern char fldattr[];	/* Attribute of each field */
extern int fldmax[];	/* Maximum width of each field */
extern int totfields;	/* Total number of fields on screen */
extern int curfield;	/* Current field number */
extern int bufaddr;	/* Current buffer address, 0 to
			   MAXSCREENSIZE-1 */
extern int cursaddr;	/* Current cursor address, 0 to
			   MAXSCREENSIZE-1 */
#define ROW cursaddr/SCREENWIDTH	
#define COL cursaddr%SCREENWIDTH

/* emputchar returns the following define values */
#define NORMAL 	  0
#define NUMERIC   1  
#define PROTECTED 2
#define FLD_FULL  3
#define NON_DISP  4
#define ATTR_CHAR 5

/* scrn_image is a replica of the current ASCII screen image, except that 
   attribute characters are replaced with x80's. */
extern char scrn_image[];
#define	ATTRCODE (char)0x80

/* scrn_xref is a cross-reference into scrn_image. It contains the current
   field number corresponding to each screen location.	
   For example, a screen containing two fields, one beginning at screen
   position 10 and the other beginning at screen position 30, can be
   visualized as follows (top row of numbers represent screen positions):
    0	      1         2         3         4         5	
    012345678901234567890123456789012345678901234567890...
    111111111122222222222222222222333333333333333333333...

   */
extern int scrn_xref[];

extern int unprotected;		/* count of unprotected fields on the screen */
/* status indicates 3277 terminal status */
extern int status;	/* As follows : */
#define SYS_AVAIL	0x8000	/* System Available, Online A */
#define	ONLINEA		0x8000	/* Synonym for System Available */
#define	ONLINE		0x4000	/* Online */
#define	MYJOB		0x4000	/* My Job */
#define	INPUT_INH	0x2000	/* Input Inhibited */
#define	SYSTEM_LOCK	0x2000	/* Synonym for Input Inhibited */
#define	COMM_CHK	0x1000	/* Communications Check */
#define	PRTR_NW		0x0800	/* Printer Not Working */
#define	GO_ELSE		0x0400	/* Go Elsewhere */
#define	MORE_THAN	0x0200	/* More Than */
#define	NUM_ONLY	0x0100	/* Numeric-Only Field */
#define	INSERT_MODE	0x0080	/* Insert mode enabled */
#define PRTR_BUSY	0x0040	/* Printer Busy */
#define	LOCK_OUT (INPUT_INH|COMM_CHK|PRTR_NW|GO_ELSE|MORE_THAN|NUM_ONLY)

/* emgetchar returns the following defined values when the named characters are
   encountered */
#define	ENTER	129
#define	PF1	ENTER+1
#define	PF2	ENTER+2
#define	PF3	ENTER+3
#define	PF4	ENTER+4
#define	PF5	ENTER+5
#define	PF6	ENTER+6
#define	PF7	ENTER+7
#define	PF8	ENTER+8
#define	PF9	ENTER+9
#define	PF10	ENTER+10
#define	PF11	ENTER+11
#define	PF12	ENTER+12
#define	PA1	ENTER+13
#define PA2	ENTER+14
#define PA3	ENTER+15
#define	CLEAR	ENTER+16
#define	TESTREQ	ENTER+17
#define	TAB	150
#define	BACKTAB	151
#define	ERASE_INP	152
#define	ERASE_EOF	153
#define	INS	154
#define	DELCHR	155
#define	ESC	156
#define	DUP	157
#define	FM	158
#define	UPAR	159
#define	DOWN	160
#define	LEFT	161
#define	RIGHT	162
#define	BACKSP	163
#define	CARRET	164
#define RESET	165
#define HELP	166
#define STATS	167
#define PRINT	168
#define OTHER 170
#define NOCHAR 0	/* no character available/recognized at present */

extern int	COLS;	/* number of columns */
extern int	LINES;	/* # lines on screen */

/* attribute codes for fldattr[]: */
#define ATTRTYPE	0x30	/* protected, numeric attribute mask */
#define ATTRNUM		0x10	/* (fldattr[x] & ATTRTYPE) == ATTRNUM
				   if attribute defines numeric field */
#define ATTRPROT	0x20	/* (fldattr[x] & ATTRTYPE) == ATTRPROT
				   if attribute defines protected field */
#define ATTRSKIP	0x30	/* protected and numeric -> autoskip */

#define num_attr(attr) ((attr & ATTRTYPE) == ATTRNUM)
#define prot_attr(attr) (attr & ATTRPROT)
#define	invis_attr(attr)	((attr & ATTRDISP) == ATTRINVIS)
#define	hl_attr(attr)	((attr & ATTRDISP) == ATTRHL)
#define skip_attr(attr) ((attr & ATTRSKIP) == ATTRSKIP)

#define	ATTRDISP	0x0c	/* display mode mask: */
#define	ATTRINVIS	0x0c	/*	Invisible */
#define	ATTRHL		0x08	/* 	Highlight */
#define	ATTRMDT		0x01	/* Modified Data flag */

/* Write and Ewrite commands are followed by a WCC (write control character) */
extern char wcc;

/* Write Control Character (WCC) Layout: */
#define	WCCPRFMT	0x30	/* Print format mask: */
#define	WCCPRVAR	0x00		/* Variable-length to 132 chars */
#define	WCCPR40		0x10		/* 40-char. fixed */
#define	WCCPR64		0x20		/* 64-char. fixed */
#define	WCCPR80		0x30		/* 80-char. fixed */
#define	WCCSTPRT	0x08	/* Start Print (after command complete) */
#define	WCCALARM	0x04	/* Sound Alarm (after command complete) */
#define	WCCKYBDRST	0x02	/* Unlock Keyboard (after command complete) */
#define	WCCMDTRST	0x01	/* Immediate reset of MDT bit in all fields */

#define stprt(wc) (wc & WCCSTPRT)
#define walarm(wc) (wc & WCCALARM)
#define kbdrst(wc) (wc & WCCKYBDRST)
#define mdtrst(wc) (wc & WCCMDTRST)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.