head	1.5;
access;
symbols
	perseant-exfatfs-base-20250801:1.5
	perseant-exfatfs-base-20240630:1.5
	perseant-exfatfs:1.5.0.36
	perseant-exfatfs-base:1.5
	cjep_sun2x:1.5.0.34
	cjep_sun2x-base:1.5
	cjep_staticlib_x-base1:1.5
	cjep_staticlib_x:1.5.0.32
	cjep_staticlib_x-base:1.5
	phil-wifi-20200421:1.5
	phil-wifi-20200411:1.5
	phil-wifi-20200406:1.5
	pgoyette-compat-merge-20190127:1.5
	pgoyette-compat-20190127:1.5
	pgoyette-compat-20190118:1.5
	pgoyette-compat-1226:1.5
	pgoyette-compat-1126:1.5
	pgoyette-compat-1020:1.5
	pgoyette-compat-0930:1.5
	pgoyette-compat-0906:1.5
	pgoyette-compat-0728:1.5
	pgoyette-compat-0625:1.5
	pgoyette-compat-0521:1.5
	pgoyette-compat-0502:1.5
	pgoyette-compat-0422:1.5
	pgoyette-compat-0415:1.5
	pgoyette-compat-0407:1.5
	pgoyette-compat-0330:1.5
	pgoyette-compat-0322:1.5
	pgoyette-compat-0315:1.5
	pgoyette-compat:1.5.0.30
	pgoyette-compat-base:1.5
	perseant-stdc-iso10646:1.5.0.28
	perseant-stdc-iso10646-base:1.5
	prg-localcount2-base3:1.5
	prg-localcount2-base2:1.5
	prg-localcount2-base1:1.5
	prg-localcount2:1.5.0.26
	prg-localcount2-base:1.5
	pgoyette-localcount-20170426:1.5
	bouyer-socketcan-base1:1.5
	pgoyette-localcount-20170320:1.5
	bouyer-socketcan:1.5.0.24
	bouyer-socketcan-base:1.5
	pgoyette-localcount-20170107:1.5
	pgoyette-localcount-20161104:1.5
	localcount-20160914:1.5
	pgoyette-localcount-20160806:1.5
	pgoyette-localcount-20160726:1.5
	pgoyette-localcount:1.5.0.22
	pgoyette-localcount-base:1.5
	netbsd-5-2-3-RELEASE:1.5
	netbsd-5-1-5-RELEASE:1.5
	yamt-pagecache-base9:1.5
	yamt-pagecache-tag8:1.5
	tls-earlyentropy:1.5.0.18
	tls-earlyentropy-base:1.5
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.5
	riastradh-drm2-base3:1.5
	netbsd-5-2-2-RELEASE:1.5
	netbsd-5-1-4-RELEASE:1.5
	netbsd-5-2-1-RELEASE:1.5
	netbsd-5-1-3-RELEASE:1.5
	agc-symver:1.5.0.20
	agc-symver-base:1.5
	tls-maxphys-base:1.5
	yamt-pagecache-base8:1.5
	netbsd-5-2:1.5.0.16
	yamt-pagecache-base7:1.5
	netbsd-5-2-RELEASE:1.5
	netbsd-5-2-RC1:1.5
	yamt-pagecache-base6:1.5
	yamt-pagecache-base5:1.5
	yamt-pagecache-base4:1.5
	netbsd-5-1-2-RELEASE:1.5
	netbsd-5-1-1-RELEASE:1.5
	yamt-pagecache-base3:1.5
	yamt-pagecache-base2:1.5
	yamt-pagecache:1.5.0.14
	yamt-pagecache-base:1.5
	bouyer-quota2-nbase:1.5
	bouyer-quota2:1.5.0.12
	bouyer-quota2-base:1.5
	matt-nb5-pq3:1.5.0.10
	matt-nb5-pq3-base:1.5
	netbsd-5-1:1.5.0.8
	netbsd-5-1-RELEASE:1.5
	netbsd-5-1-RC4:1.5
	netbsd-5-1-RC3:1.5
	netbsd-5-1-RC2:1.5
	netbsd-5-1-RC1:1.5
	netbsd-5-0-2-RELEASE:1.5
	netbsd-5-0-1-RELEASE:1.5
	jym-xensuspend-nbase:1.5
	netbsd-5-0:1.5.0.6
	netbsd-5-0-RELEASE:1.5
	netbsd-5-0-RC4:1.5
	netbsd-5-0-RC3:1.5
	netbsd-5-0-RC2:1.5
	jym-xensuspend:1.5.0.4
	jym-xensuspend-base:1.5
	netbsd-5-0-RC1:1.5
	netbsd-5:1.5.0.2
	netbsd-5-base:1.5
	matt-mips64-base2:1.4
	matt-mips64:1.4.0.40
	mjf-devfs2:1.4.0.38
	mjf-devfs2-base:1.4
	netbsd-4-0-1-RELEASE:1.4
	wrstuden-revivesa-base-3:1.4
	wrstuden-revivesa-base-2:1.4
	wrstuden-fixsa-newbase:1.4
	wrstuden-revivesa-base-1:1.4
	yamt-pf42-base4:1.4
	yamt-pf42-base3:1.4
	hpcarm-cleanup-nbase:1.4
	yamt-pf42-baseX:1.4
	yamt-pf42-base2:1.4
	wrstuden-revivesa:1.4.0.36
	wrstuden-revivesa-base:1.4
	yamt-pf42:1.4.0.34
	yamt-pf42-base:1.4
	keiichi-mipv6-nbase:1.4
	keiichi-mipv6:1.4.0.32
	keiichi-mipv6-base:1.4
	matt-armv6-nbase:1.4
	matt-armv6-prevmlocking:1.4
	wrstuden-fixsa-base-1:1.4
	netbsd-4-0:1.4.0.30
	netbsd-4-0-RELEASE:1.4
	cube-autoconf:1.4.0.28
	cube-autoconf-base:1.4
	netbsd-4-0-RC5:1.4
	netbsd-4-0-RC4:1.4
	netbsd-4-0-RC3:1.4
	netbsd-4-0-RC2:1.4
	netbsd-4-0-RC1:1.4
	matt-armv6:1.4.0.26
	matt-armv6-base:1.4
	matt-mips64-base:1.4
	hpcarm-cleanup:1.4.0.24
	hpcarm-cleanup-base:1.4
	netbsd-3-1-1-RELEASE:1.4
	netbsd-3-0-3-RELEASE:1.4
	wrstuden-fixsa:1.4.0.22
	wrstuden-fixsa-base:1.4
	abandoned-netbsd-4-base:1.4
	abandoned-netbsd-4:1.4.0.16
	netbsd-3-1:1.4.0.18
	netbsd-3-1-RELEASE:1.4
	netbsd-3-0-2-RELEASE:1.4
	netbsd-3-1-RC4:1.4
	netbsd-3-1-RC3:1.4
	netbsd-3-1-RC2:1.4
	netbsd-3-1-RC1:1.4
	netbsd-4:1.4.0.20
	netbsd-4-base:1.4
	chap-midi-nbase:1.4
	netbsd-3-0-1-RELEASE:1.4
	chap-midi:1.4.0.14
	chap-midi-base:1.4
	netbsd-3-0:1.4.0.12
	netbsd-3-0-RELEASE:1.4
	netbsd-3-0-RC6:1.4
	netbsd-3-0-RC5:1.4
	netbsd-3-0-RC4:1.4
	netbsd-3-0-RC3:1.4
	netbsd-3-0-RC2:1.4
	netbsd-3-0-RC1:1.4
	netbsd-2-0-3-RELEASE:1.4
	netbsd-2-1:1.4.0.10
	netbsd-2-1-RELEASE:1.4
	netbsd-2-1-RC6:1.4
	netbsd-2-1-RC5:1.4
	netbsd-2-1-RC4:1.4
	netbsd-2-1-RC3:1.4
	netbsd-2-1-RC2:1.4
	netbsd-2-1-RC1:1.4
	netbsd-2-0-2-RELEASE:1.4
	netbsd-3:1.4.0.8
	netbsd-3-base:1.4
	netbsd-2-0-1-RELEASE:1.4
	netbsd-2:1.4.0.6
	netbsd-2-base:1.4
	netbsd-2-0-RELEASE:1.4
	netbsd-2-0-RC5:1.4
	netbsd-2-0-RC4:1.4
	netbsd-2-0-RC3:1.4
	netbsd-2-0-RC2:1.4
	netbsd-2-0-RC1:1.4
	netbsd-2-0:1.4.0.4
	netbsd-2-0-base:1.4
	netbsd-1-6-PATCH002-RELEASE:1.4
	netbsd-1-6-PATCH002:1.4
	netbsd-1-6-PATCH002-RC4:1.4
	netbsd-1-6-PATCH002-RC3:1.4
	netbsd-1-6-PATCH002-RC2:1.4
	netbsd-1-6-PATCH002-RC1:1.4
	netbsd-1-6-PATCH001:1.4
	netbsd-1-6-PATCH001-RELEASE:1.4
	netbsd-1-6-PATCH001-RC3:1.4
	netbsd-1-6-PATCH001-RC2:1.4
	netbsd-1-6-PATCH001-RC1:1.4
	fvdl_fs64_base:1.4
	netbsd-1-6-RELEASE:1.4
	netbsd-1-6-RC3:1.4
	netbsd-1-6-RC2:1.4
	netbsd-1-6-RC1:1.4
	netbsd-1-6:1.4.0.2
	netbsd-1-6-base:1.4
	netbsd-1-5-PATCH003:1.3
	netbsd-1-5-PATCH002:1.3
	netbsd-1-5-PATCH001:1.3
	nvi_1_79:1.1.1.3
	netbsd-1-5-RELEASE:1.3
	netbsd-1-5-BETA2:1.3
	netbsd-1-5-BETA:1.3
	netbsd-1-4-PATCH003:1.2
	netbsd-1-5-ALPHA2:1.3
	netbsd-1-5:1.3.0.2
	netbsd-1-5-base:1.3
	minoura-xpg4dl-base:1.2
	minoura-xpg4dl:1.2.0.8
	netbsd-1-4-PATCH002:1.2
	wrstuden-devbsize-19991221:1.2
	wrstuden-devbsize:1.2.0.6
	wrstuden-devbsize-base:1.2
	comdex-fall-1999:1.2.0.4
	comdex-fall-1999-base:1.2
	netbsd-1-4-PATCH001:1.2
	netbsd-1-4-RELEASE:1.2
	netbsd-1-4:1.2.0.2
	netbsd-1-4-base:1.2
	netbsd-1-3-PATCH003:1.1.1.2
	netbsd-1-3-PATCH003-CANDIDATE2:1.1.1.2
	netbsd-1-3-PATCH003-CANDIDATE1:1.1.1.2
	netbsd-1-3-PATCH003-CANDIDATE0:1.1.1.2
	netbsd-1-3-PATCH002:1.1.1.2
	netbsd-1-3-PATCH001:1.1.1.2
	netbsd-1-3-RELEASE:1.1.1.2
	netbsd-1-3-BETA:1.1.1.2
	netbsd-1-3:1.1.1.2.0.2
	netbsd-1-3-base:1.1.1.2
	netbsd-1-2-PATCH001:1.1.1.2
	netbsd-1-2-RELEASE:1.1.1.2
	netbsd-1-2-BETA:1.1.1.2
	netbsd-1-2:1.1.1.2.0.4
	netbsd-1-2-base:1.1.1.2
	nvi_1_66:1.1.1.2
	BOSTIC:1.1.1
	netbsd-1-1-PATCH001:1.1.1.1
	netbsd-1-1-RELEASE:1.1.1.1
	netbsd-1-1:1.1.1.1.0.4
	netbsd-1-1-base:1.1.1.1
	netbsd-1-0-PATCH06:1.1.1.1
	netbsd-1-0-PATCH05:1.1.1.1
	netbsd-1-0-PATCH04:1.1.1.1
	netbsd-1-0-PATCH03:1.1.1.1
	netbsd-1-0-PATCH02:1.1.1.1
	netbsd-1-0-PATCH1:1.1.1.1
	netbsd-1-0-PATCH0:1.1.1.1
	netbsd-1-0-RELEASE:1.1.1.1
	netbsd-1-0:1.1.1.1.0.2
	nvi-1-34b:1.1.1.1
	nvi-1-33b:1.1.1.1
	bostic-nvi:1.1.1;
