Commit | Line | Data |
---|---|---|
1e64b3ba JH |
1 | /*- |
2 | * Copyright (c) 1992, 1993 | |
3 | * The Regents of the University of California. All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * 3. All advertising materials mentioning features or use of this software | |
14 | * must display the following acknowledgement: | |
15 | * This product includes software developed by the University of | |
16 | * California, Berkeley and its contributors. | |
17 | * 4. Neither the name of the University nor the names of its contributors | |
18 | * may be used to endorse or promote products derived from this software | |
19 | * without specific prior written permission. | |
20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | * SUCH DAMAGE. | |
32 | * | |
33 | * @(#)seq.h 8.7 (Berkeley) 12/2/93 | |
34 | */ | |
35 | ||
36 | /* | |
37 | * Map and abbreviation structures. | |
38 | * | |
39 | * The map structure is doubly linked list, sorted by input string and by | |
40 | * input length within the string. (The latter is necessary so that short | |
41 | * matches will happen before long matches when the list is searched.) | |
42 | * Additionally, there is a bitmap which has bits set if there are entries | |
43 | * starting with the corresponding character. This keeps us from walking | |
44 | * the list unless it's necessary. | |
45 | * | |
46 | * XXX | |
47 | * The fast-lookup bits are never turned off -- users don't usually unmap | |
48 | * things, though, so it's probably not a big deal. | |
49 | */ | |
50 | /* Sequence type. */ | |
51 | enum seqtype { SEQ_ABBREV, SEQ_COMMAND, SEQ_INPUT }; | |
52 | ||
53 | struct _seq { | |
54 | LIST_ENTRY(_seq) q; /* Linked list of all sequences. */ | |
55 | enum seqtype stype; /* Sequence type. */ | |
56 | char *name; /* Sequence name (if any). */ | |
57 | size_t nlen; /* Name length. */ | |
58 | char *input; /* Sequence input keys. */ | |
59 | size_t ilen; /* Input keys length. */ | |
60 | char *output; /* Sequence output keys. */ | |
61 | size_t olen; /* Output keys length. */ | |
62 | ||
63 | #define S_USERDEF 0x01 /* If sequence user defined. */ | |
64 | u_char flags; | |
65 | }; | |
66 | ||
67 | int abbr_save __P((SCR *, FILE *)); | |
68 | int map_save __P((SCR *, FILE *)); | |
69 | int seq_delete __P((SCR *, char *, size_t, enum seqtype)); | |
70 | int seq_dump __P((SCR *, enum seqtype, int)); | |
71 | SEQ *seq_find __P((SCR *, SEQ **, char *, size_t, enum seqtype, int *)); | |
72 | void seq_init __P((SCR *)); | |
73 | int seq_save __P((SCR *, FILE *, char *, enum seqtype)); | |
74 | int seq_set __P((SCR *, char *, size_t, | |
75 | char *, size_t, char *, size_t, enum seqtype, int)); |