From 54117bf0c16692286decc2faf2bdade5ce4b6768 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 19 Aug 2000 12:55:45 +0000 Subject: [PATCH] test-1.exp renamed to c-parse.exp and regenerated. --- tests/c-parse.exp | 198 ++++++++++++++++++++++++++++++++++++++++++++++ tests/test-1.exp | 153 ----------------------------------- 2 files changed, 198 insertions(+), 153 deletions(-) create mode 100644 tests/c-parse.exp delete mode 100644 tests/test-1.exp diff --git a/tests/c-parse.exp b/tests/c-parse.exp new file mode 100644 index 0000000..9b21090 --- /dev/null +++ b/tests/c-parse.exp @@ -0,0 +1,198 @@ +/* C code produced by gperf version 2.7 */ +/* Command-line: ../src/gperf -L C -F , 0, 0 -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$ */ +/* Command-line: gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ +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 */ + +#ifdef __GNUC__ +__inline +#endif +static unsigned int +hash (str, len) + register const char *str; + register unsigned int 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 + }; + 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]]; +} + +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}, + {"__typeof__", TYPEOF, NORID}, + {"typeof", TYPEOF, NORID}, + {"typedef", SCSPEC, RID_TYPEDEF}, + {"if", IF, NORID}, + {"short", TYPESPEC, RID_SHORT}, + {"int", TYPESPEC, RID_INT}, + {"sizeof", SIZEOF, NORID}, + {"__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}, + {"in", TYPE_QUAL, RID_IN}, + {"", 0, 0}, + {"@compatibility_alias", ALIAS, NORID}, + {"", 0, 0}, + {"@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}, + {"@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}, + {"static", SCSPEC, RID_STATIC}, + {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, + {"long", TYPESPEC, RID_LONG}, + {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, + {"char", TYPESPEC, RID_CHAR} + }; + +#ifdef __GNUC__ +__inline +#endif +struct resword * +is_reserved_word (str, len) + register const char *str; + register unsigned int len; +{ + 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; +} diff --git a/tests/test-1.exp b/tests/test-1.exp deleted file mode 100644 index 462fea5..0000000 --- a/tests/test-1.exp +++ /dev/null @@ -1,153 +0,0 @@ -/* 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; -}