123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796 |
- #ifndef CURSES_H
- #define CURSES_H
-
- #include <stdint.h>
- #include <stdarg.h>
-
-
-
- #undef ERR
- #define ERR (-1)
-
- #undef FALSE
- #define FALSE (0)
-
- #undef OK
- #define OK (0)
-
- #undef TRUE
- #define TRUE (1)
-
- typedef short bool;
- typedef uint32_t chtype;
- typedef uint32_t attr_t;
-
-
- typedef struct _curses_screen {
- void ( *init ) ( struct _curses_screen *scr );
- void ( *exit ) ( struct _curses_screen *scr );
-
-
- void ( * movetoyx ) ( struct _curses_screen *scr,
- unsigned int y, unsigned int x );
-
-
- void ( * putc ) ( struct _curses_screen *scr, chtype c );
-
-
- int ( * getc ) ( struct _curses_screen *scr );
-
-
- bool ( *peek ) ( struct _curses_screen *scr );
- } SCREEN;
-
-
- typedef struct _curses_window {
-
- SCREEN *scr;
-
- attr_t attrs;
-
- unsigned int ori_x, ori_y;
-
- unsigned int curs_x, curs_y;
-
- unsigned int width, height;
-
- struct _curses_window *parent;
-
-
-
-
- } WINDOW;
-
- extern WINDOW _stdscr;
- extern SCREEN _curscr;
- extern unsigned short _COLS;
- extern unsigned short _LINES;
- extern unsigned int _COLOURS;
- extern unsigned int _COLOUR_PAIRS;
-
- #define stdscr ( &_stdscr )
- #define curscr ( &_curscr )
- #define COLS _COLS
- #define LINES _LINES
- #define COLORS _COLOURS
- #define COLOR_PAIRS _COLOUR_PAIRS
-
- #define MUCURSES_BITS( mask, shift ) (( mask ) << (shift))
- #define CPAIR_SHIFT 8
- #define ATTRS_SHIFT 16
-
- #define A_DEFAULT ( 1UL - 1UL )
- #define A_ALTCHARSET MUCURSES_BITS( 1UL, ATTRS_SHIFT + 0 )
- #define A_BLINK MUCURSES_BITS( 1UL, ATTRS_SHIFT + 1 )
- #define A_BOLD MUCURSES_BITS( 1UL, ATTRS_SHIFT + 2 )
- #define A_DIM MUCURSES_BITS( 1UL, ATTRS_SHIFT + 3 )
- #define A_INVIS MUCURSES_BITS( 1UL, ATTRS_SHIFT + 4 )
- #define A_PROTECT MUCURSES_BITS( 1UL, ATTRS_SHIFT + 5 )
- #define A_REVERSE MUCURSES_BITS( 1UL, ATTRS_SHIFT + 6 )
- #define A_STANDOUT MUCURSES_BITS( 1UL, ATTRS_SHIFT + 7 )
- #define A_UNDERLINE MUCURSES_BITS( 1UL, ATTRS_SHIFT + 8 )
-
- #define WA_ALTCHARSET A_ALTCHARSET
- #define WA_BLINK A_BLINK
- #define WA_BOLD A_BOLD
- #define WA_DIM A_DIM
- #define WA_INVIS A_INVIS
- #define WA_PROTECT A_PROTECT
- #define WA_REVERSE A_REVERSE
- #define WA_STANDOUT A_STANDOUT
- #define WA_UNDERLINE A_UNDERLINE
- #define WA_HORIZONTAL MUCURSES_BITS( 1UL, ATTRS_SHIFT + 9 )
- #define WA_VERTICAL MUCURSES_BITS( 1UL, ATTRS_SHIFT + 10 )
- #define WA_LEFT MUCURSES_BITS( 1UL, ATTRS_SHIFT + 11 )
- #define WA_RIGHT MUCURSES_BITS( 1UL, ATTRS_SHIFT + 12 )
- #define WA_LOW MUCURSES_BITS( 1UL, ATTRS_SHIFT + 13 )
- #define WA_TOP MUCURSES_BITS( 1UL, ATTRS_SHIFT + 14 )
-
- #define A_ATTRIBUTES ( MUCURSES_BITS( 1UL, ATTRS_SHIFT ) - 1UL )
- #define A_CHARTEXT ( MUCURSES_BITS( 1UL, 0 ) - 1UL )
- #define A_COLOUR MUCURSES_BITS( ( 1UL << 8 ) - 1UL, CPAIR_SHIFT )
- #define A_COLOR A_COLOUR
-
- #define ACS_ULCORNER '+'
- #define ACS_LLCORNER '+'
- #define ACS_URCORNER '+'
- #define ACS_LRCORNER '+'
- #define ACS_RTEE '+'
- #define ACS_LTEE '+'
- #define ACS_BTEE '+'
- #define ACS_TTEE '+'
- #define ACS_HLINE '-'
- #define ACS_VLINE '|'
- #define ACS_PLUS '+'
- #define ACS_S1 '-'
- #define ACS_S9 '_'
- #define ACS_DIAMOND '+'
- #define ACS_CKBOARD ':'
- #define ACS_DEGREE '\''
- #define ACS_PLMINUS '#'
- #define ACS_BULLET 'o'
- #define ACS_LARROW '<'
- #define ACS_RARROW '>'
- #define ACS_DARROW 'v'
- #define ACS_UARROW '^'
- #define ACS_BOARD '#'
- #define ACS_LANTERN '#'
- #define ACS_BLOCK '#'
-
- #define COLOUR_BLACK 0
- #define COLOUR_RED 1
- #define COLOUR_GREEN 2
- #define COLOUR_YELLOW 3
- #define COLOUR_BLUE 4
- #define COLOUR_MAGENTA 5
- #define COLOUR_CYAN 6
- #define COLOUR_WHITE 7
-
- #define COLOUR_FG 30
- #define COLOUR_BG 40
- #define COLOR_FG COLOUR_FG
- #define COLOR_BG COLOUR_BG
-
- #define COLOR_BLACK COLOUR_BLACK
- #define COLOR_BLUE COLOUR_BLUE
- #define COLOR_GREEN COLOUR_GREEN
- #define COLOR_CYAN COLOUR_CYAN
- #define COLOR_RED COLOUR_RED
- #define COLOR_MAGENTA COLOUR_MAGENTA
- #define COLOR_YELLOW COLOUR_YELLOW
- #define COLOR_WHITE COLOUR_WHITE
-
-
- #define KEY_BREAK 0401
- #define KEY_DOWN 0402
- #define KEY_UP 0403
- #define KEY_LEFT 0404
- #define KEY_RIGHT 0405
- #define KEY_HOME 0406
- #define KEY_BACKSPACE 0407
- #define KEY_F0 0410
- #define KEY_F(n) (KEY_F0+(n))
- #define KEY_DL 0510
- #define KEY_IL 0511
- #define KEY_DC 0512
- #define KEY_IC 0513
- #define KEY_EIC 0514
- #define KEY_CLEAR 0515
- #define KEY_EOS 0516
- #define KEY_EOL 0517
- #define KEY_SF 0520
- #define KEY_SR 0521
- #define KEY_NPAGE 0522
- #define KEY_PPAGE 0523
- #define KEY_STAB 0524
- #define KEY_CTAB 0525
- #define KEY_CATAB 0526
- #define KEY_ENTER 0527
- #define KEY_PRINT 0532
- #define KEY_LL 0533
- #define KEY_A1 0534
- #define KEY_A3 0535
- #define KEY_B2 0536
- #define KEY_C1 0537
- #define KEY_C3 0540
- #define KEY_BTAB 0541
- #define KEY_BEG 0542
- #define KEY_CANCEL 0543
- #define KEY_CLOSE 0544
- #define KEY_COMMAND 0545
- #define KEY_COPY 0546
- #define KEY_CREATE 0547
- #define KEY_END 0550
- #define KEY_EXIT 0551
- #define KEY_FIND 0552
- #define KEY_HELP 0553
- #define KEY_MARK 0554
- #define KEY_MESSAGE 0555
- #define KEY_MOVE 0556
- #define KEY_NEXT 0557
- #define KEY_OPEN 0560
- #define KEY_OPTIONS 0561
- #define KEY_PREVIOUS 0562
- #define KEY_REDO 0563
- #define KEY_REFERENCE 0564
- #define KEY_REFRESH 0565
- #define KEY_REPLACE 0566
- #define KEY_RESTART 0567
- #define KEY_RESUME 0570
- #define KEY_SAVE 0571
- #define KEY_SBEG 0572
- #define KEY_SCANCEL 0573
- #define KEY_SCOMMAND 0574
- #define KEY_SCOPY 0575
- #define KEY_SCREATE 0576
- #define KEY_SDC 0577
- #define KEY_SDL 0600
- #define KEY_SELECT 0601
- #define KEY_SEND 0602
- #define KEY_SEOL 0603
- #define KEY_SEXIT 0604
- #define KEY_SFIND 0605
- #define KEY_SHELP 0606
- #define KEY_SHOME 0607
- #define KEY_SIC 0610
- #define KEY_SLEFT 0611
- #define KEY_SMESSAGE 0612
- #define KEY_SMOVE 0613
- #define KEY_SNEXT 0614
- #define KEY_SOPTIONS 0615
- #define KEY_SPREVIOUS 0616
- #define KEY_SPRINT 0617
- #define KEY_SREDO 0620
- #define KEY_SREPLACE 0621
- #define KEY_SRIGHT 0622
- #define KEY_SRSUME 0623
- #define KEY_SSAVE 0624
- #define KEY_SSUSPEND 0625
- #define KEY_SUNDO 0626
- #define KEY_SUSPEND 0627
- #define KEY_UNDO 0630
- #define KEY_RESIZE 0632
- #define KEY_EVENT 0633
-
- #define KEY_MAX 0777
-
-
-
-
-
-
-
-
-
- extern int attr_get ( attr_t *, short *, void * );
- extern int attr_off ( attr_t, void * );
- extern int attr_on ( attr_t, void * );
- extern int attr_set ( attr_t, short, void * );
- extern int baudrate ( void );
- extern int beep ( void );
-
-
- extern int box ( WINDOW *, chtype, chtype );
- extern bool can_change_colour ( void );
- #define can_change_color() can_change_colour()
- extern int cbreak ( void );
-
-
- extern int colour_content ( short, short *, short *, short * );
- #define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
-
-
- extern int copywin ( const WINDOW *, WINDOW *, int, int, int,
- int, int, int, int );
- extern int curs_set ( int );
- extern int def_prog_mode ( void );
- extern int def_shell_mode ( void );
- extern int delay_output ( int );
-
-
- extern void delscreen ( SCREEN * );
- extern int delwin ( WINDOW * );
- extern WINDOW *derwin ( WINDOW *, int, int, int, int );
-
- extern WINDOW *dupwin ( WINDOW * );
- extern int echo ( void );
- extern int echochar ( const chtype );
- extern int endwin ( void );
- extern char erasechar ( void );
-
- extern void filter ( void );
- extern int flash ( void );
- extern int flushinp ( void );
- extern chtype getbkgd ( WINDOW * );
-
-
-
- extern int halfdelay ( int );
- extern bool has_colors ( void );
- extern bool has_ic ( void );
- extern bool has_il ( void );
-
- extern void idcok ( WINDOW *, bool );
- extern int idlok ( WINDOW *, bool );
-
-
-
-
- extern WINDOW *initscr ( void );
- extern int init_colour ( short, short, short, short );
- #define init_color ( c, r, g, b ) init_colour ( (c), (r), (g), (b) )
- extern int init_pair ( short, short, short );
-
-
-
-
-
- extern int intrflush ( WINDOW *, bool );
- extern bool isendwin ( void );
-
-
- extern char *keyname ( int );
- extern int keypad ( WINDOW *, bool );
- extern char killchar ( void );
- extern int leaveok ( WINDOW *, bool );
- extern char *longname ( void );
- extern int meta ( WINDOW *, bool );
-
-
-
-
-
-
- extern int mvcur ( int, int, int, int );
-
- extern int mvderwin ( WINDOW *, int, int );
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- extern int mvwin ( WINDOW *, int, int );
-
-
-
-
-
-
-
-
-
-
-
- extern int napms ( int );
-
- extern WINDOW *newwin ( int, int, int, int );
- extern int nl ( void );
- extern int nocbreak ( void );
- extern int nodelay ( WINDOW *, bool );
- extern int noecho ( void );
- extern int nonl ( void );
- extern void noqiflush ( void );
- extern int noraw ( void );
- extern int notimeout ( WINDOW *, bool );
- extern int overlay ( const WINDOW *, WINDOW * );
- extern int overwrite ( const WINDOW *, WINDOW * );
- extern int pair_content ( short, short *, short * );
- extern int PAIR_NUMBER ( int );
-
-
-
- extern int printw ( char *, ... );
- extern int putp ( const char * );
- extern void qiflush ( void );
- extern int raw ( void );
-
-
- extern int reset_prog_mode ( void );
- extern int reset_shell_mode ( void );
- extern int resetty ( void );
- extern int ripoffline ( int, int (*) ( WINDOW *, int) );
- extern int savetty ( void );
-
-
-
-
-
- extern SCREEN *set_term ( SCREEN * );
- extern int setupterm ( char *, int, int * );
- extern int slk_attr_off ( const attr_t, void * );
- extern int slk_attroff ( const chtype );
- extern int slk_attr_on ( const attr_t, void * );
- extern int slk_attron ( const chtype );
- extern int slk_attr_set ( const attr_t, short, void * );
- extern int slk_attrset ( const chtype );
- extern int slk_clear ( void );
- extern int slk_colour ( short );
- #define slk_color( c ) slk_colour( (c) )
- extern int slk_init ( int );
- extern char *slk_label ( int );
- extern int slk_noutrefresh ( void );
-
- extern int slk_restore ( void );
- extern int slk_set ( int, const char *, int );
- extern int slk_touch ( void );
- extern int standend ( void );
- extern int standout ( void );
- extern int start_colour ( void );
- #define start_color() start_colour()
-
- extern WINDOW *subwin ( WINDOW *, int, int, int, int );
- extern int syncok ( WINDOW *, bool );
- extern chtype termattrs ( void );
- extern attr_t term_attrs ( void );
- extern char *termname ( void );
- extern int tigetflag ( char * );
- extern int tigetnum ( char * );
- extern char *tigetstr ( char * );
- extern void timeout ( int );
-
-
- extern char *tparm ( char *, long, long, long, long, long, long, long, long,
- long );
- extern int typeahead ( int );
-
-
- extern void use_env ( bool );
- extern int vid_attr ( attr_t, short, void * );
- extern int vidattr ( chtype );
- extern int vid_puts ( attr_t, short, void *, int ( *) ( int) );
- extern int vidputs ( chtype, int ( *) ( int) );
-
-
- extern int vw_printw ( WINDOW *, const char *, va_list );
-
-
- extern int waddch ( WINDOW *, const chtype );
- extern int waddchnstr ( WINDOW *, const chtype *, int );
-
- extern int waddnstr ( WINDOW *, const char *, int );
-
- extern int wattroff ( WINDOW *, int );
- extern int wattron ( WINDOW *, int );
- extern int wattrset ( WINDOW *, int );
- extern int wattr_get ( WINDOW *, attr_t *, short *, void * );
- extern int wattr_off ( WINDOW *, attr_t, void * );
- extern int wattr_on ( WINDOW *, attr_t, void * );
- extern int wattr_set ( WINDOW *, attr_t, short, void * );
-
- extern int wborder ( WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
- chtype, chtype );
- extern int wclrtobot ( WINDOW * );
- extern int wclrtoeol ( WINDOW * );
- extern void wcursyncup ( WINDOW * );
-
- #define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
- extern int wdelch ( WINDOW * );
- extern int wdeleteln ( WINDOW * );
- extern int wechochar ( WINDOW *, const chtype );
- extern int werase ( WINDOW * );
- extern int wgetch ( WINDOW * );
- extern int wgetnstr ( WINDOW *, char *, int );
-
- extern int whline ( WINDOW *, chtype, int );
-
-
-
-
-
-
-
-
- extern int wmove ( WINDOW *, int, int );
-
- extern int wprintw ( WINDOW *, const char *, ... );
-
-
-
-
-
-
-
- extern void wsyncup ( WINDOW * );
- extern void wsyncdown ( WINDOW * );
- extern void wtimeout ( WINDOW *, int );
-
- extern int wvline ( WINDOW *, chtype, int );
-
-
-
- static inline int addch ( const chtype ch ) {
- return waddch( stdscr, ch );
- }
-
- static inline int addchnstr ( const chtype *chstr, int n ) {
- return waddchnstr ( stdscr, chstr, n );
- }
-
- static inline int addchstr ( const chtype *chstr ) {
- return waddchnstr ( stdscr, chstr, -1 );
- }
-
- static inline int addnstr ( const char *str, int n ) {
- return waddnstr ( stdscr, str, n );
- }
-
- static inline int addstr ( const char *str ) {
- return waddnstr ( stdscr, str, -1 );
- }
-
- static inline int attroff ( int attrs ) {
- return wattroff ( stdscr, attrs );
- }
-
- static inline int attron ( int attrs ) {
- return wattron ( stdscr, attrs );
- }
-
- static inline int attrset ( int attrs ) {
- return wattrset ( stdscr, attrs );
- }
-
- static inline void bkgdset ( chtype ch ) {
- wattrset ( stdscr, ch );
- }
-
- static inline int border ( chtype ls, chtype rs, chtype ts, chtype bs,
- chtype tl, chtype tr, chtype bl, chtype br ) {
- return wborder ( stdscr, ls, rs, ts, bs, tl, tr, bl, br );
- }
-
- static inline int clrtobot ( void ) {
- return wclrtobot( stdscr );
- }
-
- static inline int clrtoeol ( void ) {
- return wclrtoeol( stdscr );
- }
-
- static inline int delch ( void ) {
- return wdelch ( stdscr );
- }
-
- static inline int deleteln ( void ) {
- return wdeleteln( stdscr );
- }
-
- static inline int erase ( void ) {
- return werase ( stdscr );
- }
-
- static inline int getch ( void ) {
- return wgetch ( stdscr );
- }
-
- static inline int getnstr ( char *str, int n ) {
- return wgetnstr ( stdscr, str, n );
- }
-
- static inline int getstr ( char *str ) {
- return wgetnstr ( stdscr, str, -1 );
- }
-
- static inline int hline ( chtype ch, int n ) {
- return whline ( stdscr, ch, n );
- }
-
- static inline int move ( int y, int x ) {
- return wmove ( stdscr, y, x );
- }
-
- static inline int mvaddch ( int y, int x, const chtype ch ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? waddch( stdscr, ch ) : ERR );
- }
-
- static inline int mvaddchnstr ( int y, int x, const chtype *chstr, int n ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? waddchnstr ( stdscr, chstr, n ) : ERR );
- }
-
- static inline int mvaddchstr ( int y, int x, const chtype *chstr ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? waddchnstr ( stdscr, chstr, -1 ) : ERR );
- }
-
- static inline int mvaddnstr ( int y, int x, const char *str, int n ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? waddnstr ( stdscr, str, n ) : ERR );
- }
-
- static inline int mvaddstr ( int y, int x, const char *str ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? waddnstr ( stdscr, str, -1 ) : ERR );
- }
-
- static inline int mvdelch ( int y, int x ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? wdelch ( stdscr ) : ERR );
- }
-
- static inline int mvgetch ( int y, int x ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? wgetch ( stdscr ) : ERR );
- }
-
- static inline int mvgetnstr ( int y, int x, char *str, int n ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? wgetnstr ( stdscr, str, n ) : ERR );
- }
-
- static inline int mvgetstr ( int y, int x, char *str ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? wgetnstr ( stdscr, str, -1 ) : ERR );
- }
-
- static inline int mvhline ( int y, int x, chtype ch, int n ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? whline ( stdscr, ch, n ) : ERR );
- }
-
-
- #define mvprintw( y, x, fmt, ... ) \
- ( wmove(stdscr,(y),(x)) == OK \
- ? wprintw( stdscr,(fmt), ## __VA_ARGS__ ) : ERR )
-
- static inline int mvvline ( int y, int x, chtype ch, int n ) {
- return ( wmove ( stdscr, y, x ) == OK
- ? wvline ( stdscr, ch, n ) : ERR );
- }
-
- static inline int mvwaddch ( WINDOW *win, int y, int x, const chtype ch ) {
- return ( wmove( win, y, x ) == OK
- ? waddch ( win, ch ) : ERR );
- }
-
- static inline int mvwaddchnstr ( WINDOW *win, int y, int x, const chtype *chstr, int n ) {
- return ( wmove ( win, y, x ) == OK
- ? waddchnstr ( win, chstr, n ) : ERR );
- }
-
- static inline int mvwaddchstr ( WINDOW *win, int y, int x, const chtype *chstr ) {
- return ( wmove ( win, y, x ) == OK
- ? waddchnstr ( win, chstr, -1 ) : ERR );
- }
-
- static inline int mvwaddnstr ( WINDOW *win, int y, int x, const char *str, int n ) {
- return ( wmove ( win, y, x ) == OK
- ? waddnstr ( win, str, n ) : ERR );
- }
-
- static inline int mvwaddstr ( WINDOW *win, int y, int x, const char *str ) {
- return ( wmove ( win, y, x ) == OK
- ? waddnstr ( win, str, -1 ) : ERR );
- }
-
- static inline int mvwdelch ( WINDOW *win, int y, int x ) {
- return ( wmove ( win, y, x ) == OK
- ? wdelch ( win ) : ERR );
- }
-
- static inline int mvwgetch ( WINDOW *win, int y, int x ) {
- return ( wmove ( win, y, x ) == OK
- ? wgetch ( win ) : ERR );
- }
-
- static inline int mvwgetnstr ( WINDOW *win, int y, int x, char *str, int n ) {
- return ( wmove ( win, y, x ) == OK
- ? wgetnstr ( win, str, n ) : ERR );
- }
-
- static inline int mvwgetstr ( WINDOW *win, int y, int x, char *str ) {
- return ( wmove ( win, y, x ) == OK
- ? wgetnstr ( win, str, -1 ) : ERR );
- }
-
- static inline int mvwhline ( WINDOW *win, int y, int x, chtype ch, int n ) {
- return ( wmove ( win, y, x ) == OK
- ? whline ( win, ch, n ) : ERR );
- }
-
- #define mvwprintw( win, y, x, fmt, ... ) \
- ( wmove((win),(y),(x)) == OK \
- ? wprintw((win),(fmt), ## __VA_ARGS__) : ERR )
-
- static inline int mvwvline ( WINDOW *win, int y, int x, chtype ch, int n ) {
- return ( wmove ( win, y, x ) == OK
- ? wvline ( win, ch, n ) : ERR );
- }
-
- #define printw( fmt, ... ) wprintw(stdscr,(fmt), ## __VA_ARGS__ )
-
- static inline int slk_refresh ( void ) {
- if ( slk_clear() == OK )
- return slk_restore();
- else
- return ERR;
- }
-
- #define standend() wstandend( stdscr )
- #define standout() wstandout( stdscr )
-
- static inline int vline ( chtype ch, int n ) {
- return wvline ( stdscr, ch, n );
- }
-
-
- static inline int vwprintw ( WINDOW *win, const char *fmt, va_list varglist ) {
- return vw_printw ( win, fmt, varglist );
- }
-
- static inline int waddchstr ( WINDOW *win, const chtype *chstr ) {
- return waddchnstr ( win, chstr, -1 );
- }
-
- static inline int waddstr ( WINDOW *win, const char *str ) {
- return waddnstr ( win, str, -1 );
- }
-
- static inline int wbkgdset ( WINDOW *win, chtype ch ) {
- return wattrset( win, ch );
- }
-
- static inline int wgetstr ( WINDOW *win, char *str ) {
- return wgetnstr ( win, str, -1 );
- }
-
- static inline int wstandend ( WINDOW *win ) {
- return wattrset ( win, A_DEFAULT );
- }
-
- static inline int wstandout ( WINDOW *win ) {
- return wattrset ( win, A_STANDOUT );
- }
-
- #endif
|