diff --git a/curses.h b/curses.h index a99b2767..1eb15a39 100644 --- a/curses.h +++ b/curses.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: curses.h,v 1.187 2006/07/09 03:58:29 wmcbrine Exp $ */ +/* $Id: curses.h,v 1.188 2006/07/09 22:48:16 wmcbrine Exp $ */ /*----------------------------------------------------------------------* * PDCurses * @@ -45,7 +45,7 @@ PDCurses portable platform definitions list: **man-end****************************************************************/ -#define PDC_BUILD 2807 +#define PDC_BUILD 2808 #define PDCURSES 1 /* PDCurses-only routines */ #define XOPEN 1 /* X/Open Curses routines */ #define SYSVcurses 1 /* System V Curses routines */ @@ -398,6 +398,7 @@ typedef unsigned int chtype; # else typedef unsigned long chtype; /* 16-bit attr + 16-bit char */ # endif +typedef chtype cchar_t; #else typedef unsigned short chtype; /* 8-bit attr + 8-bit char */ #endif @@ -947,6 +948,38 @@ currently used.) #define ACS_SBSB ACS_VLINE #define ACS_SSSS ACS_PLUS +/* cchar_t aliases */ + +#ifdef CHTYPE_LONG +# define WACS_ULCORNER ACS_ULCORNER +# define WACS_LLCORNER ACS_LLCORNER +# define WACS_URCORNER ACS_URCORNER +# define WACS_LRCORNER ACS_LRCORNER +# define WACS_RTEE ACS_RTEE +# define WACS_LTEE ACS_LTEE +# define WACS_BTEE ACS_BTEE +# define WACS_TTEE ACS_TTEE +# define WACS_HLINE ACS_HLINE +# define WACS_VLINE ACS_VLINE +# define WACS_PLUS ACS_PLUS + +# define WACS_S1 ACS_S1 +# define WACS_S9 ACS_S9 +# define WACS_DIAMOND ACS_DIAMOND +# define WACS_CKBOARD ACS_CKBOARD +# define WACS_DEGREE ACS_DEGREE +# define WACS_PLMINUS ACS_PLMINUS +# define WACS_BULLET ACS_BULLET + +# define WACS_LARROW ACS_LARROW +# define WACS_RARROW ACS_RARROW +# define WACS_DARROW ACS_DARROW +# define WACS_UARROW ACS_UARROW +# define WACS_BOARD ACS_BOARD +# define WACS_LANTERN ACS_LANTERN +# define WACS_BLOCK ACS_BLOCK +#endif + /*** Color macros ***/ #define COLOR_BLACK 0 @@ -1524,6 +1557,60 @@ int winnwstr(WINDOW *, wchar_t *, int); int wins_nwstr(WINDOW *, const wchar_t *, int); int wins_wstr(WINDOW *, const wchar_t *); int winwstr(WINDOW *, wchar_t *); + +int add_wch(const cchar_t *); +int add_wchnstr(const cchar_t *, int); +int add_wchstr(const cchar_t *); +int border_set(const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *); +int box_set(WINDOW *, const cchar_t *, const cchar_t *); +int echo_wchar(const cchar_t *); +int getbkgrnd(cchar_t *); +int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *); +int hline_set(const cchar_t *, int); +int ins_wch(const cchar_t *); +int in_wch(cchar_t *); +int in_wchnstr(cchar_t *, int); +int in_wchstr(cchar_t *); +int mvadd_wch(int, int, const cchar_t *); +int mvadd_wchnstr(int, int, const cchar_t *, int); +int mvadd_wchstr(int, int, const cchar_t *); +int mvhline_set(int, int, const cchar_t *, int); +int mvins_wch(int, int, const cchar_t *); +int mvin_wch(int, int, cchar_t *); +int mvin_wchnstr(int, int, cchar_t *, int); +int mvin_wchstr(int, int, cchar_t *); +int mvvline_set(int, int, const cchar_t *, int); +int mvwadd_wch(WINDOW *, int, int, const cchar_t *); +int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); +int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); +int mvwhline_set(WINDOW *, int, int, const cchar_t *, int); +int mvwins_wch(WINDOW *, int, int, const cchar_t *); +int mvwin_wch(WINDOW *, int, int, cchar_t *); +int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int); +int mvwin_wchstr(WINDOW *, int, int, cchar_t *); +int mvwvline_set(WINDOW *, int, int, const cchar_t *, int); +int pecho_wchar(WINDOW *, const cchar_t*); +int setcchar(cchar_t*, const wchar_t*, const attr_t, short, const void*); +int vline_set(const cchar_t *, int); +int wadd_wch(WINDOW *, const cchar_t *); +int wadd_wchnstr(WINDOW *, const cchar_t *, int); +int wadd_wchstr(WINDOW *, const cchar_t *); +int wbkgrnd(WINDOW *, const cchar_t *); +void wbkgrndset(WINDOW *, const cchar_t *); +int wborder_set(WINDOW *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *); +int wecho_wchar(WINDOW *, const cchar_t *); +int wgetbkgrnd(WINDOW *, cchar_t *); +int whline_set(WINDOW *, const cchar_t *, int); +int wins_wch(WINDOW *, const cchar_t *); +int win_wch(WINDOW *, cchar_t *); +int win_wchnstr(WINDOW *, cchar_t *, int); +int win_wchstr(WINDOW *, cchar_t *); +wchar_t *wunctrl(cchar_t *); +int wvline_set(WINDOW *, const cchar_t *, int); #endif /* Quasi-standard */ diff --git a/pdcurses/addch.c b/pdcurses/addch.c index 379bc092..e4864671 100644 --- a/pdcurses/addch.c +++ b/pdcurses/addch.c @@ -34,7 +34,7 @@ # undef wmove #endif -RCSID("$Id: addch.c,v 1.19 2006/03/29 20:06:40 wmcbrine Exp $"); +RCSID("$Id: addch.c,v 1.20 2006/07/09 22:48:16 wmcbrine Exp $"); /*man-start************************************************************** @@ -177,3 +177,57 @@ int wechochar(WINDOW *win, const chtype ch) return wrefresh(win); } + +#ifdef CHTYPE_LONG +int add_wch(const cchar_t *wch) +{ + PDC_LOG(("add_wch() - called: wch=%x\n", *wch)); + + return wadd_wch(stdscr, wch); +} + +int wadd_wch(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wadd_wch() - called: win=%x wch=%x\n", win, *wch)); + + return wch ? PDC_chadd(win, *wch, (bool)(!(SP->raw_out)), TRUE) : ERR; +} + +int mvadd_wch(int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvaddch() - called: y=%d x=%d wch=%x\n", y, x, *wch)); + + if (move(y,x) == ERR) + return ERR; + + return wadd_wch(stdscr, wch); +} + +int mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvwaddch() - called: win=%x y=%d x=%d wch=%d\n", + win, y, x, *wch)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wadd_wch(win, wch); +} + +int echo_wchar(const cchar_t *wch) +{ + PDC_LOG(("echo_wchar() - called: wch=%x\n", *wch)); + + return wecho_wchar(stdscr, wch); +} + +int wecho_wchar(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wecho_wchar() - called: win=%x wch=%x\n", win, *wch)); + + if (!wch || (wadd_wch(win, wch) == ERR)) + return ERR; + + return wrefresh(win); +} +#endif diff --git a/pdcurses/addchstr.c b/pdcurses/addchstr.c index f4ebeed2..5206d4bb 100644 --- a/pdcurses/addchstr.c +++ b/pdcurses/addchstr.c @@ -35,7 +35,7 @@ # undef wmove #endif -RCSID("$Id: addchstr.c,v 1.24 2006/03/29 20:06:40 wmcbrine Exp $"); +RCSID("$Id: addchstr.c,v 1.25 2006/07/09 22:48:16 wmcbrine Exp $"); /*man-start************************************************************** @@ -112,10 +112,7 @@ int waddchnstr(WINDOW *win, const chtype *ch, int n) PDC_LOG(("waddchnstr() - called: win=%x n=%d\n", win, n)); - if (win == (WINDOW *)NULL) - return ERR; - - if (n == 0 || n < -1) + if (!win || !ch || !n || n < -1) return ERR; x = win->_curx; @@ -175,7 +172,7 @@ int mvaddchnstr(int y, int x, const chtype *ch, int n) int mvwaddchstr(WINDOW *win, int y, int x, const chtype *ch) { - PDC_LOG(("waddchstr() - called:\n")); + PDC_LOG(("mvwaddchstr() - called:\n")); if (wmove(win, y, x) == ERR) return ERR; @@ -183,8 +180,7 @@ int mvwaddchstr(WINDOW *win, int y, int x, const chtype *ch) return waddchnstr(win, ch, -1); } -int mvwaddchnstr(WINDOW *win, int y, int x, - const chtype *ch, int n) +int mvwaddchnstr(WINDOW *win, int y, int x, const chtype *ch, int n) { PDC_LOG(("mvwaddchnstr() - called: y %d x %d n %d \n", y, x, n)); @@ -193,3 +189,73 @@ int mvwaddchnstr(WINDOW *win, int y, int x, return waddchnstr(win, ch, n); } + +#ifdef CHTYPE_LONG +int add_wchstr(const cchar_t *wch) +{ + PDC_LOG(("add_wchstr() - called\n")); + + return wadd_wchnstr(stdscr, wch, -1); +} + +int add_wchnstr(const cchar_t *wch, int n) +{ + PDC_LOG(("add_wchnstr() - called\n")); + + return wadd_wchnstr(stdscr, wch, n); +} + +int wadd_wchstr(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wadd_wchstr() - called: win=%x\n", win)); + + return wadd_wchnstr(win, wch, -1); +} + +int wadd_wchnstr(WINDOW *win, const cchar_t *wch, int n) +{ + PDC_LOG(("wadd_wchnstr() - called: win=%x n=%d\n", win, n)); + + return waddchnstr(win, wch, n); +} + +int mvadd_wchstr(int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvadd_wchstr() - called: y %d x %d\n", y, x)); + + if (move(y, x) == ERR) + return ERR; + + return wadd_wchnstr(stdscr, wch, -1); +} + +int mvadd_wchnstr(int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvadd_wchnstr() - called: y %d x %d n %d\n", y, x, n)); + + if (move(y, x) == ERR) + return ERR; + + return wadd_wchnstr(stdscr, wch, n); +} + +int mvwadd_wchstr(WINDOW *win, int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvwadd_wchstr() - called:\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wadd_wchnstr(win, wch, -1); +} + +int mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvwadd_wchnstr() - called: y %d x %d n %d \n", y, x, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wadd_wchnstr(win, wch, n); +} +#endif diff --git a/pdcurses/bkgd.c b/pdcurses/bkgd.c index 3ce5131b..ccfccd08 100644 --- a/pdcurses/bkgd.c +++ b/pdcurses/bkgd.c @@ -25,7 +25,7 @@ #undef wbkgd #undef wbkgdset -RCSID("$Id: bkgd.c,v 1.19 2006/03/29 20:06:40 wmcbrine Exp $"); +RCSID("$Id: bkgd.c,v 1.20 2006/07/09 22:48:16 wmcbrine Exp $"); /*man-start************************************************************** @@ -218,3 +218,53 @@ void wbkgdset(WINDOW *win, chtype ch) win->_bkgd = (ch | bkgdattr); } + +#ifdef CHTYPE_LONG +int bkgrnd(const cchar_t *wch) +{ + PDC_LOG(("bkgrnd() - called\n")); + + return wbkgrnd(stdscr, wch); +} + +void bkgrndset(const cchar_t *wch) +{ + PDC_LOG(("bkgrndset() - called\n")); + + wbkgrndset(stdscr, wch); +} + +int getbkgrnd(cchar_t *wch) +{ + PDC_LOG(("getbkgrnd() - called\n")); + + return wgetbkgrnd(stdscr, wch); +} + +int wbkgrnd(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wbkgrnd() - called\n")); + + return wch ? wbkgd(win, *wch) : ERR; +} + +void wbkgrndset(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wbkgdset() - called\n")); + + if (wch) + wbkgdset(win, *wch); +} + +int wgetbkgrnd(WINDOW *win, cchar_t *wch) +{ + PDC_LOG(("wgetbkgrnd() - called\n")); + + if (!win || !wch) + return ERR; + + *wch = win->_bkgd; + + return OK; +} +#endif diff --git a/pdcurses/border.c b/pdcurses/border.c index 3eda82f3..02970230 100644 --- a/pdcurses/border.c +++ b/pdcurses/border.c @@ -34,7 +34,7 @@ #undef PDC_leftline #undef PDC_rightline -RCSID("$Id: border.c,v 1.24 2006/07/06 18:58:17 wmcbrine Exp $"); +RCSID("$Id: border.c,v 1.25 2006/07/09 22:48:16 wmcbrine Exp $"); /*man-start************************************************************** @@ -150,6 +150,14 @@ static chtype PDC_attr_passthru(WINDOW *win, chtype ch) return ch; } +int border(chtype ls, chtype rs, chtype ts, chtype bs, + chtype tl, chtype tr, chtype bl, chtype br) +{ + PDC_LOG(("border() - called\n")); + + return wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br); +} + int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br) { @@ -200,14 +208,6 @@ int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, return OK; } -int border(chtype ls, chtype rs, chtype ts, chtype bs, - chtype tl, chtype tr, chtype bl, chtype br) -{ - PDC_LOG(("border() - called\n")); - - return wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br); -} - int box(WINDOW *win, chtype verch, chtype horch) { PDC_LOG(("box() - called\n")); @@ -406,3 +406,102 @@ int PDC_wrightline(WINDOW *win, int n, bool state) return PDC_lineattr(win, n, state, A_RIGHTLINE); } + +#ifdef CHTYPE_LONG +int border_set(const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, + const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, + const cchar_t *bl, const cchar_t *br) +{ + PDC_LOG(("border_set() - called\n")); + + return wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br); +} + +int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs, + const cchar_t *ts, const cchar_t *bs, const cchar_t *tl, + const cchar_t *tr, const cchar_t *bl, const cchar_t *br) +{ + PDC_LOG(("wborder_set() - called\n")); + + return wborder(win, + ls ? *ls : 0, rs ? *rs : 0, ts ? *ts : 0, bs ? *bs : 0, + tl ? *tl : 0, tr ? *tr : 0, bl ? *bl : 0, br ? *br : 0); +} + +int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch) +{ + PDC_LOG(("box_set() - called\n")); + + return wborder_set(win, verch, verch, horch, horch, + (const cchar_t *)NULL, (const cchar_t *)NULL, + (const cchar_t *)NULL, (const cchar_t *)NULL); +} + +int hline_set(const cchar_t *wch, int n) +{ + PDC_LOG(("hline_set() - called\n")); + + return whline_set(stdscr, wch, n); +} + +int vline_set(const cchar_t *wch, int n) +{ + PDC_LOG(("vline_set() - called\n")); + + return wvline_set(stdscr, wch, n); +} + +int whline_set(WINDOW *win, const cchar_t *wch, int n) +{ + PDC_LOG(("whline_set() - called\n")); + + return wch ? whline(win, *wch, n) : ERR; +} + +int wvline_set(WINDOW *win, const cchar_t *wch, int n) +{ + PDC_LOG(("wvline_set() - called\n")); + + return wch ? wvline(win, *wch, n) : ERR; +} + +int mvhline_set(int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvhline_set() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return whline_set(stdscr, wch, n); +} + +int mvvline_set(int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvvline_set() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wvline_set(stdscr, wch, n); +} + +int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvwhline_set() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return whline_set(win, wch, n); +} + +int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n) +{ + PDC_LOG(("mvwvline_set() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wvline_set(win, wch, n); +} +#endif diff --git a/pdcurses/inch.c b/pdcurses/inch.c index 401e8fb5..83aa1ea0 100644 --- a/pdcurses/inch.c +++ b/pdcurses/inch.c @@ -30,7 +30,7 @@ # undef wmove #endif -RCSID("$Id: inch.c,v 1.16 2006/03/29 20:06:40 wmcbrine Exp $"); +RCSID("$Id: inch.c,v 1.17 2006/07/09 22:48:16 wmcbrine Exp $"); /*man-start************************************************************** @@ -101,3 +101,48 @@ chtype mvwinch(WINDOW *win, int y, int x) return win->_y[win->_cury][win->_curx]; } + +#ifdef CHTYPE_LONG +int win_wch(WINDOW *win, cchar_t *wcval) +{ + PDC_LOG(("win_wch() - called\n")); + + if (!win || !wcval) + return ERR; + + *wcval = win->_y[win->_cury][win->_curx]; + + return OK; +} + +int in_wch(cchar_t *wcval) +{ + PDC_LOG(("in_wch() - called\n")); + + return win_wch(stdscr, wcval); +} + +int mvin_wch(int y, int x, cchar_t *wcval) +{ + PDC_LOG(("mvin_wch() - called\n")); + + if (!wcval || (move(y, x) == ERR)) + return ERR; + + *wcval = stdscr->_y[stdscr->_cury][stdscr->_curx]; + + return OK; +} + +int mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval) +{ + PDC_LOG(("mvwin_wch() - called\n")); + + if (!wcval || (wmove(win, y, x) == ERR)) + return ERR; + + *wcval = win->_y[win->_cury][win->_curx]; + + return OK; +} +#endif diff --git a/pdcurses/inchstr.c b/pdcurses/inchstr.c index 76c00857..36235ddc 100644 --- a/pdcurses/inchstr.c +++ b/pdcurses/inchstr.c @@ -34,7 +34,7 @@ # undef wmove #endif -RCSID("$Id: inchstr.c,v 1.16 2006/03/29 20:06:40 wmcbrine Exp $"); +RCSID("$Id: inchstr.c,v 1.17 2006/07/09 22:48:16 wmcbrine Exp $"); /*man-start************************************************************** @@ -108,7 +108,7 @@ int winchnstr(WINDOW *win, chtype *ch, int n) PDC_LOG(("winchnstr() - called\n")); - if ((win == (WINDOW *)NULL) || (n < 0)) + if (!win || !ch || (n < 0)) return ERR; ptr = &(win->_y[win->_cury][win->_curx]); @@ -121,7 +121,7 @@ int winchnstr(WINDOW *win, chtype *ch, int n) *ch = (chtype)0; - return i; + return OK; } int mvinchstr(int y, int x, chtype *ch) @@ -146,7 +146,7 @@ int mvinchnstr(int y, int x, chtype *ch, int n) int mvwinchstr(WINDOW *win, int y, int x, chtype *ch) { - PDC_LOG(("winchstr() - called:\n")); + PDC_LOG(("mvwinchstr() - called:\n")); if (wmove(win, y, x) == ERR) return ERR; @@ -163,3 +163,73 @@ int mvwinchnstr(WINDOW *win, int y, int x, chtype *ch, int n) return winchnstr(win, ch, n); } + +#ifdef CHTYPE_LONG +int in_wchstr(cchar_t *wch) +{ + PDC_LOG(("in_wchstr() - called\n")); + + return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx); +} + +int in_wchnstr(cchar_t *wch, int n) +{ + PDC_LOG(("in_wchnstr() - called\n")); + + return win_wchnstr(stdscr, wch, n); +} + +int win_wchstr(WINDOW *win, cchar_t *wch) +{ + PDC_LOG(("win_wchstr() - called\n")); + + return win_wchnstr(win, wch, win->_maxx - win->_curx); +} + +int win_wchnstr(WINDOW *win, cchar_t *wch, int n) +{ + PDC_LOG(("win_wchnstr() - called\n")); + + return winchnstr(win, wch, n); +} + +int mvin_wchstr(int y, int x, cchar_t *wch) +{ + PDC_LOG(("mvin_wchstr() - called: y %d x %d\n", y, x)); + + if (move(y, x) == ERR) + return ERR; + + return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx); +} + +int mvin_wchnstr(int y, int x, cchar_t *wch, int n) +{ + PDC_LOG(("mvin_wchnstr() - called: y %d x %d n %d\n", y, x, n)); + + if (move(y, x) == ERR) + return ERR; + + return win_wchnstr(stdscr, wch, n); +} + +int mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wch) +{ + PDC_LOG(("mvwin_wchstr() - called:\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return win_wchnstr(win, wch, win->_maxx - win->_curx); +} + +int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n) +{ + PDC_LOG(("mvwinchnstr() - called: y %d x %d n %d \n", y, x, n)); + + if (wmove(win, y, x) == ERR) + return ERR; + + return win_wchnstr(win, wch, n); +} +#endif diff --git a/pdcurses/insch.c b/pdcurses/insch.c index 001cfdb0..eada56ea 100644 --- a/pdcurses/insch.c +++ b/pdcurses/insch.c @@ -32,7 +32,7 @@ # undef wmove #endif -RCSID("$Id: insch.c,v 1.17 2006/03/29 20:06:40 wmcbrine Exp $"); +RCSID("$Id: insch.c,v 1.18 2006/07/09 22:48:16 wmcbrine Exp $"); /*man-start************************************************************** @@ -153,3 +153,39 @@ int mvwinsch(WINDOW *win, int y, int x, chtype ch) return PDC_chins(win, ch, (bool)(!(SP->raw_out))); } + +#ifdef CHTYPE_LONG +int ins_wch(const cchar_t *wch) +{ + PDC_LOG(("ins_wch() - called\n")); + + return wch ? PDC_chins(stdscr, *wch, (bool)(!(SP->raw_out))) : ERR; +} + +int wins_wch(WINDOW *win, const cchar_t *wch) +{ + PDC_LOG(("wins_wch() - called\n")); + + return wch ? PDC_chins(win, *wch, (bool)(!(SP->raw_out))) : ERR; +} + +int mvins_wch(int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvins_wch() - called\n")); + + if (move(y, x) == ERR) + return ERR; + + return wch ? PDC_chins(stdscr, *wch, (bool)(!(SP->raw_out))) : ERR; +} + +int mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch) +{ + PDC_LOG(("mvwins_wch() - called\n")); + + if (wmove(win, y, x) == ERR) + return ERR; + + return wch? PDC_chins(win, *wch, (bool)(!(SP->raw_out))) : ERR; +} +#endif diff --git a/pdcurses/pad.c b/pdcurses/pad.c index b0b200cc..71d36f14 100644 --- a/pdcurses/pad.c +++ b/pdcurses/pad.c @@ -31,7 +31,7 @@ # undef doupdate #endif -RCSID("$Id: pad.c,v 1.21 2006/07/05 20:20:48 wmcbrine Exp $"); +RCSID("$Id: pad.c,v 1.22 2006/07/09 22:48:16 wmcbrine Exp $"); /* save values for pechochar() */ @@ -317,3 +317,16 @@ int pechochar(WINDOW *pad, chtype ch) return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, save_smincol, save_smaxrow, save_smaxcol); } + +#ifdef CHTYPE_LONG +int pecho_wchar(WINDOW *pad, const cchar_t *wch) +{ + PDC_LOG(("pecho_wchar() - called\n")); + + if (!wch || (waddch(pad, *wch) == ERR)) + return ERR; + + return prefresh(pad, save_pminrow, save_pmincol, save_sminrow, + save_smincol, save_smaxrow, save_smaxcol); +} +#endif diff --git a/pdcurses/util.c b/pdcurses/util.c index addfc154..bc0c592f 100644 --- a/pdcurses/util.c +++ b/pdcurses/util.c @@ -27,7 +27,7 @@ #undef delay_output #undef flushinp -RCSID("$Id: util.c,v 1.36 2006/07/07 00:00:53 wmcbrine Exp $"); +RCSID("$Id: util.c,v 1.37 2006/07/09 22:48:16 wmcbrine Exp $"); /*man-start************************************************************** @@ -97,14 +97,14 @@ char *unctrl(chtype c) if (ic >= 0x20 && ic != 0x7f) /* normal characters */ { - strbuf[0] = (char) ic; + strbuf[0] = (char)ic; strbuf[1] = '\0'; return strbuf; } strbuf[0] = '^'; /* '^' prefix */ - if (c == 0x7f) /* 0x7f == DEL */ + if (ic == 0x7f) /* 0x7f == DEL */ strbuf[1] = '?'; else /* other control */ strbuf[1] = (char)(ic + '@'); @@ -236,6 +236,67 @@ int flushinp(void) return OK; } +#ifdef CHTYPE_LONG +int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, + short *color_pair, void *opts) +{ + if (!wcval) + return ERR; + + if (wch) + { + if (!attrs || !color_pair) + return ERR; + + *wch = (*wcval & A_CHARTEXT); + *attrs = (*wcval & (A_ATTRIBUTES & ~A_COLOR)); + *color_pair = PAIR_NUMBER(*wcval & A_COLOR); + + return OK; + } + else + return 1; +} + +int setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs, + short color_pair, const void *opts) +{ + if (!wcval || !wch) + return ERR; + + *wcval = *wch | attrs | COLOR_PAIR(color_pair); + + return OK; +} + +wchar_t *wunctrl(cchar_t *wc) +{ + static wchar_t strbuf[3] = {0, 0, 0}; + + cchar_t ic; + + PDC_LOG(("wunctrl() - called\n")); + + ic = *wc & A_CHARTEXT; + + if (ic >= 0x20 && ic != 0x7f) /* normal characters */ + { + strbuf[0] = (wchar_t)ic; + strbuf[1] = '\0'; + return strbuf; + } + + strbuf[0] = '^'; /* '^' prefix */ + + if (ic == 0x7f) /* 0x7f == DEL */ + strbuf[1] = '?'; + else /* other control */ + strbuf[1] = (wchar_t)(ic + '@'); + + return strbuf; +} +#endif + #undef traceon #undef traceoff