|
|
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 the above copyright notice and this paragraph are ! 7: * duplicated in all such forms and that any documentation, ! 8: * advertising materials, and other materials related to such ! 9: * distribution and use acknowledge that the software was developed ! 10: * by the University of California, Berkeley. The name of the ! 11: * University may not be used to endorse or promote products derived ! 12: * from this software without specific prior written permission. ! 13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 14: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 15: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 16: * ! 17: * @(#)screen.h 4.2 (Berkeley) 2/6/89 ! 18: */ ! 19: ! 20: #define INCLUDED_SCREEN ! 21: ! 22: /* defines and defines to describe how to deal with the screen */ ! 23: ! 24: #if !defined(MSDOS) ! 25: #define MAXNUMBERLINES 43 /* 3278-4 */ ! 26: #define MAXNUMBERCOLUMNS 132 /* 3278-5 */ ! 27: #define MAXSCREENSIZE 3564 /* (27*132) 3278-5 */ ! 28: #else /* !defined(MSDOS) */ /* MSDOS has memory constraints */ ! 29: #define MAXNUMBERLINES 25 /* XXX */ ! 30: #define MAXNUMBERCOLUMNS 80 ! 31: #define MAXSCREENSIZE (MAXNUMBERLINES*MAXNUMBERCOLUMNS) ! 32: #endif /* !defined(MSDOS) */ /* MSDOS has memory constraints */ ! 33: #define LowestScreen() 0 ! 34: #define HighestScreen() (ScreenSize-1) ! 35: ! 36: #define ScreenLineOffset(x) ((x)%NumberColumns) ! 37: #define ScreenLine(x) ((int)((x)/NumberColumns)) ! 38: #define ScreenInc(x) (((x)==HighestScreen())? LowestScreen():x+1) ! 39: #define ScreenDec(x) (((x)==LowestScreen())? HighestScreen():x-1) ! 40: #define ScreenUp(x) (((x)+(ScreenSize-NumberColumns))%ScreenSize) ! 41: #define ScreenDown(x) (((x)+NumberColumns)%ScreenSize) ! 42: #define IsOrder(x) (Orders[x]) ! 43: #define BAIC(x) ((x)&0x3f) ! 44: #define CIAB(x) (CIABuffer[(x)&0x3f]) ! 45: #define BufferTo3270_0(x) (CIABuffer[(int)((x)/0x40)]) ! 46: #define BufferTo3270_1(x) (CIABuffer[(x)&0x3f]) ! 47: #define Addr3270(x,y) (BAIC(x)*64+BAIC(y)) ! 48: #define SetBufferAddress(x,y) ((x)*NumberColumns+(y)) ! 49: ! 50: /* These know how fields are implemented... */ ! 51: ! 52: #define WhereAttrByte(p) (IsStartField(p)? p: FieldDec(p)) ! 53: #define WhereHighByte(p) ScreenDec(FieldInc(p)) ! 54: #define WhereLowByte(p) ScreenInc(WhereAttrByte(p)) ! 55: #define FieldAttributes(x) (IsStartField(x)? GetHost(x) : \ ! 56: GetHost(WhereAttrByte(x))) ! 57: #define FieldAttributesPointer(p) (IsStartFieldPointer(p)? \ ! 58: GetHostPointer(p): \ ! 59: GetHost(WhereAttrByte((p)-&Host[0]))) ! 60: ! 61: /* ! 62: * The MDT functions need to protect against the case where the screen ! 63: * is unformatted (sigh). ! 64: */ ! 65: ! 66: /* Turn off the Modified Data Tag */ ! 67: #define TurnOffMdt(x) \ ! 68: if (HasMdt(WhereAttrByte(x))) { \ ! 69: ModifyMdt(x, 0); \ ! 70: } ! 71: ! 72: /* Turn on the Modified Data Tag */ ! 73: #define TurnOnMdt(x) \ ! 74: if (!HasMdt(WhereAttrByte(x))) { \ ! 75: ModifyMdt(x, 1); \ ! 76: } ! 77: ! 78: /* If this location has the MDT bit turned on (implies start of field) ... */ ! 79: #define HasMdt(x) \ ! 80: ((GetHost(x)&(ATTR_MDT|ATTR_MASK)) == (ATTR_MDT|ATTR_MASK)) ! 81: ! 82: /* ! 83: * Is the screen formatted? Some algorithms change depending ! 84: * on whether there are any attribute bytes lying around. ! 85: */ ! 86: #define FormattedScreen() \ ! 87: ((WhereAttrByte(0) != 0) || ((GetHost(0)&ATTR_MASK) == ATTR_MASK)) ! 88: ! 89: /* field starts here */ ! 90: #define IsStartField(x) ((GetHost(x)&ATTR_MASK) == ATTR_MASK) ! 91: #define IsStartFieldPointer(p) ((GetHostPointer(p)&ATTR_MASK) == ATTR_MASK) ! 92: ! 93: #define NewField(p,a) SetHost(p, (a)|ATTR_MASK) ! 94: #define DeleteField(p) SetHost(p, 0) ! 95: #define DeleteAllFields() ! 96: ! 97: /* The following are independent of the implementation of fields */ ! 98: #define IsProtectedAttr(p,a) (IsStartField(p) || ((a)&ATTR_PROT)) ! 99: #define IsProtected(p) IsProtectedAttr(p,FieldAttributes(p)) ! 100: ! 101: #define IsUnProtected(x) (!IsProtected(x)) ! 102: ! 103: #define IsAutoSkip(x) (FieldAttributes(x)&ATTR_AUTO_SKIP) ! 104: ! 105: #define IsNonDisplayAttr(c) (((c)&ATTR_DSPD_MASK) == ATTR_DSPD_NONDISPLAY) ! 106: #define IsNonDisplay(p) IsNonDisplayAttr(FieldAttributes(p)) ! 107: ! 108: #define IsHighlightedAttr(c) \ ! 109: (((c)&ATTR_DSPD_MASK) == ATTR_DSPD_HIGH) ! 110: #define IsHighlighted(p) \ ! 111: (IsHighlightedAttr(FieldAttributes(p)) && !IsStartField(p)) ! 112: ! 113: typedef unsigned char ScreenImage; ! 114: ! 115: extern int ! 116: FieldFind(); ! 117: ! 118: extern char ! 119: CIABuffer[]; ! 120: ! 121: #define GetGeneric(i,h) (h)[i] ! 122: #define GetGenericPointer(p) (*(p)) ! 123: #define SetGeneric(i,c,h) ((h)[i] = (c)) ! 124: #define ModifyGeneric(i,what,h) {(h)[i] what;} ! 125: ! 126: #define GetHost(i) GetGeneric(i,Host) ! 127: #define GetHostPointer(p) GetGenericPointer(p) ! 128: #define SetHost(i,c) SetGeneric(i,c,Host) ! 129: #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.