2006-05-15 09:29:48 +00:00
|
|
|
#ifndef CURSES_H
|
|
|
|
#define CURSES_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
/** @file
|
|
|
|
*
|
|
|
|
* MuCurses header file
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#undef ERR
|
2006-06-27 10:38:57 +00:00
|
|
|
#define ERR (-1)
|
2006-05-15 09:29:48 +00:00
|
|
|
|
|
|
|
#undef FALSE
|
|
|
|
#define FALSE (0)
|
|
|
|
|
|
|
|
#undef OK
|
|
|
|
#define OK (0)
|
|
|
|
|
|
|
|
#undef TRUE
|
|
|
|
#define TRUE (1)
|
|
|
|
|
2006-12-18 16:48:09 +00:00
|
|
|
typedef int bool;
|
2006-05-15 09:29:48 +00:00
|
|
|
typedef uint32_t chtype;
|
2006-06-27 10:38:57 +00:00
|
|
|
typedef uint32_t attr_t;
|
2006-05-15 09:29:48 +00:00
|
|
|
|
|
|
|
/** Curses SCREEN object */
|
|
|
|
typedef struct _curses_screen {
|
2006-12-19 00:51:32 +00:00
|
|
|
/** Current cursor position */
|
|
|
|
unsigned int curs_x, curs_y;
|
2006-12-19 00:27:25 +00:00
|
|
|
/** Current attribute */
|
|
|
|
attr_t attrs;
|
|
|
|
|
2006-06-27 10:38:57 +00:00
|
|
|
void ( *init ) ( struct _curses_screen *scr );
|
|
|
|
void ( *exit ) ( struct _curses_screen *scr );
|
2006-05-15 09:51:18 +00:00
|
|
|
/**
|
|
|
|
* Move cursor to position specified by x,y coords
|
|
|
|
*
|
|
|
|
* @v scr screen on which to operate
|
|
|
|
* @v y Y position
|
|
|
|
* @v x X position
|
|
|
|
*/
|
|
|
|
void ( * movetoyx ) ( struct _curses_screen *scr,
|
|
|
|
unsigned int y, unsigned int x );
|
|
|
|
/**
|
|
|
|
* Write character to current cursor position
|
|
|
|
*
|
|
|
|
* @v scr screen on which to operate
|
|
|
|
* @v c character to be written
|
|
|
|
*/
|
|
|
|
void ( * putc ) ( struct _curses_screen *scr, chtype c );
|
2006-12-19 00:27:25 +00:00
|
|
|
/**
|
|
|
|
* Pop a character from the keyboard input stream
|
|
|
|
*
|
|
|
|
* @v scr screen on which to operate
|
|
|
|
* @ret c popped character
|
|
|
|
*/
|
|
|
|
int ( * getc ) ( struct _curses_screen *scr );
|
|
|
|
/**
|
|
|
|
* Checks to see whether a character is waiting in the input stream
|
|
|
|
*
|
|
|
|
* @v scr screen on which to operate
|
|
|
|
* @ret TRUE character waiting in stream
|
|
|
|
* @ret FALSE no character waiting in stream
|
|
|
|
*/
|
|
|
|
bool ( *peek ) ( struct _curses_screen *scr );
|
2006-05-15 09:29:48 +00:00
|
|
|
} SCREEN;
|
|
|
|
|
|
|
|
/** Curses Window struct */
|
|
|
|
typedef struct _curses_window {
|
|
|
|
/** screen with which window associates */
|
|
|
|
SCREEN *scr;
|
|
|
|
/** window attributes */
|
|
|
|
attr_t attrs;
|
|
|
|
/** window origin coordinates */
|
|
|
|
unsigned int ori_x, ori_y;
|
|
|
|
/** window cursor position */
|
|
|
|
unsigned int curs_x, curs_y;
|
|
|
|
/** window dimensions */
|
|
|
|
unsigned int width, height;
|
2006-06-27 10:38:57 +00:00
|
|
|
/** parent window */
|
|
|
|
struct _curses_window *parent;
|
|
|
|
/** windows that share the same parent as this one */
|
|
|
|
//struct list_head siblings;
|
|
|
|
/** windows der'd or sub'd from this one */
|
|
|
|
//struct list_head children;
|
2006-05-15 09:29:48 +00:00
|
|
|
} WINDOW;
|
|
|
|
|
|
|
|
extern WINDOW _stdscr;
|
2006-05-19 16:22:10 +00:00
|
|
|
extern unsigned short _COLS;
|
|
|
|
extern unsigned short _LINES;
|
|
|
|
|
2006-05-15 09:29:48 +00:00
|
|
|
#define stdscr ( &_stdscr )
|
2006-05-19 16:22:10 +00:00
|
|
|
#define COLS _COLS
|
|
|
|
#define LINES _LINES
|
2006-05-15 09:29:48 +00:00
|
|
|
|
2006-05-19 16:22:10 +00:00
|
|
|
#define MUCURSES_BITS( mask, shift ) (( mask ) << (shift))
|
|
|
|
#define CPAIR_SHIFT 8
|
|
|
|
#define ATTRS_SHIFT 16
|
2006-05-15 09:29:48 +00:00
|
|
|
|
2006-12-19 00:27:25 +00:00
|
|
|
#define WA_DEFAULT ( 0x0000 << ATTRS_SHIFT )
|
|
|
|
#define WA_ALTCHARSET ( 0x0001 << ATTRS_SHIFT )
|
|
|
|
#define WA_BLINK ( 0x0002 << ATTRS_SHIFT )
|
|
|
|
#define WA_BOLD ( 0x0004 << ATTRS_SHIFT )
|
|
|
|
#define WA_DIM ( 0x0008 << ATTRS_SHIFT )
|
|
|
|
#define WA_INVIS ( 0x0010 << ATTRS_SHIFT )
|
|
|
|
#define WA_PROTECT ( 0x0020 << ATTRS_SHIFT )
|
|
|
|
#define WA_REVERSE ( 0x0040 << ATTRS_SHIFT )
|
|
|
|
#define WA_STANDOUT ( 0x0080 << ATTRS_SHIFT )
|
|
|
|
#define WA_UNDERLINE ( 0x0100 << ATTRS_SHIFT )
|
|
|
|
#define WA_HORIZONTAL ( 0x0200 << ATTRS_SHIFT )
|
|
|
|
#define WA_VERTICAL ( 0x0400 << ATTRS_SHIFT )
|
|
|
|
#define WA_LEFT ( 0x0800 << ATTRS_SHIFT )
|
|
|
|
#define WA_RIGHT ( 0x1000 << ATTRS_SHIFT )
|
|
|
|
#define WA_LOW ( 0x2000 << ATTRS_SHIFT )
|
|
|
|
#define WA_TOP ( 0x4000 << ATTRS_SHIFT )
|
|
|
|
|
|
|
|
#define A_DEFAULT WA_DEFAULT
|
|
|
|
#define A_ALTCHARSET WA_ALTCHARSET
|
|
|
|
#define A_BLINK WA_BLINK
|
|
|
|
#define A_BOLD WA_BOLD
|
|
|
|
#define A_DIM WA_DIM
|
|
|
|
#define A_INVIS WA_INVIS
|
|
|
|
#define A_PROTECT WA_PROTECT
|
|
|
|
#define A_REVERSE WA_REVERSE
|
|
|
|
#define A_STANDOUT WA_STANDOUT
|
|
|
|
#define A_UNDERLINE WA_UNDERLINE
|
|
|
|
|
|
|
|
#define A_ATTRIBUTES ( 0xffff << ATTRS_SHIFT )
|
|
|
|
#define A_CHARTEXT ( 0xff )
|
|
|
|
#define A_COLOUR ( 0xff << CPAIR_SHIFT )
|
2006-06-27 10:38:57 +00:00
|
|
|
#define A_COLOR A_COLOUR
|
2006-05-15 09:29:48 +00:00
|
|
|
|
2006-12-19 00:27:25 +00:00
|
|
|
#define COLOUR_PAIR(n) ( (n) << CPAIR_SHIFT )
|
|
|
|
#define COLOR_PAIR(n) COLOUR_PAIR(n)
|
|
|
|
#define PAIR_NUMBER(attrs) ( ( (attrs) & A_COLOUR ) >> CPAIR_SHIFT )
|
|
|
|
|
2006-12-20 03:42:35 +00:00
|
|
|
#define COLOUR_PAIRS 8 /* Arbitrary limit */
|
2006-12-19 00:27:25 +00:00
|
|
|
#define COLOR_PAIRS COLOUR_PAIRS
|
|
|
|
|
2006-05-15 09:29:48 +00:00
|
|
|
#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
|
2006-06-27 10:38:57 +00:00
|
|
|
#define COLOUR_RED 1
|
2006-05-15 09:29:48 +00:00
|
|
|
#define COLOUR_GREEN 2
|
2006-06-27 10:38:57 +00:00
|
|
|
#define COLOUR_YELLOW 3
|
|
|
|
#define COLOUR_BLUE 4
|
2006-05-15 09:29:48 +00:00
|
|
|
#define COLOUR_MAGENTA 5
|
2006-06-27 10:38:57 +00:00
|
|
|
#define COLOUR_CYAN 6
|
2006-05-15 09:29:48 +00:00
|
|
|
#define COLOUR_WHITE 7
|
2006-12-19 00:27:25 +00:00
|
|
|
#define COLOURS 7
|
2006-05-15 09:29:48 +00:00
|
|
|
|
2006-06-27 10:38:57 +00:00
|
|
|
#define COLOUR_FG 30
|
|
|
|
#define COLOUR_BG 40
|
|
|
|
#define COLOR_FG COLOUR_FG
|
|
|
|
#define COLOR_BG COLOUR_BG
|
|
|
|
|
2006-05-15 09:29:48 +00:00
|
|
|
#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
|
2006-12-19 00:27:25 +00:00
|
|
|
#define COLORS COLOURS
|
2006-05-15 09:29:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* KEY code constants
|
|
|
|
*/
|
2006-12-20 21:10:32 +00:00
|
|
|
#define KEY_MIN 0401 /**< Minimum special key */
|
2006-05-15 09:29:48 +00:00
|
|
|
#define KEY_BREAK 0401 /**< Break key */
|
|
|
|
#define KEY_DOWN 0402 /**< down-arrow key */
|
|
|
|
#define KEY_UP 0403 /**< up-arrow key */
|
|
|
|
#define KEY_LEFT 0404 /**< left-arrow key */
|
|
|
|
#define KEY_RIGHT 0405 /**< right-arrow key */
|
|
|
|
#define KEY_HOME 0406 /**< home key */
|
|
|
|
#define KEY_BACKSPACE 0407 /**< backspace key */
|
|
|
|
#define KEY_F0 0410 /**< Function keys. Space for 64 */
|
|
|
|
#define KEY_F(n) (KEY_F0+(n)) /**< Value of function key n */
|
|
|
|
#define KEY_DL 0510 /**< delete-line key */
|
|
|
|
#define KEY_IL 0511 /**< insert-line key */
|
|
|
|
#define KEY_DC 0512 /**< delete-character key */
|
|
|
|
#define KEY_IC 0513 /**< insert-character key */
|
|
|
|
#define KEY_EIC 0514 /**< sent by rmir or smir in insert mode */
|
|
|
|
#define KEY_CLEAR 0515 /**< clear-screen or erase key */
|
|
|
|
#define KEY_EOS 0516 /**< clear-to-end-of-screen key */
|
|
|
|
#define KEY_EOL 0517 /**< clear-to-end-of-line key */
|
|
|
|
#define KEY_SF 0520 /**< scroll-forward key */
|
|
|
|
#define KEY_SR 0521 /**< scroll-backward key */
|
|
|
|
#define KEY_NPAGE 0522 /**< next-page key */
|
|
|
|
#define KEY_PPAGE 0523 /**< previous-page key */
|
|
|
|
#define KEY_STAB 0524 /**< set-tab key */
|
|
|
|
#define KEY_CTAB 0525 /**< clear-tab key */
|
|
|
|
#define KEY_CATAB 0526 /**< clear-all-tabs key */
|
|
|
|
#define KEY_ENTER 0527 /**< enter/send key */
|
|
|
|
#define KEY_PRINT 0532 /**< print key */
|
|
|
|
#define KEY_LL 0533 /**< lower-left key (home down) */
|
|
|
|
#define KEY_A1 0534 /**< upper left of keypad */
|
|
|
|
#define KEY_A3 0535 /**< upper right of keypad */
|
|
|
|
#define KEY_B2 0536 /**< center of keypad */
|
|
|
|
#define KEY_C1 0537 /**< lower left of keypad */
|
|
|
|
#define KEY_C3 0540 /**< lower right of keypad */
|
|
|
|
#define KEY_BTAB 0541 /**< back-tab key */
|
|
|
|
#define KEY_BEG 0542 /**< begin key */
|
|
|
|
#define KEY_CANCEL 0543 /**< cancel key */
|
|
|
|
#define KEY_CLOSE 0544 /**< close key */
|
|
|
|
#define KEY_COMMAND 0545 /**< command key */
|
|
|
|
#define KEY_COPY 0546 /**< copy key */
|
|
|
|
#define KEY_CREATE 0547 /**< create key */
|
|
|
|
#define KEY_END 0550 /**< end key */
|
|
|
|
#define KEY_EXIT 0551 /**< exit key */
|
|
|
|
#define KEY_FIND 0552 /**< find key */
|
|
|
|
#define KEY_HELP 0553 /**< help key */
|
|
|
|
#define KEY_MARK 0554 /**< mark key */
|
|
|
|
#define KEY_MESSAGE 0555 /**< message key */
|
|
|
|
#define KEY_MOVE 0556 /**< move key */
|
|
|
|
#define KEY_NEXT 0557 /**< next key */
|
|
|
|
#define KEY_OPEN 0560 /**< open key */
|
|
|
|
#define KEY_OPTIONS 0561 /**< options key */
|
|
|
|
#define KEY_PREVIOUS 0562 /**< previous key */
|
|
|
|
#define KEY_REDO 0563 /**< redo key */
|
|
|
|
#define KEY_REFERENCE 0564 /**< reference key */
|
|
|
|
#define KEY_REFRESH 0565 /**< refresh key */
|
|
|
|
#define KEY_REPLACE 0566 /**< replace key */
|
|
|
|
#define KEY_RESTART 0567 /**< restart key */
|
|
|
|
#define KEY_RESUME 0570 /**< resume key */
|
|
|
|
#define KEY_SAVE 0571 /**< save key */
|
|
|
|
#define KEY_SBEG 0572 /**< shifted begin key */
|
|
|
|
#define KEY_SCANCEL 0573 /**< shifted cancel key */
|
|
|
|
#define KEY_SCOMMAND 0574 /**< shifted command key */
|
|
|
|
#define KEY_SCOPY 0575 /**< shifted copy key */
|
|
|
|
#define KEY_SCREATE 0576 /**< shifted create key */
|
|
|
|
#define KEY_SDC 0577 /**< shifted delete-character key */
|
|
|
|
#define KEY_SDL 0600 /**< shifted delete-line key */
|
|
|
|
#define KEY_SELECT 0601 /**< select key */
|
|
|
|
#define KEY_SEND 0602 /**< shifted end key */
|
|
|
|
#define KEY_SEOL 0603 /**< shifted clear-to-end-of-line key */
|
|
|
|
#define KEY_SEXIT 0604 /**< shifted exit key */
|
|
|
|
#define KEY_SFIND 0605 /**< shifted find key */
|
|
|
|
#define KEY_SHELP 0606 /**< shifted help key */
|
|
|
|
#define KEY_SHOME 0607 /**< shifted home key */
|
|
|
|
#define KEY_SIC 0610 /**< shifted insert-character key */
|
|
|
|
#define KEY_SLEFT 0611 /**< shifted left-arrow key */
|
|
|
|
#define KEY_SMESSAGE 0612 /**< shifted message key */
|
|
|
|
#define KEY_SMOVE 0613 /**< shifted move key */
|
|
|
|
#define KEY_SNEXT 0614 /**< shifted next key */
|
|
|
|
#define KEY_SOPTIONS 0615 /**< shifted options key */
|
|
|
|
#define KEY_SPREVIOUS 0616 /**< shifted previous key */
|
|
|
|
#define KEY_SPRINT 0617 /**< shifted print key */
|
|
|
|
#define KEY_SREDO 0620 /**< shifted redo key */
|
|
|
|
#define KEY_SREPLACE 0621 /**< shifted replace key */
|
|
|
|
#define KEY_SRIGHT 0622 /**< shifted right-arrow key */
|
|
|
|
#define KEY_SRSUME 0623 /**< shifted resume key */
|
|
|
|
#define KEY_SSAVE 0624 /**< shifted save key */
|
|
|
|
#define KEY_SSUSPEND 0625 /**< shifted suspend key */
|
|
|
|
#define KEY_SUNDO 0626 /**< shifted undo key */
|
|
|
|
#define KEY_SUSPEND 0627 /**< suspend key */
|
|
|
|
#define KEY_UNDO 0630 /**< undo key */
|
|
|
|
#define KEY_RESIZE 0632 /**< Terminal resize event */
|
|
|
|
#define KEY_EVENT 0633 /**< We were interrupted by an event */
|
|
|
|
|
|
|
|
#define KEY_MAX 0777 /* Maximum key value is 0633 */
|
|
|
|
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int addch ( const chtype * );
|
|
|
|
//extern int addchnstr ( const chtype *, int );
|
|
|
|
//extern int addchstr ( const chtype * );
|
|
|
|
//extern int addnstr ( const char *, int );
|
|
|
|
//extern int addstr ( const char * );
|
|
|
|
//extern int attroff ( int );
|
|
|
|
//extern int attron ( int );
|
|
|
|
//extern int attrset ( int );
|
2006-12-20 06:06:38 +00:00
|
|
|
//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 * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int baudrate ( void );
|
|
|
|
extern int beep ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern void bkgdset ( chtype );
|
2006-05-15 09:29:48 +00:00
|
|
|
/*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
|
|
|
|
chtype );*/
|
|
|
|
extern int box ( WINDOW *, chtype, chtype );
|
2006-12-19 00:27:25 +00:00
|
|
|
//extern bool can_change_colour ( void );
|
2006-05-15 09:29:48 +00:00
|
|
|
#define can_change_color() can_change_colour()
|
|
|
|
extern int cbreak ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int clrtobot ( void );
|
|
|
|
//extern int clrtoeol ( void );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int colour_content ( short, short *, short *, short * );
|
2006-06-27 10:38:57 +00:00
|
|
|
#define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
|
|
|
|
//extern int colour_set ( short, void * );
|
2006-12-19 00:27:25 +00:00
|
|
|
#define color_set( cpno, opts ) colour_set( (cpno), (opts) )
|
2006-05-15 09:29:48 +00:00
|
|
|
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 );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int delch ( void );
|
|
|
|
//extern int deleteln ( void );
|
2006-05-22 17:03:41 +00:00
|
|
|
extern void delscreen ( SCREEN * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int delwin ( WINDOW * );
|
|
|
|
extern WINDOW *derwin ( WINDOW *, int, int, int, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int doupdate ( void );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern WINDOW *dupwin ( WINDOW * );
|
|
|
|
extern int echo ( void );
|
|
|
|
extern int echochar ( const chtype );
|
|
|
|
extern int endwin ( void );
|
|
|
|
extern char erasechar ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int erase ( void );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern void filter ( void );
|
|
|
|
extern int flash ( void );
|
|
|
|
extern int flushinp ( void );
|
|
|
|
extern chtype getbkgd ( WINDOW * );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int getch ( void );
|
|
|
|
//extern int getnstr ( char *, int );
|
|
|
|
//extern int getstr ( char * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int halfdelay ( int );
|
2006-12-19 00:27:25 +00:00
|
|
|
//extern bool has_colors ( void );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern bool has_ic ( void );
|
|
|
|
extern bool has_il ( void );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern int hline ( chtype, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern void idcok ( WINDOW *, bool );
|
|
|
|
extern int idlok ( WINDOW *, bool );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern void immedok ( WINDOW *, bool );
|
|
|
|
//extern chtype inch ( void );
|
|
|
|
//extern int inchnstr ( chtype *, int );
|
|
|
|
//extern int inchstr ( chtype * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern WINDOW *initscr ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
extern int init_colour ( short, short, short, short );
|
|
|
|
#define init_color ( c, r, g, b ) init_colour ( (c), (r), (g), (b) )
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int init_pair ( short, short, short );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern int innstr ( char *, int );
|
|
|
|
//extern int insch ( chtype );
|
|
|
|
//extern int insnstr ( const char *, int );
|
|
|
|
//extern int insstr ( const char * );
|
|
|
|
//extern int instr ( char * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int intrflush ( WINDOW *, bool );
|
|
|
|
extern bool isendwin ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern bool is_linetouched ( WINDOW *, int );
|
|
|
|
//extern bool is_wintouched ( WINDOW * );
|
2006-05-15 09:29:48 +00:00
|
|
|
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 );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int move ( int, int );
|
|
|
|
//extern int mvaddch ( int, int, const chtype );
|
|
|
|
//extern int mvaddchnstr ( int, int, const chtype *, int );
|
|
|
|
//extern int mvaddchstr ( int, int, const chtype * );
|
|
|
|
//extern int mvaddnstr ( int, int, const char *, int );
|
|
|
|
//extern int mvaddstr ( int, int, const char * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int mvcur ( int, int, int, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int mvdelch ( int, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int mvderwin ( WINDOW *, int, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int mvgetch ( int, int );
|
|
|
|
//extern int mvgetnstr ( int, int, char *, int );
|
|
|
|
//extern int mvgetstr ( int, int, char * );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern int mvhline ( int, int, chtype, int );
|
|
|
|
//extern chtype mvinch ( int, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int mvinchnstr ( int, int, chtype *, int );
|
|
|
|
//extern int mvinchstr ( int, int, chtype * );
|
|
|
|
//extern int mvinnstr ( int, int, char *, int );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern int mvinsch ( int, int, chtype );
|
|
|
|
//extern int mvinsnstr ( int, int, const char *, int );
|
|
|
|
//extern int mvinsstr ( int, int, const char * );
|
|
|
|
//extern int mvinstr ( int, int, char * );
|
|
|
|
//extern int mvprintw ( int, int, char *, ... );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int mvscanw ( int, int, char *, ... );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern int mvvline ( int, int, chtype, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int mvwaddch ( WINDOW *, int, int, const chtype );
|
|
|
|
//extern int mvwaddchnstr ( WINDOW *, int, int, const chtype *, int );
|
|
|
|
//extern int mvwaddchstr ( WINDOW *, int, int, const chtype * );
|
|
|
|
//extern int mvwaddnstr ( WINDOW *, int, int, const char *, int );
|
|
|
|
//extern int mvwaddstr ( WINDOW *, int, int, const char * );
|
|
|
|
//extern int mvwdelch ( WINDOW *, int, int );
|
|
|
|
//extern int mvwgetch ( WINDOW *, int, int );
|
|
|
|
//extern int mvwgetnstr ( WINDOW *, int, int, char *, int );
|
|
|
|
//extern int mvwgetstr ( WINDOW *, int, int, char * );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern int mvwhline ( WINDOW *, int, int, chtype, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int mvwin ( WINDOW *, int, int );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern chtype mvwinch ( WINDOW *, int, int );
|
|
|
|
//extern int mvwinchnstr ( WINDOW *, int, int, chtype *, int );
|
|
|
|
//extern int mvwinchstr ( WINDOW *, int, int, chtype * );
|
|
|
|
//extern int mvwinnstr ( WINDOW *, int, int, char *, int );
|
|
|
|
//extern int mvwinsch ( WINDOW *, int, int, chtype );
|
|
|
|
//extern int mvwinsnstr ( WINDOW *, int, int, const char *, int );
|
|
|
|
//extern int mvwinsstr ( WINDOW *, int, int, const char * );
|
|
|
|
//extern int mvwinstr ( WINDOW *, int, int, char * );
|
|
|
|
//extern int mvwprintw ( WINDOW *, int, int, char *, ... );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int mvwscanw ( WINDOW *, int, int, char *, ... );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern int mvwvline ( WINDOW *, int, int, chtype, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int napms ( int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern WINDOW *newpad ( int, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
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 * );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int pechochar ( WINDOW *, chtype );
|
|
|
|
//extern int pnoutrefresh ( WINDOW *, int, int, int, int, int, int );
|
|
|
|
//extern int prefresh ( WINDOW *, int, int, int, int, int, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int printw ( char *, ... );
|
|
|
|
extern int putp ( const char * );
|
|
|
|
extern void qiflush ( void );
|
|
|
|
extern int raw ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int redrawwin ( WINDOW * );
|
|
|
|
//extern int refresh ( void );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int reset_prog_mode ( void );
|
|
|
|
extern int reset_shell_mode ( void );
|
|
|
|
extern int resetty ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
extern int ripoffline ( int, int (*) ( WINDOW *, int) );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int savetty ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int scanw ( char *, ... );
|
|
|
|
//extern int scrl ( int );
|
|
|
|
//extern int scroll ( WINDOW * );
|
|
|
|
//extern int scrollok ( WINDOW *, bool );
|
|
|
|
//extern int setscrreg ( int, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
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 );
|
2006-06-27 10:38:57 +00:00
|
|
|
extern int slk_colour ( short );
|
|
|
|
#define slk_color( c ) slk_colour( (c) )
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int slk_init ( int );
|
|
|
|
extern char *slk_label ( int );
|
|
|
|
extern int slk_noutrefresh ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int slk_refresh ( void );
|
2006-05-15 09:29:48 +00:00
|
|
|
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 );
|
2006-12-19 00:27:25 +00:00
|
|
|
//extern int start_colour ( void );
|
2006-06-27 10:38:57 +00:00
|
|
|
#define start_color() start_colour()
|
|
|
|
//extern WINDOW *subpad ( WINDOW *, int, int, int, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
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 );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int touchline ( WINDOW *, int, int );
|
|
|
|
//extern int touchwin ( WINDOW * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern char *tparm ( char *, long, long, long, long, long, long, long, long,
|
|
|
|
long );
|
|
|
|
extern int typeahead ( int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int ungetch ( int );
|
|
|
|
//extern int untouchwin ( WINDOW * );
|
2006-05-15 09:29:48 +00:00
|
|
|
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) );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern int vline ( chtype, int );
|
|
|
|
//extern int vwprintw ( WINDOW *, const char *, va_list );
|
|
|
|
extern int vw_printw ( WINDOW *, const char *, va_list );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int vwscanw ( WINDOW *, char *, va_list );
|
|
|
|
//extern int vw_scanw ( WINDOW *, char *, va_list );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int waddch ( WINDOW *, const chtype );
|
|
|
|
extern int waddchnstr ( WINDOW *, const chtype *, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int waddchstr ( WINDOW *, const chtype * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int waddnstr ( WINDOW *, const char *, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int waddstr ( WINDOW *, const char * );
|
2006-05-15 09:29:48 +00:00
|
|
|
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 * );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern void wbkgdset ( WINDOW *, chtype );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int wborder ( WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
|
|
|
|
chtype, chtype );
|
|
|
|
extern int wclrtobot ( WINDOW * );
|
|
|
|
extern int wclrtoeol ( WINDOW * );
|
|
|
|
extern void wcursyncup ( WINDOW * );
|
2006-12-19 00:27:25 +00:00
|
|
|
extern int wcolour_set ( WINDOW *, short, void * );
|
2006-05-19 16:22:10 +00:00
|
|
|
#define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
|
2006-05-15 09:29:48 +00:00
|
|
|
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 );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int wgetstr ( WINDOW *, char * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int whline ( WINDOW *, chtype, int );
|
2006-05-22 17:03:41 +00:00
|
|
|
//extern chtype winch ( WINDOW * );
|
|
|
|
//extern int winchnstr ( WINDOW *, chtype *, int );
|
|
|
|
//extern int winchstr ( WINDOW *, chtype * );
|
|
|
|
//extern int winnstr ( WINDOW *, char *, int );
|
|
|
|
//extern int winsch ( WINDOW *, chtype );
|
|
|
|
//extern int winsnstr ( WINDOW *, const char *, int );
|
|
|
|
//extern int winsstr ( WINDOW *, const char * );
|
|
|
|
//extern int winstr ( WINDOW *, char * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int wmove ( WINDOW *, int, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int wnoutrefresh ( WINDOW * );
|
2006-05-22 17:03:41 +00:00
|
|
|
extern int wprintw ( WINDOW *, const char *, ... );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int wredrawln ( WINDOW *, int, int );
|
|
|
|
//extern int wrefresh ( WINDOW * );
|
|
|
|
//extern int wscanw ( WINDOW *, char *, ... );
|
|
|
|
//extern int wscrl ( WINDOW *, int );
|
|
|
|
//extern int wsetscrreg ( WINDOW *, int, int );
|
|
|
|
//extern int wstandend ( WINDOW * );
|
|
|
|
//extern int wstandout ( WINDOW * );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern void wsyncup ( WINDOW * );
|
|
|
|
extern void wsyncdown ( WINDOW * );
|
|
|
|
extern void wtimeout ( WINDOW *, int );
|
2006-06-27 10:38:57 +00:00
|
|
|
//extern int wtouchln ( WINDOW *, int, int, int );
|
2006-05-15 09:29:48 +00:00
|
|
|
extern int wvline ( WINDOW *, chtype, int );
|
|
|
|
|
|
|
|
/*
|
2006-05-19 16:22:10 +00:00
|
|
|
* There is frankly a ridiculous amount of redundancy within the
|
|
|
|
* curses API - ncurses decided to get around this by using #define
|
|
|
|
* macros, but I've decided to be type-safe and implement them all as
|
|
|
|
* static inlines instead...
|
2006-05-15 09:29:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2006-12-20 06:06:38 +00:00
|
|
|
static inline int attr_get ( attr_t *attrs, short *pair, void *opts ) {
|
|
|
|
return wattr_get ( stdscr, attrs, pair, opts );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int attr_off ( attr_t attrs, void *opts ) {
|
|
|
|
return wattr_off ( stdscr, attrs, opts );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int attr_on ( attr_t attrs, void *opts ) {
|
|
|
|
return wattr_on ( stdscr, attrs, opts );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int attr_set ( attr_t attrs, short cpair, void *opts ) {
|
|
|
|
return wattr_set ( stdscr, attrs, cpair, opts );
|
|
|
|
}
|
|
|
|
|
2006-05-15 09:29:48 +00:00
|
|
|
static inline void bkgdset ( chtype ch ) {
|
2006-05-18 17:51:19 +00:00
|
|
|
wattrset ( stdscr, ch );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2006-12-19 00:27:25 +00:00
|
|
|
static inline bool can_change_colour ( void ) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-05-19 16:22:10 +00:00
|
|
|
static inline int clrtobot ( void ) {
|
|
|
|
return wclrtobot( stdscr );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int clrtoeol ( void ) {
|
|
|
|
return wclrtoeol( stdscr );
|
|
|
|
}
|
|
|
|
|
2006-12-19 00:27:25 +00:00
|
|
|
static inline int colour_set ( short colour_pair_number, void *opts ) {
|
|
|
|
return wcolour_set ( stdscr, colour_pair_number, opts );
|
|
|
|
}
|
|
|
|
|
2006-05-22 13:10:19 +00:00
|
|
|
static inline int delch ( void ) {
|
|
|
|
return wdelch ( stdscr );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int deleteln ( void ) {
|
|
|
|
return wdeleteln( stdscr );
|
|
|
|
}
|
|
|
|
|
2006-06-27 10:38:57 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2006-12-19 00:27:25 +00:00
|
|
|
static inline bool has_colors ( void ) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-05-22 17:03:41 +00:00
|
|
|
static inline int hline ( chtype ch, int n ) {
|
|
|
|
return whline ( stdscr, ch, n );
|
|
|
|
}
|
|
|
|
|
2006-05-15 09:29:48 +00:00
|
|
|
static inline int move ( int y, int x ) {
|
|
|
|
return wmove ( stdscr, y, x );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvaddch ( int y, int x, const chtype ch ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( stdscr, y, x ) == OK
|
|
|
|
? waddch( stdscr, ch ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvaddchnstr ( int y, int x, const chtype *chstr, int n ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( stdscr, y, x ) == OK
|
|
|
|
? waddchnstr ( stdscr, chstr, n ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvaddchstr ( int y, int x, const chtype *chstr ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( stdscr, y, x ) == OK
|
|
|
|
? waddchnstr ( stdscr, chstr, -1 ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvaddnstr ( int y, int x, const char *str, int n ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( stdscr, y, x ) == OK
|
|
|
|
? waddnstr ( stdscr, str, n ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvaddstr ( int y, int x, const char *str ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( stdscr, y, x ) == OK
|
|
|
|
? waddnstr ( stdscr, str, -1 ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
2006-05-22 13:10:19 +00:00
|
|
|
static inline int mvdelch ( int y, int x ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( stdscr, y, x ) == OK
|
|
|
|
? wdelch ( stdscr ) : ERR );
|
|
|
|
}
|
|
|
|
|
2006-06-27 10:38:57 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2006-05-22 17:03:41 +00:00
|
|
|
static inline int mvhline ( int y, int x, chtype ch, int n ) {
|
|
|
|
return ( wmove ( stdscr, y, x ) == OK
|
|
|
|
? whline ( stdscr, ch, n ) : ERR );
|
|
|
|
}
|
|
|
|
|
|
|
|
// OK, so maybe a few I did with macros...
|
|
|
|
#define mvprintw( y, x, fmt, ... ) \
|
|
|
|
( wmove(stdscr,(y),(x)) == OK \
|
2006-06-28 11:53:41 +00:00
|
|
|
? wprintw( stdscr,(fmt), ## __VA_ARGS__ ) : ERR )
|
2006-05-22 17:03:41 +00:00
|
|
|
|
|
|
|
static inline int mvvline ( int y, int x, chtype ch, int n ) {
|
|
|
|
return ( wmove ( stdscr, y, x ) == OK
|
|
|
|
? wvline ( stdscr, ch, n ) : ERR );
|
2006-05-22 13:10:19 +00:00
|
|
|
}
|
|
|
|
|
2006-05-15 09:29:48 +00:00
|
|
|
static inline int mvwaddch ( WINDOW *win, int y, int x, const chtype ch ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove( win, y, x ) == OK
|
|
|
|
? waddch ( win, ch ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvwaddchnstr ( WINDOW *win, int y, int x, const chtype *chstr, int n ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( win, y, x ) == OK
|
|
|
|
? waddchnstr ( win, chstr, n ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvwaddchstr ( WINDOW *win, int y, int x, const chtype *chstr ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( win, y, x ) == OK
|
|
|
|
? waddchnstr ( win, chstr, -1 ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvwaddnstr ( WINDOW *win, int y, int x, const char *str, int n ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( win, y, x ) == OK
|
|
|
|
? waddnstr ( win, str, n ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int mvwaddstr ( WINDOW *win, int y, int x, const char *str ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( win, y, x ) == OK
|
|
|
|
? waddnstr ( win, str, -1 ) : ERR );
|
2006-05-15 09:29:48 +00:00
|
|
|
}
|
|
|
|
|
2006-05-22 13:10:19 +00:00
|
|
|
static inline int mvwdelch ( WINDOW *win, int y, int x ) {
|
2006-05-22 17:03:41 +00:00
|
|
|
return ( wmove ( win, y, x ) == OK
|
|
|
|
? wdelch ( win ) : ERR );
|
|
|
|
}
|
|
|
|
|
2006-06-27 10:38:57 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2006-05-22 17:03:41 +00:00
|
|
|
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__ )
|
|
|
|
|
2006-06-27 10:38:57 +00:00
|
|
|
static inline int slk_refresh ( void ) {
|
|
|
|
if ( slk_clear() == OK )
|
|
|
|
return slk_restore();
|
|
|
|
else
|
|
|
|
return ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define standend() wstandend( stdscr )
|
|
|
|
#define standout() wstandout( stdscr )
|
|
|
|
|
2006-12-19 00:27:25 +00:00
|
|
|
static inline int start_colour ( void ) {
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
2006-05-22 17:03:41 +00:00
|
|
|
static inline int vline ( chtype ch, int n ) {
|
|
|
|
return wvline ( stdscr, ch, n );
|
|
|
|
}
|
|
|
|
|
|
|
|
// marked for removal
|
|
|
|
static inline int vwprintw ( WINDOW *win, const char *fmt, va_list varglist ) {
|
|
|
|
return vw_printw ( win, fmt, varglist );
|
2006-05-22 13:10:19 +00:00
|
|
|
}
|
|
|
|
|
2006-05-15 09:29:48 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2006-05-18 17:51:19 +00:00
|
|
|
static inline int wbkgdset ( WINDOW *win, chtype ch ) {
|
|
|
|
return wattrset( win, ch );
|
|
|
|
}
|
2006-05-15 09:29:48 +00:00
|
|
|
|
2006-06-27 10:38:57 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2006-05-15 09:29:48 +00:00
|
|
|
#endif /* CURSES_H */
|