File:  [Apple XNU] / GNUtools / cc / obcp-hash.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:45:32 2018 UTC (8 years, 2 months ago) by root
Branches: MAIN, Apple
CVS tags: HEAD, GNUtools33
GNU tools for NeXTSTEP 3.3

/* starting time is 13:16:31 */
/* C code produced by gperf version 2.5 (GNU C++ version) */
/* Command-line: /Net/seaport/homes/nebraska/mwagner/bin/gperf -G -i 1 -p -j1 -o -t -N is_reserved_word -k1,4,$,7 obcp.gperf  */
/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$,7 gplus.gperf  */
struct resword { char *name; short token; enum rid rid; enum languages lang; char *save; };

#define TOTAL_KEYWORDS 99
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 15
#define MIN_HASH_VALUE 7
#define MAX_HASH_VALUE 180
/* maximum key range = 174, duplicates = 0 */

static unsigned int
hash (str, len)
     register char *str;
     register int unsigned len;
{
  static unsigned char asso_values[] =
    {
     181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
     181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
     181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
     181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
     181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
     181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
     181, 181, 181, 181,  59, 181, 181, 181, 181, 181,
     181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
     181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
     181, 181, 181, 181, 181,   1, 181, 103,   7,  38,
      27,   1,  13,   6,  22,  67, 181,   1,  18,   8,
      32,   1,  19, 181,  40,  12,   5,  34,  21,  67,
       1,  23, 181, 181, 181, 181, 181, 181,
    };
  register int hval = len;

  switch (hval)
    {
      default:
      case 7:
        hval += asso_values[str[6]];
      case 6:
      case 5:
      case 4:
        hval += asso_values[str[3]];
      case 3:
      case 2:
      case 1:
        hval += asso_values[str[0]];
    }
  return hval + asso_values[str[len - 1]];
}

