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