locks; strict;
comment	@ * @;


1.5
date	2008.10.29.16.49.34;	author christos;	state dead;
branches;
next	1.4;

1.4
date	2001.03.31.11.37.46;	author aymeric;	state Exp;
branches;
next	1.3;

1.3
date	2000.05.31.19.49.25;	author jdc;	state Exp;
branches;
next	1.2;

1.2
date	98.01.09.08.06.39;	author perry;	state Exp;
branches
	1.2.8.1;
next	1.1;

1.1
date	94.08.17.16.19.03;	author cgd;	state Exp;
branches
	1.1.1.1;
next	;

1.2.8.1
date	2000.06.23.16.40.08;	author minoura;	state Exp;
branches;
next	;

1.1.1.1
date	94.08.17.16.19.04;	author cgd;	state Exp;
branches
	1.1.1.1.2.1;
next	1.1.1.2;

1.1.1.2
date	96.05.20.02.04.01;	author mrg;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2001.03.31.11.30.01;	author aymeric;	state Exp;
branches;
next	;

1.1.1.1.2.1
date	94.08.17.16.19.04;	author cgd;	state dead;
branches;
next	1.1.1.1.2.2;

1.1.1.1.2.2
date	94.08.17.16.19.05;	author cgd;	state Exp;
branches;
next	;


