drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / payloads / libpayload / curses / PDCurses / pdcurses / getyx.c
blob0f39c48d350f19e274e1bbd15874153564031dd8
1 /* Public Domain Curses */
3 #include <curspriv.h>
5 RCSID("$Id: getyx.c,v 1.29 2008/07/15 17:13:26 wmcbrine Exp $")
7 /*man-start**************************************************************
9 Name: getyx
11 Synopsis:
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);
17 void getsyx(int y, int x);
18 int setsyx(int y, int x);
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);
29 Description:
30 The getyx() macro (defined in curses.h -- the prototypes here
31 are merely illustrative) puts the current cursor position of the
32 specified window into y and x. getbegyx() and getmaxyx() return
33 the starting coordinates and size of the specified window,
34 respectively. getparyx() returns the starting coordinates of the
35 parent's window, if the specified window is a subwindow;
36 otherwise it sets y and x to -1. These are all macros.
38 getsyx() gets the coordinates of the virtual screen cursor, and
39 stores them in y and x. If leaveok() is TRUE, it returns -1, -1.
40 If lines have been removed with ripoffline(), then getsyx()
41 includes these lines in its count; so, the returned y and x
42 values should only be used with setsyx().
44 setsyx() sets the virtual screen cursor to the y, x coordinates.
45 If y, x are -1, -1, leaveok() is set TRUE.
47 getsyx() and setsyx() are meant to be used by a library routine
48 that manipulates curses windows without altering the position of
49 the cursor. Note that getsyx() is defined only as a macro.
51 getbegy(), getbegx(), getcurx(), getcury(), getmaxy(),
52 getmaxx(), getpary(), and getparx() return the appropriate
53 coordinate or size values, or ERR in the case of a NULL window.
55 Portability X/Open BSD SYS V
56 getyx Y Y Y
57 getparyx - - 4.0
58 getbegyx - - 3.0
59 getmaxyx - - 3.0
60 getsyx - - 3.0
61 setsyx - - 3.0
62 getbegy - - -
63 getbegx - - -
64 getcury - - -
65 getcurx - - -
66 getpary - - -
67 getparx - - -
68 getmaxy - - -
69 getmaxx - - -
71 **man-end****************************************************************/
73 int getbegy(WINDOW *win)
75 PDC_LOG(("getbegy() - called\n"));
77 return win ? win->_begy : ERR;
80 int getbegx(WINDOW *win)
82 PDC_LOG(("getbegx() - called\n"));
84 return win ? win->_begx : ERR;
87 int getcury(WINDOW *win)
89 PDC_LOG(("getcury() - called\n"));
91 return win ? win->_cury : ERR;
94 int getcurx(WINDOW *win)
96 PDC_LOG(("getcurx() - called\n"));
98 return win ? win->_curx : ERR;
101 int getpary(WINDOW *win)
103 PDC_LOG(("getpary() - called\n"));
105 return win ? win->_pary : ERR;
108 int getparx(WINDOW *win)
110 PDC_LOG(("getparx() - called\n"));
112 return win ? win->_parx : ERR;
115 int getmaxy(WINDOW *win)
117 PDC_LOG(("getmaxy() - called\n"));
119 return win ? win->_maxy : ERR;
122 int getmaxx(WINDOW *win)
124 PDC_LOG(("getmaxx() - called\n"));
126 return win ? win->_maxx : ERR;
129 int setsyx(int y, int x)
131 PDC_LOG(("setsyx() - called\n"));
133 if(y == -1 && x == -1)
135 curscr->_leaveit = TRUE;
136 return OK;
138 else if (y == -1 || x == -1)
140 return OK;
142 else
144 curscr->_leaveit = FALSE;
145 wmove(curscr, y, x);
146 return OK;