From 163ad56fce1b8d83d43034620a8d5c847785edf7 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 23 Sep 2008 02:19:50 +0000 Subject: Rework html parser bindings to have a common API and reside in separate files for ease of reading. Add error handling to hubbub binding. svn path=/trunk/netsurf/; revision=5404 --- render/parser_binding.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 render/parser_binding.h (limited to 'render/parser_binding.h') diff --git a/render/parser_binding.h b/render/parser_binding.h new file mode 100644 index 000000000..73e6e9708 --- /dev/null +++ b/render/parser_binding.h @@ -0,0 +1,48 @@ +/* + * Copyright 2008 John-Mark Bell + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef _NETSURF_RENDER_PARSER_BINDING_H_ +#define _NETSURF_RENDER_PARSER_BINDING_H_ + +#include + +#include + +typedef enum binding_error { + BINDING_OK, + BINDING_NOMEM, + BINDING_ENCODINGCHANGE +} binding_error; + +typedef enum binding_encoding_source { + ENCODING_SOURCE_HEADER, + ENCODING_SOURCE_DETECTED, + ENCODING_SOURCE_META +} binding_encoding_source; + +void *binding_create_tree(void *arena, const char *charset); +void binding_destroy_tree(void *ctx); + +binding_error binding_parse_chunk(void *ctx, const uint8_t *data, size_t len); +binding_error binding_parse_completed(void *ctx); + +const char *binding_get_encoding(void *ctx, binding_encoding_source *source); +xmlDocPtr binding_get_document(void *ctx); + +#endif + -- cgit v1.2.3