desc
@@


1.5
log
@bye old vi!
@
text
@/*	$NetBSD: gs.h,v 1.4 2001/03/31 11:37:46 aymeric Exp $	*/

/*-
 * Copyright (c) 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 * Copyright (c) 1993, 1994, 1995, 1996
 *	Keith Bostic.  All rights reserved.
 *
 * See the LICENSE file for redistribution information.
 *
 *	@@(#)gs.h	10.34 (Berkeley) 9/24/96
 */

#define	TEMPORARY_FILE_STRING	"/tmp"	/* Default temporary file name. */

/*
 * File reference structure (FREF).  The structure contains the name of the
 * file, along with the information that follows the name.
 *
 * !!!
 * The read-only bit follows the file name, not the file itself.
 */
struct _fref {
	CIRCLEQ_ENTRY(_fref) q;		/* Linked list of file references. */
	char	*name;			/* File name. */
	char	*tname;			/* Backing temporary file name. */

	recno_t	 lno;			/* 1-N: file cursor line. */
	size_t	 cno;			/* 0-N: file cursor column. */

#define	FR_CURSORSET	0x0001		/* If lno/cno values valid. */
#define	FR_DONTDELETE	0x0002		/* Don't delete the temporary file. */
#define	FR_EXNAMED	0x0004		/* Read/write renamed the file. */
#define	FR_NAMECHANGE	0x0008		/* If the name changed. */
#define	FR_NEWFILE	0x0010		/* File doesn't really exist yet. */
#define	FR_RECOVER	0x0020		/* File is being recovered. */
#define	FR_TMPEXIT	0x0040		/* Modified temporary file, no exit. */
#define	FR_TMPFILE	0x0080		/* If file has no name. */
#define	FR_UNLOCKED	0x0100		/* File couldn't be locked. */
	u_int16_t flags;
};

