aboutsummaryrefslogtreecommitdiff
path: root/scripts/kconfig/libcurses/clear.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scripts/kconfig/libcurses/clear.c161
1 files changed, 161 insertions, 0 deletions
diff --git a/scripts/kconfig/libcurses/clear.c b/scripts/kconfig/libcurses/clear.c
new file mode 100644
index 000000000..e10b321c3
--- /dev/null
+++ b/scripts/kconfig/libcurses/clear.c
@@ -0,0 +1,161 @@
1/* PDCurses */
2
3#include "curspriv.h"
4
5/*man-start**************************************************************
6
7clear
8-----
9
10### Synopsis
11
12 int clear(void);
13 int wclear(WINDOW *win);
14 int erase(void);
15 int werase(WINDOW *win);
16 int clrtobot(void);
17 int wclrtobot(WINDOW *win);
18 int clrtoeol(void);
19 int wclrtoeol(WINDOW *win);
20
21### Description
22
23 erase() and werase() copy blanks (i.e. the background chtype) to
24 every cell of the window.
25
26 clear() and wclear() are similar to erase() and werase(), but they
27 also call clearok() to ensure that the the window is cleared on the
28 next wrefresh().
29
30 clrtobot() and wclrtobot() clear the window from the current cursor
31 position to the end of the window.
32
33 clrtoeol() and wclrtoeol() clear the window from the current cursor
34 position to the end of the current line.
35
36### Return Value
37
38 All functions return OK on success and ERR on error.
39
40### Portability
41
42 Function | X/Open | ncurses | NetBSD
43 :---------------------|:------:|:-------:|:------:
44 clear | Y | Y | Y
45 wclear | Y | Y | Y
46 erase | Y | Y | Y
47 werase | Y | Y | Y
48 clrtobot | Y | Y | Y
49 wclrtobot | Y | Y | Y
50 clrtoeol | Y | Y | Y
51 wclrtoeol | Y | Y | Y
52
53**man-end****************************************************************/
54
55int wclrtoeol(WINDOW *win)
56{
57 int x, y, minx;
58 chtype blank, *ptr;
59
60 PDC_LOG(("wclrtoeol() - called: Row: %d Col: %d\n",
61 win->_cury, win->_curx));
62
63 if (!win)
64 return ERR;
65
66 y = win->_cury;
67 x = win->_curx;
68
69 /* wrs (4/10/93) account for window background */
70
71 blank = win->_bkgd;
72
73 for (minx = x, ptr = &win->_y[y][x]; minx < win->_maxx; minx++, ptr++)
74 *ptr = blank;
75
76 if (x < win->_firstch[y] || win->_firstch[y] == _NO_CHANGE)
77 win->_firstch[y] = x;
78
79 win->_lastch[y] = win->_maxx - 1;
80
81 PDC_sync(win);
82 return OK;
83}
84
85int clrtoeol(void)
86{
87 PDC_LOG(("clrtoeol() - called\n"));
88
89 return wclrtoeol(stdscr);
90}
91
92int wclrtobot(WINDOW *win)
93{
94 int savey, savex;
95
96 PDC_LOG(("wclrtobot() - called\n"));
97
98 if (!win)
99 return ERR;
100
101 savey = win->_cury;
102 savex = win->_curx;
103
104 /* should this involve scrolling region somehow ? */
105
106 if (win->_cury + 1 < win->_maxy)
107 {
108 win->_curx = 0;
109 win->_cury++;
110 for (; win->_maxy > win->_cury; win->_cury++)
111 wclrtoeol(win);
112 win->_cury = savey;
113 win->_curx = savex;
114 }
115 wclrtoeol(win);
116
117 PDC_sync(win);
118 return OK;
119}
120
121int clrtobot(void)
122{
123 PDC_LOG(("clrtobot() - called\n"));
124
125 return wclrtobot(stdscr);
126}
127
128int werase(WINDOW *win)
129{
130 PDC_LOG(("werase() - called\n"));
131
132 if (wmove(win, 0, 0) == ERR)
133 return ERR;
134
135 return wclrtobot(win);
136}
137
138int erase(void)
139{
140 PDC_LOG(("erase() - called\n"));
141
142 return werase(stdscr);
143}
144
145int wclear(WINDOW *win)
146{
147 PDC_LOG(("wclear() - called\n"));
148
149 if (!win)
150 return ERR;
151
152 win->_clear = TRUE;
153 return werase(win);
154}
155
156int clear(void)
157{
158 PDC_LOG(("clear() - called\n"));
159
160 return wclear(stdscr);
161}