static struct resword wordlist[] =
{
      {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
      {"else",  ELSE, NORID, lang_c,},
      {"",}, 
      {"out",  TYPE_QUAL, RID_OUT, lang_objc,},
      {"",}, {"",}, 
      {"goto",  GOTO, NORID, lang_c,},
      {"except",  EXCEPT, NORID, lang_cplusplus,		/* Extension */},
      {"__headof__",  HEADOF, NORID, lang_c,},
      {"",}, {"",}, 
      {"__const__",  TYPE_QUAL, RID_CONST, lang_c,},
      {"__volatile",  TYPE_QUAL, RID_VOLATILE, lang_c,},
      {"__const",  TYPE_QUAL, RID_CONST, lang_c,},
      {"__volatile__",  TYPE_QUAL, RID_VOLATILE, lang_c,},
      {"enum",  ENUM, NORID, lang_c,},
      {"__asm__",  GCC_ASM_KEYWORD, NORID, lang_c,},
      {"",}, 
      {"__headof",  HEADOF, NORID, lang_c,},
      {"typeof",  TYPEOF, NORID, lang_c, },
      {"__asm",  GCC_ASM_KEYWORD, NORID, lang_c,},
      {"",}, {"",}, {"",}, 
      {"do",  DO, NORID, lang_c,},
      {"try",  TRY, NORID, lang_cplusplus			/* Extension */,},
      {"sizeof",  SIZEOF, NORID, lang_c, },
      {"this",  THIS, NORID, lang_cplusplus, },
      {"long",  TYPESPEC, RID_LONG, lang_c,},
      {"delete",  DELETE, NORID, lang_cplusplus,},
      {"__typeof__",  TYPEOF, NORID, lang_c,},
      {"bycopy",  TYPE_QUAL, RID_BYCOPY, lang_objc,},
      {"template",  TEMPLATE, NORID, lang_cplusplus, },
      {"typedef",  SCSPEC, RID_TYPEDEF, lang_c, },
      {"extern",  SCSPEC, RID_EXTERN, lang_c,},
      {"double",  TYPESPEC, RID_DOUBLE, lang_c,},
      {"",}, 
      {"__classof__",  CLASSOF, NORID, lang_c,},
      {"case",  CASE, NORID, lang_c,},
      {"switch",  SWITCH, NORID, lang_c, },
      {"__typeof",  TYPEOF, NORID, lang_c,},
      {"friend",  SCSPEC, RID_FRIEND, lang_cplusplus,},
      {"__extension__",  EXTENSION, NORID, lang_c,},
      {"private",  VISSPEC, RID_PRIVATE, lang_cplusplus,},
      {"",}, {"",}, {"",}, 
      {"__classof",  CLASSOF, NORID, lang_c,},
      {"",}, {"",}, 
      {"for",  FOR, NORID, lang_c,},
      {"struct",  AGGR, RID_RECORD, lang_c, },
      {"raise",  RAISE, NORID, lang_cplusplus,		/* Extension */},
      {"",}, 
      {"const",  TYPE_QUAL, RID_CONST, lang_c,},
      {"static",  SCSPEC, RID_STATIC, lang_c, },
      {"short",  TYPESPEC, RID_SHORT, lang_c, },
      {"__alignof__",  ALIGNOF, NORID, lang_c,},
      {"",}, 
      {"protected",  VISSPEC, RID_PROTECTED, lang_cplusplus,},
      {"",}, 
      {"class",  AGGR, RID_CLASS, lang_cplusplus,},
      {"headof",  HEADOF, NORID, lang_cplusplus,},
      {"virtual",  SCSPEC, RID_VIRTUAL, lang_cplusplus, },
      {"raises",  RAISES, NORID, lang_cplusplus,		/* Extension */},
      {"",}, 
      {"union",  AGGR, RID_UNION, lang_c, },
      {"__alignof",  ALIGNOF, NORID, lang_c,},
      {"__inline",  SCSPEC, RID_INLINE, lang_c,},
      {"int",  TYPESPEC, RID_INT, lang_c,},
      {"__inline__",  SCSPEC, RID_INLINE, lang_c,},
      {"signed",  TYPESPEC, RID_SIGNED, lang_c, },
      {"throw",  THROW, NORID, lang_cplusplus		/* Extension */,},
      {"void",  TYPESPEC, RID_VOID, lang_c, },
      {"__signed__",  TYPESPEC, RID_SIGNED, lang_c,},
      {"public",  VISSPEC, RID_PUBLIC, lang_cplusplus, },
      {"if",  IF, NORID, lang_c,},
      {"classof",  CLASSOF, NORID, lang_cplusplus,},
      {"",}, 
      {"__attribute",  ATTRIBUTE, NORID, lang_c,},
      {"continue",  CONTINUE, NORID, lang_c,},
      {"__attribute__",  ATTRIBUTE, NORID, lang_c,},
      {"@interface",  INTERFACE, NORID, lang_objc,},
      {"@defs",  DEFS, NORID, lang_objc,},
      {"operator",  OPERATOR, NORID, lang_cplusplus,},
      {"while",  WHILE, NORID, lang_c, },
      {"",}, 
      {"__wchar_t",  TYPESPEC, RID_WCHAR, lang_cplusplus, /* Unique to ANSI C++ */},
      {"",}, {"",}, 
      {"id",  OBJECTNAME, RID_ID, lang_objc,},
      {"oneway",  TYPE_QUAL, RID_ONEWAY, lang_objc,},
      {"",}, {"",}, {"",}, 
      {"in",  TYPE_QUAL, RID_IN, lang_objc,},
      {"new",  NEW, NORID, lang_cplusplus,},
      {"catch",  CATCH, NORID, lang_cplusplus,},
      {"__signed",  TYPESPEC, RID_SIGNED, lang_c,},
      {"",}, 
      {"@encode",  ENCODE, NORID, lang_objc,},
      {"",}, {"",}, 
      {"auto",  SCSPEC, RID_AUTO, lang_c,},
      {"exception",  AGGR, RID_EXCEPTION, lang_cplusplus,	/* Extension */},
      {"inout",  TYPE_QUAL, RID_INOUT, lang_objc,},
      {"return",  RETURN, NORID, lang_c, },
      {"",}, 
      {"asm",  ASM_KEYWORD, NORID, lang_c,},
      {"",}, 
      {"break",  BREAK, NORID, lang_c,},
      {"@end",  END, NORID, lang_objc,},
      {"",}, {"",}, 
      {"mutable",  SCSPEC, RID_MUTABLE, lang_cplusplus,},
      {"",}, 
      {"char",  TYPESPEC, RID_CHAR, lang_c,},
      {"",}, 
      {"all",  ALL, NORID, lang_cplusplus,		/* Extension */},
      {"@protocol",  PROTOCOL, NORID, lang_objc,},
      {"float",  TYPESPEC, RID_FLOAT, lang_c,},
      {"",}, {"",}, {"",}, {"",}, 
      {"@selector",  SELECTOR, NORID, lang_objc, },
      {"__label__",  LABEL, NORID, lang_c,},
      {"@implementation",  IMPLEMENTATION, NORID, lang_objc,},
      {"",}, 
      {"@protected",  PROTECTED, NORID, lang_objc,},
      {"",}, 
      {"unsigned",  TYPESPEC, RID_UNSIGNED, lang_c, },
      {"",}, {"",}, 
      {"@private",  PRIVATE, NORID, lang_objc,},
      {"inline",  SCSPEC, RID_INLINE, lang_c,},
      {"",}, {"",}, {"",}, {"",}, {"",}, 
      {"default",  DEFAULT, NORID, lang_c,},
      {"",}, 
      {"@public",  PUBLIC, NORID, lang_objc,},
      {"",}, 
      {"volatile",  TYPE_QUAL, RID_VOLATILE, lang_c, },
      {"reraise",  RERAISE, NORID, lang_cplusplus,	/* Extension */},
      {"",}, {"",}, {"",}, 
      {"register",  SCSPEC, RID_REGISTER, lang_c, },
      {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
      {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
      {"",}, {"",}, {"",}, {"",}, 
      {"overload",  OVERLOAD, NORID, lang_cplusplus,},
      {"@class",  CLASS, NORID, lang_objc,},
};

struct resword *
is_reserved_word (str, len)
     register 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 char *s = wordlist[key].name;

          if (*s == *str && !strcmp (str + 1, s + 1))
            return &wordlist[key];
        }
    }
  return 0;
}
/* ending time is 13:16:31 */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.