fixed logleve(l) keyword typo
[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 14
60 #define MIN_WORD_LENGTH 2
61 #define MAX_WORD_LENGTH 11
62 #define MIN_HASH_VALUE 2
63 #define MAX_HASH_VALUE 21
64 /* maximum key range = 20, 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 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
81 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
82 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
83 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
84 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
85 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
86 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
87 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
88 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
89 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
90 0, 15, 22, 22, 22, 5, 22, 22, 22, 22,
91 22, 0, 0, 22, 22, 22, 0, 22, 22, 22,
92 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
93 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
94 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
95 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
96 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
97 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
98 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
99 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
100 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
101 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
102 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
103 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
104 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
105 22, 22, 22, 22, 22, 22
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 {"add", STROKE_ADD},
115 {"down", STROKE_DOWN},
116 {"route", STROKE_ROUTE},
117 {"status", STROKE_STATUS},
118 {"logtype", STROKE_LOGTYPE},
119 {"loglevel", STROKE_LOGLEVEL},
120 {"statusall", STROKE_STATUSALL},
121 {""}, {""},
122 {"listall", STROKE_LIST_ALL},
123 {"listcrls", STROKE_LIST_CRLS},
124 {"listcerts", STROKE_LIST_CERTS},
125 {""},
126 {"listcacerts", STROKE_LIST_CACERTS},
127 {""},
128 {"del", STROKE_DEL},
129 {""}, {""},
130 {"delete", STROKE_DELETE}
131 };
132
133 #ifdef __GNUC__
134 __inline
135 #endif
136 const struct stroke_token *
137 in_word_set (str, len)
138 register const char *str;
139 register unsigned int len;
140 {
141 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
142 {
143 register int key = hash (str, len);
144
145 if (key <= MAX_HASH_VALUE && key >= 0)
146 {
147 register const char *s = wordlist[key].name;
148
149 if (*str == *s && !strcmp (str + 1, s + 1))
150 return &wordlist[key];
151 }
152 }
153 return 0;
154 }