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