📄 curses.h.in
字号:
extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented *//* * vid_attr() was implemented originally based on the draft of XSI curses. */#ifndef _XOPEN_SOURCE_EXTENDED#define vid_attr(a,pair,opts) vidattr(a)#endif/* attributes */#define NCURSES_ATTR_SHIFT 8#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))#define A_NORMAL (@cf_cv_1UL@ - @cf_cv_1UL@)#define A_ATTRIBUTES NCURSES_BITS(~(@cf_cv_1UL@ - @cf_cv_1UL@),0)#define A_CHARTEXT (NCURSES_BITS(@cf_cv_1UL@,0) - @cf_cv_1UL@)#define A_COLOR NCURSES_BITS(((@cf_cv_1UL@) << 8) - @cf_cv_1UL@,0)#define A_STANDOUT NCURSES_BITS(@cf_cv_1UL@,8)#define A_UNDERLINE NCURSES_BITS(@cf_cv_1UL@,9)#define A_REVERSE NCURSES_BITS(@cf_cv_1UL@,10)#define A_BLINK NCURSES_BITS(@cf_cv_1UL@,11)#define A_DIM NCURSES_BITS(@cf_cv_1UL@,12)#define A_BOLD NCURSES_BITS(@cf_cv_1UL@,13)#define A_ALTCHARSET NCURSES_BITS(@cf_cv_1UL@,14)#define A_INVIS NCURSES_BITS(@cf_cv_1UL@,15)#define A_PROTECT NCURSES_BITS(@cf_cv_1UL@,16)#define A_HORIZONTAL NCURSES_BITS(@cf_cv_1UL@,17)#define A_LEFT NCURSES_BITS(@cf_cv_1UL@,18)#define A_LOW NCURSES_BITS(@cf_cv_1UL@,19)#define A_RIGHT NCURSES_BITS(@cf_cv_1UL@,20)#define A_TOP NCURSES_BITS(@cf_cv_1UL@,21)#define A_VERTICAL NCURSES_BITS(@cf_cv_1UL@,22)/* * These apply to the first 256 color pairs. */#define COLOR_PAIR(n) NCURSES_BITS(n, 0)#define PAIR_NUMBER(a) (NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))/* * pseudo functions */#define wgetstr(w, s) wgetnstr(w, s, -1)#define getnstr(s, n) wgetnstr(stdscr, s, n)#define setterm(term) setupterm(term, 1, (int *)0)#define fixterm() reset_prog_mode()#define resetterm() reset_shell_mode()#define saveterm() def_prog_mode()#define crmode() cbreak()#define nocrmode() nocbreak()#define gettmode()#define getyx(win,y,x) (y = getcury(win), x = getcurx(win))#define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win))#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))#define getparyx(win,y,x) (y = getpary(win), x = getparx(win))#define getsyx(y,x) do { if(newscr->_leaveok) (y)=(x)=-1; \ else getyx(newscr,(y),(x)); \ } while(0)#define setsyx(y,x) do { if((y)==-1 && (x)==-1) newscr->_leaveok=TRUE; \ else {newscr->_leaveok=FALSE;wmove(newscr,(y),(x));} \ } while(0)/* It seems older SYSV curses versions define these */#define getattrs(win) ((win)?(win)->_attrs:A_NORMAL)#define getcurx(win) ((win)?(win)->_curx:ERR)#define getcury(win) ((win)?(win)->_cury:ERR)#define getbegx(win) ((win)?(win)->_begx:ERR)#define getbegy(win) ((win)?(win)->_begy:ERR)#define getmaxx(win) ((win)?((win)->_maxx + 1):ERR)#define getmaxy(win) ((win)?((win)->_maxy + 1):ERR)#define getparx(win) ((win)?(win)->_parx:ERR)#define getpary(win) ((win)?(win)->_pary:ERR)#define wstandout(win) (wattrset(win,A_STANDOUT))#define wstandend(win) (wattrset(win,A_NORMAL))#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL)#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL)#if @NCURSES_EXT_COLORS@#define wattrset(win,at) ((win)->_color = PAIR_NUMBER(at), \ (win)->_attrs = (at))#else#define wattrset(win,at) ((win)->_attrs = (at))#endif#define scroll(win) wscrl(win,1)#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1)#define touchline(win, s, c) wtouchln((win), s, c, 1)#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0)#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0)#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)#define hline(ch, n) whline(stdscr, ch, n)#define vline(ch, n) wvline(stdscr, ch, n)#define winstr(w, s) winnstr(w, s, -1)#define winchstr(w, s) winchnstr(w, s, -1)#define winsstr(w, s) winsnstr(w, s, -1)#define redrawwin(win) wredrawln(win, 0, (win)->_maxy+1)#define waddstr(win,str) waddnstr(win,str,-1)#define waddchstr(win,str) waddchnstr(win,str,-1)/* * pseudo functions for standard screen */#define addch(ch) waddch(stdscr,ch)#define addchnstr(str,n) waddchnstr(stdscr,str,n)#define addchstr(str) waddchstr(stdscr,str)#define addnstr(str,n) waddnstr(stdscr,str,n)#define addstr(str) waddnstr(stdscr,str,-1)#define attroff(at) wattroff(stdscr,at)#define attron(at) wattron(stdscr,at)#define attrset(at) wattrset(stdscr,at)#define attr_get(ap,cp,o) wattr_get(stdscr,ap,cp,o)#define attr_off(a,o) wattr_off(stdscr,a,o)#define attr_on(a,o) wattr_on(stdscr,a,o)#define attr_set(a,c,o) wattr_set(stdscr,a,c,o)#define bkgd(ch) wbkgd(stdscr,ch)#define bkgdset(ch) wbkgdset(stdscr,ch)#define chgat(n,a,c,o) wchgat(stdscr,n,a,c,o)#define clear() wclear(stdscr)#define clrtobot() wclrtobot(stdscr)#define clrtoeol() wclrtoeol(stdscr)#define color_set(c,o) wcolor_set(stdscr,c,o)#define delch() wdelch(stdscr)#define deleteln() winsdelln(stdscr,-1)#define echochar(c) wechochar(stdscr,c)#define erase() werase(stdscr)#define getch() wgetch(stdscr)#define getstr(str) wgetstr(stdscr,str)#define inch() winch(stdscr)#define inchnstr(s,n) winchnstr(stdscr,s,n)#define inchstr(s) winchstr(stdscr,s)#define innstr(s,n) winnstr(stdscr,s,n)#define insch(c) winsch(stdscr,c)#define insdelln(n) winsdelln(stdscr,n)#define insertln() winsdelln(stdscr,1)#define insnstr(s,n) winsnstr(stdscr,s,n)#define insstr(s) winsstr(stdscr,s)#define instr(s) winstr(stdscr,s)#define move(y,x) wmove(stdscr,y,x)#define refresh() wrefresh(stdscr)#define scrl(n) wscrl(stdscr,n)#define setscrreg(t,b) wsetscrreg(stdscr,t,b)#define standend() wstandend(stdscr)#define standout() wstandout(stdscr)#define timeout(delay) wtimeout(stdscr,delay)#define wdeleteln(win) winsdelln(win,-1)#define winsertln(win) winsdelln(win,1)/* * mv functions */#define mvwaddch(win,y,x,ch) (wmove(win,y,x) == ERR ? ERR : waddch(win,ch))#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))#define mvwaddchstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))#define mvwaddnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))#define mvwaddstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))#define mvwdelch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wdelch(win))#define mvwchgat(win,y,x,n,a,c,o) (wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))#define mvwgetch(win,y,x) (wmove(win,y,x) == ERR ? ERR : wgetch(win))#define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))#define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))#define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n))#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))#define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))#define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s))#define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))#define mvwinsch(win,y,x,c) (wmove(win,y,x) == ERR ? ERR : winsch(win,c))#define mvwinsnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))#define mvwinsstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winsstr(win,s))#define mvwinstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winstr(win,s))#define mvwvline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,y,x,str,n)#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,y,x,str)#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,y,x,str,n)#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,y,x,n,a,c,o)#define mvdelch(y,x) mvwdelch(stdscr,y,x)#define mvgetch(y,x) mvwgetch(stdscr,y,x)#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,y,x,str,n)#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)#define mvhline(y,x,c,n) mvwhline(stdscr,y,x,c,n)#define mvinch(y,x) mvwinch(stdscr,y,x)#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,y,x,s,n)#define mvinchstr(y,x,s) mvwinchstr(stdscr,y,x,s)#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,y,x,s,n)#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,y,x,s,n)#define mvinsstr(y,x,s) mvwinsstr(stdscr,y,x,s)#define mvinstr(y,x,s) mvwinstr(stdscr,y,x,s)#define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n)/* * Some wide-character functions can be implemented without the extensions. */#define getbkgd(win) ((win)->_bkgd)#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a))#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a))#if @NCURSES_EXT_COLORS@#define wattr_set(win,a,p,opts) ((win)->_attrs = ((a) & ~A_COLOR), \ (win)->_color = (p), \ OK)#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ (void)((p) != 0 && (*(p) = (win)->_color)), \ OK)#else#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ OK)#endif/* * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already * use stdarg.h, so... */#define vw_printw vwprintw#define vw_scanw vwscanw/* * Export fallback function for use in C++ binding. */#if !@HAVE_VSSCANF@#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);#endif/* * Pseudo-character tokens outside ASCII range. The curses wgetch() function * will return any given one of these only if the corresponding k- capability * is defined in your terminal's terminfo entry. * * Some keys (KEY_A1, etc) are arranged like this: * a1 up a3 * left b2 right * c1 down c3 * * A few key codes do not depend upon the terminfo entry. */#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */#define KEY_MIN 0401 /* Minimum curses key */#define KEY_BREAK 0401 /* Break key (unreliable) */#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -