home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / obcp / hash-pdo.h < prev    next >
C/C++ Source or Header  |  1997-01-18  |  9KB  |  233 lines

  1. /* C code produced by gperf version 2.5 (GNU C++ version) */
  2. /* Command-line: gperf -p -j1 -g -G -o -t -N is_reserved_word -k1,4,7,$  */
  3. /* Command-line: gperf -p -j1 -g -G -o -t -N is_reserved_word '-k1,4,$,7' obcp.gperf  */
  4. struct resword { char *name; short token; enum rid rid; enum languages lang; char *save; };
  5.  
  6. #define TOTAL_KEYWORDS 110
  7. #define MIN_WORD_LENGTH 2
  8. #define MAX_WORD_LENGTH 15
  9. #define MIN_HASH_VALUE 4
  10. #define MAX_HASH_VALUE 235
  11. /* maximum key range = 232, duplicates = 0 */
  12.  
  13. #ifdef __GNUC__
  14. inline
  15. #endif
  16. static unsigned int
  17. hash (str, len)
  18.      register char *str;
  19.      register int unsigned len;
  20. {
  21.   static unsigned char asso_values[] =
  22.     {
  23.      236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
  24.      236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
  25.      236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
  26.      236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
  27.      236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
  28.      236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
  29.      236, 236, 236, 236,  50, 236, 236, 236, 236, 236,
  30.      236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
  31.      236, 236, 236, 236, 236, 236, 236, 236, 236, 236,
  32.      236, 236, 236, 236, 236,   0, 236,  32, 118,  30,
  33.       22,   0,  84,  28,  11,  13, 236,   0,   9,  45,
  34.       29,   2,  57,   3,  49,  38,   1,  98,  13,  51,
  35.        0,  12, 236, 236, 236, 236, 236, 236,
  36.     };
  37.   register int hval = len;
  38.  
  39.   switch (hval)
  40.     {
  41.       default:
  42.       case 7:
  43.         hval += asso_values[str[6]];
  44.       case 6:
  45.       case 5:
  46.       case 4:
  47.         hval += asso_values[str[3]];
  48.       case 3:
  49.       case 2:
  50.       case 1:
  51.         hval += asso_values[str[0]];
  52.         break;
  53.     }
  54.   return hval + asso_values[str[len - 1]];
  55. }
  56.  
  57. static struct resword wordlist[] =
  58. {
  59.       {"",}, {"",}, {"",}, {"",}, 
  60.       {"else",  ELSE, NORID, lang_c,},
  61.       {"true",  CXX_TRUE, NORID, lang_c,},
  62.       {"out",  TYPE_QUAL, RID_OUT, lang_objc,},
  63.       {"",}, {"",}, 
  64.       {"xor_eq",  ASSIGN, NORID, lang_c,},
  65.       {"or_eq",  ASSIGN, NORID, lang_c,},
  66.       {"__const",  TYPE_QUAL, RID_CONST, lang_c,},
  67.       {"__const__",  TYPE_QUAL, RID_CONST, lang_c,},
  68.       {"__volatile",  TYPE_QUAL, RID_VOLATILE, lang_c,},
  69.       {"",}, 
  70.       {"__volatile__",  TYPE_QUAL, RID_VOLATILE, lang_c,},
  71.       {"try",  TRY, NORID, lang_cplusplus,        /* Extension */},
  72.       {"int",  TYPESPEC, RID_INT, lang_c,},
  73.       {"",}, {"",}, {"",}, {"",}, {"",}, 
  74.       {"__signed__",  TYPESPEC, RID_SIGNED, lang_c,},
  75.       {"__typeof__",  TYPEOF, NORID, lang_c,},
  76.       {"__attribute",  ATTRIBUTE, NORID, lang_c,},
  77.       {"do",  DO, NORID, lang_c,},
  78.       {"__attribute__",  ATTRIBUTE, NORID, lang_c,},
  79.       {"delete",  DELETE, NORID, lang_cplusplus,},
  80.       {"typeid",  TYPEID, NORID, lang_cplusplus,},
  81.       {"",}, {"",}, 
  82.       {"inline",  SCSPEC, RID_INLINE, lang_c,},
  83.       {"not",  '!', NORID, lang_c,},
  84.       {"case",  CASE, NORID, lang_c,},
  85.       {"extern",  SCSPEC, RID_EXTERN, lang_c,},
  86.       {"goto",  GOTO, NORID, lang_c,},
  87.       {"id",  OBJECTNAME, RID_ID, lang_objc,},
  88.       {"not_eq",  EQCOMPARE, NORID, lang_c,},
  89.       {"virtual",  SCSPEC, RID_VIRTUAL, lang_cplusplus, },
  90.       {"auto",  SCSPEC, RID_AUTO, lang_c,},
  91.       {"and_eq",  ASSIGN, NORID, lang_c,},
  92.       {"__extension__",  EXTENSION, NORID, lang_c,},
  93.       {"__signed",  TYPESPEC, RID_SIGNED, lang_c,},
  94.       {"in",  TYPE_QUAL, RID_IN, lang_objc,},
  95.       {"__asm__",  GCC_ASM_KEYWORD, NORID, lang_c,},
  96.       {"",}, {"",}, {"",}, 
  97.       {"__alignof__",  ALIGNOF, NORID, lang_c,},
  98.       {"__label__",  LABEL, NORID, lang_c,},
  99.       {"static_cast",  STATIC_CAST, NORID, lang_cplusplus,},
  100.       {"xor",  '^', NORID, lang_c,},
  101.       {"or",  OROR, NORID, lang_c,},
  102.       {"typename",  TYPENAME_KEYWORD, NORID, lang_cplusplus,},
  103.       {"",}, 
  104.       {"switch",  SWITCH, NORID, lang_c, },
  105.       {"and",  ANDAND, NORID, lang_c,},
  106.       {"__signature__",  AGGR, RID_SIGNATURE, lang_cplusplus    /* Extension */,},
  107.       {"throw",  THROW, NORID, lang_cplusplus,        /* Extension */},
  108.       {"",}, 
  109.       {"void",  TYPESPEC, RID_VOID, lang_c, },
  110.       {"volatile",  TYPE_QUAL, RID_VOLATILE, lang_c, },
  111.       {"default",  DEFAULT, NORID, lang_c,},
  112.       {"",}, 
  113.       {"while",  WHILE, NORID, lang_c, },
  114.       {"__inline",  SCSPEC, RID_INLINE, lang_c,},
  115.       {"template",  TEMPLATE, NORID, lang_cplusplus, },
  116.       {"__inline__",  SCSPEC, RID_INLINE, lang_c,},
  117.       {"long",  TYPESPEC, RID_LONG, lang_c,},
  118.       {"namespace",  NAMESPACE, NORID, lang_cplusplus,},
  119.       {"oneway",  TYPE_QUAL, RID_ONEWAY, lang_objc,},
  120.       {"@private",  PRIVATE, NORID, lang_objc,},
  121.       {"",}, 
  122.       {"const",  TYPE_QUAL, RID_CONST, lang_c,},
  123.       {"static",  SCSPEC, RID_STATIC, lang_c, },
  124.       {"catch",  CATCH, NORID, lang_cplusplus,},
  125.       {"private",  VISSPEC, RID_PRIVATE, lang_cplusplus,},
  126.       {"",}, {"",}, 
  127.       {"asm",  ASM_KEYWORD, NORID, lang_c,},
  128.       {"this",  THIS, NORID, lang_cplusplus, },
  129.       {"",}, 
  130.       {"new",  NEW, NORID, lang_cplusplus,},
  131.       {"mutable",  SCSPEC, RID_MUTABLE, lang_cplusplus,},
  132.       {"",}, {"",}, 
  133.       {"@encode",  ENCODE, NORID, lang_objc,},
  134.       {"__asm",  GCC_ASM_KEYWORD, NORID, lang_c,},
  135.       {"__wchar_t",  TYPESPEC, RID_WCHAR, lang_cplusplus, /* Unique to ANSI C++ */},
  136.       {"protected",  VISSPEC, RID_PROTECTED, lang_cplusplus,},
  137.       {"typeof",  TYPEOF, NORID, lang_c, },
  138.       {"",}, 
  139.       {"short",  TYPESPEC, RID_SHORT, lang_c, },
  140.       {"enum",  ENUM, NORID, lang_c,},
  141.       {"signed",  TYPESPEC, RID_SIGNED, lang_c, },
  142.       {"",}, 
  143.       {"dynamic_cast",  DYNAMIC_CAST, NORID, lang_cplusplus,},
  144.       {"@end",  END, NORID, lang_objc,},
  145.       {"if",  IF, NORID, lang_c,},
  146.       {"@protocol",  PROTOCOL, NORID, lang_objc,},
  147.       {"compl",  '~', NORID, lang_c,},
  148.       {"public",  VISSPEC, RID_PUBLIC, lang_cplusplus, },
  149.       {"",}, {"",}, {"",}, 
  150.       {"__typeof",  TYPEOF, NORID, lang_c,},
  151.       {"",}, {"",}, 
  152.       {"const_cast",  CONST_CAST, NORID, lang_cplusplus,},
  153.       {"operator",  OPERATOR, NORID, lang_cplusplus,},
  154.       {"class",  AGGR, RID_CLASS, lang_cplusplus,},
  155.       {"friend",  SCSPEC, RID_FRIEND, lang_cplusplus,},
  156.       {"overload",  OVERLOAD, NORID, lang_cplusplus,},
  157.       {"@protected",  PROTECTED, NORID, lang_objc,},
  158.       {"",}, {"",}, 
  159.       {"inout",  TYPE_QUAL, RID_INOUT, lang_objc,},
  160.       {"@selector",  SELECTOR, NORID, lang_objc, },
  161.       {"register",  SCSPEC, RID_REGISTER, lang_c, },
  162.       {"",}, {"",}, 
  163.       {"float",  TYPESPEC, RID_FLOAT, lang_c,},
  164.       {"",}, {"",}, {"",}, 
  165.       {"@class",  CLASS, NORID, lang_objc,},
  166.       {"false",  CXX_FALSE, NORID, lang_c,},
  167.       {"sizeof",  SIZEOF, NORID, lang_c, },
  168.       {"sigof",  SIGOF, NORID, lang_cplusplus,        /* Extension */},
  169.       {"",}, 
  170.       {"__alignof",  ALIGNOF, NORID, lang_c,},
  171.       {"char",  TYPESPEC, RID_CHAR, lang_c,},
  172.       {"",}, 
  173.       {"union",  AGGR, RID_UNION, lang_c, },
  174.       {"",}, 
  175.       {"for",  FOR, NORID, lang_c,},
  176.       {"continue",  CONTINUE, NORID, lang_c,},
  177.       {"bycopy",  TYPE_QUAL, RID_BYCOPY, lang_objc,},
  178.       {"",}, 
  179.       {"bool",  TYPESPEC, RID_BOOL, lang_c,},
  180.       {"unsigned",  TYPESPEC, RID_UNSIGNED, lang_c, },
  181.       {"",}, 
  182.       {"struct",  AGGR, RID_RECORD, lang_c, },
  183.       {"",}, 
  184.       {"@interface",  INTERFACE, NORID, lang_objc,},
  185.       {"double",  TYPESPEC, RID_DOUBLE, lang_c,},
  186.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  187.       {"break",  BREAK, NORID, lang_c,},
  188.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  189.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  190.       
  191.       {"bitor",  '|', NORID, lang_c,},
  192.       {"",}, 
  193.       {"typedef",  SCSPEC, RID_TYPEDEF, lang_c, },
  194.       {"@defs",  DEFS, NORID, lang_objc,},
  195.       {"bitand",  '&', NORID, lang_c,},
  196.       {"",}, {"",}, {"",}, 
  197.       {"return",  RETURN, NORID, lang_c, },
  198.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  199.       {"",}, {"",}, {"",}, {"",}, 
  200.       {"@implementation",  IMPLEMENTATION, NORID, lang_objc,},
  201.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  202.       {"",}, 
  203.       {"byref",  TYPE_QUAL, RID_BYREF, lang_objc,},
  204.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  205.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  206.       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
  207.       
  208.       {"@public",  PUBLIC, NORID, lang_objc,},
  209. };
  210.  
  211. #ifdef __GNUC__
  212. inline
  213. #endif
  214. struct resword *
  215. is_reserved_word (str, len)
  216.      register char *str;
  217.      register unsigned int len;
  218. {
  219.   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
  220.     {
  221.       register int key = hash (str, len);
  222.  
  223.       if (key <= MAX_HASH_VALUE && key >= 0)
  224.         {
  225.           register char *s = wordlist[key].name;
  226.  
  227.           if (*s == *str && !strcmp (str + 1, s + 1))
  228.             return &wordlist[key];
  229.         }
  230.     }
  231.   return 0;
  232. }
  233.