Annotation of embedaddon/strongswan/src/stroke/stroke_keywords.c, revision 1.1

1.1     ! misho       1: /* ANSI-C code produced by gperf version 3.1 */
        !             2: /* Command-line: /usr/bin/gperf -m 10 -D -C -G -t  */
        !             3: /* Computed positions: -k'1,5,7' */
        !             4: 
        !             5: #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
        !             6:       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
        !             7:       && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
        !             8:       && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
        !             9:       && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
        !            10:       && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
        !            11:       && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
        !            12:       && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
        !            13:       && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
        !            14:       && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
        !            15:       && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
        !            16:       && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
        !            17:       && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
        !            18:       && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
        !            19:       && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
        !            20:       && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
        !            21:       && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
        !            22:       && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
        !            23:       && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
        !            24:       && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
        !            25:       && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
        !            26:       && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
        !            27:       && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
        !            28: /* The character set is not based on ISO-646.  */
        !            29: #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
        !            30: #endif
        !            31: 
        !            32: 
        !            33: /*
        !            34:  * Copyright (C) 2006 Andreas Steffen
        !            35:  * HSR Hochschule fuer Technik Rapperswil
        !            36:  *
        !            37:  * This program is free software; you can redistribute it and/or modify it
        !            38:  * under the terms of the GNU General Public License as published by the
        !            39:  * Free Software Foundation; either version 2 of the License, or (at your
        !            40:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
        !            41:  *
        !            42:  * This program is distributed in the hope that it will be useful, but
        !            43:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
        !            44:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        !            45:  * for more details.
        !            46:  */
        !            47: 
        !            48: #include <string.h>
        !            49: 
        !            50: #include "stroke_keywords.h"
        !            51: 
        !            52: struct stroke_token {
        !            53:     char *name;
        !            54:     stroke_keyword_t kw;
        !            55: };
        !            56: 
        !            57: #define TOTAL_KEYWORDS 48
        !            58: #define MIN_WORD_LENGTH 2
        !            59: #define MAX_WORD_LENGTH 15
        !            60: #define MIN_HASH_VALUE 3
        !            61: #define MAX_HASH_VALUE 59
        !            62: /* maximum key range = 57, duplicates = 0 */
        !            63: 
        !            64: #ifdef __GNUC__
        !            65: __inline
        !            66: #else
        !            67: #ifdef __cplusplus
        !            68: inline
        !            69: #endif
        !            70: #endif
        !            71: static unsigned int
        !            72: hash (register const char *str, register size_t len)
        !            73: {
        !            74:   static const unsigned char asso_values[] =
        !            75:     {
        !            76:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            77:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            78:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            79:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            80:       60, 60, 60, 60, 60, 25, 60, 60, 60, 60,
        !            81:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            82:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            83:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            84:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            85:       60, 60, 60, 60, 60, 60, 60,  0, 18,  1,
        !            86:        1, 15, 60, 23, 60, 23, 60, 11,  0,  7,
        !            87:       60, 24, 14, 60,  6,  9, 16,  9, 60, 60,
        !            88:        2,  3, 60, 60, 60, 60, 60, 60, 60, 60,
        !            89:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            90:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            91:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            92:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            93:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            94:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            95:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            96:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            97:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            98:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !            99:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !           100:       60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
        !           101:       60, 60, 60, 60, 60, 60
        !           102:     };
        !           103:   register unsigned int hval = len;
        !           104: 
        !           105:   switch (hval)
        !           106:     {
        !           107:       default:
        !           108:         hval += asso_values[(unsigned char)str[6]];
        !           109:       /*FALLTHROUGH*/
        !           110:       case 6:
        !           111:       case 5:
        !           112:         hval += asso_values[(unsigned char)str[4]];
        !           113:       /*FALLTHROUGH*/
        !           114:       case 4:
        !           115:       case 3:
        !           116:       case 2:
        !           117:       case 1:
        !           118:         hval += asso_values[(unsigned char)str[0]];
        !           119:         break;
        !           120:     }
        !           121:   return hval;
        !           122: }
        !           123: 
        !           124: static const struct stroke_token wordlist[] =
        !           125:   {
        !           126:     {"add",             STROKE_ADD},
        !           127:     {"del",             STROKE_DEL},
        !           128:     {"down",            STROKE_DOWN},
        !           129:     {"listall",         STROKE_LIST_ALL},
        !           130:     {"listcrls",        STROKE_LIST_CRLS},
        !           131:     {"up",              STROKE_UP},
        !           132:     {"listaacerts",     STROKE_LIST_AACERTS},
        !           133:     {"listcacerts",     STROKE_LIST_CACERTS},
        !           134:     {"rekey",           STROKE_REKEY},
        !           135:     {"rereadall",       STROKE_REREAD_ALL},
        !           136:     {"listcerts",       STROKE_LIST_CERTS},
        !           137:     {"rereadcrls",      STROKE_REREAD_CRLS},
        !           138:     {"rereadacerts",    STROKE_REREAD_ACERTS},
        !           139:     {"rereadaacerts",   STROKE_REREAD_AACERTS},
        !           140:     {"rereadcacerts",   STROKE_REREAD_CACERTS},
        !           141:     {"leases",          STROKE_LEASES},
        !           142:     {"listcounters",    STROKE_COUNTERS},
        !           143:     {"delete",          STROKE_DELETE},
        !           144:     {"status",          STROKE_STATUS},
        !           145:     {"listacerts",      STROKE_LIST_ACERTS},
        !           146:     {"route",           STROKE_ROUTE},
        !           147:     {"statusall",       STROKE_STATUSALL},
        !           148:     {"rereadsecrets",   STROKE_REREAD_SECRETS},
        !           149:     {"statusallnb",     STROKE_STATUSALL_NOBLK},
        !           150:     {"statusall-nb",    STROKE_STATUSALL_NOBLK},
        !           151:     {"listalgs",        STROKE_LIST_ALGS},
        !           152:     {"up-nb",           STROKE_UP_NOBLK},
        !           153:     {"exportx509",      STROKE_EXPORT_X509},
        !           154:     {"listplugins",     STROKE_LIST_PLUGINS},
        !           155:     {"listcainfos",     STROKE_LIST_CAINFOS},
        !           156:     {"exportconncert",  STROKE_EXPORT_CONN_CERT},
        !           157:     {"exportconnchain", STROKE_EXPORT_CONN_CHAIN},
        !           158:     {"loglevel",        STROKE_LOGLEVEL},
        !           159:     {"purgeocsp",       STROKE_PURGE_OCSP},
        !           160:     {"unroute",         STROKE_UNROUTE},
        !           161:     {"listocsp",        STROKE_LIST_OCSP},
        !           162:     {"down-srcip",      STROKE_DOWN_SRCIP},
        !           163:     {"listpubkeys",     STROKE_LIST_PUBKEYS},
        !           164:     {"purgecrls",       STROKE_PURGE_CRLS},
        !           165:     {"rereadocspcerts", STROKE_REREAD_OCSPCERTS},
        !           166:     {"listocspcerts",   STROKE_LIST_OCSPCERTS},
        !           167:     {"memusage",        STROKE_MEMUSAGE},
        !           168:     {"purgeike",        STROKE_PURGE_IKE},
        !           169:     {"user-creds",      STROKE_USER_CREDS},
        !           170:     {"down-nb",         STROKE_DOWN_NOBLK},
        !           171:     {"purgecerts",      STROKE_PURGE_CERTS},
        !           172:     {"listgroups",      STROKE_LIST_GROUPS},
        !           173:     {"resetcounters",   STROKE_COUNTERS_RESET}
        !           174:   };
        !           175: 
        !           176: static const signed char lookup[] =
        !           177:   {
        !           178:     -1, -1, -1,  0,  1,  2, -1,  3, -1,  4, -1,  5,  6,  7,
        !           179:      8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
        !           180:     22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
        !           181:     36, 37, 38, 39, 40, 41, 42, -1, 43, 44, -1, -1, 45, -1,
        !           182:     -1, 46, -1, 47
        !           183:   };
        !           184: 
        !           185: const struct stroke_token *
        !           186: in_word_set (register const char *str, register size_t len)
        !           187: {
        !           188:   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
        !           189:     {
        !           190:       register unsigned int key = hash (str, len);
        !           191: 
        !           192:       if (key <= MAX_HASH_VALUE)
        !           193:         {
        !           194:           register int index = lookup[key];
        !           195: 
        !           196:           if (index >= 0)
        !           197:             {
        !           198:               register const char *s = wordlist[index].name;
        !           199: 
        !           200:               if (*str == *s && !strcmp (str + 1, s + 1))
        !           201:                 return &wordlist[index];
        !           202:             }
        !           203:         }
        !           204:     }
        !           205:   return 0;
        !           206: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>