1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Completely new asso_values search algorithm.

This commit is contained in:
Bruno Haible
2003-03-18 10:22:37 +00:00
parent 40f37680ac
commit 6d268d095b
20 changed files with 1918 additions and 2117 deletions

View File

@@ -7,9 +7,9 @@ struct resword { const char *name; short token; enum rid rid; };
#define TOTAL_KEYWORDS 83
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 20
#define MIN_HASH_VALUE 8
#define MAX_HASH_VALUE 141
/* maximum key range = 134, duplicates = 0 */
#define MIN_HASH_VALUE 12
#define MAX_HASH_VALUE 125
/* maximum key range = 114, duplicates = 0 */
#ifdef __GNUC__
__inline
@@ -25,32 +25,32 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 35, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 1, 142, 90, 1, 28,
40, 6, 1, 24, 3, 13, 142, 36, 60, 14,
49, 3, 6, 142, 19, 8, 1, 50, 33, 11,
2, 23, 4, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 19, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 1, 126, 12, 50, 17,
22, 18, 51, 37, 5, 10, 126, 15, 35, 49,
27, 40, 28, 126, 2, 20, 1, 33, 64, 7,
11, 4, 7, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
126, 126, 126, 126, 126, 126
};
register int hval = len;
@@ -71,112 +71,102 @@ static struct resword wordlist[] =
{
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"out", TYPE_QUAL, RID_OUT},
{"", 0, 0},
{"float", TYPESPEC, RID_FLOAT},
{"__typeof", TYPEOF, NORID},
{"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__real__", REALPART, NORID},
{"__typeof__", TYPEOF, NORID},
{"typeof", TYPEOF, NORID},
{"typedef", SCSPEC, RID_TYPEDEF},
{"if", IF, NORID},
{"short", TYPESPEC, RID_SHORT},
{"__restrict", TYPE_QUAL, RID_RESTRICT},
{"int", TYPESPEC, RID_INT},
{"sizeof", SIZEOF, NORID},
{"__restrict__", TYPE_QUAL, RID_RESTRICT},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__imag__", IMAGPART, NORID},
{"__asm__", ASM_KEYWORD, NORID},
{"__inline__", SCSPEC, RID_INLINE},
{"__iterator", SCSPEC, RID_ITERATOR},
{"__iterator__", SCSPEC, RID_ITERATOR},
{"__alignof__", ALIGNOF, NORID},
{"__const", TYPE_QUAL, RID_CONST},
{"__attribute__", ATTRIBUTE, NORID},
{"__const__", TYPE_QUAL, RID_CONST},
{"struct", STRUCT, NORID},
{"__complex__", TYPESPEC, RID_COMPLEX},
{"restrict", TYPE_QUAL, RID_RESTRICT},
{"__signed__", TYPESPEC, RID_SIGNED},
{"__extension__", EXTENSION, NORID},
{"inout", TYPE_QUAL, RID_INOUT},
{"__imag__", IMAGPART, NORID},
{"else", ELSE, NORID},
{"__inline__", SCSPEC, RID_INLINE},
{"byref", TYPE_QUAL, RID_BYREF},
{"__iterator__", SCSPEC, RID_ITERATOR},
{"__inline", SCSPEC, RID_INLINE},
{"__real__", REALPART, NORID},
{"switch", SWITCH, NORID},
{"__restrict", TYPE_QUAL, RID_RESTRICT},
{"goto", GOTO, NORID},
{"__restrict__", TYPE_QUAL, RID_RESTRICT},
{"struct", STRUCT, NORID},
{"while", WHILE, NORID},
{"restrict", TYPE_QUAL, RID_RESTRICT},
{"__const", TYPE_QUAL, RID_CONST},
{"oneway", TYPE_QUAL, RID_ONEWAY},
{"__const__", TYPE_QUAL, RID_CONST},
{"__complex", TYPESPEC, RID_COMPLEX},
{"__complex__", TYPESPEC, RID_COMPLEX},
{"for", FOR, NORID},
{"__iterator", SCSPEC, RID_ITERATOR},
{"__imag", IMAGPART, NORID},
{"do", DO, NORID},
{"case", CASE, NORID},
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
{"break", BREAK, NORID},
{"default", DEFAULT, NORID},
{"__volatile", TYPE_QUAL, RID_VOLATILE},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@defs", DEFS, NORID},
{"id", OBJECTNAME, RID_ID},
{"", 0, 0},
{"__signed", TYPESPEC, RID_SIGNED},
{"bycopy", TYPE_QUAL, RID_BYCOPY},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"extern", SCSPEC, RID_EXTERN},
{"", 0, 0},
{"char", TYPESPEC, RID_CHAR},
{"return", RETURN, NORID},
{"__inline", SCSPEC, RID_INLINE},
{"__complex", TYPESPEC, RID_COMPLEX},
{"in", TYPE_QUAL, RID_IN},
{"while", WHILE, NORID},
{"switch", SWITCH, NORID},
{"__attribute", ATTRIBUTE, NORID},
{"", 0, 0},
{"@compatibility_alias", ALIAS, NORID},
{"", 0, 0},
{"__real", REALPART, NORID},
{"out", TYPE_QUAL, RID_OUT},
{"__label__", LABEL, NORID},
{"@private", PRIVATE, NORID},
{"@selector", SELECTOR, NORID},
{"register", SCSPEC, RID_REGISTER},
{"__label__", LABEL, NORID},
{"", 0, 0}, {"", 0, 0},
{"enum", ENUM, NORID},
{"return", RETURN, NORID},
{"", 0, 0}, {"", 0, 0},
{"signed", TYPESPEC, RID_SIGNED},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"const", TYPE_QUAL, RID_CONST},
{"", 0, 0},
{"inline", SCSPEC, RID_INLINE},
{"__real", REALPART, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"void", TYPESPEC, RID_VOID},
{"continue", CONTINUE, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0},
{"@encode", ENCODE, NORID},
{"auto", SCSPEC, RID_AUTO},
{"__asm__", ASM_KEYWORD, NORID},
{"@interface", INTERFACE, NORID},
{"__alignof", ALIGNOF, NORID},
{"double", TYPESPEC, RID_DOUBLE},
{"__alignof__", ALIGNOF, NORID},
{"__signed", TYPESPEC, RID_SIGNED},
{"extern", SCSPEC, RID_EXTERN},
{"@protected", PROTECTED, NORID},
{"__attribute__", ATTRIBUTE, NORID},
{"unsigned", TYPESPEC, RID_UNSIGNED},
{"volatile", TYPE_QUAL, RID_VOLATILE},
{"__attribute", ATTRIBUTE, NORID},
{"@class", CLASS, NORID},
{"__asm", ASM_KEYWORD, NORID},
{"", 0, 0}, {"", 0, 0},
{"@implementation", IMPLEMENTATION, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"union", UNION, NORID},
{"", 0, 0}, {"", 0, 0},
{"@public", PUBLIC, NORID},
{"asm", ASM_KEYWORD, NORID},
{"", 0, 0},
{"@protocol", PROTOCOL, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@end", END, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__imag", IMAGPART, NORID},
{"static", SCSPEC, RID_STATIC},
{"inout", TYPE_QUAL, RID_INOUT},
{"auto", SCSPEC, RID_AUTO},
{"for", FOR, NORID},
{"case", CASE, NORID},
{"else", ELSE, NORID},
{"__typeof", TYPEOF, NORID},
{"@defs", DEFS, NORID},
{"if", IF, NORID},
{"do", DO, NORID},
{"@protocol", PROTOCOL, NORID},
{"short", TYPESPEC, RID_SHORT},
{"__asm", ASM_KEYWORD, NORID},
{"oneway", TYPE_QUAL, RID_ONEWAY},
{"inline", SCSPEC, RID_INLINE},
{"continue", CONTINUE, NORID},
{"@encode", ENCODE, NORID},
{"@end", END, NORID},
{"__alignof", ALIGNOF, NORID},
{"@interface", INTERFACE, NORID},
{"union", UNION, NORID},
{"@public", PUBLIC, NORID},
{"bycopy", TYPE_QUAL, RID_BYCOPY},
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
{"double", TYPESPEC, RID_DOUBLE},
{"@class", CLASS, NORID},
{"default", DEFAULT, NORID},
{"goto", GOTO, NORID},
{"unsigned", TYPESPEC, RID_UNSIGNED},
{"sizeof", SIZEOF, NORID},
{"signed", TYPESPEC, RID_SIGNED},
{"typeof", TYPEOF, NORID},
{"typedef", SCSPEC, RID_TYPEDEF},
{"break", BREAK, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"long", TYPESPEC, RID_LONG},
{"__volatile", TYPE_QUAL, RID_VOLATILE},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"char", TYPESPEC, RID_CHAR}
{"float", TYPESPEC, RID_FLOAT},
{"", 0, 0},
{"@compatibility_alias", ALIAS, NORID},
{"void", TYPESPEC, RID_VOID},
{"", 0, 0}, {"", 0, 0},
{"long", TYPESPEC, RID_LONG},
{"enum", ENUM, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"byref", TYPE_QUAL, RID_BYREF},
{"", 0, 0},
{"@implementation", IMPLEMENTATION, NORID},
{"", 0, 0}, {"", 0, 0},
{"asm", ASM_KEYWORD, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"volatile", TYPE_QUAL, RID_VOLATILE}
};
#ifdef __GNUC__