Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5131 clevermous 1
/* ANSI-C code produced by gperf version 2.7 */
2
/* Command-line: gperf -c -C -l -L ANSI-C -f 0 -G -t bdf.in  */
3
struct bdfword { char *name; int code; };
4
 
5
#define TOTAL_KEYWORDS 21
6
#define MIN_WORD_LENGTH 3
7
#define MAX_WORD_LENGTH 15
8
#define MIN_HASH_VALUE 3
9
#define MAX_HASH_VALUE 37
10
/* maximum key range = 35, duplicates = 0 */
11
 
12
#ifdef __GNUC__
13
__inline
14
#endif
15
static unsigned int
16
hash (register const char *str, register unsigned int len)
17
{
18
  static const unsigned char asso_values[] =
19
    {
20
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
21
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
22
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
23
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
24
      38, 38, 38, 38, 38, 38, 38, 38, 38,  5,
25
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
26
      38, 38, 38, 38, 38, 38,  0, 20,  5,  0,
27
      15,  0,  0, 38, 38, 38, 38,  0,  0, 38,
28
      10, 38, 15,  0,  0, 38, 15, 38,  0, 38,
29
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
30
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
31
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
32
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
33
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
34
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
35
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
36
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
37
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
38
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
39
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
40
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
41
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
42
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
43
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
44
      38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
45
      38, 38, 38, 38, 38, 38
46
    };
47
  return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
48
}
49
 
50
static const unsigned char lengthtable[] =
51
  {
52
     0,  0,  0,  3,  4,  0,  6,  7,  8,  9, 10,  6,  7, 13,
53
     0, 15,  6,  7,  0,  4,  0,  0,  7,  0,  9,  5,  0,  7,
54
     0,  0, 15,  0,  0,  0, 14,  0,  0,  7
55
  };
56
 
57
static const struct bdfword wordlist[] =
58
  {
59
    {""}, {""}, {""},
60
    {"BBX",BBX},
61
    {"SIZE",SIZE},
62
    {""},
63
    {"SWIDTH",SWIDTH},
64
    {"ENDFONT",ENDFONT},
65
    {"ENCODING",ENCODING},
66
    {"STARTFONT",STARTFONT},
67
    {"METRICSSET",METRICSSET},
68
    {"DWIDTH",DWIDTH},
69
    {"SWIDTH1",SWIDTH1},
70
    {"ENDPROPERTIES",ENDPROPERTIES},
71
    {""},
72
    {"STARTPROPERTIES",STARTPROPERTIES},
73
    {"BITMAP",BITMAP},
74
    {"DWIDTH1",DWIDTH1},
75
    {""},
76
    {"FONT",FONT},
77
    {""}, {""},
78
    {"ENDCHAR",ENDCHAR},
79
    {""},
80
    {"STARTCHAR",STARTCHAR},
81
    {"CHARS",CHARS},
82
    {""},
83
    {"COMMENT",COMMENT},
84
    {""}, {""},
85
    {"FONTBOUNDINGBOX",FONTBOUNDINGBOX},
86
    {""}, {""}, {""},
87
    {"CONTENTVERSION",CONTENTVERSION},
88
    {""}, {""},
89
    {"VVECTOR",VVECTOR}
90
  };
91
 
92
#ifdef __GNUC__
93
__inline
94
#endif
95
const struct bdfword *
96
in_word_set (register const char *str, register unsigned int len)
97
{
98
  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
99
    {
100
      register int key = hash (str, len);
101
 
102
      if (key <= MAX_HASH_VALUE && key >= 0)
103
        if (len == lengthtable[key])
104
          {
105
            register const char *s = wordlist[key].name;
106
 
107
            if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
108
              return &wordlist[key];
109
          }
110
    }
111
  return 0;
112
}