pdcurses/clear.c

Wed, 27 Jan 2021 12:34:26 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 27 Jan 2021 12:34:26 +0200
branch
protocol5
changeset 171
d0fba0d7ad03
parent 97
2d43f05b284c
permissions
-rw-r--r--

remove the packet queue for now

97
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
1 /* Public Domain Curses */
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
2
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
3 #include <curspriv.h>
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
4
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
5 RCSID("$Id: clear.c,v 1.35 2008/07/13 16:08:18 wmcbrine Exp $")
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
6
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
7 /*man-start**************************************************************
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
8
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
9 Name: clear
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
10
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
11 Synopsis:
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
12 int clear(void);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
13 int wclear(WINDOW *win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
14 int erase(void);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
15 int werase(WINDOW *win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
16 int clrtobot(void);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
17 int wclrtobot(WINDOW *win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
18 int clrtoeol(void);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
19 int wclrtoeol(WINDOW *win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
20
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
21 Description:
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
22 erase() and werase() copy blanks (i.e. the background chtype) to
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
23 every cell of the window.
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
24
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
25 clear() and wclear() are similar to erase() and werase(), but
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
26 they also call clearok() to ensure that the the window is
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
27 cleared on the next wrefresh().
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
28
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
29 clrtobot() and wclrtobot() clear the window from the current
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
30 cursor position to the end of the window.
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
31
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
32 clrtoeol() and wclrtoeol() clear the window from the current
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
33 cursor position to the end of the current line.
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
34
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
35 Return Value:
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
36 All functions return OK on success and ERR on error.
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
37
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
38 Portability X/Open BSD SYS V
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
39 clear Y Y Y
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
40 wclear Y Y Y
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
41 erase Y Y Y
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
42 werase Y Y Y
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
43 clrtobot Y Y Y
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
44 wclrtobot Y Y Y
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
45 clrtoeol Y Y Y
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
46 wclrtoeol Y Y Y
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
47
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
48 **man-end****************************************************************/
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
49
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
50 int wclrtoeol(WINDOW *win)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
51 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
52 int x, y, minx;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
53 chtype blank, *ptr;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
54
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
55 PDC_LOG(("wclrtoeol() - called: Row: %d Col: %d\n",
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
56 win->_cury, win->_curx));
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
57
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
58 if (!win)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
59 return ERR;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
60
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
61 y = win->_cury;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
62 x = win->_curx;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
63
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
64 /* wrs (4/10/93) account for window background */
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
65
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
66 blank = win->_bkgd;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
67
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
68 for (minx = x, ptr = &win->_y[y][x]; minx < win->_maxx; minx++, ptr++)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
69 *ptr = blank;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
70
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
71 if (x < win->_firstch[y] || win->_firstch[y] == _NO_CHANGE)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
72 win->_firstch[y] = x;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
73
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
74 win->_lastch[y] = win->_maxx - 1;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
75
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
76 PDC_sync(win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
77 return OK;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
78 }
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
79
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
80 int clrtoeol(void)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
81 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
82 PDC_LOG(("clrtoeol() - called\n"));
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
83
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
84 return wclrtoeol(stdscr);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
85 }
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
86
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
87 int wclrtobot(WINDOW *win)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
88 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
89 int savey = win->_cury;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
90 int savex = win->_curx;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
91
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
92 PDC_LOG(("wclrtobot() - called\n"));
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
93
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
94 if (!win)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
95 return ERR;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
96
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
97 /* should this involve scrolling region somehow ? */
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
98
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
99 if (win->_cury + 1 < win->_maxy)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
100 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
101 win->_curx = 0;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
102 win->_cury++;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
103 for (; win->_maxy > win->_cury; win->_cury++)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
104 wclrtoeol(win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
105 win->_cury = savey;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
106 win->_curx = savex;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
107 }
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
108 wclrtoeol(win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
109
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
110 PDC_sync(win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
111 return OK;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
112 }
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
113
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
114 int clrtobot(void)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
115 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
116 PDC_LOG(("clrtobot() - called\n"));
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
117
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
118 return wclrtobot(stdscr);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
119 }
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
120
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
121 int werase(WINDOW *win)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
122 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
123 PDC_LOG(("werase() - called\n"));
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
124
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
125 if (wmove(win, 0, 0) == ERR)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
126 return ERR;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
127
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
128 return wclrtobot(win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
129 }
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
130
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
131 int erase(void)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
132 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
133 PDC_LOG(("erase() - called\n"));
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
134
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
135 return werase(stdscr);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
136 }
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
137
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
138 int wclear(WINDOW *win)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
139 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
140 PDC_LOG(("wclear() - called\n"));
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
141
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
142 if (!win)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
143 return ERR;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
144
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
145 win->_clear = TRUE;
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
146 return werase(win);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
147 }
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
148
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
149 int clear(void)
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
150 {
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
151 PDC_LOG(("clear() - called\n"));
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
152
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
153 return wclear(stdscr);
2d43f05b284c Added pdcurses source files, if no curses library is provided, these source files will be fallen back to instead of raising an error. Should make compiling on windows slightly less painful.
Teemu Piippo <tsapii@utu.fi>
parents:
diff changeset
154 }

mercurial