1: /*
   2:  *	Copyright 1984, 1985 by the Regents of the University of
   3:  *	California and by Gregory Glenn Minshall.
   4:  *
   5:  *	Permission to use, copy, modify, and distribute these
   6:  *	programs and their documentation for any purpose and
   7:  *	without fee is hereby granted, provided that this
   8:  *	copyright and permission appear on all copies and
   9:  *	supporting documentation, the name of the Regents of
  10:  *	the University of California not be used in advertising
  11:  *	or publicity pertaining to distribution of the programs
  12:  *	without specific prior permission, and notice be given in
  13:  *	supporting documentation that copying and distribution is
  14:  *	by permission of the Regents of the University of California
  15:  *	and by Gregory Glenn Minshall.  Neither the Regents of the
  16:  *	University of California nor Gregory Glenn Minshall make
  17:  *	representations about the suitability of this software
  18:  *	for any purpose.  It is provided "as is" without
  19:  *	express or implied warranty.
  20:  */
  21: 
  22: 
  23: /* defines and defines to describe how to deal with the screen */
  24: 
  25: #define LINESIZE    80
  26: #define NUMBERLINES 24
  27: #define SCREENSIZE  (LINESIZE*NUMBERLINES)
  28: #define LowestScreen()  0
  29: #define HighestScreen() (SCREENSIZE-1)
  30: 
  31: #define ScreenLineOffset(x) ((x)%LINESIZE)
  32: #define ScreenLine(x)   ((int)((x)/LINESIZE))
  33: #define ScreenInc(x)    (((x)==HighestScreen())? LowestScreen():x+1)
  34: #define ScreenDec(x)    (((x)==LowestScreen())? HighestScreen():x-1)
  35: #define ScreenUp(x) (((x)+(SCREENSIZE-LINESIZE))%SCREENSIZE)
  36: #define ScreenDown(x)   (((x)+LINESIZE)%SCREENSIZE)
  37: #define IsOrder(x)  ((x) && ((x) < 0x40) && (\
  38:                 ((x) == ORDER_SF) || \
  39:                 ((x) == ORDER_SBA) || \
  40:                 ((x) == ORDER_IC) || \
  41:                 ((x) == ORDER_PT) || \
  42:                 ((x) == ORDER_RA) || \
  43:                 ((x) == ORDER_EUA) || \
  44:                 ((x) == ORDER_YALE)))
  45: #define BAIC(x)     ((x)&0x3f)
  46: #define CIAB(x)     (CIABuffer[(x)&0x3f])
  47: #define BufferTo3270_0(x)   (CIABuffer[(int)((x)/0x40)])
  48: #define BufferTo3270_1(x)   (CIABuffer[(x)&0x3f])
  49: #define Addr3270(x,y)   (BAIC(x)*64+BAIC(y))
  50: #define SetBufferAddress(x,y)   ((x)*LINESIZE+(y))
  51: 
  52: /* These know how fields are implemented... */
  53: 
  54: #define FieldInc(p) FieldFind(FieldForward, p, LowestScreen())
  55: #define FieldDec(p) (HighestScreen() - \
  56:                 FieldFind(FieldReverse, \
  57:                     HighestScreen()-p, HighestScreen()))
  58: #define WhereAttrByte(p)    (IsStartField(p)? p: FieldDec(p))
  59: #define WhereHighByte(p)    ScreenDec(FieldInc(p))
  60: #define WhereLowByte(p)     ScreenInc(WhereAttrByte(p))
  61: #define FieldAttributes(x)  (IsStartField(x)? Host[x].field&0xff : \
  62:                     Host[WhereAttrByte(x)].field&0xff)
  63: #define TermAttributes(x)   (TermIsStartField(x)? Terminal[x].field&0xff : \
  64:                     Terminal[WhereTermAttrByte(x)].field&0xff)
  65: #define TurnOffMdt(x)   (Host[WhereAttrByte(x)].field &= ~ATTR_MDT)
  66: #define TurnOnMdt(x)    (Host[WhereAttrByte(x)].field |= ATTR_MDT)
  67: #define HasMdt(x)   (Host[x].field&ATTR_MDT)    /* modified tag */
  68: 
  69: #define IsStartField(x) (Host[x].field&ATTR_MASK)   /* field starts here */
  70: #define TermIsStartField(x) (Terminal[x].field&ATTR_MASK)
  71: #define NewField(p,a)   (Host[p].field = (a)|ATTR_MASK, \
  72:                 FieldForward[p] = FieldReverse[SCREENSIZE-p-1] = 1)
  73: #define TermNewField(p,a)   (Terminal[p].field = (a)|ATTR_MASK)
  74: #define DeleteField(p)  (Host[p].field = 0, \
  75:                 FieldForward[p] = FieldReverse[SCREENSIZE-p-1] = 0)
  76: #define TermDeleteField(p)  (Terminal[p].field = 0)
  77: #define DeleteAllFields()   (bzero(FieldForward, sizeof FieldForward), \
  78:                     bzero(FieldReverse, sizeof FieldReverse))
  79: 
  80: 
  81: /* The following are independent of the implementation of fields */
  82: #define IsProtectedAttr(p,a)    (IsStartField(p) || ((a)&ATTR_PROT))
  83: #define IsProtected(p)  IsProtectedAttr(p,FieldAttributes(p))
  84: 
  85: #define IsUnProtected(x)    (!IsProtected(x))
  86: 
  87: #define IsAutoSkip(x)   (FieldAttributes(x)&ATTR_AUTO_SKIP)
  88: 
  89: #define IsNonDisplayAttr(c) (((c)&ATTR_DSPD_MASK) == ATTR_DSPD_NONDISPLAY)
  90: #define IsNonDisplay(p) IsNonDisplayAttr(FieldAttributes(p))
  91: 
  92: #define IsHighlightedAttr(c) \
  93:         (((c)&ATTR_DSPD_MASK) == ATTR_DSPD_HIGH)
  94: #define IsHighlighted(p) \
  95:         (IsHighlightedAttr(FieldAttributes(p)) && !IsStartField(p))
  96: 
  97: #define TermIsNonDisplay(x) \
  98:             ((TermAttributes(x)&ATTR_DSPD_MASK) == ATTR_DSPD_NONDISPLAY)
  99: #define TermIsHighlighted(x) \
 100:         (((TermAttributes(x)&ATTR_DSPD_MASK) == ATTR_DSPD_HIGH) \
 101:                     && !TermIsStartField(x))
 102: 
 103: #define TerminalCharacterAttr(c,p,a)    (IsNonDisplayAttr(a) ? ' ':c)
 104: #define TerminalCharacter(c,p)  TerminalCharacterAttr(c,p,FieldAttributes(p))
 105: 
 106: #define NeedToRedisplayFields(p) ((TermIsNonDisplay(p) != IsNonDisplay(p)) || \
 107:                 (TermIsHighlighted(p) != IsHighlighted(p)))
 108: #define NeedToRedisplayFieldsAttr(p,c) ( \
 109:             (TermIsNonDisplay(p) != IsNonDisplayAttr(c)) || \
 110:             (TermIsHighlighted(p) != IsHighlightedAttr(c)))
 111: 
 112: #define NotVisuallyCompatibleAttributes(p,c,d) ( \
 113:             (IsNonDisplayAttr(c) != IsNonDisplayAttr(d)) || \
 114:             (IsHighlightedAttr(c) != IsHighlightedAttr(d)))
 115: 
 116: #define NeedToRedisplayAttr(c,p,a) \
 117:             ((c != GetTerminal(p)) || NeedToRedisplayFieldsAttr(p,a))
 118: #define NeedToRedisplay(c,p)    NeedToRedisplayAttr(c,p,FieldAttributes(p))
 119: 
 120: #define MAX(x,y)    ((x)<(y)? (y):(x))
 121: #define MIN(x,y)    ((x)<(y)? x:(y))
 122: 
 123: #define GetHost(i)  Host[i].data
 124: #define SetHost(i,c)    (Host[i].data = c)
 125: 
 126: #define GetTerminal(i)      Terminal[i].data
 127: #define SetTerminal(i,c)    (Terminal[i].data = c)
 128: 
 129: struct {
 130:     char    data,   /* data at this position */
 131:         field;  /* field attributes of this location if ATTR_MASK */
 132: }   Host[SCREENSIZE],       /* host view of screen */
 133:     Terminal[SCREENSIZE];
 134: 
 135: char    FieldForward[SCREENSIZE],   /* non-zero for SF, 0..1919 */
 136:     FieldReverse[SCREENSIZE];   /* non-zero for SF, 1919..0 */
 137: 
 138: 
 139: int CursorAddress;          /* where cursor is */
 140: int BufferAddress;          /* where writes are going */
 141: 
 142: int Lowest, Highest;
 143: 
 144: /* the Following are globals */
 145: 
 146: extern char CIABuffer[];
 147: 
 148: int UnLocked;       /* is the keyboard unlocked */
 149: int AidByte;
 150: 
 151: int Initialized;    /* are we initialized? */

