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