/* Action arguments to scr_exadjust(). */
typedef enum { EX_TERM_CE, EX_TERM_SCROLL } exadj_t;

/* Screen attribute arguments to scr_attr(). */
typedef enum { SA_ALTERNATE, SA_INVERSE } scr_attr_t;

/* Key type arguments to scr_keyval(). */
typedef enum { KEY_VEOF, KEY_VERASE, KEY_VKILL, KEY_VWERASE } scr_keyval_t;

/*
 * GS:
 *
 * Structure that describes global state of the running program.
 */
struct _gs {
	char	*progname;		/* Programe name. */

	int	 id;			/* Last allocated screen id. */
	CIRCLEQ_HEAD(_dqh, _scr) dq;	/* Displayed screens. */
	CIRCLEQ_HEAD(_hqh, _scr) hq;	/* Hidden screens. */

	SCR	*ccl_sp;		/* Colon command-line screen. */

	void	*perl_interp;		/* Perl interpreter. */
	void	*tcl_interp;		/* Tcl_Interp *: Tcl interpreter. */

	void	*cl_private;		/* Curses support private area. */
	void	*ip_private;		/* IP support private area. */
	void	*tk_private;		/* Tk/Tcl support private area. */

					/* File references. */
	CIRCLEQ_HEAD(_frefh, _fref) frefq;

#define	GO_COLUMNS	0		/* Global options: columns. */
#define	GO_LINES	1		/* Global options: lines. */
#define	GO_SECURE	2		/* Global options: secure. */
#define	GO_TERM		3		/* Global options: terminal type. */
	OPTION	 opts[GO_TERM + 1];

	DB	*msg;			/* Message catalog DB. */
	MSGH	 msgq;			/* User message list. */
#define	DEFAULT_NOPRINT	'\1'		/* Emergency non-printable character. */
	CHAR_T	 noprint;		/* Cached, unprintable character. */

	void	*tmp_bp;		/* Temporary buffer. */
	size_t	 tmp_blen;		/* Temporary buffer size. */

	/*
	 * Ex command structures (EXCMD).  Defined here because ex commands
	 * exist outside of any particular screen or file.
	 */
#define	EXCMD_RUNNING(gp)	((gp)->ecq.lh_first->clen != 0)
	LIST_HEAD(_excmdh, _excmd) ecq;	/* Ex command linked list. */
	EXCMD	 excmd;			/* Default ex command structure. */
	char	 *if_name;		/* Current associated file. */
	recno_t	  if_lno;		/* Current associated line number. */

	char	*c_option;		/* Ex initial, command-line command. */

#ifdef DEBUG
	FILE	*tracefp;		/* Trace file pointer. */
#endif

	EVENT	*i_event;		/* Array of input events. */
	size_t	 i_nelem;		/* Number of array elements. */
	size_t	 i_cnt;			/* Count of events. */
	size_t	 i_next;		/* Offset of next event. */

	CB	*dcbp;			/* Default cut buffer pointer. */
	CB	 dcb_store;		/* Default cut buffer storage. */
	LIST_HEAD(_cuth, _cb) cutq;	/* Linked list of cut buffers. */

#define	MAX_BIT_SEQ	128		/* Max + 1 fast check character. */
	LIST_HEAD(_seqh, _seq) seqq;	/* Linked list of maps, abbrevs. */
	bitstr_t bit_decl(seqb, MAX_BIT_SEQ);

#define	MAX_FAST_KEY	254		/* Max fast check character.*/
#define	KEY_LEN(sp, ch)							\
	((unsigned char)(ch) <= MAX_FAST_KEY ?				\
	    sp->gp->cname[(unsigned char)ch].len : v_key_len(sp, ch))
#define	KEY_NAME(sp, ch)						\
	((unsigned char)(ch) <= MAX_FAST_KEY ?				\
	    sp->gp->cname[(unsigned char)ch].name : v_key_name(sp, ch))
	struct {
		CHAR_T	 name[MAX_CHARACTER_COLUMNS + 1];
		u_int8_t len;
	} cname[MAX_FAST_KEY + 1];	/* Fast lookup table. */

#define	KEY_VAL(sp, ch)							\
	((unsigned char)(ch) <= MAX_FAST_KEY ? 				\
	    sp->gp->special_key[(unsigned char)ch] :			\
	    (unsigned char)(ch) > sp->gp->max_special ? 0 : v_key_val(sp,ch))
	CHAR_T	 max_special;		/* Max special character. */
	u_char				/* Fast lookup table. */
	    special_key[MAX_FAST_KEY + 1];

/* Flags. */
#define	G_ABBREV	0x0001		/* If have abbreviations. */
#define	G_BELLSCHED	0x0002		/* Bell scheduled. */
#define	G_INTERRUPTED	0x0004		/* Interrupted. */
#define	G_RECOVER_SET	0x0008		/* Recover system initialized. */
#define	G_SCRIPTED	0x0010		/* Ex script session. */
#define	G_SCRWIN	0x0020		/* Scripting windows running. */
#define	G_SNAPSHOT	0x0040		/* Always snapshot files. */
#define	G_SRESTART	0x0080		/* Screen restarted. */
#define	G_TMP_INUSE	0x0100		/* Temporary buffer in use. */
	u_int32_t flags;

