/* C code produced by gperf version 2.1 (K&R C version) */
/* Command-line: gperf -N cpp_rsvd -t -p cpp.prf */
#include <sys/types.h>
#include "ansi.h"
#include "files.h"
#include "hash.h"
#include "buffer.h"
#include "cpp.h"
#include "cpp_hide.h"
struct resword {char *name; int token;};
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 7
#define MIN_HASH_VALUE 4
#define MAX_HASH_VALUE 25
/*
13 keywords
22 is the maximum key range
*/
static int
hash (str, len)
register char *str;
register unsigned int len;
{
static unsigned char hash_table[] =
{
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 5, 25, 25,
0, 0, 4, 25, 25, 15, 25, 25, 10, 25,
25, 25, 0, 25, 10, 25, 0, 10, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25,
};
return len + hash_table[str[len - 1]] + hash_table[str[0]];
}
struct resword *
cpp_rsvd (str, len)
register char *str;
register unsigned int len;
{
static struct resword wordlist[] =
{
{"",}, {"",}, {"",}, {"",},
{"else", Else},
{"",},
{"define", Define},
{"",},
{"elif", Elif},
{"endif", Endif},
{"",},
{"pragma", Pragma},
{"",}, {"",},
{"line", Line},
{"error", Error},
{"",}, {"",}, {"",},
{"undef", Undef},
{"ident", Ident},
{"if", If},
{"include", Include},
{"",},
{"ifdef", Ifdef},
{"ifndef", Ifndef},
};
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