1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1995-1998 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /* LINTLIBRARY */
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate /*
30*7c478bd9Sstevel@tonic-gate  * vid_puts.c
31*7c478bd9Sstevel@tonic-gate  *
32*7c478bd9Sstevel@tonic-gate  * XCurses Library
33*7c478bd9Sstevel@tonic-gate  *
34*7c478bd9Sstevel@tonic-gate  * Copyright 1990, 1995 by Mortice Kern Systems Inc.  All rights reserved.
35*7c478bd9Sstevel@tonic-gate  *
36*7c478bd9Sstevel@tonic-gate  */
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #ifdef M_RCSID
39*7c478bd9Sstevel@tonic-gate #ifndef lint
40*7c478bd9Sstevel@tonic-gate static char rcsID[] =
41*7c478bd9Sstevel@tonic-gate "$Header: /team/ps/sun_xcurses/archive/local_changes/xcurses/src/lib/"
42*7c478bd9Sstevel@tonic-gate "libxcurses/src/libc/xcurses/rcs/vid_puts.c 1.6 1998/05/28 14:22:43 "
43*7c478bd9Sstevel@tonic-gate "cbates Exp $";
44*7c478bd9Sstevel@tonic-gate #endif
45*7c478bd9Sstevel@tonic-gate #endif
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate #include <private.h>
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate static attr_t	turn_off(int (*)(int), attr_t);
50*7c478bd9Sstevel@tonic-gate static attr_t	turn_on(int (*)(int), attr_t);
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /*
53*7c478bd9Sstevel@tonic-gate  * Return true if attribute X a member of the attribute set A.
54*7c478bd9Sstevel@tonic-gate  * no_color_video is the set of attributes that cannot be combined
55*7c478bd9Sstevel@tonic-gate  * with colours.
56*7c478bd9Sstevel@tonic-gate  */
57*7c478bd9Sstevel@tonic-gate #define	ISATTR(a, x)	(((a) & ~no_color_video & (x)) == (x))
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate /*
60*7c478bd9Sstevel@tonic-gate  * Set the desired attribute state for a terminal screen.
61*7c478bd9Sstevel@tonic-gate  *
62*7c478bd9Sstevel@tonic-gate  * Using set_attributes is the prefered method but requires some care
63*7c478bd9Sstevel@tonic-gate  * in writing the proper terminfo string.  Using exit_attribute_mode and
64*7c478bd9Sstevel@tonic-gate  * the assorted enter_ attribute mode capabilities is the next best method.
65*7c478bd9Sstevel@tonic-gate  * Finally using the assorted exit_ and enter_ attribute mode capabilities
66*7c478bd9Sstevel@tonic-gate  * is the last method available and is not necessarily efficent (or smart
67*7c478bd9Sstevel@tonic-gate  * because of the needs of ceol_standout_glitch support).
68*7c478bd9Sstevel@tonic-gate  */
69*7c478bd9Sstevel@tonic-gate /* ARGSUSED */
70*7c478bd9Sstevel@tonic-gate int
vid_puts(attr_t attr,short pair,void * opts,int (* putout)(int))71*7c478bd9Sstevel@tonic-gate vid_puts(attr_t attr, short pair, void *opts, int (*putout)(int))
72*7c478bd9Sstevel@tonic-gate {
73*7c478bd9Sstevel@tonic-gate 	long	p1, p2, p3, p4, p5, p6, p7, p8, p9;
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate 	if (set_attributes != NULL && ATTR_STATE != attr) {
76*7c478bd9Sstevel@tonic-gate 		/*
77*7c478bd9Sstevel@tonic-gate 		 * Assume that <set_attributes> disables attributes
78*7c478bd9Sstevel@tonic-gate 		 * then re-enables attributes that are to be on.
79*7c478bd9Sstevel@tonic-gate 		 */
80*7c478bd9Sstevel@tonic-gate 		p1 = (long) ISATTR(attr, WA_STANDOUT);
81*7c478bd9Sstevel@tonic-gate 		p2 = (long) ISATTR(attr, WA_UNDERLINE);
82*7c478bd9Sstevel@tonic-gate 		p3 = (long) ISATTR(attr, WA_REVERSE);
83*7c478bd9Sstevel@tonic-gate 		p4 = (long) ISATTR(attr, WA_BLINK);
84*7c478bd9Sstevel@tonic-gate 		p5 = (long) ISATTR(attr, WA_DIM);
85*7c478bd9Sstevel@tonic-gate 		p6 = (long) ISATTR(attr, WA_BOLD);
86*7c478bd9Sstevel@tonic-gate 		p7 = (long) ISATTR(attr, WA_INVIS);
87*7c478bd9Sstevel@tonic-gate 		p8 = (long) ISATTR(attr, WA_PROTECT);
88*7c478bd9Sstevel@tonic-gate 		p9 = (long) ISATTR(attr, WA_ALTCHARSET);
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(tparm(set_attributes,
91*7c478bd9Sstevel@tonic-gate 			p1, p2, p3, p4, p5, p6, p7, p8, p9),
92*7c478bd9Sstevel@tonic-gate 			1, putout);
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate 		ATTR_STATE &= ~WA_SGR_MASK;
95*7c478bd9Sstevel@tonic-gate 		ATTR_STATE |= attr & WA_SGR_MASK;
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate 		/*
98*7c478bd9Sstevel@tonic-gate 		 * Only use <set_a_attributes> when <set_attributes>
99*7c478bd9Sstevel@tonic-gate 		 * is defined.  <set_a_attributes> should not disable
100*7c478bd9Sstevel@tonic-gate 		 * attributes, as this will have been handled by
101*7c478bd9Sstevel@tonic-gate 		 * <set_attributes>.
102*7c478bd9Sstevel@tonic-gate 		 * NOT TRUE - C. Bates
103*7c478bd9Sstevel@tonic-gate 		 */
104*7c478bd9Sstevel@tonic-gate 		if (set_a_attributes != NULL) {
105*7c478bd9Sstevel@tonic-gate 			p1 = (long) ISATTR(attr, WA_HORIZONTAL);
106*7c478bd9Sstevel@tonic-gate 			p2 = (long) ISATTR(attr, WA_LEFT);
107*7c478bd9Sstevel@tonic-gate 			p3 = (long) ISATTR(attr, WA_LOW);
108*7c478bd9Sstevel@tonic-gate 			p4 = (long) ISATTR(attr, WA_RIGHT);
109*7c478bd9Sstevel@tonic-gate 			p5 = (long) ISATTR(attr, WA_TOP);
110*7c478bd9Sstevel@tonic-gate 			p6 = (long) ISATTR(attr, WA_VERTICAL);
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate 			(void) TPUTS(tparm(set_a_attributes,
113*7c478bd9Sstevel@tonic-gate 				p1, p2, p3, p4, p5, p6, 0L, 0L, 0L),
114*7c478bd9Sstevel@tonic-gate 				1, putout);
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate 			ATTR_STATE &= ~WA_SGR1_MASK;
117*7c478bd9Sstevel@tonic-gate 			ATTR_STATE |= attr & WA_SGR1_MASK;
118*7c478bd9Sstevel@tonic-gate 		}
119*7c478bd9Sstevel@tonic-gate 	} else if (ATTR_STATE != attr) {
120*7c478bd9Sstevel@tonic-gate 		/* Turn off only those attributes that are on. */
121*7c478bd9Sstevel@tonic-gate 		(void) turn_off(putout, ATTR_STATE);
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate 		/*
124*7c478bd9Sstevel@tonic-gate 		 * Turn on attributes regardless if they are already
125*7c478bd9Sstevel@tonic-gate 		 * on, because terminals with ceol_standout_glitch, like
126*7c478bd9Sstevel@tonic-gate 		 * HP terminals, will have to re-enforce the current
127*7c478bd9Sstevel@tonic-gate 		 * attributes in order to change existing attribute
128*7c478bd9Sstevel@tonic-gate 		 * cookies on the screen.
129*7c478bd9Sstevel@tonic-gate 		 */
130*7c478bd9Sstevel@tonic-gate 		ATTR_STATE = turn_on(putout, attr);
131*7c478bd9Sstevel@tonic-gate 	}
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate 	/*
134*7c478bd9Sstevel@tonic-gate 	 * A_NORMAL equals 0, which is all attributes off and
135*7c478bd9Sstevel@tonic-gate 	 * COLOR_PAIR(0).  This implies that colour pair 0 is
136*7c478bd9Sstevel@tonic-gate 	 * the orig_pair.
137*7c478bd9Sstevel@tonic-gate 	 */
138*7c478bd9Sstevel@tonic-gate 	if (pair == 0) {
139*7c478bd9Sstevel@tonic-gate 		if (orig_pair != NULL) {
140*7c478bd9Sstevel@tonic-gate 			(void) TPUTS(orig_pair, 1, putout);
141*7c478bd9Sstevel@tonic-gate 		}
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate 		pair = 0;
144*7c478bd9Sstevel@tonic-gate 	} else if (pair != cur_term->_co && 0 < max_colors) {
145*7c478bd9Sstevel@tonic-gate 		short	fg, bg;
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate 		if (set_color_pair != NULL) {
148*7c478bd9Sstevel@tonic-gate 			(void) TPUTS(tparm(set_color_pair, (long) pair,
149*7c478bd9Sstevel@tonic-gate 				0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
150*7c478bd9Sstevel@tonic-gate 				1, putout);
151*7c478bd9Sstevel@tonic-gate 		} else if (pair_content(pair, &fg, &bg) == OK) {
152*7c478bd9Sstevel@tonic-gate 			if (set_a_foreground != NULL) {
153*7c478bd9Sstevel@tonic-gate 				(void) TPUTS(tparm(set_a_foreground, (long) fg,
154*7c478bd9Sstevel@tonic-gate 					0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
155*7c478bd9Sstevel@tonic-gate 					1, putout);
156*7c478bd9Sstevel@tonic-gate 			} else if (set_foreground != NULL) {
157*7c478bd9Sstevel@tonic-gate 				(void) TPUTS(tparm(set_foreground, (long) fg,
158*7c478bd9Sstevel@tonic-gate 					0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
159*7c478bd9Sstevel@tonic-gate 					1, putout);
160*7c478bd9Sstevel@tonic-gate 			}
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate 			if (set_a_background != NULL) {
163*7c478bd9Sstevel@tonic-gate 				(void) TPUTS(tparm(set_a_background, (long) bg,
164*7c478bd9Sstevel@tonic-gate 					0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
165*7c478bd9Sstevel@tonic-gate 					1, putout);
166*7c478bd9Sstevel@tonic-gate 			} else if (set_background != NULL) {
167*7c478bd9Sstevel@tonic-gate 				(void) TPUTS(tparm(set_background, (long) bg,
168*7c478bd9Sstevel@tonic-gate 					0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L),
169*7c478bd9Sstevel@tonic-gate 					1, putout);
170*7c478bd9Sstevel@tonic-gate 			}
171*7c478bd9Sstevel@tonic-gate 		}
172*7c478bd9Sstevel@tonic-gate 	}
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate 	/* Remember the current attribute state for the terminal. */
175*7c478bd9Sstevel@tonic-gate 	ATTR_STATE = attr;
176*7c478bd9Sstevel@tonic-gate 	cur_term->_co = pair;
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate 	return (OK);
179*7c478bd9Sstevel@tonic-gate }
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate static attr_t
turn_off(int (* putout)(int),attr_t attr)182*7c478bd9Sstevel@tonic-gate turn_off(int (*putout)(int), attr_t attr)
183*7c478bd9Sstevel@tonic-gate {
184*7c478bd9Sstevel@tonic-gate 	attr_t	new = attr;
185*7c478bd9Sstevel@tonic-gate 
186*7c478bd9Sstevel@tonic-gate 	if (exit_attribute_mode != NULL) {
187*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(exit_attribute_mode, 1, putout);
188*7c478bd9Sstevel@tonic-gate 		new = WA_NORMAL;
189*7c478bd9Sstevel@tonic-gate 	} else {
190*7c478bd9Sstevel@tonic-gate 		if (ISATTR(attr, WA_UNDERLINE) &&
191*7c478bd9Sstevel@tonic-gate 			exit_underline_mode != NULL) {
192*7c478bd9Sstevel@tonic-gate 			(void) TPUTS(exit_underline_mode, 1, putout);
193*7c478bd9Sstevel@tonic-gate 			new &= ~WA_UNDERLINE;
194*7c478bd9Sstevel@tonic-gate 		}
195*7c478bd9Sstevel@tonic-gate 
196*7c478bd9Sstevel@tonic-gate 		if (ISATTR(attr, WA_STANDOUT) &&
197*7c478bd9Sstevel@tonic-gate 			exit_standout_mode != NULL) {
198*7c478bd9Sstevel@tonic-gate 			(void) TPUTS(exit_standout_mode, 1, putout);
199*7c478bd9Sstevel@tonic-gate 			new &= ~WA_STANDOUT;
200*7c478bd9Sstevel@tonic-gate 		}
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate 		if (ISATTR(attr, WA_ALTCHARSET) &&
203*7c478bd9Sstevel@tonic-gate 			exit_alt_charset_mode != NULL) {
204*7c478bd9Sstevel@tonic-gate 			(void) TPUTS(exit_alt_charset_mode, 1, putout);
205*7c478bd9Sstevel@tonic-gate 			new &= ~WA_ALTCHARSET;
206*7c478bd9Sstevel@tonic-gate 		}
207*7c478bd9Sstevel@tonic-gate 	}
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate 	return (new);
210*7c478bd9Sstevel@tonic-gate }
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate static attr_t
turn_on(int (* putout)(int),attr_t attr)213*7c478bd9Sstevel@tonic-gate turn_on(int (*putout)(int), attr_t attr)
214*7c478bd9Sstevel@tonic-gate {
215*7c478bd9Sstevel@tonic-gate 	attr_t	new = attr;
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_ALTCHARSET) &&
218*7c478bd9Sstevel@tonic-gate 		enter_alt_charset_mode != NULL) {
219*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_alt_charset_mode, 1, putout);
220*7c478bd9Sstevel@tonic-gate 		new |= WA_ALTCHARSET;
221*7c478bd9Sstevel@tonic-gate 	}
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_BLINK) &&
224*7c478bd9Sstevel@tonic-gate 		enter_blink_mode != NULL) {
225*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_blink_mode, 1, putout);
226*7c478bd9Sstevel@tonic-gate 		new |= WA_BLINK;
227*7c478bd9Sstevel@tonic-gate 	}
228*7c478bd9Sstevel@tonic-gate 
229*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_BOLD) &&
230*7c478bd9Sstevel@tonic-gate 		enter_bold_mode != NULL) {
231*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_bold_mode, 1, putout);
232*7c478bd9Sstevel@tonic-gate 		new |= WA_BOLD;
233*7c478bd9Sstevel@tonic-gate 	}
234*7c478bd9Sstevel@tonic-gate 
235*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_INVIS) &&
236*7c478bd9Sstevel@tonic-gate 		enter_secure_mode != NULL) {
237*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_secure_mode, 1, putout);
238*7c478bd9Sstevel@tonic-gate 		new |= WA_INVIS;
239*7c478bd9Sstevel@tonic-gate 	}
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_DIM) &&
242*7c478bd9Sstevel@tonic-gate 		enter_dim_mode != NULL) {
243*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_dim_mode, 1, putout);
244*7c478bd9Sstevel@tonic-gate 		new |= WA_DIM;
245*7c478bd9Sstevel@tonic-gate 	}
246*7c478bd9Sstevel@tonic-gate 
247*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_PROTECT) &&
248*7c478bd9Sstevel@tonic-gate 		enter_protected_mode != NULL) {
249*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_protected_mode, 1, putout);
250*7c478bd9Sstevel@tonic-gate 		new |= WA_PROTECT;
251*7c478bd9Sstevel@tonic-gate 	}
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_REVERSE) &&
254*7c478bd9Sstevel@tonic-gate 		enter_reverse_mode != NULL) {
255*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_reverse_mode, 1, putout);
256*7c478bd9Sstevel@tonic-gate 		new |= WA_REVERSE;
257*7c478bd9Sstevel@tonic-gate 	}
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_STANDOUT) &&
260*7c478bd9Sstevel@tonic-gate 		enter_standout_mode != NULL) {
261*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_standout_mode, 1, putout);
262*7c478bd9Sstevel@tonic-gate 		new |= WA_STANDOUT;
263*7c478bd9Sstevel@tonic-gate 	}
264*7c478bd9Sstevel@tonic-gate 
265*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_UNDERLINE) &&
266*7c478bd9Sstevel@tonic-gate 		enter_underline_mode != NULL) {
267*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_underline_mode, 1, putout);
268*7c478bd9Sstevel@tonic-gate 		new |= WA_UNDERLINE;
269*7c478bd9Sstevel@tonic-gate 	}
270*7c478bd9Sstevel@tonic-gate 
271*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_HORIZONTAL) &&
272*7c478bd9Sstevel@tonic-gate 		enter_horizontal_hl_mode != NULL) {
273*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_horizontal_hl_mode, 1, putout);
274*7c478bd9Sstevel@tonic-gate 		new |= WA_HORIZONTAL;
275*7c478bd9Sstevel@tonic-gate 	}
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_LEFT) &&
278*7c478bd9Sstevel@tonic-gate 		enter_left_hl_mode != NULL) {
279*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_left_hl_mode, 1, putout);
280*7c478bd9Sstevel@tonic-gate 		new |= WA_LEFT;
281*7c478bd9Sstevel@tonic-gate 	}
282*7c478bd9Sstevel@tonic-gate 
283*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_LOW) &&
284*7c478bd9Sstevel@tonic-gate 		enter_low_hl_mode != NULL) {
285*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_low_hl_mode, 1, putout);
286*7c478bd9Sstevel@tonic-gate 		new |= WA_LOW;
287*7c478bd9Sstevel@tonic-gate 	}
288*7c478bd9Sstevel@tonic-gate 
289*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_RIGHT) &&
290*7c478bd9Sstevel@tonic-gate 		enter_right_hl_mode != NULL) {
291*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_right_hl_mode, 1, putout);
292*7c478bd9Sstevel@tonic-gate 		new |= WA_RIGHT;
293*7c478bd9Sstevel@tonic-gate 	}
294*7c478bd9Sstevel@tonic-gate 
295*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_TOP) &&
296*7c478bd9Sstevel@tonic-gate 		enter_top_hl_mode != NULL) {
297*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_top_hl_mode, 1, putout);
298*7c478bd9Sstevel@tonic-gate 		new |= WA_TOP;
299*7c478bd9Sstevel@tonic-gate 	}
300*7c478bd9Sstevel@tonic-gate 
301*7c478bd9Sstevel@tonic-gate 	if (ISATTR(attr, WA_VERTICAL) &&
302*7c478bd9Sstevel@tonic-gate 		enter_vertical_hl_mode != NULL) {
303*7c478bd9Sstevel@tonic-gate 		(void) TPUTS(enter_vertical_hl_mode, 1, putout);
304*7c478bd9Sstevel@tonic-gate 		new |= WA_VERTICAL;
305*7c478bd9Sstevel@tonic-gate 	}
306*7c478bd9Sstevel@tonic-gate 
307*7c478bd9Sstevel@tonic-gate 	return (new);
308*7c478bd9Sstevel@tonic-gate }
309