	/* Screen interface functions. */
					/* Add a string to the screen. */
	int	(*scr_addstr) __P((SCR *, const char *, size_t));
					/* Toggle a screen attribute. */
	int	(*scr_attr) __P((SCR *, scr_attr_t, int));
					/* Terminal baud rate. */
	int	(*scr_baud) __P((SCR *, u_long *));
					/* Beep/bell/flash the terminal. */
	int	(*scr_bell) __P((SCR *));
					/* Display a busy message. */
	void	(*scr_busy) __P((SCR *, const char *, busy_t));
					/* Clear to the end of the line. */
	int	(*scr_clrtoeol) __P((SCR *));
					/* Return the cursor location. */
	int	(*scr_cursor) __P((SCR *, size_t *, size_t *));
					/* Delete a line. */
	int	(*scr_deleteln) __P((SCR *));
					/* Get a keyboard event. */
	int	(*scr_event) __P((SCR *, EVENT *, u_int32_t, int));
					/* Ex: screen adjustment routine. */
	int	(*scr_ex_adjust) __P((SCR *, exadj_t));
	int	(*scr_fmap)		/* Set a function key. */
	    __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
					/* Get terminal key value. */
	int	(*scr_keyval) __P((SCR *, scr_keyval_t, CHAR_T *, int *));
					/* Insert a line. */
	int	(*scr_insertln) __P((SCR *));
					/* Handle an option change. */
	int	(*scr_optchange) __P((SCR *, int, char *, u_long *));
					/* Move the cursor. */
	int	(*scr_move) __P((SCR *, size_t, size_t));
					/* Message or ex output. */
	void	(*scr_msg) __P((SCR *, mtype_t, char *, size_t));
					/* Refresh the screen. */
	int	(*scr_refresh) __P((SCR *, int));
					/* Rename the file. */
	int	(*scr_rename) __P((SCR *, char *, int));
					/* Set the screen type. */
	int	(*scr_screen) __P((SCR *, u_int32_t));
					/* Suspend the editor. */
	int	(*scr_suspend) __P((SCR *, int *));
					/* Print usage message. */
	void	(*scr_usage) __P((void));
};

/*
 * XXX
 * Block signals if there are asynchronous events.  Used to keep DB system calls
 * from being interrupted and not restarted, as that will result in consistency
 * problems.  This should be handled by DB.
 */
#ifdef BLOCK_SIGNALS
#include <signal.h>
extern sigset_t	__sigblockset;
#define	SIGBLOCK \
	(void)sigprocmask(SIG_BLOCK, &__sigblockset, NULL)
#define	SIGUNBLOCK \
	(void)sigprocmask(SIG_UNBLOCK, &__sigblockset, NULL);
#else
#define	SIGBLOCK
#define	SIGUNBLOCK
#endif
@


1.4
log
@merge changes after import of nvi 1.79
@
text
@d1 1
a1 1
/*	$NetBSD: gs.h,v 1.3 2000/05/31 19:49:25 jdc Exp $	*/
@


