Commit | Line | Data |
---|---|---|
23d0e88a GM |
1 | /* |
2 | * @(#)screen.h 3.1 10/29/86 | |
3 | */ | |
4 | ||
5 | #define INCLUDED_SCREEN | |
6 | ||
7 | /* defines and defines to describe how to deal with the screen */ | |
8 | ||
52729f2b | 9 | #if !defined(MSDOS) |
23d0e88a GM |
10 | #define MAXNUMBERLINES 43 /* 3278-4 */ |
11 | #define MAXNUMBERCOLUMNS 132 /* 3278-5 */ | |
12 | #define MAXSCREENSIZE 3564 /* (27*132) 3278-5 */ | |
52729f2b GM |
13 | #else /* !defined(MSDOS) */ /* MSDOS has memory constraints */ |
14 | #define MAXNUMBERLINES 25 /* XXX */ | |
15 | #define MAXNUMBERCOLUMNS 80 | |
16 | #define MAXSCREENSIZE (MAXNUMBERLINES*MAXNUMBERCOLUMNS) | |
17 | #endif /* !defined(MSDOS) */ /* MSDOS has memory constraints */ | |
23d0e88a GM |
18 | #define LowestScreen() 0 |
19 | #define HighestScreen() (ScreenSize-1) | |
20 | ||
21 | #define ScreenLineOffset(x) ((x)%NumberColumns) | |
22 | #define ScreenLine(x) ((int)((x)/NumberColumns)) | |
23 | #define ScreenInc(x) (((x)==HighestScreen())? LowestScreen():x+1) | |
24 | #define ScreenDec(x) (((x)==LowestScreen())? HighestScreen():x-1) | |
25 | #define ScreenUp(x) (((x)+(ScreenSize-NumberColumns))%ScreenSize) | |
26 | #define ScreenDown(x) (((x)+NumberColumns)%ScreenSize) | |
27 | #define IsOrder(x) (Orders[x]) | |
28 | #define BAIC(x) ((x)&0x3f) | |
29 | #define CIAB(x) (CIABuffer[(x)&0x3f]) | |
30 | #define BufferTo3270_0(x) (CIABuffer[(int)((x)/0x40)]) | |
31 | #define BufferTo3270_1(x) (CIABuffer[(x)&0x3f]) | |
32 | #define Addr3270(x,y) (BAIC(x)*64+BAIC(y)) | |
33 | #define SetBufferAddress(x,y) ((x)*NumberColumns+(y)) | |
34 | \f | |
35 | /* These know how fields are implemented... */ | |
36 | ||
23d0e88a GM |
37 | #define WhereAttrByte(p) (IsStartField(p)? p: FieldDec(p)) |
38 | #define WhereHighByte(p) ScreenDec(FieldInc(p)) | |
39 | #define WhereLowByte(p) ScreenInc(WhereAttrByte(p)) | |
3aa4065a GM |
40 | #define FieldAttributes(x) (IsStartField(x)? GetHost(x) : \ |
41 | GetHost(WhereAttrByte(x))) | |
42 | #define FieldAttributesPointer(p) (IsStartFieldPointer(p)? \ | |
43 | GetHostPointer(p): \ | |
44 | GetHost(WhereAttrByte((p)-&Host[0]))) | |
45 | #define TurnOffMdt(x) ModifyHost(WhereAttrByte(x), &= ~ATTR_MDT) | |
46 | #define TurnOnMdt(x) ModifyHost(WhereAttrByte(x), |= ATTR_MDT) | |
47 | #define HasMdt(x) (GetHost(x)&ATTR_MDT) /* modified tag */ | |
23d0e88a GM |
48 | |
49 | /* | |
50 | * Is the screen formatted? Some algorithms change depending | |
51 | * on whether there are any attribute bytes lying around. | |
52 | */ | |
53 | #define FormattedScreen() \ | |
3aa4065a | 54 | ((WhereAttrByte(0) != 0) || ((GetHost(0)&ATTR_MASK) == ATTR_MASK)) |
23d0e88a | 55 | |
90ed7ac2 | 56 | /* field starts here */ |
3aa4065a GM |
57 | #define IsStartField(x) ((GetHost(x)&ATTR_MASK) == ATTR_MASK) |
58 | #define IsStartFieldPointer(p) ((GetHostPointer(p)&ATTR_MASK) == ATTR_MASK) | |
90ed7ac2 | 59 | |
3aa4065a GM |
60 | #define NewField(p,a) SetHost(p, (a)|ATTR_MASK) |
61 | #define DeleteField(p) SetHost(p, 0) | |
eb8f58d6 | 62 | #define DeleteAllFields() |
23d0e88a GM |
63 | \f |
64 | /* The following are independent of the implementation of fields */ | |
65 | #define IsProtectedAttr(p,a) (IsStartField(p) || ((a)&ATTR_PROT)) | |
66 | #define IsProtected(p) IsProtectedAttr(p,FieldAttributes(p)) | |
67 | ||
68 | #define IsUnProtected(x) (!IsProtected(x)) | |
69 | ||
70 | #define IsAutoSkip(x) (FieldAttributes(x)&ATTR_AUTO_SKIP) | |
71 | ||
72 | #define IsNonDisplayAttr(c) (((c)&ATTR_DSPD_MASK) == ATTR_DSPD_NONDISPLAY) | |
73 | #define IsNonDisplay(p) IsNonDisplayAttr(FieldAttributes(p)) | |
74 | ||
75 | #define IsHighlightedAttr(c) \ | |
76 | (((c)&ATTR_DSPD_MASK) == ATTR_DSPD_HIGH) | |
77 | #define IsHighlighted(p) \ | |
78 | (IsHighlightedAttr(FieldAttributes(p)) && !IsStartField(p)) | |
79 | ||
80 | ||
81 | #define MAX(x,y) ((x)<(y)? (y):(x)) | |
82 | #define MIN(x,y) ((x)<(y)? x:(y)) | |
83 | ||
3aa4065a | 84 | typedef unsigned char ScreenImage; |
23d0e88a GM |
85 | |
86 | extern int | |
87 | FieldFind(); | |
88 | ||
89 | extern char | |
90 | CIABuffer[]; | |
91 | ||
3aa4065a GM |
92 | #define GetGeneric(i,h) (h)[i] |
93 | #define GetGenericPointer(p) (*(p)) | |
94 | #define SetGeneric(i,c,h) ((h)[i] = (c)) | |
95 | #define ModifyGeneric(i,what,h) {(h)[i] what;} | |
96 | ||
97 | #define GetHost(i) GetGeneric(i,Host) | |
98 | #define GetHostPointer(p) GetGenericPointer(p) | |
99 | #define SetHost(i,c) SetGeneric(i,c,Host) | |
100 | #define ModifyHost(i,what) ModifyGeneric(i,what,Host) |