f622d2dee0d99c63e60f09d8dcae4a702f4f7833
[strongswan.git] / src / stroke / stroke_keywords.c
1 /* C code produced by gperf version 3.0.1 */
2 /* Command-line: /usr/bin/gperf -C -G -t */
3 /* Computed positions: -k'2' */
4
5 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 /* The character set is not based on ISO-646. */
29 error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
30 #endif
31
32
33 /* stroke keywords
34 * Copyright (C) 2006 Andreas Steffen
35 * Hochschule fuer Technik Rapperswil, Switzerland
36 *
37 * This program is free software; you can redistribute it and/or modify it
38 * under the terms of the GNU General Public License as published by the
39 * Free Software Foundation; either version 2 of the License, or (at your
40 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
41 *
42 * This program is distributed in the hope that it will be useful, but
43 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
44 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
45 * for more details.
46 *
47 * RCSID $Id: keywords.txt,v 1.6 2006/04/17 10:30:27 as Exp $
48 */
49
50 #include <string.h>
51
52 #include "stroke_keywords.h"
53
54 struct stroke_token {
55 char *name;
56 stroke_keyword_t kw;
57 };
58
59 #define TOTAL_KEYWORDS 17
60 #define MIN_WORD_LENGTH 2
61 #define MAX_WORD_LENGTH 13
62 #define MIN_HASH_VALUE 2
63 #define MAX_HASH_VALUE 23
64 /* maximum key range = 22, duplicates = 0 */
65
66 #ifdef __GNUC__
67 __inline
68 #else
69 #ifdef __cplusplus
70 inline
71 #endif
72 #endif
73 static unsigned int
74 hash (str, len)
75 register const char *str;
76 register unsigned int len;
77 {
78 static const unsigned char asso_values[] =
79 {
80 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
81 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
82 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
83 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
84 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
85 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
86 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
87 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
88 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
89 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
90 20, 0, 24, 24, 24, 10, 24, 24, 24, 24,
91 24, 0, 0, 24, 24, 24, 5, 24, 24, 24,
92 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
93 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
94 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
95 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
96 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
97 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
98 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
99 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
100 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
101 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
102 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
103 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
104 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
105 24, 24, 24, 24, 24, 24
106 };
107 return len + asso_values[(unsigned char)str[1]];
108 }
109
110 static const struct stroke_token wordlist[] =
111 {
112 {""}, {""},
113 {"up", STROKE_UP},
114 {"del", STROKE_DEL},
115 {"down", STROKE_DOWN},
116 {"route", STROKE_ROUTE},
117 {"delete", STROKE_DELETE},
118 {"logtype", STROKE_LOGTYPE},
119 {"loglevel", STROKE_LOGLEVEL},
120 {"rereadall", STROKE_REREAD_ALL},
121 {"rereadcrls", STROKE_REREAD_CRLS,},
122 {"status", STROKE_STATUS},
123 {""},
124 {"rereadcacerts", STROKE_REREAD_CACERTS,},
125 {"statusall", STROKE_STATUSALL},
126 {""}, {""},
127 {"listall", STROKE_LIST_ALL,},
128 {"listcrls", STROKE_LIST_CRLS},
129 {"listcerts", STROKE_LIST_CERTS},
130 {""},
131 {"listcacerts", STROKE_LIST_CACERTS},
132 {""},
133 {"add", STROKE_ADD}
134 };
135
136 #ifdef __GNUC__
137 __inline
138 #endif
139 const struct stroke_token *
140 in_word_set (str, len)
141 register const char *str;
142 register unsigned int len;
143 {
144 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
145 {
146 register int key = hash (str, len);
147
148 if (key <= MAX_HASH_VALUE && key >= 0)
149 {
150 register const char *s = wordlist[key].name;
151
152 if (*str == *s && !strcmp (str + 1, s + 1))
153 return &wordlist[key];
154 }
155 }
156 return 0;
157 }