1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00
freebsd/contrib/gperf/tests/test-1.exp
2000-03-25 07:45:29 +00:00

154 lines
4.6 KiB
Plaintext

/* C code produced by gperf version 2.7 */
/* Command-line: ../src/gperf -p -j1 -g -o -t -N is_reserved_word -k1,3,$ */
/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
struct resword { char *name; short token; enum rid rid; };
#define TOTAL_KEYWORDS 51
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 13
#define MIN_HASH_VALUE 8
#define MAX_HASH_VALUE 82
/* maximum key range = 75, duplicates = 0 */
#ifdef __GNUC__
__inline
#endif
static unsigned int
hash (str, len)
register const char *str;
register unsigned int len;
{
static unsigned char asso_values[] =
{
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 0, 83, 1, 2, 34,
19, 6, 11, 29, 0, 17, 83, 0, 23, 28,
26, 30, 31, 83, 15, 1, 0, 28, 13, 4,
83, 83, 5, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83
};
register int hval = len;
switch (hval)
{
default:
case 3:
hval += asso_values[(unsigned char)str[2]];
case 2:
case 1:
hval += asso_values[(unsigned char)str[0]];
break;
}
return hval + asso_values[(unsigned char)str[len - 1]];
}
#ifdef __GNUC__
__inline
#endif
struct resword *
is_reserved_word (str, len)
register const char *str;
register unsigned int len;
{
static struct resword wordlist[] =
{
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{"__asm__", ASM, NORID},
{""},
{"__typeof__", TYPEOF, NORID},
{"__signed__", TYPESPEC, RID_SIGNED},
{"__alignof__", ALIGNOF, NORID},
{"break", BREAK, NORID},
{"__attribute__", ATTRIBUTE, NORID},
{""}, {""},
{"else", ELSE, NORID},
{"__attribute", ATTRIBUTE, NORID},
{"__typeof", TYPEOF, NORID},
{"int", TYPESPEC, RID_INT},
{"__alignof", ALIGNOF, NORID},
{"struct", STRUCT, NORID},
{"sizeof", SIZEOF, NORID},
{"switch", SWITCH, NORID},
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
{""},
{"__inline__", SCSPEC, RID_INLINE},
{"__signed", TYPESPEC, RID_SIGNED},
{"__volatile", TYPE_QUAL, RID_VOLATILE},
{"if", IF, NORID},
{"__inline", SCSPEC, RID_INLINE},
{"while", WHILE, NORID},
{""},
{"__asm", ASM, NORID},
{"auto", SCSPEC, RID_AUTO},
{"short", TYPESPEC, RID_SHORT},
{"default", DEFAULT, NORID},
{"extern", SCSPEC, RID_EXTERN},
{""}, {""},
{"__const", TYPE_QUAL, RID_CONST},
{"static", SCSPEC, RID_STATIC},
{"__const__", TYPE_QUAL, RID_CONST},
{"for", FOR, NORID},
{"case", CASE, NORID},
{"float", TYPESPEC, RID_FLOAT},
{"return", RETURN, NORID},
{"typeof", TYPEOF, NORID},
{"typedef", SCSPEC, RID_TYPEDEF},
{"volatile", TYPE_QUAL, RID_VOLATILE},
{"do", DO, NORID},
{"inline", SCSPEC, RID_INLINE},
{"void", TYPESPEC, RID_VOID},
{"char", TYPESPEC, RID_CHAR},
{"signed", TYPESPEC, RID_SIGNED},
{"unsigned", TYPESPEC, RID_UNSIGNED},
{""}, {""},
{"double", TYPESPEC, RID_DOUBLE},
{"asm", ASM, NORID},
{""}, {""},
{"goto", GOTO, NORID},
{""},
{"const", TYPE_QUAL, RID_CONST},
{"enum", ENUM, NORID},
{"register", SCSPEC, RID_REGISTER},
{""}, {""}, {""}, {""}, {""}, {""},
{"continue", CONTINUE, NORID},
{""},
{"union", UNION, NORID},
{""}, {""}, {""}, {""}, {""},
{"long", TYPESPEC, RID_LONG}
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
register const char *s = wordlist[key].name;
if (*str == *s && !strcmp (str + 1, s + 1))
return &wordlist[key];
}
}
return 0;
}