OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [java/] [keyword.h] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* ANSI-C code produced by gperf version 2.7.2 */
2
/* Command-line: gperf -L ANSI-C -C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k'1,4,$' keyword.gperf  */
3
/* Keyword definition for the GNU compiler for the Java(TM) language.
4
   Copyright (C) 1997, 1998, 2001, 2002, 2003
5
   Free Software Foundation, Inc.
6
   Contributed by Alexandre Petit-Bianco (apbianco@cygnus.com)
7
 
8
This file is part of GCC.
9
 
10
GCC is free software; you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation; either version 2, or (at your option)
13
any later version.
14
 
15
GCC is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
GNU General Public License for more details.
19
 
20
You should have received a copy of the GNU General Public License
21
along with GCC; see the file COPYING.  If not, write to
22
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23
Boston, MA 02110-1301, USA.
24
 
25
Java and all Java-based marks are trademarks or registered trademarks
26
of Sun Microsystems, Inc. in the United States and other countries.
27
The Free Software Foundation is independent of Sun Microsystems, Inc.  */
28
 
29
struct java_keyword { const char *const name; const int token; };
30
#ifdef __GNUC__
31
__inline
32
#endif
33
static unsigned int hash (const char *, unsigned int);
34
#ifdef __GNUC__
35
__inline
36
#endif
37
const struct java_keyword *java_keyword (const char *, unsigned int);
38
 
39
#define TOTAL_KEYWORDS 52
40
#define MIN_WORD_LENGTH 2
41
#define MAX_WORD_LENGTH 12
42
#define MIN_HASH_VALUE 7
43
#define MAX_HASH_VALUE 85
44
/* maximum key range = 79, duplicates = 0 */
45
 
46
#ifdef __GNUC__
47
__inline
48
#else
49
#ifdef __cplusplus
50
inline
51
#endif
52
#endif
53
static unsigned int
54
hash (const char *str, unsigned int len)
55
{
56
  static const unsigned char asso_values[] =
57
    {
58
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
59
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
60
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
61
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
62
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
63
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
64
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
65
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
66
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
67
      86, 86, 86, 86, 86, 86, 86,  1, 34,  3,
68
       1,  1, 18,  7, 21, 28, 86, 14,  1, 86,
69
      18, 20, 37, 86, 15,  6,  2,  5, 40, 36,
70
      86, 36, 86, 86, 86, 86, 86, 86, 86, 86,
71
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
72
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
73
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
74
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
75
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
76
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
77
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
78
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
79
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
80
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
81
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
82
      86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
83
      86, 86, 86, 86, 86, 86
84
    };
85
  int hval = len;
86
 
87
  switch (hval)
88
    {
89
      default:
90
      case 4:
91
        hval += asso_values[(unsigned char)str[3]];
92
      case 3:
93
      case 2:
94
      case 1:
95
        hval += asso_values[(unsigned char)str[0]];
96
        break;
97
    }
98
  return hval + asso_values[(unsigned char)str[len - 1]];
99
}
100
 
101
#ifdef __GNUC__
102
__inline
103
#endif
104
const struct java_keyword *
105
java_keyword (const char *str, unsigned int len)
106
{
107
  static const struct java_keyword wordlist[] =
108
    {
109
      {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
110
      {"", 0},
111
      {"else", ELSE_TK},
112
      {"true", TRUE_TK},
113
      {"case", CASE_TK},
114
      {"assert", ASSERT_TK},
115
      {"default", DEFAULT_TK},
116
      {"", 0},
117
      {"abstract", ABSTRACT_TK},
118
      {"continue", CONTINUE_TK},
119
      {"extends", EXTENDS_TK},
120
      {"const", CONST_TK},
121
      {"static", STATIC_TK},
122
      {"this", THIS_TK},
123
      {"long", LONG_TK},
124
      {"class", CLASS_TK},
125
      {"", 0},
126
      {"synchronized", SYNCHRONIZED_TK},
127
      {"do", DO_TK},
128
      {"null", NULL_TK},
129
      {"final", FINAL_TK},
130
      {"float", FLOAT_TK},
131
      {"super", SUPER_TK},
132
      {"short", SHORT_TK},
133
      {"", 0},
134
      {"false", FALSE_TK},
135
      {"transient", TRANSIENT_TK},
136
      {"catch", CATCH_TK},
137
      {"int", INT_TK},
138
      {"throws", THROWS_TK},
139
      {"switch", SWITCH_TK},
140
      {"for", FOR_TK},
141
      {"char", CHAR_TK},
142
      {"", 0},
143
      {"interface", INTERFACE_TK},
144
      {"byte", BYTE_TK},
145
      {"try", TRY_TK},
146
      {"double", DOUBLE_TK},
147
      {"while", WHILE_TK},
148
      {"return", RETURN_TK},
149
      {"implements", IMPLEMENTS_TK},
150
      {"void", VOID_TK},
151
      {"public", PUBLIC_TK},
152
      {"if", IF_TK},
153
      {"protected", PROTECTED_TK},
154
      {"volatile", VOLATILE_TK},
155
      {"goto", GOTO_TK},
156
      {"", 0},
157
      {"native", NATIVE_TK},
158
      {"break", BREAK_TK},
159
      {"", 0},
160
      {"import", IMPORT_TK},
161
      {"new", NEW_TK},
162
      {"instanceof", INSTANCEOF_TK},
163
      {"package", PACKAGE_TK},
164
      {"boolean", BOOLEAN_TK},
165
      {"", 0},
166
      {"finally", FINALLY_TK},
167
      {"throw", THROW_TK},
168
      {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
169
      {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
170
      {"", 0}, {"", 0}, {"", 0},
171
      {"strictfp", STRICT_TK},
172
      {"", 0}, {"", 0}, {"", 0}, {"", 0}, {"", 0},
173
      {"private", PRIVATE_TK}
174
    };
175
 
176
  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
177
    {
178
      int key = hash (str, len);
179
 
180
      if (key <= MAX_HASH_VALUE && key >= 0)
181
        {
182
          const char *s = wordlist[key].name;
183
 
184
          if (*str == *s && !strcmp (str + 1, s + 1))
185
            return &wordlist[key];
186
        }
187
    }
188
  return 0;
189
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.