📄 curses.ed
字号:
extern char *unctrl();extern chtype inch(), mvinch(), mvwinch();extern int intrflush(), meta(), noecho(), echo(), nl(), nonl(), beep(), flash(), attroff(), attron(), attrset(), standend(), standout();extern void bkgdset(), timeout();#else /* NOMACROS || lint *//* * The defines from here down to the #endif for NOMACROS * define macros, which may be more efficient than their * function versions. The functions may be accessed by defining * NOMACROS in C code. This is useful for debugging purposes. */#include <unctrl.h>/* pseudo functions for stdscr */#define addch(ch) waddch(stdscr, ch)#define addnstr(s,n) waddnstr(stdscr,s,n)#define addstr(str) waddstr(stdscr, str)#define attroff(at) wattroff(stdscr,at)#define attron(at) wattron(stdscr,at)#define attrset(at) wattrset(stdscr,at)#define bkgd(c) wbkgd(stdscr,c)#define border(lc,rc,tc,bc) wborder(stdscr,lc,rc,tc,bc)#define clear() wclear(stdscr)#define clrtobot() wclrtobot(stdscr)#define clrtoeol() wclrtoeol(stdscr)#define delch() wdelch(stdscr)#define deleteln() wdeleteln(stdscr)#define echochar(ch) wechochar(stdscr, ch)#define erase() werase(stdscr)#define getch() wgetch(stdscr)#define getstr(str) wgetstr(stdscr, str)#define inch() winch(stdscr)#define insch(c) winsch(stdscr,c)#define insdelln(id) winsdelln(stdscr,id)#define insertln() winsertln(stdscr)#define insnstr(s,n) winsnstr(stdscr,s,n)#define insstr(s) winsstr(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(tm) wtimeout(stdscr,tm)#define hline(c,num) whline(stdscr,c,num)#define vline(c,num) wvline(stdscr,c,num)#define addchstr(str) waddchstr(stdscr,str)#define addchnstr(str,n) waddchnstr(stdscr,str,n)#define instr(str) winstr(stdscr,(str))#define innstr(str,n) winnstr(stdscr,(str),(n))#define inchstr(str) winchstr(stdscr,str)#define inchnstr(str,n) winchnstr(stdscr,str,n)#define bkgdset(c) wbkgdset(stdscr,c)/* functions to define environment flags of a window */#ifdef PERFORMANCE#define wbkgdset(win,c) (((win)->_attrs = (((win)->_attrs & ~((win)->_bkgd & A_ATTRIBUTES)) | (c & A_ATTRIBUTES))), ((win)->_bkgd = (c)))#define syncok(win,bf) ((win)->_parent?(win)->_sync=(bf):ERR)#define notimeout(win,bf) ((win)->_notimeout = ((bf) ? TRUE : FALSE))#define clearok(win,bf) ((win)->_clear = (bf))#define leaveok(win,bf) ((win)->_leave = (bf))#define scrollok(win,bf) ((win)->_scroll = ((bf) ? TRUE : FALSE))#define idcok(win,bf) ((win)->_use_idc = ((bf) ? TRUE : FALSE))#define nodelay(win,bf) ((win)->_delay = (bf) ? 0 : -1)#define is_wintouched(win) ((win)->_flags & _WINCHANGED)#define is_linetouched(win,line) ((((line) >= (win)->_maxy) || \ ((line) < 0)) ? ERR : \ (((win)->_firstch[(line)] == _INFINITY) ? \ FALSE : TRUE))#endif /* PERFORMANCE *//* functions for handling video attributes */#ifdef PERFORMANCE#if defined(_VR3_COMPAT_CODE)#undef wattroff#undef wattron#undef wattrset#endif /* _VR3_COMPAT_CODE */#define wattroff(w,a) ((w)->_attrs &= ((~(a) | (w)->_bkgd) & A_ATTRIBUTES))#define wattron(w,a) ((w)->_attrs |= ((a) & A_ATTRIBUTES))#define wattrset(w,a) ((w)->_attrs = ((a) | (w)->_bkgd) & A_ATTRIBUTES)#endif /* PERFORMANCE *//* functions for move and update */#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)#define mvaddnstr(y,x,s,n) mvwaddnstr(stdscr,y,x,s,n)#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)#define mvdelch(y,x) mvwdelch(stdscr,y,x)#define mvgetch(y,x) mvwgetch(stdscr,y,x)#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)#define mvinch(y,x) mvwinch(stdscr,y,x)#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 mvaddchstr(y,x,str) mvwaddchstr(stdscr,y,x,str)#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,y,x,str,n)#define mvinstr(y,x,str) mvwinstr(stdscr,y,x,(str))#define mvinnstr(y,x,str,n) mvwinnstr(stdscr,y,x,(str),(n))#define mvinchstr(y,x,str) mvwinchstr(stdscr,y,x,str)#define mvinchnstr(y,x,str,n) mvwinchnstr(stdscr,y,x,str,n)#define mvhline(y,x,c,num) mvwhline(stdscr,y,x,c,num)#define mvvline(y,x,c,num) mvwvline(stdscr,y,x,c,num)#define mvwaddch(win,y,x,ch) (wmove(win,y,x)==ERR?ERR:waddch(win,ch))#define mvwaddnstr(win,y,x,s,n) (wmove(win,y,x)==ERR?ERR:waddnstr(win,s,n))#define mvwaddstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:waddstr(win,str))#define mvwdelch(win,y,x) (wmove(win,y,x)==ERR?ERR:wdelch(win))#define mvwgetch(win,y,x) (wmove(win,y,x)==ERR?ERR:wgetch(win))#define mvwgetstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:wgetstr(win,str))#define mvwinch(win,y,x) (wmove(win,y,x)==ERR?(chtype) ERR:winch(win))#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 mvwhline(win,y,x,c,num) (wmove(win,y,x)==ERR?ERR:whline(win,c,num))#define mvwvline(win,y,x,c,num) (wmove(win,y,x)==ERR?ERR:wvline(win,c,num))#define mvwaddchstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:waddchstr(win,str))#define mvwaddchnstr(win,y,x,str,n) (wmove(win,y,x)==ERR?ERR:waddchnstr(win,str,n))#define mvwinstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:winstr(win,str))#define mvwinnstr(win,y,x,str,n) (wmove(win,y,x)==ERR?ERR:winnstr(win,str,n))#define mvwinchstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:winchstr(win,str))#define mvwinchnstr(win,y,x,str,n) (wmove(win,y,x)==ERR?ERR:winchnstr(win,str,n))#ifdef CURSES_MACROS#define overlay(src,dst) _overlap((src),(dst),TRUE)#define overwrite(src,dst) _overlap((src),(dst),FALSE)#define wdeleteln(win) winsdelln((win),-1)#define winsertln(win) winsdelln((win),1)#define wstandend(win) wattrset((win),A_NORMAL)#define wstandout(win) wattron((win),A_STANDOUT)#define beep() _ring(TRUE)#define flash() _ring(FALSE)#define scroll(win) wscrl((win),1)#define slk_init(f) slk_start(((f == 0) ? 3 : 2),NULL)#define scr_init(file) _scr_all(file,0)#define scr_restore(file) _scr_all(file,1)#define subpad(win,nl,nc,by,bx) derwin((win),(nl),(nc),(by),(bx))#define box(win,v,h) wborder((win),(v),(v),(h),(h),0,0,0,0)#define newterm(type,fout,fin) newscreen((type),0,0,0,(fout),(fin))#define touchline(win,y,n) wtouchln((win),(y),(n),TRUE)#endif /* CURSES_MACROS */#define garbagedlines wredrawln#define garbagedwin redrawwin#ifdef PERFORMANCE#define subwin(win,nl,nc,by,bx) derwin((win),(nl),(nc),(by-win->_begy),(bx-win->_begx))#define touchwin(win) wtouchln((win),0,(win)->_maxy,TRUE)#define redrawwin(win) wredrawln((win),0,(win)->_maxy)#define winchstr(win,str) winchnstr((win),str,((win)->_maxx - (win)->_curx))#define winstr(win,str) winnstr((win),str,((win)->_maxx - (win)->_curx))#define untouchwin(win) wtouchln((win),0,((win)->_maxy),FALSE)#define winch(win) ((win)->_y[(win)->_cury][(win)->_curx])#endif /* PERFORMANCE */#ifdef CURSES_MACROS#define waddstr(win,str) waddnstr((win),(str),-1)#define werase(win) (wmove((win),0,0), wclrtobot(win))#define wclear(win) (clearok((win),TRUE), werase(win))#define intrflush(win,flag) _setqiflush(flag)#define meta(win,flag) _meta(flag)#endif /* CURSES_MACROS */#define crmode cbreak#define nocrmode nocbreak#define saveterm def_prog_mode#define fixterm reset_prog_mode#define resetterm reset_shell_mode#ifdef CURSES_MACROS#define setterm(name) setupterm((name),1,(char*)NULL)#define gettmode() (OK)#define halfdelay(tens) ttimeout((tens)*100)#endif /* CURSES_MACROS */#define waddchstr(win,str) waddchnstr((win),(str),-1)#define winsstr(win,str) winsnstr((win),(str),-1)/* iocontrol functions */#define qiflush() _setqiflush(TRUE)#define noqiflush() _setqiflush(FALSE)#ifdef CURSES_MACROS#define echo() _setecho(TRUE)#define noecho() _setecho(FALSE)#define nl() _setnonl(FALSE)#define nonl() _setnonl(TRUE)#endif /* CURSES_MACROS *//* functions for setting time-out length on inputs */#ifdef PERFORMANCE#define wtimeout(win,tm) ((win)->_delay = (tm))#endif /* PERFORMANCE */#define set_term setcurscreen#define scr_set(file) _scr_all(file,2)#endif /* NOMACROS || lint *//* * Standard alternate character set. The current ACS world is evolving, * so we support only a widely available subset: the line drawing characters * from the VT100, plus a few from the Teletype 5410v1. Eventually there * may be support of more sophisticated ACS line drawing, such as that * in the Teletype 5410, the HP line drawing set, and the like. There may * be support for some non line oriented characters as well. * * Line drawing ACS names are of the form ACS_trbl, where t is the top, r * is the right, b is the bottom, and l is the left. t, r, b, and l might * be B (blank), S (single), D (double), or T (thick). The subset defined * here only uses B and S. */#define ACS_BSSB (acs_map['l'])#define ACS_SSBB (acs_map['m'])#define ACS_BBSS (acs_map['k'])#define ACS_SBBS (acs_map['j'])#define ACS_SBSS (acs_map['u'])#define ACS_SSSB (acs_map['t'])#define ACS_SSBS (acs_map['v'])#define ACS_BSSS (acs_map['w'])#define ACS_BSBS (acs_map['q'])#define ACS_SBSB (acs_map['x'])#define ACS_SSSS (acs_map['n'])/* * Human readable names for the most commonly used characters. * "Upper", "right", etc. are chosen to be consistent with the vt100 manual. */#define ACS_ULCORNER ACS_BSSB#define ACS_LLCORNER ACS_SSBB#define ACS_URCORNER ACS_BBSS#define ACS_LRCORNER ACS_SBBS#define ACS_RTEE ACS_SBSS#define ACS_LTEE ACS_SSSB#define ACS_BTEE ACS_SSBS#define ACS_TTEE ACS_BSSS#define ACS_HLINE ACS_BSBS#define ACS_VLINE ACS_SBSB#define ACS_PLUS ACS_SSSS#define ACS_S1 (acs_map['o']) /* scan line 1 */#define ACS_S9 (acs_map['s']) /* scan line 9 */#define ACS_DIAMOND (acs_map['`']) /* diamond */#define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */#define ACS_DEGREE (acs_map['f']) /* degree symbol */#define ACS_PLMINUS (acs_map['g']) /* plus/minus */#define ACS_BULLET (acs_map['~']) /* bullet */ /* Teletype 5410v1 symbols */#define ACS_LARROW (acs_map[',']) /* arrow pointing left */#define ACS_RARROW (acs_map['+']) /* arrow pointing right */#define ACS_DARROW (acs_map['.']) /* arrow pointing down */#define ACS_UARROW (acs_map['-']) /* arrow pointing up */#define ACS_BOARD (acs_map['h']) /* board of squares */#define ACS_LANTERN (acs_map['i']) /* lantern symbol */#define ACS_BLOCK (acs_map['0']) /* solid square block */.$a/* The definition for 'reg' is not standard, and is provided for compatibility reasons. Users are discouraged from using this.*/#define reg register/* Various video attributes */#define A_STANDOUT 000000200000L#define _STANDOUT A_STANDOUT /* for compatability with old curses */#define A_UNDERLINE 000000400000L#define A_REVERSE 000001000000L#define A_BLINK 000002000000L#define A_DIM 000004000000L#define A_BOLD 000010000000L#define A_ALTCHARSET 000100000000L/* The next two are subject to change so don't depend on them */#define A_INVIS 000020000000L#define A_PROTECT 000040000000L#define A_NORMAL 000000000000L#define A_ATTRIBUTES 037777600000L /* 0xFFFF0000 */#define A_CHARTEXT 000000177777L /* 0x0000FFFF */#endif /* CURSES_H */.0r copyright.h/SMI/d1i/* @(#)curses.ed 1.1 92/07/30 SMI; from S5R3.1 1.31 */.w curses.h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -