aboutsummaryrefslogtreecommitdiff
path: root/scripts/kconfig/libcurses/getyx.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scripts/kconfig/libcurses/getyx.c144
1 files changed, 144 insertions, 0 deletions
diff --git a/scripts/kconfig/libcurses/getyx.c b/scripts/kconfig/libcurses/getyx.c
new file mode 100644
index 000000000..6aa894ed0
--- /dev/null
+++ b/scripts/kconfig/libcurses/getyx.c
@@ -0,0 +1,144 @@
1/* PDCurses */
2
3#include "curspriv.h"
4
5/*man-start**************************************************************
6
7getyx
8-----
9
10### Synopsis
11
12 void getyx(WINDOW *win, int y, int x);
13 void getparyx(WINDOW *win, int y, int x);
14 void getbegyx(WINDOW *win, int y, int x);
15 void getmaxyx(WINDOW *win, int y, int x);
16
17 void getsyx(int y, int x);
18 void setsyx(int y, int x);
19
20 int getbegy(WINDOW *win);
21 int getbegx(WINDOW *win);
22 int getcury(WINDOW *win);
23 int getcurx(WINDOW *win);
24 int getpary(WINDOW *win);
25 int getparx(WINDOW *win);
26 int getmaxy(WINDOW *win);
27 int getmaxx(WINDOW *win);
28
29### Description
30
31 The getyx() macro (defined in curses.h -- the prototypes here are
32 merely illustrative) puts the current cursor position of the
33 specified window into y and x. getbegyx() and getmaxyx() return the
34 starting coordinates and size of the specified window, respectively.
35 getparyx() returns the starting coordinates of the parent's window,
36 if the specified window is a subwindow; otherwise it sets y and x to
37 -1. These are all macros.
38
39 getsyx() gets the coordinates of the virtual screen cursor, and
40 stores them in y and x. If leaveok() is TRUE, it returns -1, -1. If
41 lines have been removed with ripoffline(), then getsyx() includes
42 these lines in its count; so, the returned y and x values should only
43 be used with setsyx().
44
45 setsyx() sets the virtual screen cursor to the y, x coordinates. If
46 either y or x is -1, leaveok() is set TRUE, else it's set FALSE.
47
48 getsyx() and setsyx() are meant to be used by a library routine that
49 manipulates curses windows without altering the position of the
50 cursor. Note that getsyx() is defined only as a macro.
51
52 getbegy(), getbegx(), getcurx(), getcury(), getmaxy(), getmaxx(),
53 getpary(), and getparx() return the appropriate coordinate or size
54 values, or ERR in the case of a NULL window.
55
56### Portability
57
58 Function | X/Open | ncurses | NetBSD
59 :---------------------|:------:|:-------:|:------:
60 getyx | Y | Y | Y
61 getparyx | Y | Y | Y
62 getbegyx | Y | Y | Y
63 getmaxyx | Y | Y | Y
64 getsyx | - | Y | Y
65 setsyx | - | Y | Y
66 getbegy | - | Y | Y
67 getbegx | - | Y | Y
68 getcury | - | Y | Y
69 getcurx | - | Y | Y
70 getpary | - | Y | Y
71 getparx | - | Y | Y
72 getmaxy | - | Y | Y
73 getmaxx | - | Y | Y
74
75**man-end****************************************************************/
76
77int getbegy(WINDOW *win)
78{
79 PDC_LOG(("getbegy() - called\n"));
80
81 return win ? win->_begy : ERR;
82}
83
84int getbegx(WINDOW *win)
85{
86 PDC_LOG(("getbegx() - called\n"));
87
88 return win ? win->_begx : ERR;
89}
90
91int getcury(WINDOW *win)
92{
93 PDC_LOG(("getcury() - called\n"));
94
95 return win ? win->_cury : ERR;
96}
97
98int getcurx(WINDOW *win)
99{
100 PDC_LOG(("getcurx() - called\n"));
101
102 return win ? win->_curx : ERR;
103}
104
105int getpary(WINDOW *win)
106{
107 PDC_LOG(("getpary() - called\n"));
108
109 return win ? win->_pary : ERR;
110}
111
112int getparx(WINDOW *win)
113{
114 PDC_LOG(("getparx() - called\n"));
115
116 return win ? win->_parx : ERR;
117}
118
119int getmaxy(WINDOW *win)
120{
121 PDC_LOG(("getmaxy() - called\n"));
122
123 return win ? win->_maxy : ERR;
124}
125
126int getmaxx(WINDOW *win)
127{
128 PDC_LOG(("getmaxx() - called\n"));
129
130 return win ? win->_maxx : ERR;
131}
132
133void setsyx(int y, int x)
134{
135 PDC_LOG(("setsyx() - called\n"));
136
137 if (curscr)
138 {
139 curscr->_leaveit = y == -1 || x == -1;
140
141 if (!curscr->_leaveit)
142 wmove(curscr, y, x);
143 }
144}