|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1988 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that this notice is preserved and that due credit is given ! 7: * to the University of California at Berkeley. The name of the University ! 8: * may not be used to endorse or promote products derived from this ! 9: * software without specific prior written permission. This software ! 10: * is provided ``as is'' without express or implied warranty. ! 11: * ! 12: * @(#)screen.h 3.3 (Berkeley) 3/28/88 ! 13: */ ! 14: ! 15: #define INCLUDED_SCREEN ! 16: ! 17: /* defines and defines to describe how to deal with the screen */ ! 18: ! 19: #if !defined(MSDOS) ! 20: #define MAXNUMBERLINES 43 /* 3278-4 */ ! 21: #define MAXNUMBERCOLUMNS 132 /* 3278-5 */ ! 22: #define MAXSCREENSIZE 3564 /* (27*132) 3278-5 */ ! 23: #else /* !defined(MSDOS) */ /* MSDOS has memory constraints */ ! 24: #define MAXNUMBERLINES 25 /* XXX */ ! 25: #define MAXNUMBERCOLUMNS 80 ! 26: #define MAXSCREENSIZE (MAXNUMBERLINES*MAXNUMBERCOLUMNS) ! 27: #endif /* !defined(MSDOS) */ /* MSDOS has memory constraints */ ! 28: #define LowestScreen() 0 ! 29: #define HighestScreen() (ScreenSize-1) ! 30: ! 31: #define ScreenLineOffset(x) ((x)%NumberColumns) ! 32: #define ScreenLine(x) ((int)((x)/NumberColumns)) ! 33: #define ScreenInc(x) (((x)==HighestScreen())? LowestScreen():x+1) ! 34: #define ScreenDec(x) (((x)==LowestScreen())? HighestScreen():x-1) ! 35: #define ScreenUp(x) (((x)+(ScreenSize-NumberColumns))%ScreenSize) ! 36: #define ScreenDown(x) (((x)+NumberColumns)%ScreenSize) ! 37: #define IsOrder(x) (Orders[x]) ! 38: #define BAIC(x) ((x)&0x3f) ! 39: #define CIAB(x) (CIABuffer[(x)&0x3f]) ! 40: #define BufferTo3270_0(x) (CIABuffer[(int)((x)/0x40)]) ! 41: #define BufferTo3270_1(x) (CIABuffer[(x)&0x3f]) ! 42: #define Addr3270(x,y) (BAIC(x)*64+BAIC(y)) ! 43: #define SetBufferAddress(x,y) ((x)*NumberColumns+(y)) ! 44: ! 45: /* These know how fields are implemented... */ ! 46: ! 47: #define WhereAttrByte(p) (IsStartField(p)? p: FieldDec(p)) ! 48: #define WhereHighByte(p) ScreenDec(FieldInc(p)) ! 49: #define WhereLowByte(p) ScreenInc(WhereAttrByte(p)) ! 50: #define FieldAttributes(x) (IsStartField(x)? GetHost(x) : \ ! 51: GetHost(WhereAttrByte(x))) ! 52: #define FieldAttributesPointer(p) (IsStartFieldPointer(p)? \ ! 53: GetHostPointer(p): \ ! 54: GetHost(WhereAttrByte((p)-&Host[0]))) ! 55: ! 56: /* ! 57: * The MDT functions need to protect against the case where the screen ! 58: * is unformatted (sigh). ! 59: */ ! 60: ! 61: /* Turn off the Modified Data Tag */ ! 62: #define TurnOffMdt(x) \ ! 63: if (HasMdt(WhereAttrByte(x))) { \ ! 64: ModifyMdt(x, 0); \ ! 65: } ! 66: ! 67: /* Turn on the Modified Data Tag */ ! 68: #define TurnOnMdt(x) \ ! 69: if (!HasMdt(WhereAttrByte(x))) { \ ! 70: ModifyMdt(x, 1); \ ! 71: } ! 72: ! 73: /* If this location has the MDT bit turned on (implies start of field) ... */ ! 74: #define HasMdt(x) \ ! 75: ((GetHost(x)&(ATTR_MDT|ATTR_MASK)) == (ATTR_MDT|ATTR_MASK)) ! 76: ! 77: /* ! 78: * Is the screen formatted? Some algorithms change depending ! 79: * on whether there are any attribute bytes lying around. ! 80: */ ! 81: #define FormattedScreen() \ ! 82: ((WhereAttrByte(0) != 0) || ((GetHost(0)&ATTR_MASK) == ATTR_MASK)) ! 83: ! 84: /* field starts here */ ! 85: #define IsStartField(x) ((GetHost(x)&ATTR_MASK) == ATTR_MASK) ! 86: #define IsStartFieldPointer(p) ((GetHostPointer(p)&ATTR_MASK) == ATTR_MASK) ! 87: ! 88: #define NewField(p,a) SetHost(p, (a)|ATTR_MASK) ! 89: #define DeleteField(p) SetHost(p, 0) ! 90: #define DeleteAllFields() ! 91: ! 92: /* The following are independent of the implementation of fields */ ! 93: #define IsProtectedAttr(p,a) (IsStartField(p) || ((a)&ATTR_PROT)) ! 94: #define IsProtected(p) IsProtectedAttr(p,FieldAttributes(p)) ! 95: ! 96: #define IsUnProtected(x) (!IsProtected(x)) ! 97: ! 98: #define IsAutoSkip(x) (FieldAttributes(x)&ATTR_AUTO_SKIP) ! 99: ! 100: #define IsNonDisplayAttr(c) (((c)&ATTR_DSPD_MASK) == ATTR_DSPD_NONDISPLAY) ! 101: #define IsNonDisplay(p) IsNonDisplayAttr(FieldAttributes(p)) ! 102: ! 103: #define IsHighlightedAttr(c) \ ! 104: (((c)&ATTR_DSPD_MASK) == ATTR_DSPD_HIGH) ! 105: #define IsHighlighted(p) \ ! 106: (IsHighlightedAttr(FieldAttributes(p)) && !IsStartField(p)) ! 107: ! 108: ! 109: #define MAX(x,y) ((x)<(y)? (y):(x)) ! 110: #define MIN(x,y) ((x)<(y)? x:(y)) ! 111: ! 112: typedef unsigned char ScreenImage; ! 113: ! 114: extern int ! 115: FieldFind(); ! 116: ! 117: extern char ! 118: CIABuffer[]; ! 119: ! 120: #define GetGeneric(i,h) (h)[i] ! 121: #define GetGenericPointer(p) (*(p)) ! 122: #define SetGeneric(i,c,h) ((h)[i] = (c)) ! 123: #define ModifyGeneric(i,what,h) {(h)[i] what;} ! 124: ! 125: #define GetHost(i) GetGeneric(i,Host) ! 126: #define GetHostPointer(p) GetGenericPointer(p) ! 127: #define SetHost(i,c) SetGeneric(i,c,Host) ! 128: #define ModifyHost(i,what) ModifyGeneric(i,what,Host)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.