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