(root)/
gettext-0.22.4/
gettext-runtime/
gnulib-lib/
iconv_open-solaris.h
       1  /* ANSI-C code produced by gperf version 3.2 */
       2  /* Command-line: gperf -m 10 ./iconv_open-solaris.gperf  */
       3  /* Computed positions: -k'10' */
       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  #line 17 "./iconv_open-solaris.gperf"
      33  struct mapping { int standard_name; const char vendor_name[10 + 1]; };
      34  
      35  #define TOTAL_KEYWORDS 13
      36  #define MIN_WORD_LENGTH 5
      37  #define MAX_WORD_LENGTH 11
      38  #define MIN_HASH_VALUE 5
      39  #define MAX_HASH_VALUE 19
      40  /* maximum key range = 15, duplicates = 0 */
      41  
      42  #ifdef __GNUC__
      43  __inline
      44  #else
      45  #ifdef __cplusplus
      46  inline
      47  #endif
      48  #endif
      49  static unsigned int
      50  mapping_hash (register const char *str, register size_t len)
      51  {
      52    static const unsigned char asso_values[] =
      53      {
      54        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      55        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      56        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      57        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      58        20, 20, 20, 20, 20, 20, 20, 20, 20,  0,
      59         9,  8,  7,  6,  5,  4,  3,  2, 20, 20,
      60        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      61        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      62        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      63        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      64        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      65        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      66        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      67        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      68        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      69        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      70        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      71        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      72        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      73        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      74        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      75        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      76        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      77        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      78        20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
      79        20, 20, 20, 20, 20, 20
      80      };
      81    register unsigned int hval = len;
      82  
      83    switch (hval)
      84      {
      85        default:
      86          hval += asso_values[(unsigned char)str[9]];
      87  #if defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang_major__ && defined __clang_minor__ && __clang_major__ + (__clang_minor__ >= 9) > 3))
      88        [[fallthrough]];
      89  #elif defined __GNUC__ && __GNUC__ >= 7
      90        __attribute__ ((__fallthrough__));
      91  #endif
      92        /*FALLTHROUGH*/
      93        case 9:
      94        case 8:
      95        case 7:
      96        case 6:
      97        case 5:
      98          break;
      99      }
     100    return hval;
     101  }
     102  
     103  struct stringpool_t
     104    {
     105      char stringpool_str5[sizeof("ASCII")];
     106      char stringpool_str6[sizeof("CP1251")];
     107      char stringpool_str7[sizeof("$   abc")];
     108      char stringpool_str10[sizeof("ISO-8859-1")];
     109      char stringpool_str11[sizeof("ISO-8859-15")];
     110      char stringpool_str12[sizeof("ISO-8859-9")];
     111      char stringpool_str13[sizeof("ISO-8859-8")];
     112      char stringpool_str14[sizeof("ISO-8859-7")];
     113      char stringpool_str15[sizeof("ISO-8859-6")];
     114      char stringpool_str16[sizeof("ISO-8859-5")];
     115      char stringpool_str17[sizeof("ISO-8859-4")];
     116      char stringpool_str18[sizeof("ISO-8859-3")];
     117      char stringpool_str19[sizeof("ISO-8859-2")];
     118    };
     119  static const struct stringpool_t stringpool_contents =
     120    {
     121      "ASCII",
     122      "CP1251",
     123      "$   abc",
     124      "ISO-8859-1",
     125      "ISO-8859-15",
     126      "ISO-8859-9",
     127      "ISO-8859-8",
     128      "ISO-8859-7",
     129      "ISO-8859-6",
     130      "ISO-8859-5",
     131      "ISO-8859-4",
     132      "ISO-8859-3",
     133      "ISO-8859-2"
     134    };
     135  #define stringpool ((const char *) &stringpool_contents)
     136  
     137  static const struct mapping mappings[] =
     138    {
     139      {-1}, {-1}, {-1}, {-1}, {-1},
     140  #line 35 "./iconv_open-solaris.gperf"
     141      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, "646"},
     142  #line 46 "./iconv_open-solaris.gperf"
     143      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "ansi-1251"},
     144  #line 34 "./iconv_open-solaris.gperf"
     145      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7},
     146      {-1}, {-1},
     147  #line 36 "./iconv_open-solaris.gperf"
     148      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-1"},
     149  #line 45 "./iconv_open-solaris.gperf"
     150      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "ISO8859-15"},
     151  #line 44 "./iconv_open-solaris.gperf"
     152      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-9"},
     153  #line 43 "./iconv_open-solaris.gperf"
     154      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-8"},
     155  #line 42 "./iconv_open-solaris.gperf"
     156      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "ISO8859-7"},
     157  #line 41 "./iconv_open-solaris.gperf"
     158      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "ISO8859-6"},
     159  #line 40 "./iconv_open-solaris.gperf"
     160      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "ISO8859-5"},
     161  #line 39 "./iconv_open-solaris.gperf"
     162      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "ISO8859-4"},
     163  #line 38 "./iconv_open-solaris.gperf"
     164      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-3"},
     165  #line 37 "./iconv_open-solaris.gperf"
     166      {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-2"}
     167    };
     168  
     169  const struct mapping *
     170  mapping_lookup (register const char *str, register size_t len)
     171  {
     172    if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     173      {
     174        register unsigned int key = mapping_hash (str, len);
     175  
     176        if (key <= MAX_HASH_VALUE)
     177          {
     178            register int o = mappings[key].standard_name;
     179            if (o >= 0)
     180              {
     181                register const char *s = o + stringpool;
     182  
     183                if (*str == *s && !strcmp (str + 1, s + 1))
     184                  return &mappings[key];
     185              }
     186          }
     187      }
     188    return 0;
     189  }