home *** CD-ROM | disk | FTP | other *** search
- /*
- *
- * Author : Simon J Raybould. (sie@fulcrum.bt.co.uk).
- *
- * Date : v1.00a 16th Feb 1990
- * v1.10 30th Sep 1990
- * v1.20a 4th Oct 1990 (very limited distribution)
- * v1.20 7th Nov 1990
- * v1.21 2nd Dec 1990
- *
- * Desc : Header file for my AMIGA CURSES package.
- * This should be included instead of stdio.h, this will
- * include stdio.h for you.
- * This file is Public Domain but please leave the name
- * of the author intact.
- *
- */
-
- #ifndef CURSES_H
- #define CURSES_H
-
- #ifndef stdin /* May be a better way to do this !! */
- #include <stdio.h>
- #endif /* stdin */
-
- #ifndef TRUE
- #define TRUE 1
- #define FALSE 0
- #endif /* TRUE */
-
- #define ERR -1
- #define OK 0
-
- extern int LINES, COLS;
-
-
- /*
- * Macros
- */
-
- #define addch(c) waddch(stdscr, (c))
- #define addstr(str) waddstr(stdscr, (str))
- #define attrset(attr) wattrset(stdscr, (attr))
- #define attron(attr) wattron(stdscr, (attr))
- #define attroff(attr) wattroff(stdscr, (attr))
- #define clear() wclear(stdscr)
- #define clrtoeol() wclrtoeol(stdscr)
- #define clrtobot() wclrtobot(stdscr)
- #define delch() wdelch(stdscr)
- #define deleteln() wdeleteln(stdscr)
- #define erase() werase(stdscr)
- #define inch() winch(stdscr)
- #define insch(c) winsch(stdscr, (c))
- #define insertln() winsertln(stdscr)
- #define getch() wgetch(stdscr)
- #define getstr(ptr) wgetstr(stdscr, (ptr))
- #define getyx(win,y,x) ((y) = getcury(win), (x) = getcurx(win))
- #define getbegyx(win,y,x) ((y) = getbegy(win), (x) = getbegx(win))
- #define getmaxyx(win,y,x) ((y) = getmaxy(win), (x) = getmaxx(win))
- #define getparyx(win,y,x) ((y) = getpary(win), (x) = getparx(win))
- #define getcury(win) ((win)->_cury)
- #define getcurx(win) ((win)->_curx)
- #define getbegy(win) ((win)->_begy)
- #define getbegx(win) ((win)->_begx)
- #define getmaxy(win) ((win)->_maxy)
- #define getmaxx(win) ((win)->_maxx)
- #define getpary(win) ((win)->_pary)
- #define getparx(win) ((win)->_parx)
- #define getbkgd(win) ((win)->_bkgd)
- #define getattrs(win) ((win)->_attrs)
- #define move(line, col) wmove(stdscr, (line), (col))
- #define mvdelch(y, x) (move((y), (x)), delch())
- #define mvwdelch(win, y, x) (wmove((win),(y),(x)),wdelch((win)))
- #define mvgetch(y, x) (move((y), (x)), getch())
- #define mvwgetch(win, y, x) (wmove((win),(y),(x)),wgetch((win)))
- #define mvgetstr(y, x, ptr) (move((y), (x)), getstr((ptr)))
- #define mvwgetstr(win, y, x, ptr) (wmove((win), (y), (x)), \
- wgetstr((win), (ptr)))
- #define mvinsch(y, x, c) (move((y), (x)), insch((c)))
- #define mvwinsch(win, y, x, c) (wmove((win), (y), (x)), \
- winsch((win), (c)))
- #define mvinch(y, x) (move((y), (x)), inch())
- #define mvwinch(win, y, x) (wmove((win), (y), (x)),winch((win)))
- #define mvaddch(y, x, c) (move((y), (x)), addch((c)))
- #define mvwaddch(win, y, x, c) (wmove((win), (y), (x)), \
- waddch((win), (c)))
- #define mvaddstr(y, x, str) (move((y), (x)), addstr((str)))
- #define mvwaddstr(win, y, x, str) (wmove((win), (y), (x)), \
- waddstr((win), (str)))
- #define refresh() wrefresh(stdscr)
- #define noutrefresh() wnoutrefresh(stdscr)
- #define setscrreg(top, bottom) wsetscrreg(stdscr, (top), (bottom))
- #define standend() wstandend(stdscr)
- #define standout() wstandout(stdscr)
-
- /*
- * NON STANDARD MACROS
- */
-
- #define pencolour(n) wpencolour(stdscr, (n))
-
- /*
- * Colours
- */
-
- #define COLOR_BLACK 0 /* Black */
- #define COLOR_WHITE 1 /* White */
- #define COLOR_YELLOW 2 /* Yellow */
- #define COLOR_ORANGE 3 /* Orange */
- #define COLOR_BLUE 4 /* Blue */
- #define COLOR_MAGENTA 5 /* Magenta */
- #define COLOR_CYAN 6 /* Cyan */
- #define COLOR_PWHITE 7 /* Paper White */
- #define COLOR_BROWN 8 /* Brown */
- #define COLOR_RED 9 /* Red */
- #define COLOR_LGREEN 10 /* Light Green */
- #define COLOR_TAN 11 /* Well err Tan really */
- #define COLOR_BBLUE 12 /* Different to BLUE */
- #define COLOR_PURPLE 13 /* Pomegranate colour */
- #define COLOR_GREEN 14 /* The Bla Bla Grass of home and all that */
- #define COLOR_GREY 15 /* Dead giveaway that one */
-
-
- /*
- * Video Attributes.
- */
-
- #define A_NORMAL 0000000
- #define A_STANDOUT 0000200
- #define _STANDOUT A_STANDOUT /* for compatibility with old curses */
- #define A_UNDERLINE 0000400
- #define A_REVERSE 0001000
- #define A_BLINK 0002000
- #define A_DIM 0004000
- #define A_BOLD 0010000
-
- #define A_ATTRIBUTES 0377600
- #define A_CHARTEXT 0000177
-
-
-
- #define bool char
- #define reg register
-
- struct _win_st {
- short _cury, _curx;
- short _maxy, _maxx;
- short _begy, _begx;
- short _flags;
- short _attrs;
- bool _clear; /* T=clear on every refresh set by clearok() */
- bool _cls; /* T=clear on next refresh set by clear() */
- bool _leave;
- bool _scroll;
- bool _use_idl;
- bool _use_keypad; /* 0=no, 1=yes, 2=yes/timeout */
- bool _use_meta; /* T=use the meta key */
- bool _nodelay; /* T=don't wait for tty input */
- char **_y;
- short *_firstch;
- short *_lastch;
- short _tmarg,_bmarg;
- char *_WinStat; /* Window state SJR */
- };
-
- typedef struct _win_st WINDOW;
- extern WINDOW *stdscr, *curscr;
-
- /* Funny "characters" enabled for various special function keys for input */
- #define KEY_BREAK 0401 /* break key (unreliable) */
- #define KEY_DOWN 0402 /* The four arrow keys ... */
- #define KEY_UP 0403
- #define KEY_LEFT 0404
- #define KEY_RIGHT 0405 /* ... */
- #define KEY_HOME 0406 /* Home key (upward+left arrow) */
- #define KEY_BACKSPACE 0407 /* backspace (unreliable) */
- #define KEY_F0 0410 /* Function keys. Space for 64 */
- #define KEY_F(n) (KEY_F0+(n)) /* keys is reserved. */
- #define KEY_DL 0510 /* Delete line */
- #define KEY_IL 0511 /* Insert line */
- #define KEY_DC 0512 /* Delete character */
- #define KEY_IC 0513 /* Insert char or enter insert mode */
- #define KEY_EIC 0514 /* Exit insert char mode */
- #define KEY_CLEAR 0515 /* Clear screen */
- #define KEY_EOS 0516 /* Clear to end of screen */
- #define KEY_EOL 0517 /* Clear to end of line */
- #define KEY_SF 0520 /* Scroll 1 line forward */
- #define KEY_SR 0521 /* Scroll 1 line backwards (reverse) */
- #define KEY_NPAGE 0522 /* Next page */
- #define KEY_PPAGE 0523 /* Previous page */
- #define KEY_STAB 0524 /* Set tab */
- #define KEY_CTAB 0525 /* Clear tab */
- #define KEY_CATAB 0526 /* Clear all tabs */
- #define KEY_ENTER 0527 /* Enter or send (unreliable) */
- #define KEY_SRESET 0530 /* soft (partial) reset (unreliable) */
- #define KEY_RESET 0531 /* reset or hard reset (unreliable) */
- #define KEY_PRINT 0532 /* print or copy */
- #define KEY_LL 0533 /* home down or bottom (lower left) */
- /* The keypad is arranged like this: */
- /* a1 up a3 */
- /* left b2 right */
- /* c1 down c3 */
- #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_HELP 0553 /* Help Key */
-
- WINDOW *newwin(), *subwin();
-
- #endif /* CURSES_H */
-