Defined variables

AidByte defined in line 149; used 13 times
BufferAddress defined in line 140; used 28 times
CursorAddress defined in line 139; used 96 times
FieldForward defined in line 135; used 5 times
FieldReverse defined in line 136; used 5 times
Highest defined in line 142; used 16 times
Initialized defined in line 151; used 4 times
Lowest defined in line 142; used 15 times
UnLocked defined in line 148; used 10 times

Defined macros

Addr3270 defined in line 49; used 3 times
BAIC defined in line 45; used 2 times
  • in line 49(2)
BufferTo3270_0 defined in line 47; used 3 times
BufferTo3270_1 defined in line 48; used 4 times
CIAB defined in line 46; never used
DeleteAllFields defined in line 77; used 2 times
DeleteField defined in line 74; used 1 times
FieldAttributes defined in line 61; used 12 times
FieldDec defined in line 55; used 1 times
  • in line 58
FieldInc defined in line 54; used 9 times
GetHost defined in line 123; used 20 times
GetTerminal defined in line 126; used 4 times
HasMdt defined in line 67; used 3 times
HighestScreen defined in line 29; used 18 times
IsAutoSkip defined in line 87; never used
IsHighlighted defined in line 94; used 1 times
IsHighlightedAttr defined in line 92; used 5 times
IsNonDisplay defined in line 90; used 1 times
IsNonDisplayAttr defined in line 89; used 5 times
IsOrder defined in line 37; used 2 times
IsProtected defined in line 83; used 18 times
IsProtectedAttr defined in line 82; used 2 times
IsStartField defined in line 69; used 24 times
IsUnProtected defined in line 85; used 10 times
LINESIZE defined in line 25; used 10 times
LowestScreen defined in line 28; used 18 times
MAX defined in line 120; never used
MIN defined in line 121; never used
NUMBERLINES defined in line 26; used 2 times
NeedToRedisplay defined in line 118; never used
NeedToRedisplayAttr defined in line 116; used 1 times
NeedToRedisplayFields defined in line 106; never used
NeedToRedisplayFieldsAttr defined in line 108; used 1 times
NewField defined in line 71; used 1 times
SCREENSIZE defined in line 27; used 12 times
ScreenDec defined in line 34; used 20 times
ScreenDown defined in line 36; used 2 times
ScreenInc defined in line 33; used 45 times
ScreenLine defined in line 32; used 11 times
ScreenLineOffset defined in line 31; used 14 times
ScreenUp defined in line 35; used 1 times
SetBufferAddress defined in line 50; used 13 times
SetHost defined in line 124; used 2 times
SetTerminal defined in line 127; used 3 times
TermAttributes defined in line 63; used 4 times
TermDeleteField defined in line 76; used 1 times
TermIsHighlighted defined in line 99; used 2 times
TermIsNonDisplay defined in line 97; used 2 times
TermIsStartField defined in line 70; used 8 times
TermNewField defined in line 73; used 2 times
TerminalCharacter defined in line 104; never used
TerminalCharacterAttr defined in line 103; used 2 times
TurnOffMdt defined in line 65; used 2 times
TurnOnMdt defined in line 66; used 4 times
WhereAttrByte defined in line 58; used 11 times
WhereHighByte defined in line 59; used 1 times
WhereLowByte defined in line 60; used 2 times

Usage of this include

Last modified: 1986-01-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1782
Valid CSS Valid XHTML 1.0 Strict