119304Speter/*-
219304Speter * Copyright (c) 1992, 1993, 1994
319304Speter *	The Regents of the University of California.  All rights reserved.
419304Speter * Copyright (c) 1992, 1993, 1994, 1995, 1996
519304Speter *	Keith Bostic.  All rights reserved.
619304Speter *
719304Speter * See the LICENSE file for redistribution information.
819304Speter *
9254225Speter *	$Id: seq.h,v 10.4 2011/12/11 21:43:39 zy Exp $
1019304Speter */
1119304Speter
1219304Speter/*
1319304Speter * Map and abbreviation structures.
1419304Speter *
15254225Speter * The map structure is singly linked list, sorted by input string and by
1619304Speter * input length within the string.  (The latter is necessary so that short
1719304Speter * matches will happen before long matches when the list is searched.)
1819304Speter * Additionally, there is a bitmap which has bits set if there are entries
1919304Speter * starting with the corresponding character.  This keeps us from walking
2019304Speter * the list unless it's necessary.
2119304Speter *
2219304Speter * The name and the output fields of a SEQ can be empty, i.e. NULL.
2319304Speter * Only the input field is required.
2419304Speter *
2519304Speter * XXX
2619304Speter * The fast-lookup bits are never turned off -- users don't usually unmap
2719304Speter * things, though, so it's probably not a big deal.
2819304Speter */
2919304Speterstruct _seq {
30254225Speter	SLIST_ENTRY(_seq) q;		/* Linked list of all sequences. */
3119304Speter	seq_t	 stype;			/* Sequence type. */
3219304Speter	CHAR_T	*name;			/* Sequence name (if any). */
3319304Speter	size_t	 nlen;			/* Name length. */
3419304Speter	CHAR_T	*input;			/* Sequence input keys. */
3519304Speter	size_t	 ilen;			/* Input keys length. */
3619304Speter	CHAR_T	*output;		/* Sequence output keys. */
3719304Speter	size_t	 olen;			/* Output keys length. */
3819304Speter
3919304Speter#define	SEQ_FUNCMAP	0x01		/* If unresolved function key.*/
4019304Speter#define	SEQ_NOOVERWRITE	0x02		/* Don't replace existing entry. */
4119304Speter#define	SEQ_SCREEN	0x04		/* If screen specific. */
4219304Speter#define	SEQ_USERDEF	0x08		/* If user defined. */
4319304Speter	u_int8_t flags;
4419304Speter};
45