Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Utilities/cmpdcurses/pdcurses/inch.c
3153 views
1
/* PDCurses */
2
3
#include <curspriv.h>
4
5
/*man-start**************************************************************
6
7
inch
8
----
9
10
### Synopsis
11
12
chtype inch(void);
13
chtype winch(WINDOW *win);
14
chtype mvinch(int y, int x);
15
chtype mvwinch(WINDOW *win, int y, int x);
16
17
int in_wch(cchar_t *wcval);
18
int win_wch(WINDOW *win, cchar_t *wcval);
19
int mvin_wch(int y, int x, cchar_t *wcval);
20
int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval);
21
22
### Description
23
24
The inch() functions retrieve the character and attribute from the
25
current or specified window position, in the form of a chtype. If a
26
NULL window is specified, (chtype)ERR is returned.
27
28
The in_wch() functions are the wide-character versions; instead of
29
returning a chtype, they store a cchar_t at the address specified by
30
wcval, and return OK or ERR. (No value is stored when ERR is
31
returned.) Note that in PDCurses, chtype and cchar_t are the same.
32
33
### Portability
34
X/Open ncurses NetBSD
35
inch Y Y Y
36
winch Y Y Y
37
mvinch Y Y Y
38
mvwinch Y Y Y
39
in_wch Y Y Y
40
win_wch Y Y Y
41
mvin_wch Y Y Y
42
mvwin_wch Y Y Y
43
44
**man-end****************************************************************/
45
46
chtype winch(WINDOW *win)
47
{
48
PDC_LOG(("winch() - called\n"));
49
50
if (!win)
51
return (chtype)ERR;
52
53
return win->_y[win->_cury][win->_curx];
54
}
55
56
chtype inch(void)
57
{
58
PDC_LOG(("inch() - called\n"));
59
60
return winch(stdscr);
61
}
62
63
chtype mvinch(int y, int x)
64
{
65
PDC_LOG(("mvinch() - called\n"));
66
67
if (move(y, x) == ERR)
68
return (chtype)ERR;
69
70
return stdscr->_y[stdscr->_cury][stdscr->_curx];
71
}
72
73
chtype mvwinch(WINDOW *win, int y, int x)
74
{
75
PDC_LOG(("mvwinch() - called\n"));
76
77
if (wmove(win, y, x) == ERR)
78
return (chtype)ERR;
79
80
return win->_y[win->_cury][win->_curx];
81
}
82
83
#ifdef PDC_WIDE
84
int win_wch(WINDOW *win, cchar_t *wcval)
85
{
86
PDC_LOG(("win_wch() - called\n"));
87
88
if (!win || !wcval)
89
return ERR;
90
91
*wcval = win->_y[win->_cury][win->_curx];
92
93
return OK;
94
}
95
96
int in_wch(cchar_t *wcval)
97
{
98
PDC_LOG(("in_wch() - called\n"));
99
100
return win_wch(stdscr, wcval);
101
}
102
103
int mvin_wch(int y, int x, cchar_t *wcval)
104
{
105
PDC_LOG(("mvin_wch() - called\n"));
106
107
if (!wcval || (move(y, x) == ERR))
108
return ERR;
109
110
*wcval = stdscr->_y[stdscr->_cury][stdscr->_curx];
111
112
return OK;
113
}
114
115
int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval)
116
{
117
PDC_LOG(("mvwin_wch() - called\n"));
118
119
if (!wcval || (wmove(win, y, x) == ERR))
120
return ERR;
121
122
*wcval = win->_y[win->_cury][win->_curx];
123
124
return OK;
125
}
126
#endif
127
128