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 * @(#)terminal.h 3.3 (Berkeley) 06/29/88 18 */ 19 20 #define INCLUDED_TERMINAL 21 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 27 #define TermAttributes(x) (TermIsStartField(x)? GetTerminal(x)&0xff : \ 28 GetTerminal(WhereTermAttrByte(x))&0xff) 29 #define TermIsStartField(x) ((GetTerminal(x)&ATTR_MASK) == ATTR_MASK) 30 #define TermNewField(p,a) SetTerminal(p, (a)|ATTR_MASK) 31 #define TermDeleteField(p) SetTerminal(p, 0) 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 55 56 #define GetTerminal(i) GetGeneric(i, Terminal) 57 #define GetTerminalPointer(p) GetGenericPointer(p) 58 #define SetTerminal(i,c) SetGeneric(i,c,Terminal) 59