fix bug 2989, 'Segfault at startup because of corrupted folderlist.xml'
[claws.git] / src / html.h
blobad81f2556ea0b3a7150f4ea0f09e369dc3367aba
1 /*
2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef __HTML_H__
21 #define __HTML_H__
23 #include <glib.h>
24 #include <stdio.h>
26 #include "codeconv.h"
28 typedef enum
30 SC_HTML_NORMAL,
31 SC_HTML_PAR,
32 SC_HTML_BR,
33 SC_HTML_HR,
34 SC_HTML_HREF,
35 SC_HTML_IMG,
36 SC_HTML_FONT,
37 SC_HTML_PRE,
38 SC_HTML_UNKNOWN,
39 SC_HTML_CONV_FAILED,
40 SC_HTML_ERR,
41 SC_HTML_EOF,
42 SC_HTML_HREF_BEG
43 } SC_HTMLState;
45 typedef struct _SC_HTMLParser SC_HTMLParser;
46 typedef struct _SC_HTMLAttr SC_HTMLAttr;
47 typedef struct _SC_HTMLTag SC_HTMLTag;
49 struct _SC_HTMLParser
51 FILE *fp;
52 CodeConverter *conv;
54 GHashTable *symbol_table;
55 GHashTable *alt_symbol_table;
57 GString *str;
58 GString *buf;
60 gchar *bufp;
62 SC_HTMLState state;
64 gchar *href;
66 gboolean newline;
67 gboolean empty_line;
68 gboolean space;
69 gboolean pre;
72 struct _SC_HTMLAttr
74 gchar *name;
75 gchar *value;
78 struct _SC_HTMLTag
80 gchar *name;
81 GList *attr;
84 SC_HTMLParser *sc_html_parser_new (FILE *fp,
85 CodeConverter *conv);
86 void sc_html_parser_destroy (SC_HTMLParser *parser);
87 gchar *sc_html_parse (SC_HTMLParser *parser);
89 #endif /* __HTML_H__ */