add S_RENUMBER support so when a new line is entered all the line
[nvi.git] / common / seq.h
blobf54f04b91e1a83e510e6dd83f9c3723ecee7d6c5
1 /*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
7 * $Id: seq.h,v 8.5 1993/11/18 08:17:21 bostic Exp $ (Berkeley) $Date: 1993/11/18 08:17:21 $
8 */
11 * Map and abbreviation structures.
13 * The map structure is doubly 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.
20 * XXX
21 * The fast-lookup bits are never turned off -- users don't usually unmap
22 * things, though, so it's probably not a big deal.
24 /* Sequence type. */
25 enum seqtype { SEQ_ABBREV, SEQ_COMMAND, SEQ_INPUT };
27 struct _seq {
28 LIST_ENTRY(_seq) q; /* Linked list of all sequences. */
29 enum seqtype stype; /* Sequence type. */
30 char *name; /* Name of the sequence, if any. */
31 char *input; /* Input key sequence. */
32 size_t ilen; /* Input key sequence length. */
33 char *output; /* Output key sequence. */
34 size_t olen; /* Output key sequence length. */
36 #define S_USERDEF 0x01 /* If sequence user defined. */
37 u_char flags;
40 int abbr_save __P((SCR *, FILE *));
41 int map_save __P((SCR *, FILE *));
42 int seq_delete __P((SCR *, char *, enum seqtype));
43 int seq_dump __P((SCR *, enum seqtype, int));
44 SEQ *seq_find __P((SCR *, char *, size_t, enum seqtype, int *));
45 void seq_init __P((SCR *));
46 int seq_save __P((SCR *, FILE *, char *, enum seqtype));
47 int seq_set __P((SCR *, char *, char *, char *, enum seqtype, int));