Statistics
| Revision:

root / src / html.h @ 1

History | View | Annotate | Download (1.7 KB)

1
/*
2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2003 Hiroyuki Yamamoto
4
 *
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 2 of the License, or
8
 * (at your option) any later version.
9
 *
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.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 */
19

    
20
#ifndef __HTML_H__
21
#define __HTML_H__
22

    
23
#include <glib.h>
24
#include <stdio.h>
25

    
26
#include "codeconv.h"
27

    
28
typedef enum
29
{
30
        HTML_NORMAL,
31
        HTML_PAR,
32
        HTML_BR,
33
        HTML_HR,
34
        HTML_HREF,
35
        HTML_IMG,
36
        HTML_FONT,
37
        HTML_PRE,
38
        HTML_UNKNOWN,
39
        HTML_CONV_FAILED,
40
        HTML_ERR,
41
        HTML_EOF
42
} HTMLState;
43

    
44
typedef struct _HTMLParser        HTMLParser;
45
typedef struct _HTMLAttr        HTMLAttr;
46
typedef struct _HTMLTag                HTMLTag;
47

    
48
struct _HTMLParser
49
{
50
        FILE *fp;
51
        CodeConverter *conv;
52

    
53
        GHashTable *symbol_table;
54

    
55
        GString *str;
56
        GString *buf;
57

    
58
        gchar *bufp;
59

    
60
        HTMLState state;
61

    
62
        gchar *href;
63

    
64
        gboolean newline;
65
        gboolean empty_line;
66
        gboolean space;
67
        gboolean pre;
68
};
69

    
70
struct _HTMLAttr
71
{
72
        gchar *name;
73
        gchar *value;
74
};
75

    
76
struct _HTMLTag
77
{
78
        gchar *name;
79
        GList *attr;
80
};
81

    
82
HTMLParser *html_parser_new        (FILE                *fp,
83
                                 CodeConverter        *conv);
84
void html_parser_destroy        (HTMLParser        *parser);
85
gchar *html_parse                (HTMLParser        *parser);
86

    
87
#endif /* __HTML_H__ */