mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
87 lines
2.1 KiB
Plaintext
87 lines
2.1 KiB
Plaintext
/* C code produced by gperf version 2.7.2 */
|
|
/* Command-line: ../src/gperf -m5 */
|
|
/* Computed positions: -k'1-2' */
|
|
|
|
#define TOTAL_KEYWORDS 4
|
|
#define MIN_WORD_LENGTH 3
|
|
#define MAX_WORD_LENGTH 3
|
|
#define MIN_HASH_VALUE 3
|
|
#define MAX_HASH_VALUE 6
|
|
/* maximum key range = 4, duplicates = 0 */
|
|
|
|
#ifdef __GNUC__
|
|
__inline
|
|
#else
|
|
#ifdef __cplusplus
|
|
inline
|
|
#endif
|
|
#endif
|
|
static unsigned int
|
|
hash (str, len)
|
|
register const char *str;
|
|
register unsigned int len;
|
|
{
|
|
static unsigned char asso_values[] =
|
|
{
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 2, 0, 1,
|
|
0, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
|
7, 7, 7, 7, 7, 7, 7
|
|
};
|
|
return len + asso_values[(unsigned char)str[1]+1] + asso_values[(unsigned char)str[0]];
|
|
}
|
|
|
|
#ifdef __GNUC__
|
|
__inline
|
|
#endif
|
|
const char *
|
|
in_word_set (str, len)
|
|
register const char *str;
|
|
register unsigned int len;
|
|
{
|
|
static const char * wordlist[] =
|
|
{
|
|
"", "", "",
|
|
"bca",
|
|
"cab",
|
|
"acb",
|
|
"abc"
|
|
};
|
|
|
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
|
{
|
|
register int key = hash (str, len);
|
|
|
|
if (key <= MAX_HASH_VALUE && key >= 0)
|
|
{
|
|
register const char *s = wordlist[key];
|
|
|
|
if (*str == *s && !strcmp (str + 1, s + 1))
|
|
return s;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|