int in_wchstr(cchar_t *ccs) { int code; code = win_wchnstr(stdscr, ccs, -1); return (code); }
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); }
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 in_wchnstr(cchar_t *ccs, int n) { int code; code = win_wchnstr(stdscr, ccs, n); return (code); }
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 win_wchstr(WINDOW *w, cchar_t *ccs) { int code; code = win_wchnstr(w, ccs, -1); return (code); }
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_wchnstr(WINDOW *w, int y, int x, cchar_t *ccs, int n) { int code; if ((code = wmove(w, y, x)) == OK) code = win_wchnstr(w, ccs, n); return (code); }
int mvin_wchnstr(int y, int x, cchar_t *ccs, int n) { int code; if ((code = wmove(stdscr, y, x)) == OK) code = win_wchnstr(stdscr, ccs, n); return (code); }
/* Returns a string of N characters and sttributes from the current window */ SCM gucu_winchnstr (SCM win, SCM n) { WINDOW *c_win; SCM s_str; int c_n; c_win = _scm_to_window (win); c_n = scm_to_int (n); if (c_n == -1) c_n = COLS; #ifdef HAVE_NCURSESW { int ret; cchar_t *c_cstr = (cchar_t *) scm_malloc (sizeof (cchar_t) * (c_n + 1)); ret = win_wchnstr (c_win, c_cstr, c_n); if (ret == ERR) return SCM_BOOL_F; s_str = _scm_xstring_from_cstring (c_cstr); free (c_cstr); } #else { int ret; chtype *c_chstr = (chtype *) scm_malloc (sizeof (chtype) * (c_n + 1)); ret = winchnstr (_scm_to_window (win), c_chstr, scm_to_int (n)); if (ret != ERR) { s_str = _scm_xstring_from_chstring (c_chstr); free (c_chstr); } else abort (); } #endif return s_str; }
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 in_wchstr(cchar_t *wch) { PDC_LOG(("in_wchstr() - called\n")); return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx); }
static int test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) { WINDOW *txtbox = 0; WINDOW *txtwin = 0; FILE *fp; int j; int txt_x = 0, txt_y = 0; int base_y; int limit; cchar_t ch; cchar_t text[MAX_COLS]; if (argv[level] == 0) { beep(); return FALSE; } if (level > 1) { txtbox = newwin(LINES - BASE_Y, COLS - level, BASE_Y, level); box(txtbox, 0, 0); wnoutrefresh(txtbox); txtwin = derwin(txtbox, getmaxy(txtbox) - 2, getmaxx(txtbox) - 2, 1, 1); base_y = 0; } else { txtwin = stdscr; base_y = BASE_Y; } keypad(txtwin, TRUE); /* enable keyboard mapping */ (void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) noecho(); /* don't echo input */ txt_y = base_y; txt_x = 0; wmove(txtwin, txt_y, txt_x); if ((fp = fopen(argv[level], "r")) != 0) { while ((j = fgetc(fp)) != EOF) { if (waddch(txtwin, UChar(j)) != OK) { break; } } fclose(fp); } else { wprintw(txtwin, "Cannot open:\n%s", argv[1]); } while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) { switch (j) { case KEY_DOWN: case 'j': if (txt_y < getmaxy(txtwin) - 1) txt_y++; else beep(); break; case KEY_UP: case 'k': if (txt_y > base_y) txt_y--; else beep(); break; case KEY_LEFT: case 'h': if (txt_x > 0) txt_x--; else beep(); break; case KEY_RIGHT: case 'l': if (txt_x < getmaxx(txtwin) - 1) txt_x++; else beep(); break; case 'w': test_inchs(level + 1, argv, chrwin, strwin); if (txtbox != 0) { touchwin(txtbox); wnoutrefresh(txtbox); } else { touchwin(txtwin); wnoutrefresh(txtwin); } break; default: beep(); break; } MvWPrintw(chrwin, 0, 0, "char:"); wclrtoeol(chrwin); if (txtwin != stdscr) { wmove(txtwin, txt_y, txt_x); if (win_wch(txtwin, &ch) != ERR) { if (wadd_wch(chrwin, &ch) != ERR) { for (j = txt_x + 1; j < getmaxx(txtwin); ++j) { if (mvwin_wch(txtwin, txt_y, j, &ch) != ERR) { if (wadd_wch(chrwin, &ch) == ERR) { break; } } else { break; } } } } } else { move(txt_y, txt_x); if (in_wch(&ch) != ERR) { if (wadd_wch(chrwin, &ch) != ERR) { for (j = txt_x + 1; j < getmaxx(txtwin); ++j) { if (mvin_wch(txt_y, j, &ch) != ERR) { if (wadd_wch(chrwin, &ch) == ERR) { break; } } else { break; } } } } } wnoutrefresh(chrwin); MvWPrintw(strwin, 0, 0, "text:"); wclrtobot(strwin); limit = getmaxx(strwin) - 5; if (txtwin != stdscr) { wmove(txtwin, txt_y, txt_x); if (win_wchstr(txtwin, text) != ERR) { (void) mvwadd_wchstr(strwin, 0, 5, text); } wmove(txtwin, txt_y, txt_x); if (win_wchnstr(txtwin, text, limit) != ERR) { (void) mvwadd_wchstr(strwin, 1, 5, text); } if (mvwin_wchstr(txtwin, txt_y, txt_x, text) != ERR) { (void) mvwadd_wchstr(strwin, 2, 5, text); } if (mvwin_wchnstr(txtwin, txt_y, txt_x, text, limit) != ERR) { (void) mvwadd_wchstr(strwin, 3, 5, text); } } else { move(txt_y, txt_x); if (in_wchstr(text) != ERR) { (void) mvwadd_wchstr(strwin, 0, 5, text); } move(txt_y, txt_x); if (in_wchnstr(text, limit) != ERR) { (void) mvwadd_wchstr(strwin, 1, 5, text); } if (mvin_wchstr(txt_y, txt_x, text) != ERR) { (void) mvwadd_wchstr(strwin, 2, 5, text); } if (mvin_wchnstr(txt_y, txt_x, text, limit) != ERR) { (void) mvwadd_wchstr(strwin, 3, 5, text); } } wnoutrefresh(strwin); } if (level > 1) { delwin(txtwin); delwin(txtbox); } return TRUE; }
NCURSES_EXPORT(int) (in_wchnstr) (cchar_t * a1, int z) { T((T_CALLED("in_wchnstr(%p,%d)"), (const void *)a1, z)); returnCode(win_wchnstr(stdscr,a1,z)); }
NCURSES_EXPORT(int) (mvwin_wchstr) (WINDOW * a1, int a2, int a3, cchar_t * z) { T((T_CALLED("mvwin_wchstr(%p,%d,%d,%p)"), (const void *)a1, a2, a3, (const void *)z)); returnCode((wmove(a1,a2,a3) == (-1) ? (-1) : win_wchnstr(a1,z,-1))); }
NCURSES_EXPORT(int) (in_wchstr) (cchar_t * z) { T((T_CALLED("in_wchstr(%p)"), (const void *)z)); returnCode(win_wchnstr(stdscr,z,-1)); }
NCURSES_EXPORT(int) (mvin_wchstr) (int a1, int a2, cchar_t * z) { T((T_CALLED("mvin_wchstr(%d,%d,%p)"), a1, a2, (const void *)z)); returnCode((wmove(stdscr,a1,a2) == (-1) ? (-1) : win_wchnstr(stdscr,z,-1))); }
NCURSES_EXPORT(int) (win_wchstr) (WINDOW * a1, cchar_t * z) { T((T_CALLED("win_wchstr(%p,%p)"), (const void *)a1, (const void *)z)); returnCode(win_wchnstr(a1,z,-1)); }