root / libsylph / html.h @ 578
History | View | Annotate | Download (1.7 kB)
| 1 | /*
|
|---|---|
| 2 | * LibSylph -- E-Mail client library |
| 3 | * Copyright (C) 1999-2005 Hiroyuki Yamamoto |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library 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 GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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 | const gchar *html_parse (HTMLParser *parser);
|
| 86 | |
| 87 | #endif /* __HTML_H__ */ |