freebsd-nq/contrib/gperf/tests/test-2.exp
2000-03-25 07:45:29 +00:00

203 lines
5.8 KiB
Plaintext

/* C code produced by gperf version 2.7 */
/* Command-line: ../src/gperf -n -k1-8 -l */
#define TOTAL_KEYWORDS 40
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 14
#define MIN_HASH_VALUE 1
#define MAX_HASH_VALUE 256
/* maximum key range = 256, duplicates = 0 */
#ifdef __GNUC__
__inline
#endif
static unsigned int
hash (str, len)
register const char *str;
register unsigned int len;
{
static unsigned short asso_values[] =
{
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 25, 30, 35, 21, 0,
30, 15, 30, 45, 257, 257, 0, 5, 45, 0,
10, 0, 1, 20, 25, 15, 30, 40, 15, 5,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257, 257, 257, 257, 257,
257, 257, 257, 257, 257, 257
};
register int hval = 0;
switch (len)
{
default:
case 8:
hval += asso_values[(unsigned char)str[7]];
case 7:
hval += asso_values[(unsigned char)str[6]];
case 6:
hval += asso_values[(unsigned char)str[5]];
case 5:
hval += asso_values[(unsigned char)str[4]];
case 4:
hval += asso_values[(unsigned char)str[3]];
case 3:
hval += asso_values[(unsigned char)str[2]];
case 2:
hval += asso_values[(unsigned char)str[1]];
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval;
}
#ifdef __GNUC__
__inline
#endif
const char *
in_word_set (str, len)
register const char *str;
register unsigned int len;
{
static unsigned char lengthtable[] =
{
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 0, 2, 3, 0,
0, 0, 2, 3, 0, 0, 0, 2, 4, 0, 0, 0, 4, 6,
0, 0, 0, 3, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
3, 5, 6, 0, 0, 6, 0, 0, 0, 0, 3, 0, 0, 0,
3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 0, 9,
0, 4, 6, 6, 0, 0, 2, 3, 0, 0, 0, 5, 3, 0,
0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,
7, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0,
4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 10
};
static const char * wordlist[] =
{
"",
"OR",
"", "", "", "", "", "", "", "",
"LOOP",
"", "", "", "", "", "", "", "", "",
"ELSE",
"DO",
"", "", "",
"TO",
"MOD",
"", "", "",
"OF",
"FOR",
"", "", "",
"BY",
"FROM",
"", "", "",
"TYPE",
"MODULE",
"", "", "",
"SET",
"", "", "", "", "",
"EXPORT",
"", "", "", "",
"VAR",
"ARRAY",
"RECORD",
"", "",
"REPEAT",
"", "", "", "",
"END",
"", "", "",
"NOT",
"", "", "", "",
"IF",
"", "", "", "",
"CASE",
"", "",
"PROCEDURE",
"",
"EXIT",
"IMPORT",
"RETURN",
"", "",
"IN",
"AND",
"", "", "",
"ELSIF",
"DIV",
"", "", "",
"THEN",
"", "", "", "", "", "", "", "", "",
"IMPLEMENTATION",
"", "", "", "",
"WHILE",
"", "", "", "", "", "", "", "", "",
"CONST",
"POINTER",
"", "", "",
"UNTIL",
"", "", "", "",
"BEGIN",
"", "", "", "",
"WITH",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"",
"QUALIFIED",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "",
"", "", "", "", "",
"DEFINITION"
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
if (len == lengthtable[key])
{
register const char *s = wordlist[key];
if (*str == *s && !strcmp (str + 1, s + 1))
return s;
}
}
return 0;
}