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