~ubuntu-branches/ubuntu/raring/clamav/raring

« back to all changes in this revision

Viewing changes to libclamav/jsparse/generated/operators.h

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran
  • Date: 2008-09-05 17:25:34 UTC
  • mfrom: (0.35.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080905172534-yi3f8fkye1o7u1r3
* New upstream version (closes: #497662, #497773)
  - lots of new options for clamd.conf
  - fixes CVEs CVE-2008-3912, CVE-2008-3913, CVE-2008-3914, and
    CVE-2008-1389
* No longer supports --unzip option, so typo is gone (closes: #496276)
* Translations:
  - sv (thanks Martin Bagge <brother@bsnet.se>) (closes: #491760)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ANSI-C code produced by gperf version 3.0.3 */
 
2
/* Command-line: gperf -E -t -L ANSI-C -C -F ', TOK_ERROR' -c -H op_hash -N in_op_set -W oplist ../../../../trunk/libclamav/jsparse/operators.gperf  */
 
3
/* Computed positions: -k'1,$' */
 
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
struct operator {
 
33
        const char *name;
 
34
        int val;
 
35
};
 
36
/* maximum key range = 121, duplicates = 0 */
 
37
 
 
38
#ifdef __GNUC__
 
39
__inline
 
40
#else
 
41
#ifdef __cplusplus
 
42
inline
 
43
#endif
 
44
#endif
 
45
static unsigned int
 
46
op_hash (const char *str, unsigned int len)
 
47
{
 
48
  static const unsigned char asso_values[] =
 
49
    {
 
50
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
51
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
52
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
53
      122, 122, 122,  50, 122, 122, 122,  31,  40, 122,
 
54
      122, 122,  21,  30, 122,  25, 122,  16, 122, 122,
 
55
      122, 122, 122, 122, 122, 122, 122, 122,  45, 122,
 
56
       10,   5,   0,  35, 122, 122, 122, 122, 122, 122,
 
57
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
58
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
59
      122, 122, 122, 122,  60, 122, 122, 122, 122, 122,
 
60
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
61
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
62
      122, 122, 122, 122,  20, 122,  15, 122, 122, 122,
 
63
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
64
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
65
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
66
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
67
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
68
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
69
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
70
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
71
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
72
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
73
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
74
      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
 
75
      122, 122, 122, 122, 122, 122
 
76
    };
 
77
  return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
 
78
}
 
79
 
 
80
#ifdef __GNUC__
 
81
__inline
 
82
#ifdef __GNUC_STDC_INLINE__
 
83
__attribute__ ((__gnu_inline__))
 
84
#endif
 
85
#endif
 
86
static const struct operator *
 
87
in_op_set (const char *str, unsigned int len)
 
88
{
 
89
  enum
 
90
    {
 
91
      TOTAL_KEYWORDS = 39,
 
92
      MIN_WORD_LENGTH = 1,
 
93
      MAX_WORD_LENGTH = 4,
 
94
      MIN_HASH_VALUE = 1,
 
95
      MAX_HASH_VALUE = 121
 
96
    };
 
97
 
 
98
  static const struct operator oplist[] =
 
99
    {
 
100
      {"", TOK_ERROR},
 
101
      {">",     TOK_GREATER},
 
102
      {">>",    TOK_SHIFT_RIGHT},
 
103
      {">>>",   TOK_DOUBLESHIFT_RIGHT},
 
104
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
105
      {">=",    TOK_GREATEREQUAL},
 
106
      {">>=",   TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
107
      {">>>=",  TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
108
      {"", TOK_ERROR},
 
109
      {"=",     TOK_EQUAL},
 
110
      {"==",    TOK_EQUAL_EQUAL},
 
111
      {"===",   TOK_TRIPLE_EQUAL},
 
112
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
113
      {"<=",    TOK_LESSEQUAL},
 
114
      {"<<=",   TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
115
      {"", TOK_ERROR}, {"", TOK_ERROR},
 
116
      {"<",     TOK_LESS},
 
117
      {"<<",    TOK_SHIFT_LEFT},
 
118
      {"/=",    TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
119
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
120
      {"|=",    TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
121
      {"*=",    TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
122
      {"", TOK_ERROR}, {"", TOK_ERROR},
 
123
      {"~",     TOK_TILDE},
 
124
      {"-=",    TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
125
      {"/",     TOK_DIVIDE},
 
126
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
127
      {"+=",    TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
128
      {"%=",    TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
129
      {"", TOK_ERROR}, {"", TOK_ERROR},
 
130
      {"|",     TOK_OR},
 
131
      {"||",    TOK_OR_OR},
 
132
      {"*",     TOK_MULTIPLY},
 
133
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
134
      {"&=",    TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
135
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
136
      {"-",     TOK_MINUS},
 
137
      {"--",    TOK_MINUSMINUS},
 
138
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
139
      {"", TOK_ERROR},
 
140
      {"!=",    TOK_NOT_EQUAL},
 
141
      {"!==",   TOK_NOT_DOUBLEEQUAL},
 
142
      {"", TOK_ERROR}, {"", TOK_ERROR},
 
143
      {"+",     TOK_PLUS},
 
144
      {"++",    TOK_PLUSPLUS},
 
145
      {"%",     TOK_PERCENT},
 
146
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
147
      {"^=",    TOK_ASSIGNMENT_OPERATOR_NOEQUAL},
 
148
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
149
      {"?",     TOK_QUESTIONMARK},
 
150
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
151
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
152
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
153
      {"&",     TOK_AND},
 
154
      {"&&",    TOK_AND_AND},
 
155
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
156
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
157
      {"", TOK_ERROR}, {"", TOK_ERROR},
 
158
      {":",     TOK_COLON},
 
159
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
160
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
161
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
162
      {"!",     TOK_EXCLAMATION},
 
163
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
164
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
165
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
166
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
167
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
168
      {"", TOK_ERROR}, {"", TOK_ERROR}, {"", TOK_ERROR},
 
169
      {"", TOK_ERROR},
 
170
      {"^",     TOK_XOR}
 
171
    };
 
172
 
 
173
  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
 
174
    {
 
175
      int key = op_hash (str, len);
 
176
 
 
177
      if (key <= MAX_HASH_VALUE && key >= 0)
 
178
        {
 
179
          const char *s = oplist[key].name;
 
180
 
 
181
          if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
 
182
            return &oplist[key];
 
183
        }
 
184
    }
 
185
  return 0;
 
186
}