From 3b77b723ca209199c8a224702812441e2196d452 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Thu, 7 Jul 2011 15:41:53 +0200 Subject: libpayload: Add PDCurses and ncurses' libform/libmenu PDCurses provides an alternative implementation of the curses library standard in addition to tinycurses. Where tinycurses is really tiny, PDCurses is more complete and provides virtually unlimited windows and the full API. The PDCurses code is brought in "vanilla", with all local changes residing in curses/pdcurses-backend/ In addition to a curses library, this change also provides libpanel (as part of the PDCurses code), and libform and libmenu which were derived from ncurses-5.9. As they rely on ncurses internals (and PDCurses is not ncurses), more changes were required for these libraries to work. The build system is extended to install the right set of header files depending on the selected curses implementation. Change-Id: I9e5b920f94b6510da01da2f656196a993170d1c5 Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/106 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones --- .../curses/PDCurses-3.4/pdcurses/getyx.c | 143 +++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 payloads/libpayload/curses/PDCurses-3.4/pdcurses/getyx.c (limited to 'payloads/libpayload/curses/PDCurses-3.4/pdcurses/getyx.c') diff --git a/payloads/libpayload/curses/PDCurses-3.4/pdcurses/getyx.c b/payloads/libpayload/curses/PDCurses-3.4/pdcurses/getyx.c new file mode 100644 index 0000000000..fd0564d904 --- /dev/null +++ b/payloads/libpayload/curses/PDCurses-3.4/pdcurses/getyx.c @@ -0,0 +1,143 @@ +/* Public Domain Curses */ + +#include + +RCSID("$Id: getyx.c,v 1.29 2008/07/15 17:13:26 wmcbrine Exp $") + +/*man-start************************************************************** + + Name: getyx + + Synopsis: + void getyx(WINDOW *win, int y, int x); + void getparyx(WINDOW *win, int y, int x); + void getbegyx(WINDOW *win, int y, int x); + void getmaxyx(WINDOW *win, int y, int x); + + void getsyx(int y, int x); + int setsyx(int y, int x); + + int getbegy(WINDOW *win); + int getbegx(WINDOW *win); + int getcury(WINDOW *win); + int getcurx(WINDOW *win); + int getpary(WINDOW *win); + int getparx(WINDOW *win); + int getmaxy(WINDOW *win); + int getmaxx(WINDOW *win); + + Description: + The getyx() macro (defined in curses.h -- the prototypes here + are merely illustrative) puts the current cursor position of the + specified window into y and x. getbegyx() and getmaxyx() return + the starting coordinates and size of the specified window, + respectively. getparyx() returns the starting coordinates of the + parent's window, if the specified window is a subwindow; + otherwise it sets y and x to -1. These are all macros. + + getsyx() gets the coordinates of the virtual screen cursor, and + stores them in y and x. If leaveok() is TRUE, it returns -1, -1. + If lines have been removed with ripoffline(), then getsyx() + includes these lines in its count; so, the returned y and x + values should only be used with setsyx(). + + setsyx() sets the virtual screen cursor to the y, x coordinates. + If y, x are -1, -1, leaveok() is set TRUE. + + getsyx() and setsyx() are meant to be used by a library routine + that manipulates curses windows without altering the position of + the cursor. Note that getsyx() is defined only as a macro. + + getbegy(), getbegx(), getcurx(), getcury(), getmaxy(), + getmaxx(), getpary(), and getparx() return the appropriate + coordinate or size values, or ERR in the case of a NULL window. + + Portability X/Open BSD SYS V + getyx Y Y Y + getparyx - - 4.0 + getbegyx - - 3.0 + getmaxyx - - 3.0 + getsyx - - 3.0 + setsyx - - 3.0 + getbegy - - - + getbegx - - - + getcury - - - + getcurx - - - + getpary - - - + getparx - - - + getmaxy - - - + getmaxx - - - + +**man-end****************************************************************/ + +int getbegy(WINDOW *win) +{ + PDC_LOG(("getbegy() - called\n")); + + return win ? win->_begy : ERR; +} + +int getbegx(WINDOW *win) +{ + PDC_LOG(("getbegx() - called\n")); + + return win ? win->_begx : ERR; +} + +int getcury(WINDOW *win) +{ + PDC_LOG(("getcury() - called\n")); + + return win ? win->_cury : ERR; +} + +int getcurx(WINDOW *win) +{ + PDC_LOG(("getcurx() - called\n")); + + return win ? win->_curx : ERR; +} + +int getpary(WINDOW *win) +{ + PDC_LOG(("getpary() - called\n")); + + return win ? win->_pary : ERR; +} + +int getparx(WINDOW *win) +{ + PDC_LOG(("getparx() - called\n")); + + return win ? win->_parx : ERR; +} + +int getmaxy(WINDOW *win) +{ + PDC_LOG(("getmaxy() - called\n")); + + return win ? win->_maxy : ERR; +} + +int getmaxx(WINDOW *win) +{ + PDC_LOG(("getmaxx() - called\n")); + + return win ? win->_maxx : ERR; +} + +int setsyx(int y, int x) +{ + PDC_LOG(("setsyx() - called\n")); + + if(y == -1 && x == -1) + { + curscr->_leaveit = TRUE; + return OK; + } + else + { + curscr->_leaveit = FALSE; + return wmove(curscr, y, x); + } +} -- cgit v1.2.3