1.3
log
@Handle xterm's alternate screen when entering or leaving ex mode, e.g.
":!ls", so that the screen is not changed before the "Press any key"
message.  Taken from v1.79.
@
text
@d1 1
a1 1
/*	$NetBSD: gs.h,v 1.2 1998/01/09 08:06:39 perry Exp $	*/
d11 1
a11 1
 *	@@(#)gs.h	10.29 (Berkeley) 4/15/96
d43 1
a43 1
/* Action argument to scr_exadjust(). */
d46 1
a46 1
/* Screen attribute argument to scr_attr(). */
d49 1
a49 1
/* Key type argument to scr_keyval(). */
d51 1
a51 1
 
d70 1
a71 1
	void	*xaw_private;		/* XAW support private area. */
d87 1
a87 1
	char	*tmp_bp;		/* Temporary buffer. */
d144 4
a147 4
#define	G_SCRIPT	0x0010		/* Scripting windows running. */
#define	G_SNAPSHOT	0x0020		/* Always snapshot files. */
#define	G_SRESTART	0x0040		/* Screen restarted. */
#define	G_STDIN_TTY	0x0080		/* Standard input is a tty. */
d161 1
a161 1
	void	(*scr_busy) __P((SCR *, char const *, busy_t));
d187 1
a187 1
	int	(*scr_rename) __P((SCR *));
@


1.2
log
@RCS Id Police.
@
text
@d1 1
a1 1
/*	$NetBSD$	*/
d47 1
a47 1
typedef enum { SA_INVERSE } scr_attr_t;
@


1.2.8.1
log
@Sync w/ netbsd-1-5-base.
@
text
@d1 1
a1 1
/*	$NetBSD: gs.h,v 1.3 2000/05/31 19:49:25 jdc Exp $	*/
d47 1
a47 1
typedef enum { SA_ALTERNATE, SA_INVERSE } scr_attr_t;
@


1.1
log
@Initial revision
@
text
@d1 2
d6 2
d9 1
a9 15
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
d11 8
a18 11
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
d20 2
a21 1
 *	@@(#)gs.h	8.39 (Berkeley) 7/23/94
d23 25
d49 8
d58 3
d64 17
a80 3
	mode_t	 origmode;		/* Original terminal mode. */
	struct termios
		 original_termios;	/* Original terminal values. */
d82 1
d84 2
d88 1
a88 1
	size_t	 tmp_blen;		/* Size of temporary buffer. */
d90 11
a100 1
	sigset_t blockset;		/* Signal mask. */
d106 4
a109 2
/* INFORMATION SHARED BY ALL SCREENS. */
	IBUF	*tty;			/* Key input buffer. */
d121 2
a122 2
	((ch) <= MAX_FAST_KEY ?						\
	    sp->gp->cname[ch].len : __key_len(sp, ch))
d124 2
a125 2
	((ch) <= MAX_FAST_KEY ?						\
	    sp->gp->cname[ch].name : __key_name(sp, ch))
d132 3
a134 2
	((ch) <= MAX_FAST_KEY ? sp->gp->special_key[ch] :		\
	    (ch) > sp->gp->max_special ? 0 : __key_val(sp, ch))
d139 1
a139 8
/* Interrupt macros. */
#define	INTERRUPTED(sp)							\
	(F_ISSET((sp), S_INTERRUPTED) || F_ISSET((sp)->gp, G_SIGINT))
#define	CLR_INTERRUPT(sp) {						\
	F_CLR((sp), S_INTERRUPTED | S_INTERRUPTIBLE);			\
	F_CLR((sp)->gp, G_SIGINT);					\
}

d142 52
a193 10
#define	G_RECOVER_SET	0x0004		/* Recover system initialized. */
#define	G_SETMODE	0x0008		/* Tty mode changed. */
#define	G_SIGALRM	0x0010		/* SIGALRM arrived. */
#define	G_SIGINT	0x0020		/* SIGINT arrived. */
#define	G_SIGWINCH	0x0040		/* SIGWINCH arrived. */
#define	G_SNAPSHOT	0x0080		/* Always snapshot files. */
#define	G_STDIN_TTY	0x0100		/* Standard input is a tty. */
#define	G_TERMIOS_SET	0x0200		/* Termios structure is valid. */
#define	G_TMP_INUSE	0x0400		/* Temporary buffer in use. */
	u_int16_t flags;
d196 17
a212 1
extern GS *__global_list;		/* List of screens. */
@


1.1.1.1
log
@new public version of nvi
@
text
@@


1.1.1.1.2.1
log
@file gs.h was added on branch netbsd-1-0 on 1994-08-17 16:19:05 +0000
@
text
@d1 107
@


1.1.1.1.2.2
log
@new public version of nvi
@
text
@a0 107
/*-
 * Copyright (c) 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	@@(#)gs.h	8.39 (Berkeley) 7/23/94
 */

struct _gs {
	CIRCLEQ_HEAD(_dqh, _scr) dq;	/* Displayed screens. */
	CIRCLEQ_HEAD(_hqh, _scr) hq;	/* Hidden screens. */

	mode_t	 origmode;		/* Original terminal mode. */
	struct termios
		 original_termios;	/* Original terminal values. */

	MSGH	 msgq;			/* User message list. */

	char	*tmp_bp;		/* Temporary buffer. */
	size_t	 tmp_blen;		/* Size of temporary buffer. */

	sigset_t blockset;		/* Signal mask. */

#ifdef DEBUG
	FILE	*tracefp;		/* Trace file pointer. */
#endif

/* INFORMATION SHARED BY ALL SCREENS. */
	IBUF	*tty;			/* Key input buffer. */

	CB	*dcbp;			/* Default cut buffer pointer. */
	CB	 dcb_store;		/* Default cut buffer storage. */
	LIST_HEAD(_cuth, _cb) cutq;	/* Linked list of cut buffers. */

#define	MAX_BIT_SEQ	128		/* Max + 1 fast check character. */
	LIST_HEAD(_seqh, _seq) seqq;	/* Linked list of maps, abbrevs. */
	bitstr_t bit_decl(seqb, MAX_BIT_SEQ);

#define	MAX_FAST_KEY	254		/* Max fast check character.*/
#define	KEY_LEN(sp, ch)							\
	((ch) <= MAX_FAST_KEY ?						\
	    sp->gp->cname[ch].len : __key_len(sp, ch))
#define	KEY_NAME(sp, ch)						\
	((ch) <= MAX_FAST_KEY ?						\
	    sp->gp->cname[ch].name : __key_name(sp, ch))
	struct {
		CHAR_T	 name[MAX_CHARACTER_COLUMNS + 1];
		u_int8_t len;
	} cname[MAX_FAST_KEY + 1];	/* Fast lookup table. */

#define	KEY_VAL(sp, ch)							\
	((ch) <= MAX_FAST_KEY ? sp->gp->special_key[ch] :		\
	    (ch) > sp->gp->max_special ? 0 : __key_val(sp, ch))
	CHAR_T	 max_special;		/* Max special character. */
	u_char				/* Fast lookup table. */
	    special_key[MAX_FAST_KEY + 1];

/* Interrupt macros. */
#define	INTERRUPTED(sp)							\
	(F_ISSET((sp), S_INTERRUPTED) || F_ISSET((sp)->gp, G_SIGINT))
#define	CLR_INTERRUPT(sp) {						\
	F_CLR((sp), S_INTERRUPTED | S_INTERRUPTIBLE);			\
	F_CLR((sp)->gp, G_SIGINT);					\
}

#define	G_ABBREV	0x0001		/* If have abbreviations. */
#define	G_BELLSCHED	0x0002		/* Bell scheduled. */
#define	G_RECOVER_SET	0x0004		/* Recover system initialized. */
#define	G_SETMODE	0x0008		/* Tty mode changed. */
#define	G_SIGALRM	0x0010		/* SIGALRM arrived. */
#define	G_SIGINT	0x0020		/* SIGINT arrived. */
#define	G_SIGWINCH	0x0040		/* SIGWINCH arrived. */
#define	G_SNAPSHOT	0x0080		/* Always snapshot files. */
#define	G_STDIN_TTY	0x0100		/* Standard input is a tty. */
#define	G_TERMIOS_SET	0x0200		/* Termios structure is valid. */
#define	G_TMP_INUSE	0x0400		/* Temporary buffer in use. */
	u_int16_t flags;
};

