Annotation of qemu/roms/ipxe/src/include/curses.h, revision 1.1

1.1     ! root        1: #ifndef CURSES_H
        !             2: #define CURSES_H
        !             3: 
        !             4: #include <stdint.h>
        !             5: #include <stdarg.h>
        !             6: 
        !             7: /** @file
        !             8:  *
        !             9:  * MuCurses header file
        !            10:  *
        !            11:  */
        !            12: 
        !            13: FILE_LICENCE ( GPL2_OR_LATER );
        !            14: 
        !            15: #undef  ERR
        !            16: #define ERR    (-1)
        !            17: 
        !            18: #undef  FALSE
        !            19: #define FALSE  (0)
        !            20: 
        !            21: #undef  OK
        !            22: #define OK     (0)
        !            23: 
        !            24: #undef  TRUE
        !            25: #define TRUE   (1)
        !            26: 
        !            27: typedef int bool;
        !            28: typedef uint32_t chtype;
        !            29: typedef uint32_t attr_t;
        !            30: 
        !            31: /** Curses SCREEN object */
        !            32: typedef struct _curses_screen {
        !            33:        /** Current cursor position */
        !            34:        unsigned int curs_x, curs_y;
        !            35:        /** Current attribute */
        !            36:        attr_t attrs;
        !            37: 
        !            38:        void ( *init ) ( struct _curses_screen *scr );
        !            39:        void ( *exit ) ( struct _curses_screen *scr );
        !            40:        /**
        !            41:         * Move cursor to position specified by x,y coords
        !            42:         *
        !            43:         * @v scr       screen on which to operate
        !            44:         * @v y         Y position
        !            45:         * @v x         X position
        !            46:         */
        !            47:        void ( * movetoyx ) ( struct _curses_screen *scr,
        !            48:                              unsigned int y, unsigned int x );
        !            49:        /**
        !            50:         * Write character to current cursor position
        !            51:         *
        !            52:         * @v scr       screen on which to operate
        !            53:         * @v c         character to be written
        !            54:         */
        !            55:        void ( * putc ) ( struct _curses_screen *scr, chtype c );
        !            56:        /**
        !            57:         * Pop a character from the keyboard input stream
        !            58:         *
        !            59:         * @v scr       screen on which to operate
        !            60:         * @ret c       popped character
        !            61:         */
        !            62:        int ( * getc ) ( struct _curses_screen *scr );
        !            63:        /**
        !            64:         * Checks to see whether a character is waiting in the input stream
        !            65:         *
        !            66:         * @v scr       screen on which to operate
        !            67:         * @ret TRUE    character waiting in stream
        !            68:         * @ret FALSE   no character waiting in stream
        !            69:         */
        !            70:        bool ( *peek ) ( struct _curses_screen *scr );
        !            71: } SCREEN;
        !            72: 
        !            73: /** Curses Window struct */
        !            74: typedef struct _curses_window {
        !            75:        /** screen with which window associates */
        !            76:        SCREEN *scr;
        !            77:        /** window attributes */
        !            78:        attr_t attrs;
        !            79:        /** window origin coordinates */
        !            80:        unsigned int ori_x, ori_y;
        !            81:        /** window cursor position */
        !            82:        unsigned int curs_x, curs_y;
        !            83:        /** window dimensions */
        !            84:        unsigned int width, height;
        !            85:        /** parent window */
        !            86:        struct _curses_window *parent;
        !            87:        /** windows that share the same parent as this one */
        !            88:        //struct list_head siblings;
        !            89:        /** windows der'd or sub'd from this one */
        !            90:        //struct list_head children;
        !            91: } WINDOW;
        !            92: 
        !            93: extern WINDOW _stdscr;
        !            94: extern unsigned short _COLS;
        !            95: extern unsigned short _LINES;
        !            96: 
        !            97: #define stdscr ( &_stdscr )
        !            98: #define COLS _COLS
        !            99: #define LINES _LINES
        !           100: 
        !           101: #define MUCURSES_BITS( mask, shift ) (( mask ) << (shift))
        !           102: #define CPAIR_SHIFT    8
        !           103: #define ATTRS_SHIFT    16
        !           104: 
        !           105: #define WA_DEFAULT     ( 0x0000 << ATTRS_SHIFT )
        !           106: #define WA_ALTCHARSET  ( 0x0001 << ATTRS_SHIFT )
        !           107: #define WA_BLINK       ( 0x0002 << ATTRS_SHIFT )
        !           108: #define WA_BOLD                ( 0x0004 << ATTRS_SHIFT )
        !           109: #define WA_DIM         ( 0x0008 << ATTRS_SHIFT )
        !           110: #define WA_INVIS       ( 0x0010 << ATTRS_SHIFT )
        !           111: #define WA_PROTECT     ( 0x0020 << ATTRS_SHIFT )
        !           112: #define WA_REVERSE     ( 0x0040 << ATTRS_SHIFT )
        !           113: #define WA_STANDOUT    ( 0x0080 << ATTRS_SHIFT )
        !           114: #define WA_UNDERLINE   ( 0x0100 << ATTRS_SHIFT )
        !           115: #define WA_HORIZONTAL  ( 0x0200 << ATTRS_SHIFT )
        !           116: #define WA_VERTICAL    ( 0x0400 << ATTRS_SHIFT )
        !           117: #define WA_LEFT                ( 0x0800 << ATTRS_SHIFT )
        !           118: #define WA_RIGHT       ( 0x1000 << ATTRS_SHIFT )
        !           119: #define WA_LOW         ( 0x2000 << ATTRS_SHIFT )
        !           120: #define WA_TOP         ( 0x4000 << ATTRS_SHIFT )
        !           121: 
        !           122: #define A_DEFAULT      WA_DEFAULT
        !           123: #define A_ALTCHARSET   WA_ALTCHARSET
        !           124: #define A_BLINK                WA_BLINK
        !           125: #define A_BOLD         WA_BOLD
        !           126: #define A_DIM          WA_DIM
        !           127: #define A_INVIS                WA_INVIS
        !           128: #define A_PROTECT      WA_PROTECT
        !           129: #define A_REVERSE      WA_REVERSE
        !           130: #define A_STANDOUT     WA_STANDOUT
        !           131: #define A_UNDERLINE    WA_UNDERLINE
        !           132: 
        !           133: #define A_ATTRIBUTES   ( 0xffff << ATTRS_SHIFT )
        !           134: #define A_CHARTEXT     ( 0xff )
        !           135: #define A_COLOUR       ( 0xff << CPAIR_SHIFT )
        !           136: #define A_COLOR                A_COLOUR
        !           137: 
        !           138: #define COLOUR_PAIR(n) ( (n) << CPAIR_SHIFT )
        !           139: #define COLOR_PAIR(n)  COLOUR_PAIR(n)
        !           140: #define PAIR_NUMBER(attrs) ( ( (attrs) & A_COLOUR ) >> CPAIR_SHIFT )
        !           141: 
        !           142: #define COLOUR_PAIRS   8 /* Arbitrary limit */
        !           143: #define COLOR_PAIRS    COLOUR_PAIRS
        !           144: 
        !           145: #define ACS_ULCORNER   '+'
        !           146: #define ACS_LLCORNER   '+'
        !           147: #define ACS_URCORNER   '+'
        !           148: #define ACS_LRCORNER   '+'
        !           149: #define ACS_RTEE       '+'
        !           150: #define ACS_LTEE       '+'
        !           151: #define ACS_BTEE       '+'
        !           152: #define ACS_TTEE       '+'
        !           153: #define ACS_HLINE      '-'
        !           154: #define ACS_VLINE      '|'
        !           155: #define ACS_PLUS       '+'
        !           156: #define ACS_S1         '-'
        !           157: #define ACS_S9         '_'
        !           158: #define ACS_DIAMOND    '+'
        !           159: #define ACS_CKBOARD    ':'
        !           160: #define ACS_DEGREE     '\''
        !           161: #define ACS_PLMINUS    '#'
        !           162: #define ACS_BULLET     'o'
        !           163: #define ACS_LARROW     '<'
        !           164: #define ACS_RARROW     '>'
        !           165: #define ACS_DARROW     'v'
        !           166: #define ACS_UARROW     '^'
        !           167: #define ACS_BOARD      '#'
        !           168: #define ACS_LANTERN    '#'
        !           169: #define ACS_BLOCK      '#'
        !           170: 
        !           171: #define COLOUR_BLACK   0
        !           172: #define COLOUR_RED     1
        !           173: #define COLOUR_GREEN   2
        !           174: #define COLOUR_YELLOW  3
        !           175: #define COLOUR_BLUE    4
        !           176: #define COLOUR_MAGENTA 5
        !           177: #define COLOUR_CYAN    6
        !           178: #define COLOUR_WHITE   7
        !           179: #define COLOURS                7
        !           180: 
        !           181: #define COLOUR_FG      30
        !           182: #define COLOUR_BG      40
        !           183: #define COLOR_FG       COLOUR_FG
        !           184: #define COLOR_BG       COLOUR_BG
        !           185: 
        !           186: #define COLOR_BLACK    COLOUR_BLACK
        !           187: #define COLOR_BLUE     COLOUR_BLUE
        !           188: #define COLOR_GREEN    COLOUR_GREEN
        !           189: #define COLOR_CYAN     COLOUR_CYAN
        !           190: #define COLOR_RED      COLOUR_RED
        !           191: #define COLOR_MAGENTA  COLOUR_MAGENTA
        !           192: #define COLOR_YELLOW   COLOUR_YELLOW
        !           193: #define COLOR_WHITE    COLOUR_WHITE
        !           194: #define COLORS         COLOURS
        !           195: 
        !           196: /*
        !           197:  * KEY code constants are define in ipxe/keys.h
        !           198:  */
        !           199: #include <ipxe/keys.h>
        !           200: 
        !           201: //extern int addch ( const chtype * );
        !           202: //extern int addchnstr ( const chtype *, int );
        !           203: //extern int addchstr ( const chtype * );
        !           204: //extern int addnstr ( const char *, int );
        !           205: //extern int addstr ( const char * );
        !           206: //extern int attroff ( int );
        !           207: //extern int attron ( int );
        !           208: //extern int attrset ( int );
        !           209: //extern int attr_get ( attr_t *, short *, void * );
        !           210: //extern int attr_off ( attr_t, void * );
        !           211: //extern int attr_on ( attr_t, void * );
        !           212: //extern int attr_set ( attr_t, short, void * );
        !           213: extern int baudrate ( void );
        !           214: extern int beep ( void );
        !           215: //extern void bkgdset ( chtype );
        !           216: /*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
        !           217:   chtype );*/
        !           218: extern int box ( WINDOW *, chtype, chtype ) __nonnull;
        !           219: //extern bool can_change_colour ( void );
        !           220: #define can_change_color() can_change_colour()
        !           221: extern int cbreak ( void ); 
        !           222: //extern int clrtobot ( void );
        !           223: //extern int clrtoeol ( void );
        !           224: extern int colour_content ( short, short *, short *, short * ) __nonnull;
        !           225: #define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
        !           226: //extern int colour_set ( short, void * );
        !           227: #define color_set( cpno, opts ) colour_set( (cpno), (opts) )
        !           228: extern int copywin ( const WINDOW *, WINDOW *, int, int, int, 
        !           229:                     int, int, int, int );
        !           230: extern int curs_set ( int );
        !           231: extern int def_prog_mode ( void );
        !           232: extern int def_shell_mode ( void );
        !           233: extern int delay_output ( int );
        !           234: //extern int delch ( void );
        !           235: //extern int deleteln ( void );
        !           236: extern void delscreen ( SCREEN * );
        !           237: extern int delwin ( WINDOW * ) __nonnull;
        !           238: extern WINDOW *derwin ( WINDOW *, int, int, int, int ) __nonnull;
        !           239: //extern int doupdate ( void );
        !           240: extern WINDOW *dupwin ( WINDOW * ) __nonnull;
        !           241: extern int echo ( void );
        !           242: extern int echochar ( const chtype );
        !           243: extern int endwin ( void );
        !           244: extern char erasechar ( void );
        !           245: //extern int erase ( void );
        !           246: extern void filter ( void );
        !           247: extern int flash ( void );
        !           248: extern int flushinp ( void );
        !           249: extern __pure chtype getbkgd ( WINDOW * ) __nonnull;
        !           250: //extern int getch ( void );
        !           251: //extern int getnstr ( char *, int );
        !           252: //extern int getstr ( char * );
        !           253: extern int halfdelay ( int );
        !           254: //extern bool has_colors ( void );
        !           255: extern bool has_ic ( void );
        !           256: extern bool has_il ( void );
        !           257: //extern int hline ( chtype, int );
        !           258: extern void idcok ( WINDOW *, bool );
        !           259: extern int idlok ( WINDOW *, bool );
        !           260: //extern void immedok ( WINDOW *, bool );
        !           261: //extern chtype inch ( void );
        !           262: //extern int inchnstr ( chtype *, int );
        !           263: //extern int inchstr ( chtype * );
        !           264: extern WINDOW *initscr ( void );
        !           265: extern int init_colour ( short, short, short, short );
        !           266: #define init_color ( c, r, g, b ) init_colour ( (c), (r), (g), (b) )
        !           267: extern int init_pair ( short, short, short );
        !           268: //extern int innstr ( char *, int );
        !           269: //extern int insch ( chtype );
        !           270: //extern int insnstr ( const char *, int );
        !           271: //extern int insstr ( const char * );
        !           272: //extern int instr ( char * );
        !           273: extern int intrflush ( WINDOW *, bool );
        !           274: extern bool isendwin ( void );
        !           275: //extern bool is_linetouched ( WINDOW *, int );
        !           276: //extern bool is_wintouched ( WINDOW * );
        !           277: extern char *keyname ( int );
        !           278: extern int keypad ( WINDOW *, bool );
        !           279: extern char killchar ( void );
        !           280: extern int leaveok ( WINDOW *, bool );
        !           281: extern char *longname ( void );
        !           282: extern int meta ( WINDOW *, bool );
        !           283: //extern int move ( int, int );
        !           284: //extern int mvaddch ( int, int, const chtype );
        !           285: //extern int mvaddchnstr ( int, int, const chtype *, int );
        !           286: //extern int mvaddchstr ( int, int, const chtype * );
        !           287: //extern int mvaddnstr ( int, int, const char *, int );
        !           288: //extern int mvaddstr ( int, int, const char * );
        !           289: extern int mvcur ( int, int, int, int );
        !           290: //extern int mvdelch ( int, int );
        !           291: extern int mvderwin ( WINDOW *, int, int );
        !           292: //extern int mvgetch ( int, int );
        !           293: //extern int mvgetnstr ( int, int, char *, int );
        !           294: //extern int mvgetstr ( int, int, char * );
        !           295: //extern int mvhline ( int, int, chtype, int );
        !           296: //extern chtype mvinch ( int, int );
        !           297: //extern int mvinchnstr ( int, int, chtype *, int );
        !           298: //extern int mvinchstr ( int, int, chtype * );
        !           299: //extern int mvinnstr ( int, int, char *, int );
        !           300: //extern int mvinsch ( int, int, chtype );
        !           301: //extern int mvinsnstr ( int, int, const char *, int );
        !           302: //extern int mvinsstr ( int, int, const char * );
        !           303: //extern int mvinstr ( int, int, char * );
        !           304: //extern int mvprintw ( int, int, char *,  ... );
        !           305: //extern int mvscanw ( int, int, char *, ... );
        !           306: //extern int mvvline ( int, int, chtype, int );
        !           307: //extern int mvwaddch ( WINDOW *, int, int, const chtype );
        !           308: //extern int mvwaddchnstr ( WINDOW *, int, int, const chtype *, int );
        !           309: //extern int mvwaddchstr ( WINDOW *, int, int, const chtype * );
        !           310: //extern int mvwaddnstr ( WINDOW *, int, int, const char *, int );
        !           311: //extern int mvwaddstr ( WINDOW *, int, int, const char * );
        !           312: //extern int mvwdelch ( WINDOW *, int, int );
        !           313: //extern int mvwgetch ( WINDOW *, int, int );
        !           314: //extern int mvwgetnstr ( WINDOW *, int, int, char *, int );
        !           315: //extern int mvwgetstr ( WINDOW *, int, int, char * );
        !           316: //extern int mvwhline ( WINDOW *, int, int, chtype, int );
        !           317: extern int mvwin ( WINDOW *, int, int ) __nonnull;
        !           318: //extern chtype mvwinch ( WINDOW *, int, int );
        !           319: //extern int mvwinchnstr ( WINDOW *, int, int, chtype *, int );
        !           320: //extern int mvwinchstr ( WINDOW *, int, int, chtype * );
        !           321: //extern int mvwinnstr ( WINDOW *, int, int, char *, int );
        !           322: //extern int mvwinsch ( WINDOW *, int, int, chtype );
        !           323: //extern int mvwinsnstr ( WINDOW *, int, int, const char *, int );
        !           324: //extern int mvwinsstr ( WINDOW *, int, int, const char * );
        !           325: //extern int mvwinstr ( WINDOW *, int, int, char * );
        !           326: //extern int mvwprintw ( WINDOW *, int, int, char *, ... );
        !           327: //extern int mvwscanw ( WINDOW *, int, int, char *, ... );
        !           328: //extern int mvwvline ( WINDOW *, int, int, chtype, int );
        !           329: extern int napms ( int );
        !           330: //extern WINDOW *newpad ( int, int );
        !           331: extern WINDOW *newwin ( int, int, int, int );
        !           332: extern int nl ( void );
        !           333: extern int nocbreak ( void );
        !           334: extern int nodelay ( WINDOW *, bool );
        !           335: extern int noecho ( void );
        !           336: extern int nonl ( void );
        !           337: extern void noqiflush ( void );
        !           338: extern int noraw ( void );
        !           339: extern int notimeout ( WINDOW *, bool );
        !           340: extern int overlay ( const WINDOW *, WINDOW * );
        !           341: extern int overwrite ( const WINDOW *, WINDOW * );
        !           342: extern int pair_content ( short, short *, short * ) __nonnull;
        !           343: //extern int pechochar ( WINDOW *, chtype );
        !           344: //extern int pnoutrefresh ( WINDOW *, int, int, int, int, int, int );
        !           345: //extern int prefresh ( WINDOW *, int, int, int, int, int, int );
        !           346: extern int printw ( char *, ... );
        !           347: extern int putp ( const char * );
        !           348: extern void qiflush ( void );
        !           349: extern int raw ( void );
        !           350: //extern int redrawwin ( WINDOW * );
        !           351: //extern int refresh ( void );
        !           352: extern int reset_prog_mode ( void );
        !           353: extern int reset_shell_mode ( void );
        !           354: extern int resetty ( void );
        !           355: extern int ripoffline ( int, int  (*) ( WINDOW *, int) );
        !           356: extern int savetty ( void );
        !           357: //extern int scanw ( char *, ... );
        !           358: //extern int scrl ( int );
        !           359: //extern int scroll ( WINDOW * );
        !           360: //extern int scrollok ( WINDOW *, bool );
        !           361: //extern int setscrreg ( int, int );
        !           362: extern SCREEN *set_term ( SCREEN * );
        !           363: extern int setupterm ( char *, int, int * );
        !           364: extern int slk_attr_off ( const attr_t, void * );
        !           365: extern int slk_attroff ( const chtype );
        !           366: extern int slk_attr_on ( const attr_t, void * );
        !           367: extern int slk_attron ( const chtype );
        !           368: extern int slk_attr_set ( const attr_t, short, void * );
        !           369: extern int slk_attrset ( const chtype );
        !           370: extern int slk_clear ( void );
        !           371: extern int slk_colour ( short );
        !           372: #define slk_color( c ) slk_colour( (c) )
        !           373: extern int slk_init ( int );
        !           374: extern char *slk_label ( int );
        !           375: extern int slk_noutrefresh ( void );
        !           376: //extern int slk_refresh ( void );
        !           377: extern int slk_restore ( void );
        !           378: extern int slk_set ( int, const char *, int ) __nonnull;
        !           379: extern int slk_touch ( void );
        !           380: extern int standend ( void );
        !           381: extern int standout ( void );
        !           382: //extern int start_colour ( void );
        !           383: #define start_color() start_colour()
        !           384: //extern WINDOW *subpad ( WINDOW *, int, int, int, int );
        !           385: extern WINDOW *subwin ( WINDOW *, int, int, int, int ) __nonnull;
        !           386: extern int syncok ( WINDOW *, bool );
        !           387: extern chtype termattrs ( void );
        !           388: extern attr_t term_attrs ( void );
        !           389: extern char *termname ( void );
        !           390: extern int tigetflag ( char * );
        !           391: extern int tigetnum ( char * );
        !           392: extern char *tigetstr ( char * );
        !           393: extern void timeout ( int );
        !           394: //extern int touchline ( WINDOW *, int, int );
        !           395: //extern int touchwin ( WINDOW * );
        !           396: extern char *tparm ( char *, long, long, long, long, long, long, long, long,
        !           397:                   long );
        !           398: extern int typeahead ( int );
        !           399: //extern int ungetch ( int );
        !           400: //extern int untouchwin ( WINDOW * );
        !           401: extern void use_env ( bool );
        !           402: extern int vid_attr ( attr_t, short, void * );
        !           403: extern int vidattr ( chtype );
        !           404: extern int vid_puts ( attr_t, short, void *, int  ( *) ( int) );
        !           405: extern int vidputs ( chtype, int  ( *) ( int) );
        !           406: //extern int vline ( chtype, int );
        !           407: //extern int vwprintw ( WINDOW *, const char *, va_list );
        !           408: extern int vw_printw ( WINDOW *, const char *, va_list ) __nonnull;
        !           409: //extern int vwscanw ( WINDOW *, char *, va_list );
        !           410: //extern int vw_scanw ( WINDOW *, char *, va_list );
        !           411: extern int waddch ( WINDOW *, const chtype ) __nonnull;
        !           412: extern int waddchnstr ( WINDOW *, const chtype *, int ) __nonnull;
        !           413: //extern int waddchstr ( WINDOW *, const chtype * );
        !           414: extern int waddnstr ( WINDOW *, const char *, int ) __nonnull;
        !           415: //extern int waddstr ( WINDOW *, const char * );
        !           416: extern int wattroff ( WINDOW *, int ) __nonnull;
        !           417: extern int wattron ( WINDOW *, int ) __nonnull;
        !           418: extern int wattrset ( WINDOW *, int ) __nonnull;
        !           419: extern int wattr_get ( WINDOW *, attr_t *, short *, void * )
        !           420:        __attribute__ (( nonnull (1, 2, 3)));
        !           421: extern int wattr_off ( WINDOW *, attr_t, void * )
        !           422:        __attribute__ (( nonnull (1)));
        !           423: extern int wattr_on ( WINDOW *, attr_t, void * )
        !           424:        __attribute__ (( nonnull (1)));
        !           425: extern int wattr_set ( WINDOW *, attr_t, short, void * )
        !           426:        __attribute__ (( nonnull (1)));
        !           427: //extern void wbkgdset ( WINDOW *, chtype );
        !           428: extern int wborder ( WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
        !           429:                   chtype, chtype ) __nonnull;
        !           430: extern int wclrtobot ( WINDOW * ) __nonnull;
        !           431: extern int wclrtoeol ( WINDOW * ) __nonnull;
        !           432: extern void wcursyncup ( WINDOW * );
        !           433: extern int wcolour_set ( WINDOW *, short, void * ) __nonnull;
        !           434: #define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
        !           435: extern int wdelch ( WINDOW * ) __nonnull;
        !           436: extern int wdeleteln ( WINDOW * ) __nonnull;
        !           437: extern int wechochar ( WINDOW *, const chtype );
        !           438: extern int werase ( WINDOW * ) __nonnull;
        !           439: extern int wgetch ( WINDOW * );
        !           440: extern int wgetnstr ( WINDOW *, char *, int );
        !           441: //extern int wgetstr ( WINDOW *, char * );
        !           442: extern int whline ( WINDOW *, chtype, int ) __nonnull;
        !           443: //extern chtype winch ( WINDOW * );
        !           444: //extern int winchnstr ( WINDOW *, chtype *, int );
        !           445: //extern int winchstr ( WINDOW *, chtype * );
        !           446: //extern int winnstr ( WINDOW *, char *, int );
        !           447: //extern int winsch ( WINDOW *, chtype );
        !           448: //extern int winsnstr ( WINDOW *, const char *, int );
        !           449: //extern int winsstr ( WINDOW *, const char * );
        !           450: //extern int winstr ( WINDOW *, char * );
        !           451: extern int wmove ( WINDOW *, int, int );
        !           452: //extern int wnoutrefresh ( WINDOW * );
        !           453: extern int wprintw ( WINDOW *, const char *, ... ) __nonnull;
        !           454: //extern int wredrawln ( WINDOW *, int, int );
        !           455: //extern int wrefresh ( WINDOW * );
        !           456: //extern int wscanw ( WINDOW *, char *, ... );
        !           457: //extern int wscrl ( WINDOW *, int );
        !           458: //extern int wsetscrreg ( WINDOW *, int, int );
        !           459: //extern int wstandend ( WINDOW * );
        !           460: //extern int wstandout ( WINDOW * );
        !           461: extern void wsyncup ( WINDOW * );
        !           462: extern void wsyncdown ( WINDOW * );
        !           463: extern void wtimeout ( WINDOW *, int );
        !           464: //extern int wtouchln ( WINDOW *, int, int, int );
        !           465: extern int wvline ( WINDOW *, chtype, int ) __nonnull;
        !           466: 
        !           467: /*
        !           468:  * There is frankly a ridiculous amount of redundancy within the
        !           469:  * curses API - ncurses decided to get around this by using #define
        !           470:  * macros, but I've decided to be type-safe and implement them all as
        !           471:  * static inlines instead...
        !           472:  */
        !           473: 
        !           474: static inline int addch ( const chtype ch ) {
        !           475:        return waddch( stdscr, ch );
        !           476: }
        !           477: 
        !           478: static inline int addchnstr ( const chtype *chstr, int n ) {
        !           479:        return waddchnstr ( stdscr, chstr, n );
        !           480: }
        !           481: 
        !           482: static inline int addchstr ( const chtype *chstr ) {
        !           483:        return waddchnstr ( stdscr, chstr, -1 );
        !           484: }
        !           485: 
        !           486: static inline int addnstr ( const char *str, int n ) {
        !           487:        return waddnstr ( stdscr, str, n );
        !           488: }
        !           489: 
        !           490: static inline int addstr ( const char *str ) {
        !           491:        return waddnstr ( stdscr, str, -1 );
        !           492: }
        !           493: 
        !           494: static inline int attroff ( int attrs ) {
        !           495:        return wattroff ( stdscr, attrs );
        !           496: }
        !           497: 
        !           498: static inline int attron ( int attrs ) {
        !           499:        return wattron ( stdscr, attrs );
        !           500: }
        !           501: 
        !           502: static inline int attrset ( int attrs ) {
        !           503:        return wattrset ( stdscr, attrs );
        !           504: }
        !           505: 
        !           506: static inline int attr_get ( attr_t *attrs, short *pair, void *opts ) {
        !           507:        return wattr_get ( stdscr, attrs, pair, opts );
        !           508: }
        !           509: 
        !           510: static inline int attr_off ( attr_t attrs, void *opts ) {
        !           511:        return wattr_off ( stdscr, attrs, opts );
        !           512: }
        !           513: 
        !           514: static inline int attr_on ( attr_t attrs, void *opts ) {
        !           515:        return wattr_on ( stdscr, attrs, opts );
        !           516: }
        !           517: 
        !           518: static inline int attr_set ( attr_t attrs, short cpair, void *opts ) {
        !           519:        return wattr_set ( stdscr, attrs, cpair, opts );
        !           520: }
        !           521: 
        !           522: static inline void bkgdset ( chtype ch ) {
        !           523:        wattrset ( stdscr, ch );
        !           524: }
        !           525: 
        !           526: static inline int border ( chtype ls, chtype rs, chtype ts, chtype bs,
        !           527:                           chtype tl, chtype tr, chtype bl, chtype br ) {
        !           528:        return wborder ( stdscr, ls, rs, ts, bs, tl, tr, bl, br );
        !           529: }
        !           530: 
        !           531: static inline bool can_change_colour ( void ) {
        !           532:        return FALSE;
        !           533: }
        !           534: 
        !           535: static inline int clrtobot ( void ) {
        !           536:        return wclrtobot( stdscr );
        !           537: }
        !           538: 
        !           539: static inline int clrtoeol ( void ) {
        !           540:        return wclrtoeol( stdscr );
        !           541: }
        !           542: 
        !           543: static inline int colour_set ( short colour_pair_number, void *opts ) {
        !           544:        return wcolour_set ( stdscr, colour_pair_number, opts );
        !           545: }
        !           546: 
        !           547: static inline int delch ( void ) {
        !           548:        return wdelch ( stdscr );
        !           549: }
        !           550: 
        !           551: static inline int deleteln ( void ) {
        !           552:        return wdeleteln( stdscr );
        !           553: }
        !           554: 
        !           555: static inline int erase ( void ) {
        !           556:        return werase ( stdscr );
        !           557: }
        !           558: 
        !           559: static inline int getch ( void ) {
        !           560:        return wgetch ( stdscr );
        !           561: }
        !           562: 
        !           563: static inline int getnstr ( char *str, int n ) {
        !           564:        return wgetnstr ( stdscr, str, n );
        !           565: }
        !           566: 
        !           567: static inline int getstr ( char *str ) {
        !           568:        return wgetnstr ( stdscr, str, -1 );
        !           569: }
        !           570: 
        !           571: static inline bool has_colors ( void ) {
        !           572:        return TRUE;
        !           573: }
        !           574: 
        !           575: static inline int has_key ( int kc __unused ) {
        !           576:        return TRUE;
        !           577: }
        !           578: 
        !           579: static inline int hline ( chtype ch, int n ) {
        !           580:        return whline ( stdscr, ch, n );
        !           581: }
        !           582: 
        !           583: static inline int move ( int y, int x ) {
        !           584:        return wmove ( stdscr, y, x );
        !           585: }
        !           586: 
        !           587: static inline int mvaddch ( int y, int x, const chtype ch ) {
        !           588:        return ( wmove ( stdscr, y, x ) == OK
        !           589:                 ? waddch( stdscr, ch ) : ERR );
        !           590: }
        !           591: 
        !           592: static inline int mvaddchnstr ( int y, int x, const chtype *chstr, int n ) {
        !           593:        return ( wmove ( stdscr, y, x ) == OK
        !           594:                 ? waddchnstr ( stdscr, chstr, n ) : ERR );
        !           595: }
        !           596: 
        !           597: static inline int mvaddchstr ( int y, int x, const chtype *chstr ) {
        !           598:        return ( wmove ( stdscr, y, x ) == OK
        !           599:                 ? waddchnstr ( stdscr, chstr, -1 ) : ERR );
        !           600: }
        !           601: 
        !           602: static inline int mvaddnstr ( int y, int x, const char *str, int n ) {
        !           603:        return ( wmove ( stdscr, y, x ) == OK
        !           604:                 ? waddnstr ( stdscr, str, n ) : ERR );
        !           605: }
        !           606: 
        !           607: static inline int mvaddstr ( int y, int x, const char *str ) {
        !           608:        return ( wmove ( stdscr, y, x ) == OK
        !           609:                 ? waddnstr ( stdscr, str, -1 ) : ERR );
        !           610: }
        !           611: 
        !           612: static inline int mvdelch ( int y, int x ) {
        !           613:        return ( wmove ( stdscr, y, x ) == OK
        !           614:                 ? wdelch ( stdscr ) : ERR );
        !           615: }
        !           616: 
        !           617: static inline int mvgetch ( int y, int x ) {
        !           618:        return ( wmove ( stdscr, y, x ) == OK
        !           619:                 ? wgetch ( stdscr ) : ERR );
        !           620: }
        !           621: 
        !           622: static inline int mvgetnstr ( int y, int x, char *str, int n ) {
        !           623:        return ( wmove ( stdscr, y, x ) == OK
        !           624:                 ? wgetnstr ( stdscr, str, n ) : ERR );
        !           625: }
        !           626: 
        !           627: static inline int mvgetstr ( int y, int x, char *str ) {
        !           628:        return ( wmove ( stdscr, y, x ) == OK
        !           629:                 ? wgetnstr ( stdscr, str, -1 ) : ERR );
        !           630: }
        !           631: 
        !           632: static inline int mvhline ( int y, int x, chtype ch, int n ) {
        !           633:        return ( wmove ( stdscr, y, x ) == OK
        !           634:                 ? whline ( stdscr, ch, n ) : ERR );
        !           635: }
        !           636: 
        !           637: // OK, so maybe a few I did with macros...
        !           638: #define mvprintw( y, x, fmt, ... ) \
        !           639:        ( wmove(stdscr,(y),(x)) == OK \
        !           640:          ? wprintw( stdscr,(fmt), ## __VA_ARGS__ ) : ERR )
        !           641: 
        !           642: static inline int mvvline ( int y, int x, chtype ch, int n ) {
        !           643:        return ( wmove ( stdscr, y, x ) == OK
        !           644:                 ? wvline ( stdscr, ch, n ) : ERR );
        !           645: }
        !           646: 
        !           647: static inline int mvwaddch ( WINDOW *win, int y, int x, const chtype ch ) {
        !           648:        return ( wmove( win, y, x ) == OK
        !           649:                 ? waddch ( win, ch ) : ERR );
        !           650: }
        !           651: 
        !           652: static inline int mvwaddchnstr ( WINDOW *win, int y, int x, const chtype *chstr, int n ) {
        !           653:        return ( wmove ( win, y, x ) == OK
        !           654:                 ? waddchnstr ( win, chstr, n ) : ERR );
        !           655: }
        !           656: 
        !           657: static inline int mvwaddchstr ( WINDOW *win, int y, int x, const chtype *chstr ) {
        !           658:        return ( wmove ( win, y, x ) == OK
        !           659:                 ? waddchnstr ( win, chstr, -1 ) : ERR );
        !           660: }
        !           661: 
        !           662: static inline int mvwaddnstr ( WINDOW *win, int y, int x, const char *str, int n ) {
        !           663:        return ( wmove ( win, y, x ) == OK
        !           664:                 ? waddnstr ( win, str, n ) : ERR );
        !           665: }
        !           666: 
        !           667: static inline int mvwaddstr ( WINDOW *win, int y, int x, const char *str ) {
        !           668:        return ( wmove ( win, y, x ) == OK
        !           669:                 ? waddnstr ( win, str, -1 ) : ERR );
        !           670: }
        !           671: 
        !           672: static inline int mvwdelch ( WINDOW *win, int y, int x ) {
        !           673:        return ( wmove ( win, y, x ) == OK
        !           674:                 ? wdelch ( win ) : ERR );
        !           675: }
        !           676: 
        !           677: static inline int mvwgetch ( WINDOW *win, int y, int x ) {
        !           678:        return ( wmove ( win, y, x ) == OK
        !           679:                 ? wgetch ( win ) : ERR );
        !           680: }
        !           681: 
        !           682: static inline int mvwgetnstr ( WINDOW *win, int y, int x, char *str, int n ) {
        !           683:        return ( wmove ( win, y, x ) == OK
        !           684:                 ? wgetnstr ( win, str, n ) : ERR );
        !           685: }
        !           686: 
        !           687: static inline int mvwgetstr ( WINDOW *win, int y, int x, char *str ) {
        !           688:        return ( wmove ( win, y, x ) == OK
        !           689:                 ? wgetnstr ( win, str, -1 ) : ERR );
        !           690: }
        !           691: 
        !           692: static inline int mvwhline ( WINDOW *win, int y, int x, chtype ch, int n ) {
        !           693:        return ( wmove ( win, y, x ) == OK
        !           694:                 ? whline ( win, ch, n ) : ERR );
        !           695: }
        !           696: 
        !           697: #define mvwprintw( win, y, x, fmt, ... ) \
        !           698:        ( wmove((win),(y),(x)) == OK \
        !           699:          ? wprintw((win),(fmt), ## __VA_ARGS__) : ERR )
        !           700: 
        !           701: static inline int mvwvline ( WINDOW *win, int y, int x, chtype ch, int n ) {
        !           702:        return ( wmove ( win, y, x ) == OK
        !           703:                 ? wvline ( win, ch, n ) : ERR );
        !           704: }
        !           705: 
        !           706: #define printw( fmt, ... ) wprintw(stdscr,(fmt), ## __VA_ARGS__ )
        !           707: 
        !           708: static inline int slk_refresh ( void ) {
        !           709:        if ( slk_clear() == OK )
        !           710:                return slk_restore();
        !           711:        else
        !           712:                return ERR;
        !           713: }
        !           714: 
        !           715: #define standend() wstandend( stdscr )
        !           716: #define standout() wstandout( stdscr )
        !           717: 
        !           718: static inline int start_colour ( void ) {
        !           719:        return OK;
        !           720: }
        !           721: 
        !           722: static inline int vline ( chtype ch, int n ) {
        !           723:        return wvline ( stdscr, ch, n );
        !           724: }
        !           725: 
        !           726: // marked for removal
        !           727: static inline int vwprintw ( WINDOW *win, const char *fmt, va_list varglist ) {
        !           728:        return vw_printw ( win, fmt, varglist );
        !           729: }
        !           730: 
        !           731: static inline int waddchstr ( WINDOW *win, const chtype *chstr ) {
        !           732:        return waddchnstr ( win, chstr, -1 );
        !           733: }
        !           734: 
        !           735: static inline int waddstr ( WINDOW *win, const char *str ) {
        !           736:        return waddnstr ( win, str, -1 );
        !           737: }
        !           738: 
        !           739: static inline int wbkgdset ( WINDOW *win, chtype ch ) {
        !           740:        return wattrset( win, ch );
        !           741: }
        !           742: 
        !           743: static inline int wgetstr ( WINDOW *win, char *str ) {
        !           744:        return wgetnstr ( win, str, -1 );
        !           745: }
        !           746: 
        !           747: static inline int wstandend ( WINDOW *win ) {
        !           748:        return wattrset ( win, A_DEFAULT );
        !           749: }
        !           750: 
        !           751: static inline int wstandout ( WINDOW *win ) {
        !           752:        return wattrset ( win, A_STANDOUT );
        !           753: }
        !           754: 
        !           755: #endif /* CURSES_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.