#ifndef __CURSES_LOADED #define __CURSES_LOADED 1 /**************************************************************************** ** ** - Curses screen management functions ** ***************************************************************************** ** Header is nonstandard ***************************************************************************** ** ** Copyright 2000 Compaq Computer Corporation ** ** Compaq and the Compaq logo Registered in U.S. Patent and Trademark Office. ** ** Confidential computer software. Valid license from Compaq required for ** possession, use or copying. Consistent with FAR 12.211 and 12.212, ** Commercial Computer Software, Computer Software Documentation, and ** Technical Data for Commercial Items are licensed to the U.S. Government ** under vendor's standard commercial license. ** ****************************************************************************** */ #pragma __nostandard #include #ifdef __cplusplus extern "C" { #endif #if __INITIAL_POINTER_SIZE # pragma __pointer_size __save # pragma __pointer_size 32 #endif /* ** Using __VMS_CURSES implies _VMS_CURSES */ #if defined(__VMS_CURSES) && !defined(_VMS_CURSES) # define _VMS_CURSES 1 #endif /* ** Using __BSD44_CURSES implies _BSD44_CURSES */ #if defined(__BSD44_CURSES) && !defined(_BSD44_CURSES) # define _BSD44_CURSES 1 #endif /* ** Default to _VMS_CURSES */ #if !defined(_BSD44_CURSES) && !defined(_VMS_CURSES) # define _VMS_CURSES 1 #endif /* ** BSD Curses is only available on OpenVMS Alpha as of OpenVMS V7.0. ** ** While this may appear to be an incompatible change, the number of ** problems discovered in the BSD Curses package shipped as part of the DEC ** C RTL in versions of OpenVMS prior to V7.0 has led us to conclude that a ** correct program could not be built using it. We have changed the ** default to be _VMS_CURSES for those applications which are targetting ** systems prior to OpenVMS V7.0 and also utilize curses functions. ** */ #if defined(_BSD44_CURSES) && defined(__VAX) # error " BSD 4.4 Curses package not yet available on OpenVMS VAX" #endif #if defined(_BSD44_CURSES) && (__CRTL_VER < 70000000) # error " BSD 4.4 Curses package not available on OpenVMS Alpha before V7.0" #endif /* ** Disable the following messages prior to including the header files. */ #pragma __message __save #pragma __message __disable (__MISALGNDSTRCT) #pragma __message __disable (__MISALGNDMEM) #pragma __message __disable (__MACROEXT) /* ** Perform includes necessary for each of the curses packages. This is done ** here because we do not want to use any #pragmas prior to the includes. */ #ifdef _VMS_CURSES # include # include # if !(__DECC_MODE_COMMON) && !(__DECC_MODE_STRICT) # include # endif #else # include # include # include #endif /* ** All structures should be member aligned on natural boundaries */ #pragma __member_alignment __save #pragma __member_alignment /* ** Definitions common to both _VMS_CURSES and _BSD44_CURSES */ #define ERR (0) /* Error return */ #define OK (1) /* Success return */ #ifndef TRUE # define TRUE (1) #endif #ifndef FALSE # define FALSE (0) #endif /* ** Define macros which give the user the correct dereferencing of global ** variables defined in the DEC C RTL */ #ifdef __ALPHA # define LINES decc$ga_LINES # define COLS decc$ga_COLS # define stdscr decc$ga_stdscr # define curscr decc$ga_curscr #else # define LINES (*decc$ga_LINES) # define COLS (*decc$ga_COLS) # define stdscr (*decc$ga_stdscr) # define curscr (*decc$ga_curscr) #endif #ifdef _VMS_CURSES # ifdef __ALPHA # define stdkb decc$ga_stdkb # define stdpb decc$ga_stdpb # else # define stdkb (*decc$ga_stdkb) # define stdpb (*decc$ga_stdpb) # endif #endif #ifdef _VMS_CURSES /**********************************************************/ /* Header file for _VMS_CURSES (VAX and Alpha) */ /**********************************************************/ /* ** */ #define reg register /* ** */ #define _SUBWIN 0001 #define _ENDLINE 0002 #define _FULLWIN 0004 #define _SCROLLWIN 0010 #define _FLUSH 0020 #define _STANDOUT 0200 /* ** Values used in lower byte of the _win_st _flags structure */ #define _BLINK 4 /* SMG$M_BLINK */ #define _BOLD 1 /* SMG$M_BOLD */ #define _REVERSE 2 /* SMG$M_REVERSE */ #define _UNDERLINE 8 /* SMG$M_UNDERLINE */ /* ** Values used in the _flags field in the _kb_st structure */ #define _NOECHO 001 #define _NONL 002 #define _NOCRMODE 004 #define _NORAW 010 /* ** Buffer size used by SMG routines */ #define SMG_BUFSIZ 512 /* ** Define a _win_st structure */ #pragma __member_alignment __save #pragma __nomember_alignment __word struct _win_st { int _cur_y, _cur_x; int _max_y, _max_x; int _beg_y, _beg_x; /* ** Low byte of _flags contains rendition and the upper byte are ** values such as _ENDLINE, _SCROLLWIN etc (see above) */ short _flags; char _clear, _leave, _scroll, _wrap; char **_y; short *_firstch, *_lastch; struct _win_st *_next, *_parent, *_child; int _id; }; #pragma __member_alignment __restore /* ** Define a _kb_st structure */ struct _kb_st { /* ** Identifier of the keyboard. Passed to SMG. */ int _id; /* ** Flags can be raw, break etc... */ unsigned char _flags; /* ** Descriptor use for input */ struct { unsigned short length; unsigned char type; # ifdef __cplusplus unsigned char _class; # else unsigned char class; # endif char *address; } _buffer_desc; /* ** The number of bytes read in but not yet returned to the ** application. An example of this is using RAW mode where ** several characters are read in on a single getch, but the ** application must call getch several times to get each one. */ int _count; /* ** Pointer to next byte to return to user. This may or may not be ** equal to the address field in the above descriptor when input ** is buffered. */ char *_ptr; }; /* ** Define a _pb_st structure */ #if !(__DECC_MODE_COMMON) && !(__DECC_MODE_STRICT) struct _pb_st { int _id; int _rows, _cols; union smgdef *_attr; int _attr_size; }; #endif #define _KEYBOARD struct _kb_st #define WINDOW struct _win_st #define _PASTEBOARD struct _pb_st /* ** Curses external declarations */ #pragma __extern_model __save #pragma __extern_model __strict_refdef extern WINDOW * curscr; /* Current screen */ extern WINDOW * stdscr; /* Standard screen */ extern int COLS; /* Columns on the screen */ extern int LINES; /* Lines on the screen */ extern _KEYBOARD * stdkb; /* Standard keyboard */ extern _PASTEBOARD * stdpb; /* Standard pasteboard */ #pragma __extern_model __restore /* ** The following non-stdscr functions are defined as macros which use the w ** form of the functions, passing stdscr as the first argument. */ #define addch(ch) waddch (stdscr,ch) #define addstr(s) waddstr (stdscr,s) #define clear() wclear (stdscr) #define clrattr(a) wclrattr (stdscr,a) #define clrtobot() wclrtobot (stdscr) #define clrtoeol() wclrtoeol (stdscr) #define delch() wdelch (stdscr) #define deleteln() wdeleteln (stdscr) #define erase() werase (stdscr) #define getch() wgetch (stdscr) #define getstr(s) wgetstr (stdscr,s) #define inch() winch (stdscr) #define insch(c) winsch (stdscr,c) #define insertln() winsertln (stdscr) #define insstr(s) winsstr (stdscr,s) #define move(y,x) wmove (stdscr,y,x) #define refresh() wrefresh (stdscr) #define setattr(a) wsetattr (stdscr,a) #define standout() wstandout (stdscr) #define standend() wstandend (stdscr) #define mvaddch(y,x,ch) mvwaddch (stdscr,y,x,ch) #define mvgetch(y,x) mvwgetch (stdscr,y,x) #define mvaddstr(y,x,str) mvwaddstr (stdscr,y,x,str) #define mvinsstr(y,x,str) mvwinsstr (stdscr,y,x,str) #define mvgetstr(y,x,str) mvwgetstr (stdscr,y,x,str) #define mvinch(y,x) mvwinch (stdscr,y,x) #define mvdelch(y,x) mvwdelch (stdscr,y,x) #define mvinsch(y,x,ch) mvwinsch (stdscr,y,x,ch) #define mvdeleteln(y,x) mvwdeleteln (stdscr,y,x) #define mvcur(ly,lx,ny,nx) wmove (stdscr,ny,nx) #define mvwaddch(win,y,x,ch) (wmove(win,y,x)==ERR ? ERR : waddch(win,ch)) #define mvwgetch(win,y,x) (wmove(win,y,x)==ERR ? ERR : wgetch(win)) #define mvwinsstr(win,y,x,str) (wmove(win,y,x)==ERR ? ERR : winsstr(win,str)) #define mvwgetstr(win,y,x,str) (wmove(win,y,x)==ERR ? ERR : wgetstr(win,str)) #define mvwinch(win,y,x) (wmove(win,y,x)==ERR ? ERR : winch(win)) #define mvwdelch(win,y,x) (wmove(win,y,x)==ERR ? ERR : wdelch(win)) #define mvwinsch(win,y,x,ch) (wmove(win,y,x)==ERR ? ERR : winsch(win,ch)) #define mvwdeleteln(win,y,x) (wmove(win,y,x)==ERR ? ERR : wdeleteln(win)) #define clearok(win,bf) (win->_clear = bf) #define leaveok(win,bf) (win->_leave = bf) #define scrollok(win,bf) (win->_scroll = bf) #define wrapok(win,bf) (win->_wrap = bf) #define flushok(win,bf) (bf ? win->_flags |= _FLUSH : (win->_flags &= ~_FLUSH)) #define getyx(win,y,x) y = win->_cur_y, x = win->_cur_x /* ** Terminal input mode macros */ #define echo() (stdkb->_flags &= ~_NOECHO) #define noecho() (stdkb->_flags |= _NOECHO) #define raw() (stdkb->_flags &= ~_NORAW) #define noraw() (stdkb->_flags |= _NORAW) #define nl() (stdkb->_flags &= ~_NONL) #define nonl() (stdkb->_flags |= _NONL) #define crmode() ((stdkb->_flags &= ~_NOCRMODE), nonl()) #define nocrmode() (stdkb->_flags |= _NOCRMODE) /* ** Create 'private' typedefs that are sensitive to pointer size and must ** use short pointers. These typedefs are used when refering to these ** types when in 64 bit pointer context. */ typedef WINDOW * __WINDOW_ptr32; /* ** We are done defining things which must always be short pointers. If ** the user has used /pointer_size=short or /pointer_size=long, we will ** allow long pointers to be used in function calls. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif /* ** The DEC C RTL always allocates WINDOW structure in 32 bit memory. */ __WINDOW_ptr32 initscr (void); __WINDOW_ptr32 newwin (int __numlines, int __numcols, int __begin_y, int __begin_x); __WINDOW_ptr32 subwin (WINDOW *__win, int __numlines, int __numcols, int __begin_y, int __begin_x); /* ** The following functions have two interfaces, one for 32 and one for 64 bit ** pointers. */ #if __INITIAL_POINTER_SIZE == 32 # pragma __pointer_size 32 #endif char *longname (char *termbuf, char *__name); #if __INITIAL_POINTER_SIZE # pragma __pointer_size 32 char *_longname32 (char *termbuf, char *__name); # pragma __pointer_size 64 char *_longname64 (char *termbuf, char *__name); #endif /* ** Function prototypes */ int box (WINDOW *__win, char __vert, char __hor); int delwin (WINDOW *__win); int endwin (void); int mvwaddstr (WINDOW *__win, int __vert, int __horz, char *__str ); int mvwin (WINDOW *__win, int __st_row, int __st_col); int overlay (WINDOW *__win1, WINDOW *__win2); int overwrite (WINDOW *__win1, WINDOW *__win2); int printw (char *__format_spec, ...); int scanw (char *__format_spec, ...); int scroll (WINDOW *__win); int touchwin (WINDOW *__win); int waddch (WINDOW *__win, char __ch); int waddstr (WINDOW *__win, char *__str); int wclear (WINDOW *__win); int wclrattr (WINDOW *__win, int __attr); int wclrtobot (WINDOW *__win); int wclrtoeol (WINDOW *__win); int wdelch (WINDOW *__win); int wdeleteln (WINDOW *__win); int werase (WINDOW *__win); int wgetch (WINDOW *__win); int wgetstr (WINDOW *__win, char *__str); char winch (WINDOW *__win); int winsch (WINDOW *__win, char __ch); int winsertln (WINDOW *__win); int winsstr (WINDOW *, const char *); /* OpenVMS extension */ int wmove (WINDOW *__win, int __y, int __x); int wprintw (WINDOW *__win, char *__format_spec, ...); int wrefresh (WINDOW *__win); int wscanw (WINDOW *__win, char *__format_spec, ...); int wsetattr (WINDOW *__win, int __attr); int wstandend (WINDOW *__win); int wstandout (WINDOW *__win); #endif /* _VMS_CURSES */ #ifdef _BSD44_CURSES /**********************************************************/ /* Header file for _BSD44_CURSES (Alpha Only) */ /**********************************************************/ /* */ /* Documentation on the 4.4BSD curses package can be */ /* found in: */ /* */ /* "Screen Updating and Cursor Movement */ /* Optimization: A Library Package" */ /* */ /* by Kenneth C.R.C. Arnold */ /* */ /**********************************************************/ /* ** Pointers to termcap fields used by BSD curses package */ #define AE decc$ga_bsd_ae #define AL decc$ga_bsd_al #define al decc$ga_bsd_al2 #define AS decc$ga_bsd_as #define AM decc$ga_bsd_am #define BC decc$ga_bsd_bc #define BS decc$ga_bsd_bs #define BT decc$ga_bsd_bt #define CA decc$ga_bsd_ca #define CD decc$ga_bsd_cd #define CE decc$ga_bsd_ce #define CL decc$ga_bsd_cl #define CM decc$ga_bsd_cm #define CR decc$ga_bsd_cr #define CS decc$ga_bsd_cs #define DA decc$ga_bsd_da #define DB decc$ga_bsd_db #define DC decc$ga_bsd_dc #define DL decc$ga_bsd_dl #define dl decc$ga_bsd_dl2 #define DM decc$ga_bsd_dm #define DO decc$ga_bsd_do #define ED decc$ga_bsd_ed #define EI decc$ga_bsd_ei #define EO decc$ga_bsd_eo #define GT decc$ga_bsd_gt #define HC decc$ga_bsd_hc #define HO decc$ga_bsd_ho #define HZ decc$ga_bsd_hz #define IC decc$ga_bsd_ic #define IM decc$ga_bsd_im #define IN decc$ga_bsd_in #define IP decc$ga_bsd_ip #define K0 decc$ga_bsd_k0 #define K1 decc$ga_bsd_k1 #define K2 decc$ga_bsd_k2 #define K3 decc$ga_bsd_k3 #define K4 decc$ga_bsd_k4 #define K5 decc$ga_bsd_k5 #define K6 decc$ga_bsd_k6 #define K7 decc$ga_bsd_k7 #define K8 decc$ga_bsd_k8 #define K9 decc$ga_bsd_k9 #define KD decc$ga_bsd_kd #define KE decc$ga_bsd_ke #define KH decc$ga_bsd_kh #define KL decc$ga_bsd_kl #define KR decc$ga_bsd_kr #define KS decc$ga_bsd_ks #define KU decc$ga_bsd_ku #define LL decc$ga_bsd_ll #define MA decc$ga_bsd_ma #define MB decc$ga_bsd_mb #define MD decc$ga_bsd_md #define ME decc$ga_bsd_me #define MI decc$ga_bsd_mi #define MR decc$ga_bsd_mr #define MS decc$ga_bsd_ms #define NC decc$ga_bsd_nc #define ND decc$ga_bsd_nd #define NL decc$ga_bsd_nl #define NS decc$ga_bsd_ns #define OS decc$ga_bsd_os #define PC decc$ga_bsd_pc #define RC decc$ga_bsd_rc #define SC decc$ga_bsd_sc #define SE decc$ga_bsd_se #define SF decc$ga_bsd_sf #define sf decc$ga_bsd_sf2 #define SO decc$ga_bsd_so #define SR decc$ga_bsd_sr #define sr decc$ga_bsd_sr2 #define TA decc$ga_bsd_ta #define TE decc$ga_bsd_te #define TI decc$ga_bsd_ti #define UC decc$ga_bsd_uc #define UE decc$ga_bsd_ue #define UL decc$ga_bsd_ul #define UP decc$ga_bsd_up #define US decc$ga_bsd_us #define VB decc$ga_bsd_vb #define VE decc$ga_bsd_ve #define VS decc$ga_bsd_vs #define XB decc$ga_bsd_xb #define XN decc$ga_bsd_xn #define XS decc$ga_bsd_xs #define XT decc$ga_bsd_xt #define XX decc$ga_bsd_xx /* ** Possible params to specific termcap fields */ #define AL_PARM decc$ga_bsd_al_parm #define DL_PARM decc$ga_bsd_dl_parm #define DOWN_PARM decc$ga_bsd_down_parm #define LEFT_PARM decc$ga_bsd_left_parm #define RIGHT_PARM decc$ga_bsd_right_parm #define UP_PARM decc$ga_bsd_up_parm /* ** BSD boolean fields */ #define UPPERCASE decc$ga_bsd_uppercase #define NONL decc$ga_bsd_nonl #define Def_term decc$ga_bsd_def_term #define My_term decc$ga_bsd_my_term #define __unctrl decc$ga_bsd__unctrl #define __unctrllen decc$ga_bsd__unctrllen #define ttytype decc$ga_bsd_ttytype /* ** The following #defines and #includes are present for backward ** compatibility only. They should not be used in future code. ** ** START BACKWARD COMPATIBILITY ONLY. */ #ifndef _CURSES_PRIVATE # define bool char # define reg register # define _BSD_VA_LIST_ ... # define _puts(s) tputs(s,0,__cputchar) # define _putchar(c) __cputchar(c) # define crmode() cbreak() # define nocrmode() nocbreak() # if !defined __U_INT && !defined _DECC_V4_SOURCE # define __U_INT typedef __u_int u_int; # endif #endif extern char GT; /* Gtty indicates tabs */ extern char NONL; /* Term can't hack LF doing a CR */ extern char UPPERCASE; /* Terminal is uppercase only */ extern int My_term; /* Use Def_term regardless */ extern char *Def_term; /* Default terminal type */ /* ** Termcap capabilities */ extern char AM,BS,CA,DA,EO,HC,IN,MI,MS,NC,NS,OS,PC,UL,XB,XN,XT,XS,XX; extern char *AE,*AL,*AS,*BC,*BT,*CD,*CE,*CL,*CM,*CR,*CS,*DC,*DL,*DM,*DO,*ED,*EI, *K0,*K1,*K2,*K3,*K4,*K5,*K6,*K7,*K8,*K9,*HO,*IC,*IM,*IP,*KD,*KE,*KH, *KL,*KR,*KS,*KU,*LL,*MA,*MB,*MD,*ME,*MR,*ND,*NL,*RC,*SC,*SE,*SF,*SO, *SR,*TA,*TE,*TI,*UC,*UE,*UP,*US,*VB,*VS,*VE,*al,*dl,*sf,*sr, *AL_PARM,*DL_PARM,*UP_PARM,*DOWN_PARM,*LEFT_PARM,*RIGHT_PARM; /* END BACKWARD COMPATIBILITY ONLY. */ /* ** 8-bit ASCII characters */ #define unctrl(c) __unctrl[(c) & 0xff] #define unctrllen(ch) __unctrllen[(ch) & 0xff] extern char *__unctrl[256]; /* Control strings */ extern char __unctrllen[256]; /* Control strings length */ /* ** A window is an array of __LINE structures pointed to by the 'lines' ** pointer. A line is an array of __LDATA structures pointed to by ** the 'line' pointer. ** ** IMPORTANT: the __LDATA structure must NOT induce any padding,so ** if new fields are added -- padding fields with *constant values* ** should ensure that the compiler will not generate any padding when ** storing an array of __LDATA structures. This is to enable ** consistent use of memcmp,and memcpy for comparing and copying ** arrays. */ typedef struct { char ch; /* the actual character */ char attr; /* attributes of character */ } __LDATA; #define __LDATASIZE (sizeof(__LDATA)) #define A_STANDOUT 0x01 /* For wattron,wattroff,wattrset */ #define A_UNDERLINE 0x02 #define A_REVERSE 0x04 #define A_BLINK 0x08 #define A_BOLD 0x10 #define A_DIM A_BOLD /* dim not avaiable, make it bold */ #define A_ALTCHARSET 0x20 /* Use alternate character set */ #define A_NORMAL 0x00 #define __STANDOUT A_STANDOUT /* Added characters are standout. */ typedef struct { __size_t *firstchp, *lastchp; /* First and last chngd columns ptrs */ __LDATA *line; /* Pointer to the line text. */ __size_t firstch, lastch; /* First and last changed columns. */ __u_int flags; __u_int hash; /* Hash value for the line. */ } __LINE; #define __ISDIRTY 0x01 /* Line is dirty. */ #define __ISPASTEOL 0x02 /* Cursor is past end of line */ #define __FORCEPAINT 0x04 /* Force a repaint of the line */ /* ** Although fields within the window structure should never be changed ** by application code, some of the fields are useful for applications ** to have read access to. ** ** BSD 4.4 code removed the "_" from structure member names so for ** upward compatability, defines of the names including the underscore ** have been made. */ typedef struct __window { struct __window *nextp; /* Subwindows list and parent */ struct __window *orig; /* */ __LINE **lines; /* Array of pointers to the lines */ __LINE *lspace; /* line space (for cleanup) */ __LDATA *wspace; /* window space (for cleanup) */ __size_t begy, begx; /* Window home */ __size_t cury, curx; /* Current y, x coordinates */ __size_t maxy, maxx; /* Maximum values for cury, curx */ __u_int flags; __u_int w_nodelay; /* non-blocking used with nodelay routine */ short ch_off; /* x offset for firstch/lastch. */ char attrs; /* character attributes for new char */ /* See __LDATA section for valid values */ } WINDOW; /* ** */ #define _begy begy #define _begx begx #define _cury cury #define _curx curx #define _maxy maxy #define _maxx maxx #define _flags flags #define _attrs attrs /* ** Curses external declarations */ extern WINDOW * curscr; /* Current screen */ extern WINDOW * stdscr; /* Standard screen */ extern int COLS; /* Columns on the screen */ extern int LINES; /* Lines on the screen */ extern char * ttytype; /* Full name of terminal */ /* ** */ #define __ENDLINE 0x001 /* End of screen */ #define __FLUSH 0x002 /* Fflush(stdout) after refresh */ #define __FULLLINE 0x004 /* Line width = terminal width */ #define __FULLWIN 0x008 /* Window is a screen */ #define __IDLINE 0x010 /* Insert/delete sequences */ #define __SCROLLWIN 0x020 /* Last char will scroll window */ #define __SCROLLOK 0x040 /* Scrolling ok */ #define __CLEAROK 0x080 /* Clear on next refresh */ #define __WSTANDOUT 0x100 /* Standout (attributes) window */ #define __LEAVEOK 0x200 /* If curser left */ /* ** Standard screen pseudo functions ** ** Original BSD 4.4 sources with a check for decc$$scr_is_tty added ** ** The following non-stdscr functions are defined as macros which use the w ** form of the functions, passing stdscr as the first argument. */ extern unsigned decc$$scr_is_tty; #define addbytes(s,n) (!decc$$scr_is_tty ? ERR : __waddbytes(stdscr,s,n,(stdscr->attrs == A_NORMAL) ? 0 : 1)) #define addch(ch) (!decc$$scr_is_tty ? ERR : waddch(stdscr,ch)) #define addnstr(s,n) (!decc$$scr_is_tty ? ERR : waddnstr(stdscr,s,n)) #define addstr(s) (!decc$$scr_is_tty ? ERR : __waddbytes(stdscr,s,strlen(s),(stdscr->attrs == A_NORMAL) ? 0 : 1)) #define attron(at) (!decc$$scr_is_tty ? ERR : wattron(stdscr,at)) #define attroff(at) (!decc$$scr_is_tty ? ERR : wattroff(stdscr,at)) #define attrset(at) (!decc$$scr_is_tty ? ERR : wattrset(stdscr,at)) #define clear() (!decc$$scr_is_tty ? ERR : wclear(stdscr)) #define clrattr(at) (!decc$$scr_is_tty ? ERR : wclrattr(stdscr,at)) #define clrtobot() (!decc$$scr_is_tty ? ERR : wclrtobot(stdscr)) #define clrtoeol() (!decc$$scr_is_tty ? ERR : wclrtoeol(stdscr)) #define delch() (!decc$$scr_is_tty ? ERR : wdelch(stdscr)) #define deleteln() (!decc$$scr_is_tty ? ERR : wdeleteln(stdscr)) #define erase() (!decc$$scr_is_tty ? ERR : werase(stdscr)) #define getch() wgetch(stdscr) #define getstr(s) wgetstr(stdscr,s) #define inch() (!decc$$scr_is_tty ? ERR : winch(stdscr)) #define insch(ch) (!decc$$scr_is_tty ? ERR : winsch(stdscr,ch)) /* ** Digital only extension to BSD */ #define insstr(s) (!decc$$scr_is_tty ? ERR : winsstr (stdscr,s)) #define insertln() (!decc$$scr_is_tty ? ERR : winsertln(stdscr)) #define move(y,x) (!decc$$scr_is_tty ? ERR : wmove(stdscr,y,x)) #define refresh() (!decc$$scr_is_tty ? ERR : wrefresh(stdscr)) #define setattr(at) (!decc$$scr_is_tty ? ERR : wsetattr(stdscr,at)) #define standend() (!decc$$scr_is_tty ? ERR : wstandend(stdscr)) #define standout() (!decc$$scr_is_tty ? ERR : wstandout(stdscr)) #define waddbytes(w,s,n) (!decc$$scr_is_tty ? ERR : __waddbytes(w,s,n,(w->attrs == A_NORMAL) ? 0 : 1)) #define waddstr(w,s) (!decc$$scr_is_tty ? ERR : __waddbytes(w,s,strlen(s),(w->attrs == A_NORMAL) ? 0 : 1)) /* ** Standard screen plus movement pseudo functions */ #define mvaddbytes(y,x,s,n) (!decc$$scr_is_tty ? ERR : mvwaddbytes(stdscr,y,x,s,n)) #define mvaddch(y,x,ch) (!decc$$scr_is_tty ? ERR : mvwaddch(stdscr,y,x,ch)) #define mvaddnstr(y,x,s,n) (!decc$$scr_is_tty ? ERR : mvwaddnstr(stdscr,y,x,s,n)) #define mvaddstr(y,x,s) (!decc$$scr_is_tty ? ERR : mvwaddstr(stdscr,y,x,s)) #define mvdelch(y,x) (!decc$$scr_is_tty ? ERR : mvwdelch(stdscr,y,x)) #define mvgetch(y,x) (!decc$$scr_is_tty ? ERR : mvwgetch(stdscr,y,x)) #define mvgetstr(y,x,s) (!decc$$scr_is_tty ? ERR : mvwgetstr(stdscr,y,x,s)) #define mvinch(y,x) (!decc$$scr_is_tty ? ERR : mvwinch(stdscr,y,x)) #define mvinsch(y,x,c) (!decc$$scr_is_tty ? ERR : mvwinsch(stdscr,y,x,c)) /* ** Digital only extension to BSD */ #define mvinsstr(y,x,s) (!decc$$scr_is_tty ? ERR : mvwinsstr (stdscr,y,x,s)) #define mvwaddbytes(w,y,x,s,n) (wmove(w,y,x) == ERR ? ERR : __waddbytes(w,s,n,(w->attrs == A_NORMAL) ? 0 : 1)) #define mvwaddch(w,y,x,ch) (wmove(w,y,x) == ERR ? ERR : waddch(w,ch)) #define mvwaddnstr(w,y,x,s,n) (wmove(w,y,x) == ERR ? ERR : waddnstr(w,s,n)) #define mvwaddstr(w,y,x,s) (wmove(w,y,x) == ERR ? ERR : __waddbytes(w,s,strlen(s),(w->attrs == A_NORMAL) ? 0 : 1)) #define mvwdelch(w,y,x) (wmove(w,y,x) == ERR ? ERR : wdelch(w)) #define mvwgetch(w,y,x) (wmove(w,y,x) == ERR ? ERR : wgetch(w)) #define mvwgetstr(w,y,x,s) (wmove(w,y,x) == ERR ? ERR : wgetstr(w,s)) #define mvwinch(w,y,x) (wmove(w,y,x) == ERR ? ERR : winch(w)) #define mvwinsch(w,y,x,c) (wmove(w,y,x) == ERR ? ERR : winsch(w,c)) /* ** Digital only extension to BSD */ #define mvwinsstr(w,y,x,s) (wmove(w,y,x)==ERR ? ERR : winsstr(w,s)) /* ** Psuedo functions */ #define clearok(w,bf) ((bf) ? ((w)->flags |= __CLEAROK) : ((w)->flags &= ~__CLEAROK)) #define flushok(w,bf) ((bf) ? ((w)->flags |= __FLUSH) : ((w)->flags &= ~__FLUSH)) #define getyx(w,y,x) (y) = (w)->cury,(x) = (w)->curx #define leaveok(w,bf) ((bf) ? ((w)->flags |= __LEAVEOK) : ((w)->flags &= ~__LEAVEOK)) #define scrollok(w,bf) ((bf) ? ((w)->flags |= __SCROLLOK) : ((w)->flags &= ~__SCROLLOK)) #define winch(w) ((w)->lines[(w)->cury]->line[(w)->curx].ch & 0177) /* ** Create 'private' typedefs that are sensitive to pointer size and must ** use short pointers. These typedefs are used when refering to these ** types when in 64 bit pointer context. */ typedef WINDOW * __WINDOW_ptr32; /* ** Switch back to 32-bit pointer size to define those functions which ** are resticted to 32-bit pointers. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 32 #endif /* ** The callback routines for tputs is always a 32 bit address. */ typedef void (*__tputs_callback) (int); /* ** Define macros for mapping to decc$ entry points */ #define fullname(p1,p2) decc$bsd_fullname(p1,p2) #define getcap(p1) decc$bsd_getcap(p1) #define longname(p1,p2) decc$bsd_longname(p1,p2) #define tgetstr(p1,p2) decc$bsd_tgetstr(p1,p2) /* ** The following functions are restricted to 32 bit pointers. If you ** have a need to use the 64 bit interface, the names of the procedures ** to call are function prototyped in the 64 bit section and have ** names of the form decc$_bsd_fullname64. */ char *fullname (char *, char *); char *getcap (char *); char *longname (char *, char *); char *tgetstr (__char_ptr64, char **); /* ** We are done defining things which must always be short pointers. If ** the user has used /pointer_size=short or /pointer_size=long, we will ** allow long pointers to be used in function calls. */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size 64 #endif /* ** Define the 64 bit specific interfaces for those users needing access to ** them. There is no "transparent" way to access these. Compiling with ** the /pointer_size=64 qualifier does not automatically call these. */ #if __INITIAL_POINTER_SIZE char *decc$_bsd_fullname64 (char *, char *); char *decc$_bsd_getcap64 (char *); char *decc$_bsd_longname64 (char *, char *); char *decc$_bsd_tgetstr64 (char *, char **); #endif /* ** Define macros for mapping to decc$ entry points */ #define __cputchar decc$bsd__cputchar #define __waddbytes(p1,p2,p3,p4) decc$bsd__waddbytes(p1,p2,p3,p4) #define baudrate(p1) decc$bsd_baudrate(p1) #define box(p1,p2,p3) decc$bsd_box(p1,p2,p3) #define cbreak(_p1) decc$bsd_cbreak(_p1) #define delwin(p1) decc$bsd_delwin(p1) #define echo(_p1) decc$bsd_echo(_p1) #define endwin decc$bsd_endwin #define erasechar(_p1) decc$bsd_erasechar(_p1) #define gettmode(_p1) decc$bsd_gettmode(_p1) #define idlok(p1,p2) decc$bsd_idlok(p1,p2) #define initscr(_p1) decc$bsd_initscr(_p1) #define killchar(_p1) decc$bsd_killchar(_p1) #define mvwin(p1,p2,p3) decc$bsd_mvwin(p1,p2,p3) #define nl(_p1) decc$bsd_nl(_p1) #define nocbreak(_p1) decc$bsd_nocbreak(_p1) #define nodelay(p1,p2) decc$bsd_nodelay(p1,p2) #define noecho(_p1) decc$bsd_noecho(_p1) #define nonl(_p1) decc$bsd_nonl(_p1) #define noraw(_p1) decc$bsd_noraw(_p1) #define overlay(p1,p2) decc$bsd_overlay(p1,p2) #define overwrite(p1,p2) decc$bsd_overwrite(p1,p2) #define raw(_p1) decc$bsd_raw(_p1) #define resetty(_p1) decc$bsd_resetty(_p1) #define savetty(_p1) decc$bsd_savetty(_p1) #define scroll(p1) decc$bsd_scroll(p1) #define setterm(p1) decc$bsd_setterm(p1) #define tgetent(p1,p2) decc$bsd_tgetent(p1,p2) #define tgetflag(p1) decc$bsd_tgetflag(p1) #define tgetnum(p1) decc$bsd_tgetnum(p1) #define tgoto(p1,p2,p3) decc$bsd_tgoto(p1,p2,p3) #define touchwin(p1) decc$bsd_touchwin(p1) #define tputs(p1,p2,p3) decc$bsd_tputs(p1,p2,p3) #define waddch(p1,p2) decc$bsd_waddch(p1,p2) #define wattroff(p1,p2) decc$bsd_wattroff(p1,p2) #define wattron(p1,p2) decc$bsd_wattron(p1,p2) #define wattrset(p1,p2) decc$bsd_wattrset(p1,p2) #define wclear(p1) decc$bsd_wclear(p1) #define wclrattr(p1,p2) decc$bsd_wclrattr(p1,p2) #define wclrtobot(p1) decc$bsd_wclrtobot(p1) #define wclrtoeol(p1) decc$bsd_wclrtoeol(p1) #define wdelch(p1) decc$bsd_wdelch(p1) #define wdeleteln(p1) decc$bsd_wdeleteln(p1) #define werase(p1) decc$bsd_werase(p1) #define wgetch(p1) decc$bsd_wgetch(p1) #define wgetstr(p1,p2) decc$bsd_wgetstr(p1,p2) #define winsch(p1,p2) decc$bsd_winsch(p1,p2) #define winsertln(p1) decc$bsd_winsertln(p1) #define winsstr(p1,p2) decc$bsd_winsstr(p1,p2) #define wmove(p1,p2,p3) decc$bsd_wmove(p1,p2,p3) #define wrefresh(p1) decc$bsd_wrefresh(p1) #define wsetattr(p1,p2) decc$bsd_wsetattr(p1,p2) #define wstandend(p1) decc$bsd_wstandend(p1) #define wstandout(p1) decc$bsd_wstandout(p1) #define mvcur(p1,p2,p3,p4) decc$bsd_mvcur(p1,p2,p3,p4) #define newwin(p1,p2,p3,p4) decc$bsd_newwin(p1,p2,p3,p4) #define subwin(p1,p2,p3,p4,p5) decc$bsd_subwin(p1,p2,p3,p4,p5) #define touchline(p1,p2,p3,p4) decc$bsd_touchline(p1,p2,p3,p4) #define touchoverlap(p1,p2) decc$bsd_touchoverlap(p1,p2) #define waddnstr(p1,p2,p3) decc$bsd_waddnstr(p1,p2,p3) /* ** Define macros for mapping to decc$ entry points (floating point specific) */ #if __X_FLOAT # if __G_FLOAT /* g-float */ # define printw decc$gxbsd_printw # define scanw decc$gxbsd_scanw # define wprintw decc$gxbsd_wprintw # define wscanw decc$gxbsd_wscanw # define mvprintw decc$gxbsd_mvprintw # define mvwprintw decc$gxbsd_mvwprintw # define mvscanw decc$gxbsd_mvscanw # define mvwscanw decc$gxbsd_mvwscanw # elif __IEEE_FLOAT /* ieee-float */ # define printw decc$txbsd_printw # define scanw decc$txbsd_scanw # define wprintw decc$txbsd_wprintw # define wscanw decc$txbsd_wscanw # define mvprintw decc$txbsd_mvprintw # define mvwprintw decc$txbsd_mvwprintw # define mvscanw decc$txbsd_mvscanw # define mvwscanw decc$txbsd_mvwscanw # else /* d-float */ # define printw decc$dxbsd_printw # define scanw decc$dxbsd_scanw # define wprintw decc$dxbsd_wprintw # define wscanw decc$dxbsd_wscanw # define mvprintw decc$dxbsd_mvprintw # define mvwprintw decc$dxbsd_mvwprintw # define mvscanw decc$dxbsd_mvscanw # define mvwscanw decc$dxbsd_mvwscanw # endif #else # if __G_FLOAT /* g-float */ # define printw decc$bsd_printw # define scanw decc$bsd_scanw # define wprintw decc$bsd_wprintw # define wscanw decc$bsd_wscanw # define mvprintw decc$bsd_mvprintw # define mvwprintw decc$bsd_mvwprintw # define mvscanw decc$bsd_mvscanw # define mvwscanw decc$bsd_mvwscanw # elif __IEEE_FLOAT /* ieee-float */ # define printw decc$tbsd_printw # define scanw decc$tbsd_scanw # define wprintw decc$tbsd_wprintw # define wscanw decc$tbsd_wscanw # define mvprintw decc$tbsd_mvprintw # define mvwprintw decc$tbsd_mvwprintw # define mvscanw decc$tbsd_mvscanw # define mvwscanw decc$tbsd_mvwscanw # else /* d-float */ # define printw decc$dbsd_printw # define scanw decc$dbsd_scanw # define wprintw decc$dbsd_wprintw # define wscanw decc$dbsd_wscanw # define mvprintw decc$dbsd_mvprintw # define mvwprintw decc$dbsd_mvwprintw # define mvscanw decc$dbsd_mvscanw # define mvwscanw decc$dbsd_mvwscanw # endif #endif /* ** Public function prototypes */ void __cputchar (int); int __waddbytes (WINDOW *, const char *, int, int); /* ** The DEC C RTL always allocates WINDOW structure in 32 bit memory. */ __WINDOW_ptr32 initscr (void); __WINDOW_ptr32 newwin (int, int, int, int); __WINDOW_ptr32 subwin (WINDOW *, int, int, int, int); /* ** The return values of these functions are pointers to character strings ** allocated by the CRTL and are always 32 bit addresses. */ __char_ptr32 wstandend (WINDOW *); __char_ptr32 wstandout (WINDOW *); __char_ptr32 tgoto (char *, int, int); /* ** Public function prototypes */ int baudrate (void); int box (WINDOW *, int, int); int cbreak (void); int delwin (WINDOW *); int erasechar (void); int echo (void); int endwin (void); int gettmode (void); void idlok (WINDOW *, int); int killchar (void); int mvcur (int, int, int, int); int mvprintw (int, int, const char *, ...); int mvscanw (int, int, const char *, ...); int mvwin (WINDOW *, int, int); int mvwprintw (WINDOW *, int, int, const char *, ...); int mvwscanw (WINDOW *, int, int, const char *, ...); int nl (void); int nocbreak (void); int nodelay (WINDOW *, const int); /* OpenVMS extension */ int noecho (void); int nonl (void); int noraw (void); int overlay (WINDOW *, WINDOW *); int overwrite (WINDOW *, WINDOW *); int printw (const char *, ...); int raw (void); int resetty (void); int savetty (void); int scanw (const char *, ...); int scroll (WINDOW *); int setterm (char *); int touchline (WINDOW *, int, int, int); int touchoverlap (WINDOW *, WINDOW *); int touchwin (WINDOW *); int waddch (WINDOW *, int); int waddnstr (WINDOW *, const char *, int); int wclear (WINDOW *); int wclrtobot (WINDOW *); int wclrtoeol (WINDOW *); int wdelch (WINDOW *); int wdeleteln (WINDOW *); int werase (WINDOW *); int wgetch (WINDOW *); int wgetstr (WINDOW *, char *); int winsch (WINDOW *, int); int winsstr (WINDOW *, const char *); /* OpenVMS extension */ int winsertln (WINDOW *); int wmove (WINDOW *, int, int); int wprintw (WINDOW *, const char *, ...); int wrefresh (WINDOW *); int wscanw (WINDOW *, const char *, ...); int wclrattr (WINDOW *, int); int wsetattr (WINDOW *, int); int wattron (WINDOW *, int); int wattroff (WINDOW *, int); int wattrset (WINDOW *, int); /* ** Termcap functions */ int tgetent (char *, char *); int tgetnum (char *); int tgetflag (char *); void tputs (char *, int, __tputs_callback); /* ** The following routines, savetty and resetty are left in only as stubs. */ int resetty(); int savetty(); #endif /* _BSD44_CURSES */ /* ** Restore the users pointer context */ #if __INITIAL_POINTER_SIZE # pragma __pointer_size __restore #endif #ifdef __cplusplus } #endif #pragma __message __restore #pragma __member_alignment __restore #pragma __standard #endif /* __CURSES_LOADED */