/* C code produced by gperf version 2.1 (K&R C version) */
/* Command-line: gperf -N c_rsvd -t -p c.prf */
#include <sys/types.h>
#include "ansi.h"
#include "host.h"
#include "files.h"
#include "hash.h"
#include "il.h"
#include "y.tab.h"
struct resword {char *name; short token;};
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 8
#define MIN_HASH_VALUE 4
#define MAX_HASH_VALUE 61
/*
32 keywords
58 is the maximum key range
*/
static int
hash (str, len)
register char *str;
register unsigned int len;
{
static unsigned char hash_table[] =
{
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
61, 61, 61, 61, 61, 61, 61, 5, 15, 10,
30, 0, 20, 25, 15, 20, 61, 0, 10, 15,
5, 0, 61, 61, 10, 25, 0, 0, 0, 0,
61, 61, 61, 61, 61, 61, 61, 61,
};
return len + hash_table[str[len - 1]] + hash_table[str[0]];
}
struct resword *
c_rsvd (str, len)
register char *str;
register unsigned int len;
{
static struct resword wordlist[] =
{
{"",}, {"",}, {"",}, {"",},
{"else", ELSE},
{"while", WHILE},
{"",}, {"",},
{"volatile", VOLATILE},
{"auto", AUTO},
{"union", UNION},
{"extern", EXTERN},
{"",}, {"",},
{"case", CASE},
{"const", CONST},
{"",}, {"",},
{"continue", CONTINUE},
{"enum", ENUM},
{"break", BREAK},
{"return", RETURN},
{"",},
{"int", INT},
{"char", CHAR},
{"float", FLOAT},
{"",},
{"typedef", TYPEDEF},
{"register", REGISTER},
{"goto", GOTO},
{"short", SHORT},
{"struct", STRUCT},
{"do", DO},
{"for", FOR},
{"void", VOID},
{"",},
{"double", DOUBLE},
{"default", DEFAULT},
{"unsigned", UNSIGNED},
{"long", LONG},
{"",},
{"static", STATIC},
{"if", IF},
{"",}, {"",}, {"",},
{"switch", SWITCH},
{"",}, {"",}, {"",}, {"",},
{"sizeof", SIZEOF},
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"signed", SIGNED},
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
register int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
{
register char *s = wordlist[key].name;
if (*s == *str && !strcmp (str + 1, s + 1))
return &wordlist[key];
}
}
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1