root / libsylph / html.h @ 2071
History | View | Annotate | Download (1.7 kB)
| 1 | 540 | hiro | /*
|
|---|---|---|---|
| 2 | 578 | hiro | * LibSylph -- E-Mail client library |
| 3 | 540 | hiro | * Copyright (C) 1999-2005 Hiroyuki Yamamoto |
| 4 | 540 | hiro | * |
| 5 | 578 | hiro | * This library is free software; you can redistribute it and/or |
| 6 | 578 | hiro | * modify it under the terms of the GNU Lesser General Public |
| 7 | 578 | hiro | * License as published by the Free Software Foundation; either |
| 8 | 578 | hiro | * version 2.1 of the License, or (at your option) any later version. |
| 9 | 540 | hiro | * |
| 10 | 578 | hiro | * This library is distributed in the hope that it will be useful, |
| 11 | 540 | hiro | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | 578 | hiro | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | 578 | hiro | * Lesser General Public License for more details. |
| 14 | 540 | hiro | * |
| 15 | 578 | hiro | * You should have received a copy of the GNU Lesser General Public |
| 16 | 578 | hiro | * License along with this library; if not, write to the Free Software |
| 17 | 578 | hiro | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | 540 | hiro | */ |
| 19 | 540 | hiro | |
| 20 | 540 | hiro | #ifndef __HTML_H__
|
| 21 | 540 | hiro | #define __HTML_H__
|
| 22 | 540 | hiro | |
| 23 | 540 | hiro | #include <glib.h> |
| 24 | 540 | hiro | #include <stdio.h> |
| 25 | 540 | hiro | |
| 26 | 540 | hiro | #include "codeconv.h" |
| 27 | 540 | hiro | |
| 28 | 540 | hiro | typedef enum |
| 29 | 540 | hiro | {
|
| 30 | 540 | hiro | HTML_NORMAL, |
| 31 | 540 | hiro | HTML_PAR, |
| 32 | 540 | hiro | HTML_BR, |
| 33 | 540 | hiro | HTML_HR, |
| 34 | 540 | hiro | HTML_HREF, |
| 35 | 540 | hiro | HTML_IMG, |
| 36 | 540 | hiro | HTML_FONT, |
| 37 | 540 | hiro | HTML_PRE, |
| 38 | 540 | hiro | HTML_UNKNOWN, |
| 39 | 540 | hiro | HTML_CONV_FAILED, |
| 40 | 540 | hiro | HTML_ERR, |
| 41 | 540 | hiro | HTML_EOF |
| 42 | 540 | hiro | } HTMLState; |
| 43 | 540 | hiro | |
| 44 | 540 | hiro | typedef struct _HTMLParser HTMLParser; |
| 45 | 540 | hiro | typedef struct _HTMLAttr HTMLAttr; |
| 46 | 540 | hiro | typedef struct _HTMLTag HTMLTag; |
| 47 | 540 | hiro | |
| 48 | 540 | hiro | struct _HTMLParser
|
| 49 | 540 | hiro | {
|
| 50 | 540 | hiro | FILE *fp; |
| 51 | 540 | hiro | CodeConverter *conv; |
| 52 | 540 | hiro | |
| 53 | 540 | hiro | GHashTable *symbol_table; |
| 54 | 540 | hiro | |
| 55 | 540 | hiro | GString *str; |
| 56 | 540 | hiro | GString *buf; |
| 57 | 540 | hiro | |
| 58 | 540 | hiro | gchar *bufp; |
| 59 | 540 | hiro | |
| 60 | 540 | hiro | HTMLState state; |
| 61 | 540 | hiro | |
| 62 | 540 | hiro | gchar *href; |
| 63 | 540 | hiro | |
| 64 | 540 | hiro | gboolean newline; |
| 65 | 540 | hiro | gboolean empty_line; |
| 66 | 540 | hiro | gboolean space; |
| 67 | 540 | hiro | gboolean pre; |
| 68 | 540 | hiro | }; |
| 69 | 540 | hiro | |
| 70 | 540 | hiro | struct _HTMLAttr
|
| 71 | 540 | hiro | {
|
| 72 | 540 | hiro | gchar *name; |
| 73 | 540 | hiro | gchar *value; |
| 74 | 540 | hiro | }; |
| 75 | 540 | hiro | |
| 76 | 540 | hiro | struct _HTMLTag
|
| 77 | 540 | hiro | {
|
| 78 | 540 | hiro | gchar *name; |
| 79 | 540 | hiro | GList *attr; |
| 80 | 540 | hiro | }; |
| 81 | 540 | hiro | |
| 82 | 540 | hiro | HTMLParser *html_parser_new (FILE *fp, |
| 83 | 540 | hiro | CodeConverter *conv); |
| 84 | 540 | hiro | void html_parser_destroy (HTMLParser *parser);
|
| 85 | 540 | hiro | const gchar *html_parse (HTMLParser *parser);
|
| 86 | 540 | hiro | |
| 87 | 540 | hiro | #endif /* __HTML_H__ */ |