xref: /minix3/external/bsd/nvi/dist/common/seq.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /*	$NetBSD: seq.h,v 1.2 2013/11/22 15:52:05 christos Exp $	*/
2*84d9c625SLionel Sambuc /*-
3*84d9c625SLionel Sambuc  * Copyright (c) 1992, 1993, 1994
4*84d9c625SLionel Sambuc  *	The Regents of the University of California.  All rights reserved.
5*84d9c625SLionel Sambuc  * Copyright (c) 1992, 1993, 1994, 1995, 1996
6*84d9c625SLionel Sambuc  *	Keith Bostic.  All rights reserved.
7*84d9c625SLionel Sambuc  *
8*84d9c625SLionel Sambuc  * See the LICENSE file for redistribution information.
9*84d9c625SLionel Sambuc  *
10*84d9c625SLionel Sambuc  *	Id: seq.h,v 10.3 1996/03/06 19:51:03 bostic Exp  (Berkeley) Date: 1996/03/06 19:51:03
11*84d9c625SLionel Sambuc  */
12*84d9c625SLionel Sambuc 
13*84d9c625SLionel Sambuc /*
14*84d9c625SLionel Sambuc  * Map and abbreviation structures.
15*84d9c625SLionel Sambuc  *
16*84d9c625SLionel Sambuc  * The map structure is doubly linked list, sorted by input string and by
17*84d9c625SLionel Sambuc  * input length within the string.  (The latter is necessary so that short
18*84d9c625SLionel Sambuc  * matches will happen before long matches when the list is searched.)
19*84d9c625SLionel Sambuc  * Additionally, there is a bitmap which has bits set if there are entries
20*84d9c625SLionel Sambuc  * starting with the corresponding character.  This keeps us from walking
21*84d9c625SLionel Sambuc  * the list unless it's necessary.
22*84d9c625SLionel Sambuc  *
23*84d9c625SLionel Sambuc  * The name and the output fields of a SEQ can be empty, i.e. NULL.
24*84d9c625SLionel Sambuc  * Only the input field is required.
25*84d9c625SLionel Sambuc  *
26*84d9c625SLionel Sambuc  * XXX
27*84d9c625SLionel Sambuc  * The fast-lookup bits are never turned off -- users don't usually unmap
28*84d9c625SLionel Sambuc  * things, though, so it's probably not a big deal.
29*84d9c625SLionel Sambuc  */
30*84d9c625SLionel Sambuc struct _seq {
31*84d9c625SLionel Sambuc 	LIST_ENTRY(_seq) q;		/* Linked list of all sequences. */
32*84d9c625SLionel Sambuc 	seq_t	 stype;			/* Sequence type. */
33*84d9c625SLionel Sambuc 	CHAR_T	*name;			/* Sequence name (if any). */
34*84d9c625SLionel Sambuc 	size_t	 nlen;			/* Name length. */
35*84d9c625SLionel Sambuc 	CHAR_T	*input;			/* Sequence input keys. */
36*84d9c625SLionel Sambuc 	size_t	 ilen;			/* Input keys length. */
37*84d9c625SLionel Sambuc 	CHAR_T	*output;		/* Sequence output keys. */
38*84d9c625SLionel Sambuc 	size_t	 olen;			/* Output keys length. */
39*84d9c625SLionel Sambuc 
40*84d9c625SLionel Sambuc #define	SEQ_FUNCMAP	0x01		/* If unresolved function key.*/
41*84d9c625SLionel Sambuc #define	SEQ_NOOVERWRITE	0x02		/* Don't replace existing entry. */
42*84d9c625SLionel Sambuc #define	SEQ_SCREEN	0x04		/* If screen specific. */
43*84d9c625SLionel Sambuc #define	SEQ_USERDEF	0x08		/* If user defined. */
44*84d9c625SLionel Sambuc 	u_int8_t flags;
45*84d9c625SLionel Sambuc };
46