File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / usr.bin / bsc / cmd / 3270 / empr.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

#include <errno.h>
#include <stdio.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 */

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

/* scrn_image is a replica of the current ASCII screen image, except that 
   attribute characters are replaced with x80's. */
char scrn_image[MAXSCREENSIZE];
#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...

   */
int scrn_xref[MAXSCREENSIZE];

extern int unprotected;		/* count of unprotected fields on the 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 */

#define set_mdt fldattr[curfield] |= ATTRMDT


/* 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.