mb/google/nissa/var/glassway: Modify touch screen ILIT2901 sequence
[coreboot2.git] / payloads / libpayload / curses / PDCurses / pdcurses / deleteln.c
blob7e26d9bcde9726bf81ce7677f77eff937632f8db
1 /* Public Domain Curses */
3 #include <curspriv.h>
5 RCSID("$Id: deleteln.c,v 1.35 2008/07/13 16:08:18 wmcbrine Exp $")
7 /*man-start**************************************************************
9 Name: deleteln
11 Synopsis:
12 int deleteln(void);
13 int wdeleteln(WINDOW *win);
14 int insdelln(int n);
15 int winsdelln(WINDOW *win, int n);
16 int insertln(void);
17 int winsertln(WINDOW *win);
19 int mvdeleteln(int y, int x);
20 int mvwdeleteln(WINDOW *win, int y, int x);
21 int mvinsertln(int y, int x);
22 int mvwinsertln(WINDOW *win, int y, int x);
24 Description:
25 With the deleteln() and wdeleteln() functions, the line under
26 the cursor in the window is deleted. All lines below the
27 current line are moved up one line. The bottom line of the
28 window is cleared. The cursor position does not change.
30 With the insertln() and winsertn() functions, a blank line is
31 inserted above the current line and the bottom line is lost.
33 mvdeleteln(), mvwdeleteln(), mvinsertln() and mvwinsertln()
34 allow moving the cursor and inserting/deleting in one call.
36 Return Value:
37 All functions return OK on success and ERR on error.
39 Portability X/Open BSD SYS V
40 deleteln Y Y Y
41 wdeleteln Y Y Y
42 mvdeleteln - - -
43 mvwdeleteln - - -
44 insdelln Y - 4.0
45 winsdelln Y - 4.0
46 insertln Y Y Y
47 winsertln Y Y Y
48 mvinsertln - - -
49 mvwinsertln - - -
51 **man-end****************************************************************/
53 int wdeleteln(WINDOW *win)
55 chtype blank, *temp, *ptr;
56 int y;
58 PDC_LOG(("wdeleteln() - called\n"));
60 if (!win)
61 return ERR;
63 /* wrs (4/10/93) account for window background */
65 blank = win->_bkgd;
67 temp = win->_y[win->_cury];
69 for (y = win->_cury; y < win->_bmarg; y++)
71 win->_y[y] = win->_y[y + 1];
72 win->_firstch[y] = 0;
73 win->_lastch[y] = win->_maxx - 1;
76 for (ptr = temp; (ptr - temp < win->_maxx); ptr++)
77 *ptr = blank; /* make a blank line */
79 if (win->_cury <= win->_bmarg)
81 win->_firstch[win->_bmarg] = 0;
82 win->_lastch[win->_bmarg] = win->_maxx - 1;
83 win->_y[win->_bmarg] = temp;
86 return OK;
89 int deleteln(void)
91 PDC_LOG(("deleteln() - called\n"));
93 return wdeleteln(stdscr);
96 int mvdeleteln(int y, int x)
98 PDC_LOG(("mvdeleteln() - called\n"));
100 if (move(y, x) == ERR)
101 return ERR;
103 return wdeleteln(stdscr);
106 int mvwdeleteln(WINDOW *win, int y, int x)
108 PDC_LOG(("mvwdeleteln() - called\n"));
110 if (wmove(win, y, x) == ERR)
111 return ERR;
113 return wdeleteln(win);
116 int winsdelln(WINDOW *win, int n)
118 int i;
120 PDC_LOG(("winsdelln() - called\n"));
122 if (!win)
123 return ERR;
125 if (n > 0)
127 for (i = 0; i < n; i++)
128 if (winsertln(win) == ERR)
129 return ERR;
131 else if (n < 0)
133 n = -n;
134 for (i = 0; i < n; i++)
135 if (wdeleteln(win) == ERR)
136 return ERR;
139 return OK;
142 int insdelln(int n)
144 PDC_LOG(("insdelln() - called\n"));
146 return winsdelln(stdscr, n);
149 int winsertln(WINDOW *win)
151 chtype blank, *temp, *end;
152 int y;
154 PDC_LOG(("winsertln() - called\n"));
156 if (!win)
157 return ERR;
159 /* wrs (4/10/93) account for window background */
161 blank = win->_bkgd;
163 temp = win->_y[win->_maxy - 1];
165 for (y = win->_maxy - 1; y > win->_cury; y--)
167 win->_y[y] = win->_y[y - 1];
168 win->_firstch[y] = 0;
169 win->_lastch[y] = win->_maxx - 1;
172 win->_y[win->_cury] = temp;
174 for (end = &temp[win->_maxx - 1]; temp <= end; temp++)
175 *temp = blank;
177 win->_firstch[win->_cury] = 0;
178 win->_lastch[win->_cury] = win->_maxx - 1;
180 return OK;
183 int insertln(void)
185 PDC_LOG(("insertln() - called\n"));
187 return winsertln(stdscr);
190 int mvinsertln(int y, int x)
192 PDC_LOG(("mvinsertln() - called\n"));
194 if (move(y, x) == ERR)
195 return ERR;
197 return winsertln(stdscr);
200 int mvwinsertln(WINDOW *win, int y, int x)
202 PDC_LOG(("mvwinsertln() - called\n"));
204 if (wmove(win, y, x) == ERR)
205 return ERR;
207 return winsertln(win);