xref: /freebsd/contrib/nvi/common/seq.h (revision dc318a4ffabcbfa23bb56a33403aad36e6de30af)
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 
10 /*
11  * Map and abbreviation structures.
12  *
13  * The map structure is singly linked list, sorted by input string and by
14  * input length within the string.  (The latter is necessary so that short
15  * matches will happen before long matches when the list is searched.)
16  * Additionally, there is a bitmap which has bits set if there are entries
17  * starting with the corresponding character.  This keeps us from walking
18  * the list unless it's necessary.
19  *
20  * The name and the output fields of a SEQ can be empty, i.e. NULL.
21  * Only the input field is required.
22  *
23  * XXX
24  * The fast-lookup bits are never turned off -- users don't usually unmap
25  * things, though, so it's probably not a big deal.
26  */
27 struct _seq {
28 	SLIST_ENTRY(_seq) q;		/* Linked list of all sequences. */
29 	seq_t	 stype;			/* Sequence type. */
30 	CHAR_T	*name;			/* Sequence name (if any). */
31 	size_t	 nlen;			/* Name length. */
32 	CHAR_T	*input;			/* Sequence input keys. */
33 	size_t	 ilen;			/* Input keys length. */
34 	CHAR_T	*output;		/* Sequence output keys. */
35 	size_t	 olen;			/* Output keys length. */
36 
37 #define	SEQ_FUNCMAP	0x01		/* If unresolved function key.*/
38 #define	SEQ_NOOVERWRITE	0x02		/* Don't replace existing entry. */
39 #define	SEQ_SCREEN	0x04		/* If screen specific. */
40 #define	SEQ_USERDEF	0x08		/* If user defined. */
41 	u_int8_t flags;
42 };
43