1%{
2/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3/* htmlentity.c
4 *
5 * This file is part of the GtkHTML library.
6 *
7 * Copyright (C) 1999  Helix Code, Inc.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB.  If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 * Author: Ettore Perazzoli
24 */
25
26#include <config.h>
27#include <string.h>
28#include <stdlib.h>
29
30#include <glib.h>
31#include <lua-library/htmlentity.h>
32
33#ifdef __GNUC__
34_Pragma ("GCC diagnostic push")
35_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"")
36#endif
37
38%}
39struct _EntityEntry {
40	const gchar *name;
41	gulong value;
42};
43%%
44Aacute, 193
45aacute, 225
46Acirc, 194
47acirc, 226
48acute, 180
49AElig, 198
50aelig, 230
51Agrave, 192
52agrave, 224
53alefsym, 8501
54Alpha, 913
55alpha, 945
56amp, 38
57and, 8743
58ang, 8736
59apos, 39
60Aring, 197
61aring, 229
62asymp, 8776
63Atilde, 195
64atilde, 227
65Auml, 196
66auml, 228
67bdquo, 8222
68Beta, 914
69beta, 946
70brvbar, 166
71bull, 8226
72cap, 8745
73Ccedil, 199
74ccedil, 231
75cedil, 184
76cent, 162
77Chi, 935
78chi, 967
79circ, 710
80clubs, 9827
81cong, 8773
82copy, 169
83crarr, 8629
84cup, 8746
85curren, 164
86dagger, 8224
87Dagger, 8225
88darr, 8595
89dArr, 8659
90deg, 176
91Delta, 916
92delta, 948
93diams, 9830
94divide, 247
95Eacute, 201
96eacute, 233
97Ecirc, 202
98ecirc, 234
99Egrave, 200
100egrave, 232
101empty, 8709
102emsp, 8195
103ensp, 8194
104Epsilon, 917
105epsilon, 949
106equiv, 8801
107Eta, 919
108eta, 951
109ETH, 208
110eth, 240
111Euml, 203
112euml, 235
113euro, 8364
114exist, 8707
115fnof, 402
116forall, 8704
117frac12, 189
118frac14, 188
119frac34, 190
120frasl, 8260
121Gamma, 915
122gamma, 947
123ge, 8805
124gt, 62
125harr, 8596
126hArr, 8660
127hearts, 9829
128hellip, 8230
129Iacute, 205
130iacute, 237
131Icirc, 206
132icirc, 238
133iexcl, 161
134Igrave, 204
135igrave, 236
136image, 8465
137infin, 8734
138int, 8747
139Iota, 921
140iota, 953
141iquest, 191
142isin, 8712
143Iuml, 207
144iuml, 239
145Kappa, 922
146kappa, 954
147Lambda, 923
148lambda, 955
149lang, 9001
150laquo, 171
151larr, 8592
152lArr, 8656
153lceil, 8968
154ldquo, 8220
155le, 8804
156lfloor, 8970
157lowast, 8727
158loz, 9674
159lrm, 8206
160lsaquo, 8249
161lsquo, 8216
162lt, 60
163macr, 175
164mdash, 8212
165micro, 181
166middot, 183
167minus, 8722
168Mu, 924
169mu, 956
170nabla, 8711
171nbsp, 160
172ndash, 8211
173ne, 8800
174ni, 8715
175not, 172
176notin, 8713
177nsub, 8836
178Ntilde, 209
179ntilde, 241
180Nu, 925
181nu, 957
182Oacute, 211
183oacute, 243
184Ocirc, 212
185ocirc, 244
186OElig, 338
187oelig, 339
188Ograve, 210
189ograve, 242
190oline, 8254
191Omega, 937
192omega, 969
193Omicron, 927
194omicron, 959
195oplus, 8853
196or, 8744
197ordf, 170
198ordm, 186
199Oslash, 216
200oslash, 248
201Otilde, 213
202otilde, 245
203otimes, 8855
204Ouml, 214
205ouml, 246
206para, 182
207part, 8706
208permil, 8240
209perp, 8869
210Phi, 934
211phi, 966
212Pi, 928
213pi, 960
214piv, 982
215plusmn, 177
216pound, 163
217prime, 8242
218Prime, 8243
219prod, 8719
220prop, 8733
221Psi, 936
222psi, 968
223quot, 34
224radic, 8730
225rang, 9002
226raquo, 187
227rarr, 8594
228rArr, 8658
229rceil, 8969
230rdquo, 8221
231real, 8476
232reg, 174
233rfloor, 8971
234Rho, 929
235rho, 961
236rlm, 8207
237rsaquo, 8250
238rsquo, 8217
239sbquo, 8218
240Scaron, 352
241scaron, 353
242sdot, 8901
243sect, 167
244shy, 173
245Sigma, 931
246sigma, 963
247sigmaf, 962
248sim, 8764
249spades, 9824
250sub, 8834
251sube, 8838
252sum, 8721
253sup1, 185
254sup2, 178
255sup3, 179
256sup, 8835
257supe, 8839
258szlig, 223
259Tau, 932
260tau, 964
261there4, 8756
262Theta, 920
263theta, 952
264thetasym, 977
265thinsp, 8201
266THORN, 222
267thorn, 254
268tilde, 732
269times, 215
270trade, 8482
271Uacute, 218
272uacute, 250
273uarr, 8593
274uArr, 8657
275Ucirc, 219
276ucirc, 251
277Ugrave, 217
278ugrave, 249
279uml, 168
280upsih, 978
281Upsilon, 933
282upsilon, 965
283Uuml, 220
284uuml, 252
285weierp, 8472
286Xi, 926
287xi, 958
288Yacute, 221
289yacute, 253
290yen, 165
291yuml, 255
292Yuml, 376
293Zeta, 918
294zeta, 950
295zwj, 8205
296zwnj, 8204
297%%
298
299#ifdef __GNUC__
300_Pragma ("GCC diagnostic pop")
301#endif
302
303gulong
304html_entity_parse (const gchar *s, guint len)
305{
306	struct _EntityEntry * result = html_entity_hash( s, len);
307	if (result == NULL )
308		return ' ';
309	return result->value;
310}
311