1 /* $NetBSD: border.c,v 1.15 2013/05/05 14:23:16 jdc Exp $ */
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
34 __RCSID("$NetBSD: border.c,v 1.15 2013/05/05 14:23:16 jdc Exp $");
41 #include "curses_private.h"
43 #ifndef _CURSES_USE_MACROS
47 * Draw a border around stdscr using the specified
48 * delimiting characters.
51 border(chtype left
, chtype right
, chtype top
, chtype bottom
, chtype topleft
,
52 chtype topright
, chtype botleft
, chtype botright
)
54 return wborder(stdscr
, left
, right
, top
, bottom
, topleft
, topright
,
62 * Draw a border around the given window using the specified delimiting
66 wborder(WINDOW
*win
, chtype left
, chtype right
, chtype top
, chtype bottom
,
67 chtype topleft
, chtype topright
, chtype botleft
, chtype botright
)
73 if (!(left
& __CHARTEXT
))
75 if (!(right
& __CHARTEXT
))
77 if (!(top
& __CHARTEXT
))
79 if (!(bottom
& __CHARTEXT
))
81 if (!(topleft
& __CHARTEXT
))
82 topleft
|= ACS_ULCORNER
;
83 if (!(topright
& __CHARTEXT
))
84 topright
|= ACS_URCORNER
;
85 if (!(botleft
& __CHARTEXT
))
86 botleft
|= ACS_LLCORNER
;
87 if (!(botright
& __CHARTEXT
))
88 botright
|= ACS_LRCORNER
;
91 __CTRACE(__CTRACE_INPUT
, "wborder: left = %c, 0x%x\n",
92 left
& __CHARTEXT
, left
& __ATTRIBUTES
);
93 __CTRACE(__CTRACE_INPUT
, "wborder: right = %c, 0x%x\n",
94 right
& __CHARTEXT
, right
& __ATTRIBUTES
);
95 __CTRACE(__CTRACE_INPUT
, "wborder: top = %c, 0x%x\n",
96 top
& __CHARTEXT
, top
& __ATTRIBUTES
);
97 __CTRACE(__CTRACE_INPUT
, "wborder: bottom = %c, 0x%x\n",
98 bottom
& __CHARTEXT
, bottom
& __ATTRIBUTES
);
99 __CTRACE(__CTRACE_INPUT
, "wborder: topleft = %c, 0x%x\n",
100 topleft
& __CHARTEXT
, topleft
& __ATTRIBUTES
);
101 __CTRACE(__CTRACE_INPUT
, "wborder: topright = %c, 0x%x\n",
102 topright
& __CHARTEXT
, topright
& __ATTRIBUTES
);
103 __CTRACE(__CTRACE_INPUT
, "wborder: botleft = %c, 0x%x\n",
104 botleft
& __CHARTEXT
, botleft
& __ATTRIBUTES
);
105 __CTRACE(__CTRACE_INPUT
, "wborder: botright = %c, 0x%x\n",
106 botright
& __CHARTEXT
, botright
& __ATTRIBUTES
);
109 /* Merge window and background attributes */
110 left
|= (left
& __COLOR
) ? (win
->wattr
& ~__COLOR
) : win
->wattr
;
111 left
|= (left
& __COLOR
) ? (win
->battr
& ~__COLOR
) : win
->battr
;
112 right
|= (right
& __COLOR
) ? (win
->wattr
& ~__COLOR
) : win
->wattr
;
113 right
|= (right
& __COLOR
) ? (win
->battr
& ~__COLOR
) : win
->battr
;
114 top
|= (top
& __COLOR
) ? (win
->wattr
& ~__COLOR
) : win
->wattr
;
115 top
|= (top
& __COLOR
) ? (win
->battr
& ~__COLOR
) : win
->battr
;
116 bottom
|= (bottom
& __COLOR
) ? (win
->wattr
& ~__COLOR
) : win
->wattr
;
117 bottom
|= (bottom
& __COLOR
) ? (win
->battr
& ~__COLOR
) : win
->battr
;
118 topleft
|= (topleft
& __COLOR
) ? (win
->wattr
& ~__COLOR
) : win
->wattr
;
119 topleft
|= (topleft
& __COLOR
) ? (win
->battr
& ~__COLOR
) : win
->battr
;
120 topright
|= (topright
& __COLOR
) ? (win
->wattr
& ~__COLOR
) : win
->wattr
;
121 topright
|= (topright
& __COLOR
) ? (win
->battr
& ~__COLOR
) : win
->battr
;
122 botleft
|= (botleft
& __COLOR
) ? (win
->wattr
& ~__COLOR
) : win
->wattr
;
123 botleft
|= (botleft
& __COLOR
) ? (win
->battr
& ~__COLOR
) : win
->battr
;
124 botright
|= (botright
& __COLOR
) ? (win
->wattr
& ~__COLOR
) : win
->wattr
;
125 botright
|= (botright
& __COLOR
) ? (win
->battr
& ~__COLOR
) : win
->battr
;
127 endx
= win
->maxx
- 1;
128 endy
= win
->maxy
- 1;
129 fp
= win
->alines
[0]->line
;
130 lp
= win
->alines
[endy
]->line
;
133 for (i
= 1; i
< endy
; i
++) {
134 win
->alines
[i
]->line
[0].ch
= (wchar_t) left
& __CHARTEXT
;
135 win
->alines
[i
]->line
[0].attr
= (attr_t
) left
& __ATTRIBUTES
;
136 win
->alines
[i
]->line
[endx
].ch
= (wchar_t) right
& __CHARTEXT
;
137 win
->alines
[i
]->line
[endx
].attr
= (attr_t
) right
& __ATTRIBUTES
;
139 for (i
= 1; i
< endx
; i
++) {
140 fp
[i
].ch
= (wchar_t) top
& __CHARTEXT
;
141 fp
[i
].attr
= (attr_t
) top
& __ATTRIBUTES
;
142 lp
[i
].ch
= (wchar_t) bottom
& __CHARTEXT
;
143 lp
[i
].attr
= (attr_t
) bottom
& __ATTRIBUTES
;
147 if (!(win
->maxx
== LINES
&& win
->maxy
== COLS
&&
148 (win
->flags
& __SCROLLOK
) && (win
->flags
& __SCROLLWIN
))) {
149 fp
[0].ch
= (wchar_t) topleft
& __CHARTEXT
;
150 fp
[0].attr
= (attr_t
) topleft
& __ATTRIBUTES
;
151 fp
[endx
].ch
= (wchar_t) topright
& __CHARTEXT
;
152 fp
[endx
].attr
= (attr_t
) topright
& __ATTRIBUTES
;
153 lp
[0].ch
= (wchar_t) botleft
& __CHARTEXT
;
154 lp
[0].attr
= (attr_t
) botleft
& __ATTRIBUTES
;
155 lp
[endx
].ch
= (wchar_t) botright
& __CHARTEXT
;
156 lp
[endx
].attr
= (attr_t
) botright
& __ATTRIBUTES
;
160 #else /* HAVE_WCHAR */
161 cchar_t ls
, rs
, ts
, bs
, tl
, tr
, bl
, br
;
162 cchar_t
*lsp
, *rsp
, *tsp
, *bsp
, *tlp
, *trp
, *blp
, *brp
;
164 #define S(in, out, def) \
165 if (in & __CHARTEXT) { \
166 __cursesi_chtype_to_cchar(in, &out); \
168 memcpy(&out, def, sizeof(cchar_t)); \
169 out.attributes |= in & __ATTRIBUTES; \
173 S(left
, ls
, WACS_VLINE
);
174 S(right
, rs
, WACS_VLINE
);
175 S(top
, ts
, WACS_HLINE
);
176 S(bottom
, bs
, WACS_HLINE
);
177 S(topleft
, tl
, WACS_ULCORNER
);
178 S(topright
, tr
, WACS_URCORNER
);
179 S(botleft
, bl
, WACS_LLCORNER
);
180 S(botright
, br
, WACS_LRCORNER
);
182 return wborder_set(win
, lsp
, rsp
, tsp
, bsp
, tlp
, trp
, blp
, brp
);
183 #endif /* HAVE_WCHAR */
186 int border_set(const cchar_t
*ls
, const cchar_t
*rs
, const cchar_t
*ts
,
187 const cchar_t
*bs
, const cchar_t
*tl
, const cchar_t
*tr
,
188 const cchar_t
*bl
, const cchar_t
*br
)
193 return wborder_set(stdscr
, ls
, rs
, ts
, bs
, tl
, tr
, bl
, br
);
194 #endif /* HAVE_WCHAR */
197 int wborder_set(WINDOW
*win
, const cchar_t
*ls
, const cchar_t
*rs
,
198 const cchar_t
*ts
, const cchar_t
*bs
,
199 const cchar_t
*tl
, const cchar_t
*tr
,
200 const cchar_t
*bl
, const cchar_t
*br
)
205 int endy
, endx
, i
, j
, k
, cw
, pcw
, tlcw
, blcw
, trcw
, brcw
;
206 cchar_t left
, right
, bottom
, top
, topleft
, topright
, botleft
, botright
;
209 if ( ls
&& wcwidth( ls
->vals
[ 0 ]))
210 memcpy( &left
, ls
, sizeof( cchar_t
));
212 memcpy( &left
, WACS_VLINE
, sizeof( cchar_t
));
213 if ( rs
&& wcwidth( rs
->vals
[ 0 ]))
214 memcpy( &right
, rs
, sizeof( cchar_t
));
216 memcpy( &right
, WACS_VLINE
, sizeof( cchar_t
));
217 if ( ts
&& wcwidth( ts
->vals
[ 0 ]))
218 memcpy( &top
, ts
, sizeof( cchar_t
));
220 memcpy( &top
, WACS_HLINE
, sizeof( cchar_t
));
221 if ( bs
&& wcwidth( bs
->vals
[ 0 ]))
222 memcpy( &bottom
, bs
, sizeof( cchar_t
));
224 memcpy( &bottom
, WACS_HLINE
, sizeof( cchar_t
));
225 if ( tl
&& wcwidth( tl
->vals
[ 0 ]))
226 memcpy( &topleft
, tl
, sizeof( cchar_t
));
228 memcpy( &topleft
, WACS_ULCORNER
, sizeof( cchar_t
));
229 if ( tr
&& wcwidth( tr
->vals
[ 0 ]))
230 memcpy( &topright
, tr
, sizeof( cchar_t
));
232 memcpy( &topright
, WACS_URCORNER
, sizeof( cchar_t
));
233 if ( bl
&& wcwidth( bl
->vals
[ 0 ]))
234 memcpy( &botleft
, bl
, sizeof( cchar_t
));
236 memcpy( &botleft
, WACS_LLCORNER
, sizeof( cchar_t
));
237 if ( br
&& wcwidth( br
->vals
[ 0 ]))
238 memcpy( &botright
, br
, sizeof( cchar_t
));
240 memcpy( &botright
, WACS_LRCORNER
, sizeof( cchar_t
));
243 __CTRACE(__CTRACE_INPUT
, "wborder_set: left = %c, 0x%x\n",
244 left
.vals
[0], left
.attributes
);
245 __CTRACE(__CTRACE_INPUT
, "wborder_set: right = %c, 0x%x\n",
246 right
.vals
[0], right
.attributes
);
247 __CTRACE(__CTRACE_INPUT
, "wborder_set: top = %c, 0x%x\n",
248 top
.vals
[0], top
.attributes
);
249 __CTRACE(__CTRACE_INPUT
, "wborder_set: bottom = %c, 0x%x\n",
250 bottom
.vals
[0], bottom
.attributes
);
251 __CTRACE(__CTRACE_INPUT
, "wborder_set: topleft = %c, 0x%x\n",
252 topleft
.vals
[0], topleft
.attributes
);
253 __CTRACE(__CTRACE_INPUT
, "wborder_set: topright = %c, 0x%x\n",
254 topright
.vals
[0], topright
.attributes
);
255 __CTRACE(__CTRACE_INPUT
, "wborder_set: botleft = %c, 0x%x\n",
256 botleft
.vals
[0], botleft
.attributes
);
257 __CTRACE(__CTRACE_INPUT
, "wborder_set: botright = %c, 0x%x\n",
258 botright
.vals
[0], botright
.attributes
);
261 /* Merge window attributes */
262 left
.attributes
|= (left
.attributes
& __COLOR
) ?
263 (win
->wattr
& ~__COLOR
) : win
->wattr
;
264 left
.attributes
|= (left
.attributes
& __COLOR
) ?
265 (win
->battr
& ~__COLOR
) : win
->battr
;
266 right
.attributes
|= (right
.attributes
& __COLOR
) ?
267 (win
->wattr
& ~__COLOR
) : win
->wattr
;
268 right
.attributes
|= (right
.attributes
& __COLOR
) ?
269 (win
->battr
& ~__COLOR
) : win
->battr
;
270 top
.attributes
|= (top
.attributes
& __COLOR
) ?
271 (win
->wattr
& ~__COLOR
) : win
->wattr
;
272 top
.attributes
|= (top
.attributes
& __COLOR
) ?
273 (win
->battr
& ~__COLOR
) : win
->battr
;
274 bottom
.attributes
|= (bottom
.attributes
& __COLOR
) ?
275 (win
->wattr
& ~__COLOR
) : win
->wattr
;
276 bottom
.attributes
|= (bottom
.attributes
& __COLOR
) ?
277 (win
->battr
& ~__COLOR
) : win
->battr
;
278 topleft
.attributes
|= (topleft
.attributes
& __COLOR
) ?
279 (win
->wattr
& ~__COLOR
) : win
->wattr
;
280 topleft
.attributes
|= (topleft
.attributes
& __COLOR
) ?
281 (win
->battr
& ~__COLOR
) : win
->battr
;
282 topright
.attributes
|= (topright
.attributes
& __COLOR
) ?
283 (win
->wattr
& ~__COLOR
) : win
->wattr
;
284 topright
.attributes
|= (topright
.attributes
& __COLOR
) ?
285 (win
->battr
& ~__COLOR
) : win
->battr
;
286 botleft
.attributes
|= (botleft
.attributes
& __COLOR
) ?
287 (win
->wattr
& ~__COLOR
) : win
->wattr
;
288 botleft
.attributes
|= (botleft
.attributes
& __COLOR
) ?
289 (win
->battr
& ~__COLOR
) : win
->battr
;
290 botright
.attributes
|= (botright
.attributes
& __COLOR
) ?
291 (win
->wattr
& ~__COLOR
) : win
->wattr
;
292 botright
.attributes
|= (botright
.attributes
& __COLOR
) ?
293 (win
->battr
& ~__COLOR
) : win
->battr
;
295 endx
= win
->maxx
- 1;
296 endy
= win
->maxy
- 1;
299 for (i
= 1; i
< endy
; i
++) {
301 cw
= wcwidth( left
.vals
[ 0 ]);
304 for ( j
= 0; j
< cw
; j
++ ) {
305 win
->alines
[i
]->line
[j
].ch
= left
.vals
[ 0 ];
306 win
->alines
[i
]->line
[j
].attr
= left
.attributes
;
307 np
= win
->alines
[i
]->line
[j
].nsp
;
314 win
->alines
[i
]->line
[j
].nsp
= NULL
;
317 SET_WCOL( win
->alines
[i
]->line
[j
], -j
);
319 SET_WCOL( win
->alines
[i
]->line
[j
], cw
);
320 if ( left
.elements
> 1 ) {
321 for (k
= 1; k
< left
.elements
; k
++) {
322 np
= (nschar_t
*)malloc(sizeof(nschar_t
));
325 np
->ch
= left
.vals
[ k
];
326 np
->next
= win
->alines
[i
]->line
[j
].nsp
;
327 win
->alines
[i
]->line
[j
].nsp
333 for ( j
= cw
; WCOL( win
->alines
[i
]->line
[j
]) < 0; j
++ ) {
335 __CTRACE(__CTRACE_INPUT
,
336 "wborder_set: clean out partial char[%d]", j
);
338 win
->alines
[i
]->line
[j
].ch
= ( wchar_t )btowc(win
->bch
);
339 if (_cursesi_copy_nsp(win
->bnsp
,
340 &win
->alines
[i
]->line
[j
]) == ERR
)
342 SET_WCOL( win
->alines
[i
]->line
[j
], 1 );
345 cw
= wcwidth( right
.vals
[ 0 ]);
348 pcw
= WCOL( win
->alines
[i
]->line
[endx
- cw
]);
349 for ( j
= endx
- cw
+ 1; j
<= endx
; j
++ ) {
350 win
->alines
[i
]->line
[j
].ch
= right
.vals
[ 0 ];
351 win
->alines
[i
]->line
[j
].attr
= right
.attributes
;
352 np
= win
->alines
[i
]->line
[j
].nsp
;
359 win
->alines
[i
]->line
[j
].nsp
= NULL
;
361 if ( j
== endx
- cw
+ 1 ) {
362 SET_WCOL( win
->alines
[i
]->line
[j
], cw
);
363 if ( right
.elements
> 1 ) {
364 for (k
= 1; k
< right
.elements
; k
++) {
365 np
= (nschar_t
*)malloc(sizeof(nschar_t
));
368 np
->ch
= right
.vals
[ k
];
369 np
->next
= win
->alines
[i
]->line
[j
].nsp
;
370 win
->alines
[i
]->line
[j
].nsp
375 SET_WCOL( win
->alines
[i
]->line
[j
],
380 __CTRACE(__CTRACE_INPUT
,
381 "wborder_set: clean out partial chars[%d:%d]",
382 endx
- cw
+ pcw
, endx
- cw
);
384 k
= pcw
< 0 ? endx
-cw
+ pcw
: endx
- cw
;
385 for ( j
= endx
- cw
; j
>= k
; j
-- ) {
386 win
->alines
[i
]->line
[j
].ch
387 = (wchar_t)btowc(win
->bch
);
388 if (_cursesi_copy_nsp(win
->bnsp
,
389 &win
->alines
[i
]->line
[j
]) == ERR
)
391 win
->alines
[i
]->line
[j
].attr
= win
->battr
;
392 SET_WCOL( win
->alines
[i
]->line
[j
], 1 );
396 tlcw
= wcwidth( topleft
.vals
[ 0 ]);
399 blcw
= wcwidth( botleft
.vals
[ 0 ]);
402 trcw
= wcwidth( topright
.vals
[ 0 ]);
405 brcw
= wcwidth( botright
.vals
[ 0 ]);
409 cw
= wcwidth( top
.vals
[ 0 ]);
412 for (i
= tlcw
; i
<= min( endx
- cw
, endx
- trcw
); i
+= cw
) {
413 for ( j
= 0; j
< cw
; j
++ ) {
414 win
->alines
[ 0 ]->line
[i
+ j
].ch
= top
.vals
[ 0 ];
415 win
->alines
[ 0 ]->line
[i
+ j
].attr
= top
.attributes
;
416 np
= win
->alines
[ 0 ]->line
[i
+ j
].nsp
;
423 win
->alines
[ 0 ]->line
[i
+ j
].nsp
= NULL
;
426 SET_WCOL( win
->alines
[ 0 ]->line
[ i
+ j
], -j
);
428 SET_WCOL( win
->alines
[ 0 ]->line
[ i
+ j
], cw
);
429 if ( top
.elements
> 1 ) {
430 for ( k
= 1; k
< top
.elements
; k
++ ) {
431 np
= (nschar_t
*)malloc(sizeof(nschar_t
));
434 np
->ch
= top
.vals
[ k
];
435 np
->next
= win
->alines
[0]->line
[i
+ j
].nsp
;
436 win
->alines
[0]->line
[i
+ j
].nsp
443 while ( i
<= endx
- trcw
) {
444 win
->alines
[0]->line
[i
].ch
=
445 ( wchar_t )btowc(( int ) win
->bch
);
446 if (_cursesi_copy_nsp(win
->bnsp
,
447 &win
->alines
[0]->line
[i
]) == ERR
)
449 win
->alines
[ 0 ]->line
[ i
].attr
= win
->battr
;
450 SET_WCOL( win
->alines
[ 0 ]->line
[ i
], 1 );
454 for (i
= blcw
; i
<= min( endx
- cw
, endx
- brcw
); i
+= cw
) {
455 for ( j
= 0; j
< cw
; j
++ ) {
456 win
->alines
[ endy
]->line
[i
+ j
].ch
= bottom
.vals
[ 0 ];
457 win
->alines
[endy
]->line
[i
+ j
].attr
= bottom
.attributes
;
458 np
= win
->alines
[ endy
]->line
[i
+ j
].nsp
;
465 win
->alines
[ endy
]->line
[i
+ j
].nsp
= NULL
;
468 SET_WCOL( win
->alines
[endy
]->line
[i
+ j
], -j
);
470 SET_WCOL( win
->alines
[endy
]->line
[i
+ j
], cw
);
471 if ( bottom
.elements
> 1 ) {
472 for ( k
= 1; k
< bottom
.elements
;
474 if ( !( np
= ( nschar_t
*)malloc( sizeof( nschar_t
))))
476 np
->ch
= bottom
.vals
[ k
];
477 np
->next
= win
->alines
[endy
]->line
[i
+ j
].nsp
;
478 win
->alines
[endy
]->line
[i
+ j
].nsp
= np
;
484 while ( i
<= endx
- brcw
) {
485 win
->alines
[endy
]->line
[i
].ch
=
486 (wchar_t)btowc((int) win
->bch
);
487 if (_cursesi_copy_nsp(win
->bnsp
,
488 &win
->alines
[endy
]->line
[i
]) == ERR
)
490 win
->alines
[ endy
]->line
[ i
].attr
= win
->battr
;
491 SET_WCOL( win
->alines
[ endy
]->line
[ i
], 1 );
496 if (!(win
->maxx
== LINES
&& win
->maxy
== COLS
&&
497 (win
->flags
& __SCROLLOK
) && (win
->flags
& __SCROLLWIN
))) {
498 for ( i
= 0; i
< tlcw
; i
++ ) {
499 win
->alines
[ 0 ]->line
[i
].ch
= topleft
.vals
[ 0 ];
500 win
->alines
[ 0 ]->line
[i
].attr
= topleft
.attributes
;
501 np
= win
->alines
[ 0 ]->line
[i
].nsp
;
508 win
->alines
[ 0 ]->line
[i
].nsp
= NULL
;
511 SET_WCOL( win
->alines
[ 0 ]->line
[ i
], -i
);
513 SET_WCOL( win
->alines
[ 0 ]->line
[ i
], tlcw
);
514 if ( topleft
.elements
> 1 ) {
515 for ( k
= 1; k
< topleft
.elements
;
517 np
= (nschar_t
*)malloc(sizeof(nschar_t
));
520 np
->ch
= topleft
.vals
[ k
];
521 np
->next
= win
->alines
[ 0 ]->line
[i
].nsp
;
522 win
->alines
[ 0 ]->line
[i
].nsp
528 for ( i
= endx
- trcw
+ 1; i
<= endx
; i
++ ) {
529 win
->alines
[ 0 ]->line
[i
].ch
= topright
.vals
[ 0 ];
530 win
->alines
[ 0 ]->line
[i
].attr
= topright
.attributes
;
531 np
= win
->alines
[ 0 ]->line
[i
].nsp
;
538 win
->alines
[ 0 ]->line
[i
].nsp
= NULL
;
540 if ( i
== endx
- trcw
+ 1 ) {
541 SET_WCOL( win
->alines
[ 0 ]->line
[ i
], trcw
);
542 if ( topright
.elements
> 1 ) {
543 for ( k
= 1; k
< topright
.elements
;
545 np
= (nschar_t
*)malloc(sizeof(nschar_t
));
548 np
->ch
= topright
.vals
[ k
];
549 np
->next
= win
->alines
[0]->line
[i
].nsp
;
550 win
->alines
[ 0 ]->line
[i
].nsp
555 SET_WCOL( win
->alines
[ 0 ]->line
[ i
],
556 endx
- trcw
+ 1 - i
);
558 for ( i
= 0; i
< blcw
; i
++ ) {
559 win
->alines
[ endy
]->line
[i
].ch
= botleft
.vals
[ 0 ];
560 win
->alines
[ endy
]->line
[i
].attr
= botleft
.attributes
;
561 np
= win
->alines
[ endy
]->line
[i
].nsp
;
568 win
->alines
[ endy
]->line
[i
].nsp
= NULL
;
571 SET_WCOL( win
->alines
[endy
]->line
[i
], -i
);
573 SET_WCOL( win
->alines
[endy
]->line
[i
], blcw
);
574 if ( botleft
.elements
> 1 ) {
575 for ( k
= 1; k
< botleft
.elements
;
577 np
= (nschar_t
*)malloc(sizeof(nschar_t
));
580 np
->ch
= botleft
.vals
[ k
];
581 np
->next
= win
->alines
[endy
]->line
[i
].nsp
;
582 win
->alines
[endy
]->line
[i
].nsp
588 for ( i
= endx
- brcw
+ 1; i
<= endx
; i
++ ) {
589 win
->alines
[ endy
]->line
[i
].ch
= botright
.vals
[ 0 ];
590 win
->alines
[ endy
]->line
[i
].attr
= botright
.attributes
;
591 np
= win
->alines
[ endy
]->line
[i
].nsp
;
598 win
->alines
[ endy
]->line
[i
].nsp
= NULL
;
600 if ( i
== endx
- brcw
+ 1 ) {
601 SET_WCOL( win
->alines
[ endy
]->line
[ i
],
603 if ( botright
.elements
> 1 ) {
604 for ( k
= 1; k
< botright
.elements
; k
++ ) {
605 np
= (nschar_t
*)malloc(sizeof(nschar_t
));
608 np
->ch
= botright
.vals
[ k
];
609 np
->next
= win
->alines
[endy
]->line
[i
].nsp
;
610 win
->alines
[endy
]->line
[i
].nsp
615 SET_WCOL( win
->alines
[ endy
]->line
[ i
],
616 endx
- brcw
+ 1 - i
);
621 #endif /* HAVE_WCHAR */