GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libcurses/widechar/lib_box_set.c Lines: 0 29 0.0 %
Date: 2017-11-07 Branches: 0 22 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: lib_box_set.c,v 1.1 2010/09/06 17:26:17 nicm Exp $ */
2
3
/****************************************************************************
4
 * Copyright (c) 2002 Free Software Foundation, Inc.                        *
5
 *                                                                          *
6
 * Permission is hereby granted, free of charge, to any person obtaining a  *
7
 * copy of this software and associated documentation files (the            *
8
 * "Software"), to deal in the Software without restriction, including      *
9
 * without limitation the rights to use, copy, modify, merge, publish,      *
10
 * distribute, distribute with modifications, sublicense, and/or sell       *
11
 * copies of the Software, and to permit persons to whom the Software is    *
12
 * furnished to do so, subject to the following conditions:                 *
13
 *                                                                          *
14
 * The above copyright notice and this permission notice shall be included  *
15
 * in all copies or substantial portions of the Software.                   *
16
 *                                                                          *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20
 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24
 *                                                                          *
25
 * Except as contained in this notice, the name(s) of the above copyright   *
26
 * holders shall not be used in advertising or otherwise to promote the     *
27
 * sale, use or other dealings in this Software without prior written       *
28
 * authorization.                                                           *
29
 ****************************************************************************/
30
31
/****************************************************************************
32
 * Authors: Sven Verdoolaege and Thomas Dickey 2001,2002                    *
33
 ****************************************************************************/
34
35
/*
36
**	lib_box_set.c
37
**
38
**	The routine wborder_set().
39
**
40
*/
41
42
#include <curses.priv.h>
43
44
MODULE_ID("$Id: lib_box_set.c,v 1.1 2010/09/06 17:26:17 nicm Exp $")
45
46
NCURSES_EXPORT(int)
47
wborder_set(WINDOW *win,
48
	    const ARG_CH_T ls, const ARG_CH_T rs,
49
	    const ARG_CH_T ts, const ARG_CH_T bs,
50
	    const ARG_CH_T tl, const ARG_CH_T tr,
51
	    const ARG_CH_T bl, const ARG_CH_T br)
52
{
53
    NCURSES_SIZE_T i;
54
    NCURSES_SIZE_T endx, endy;
55
    NCURSES_CH_T wls, wrs, wts, wbs, wtl, wtr, wbl, wbr;
56
57
    T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
58
       win,
59
       _tracech_t2(1, ls),
60
       _tracech_t2(2, rs),
61
       _tracech_t2(3, ts),
62
       _tracech_t2(4, bs),
63
       _tracech_t2(5, tl),
64
       _tracech_t2(6, tr),
65
       _tracech_t2(7, bl),
66
       _tracech_t2(8, br)));
67
68
    if (!win)
69
	returnCode(ERR);
70
71
#define RENDER_WITH_DEFAULT(ch,def) w ##ch = _nc_render(win, (ch == 0) ? *(const ARG_CH_T)def : *ch)
72
73
    RENDER_WITH_DEFAULT(ls, WACS_VLINE);
74
    RENDER_WITH_DEFAULT(rs, WACS_VLINE);
75
    RENDER_WITH_DEFAULT(ts, WACS_HLINE);
76
    RENDER_WITH_DEFAULT(bs, WACS_HLINE);
77
    RENDER_WITH_DEFAULT(tl, WACS_ULCORNER);
78
    RENDER_WITH_DEFAULT(tr, WACS_URCORNER);
79
    RENDER_WITH_DEFAULT(bl, WACS_LLCORNER);
80
    RENDER_WITH_DEFAULT(br, WACS_LRCORNER);
81
82
    T(("using %s, %s, %s, %s, %s, %s, %s, %s",
83
       _tracech_t2(1, CHREF(wls)),
84
       _tracech_t2(2, CHREF(wrs)),
85
       _tracech_t2(3, CHREF(wts)),
86
       _tracech_t2(4, CHREF(wbs)),
87
       _tracech_t2(5, CHREF(wtl)),
88
       _tracech_t2(6, CHREF(wtr)),
89
       _tracech_t2(7, CHREF(wbl)),
90
       _tracech_t2(8, CHREF(wbr))));
91
92
    endx = win->_maxx;
93
    endy = win->_maxy;
94
95
    for (i = 0; i <= endx; i++) {
96
	win->_line[0].text[i] = wts;
97
	win->_line[endy].text[i] = wbs;
98
    }
99
    win->_line[endy].firstchar = win->_line[0].firstchar = 0;
100
    win->_line[endy].lastchar = win->_line[0].lastchar = endx;
101
102
    for (i = 0; i <= endy; i++) {
103
	win->_line[i].text[0] = wls;
104
	win->_line[i].text[endx] = wrs;
105
	win->_line[i].firstchar = 0;
106
	win->_line[i].lastchar = endx;
107
    }
108
    win->_line[0].text[0] = wtl;
109
    win->_line[0].text[endx] = wtr;
110
    win->_line[endy].text[0] = wbl;
111
    win->_line[endy].text[endx] = wbr;
112
113
    _nc_synchook(win);
114
    returnCode(OK);
115
}