curses.h revision a734c64bff58bda2fa48c2795453e092167b0ff7
#ifndef CURSES_H
#define CURSES_H
#include <stdint.h>
#include <stdarg.h>
/** @file
*
* MuCurses header file
*
*/
#define ERR (-1)
#define FALSE (0)
#define OK (0)
#define TRUE (1)
typedef int bool;
/** Curses SCREEN object */
typedef struct _curses_screen {
/** Current cursor position */
/** Current attribute */
/**
* Move cursor to position specified by x,y coords
*
* @v scr screen on which to operate
* @v y Y position
* @v x X position
*/
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
*/
/**
* Pop a character from the keyboard input stream
*
* @v scr screen on which to operate
* @ret c popped character
*/
/**
* 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
*/
} SCREEN;
/** Curses Window struct */
typedef struct _curses_window {
/** screen with which window associates */
/** window attributes */
/** window origin coordinates */
/** window cursor position */
/** window dimensions */
/** 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;
} WINDOW;
extern unsigned short _COLS;
extern unsigned short _LINES;
#define CPAIR_SHIFT 8
#define ATTRS_SHIFT 16
#define A_DEFAULT WA_DEFAULT
#define A_ALTCHARSET WA_ALTCHARSET
#define A_PROTECT WA_PROTECT
#define A_REVERSE WA_REVERSE
#define A_STANDOUT WA_STANDOUT
#define A_UNDERLINE WA_UNDERLINE
#define A_CHARTEXT ( 0xff )
#define COLOUR_PAIR(n) ( (n) << CPAIR_SHIFT )
#define COLOR_PAIR(n) COLOUR_PAIR(n)
#define COLOR_PAIRS COLOUR_PAIRS
#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 COLOURS 7
#define COLOUR_FG 30
#define COLOUR_BG 40
#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
/*
*/
//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 );
//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 void bkgdset ( chtype );
/*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
chtype );*/
//extern bool can_change_colour ( void );
#define can_change_color() can_change_colour()
extern int cbreak ( void );
//extern int clrtobot ( void );
//extern int clrtoeol ( void );
extern int colour_content ( short, short *, short *, short * ) __nonnull;
#define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
//extern int colour_set ( short, void * );
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 int delch ( void );
//extern int deleteln ( void );
//extern int doupdate ( void );
extern int echo ( void );
extern int endwin ( void );
extern char erasechar ( void );
//extern int erase ( void );
extern void filter ( void );
extern int flash ( void );
extern int flushinp ( void );
//extern int getch ( void );
//extern int getnstr ( char *, int );
//extern int getstr ( char * );
extern int halfdelay ( int );
//extern bool has_colors ( void );
extern bool has_ic ( void );
extern bool has_il ( void );
//extern int hline ( chtype, int );
//extern void immedok ( WINDOW *, bool );
//extern chtype inch ( void );
//extern int inchnstr ( chtype *, int );
//extern int inchstr ( chtype * );
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 innstr ( char *, int );
//extern int insch ( chtype );
//extern int insnstr ( const char *, int );
//extern int insstr ( const char * );
//extern int instr ( char * );
extern bool isendwin ( void );
//extern bool is_linetouched ( WINDOW *, int );
//extern bool is_wintouched ( WINDOW * );
extern char *keyname ( int );
extern char killchar ( void );
extern char *longname ( void );
//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 * );
extern int mvcur ( int, int, int, int );
//extern int mvdelch ( int, int );
//extern int mvgetch ( int, int );
//extern int mvgetnstr ( int, int, char *, int );
//extern int mvgetstr ( int, int, char * );
//extern int mvhline ( int, int, chtype, int );
//extern chtype mvinch ( int, int );
//extern int mvinchnstr ( int, int, chtype *, int );
//extern int mvinchstr ( int, int, chtype * );
//extern int mvinnstr ( int, int, char *, int );
//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 *, ... );
//extern int mvscanw ( int, int, char *, ... );
//extern int mvvline ( int, int, chtype, int );
//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 * );
//extern int mvwhline ( WINDOW *, int, int, chtype, int );
//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 *, ... );
//extern int mvwscanw ( WINDOW *, int, int, char *, ... );
//extern int mvwvline ( WINDOW *, int, int, chtype, int );
extern int napms ( int );
//extern WINDOW *newpad ( int, int );
extern int nl ( void );
extern int nocbreak ( void );
extern int noecho ( void );
extern int nonl ( void );
extern void noqiflush ( void );
extern int noraw ( void );
extern int pair_content ( short, short *, short * ) __nonnull;
//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 );
extern int printw ( char *, ... );
extern int putp ( const char * );
extern void qiflush ( void );
extern int raw ( void );
//extern int redrawwin ( WINDOW * );
//extern int refresh ( 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 int scanw ( char *, ... );
//extern int scrl ( int );
//extern int scroll ( WINDOW * );
//extern int scrollok ( WINDOW *, bool );
//extern int setscrreg ( int, int );
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_refresh ( void );
extern int slk_restore ( void );
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 *subpad ( WINDOW *, int, int, int, int );
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 int touchline ( WINDOW *, int, int );
//extern int touchwin ( WINDOW * );
extern char *tparm ( char *, long, long, long, long, long, long, long, long,
long );
extern int typeahead ( int );
//extern int ungetch ( int );
//extern int untouchwin ( WINDOW * );
extern void use_env ( bool );
//extern int vline ( chtype, int );
//extern int vwprintw ( WINDOW *, const char *, va_list );
//extern int vwscanw ( WINDOW *, char *, va_list );
//extern int vw_scanw ( WINDOW *, char *, va_list );
//extern int waddchstr ( WINDOW *, const chtype * );
//extern int waddstr ( WINDOW *, const char * );
//extern void wbkgdset ( WINDOW *, chtype );
extern void wcursyncup ( WINDOW * );
#define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
//extern int wgetstr ( WINDOW *, char * );
//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 * );
//extern int wnoutrefresh ( WINDOW * );
//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 * );
//extern int wtouchln ( WINDOW *, int, int, int );
/*
* 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...
*/
}
}
}
}
}
}
}
}
}
}
}
}
}
}
static inline bool can_change_colour ( void ) {
return FALSE;
}
static inline int clrtobot ( void ) {
}
static inline int clrtoeol ( void ) {
}
}
static inline int delch ( void ) {
}
static inline int deleteln ( void ) {
}
static inline int erase ( void ) {
}
static inline int getch ( void ) {
}
}
}
static inline bool has_colors ( void ) {
return TRUE;
}
return TRUE;
}
}
static inline int move ( int y, int x ) {
}
}
}
}
}
}
static inline int mvdelch ( int y, int x ) {
}
static inline int mvgetch ( int y, int x ) {
}
}
}
}
// OK, so maybe a few I did with macros...
}
}
}
}
}
}
}
}
}
}
}
}
static inline int slk_refresh ( void ) {
return slk_restore();
else
return ERR;
}
static inline int start_colour ( void ) {
return OK;
}
}
// marked for removal
}
}
}
}
}
}
}
#endif /* CURSES_H */