Commit | Line | Data |
---|---|---|
0b5c625e | 1 | /* |
0de390c0 KB |
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 | |
b36fc510 KB |
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. | |
0de390c0 | 16 | * |
d43d1075 | 17 | * @(#)terminal.h 4.1 (Berkeley) %G% |
0b5c625e GM |
18 | */ |
19 | ||
20 | #define INCLUDED_TERMINAL | |
21 | ||
0b5c625e GM |
22 | /* |
23 | * In the situation where we have a copy of the terminal screen in front | |
24 | * of us, here are some macros to deal with them. | |
25 | */ | |
26 | ||
f3fad2d3 GM |
27 | #define TermAttributes(x) (TermIsStartField(x)? GetTerminal(x)&0xff : \ |
28 | GetTerminal(WhereTermAttrByte(x))&0xff) | |
b052190e | 29 | #define TermIsStartField(x) ((GetTerminal(x)&ATTR_MASK) == ATTR_MASK) |
f3fad2d3 GM |
30 | #define TermNewField(p,a) SetTerminal(p, (a)|ATTR_MASK) |
31 | #define TermDeleteField(p) SetTerminal(p, 0) | |
0b5c625e GM |
32 | #define TermIsNonDisplay(x) \ |
33 | ((TermAttributes(x)&ATTR_DSPD_MASK) == ATTR_DSPD_NONDISPLAY) | |
34 | #define TermIsHighlighted(x) \ | |
35 | (((TermAttributes(x)&ATTR_DSPD_MASK) == ATTR_DSPD_HIGH) \ | |
36 | && !TermIsStartField(x)) | |
37 | ||
38 | #define TerminalCharacterAttr(c,p,a) (IsNonDisplayAttr(a) ? ' ':c) | |
39 | #define TerminalCharacter(c,p) TerminalCharacterAttr(c,p,FieldAttributes(p)) | |
40 | ||
41 | #define NeedToRedisplayFields(p) ((TermIsNonDisplay(p) != IsNonDisplay(p)) || \ | |
42 | (TermIsHighlighted(p) != IsHighlighted(p))) | |
43 | #define NeedToRedisplayFieldsAttr(p,c) ( \ | |
44 | (TermIsNonDisplay(p) != IsNonDisplayAttr(c)) || \ | |
45 | (TermIsHighlighted(p) != IsHighlightedAttr(c))) | |
46 | ||
47 | #define NotVisuallyCompatibleAttributes(p,c,d) ( \ | |
48 | (IsNonDisplayAttr(c) != IsNonDisplayAttr(d)) || \ | |
49 | (IsHighlightedAttr(c) != IsHighlightedAttr(d))) | |
50 | ||
51 | #define NeedToRedisplayAttr(c,p,a) \ | |
52 | ((c != GetTerminal(p)) || NeedToRedisplayFieldsAttr(p,a)) | |
53 | #define NeedToRedisplay(c,p) NeedToRedisplayAttr(c,p,FieldAttributes(p)) | |
54 | ||
f3fad2d3 GM |
55 | |
56 | #define GetTerminal(i) GetGeneric(i, Terminal) | |
57 | #define GetTerminalPointer(p) GetGenericPointer(p) | |
58 | #define SetTerminal(i,c) SetGeneric(i,c,Terminal) |