2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/* Copyright (c) 1988 AT&T */
2N/A/* All Rights Reserved */
2N/A
2N/A/*
2N/A * University Copyright- Copyright (c) 1982, 1986, 1988
2N/A * The Regents of the University of California
2N/A * All Rights Reserved
2N/A *
2N/A * University Acknowledgment- Portions of this document are derived from
2N/A * software developed by the University of California, Berkeley, and its
2N/A * contributors.
2N/A */
2N/A
2N/A#ifndef _CURSHDR_H
2N/A#define _CURSHDR_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define _NOHASH (-1) /* if the hash value is unknown */
2N/A#define _REDRAW (-2) /* if line need redrawn */
2N/A#define _BLANK (-3) /* if line is blank */
2N/A#define _THASH (123) /* base hash if clash with other hashes */
2N/A#define _KEY (01)
2N/A#define _MACRO (02)
2N/A
2N/A#define _INPUTPENDING cur_term->_iwait
2N/A#define _PUTS(x, y) (void) tputs(x, y, _outch)
2N/A#define _VIDS(na, oa) (vidupdate((na), (oa), _outch), curscr->_attrs = (na))
2N/A#define _ONINSERT() (_PUTS(enter_insert_mode, 1), SP->phys_irm = TRUE)
2N/A#define _OFFINSERT() (_PUTS(exit_insert_mode, 1), SP->phys_irm = FALSE)
2N/A#define _STRNOTEQ(a, b) (a == NULL ? (b != NULL) : \
2N/A (b == NULL ? 1 : strcmp(a, b)))
2N/A
2N/A/*
2N/A * IC and IL overheads and costs should be set to this
2N/A * value if the corresponding feature is missing
2N/A */
2N/A
2N/A#define LARGECOST 500
2N/A
2N/Atypedef struct
2N/A{
2N/A short icfixed; /* Insert char fixed overhead */
2N/A short dcfixed; /* Delete char fixed overhead */
2N/A short Insert_character;
2N/A short Delete_character;
2N/A short Cursor_home;
2N/A short Cursor_to_ll;
2N/A short Cursor_left;
2N/A short Cursor_right;
2N/A short Cursor_down;
2N/A short Cursor_up;
2N/A short Carriage_return;
2N/A short Tab;
2N/A short Back_tab;
2N/A short Clr_eol;
2N/A short Clr_bol;
2N/A short Parm_ich;
2N/A short Parm_dch;
2N/A short Parm_left_cursor;
2N/A short Parm_up_cursor;
2N/A short Parm_down_cursor;
2N/A short Parm_right_cursor;
2N/A short Cursor_address;
2N/A short Row_address;
2N/A} COSTS;
2N/A
2N/A#define _COST(field) (SP->term_costs.field)
2N/A
2N/A/* Soft label keys */
2N/A
2N/A#define LABMAX 16 /* max number of labels allowed */
2N/A#define LABLEN 8 /* max length of each label */
2N/A
2N/Atypedef struct
2N/A{
2N/A WINDOW *_win; /* the window to display labels */
2N/A char _ldis[LABMAX][LABLEN+1]; /* labels suitable to display */
2N/A char _lval[LABMAX][LABLEN+1]; /* labels' true values */
2N/A short _labx[LABMAX]; /* where to display labels */
2N/A short _num; /* actual number of labels */
2N/A short _len; /* real length of labels */
2N/A bool _changed; /* TRUE if some labels changed */
2N/A bool _lch[LABMAX]; /* change status */
2N/A} SLK_MAP;
2N/A
2N/Astruct screen
2N/A{
2N/A unsigned fl_echoit : 1; /* in software echo mode */
2N/A unsigned fl_endwin : 2; /* has called endwin */
2N/A unsigned fl_meta : 1; /* in meta mode */
2N/A unsigned fl_nonl : 1; /* do not xlate input \r-> \n */
2N/A unsigned yesidln : 1; /* has idln capabilities */
2N/A unsigned dmode : 1; /* Terminal has delete mode */
2N/A unsigned imode : 1; /* Terminal has insert mode */
2N/A unsigned ichok : 1; /* Terminal can insert characters */
2N/A unsigned dchok : 1; /* Terminal can delete characters */
2N/A unsigned sid_equal : 1; /* enter insert and delete mode equal */
2N/A unsigned eid_equal : 1; /* exit insert and delete mode equal */
2N/A unsigned phys_irm : 1; /* in insert mode or not */
2N/A long baud; /* baud rate of this tty */
2N/A short kp_state; /* 1 iff keypad is on, else 0 */
2N/A short Yabove; /* How many lines are above stdscr */
2N/A short lsize; /* How many lines decided by newscreen */
2N/A short csize; /* How many columns decided by newscreen */
2N/A short tsize; /* How big is a tab decided by newscreen */
2N/A WINDOW *std_scr; /* primary output screen */
2N/A WINDOW *cur_scr; /* what's physically on the screen */
2N/A WINDOW *virt_scr; /* what's virtually on the screen */
2N/A int *cur_hash; /* hash table of curscr */
2N/A int *virt_hash; /* hash table of virtscr */
2N/A TERMINAL *tcap; /* TERMINFO info */
2N/A FILE *term_file; /* File to write on for output. */
2N/A FILE *input_file; /* Where to get keyboard input */
2N/A SLK_MAP *slk; /* Soft label information */
2N/A char **_mks; /* marks, only used with xhp terminals */
2N/A COSTS term_costs; /* costs of various capabilities */
2N/A SGTTY save_tty_buf; /* saved termio state of this tty */
2N/A#ifdef SYSV
2N/A SGTTYS save_tty_bufs; /* saved termios state of this tty */
2N/A#endif
2N/A char **_color_mks; /* marks, only used with color xhp terminals */
2N/A unsigned long _trap_mbe; /* trap these mouse button events */
2N/A unsigned long _map_mbe_to_key; /* map selected buttons on top of */
2N/A /* slk's to function keys */
2N/A};
2N/A
2N/Aextern SCREEN *SP;
2N/Aextern WINDOW *_virtscr;
2N/A
2N/A#ifdef DEBUG
2N/A#ifndef outf
2N/Aextern FILE *outf;
2N/A#endif /* outf */
2N/A#endif /* DEBUG */
2N/A
2N/Aextern short cswidth[], /* byte size of multi-byte chars */
2N/A _curs_scrwidth[]; /* display size */
2N/Aextern short _csmax,
2N/A _scrmax;
2N/Aextern bool _mbtrue;
2N/A
2N/A#define MBIT 0200 /* indicator for a multi-byte char */
2N/A#define CBIT 002000000000 /* indicator for a continuing col */
2N/A#define RBYTE(x) ((x) & 0377)
2N/A#define LBYTE(x) (((x) >> 8) & 0177)
2N/A#define ISMBIT(x) ((x) & MBIT)
2N/A#define SETMBIT(x) ((x) |= MBIT)
2N/A#define CLRMBIT(x) ((x) &= ~MBIT)
2N/A#define ISCBIT(x) ((x) & CBIT)
2N/A#define SETCBIT(x) ((x) |= CBIT)
2N/A#define CLRCBIT(x) ((x) &= ~CBIT)
2N/A#define TYPE(x) ((x) == SS2 ? 1 : (x) == SS3 ? 2 : ISMBIT(x) ? 0 : 3)
2N/A#define TRIM 037777777777 /* 0xFFFFFFFF */
2N/A
2N/A/* terminfo magic number */
2N/A#define MAGNUM 0432
2N/A
2N/A/* curses screen dump magic number */
2N/A#define SVR2_DUMP_MAGIC_NUMBER 0433
2N/A#define SVR3_DUMP_MAGIC_NUMBER 0434
2N/A
2N/A/* Getting the baud rate is different on the two systems. */
2N/A
2N/A#ifdef SYSV
2N/A#define _BR(x) (x.c_cflag & CBAUD)
2N/A#define _BRS(x) (cfgetospeed(&x))
2N/A#include <values.h>
2N/A#else /* SYSV */
2N/A#define BITSPERBYTE 8
2N/A#define MAXINT 32767
2N/A#define _BR(x) (x.sg_ispeed)
2N/A#endif /* SYSV */
2N/A
2N/A#define _BLNKCHAR ' '
2N/A#define _CTRL(c) (c | 0100)
2N/A#define _ATTR(c) ((c) & A_ATTRIBUTES)
2N/A#define _CHAR(c) ((c) & A_CHARTEXT)
2N/A
2N/A/*
2N/A * combine CHAR par of the character with the attributes of the window.
2N/A * Two points: 1) If character is blank, usebackground instead
2N/A * 2) If character contains color, delete color from
2N/A * window attribute.
2N/A */
2N/A
2N/A#define _WCHAR(w, c) (_CHAR((c) == _BLNKCHAR ? (w)->_bkgd : (c))| \
2N/A (((c) & A_COLOR) ? ((w)->_attrs & ~A_COLOR) : \
2N/A ((w)->_attrs)))
2N/A
2N/A#define _DARKCHAR(c) ((c) != _BLNKCHAR)
2N/A#define _UNCTRL(c) ((c) ^ 0100)
2N/A
2N/A/* blank lines info of curscr */
2N/A#define _BEGNS curscr->_firstch
2N/A#define _ENDNS curscr->_lastch
2N/A
2N/A/* hash tables */
2N/A#define _CURHASH SP->cur_hash
2N/A#define _VIRTHASH SP->virt_hash
2N/A
2N/A/* top/bot line changed */
2N/A#define _VIRTTOP _virtscr->_parx
2N/A#define _VIRTBOT _virtscr->_pary
2N/A
2N/A/* video marks */
2N/A#define _MARKS SP->_mks
2N/A#define _COLOR_MARKS SP->_color_mks
2N/A
2N/A#define _NUMELEMENTS(x) (sizeof (x)/sizeof (x[0]))
2N/A
2N/A#ifdef _VR3_COMPAT_CODE
2N/A/*
2N/A * #define _TO_OCHTYPE(x) ((_ochtype)(((x&A_ATTRIBUTES)>>9)| \
2N/A * (x&0x0000007FUL)))
2N/A */
2N/A#define _TO_OCHTYPE(x) ((_ochtype)(((x&A_ATTRIBUTES)>>9)|(x&0177)))
2N/A#define _FROM_OCHTYPE(x) ((chtype) ((x&0177) | ((x&0177600)<<9)))
2N/Aextern void (*_y16update)(WINDOW *, int, int, int, int);
2N/A#endif /* _VR3_COMPAT_CODE */
2N/A
2N/A/* functions for screen updates */
2N/A
2N/Aextern int (*_setidln)(void);
2N/Aextern int (*_useidln)(void);
2N/Aextern int (*_quick_ptr)(WINDOW *, chtype);
2N/Aextern int (_quick_echo)(WINDOW *, chtype);
2N/A
2N/A/* min/max functions */
2N/A
2N/A#define _MIN(a, b) ((a) < (b) ? (a) : (b))
2N/A#define _MAX(a, b) ((a) > (b) ? (a) : (b))
2N/A
2N/Aextern int (*_do_slk_ref)(void);
2N/Aextern int (*_do_slk_tch)(void);
2N/Aextern int (*_do_slk_noref)(void);
2N/Aextern int _image(WINDOW *);
2N/Aextern int _outch(char);
2N/Aextern int _outwch(chtype);
2N/Aextern int _chkinput(void);
2N/Aextern int _curs_mbtowc(wchar_t *, const char *, size_t);
2N/Aextern int _curs_wctomb(char *, wchar_t);
2N/Aextern int _delay(int, int (*)(char));
2N/Aextern int _mbaddch(WINDOW *, chtype, chtype);
2N/Aextern int _mbclrch(WINDOW *, int, int);
2N/Aextern int _mbinsshift(WINDOW *, int), _mbvalid(WINDOW *);
2N/Aextern int _padjust(WINDOW *, int, int, int, int, int, int);
2N/Aextern int _prefresh(int (*)(WINDOW *), WINDOW *, int, int, int,
2N/A int, int, int);
2N/Aextern int _overlap(WINDOW *, WINDOW *, int);
2N/Aextern int _scr_all(char *, int);
2N/Aextern int _slk_update(void);
2N/Aextern int _tcsearch(char *, short [], char *[], int, int);
2N/Aextern int _vsscanf(const char *, const char *, __va_list);
2N/Aextern int force_doupdate(void);
2N/Aextern int init_acs(void);
2N/Aextern int mbscrw(int);
2N/Aextern int mbeucw(int);
2N/Aextern int scr_ll_dump(FILE *);
2N/Aextern int scr_reset(FILE *, int);
2N/Aextern int setkeymap(void);
2N/Aextern int ttimeout(int);
2N/Aextern int wadjcurspos(WINDOW *);
2N/Aextern int wcscrw(wchar_t);
2N/Aextern int wmbmove(WINDOW *, int, int);
2N/A
2N/Aextern chtype tgetch(int);
2N/A
2N/Aextern WINDOW *_makenew(int, int, int, int);
2N/A
2N/Aextern void (*_slk_init)(void);
2N/Aextern void (*_rip_init)(void);
2N/Aextern void delkeymap(TERMINAL *);
2N/Aextern void mbgetwidth(void);
2N/Aextern void memSset(chtype *, chtype, int);
2N/Aextern void _blast_keys(TERMINAL *);
2N/Aextern void _init_costs(void);
2N/Aextern void _init_HP_pair(short, short, short);
2N/Aextern void _update_old_y_area(WINDOW *, int, int, int, int);
2N/A
2N/Aextern char *tparm_p0(char *);
2N/Aextern char *tparm_p1(char *, long);
2N/Aextern char *tparm_p2(char *, long, long);
2N/Aextern char *tparm_p3(char *, long, long, long);
2N/Aextern char *tparm_p4(char *, long, long, long, long);
2N/Aextern char *tparm_p7(char *, long, long, long, long, long, long, long);
2N/A
2N/A
2N/Aextern char *infotocap(char *, int *);
2N/Aextern char *_strcode2byte(wchar_t *, char *, int);
2N/Aextern char *wmbinch(WINDOW *, int, int);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _CURSHDR_H */