extern GS *__global_list;		/* List of screens. */
@


1.1.1.2
log
@import of nvi 1.66
@
text
@a3 2
 * Copyright (c) 1993, 1994, 1995, 1996
 *	Keith Bostic.  All rights reserved.
d5 15
a19 1
 * See the LICENSE file for redistribution information.
d21 11
a31 8
 *	@@(#)gs.h	10.29 (Berkeley) 4/15/96
 */

#define	TEMPORARY_FILE_STRING	"/tmp"	/* Default temporary file name. */

/*
 * File reference structure (FREF).  The structure contains the name of the
 * file, along with the information that follows the name.
d33 1
a33 2
 * !!!
 * The read-only bit follows the file name, not the file itself.
a34 19
struct _fref {
	CIRCLEQ_ENTRY(_fref) q;		/* Linked list of file references. */
	char	*name;			/* File name. */
	char	*tname;			/* Backing temporary file name. */

	recno_t	 lno;			/* 1-N: file cursor line. */
	size_t	 cno;			/* 0-N: file cursor column. */

#define	FR_CURSORSET	0x0001		/* If lno/cno values valid. */
#define	FR_DONTDELETE	0x0002		/* Don't delete the temporary file. */
#define	FR_EXNAMED	0x0004		/* Read/write renamed the file. */
#define	FR_NAMECHANGE	0x0008		/* If the name changed. */
#define	FR_NEWFILE	0x0010		/* File doesn't really exist yet. */
#define	FR_RECOVER	0x0020		/* File is being recovered. */
#define	FR_TMPEXIT	0x0040		/* Modified temporary file, no exit. */
#define	FR_TMPFILE	0x0080		/* If file has no name. */
#define	FR_UNLOCKED	0x0100		/* File couldn't be locked. */
	u_int16_t flags;
};
a35 14
/* Action argument to scr_exadjust(). */
typedef enum { EX_TERM_CE, EX_TERM_SCROLL } exadj_t;

/* Screen attribute argument to scr_attr(). */
typedef enum { SA_INVERSE } scr_attr_t;

/* Key type argument to scr_keyval(). */
typedef enum { KEY_VEOF, KEY_VERASE, KEY_VKILL, KEY_VWERASE } scr_keyval_t;
 
/*
 * GS:
 *
 * Structure that describes global state of the running program.
 */
a36 3
	char	*progname;		/* Programe name. */

	int	 id;			/* Last allocated screen id. */
d40 3
a42 1
	SCR	*ccl_sp;		/* Colon command-line screen. */
a43 17
	void	*perl_interp;		/* Perl interpreter. */
	void	*tcl_interp;		/* Tcl_Interp *: Tcl interpreter. */

	void	*cl_private;		/* Curses support private area. */
	void	*tk_private;		/* Tk/Tcl support private area. */
	void	*xaw_private;		/* XAW support private area. */

					/* File references. */
	CIRCLEQ_HEAD(_frefh, _fref) frefq;

#define	GO_COLUMNS	0		/* Global options: columns. */
#define	GO_LINES	1		/* Global options: lines. */
#define	GO_SECURE	2		/* Global options: secure. */
#define	GO_TERM		3		/* Global options: terminal type. */
	OPTION	 opts[GO_TERM + 1];

	DB	*msg;			/* Message catalog DB. */
a44 2
#define	DEFAULT_NOPRINT	'\1'		/* Emergency non-printable character. */
	CHAR_T	 noprint;		/* Cached, unprintable character. */
d47 1
a47 11
	size_t	 tmp_blen;		/* Temporary buffer size. */

	/*
	 * Ex command structures (EXCMD).  Defined here because ex commands
	 * exist outside of any particular screen or file.
	 */
#define	EXCMD_RUNNING(gp)	((gp)->ecq.lh_first->clen != 0)
	LIST_HEAD(_excmdh, _excmd) ecq;	/* Ex command linked list. */
	EXCMD	 excmd;			/* Default ex command structure. */
	char	 *if_name;		/* Current associated file. */
	recno_t	  if_lno;		/* Current associated line number. */
d49 1
a49 1
	char	*c_option;		/* Ex initial, command-line command. */
d55 2
a56 4
	EVENT	*i_event;		/* Array of input events. */
	size_t	 i_nelem;		/* Number of array elements. */
	size_t	 i_cnt;			/* Count of events. */
	size_t	 i_next;		/* Offset of next event. */
