1 /* C code produced by gperf version 2.5 (GNU C++ version) */
2 /* Command-line: gperf -tpacCg -k* -N etags_lookup -H etags_hash -K enriched_tag etags.gperf */ /* etags.gperf -*- C -*- Map enriched to html tags
3 * Praveen Yaramada
4 * gperf -tpacCg -k "*" -N etags_lookup -H etags_hash -K enriched_tag etags.gperf > etags.c
5 */
6
7 #include "string.h"
8 #include "enriched.h"
9
10 struct etags_rec { const char *enriched_tag; const char *html_tag; int html_tag_len; EnrichedTag et; };
11
12 #define TOTAL_KEYWORDS 35
13 #define MIN_WORD_LENGTH 1
14 #define MAX_WORD_LENGTH 13
15 #define MIN_HASH_VALUE 1
16 #define MAX_HASH_VALUE 118
17 /* maximum key range = 118, duplicates = 0 */
18
19 #ifdef __GNUC__
20 inline
21 #endif
22 static unsigned int
etags_hash(register const char * str,register int len)23 etags_hash (register const char *str, register int len)
24 {
25 static const unsigned char asso_values[] =
26 {
27 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
28 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
29 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
30 119, 119, 119, 119, 119, 119, 119, 119, 5, 119,
31 119, 119, 119, 119, 119, 119, 119, 0, 119, 119,
32 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
33 0, 119, 0, 119, 119, 119, 119, 119, 119, 119,
34 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
35 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
36 119, 119, 119, 119, 119, 119, 119, 10, 35, 10,
37 20, 0, 0, 10, 0, 0, 119, 119, 0, 20,
38 0, 50, 0, 119, 0, 0, 0, 0, 119, 119,
39 15, 15, 119, 119, 119, 119, 119, 119,
40 };
41 register int hval = len;
42
43 switch (hval)
44 {
45 default:
46 case 13:
47 hval += asso_values[ (int) str [12] ];
48 case 12:
49 hval += asso_values[ (int) str [11] ];
50 case 11:
51 hval += asso_values[ (int) str [10] ];
52 case 10:
53 hval += asso_values[ (int) str [9] ];
54 case 9:
55 hval += asso_values[ (int) str [8] ];
56 case 8:
57 hval += asso_values[ (int) str [7] ];
58 case 7:
59 hval += asso_values[ (int) str [6] ];
60 case 6:
61 hval += asso_values[ (int) str [5] ];
62 case 5:
63 hval += asso_values[ (int) str [4] ];
64 case 4:
65 hval += asso_values[ (int) str [3] ];
66 case 3:
67 hval += asso_values[ (int) str [2] ];
68 case 2:
69 hval += asso_values[ (int) str [1] ];
70 case 1:
71 hval += asso_values[ (int) str [0] ];
72 }
73 return hval;
74 }
75
76 #ifdef __GNUC__
77 inline
78 #endif
79 const struct etags_rec *
etags_lookup(register const char * str,register int len)80 etags_lookup (register const char *str, register int len)
81 {
82 static const struct etags_rec wordlist[] =
83 {
84 {"", "", 0, 0},
85 {">", ">", 4, CHARTAG},
86 {"<<", "<", 4, CHARTAG},
87 {"","",0,0}, {"","",0,0}, {"","",0,0},
88 {"&", "&", 5, CHARTAG},
89 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
90 {"<flushleft>", "<div align=left>", 16, FLUSHLEFT},
91 {"</flushleft>", "</div>", 6, XFLUSHLEFT},
92 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
93 {"<center>", "<center>", 8, CENTER},
94 {"</center>", "</center>", 9, XCENTER},
95 {"","",0,0}, {"","",0,0},
96 {"<flushright>", "<div align=right>", 17, FLUSHRIGHT},
97 {"</flushright>", "</div>", 6, XFLUSHRIGHT},
98 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
99 {"<italic>", "<i>", 3, ITALIC},
100 {"</italic>", "</i>", 4, XITALIC},
101 {"","",0,0},
102 {"<underline>", "<u>", 3, UNDERLINE},
103 {"</underline>", "</u>", 4, XUNDERLINE},
104 {"","",0,0},
105 {"<excerpt>", "<blockquote type=cite>", 22, EXCERPT},
106 {"</excerpt>", "</blockquote>", 13, XEXCERPT},
107 {"","",0,0}, {"","",0,0}, {"","",0,0},
108 {"<smaller>", "<small>", 7, SMALLER},
109 {"</smaller>", "</small>", 8, XSMALLER},
110 {"","",0,0},
111 {"<fixed>", "<tt>", 4, FIXED},
112 {"</fixed>", "</tt>", 5, XFIXED},
113 {"","",0,0}, {"","",0,0}, {"","",0,0},
114 {"<param>", "<?param >", 6, PARAM},
115 {"</param>", "\">", 2, XPARAM},
116 {"","",0,0}, {"","",0,0}, {"","",0,0},
117 {"<paraindent>", "", 0, PARAINDENT},
118 {"</paraindent>", "", 0, XPARAINDENT},
119 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
120 {"<nofill>", "<pre>", 5, NOFILLV},
121 {"</nofill>", "</pre>", 6, XNOFILLV},
122 {"","",0,0}, {"","",0,0}, {"","",0,0},
123 {"<bigger>", "<big>", 5, BIGGER},
124 {"</bigger>", "</big>", 6, XBIGGER},
125 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
126 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
127 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
128 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
129 {"<flushboth>", "<div align=justify>", 19, FLUSHBOTH},
130 {"</flushboth>", "</div>", 6, XFLUSHBOTH},
131 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
132 {"<fontfamily>", "<font face=\"", 12, FONTFAMILY},
133 {"</fontfamily>", "</font>", 7, XFONTFAMILY},
134 {"","",0,0}, {"","",0,0},
135 {"<bold>", "<b>", 3, BOLD},
136 {"</bold>", "</b>", 4, XBOLD},
137 {"","",0,0}, {"","",0,0}, {"","",0,0}, {"","",0,0},
138 {"<color>", "<font color=\"", 13, COLOR},
139 {"</color>", "</font>", 7, XCOLOR},
140 };
141
142 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
143 {
144 register int key = etags_hash (str, len);
145
146 if (key <= MAX_HASH_VALUE && key >= 0)
147 {
148 register const char *s = wordlist[key].enriched_tag;
149
150 if (*s == *str && !strncmp (str + 1, s + 1, len - 1))
151 return &wordlist[key];
152 }
153 }
154 return 0;
155 }
156