d68 2
a69 2
	((unsigned char)(ch) <= MAX_FAST_KEY ?				\
	    sp->gp->cname[(unsigned char)ch].len : v_key_len(sp, ch))
d71 2
a72 2
	((unsigned char)(ch) <= MAX_FAST_KEY ?				\
	    sp->gp->cname[(unsigned char)ch].name : v_key_name(sp, ch))
d79 2
a80 3
	((unsigned char)(ch) <= MAX_FAST_KEY ? 				\
	    sp->gp->special_key[(unsigned char)ch] :			\
	    (unsigned char)(ch) > sp->gp->max_special ? 0 : v_key_val(sp,ch))
d85 8
a92 1
/* Flags. */
d95 10
a104 52
#define	G_INTERRUPTED	0x0004		/* Interrupted. */
#define	G_RECOVER_SET	0x0008		/* Recover system initialized. */
#define	G_SCRIPT	0x0010		/* Scripting windows running. */
#define	G_SNAPSHOT	0x0020		/* Always snapshot files. */
#define	G_SRESTART	0x0040		/* Screen restarted. */
#define	G_STDIN_TTY	0x0080		/* Standard input is a tty. */
#define	G_TMP_INUSE	0x0100		/* Temporary buffer in use. */
	u_int32_t flags;

	/* Screen interface functions. */
					/* Add a string to the screen. */
	int	(*scr_addstr) __P((SCR *, const char *, size_t));
					/* Toggle a screen attribute. */
	int	(*scr_attr) __P((SCR *, scr_attr_t, int));
					/* Terminal baud rate. */
	int	(*scr_baud) __P((SCR *, u_long *));
					/* Beep/bell/flash the terminal. */
	int	(*scr_bell) __P((SCR *));
					/* Display a busy message. */
	void	(*scr_busy) __P((SCR *, char const *, busy_t));
					/* Clear to the end of the line. */
	int	(*scr_clrtoeol) __P((SCR *));
					/* Return the cursor location. */
	int	(*scr_cursor) __P((SCR *, size_t *, size_t *));
					/* Delete a line. */
	int	(*scr_deleteln) __P((SCR *));
					/* Get a keyboard event. */
	int	(*scr_event) __P((SCR *, EVENT *, u_int32_t, int));
					/* Ex: screen adjustment routine. */
	int	(*scr_ex_adjust) __P((SCR *, exadj_t));
	int	(*scr_fmap)		/* Set a function key. */
	    __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
					/* Get terminal key value. */
	int	(*scr_keyval) __P((SCR *, scr_keyval_t, CHAR_T *, int *));
					/* Insert a line. */
	int	(*scr_insertln) __P((SCR *));
					/* Handle an option change. */
	int	(*scr_optchange) __P((SCR *, int, char *, u_long *));
					/* Move the cursor. */
	int	(*scr_move) __P((SCR *, size_t, size_t));
					/* Message or ex output. */
	void	(*scr_msg) __P((SCR *, mtype_t, char *, size_t));
					/* Refresh the screen. */
	int	(*scr_refresh) __P((SCR *, int));
					/* Rename the file. */
	int	(*scr_rename) __P((SCR *));
					/* Set the screen type. */
	int	(*scr_screen) __P((SCR *, u_int32_t));
					/* Suspend the editor. */
	int	(*scr_suspend) __P((SCR *, int *));
					/* Print usage message. */
	void	(*scr_usage) __P((void));
d107 1
a107 17
/*
 * XXX
 * Block signals if there are asynchronous events.  Used to keep DB system calls
 * from being interrupted and not restarted, as that will result in consistency
 * problems.  This should be handled by DB.
 */
#ifdef BLOCK_SIGNALS
#include <signal.h>
extern sigset_t	__sigblockset;
#define	SIGBLOCK \
	(void)sigprocmask(SIG_BLOCK, &__sigblockset, NULL)
#define	SIGUNBLOCK \
	(void)sigprocmask(SIG_UNBLOCK, &__sigblockset, NULL);
#else
#define	SIGBLOCK
#define	SIGUNBLOCK
#endif
@


1.1.1.3
log
@import of nvi 1.79
@
text
@d9 1
a9 1
 *	@@(#)gs.h	10.34 (Berkeley) 9/24/96
d41 1
a41 1
/* Action arguments to scr_exadjust(). */
d44 2
a45 2
/* Screen attribute arguments to scr_attr(). */
typedef enum { SA_ALTERNATE, SA_INVERSE } scr_attr_t;
d47 1
a47 1
/* Key type arguments to scr_keyval(). */
d49 1
a49 1

a67 1
	void	*ip_private;		/* IP support private area. */
d69 1
d142 4
a145 4
#define	G_SCRIPTED	0x0010		/* Ex script session. */
#define	G_SCRWIN	0x0020		/* Scripting windows running. */
#define	G_SNAPSHOT	0x0040		/* Always snapshot files. */
#define	G_SRESTART	0x0080		/* Screen restarted. */
d159 1
a159 1
	void	(*scr_busy) __P((SCR *, const char *, busy_t));
d185 1
a185 1
	int	(*scr_rename) __P((SCR *, char *, int));
@

