From 276b588217a7cae8518e9a310c94ae49fb10350c Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 2 Jan 2013 15:05:55 +0100 Subject: [PATCH 1/4] Add custom xml parser. Use as fallback. --- Makefile | 11 +- Makefile.win | 15 +- cheats.c | 7 + compat/rxml/Makefile | 20 ++ compat/rxml/rxml.c | 426 ++++++++++++++++++++++++++++++++++++++++ compat/rxml/rxml.h | 77 ++++++++ compat/rxml/rxml_test.c | 58 ++++++ config.features.h | 6 +- driver.c | 6 - file.c | 2 - general.h | 2 - gfx/gl.c | 10 +- gfx/shader_glsl.c | 15 +- qb/config.libs.sh | 4 +- qb/config.params.sh | 2 +- retroarch.c | 14 +- settings.c | 6 +- 17 files changed, 623 insertions(+), 58 deletions(-) create mode 100644 compat/rxml/Makefile create mode 100644 compat/rxml/rxml.c create mode 100644 compat/rxml/rxml.h create mode 100644 compat/rxml/rxml_test.c diff --git a/Makefile b/Makefile index e3f5a21c1f..3639f7cc37 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ OBJ = retroarch.o \ fifo_buffer.o \ compat/compat.o \ audio/null.o \ + cheats.o \ gfx/null.o \ conf/config_file.o \ input/null.o \ @@ -238,10 +239,11 @@ ifeq ($(HAVE_CG), 1) endif endif -ifeq ($(HAVE_XML), 1) - OBJ += cheats.o - LIBS += $(XML_LIBS) - DEFINES += $(XML_CFLAGS) +ifeq ($(HAVE_LIBXML2), 1) + LIBS += $(LIBXML2_LIBS) + DEFINES += $(LIBXML2_CFLAGS) +else + OBJ += compat/rxml/rxml.o endif ifeq ($(HAVE_DYLIB), 1) @@ -380,6 +382,7 @@ clean: rm -f gfx/py_state/*.o rm -f gfx/scaler/*.o rm -f compat/*.o + rm -f compat/rxml/*.o rm -f record/*.o rm -f input/*.o rm -f tools/*.o diff --git a/Makefile.win b/Makefile.win index 182f6cca9a..3f95c7a6c9 100644 --- a/Makefile.win +++ b/Makefile.win @@ -17,6 +17,7 @@ OBJ = retroarch.o \ patch.o \ compat/compat.o \ screenshot.o \ + cheats.o \ audio/utils.o \ audio/null.o \ input/null.o \ @@ -60,7 +61,7 @@ DYNAMIC = 1 ifeq ($(SLIM),) HAVE_SDL = 1 HAVE_SDL_IMAGE = 1 - HAVE_XML = 1 + HAVE_LIBXML2 = 1 HAVE_FREETYPE = 1 HAVE_RSOUND = 1 HAVE_FBO = 1 @@ -103,8 +104,8 @@ ifeq ($(HAVE_THREADS), 1) endif ifeq ($(HAVE_OPENGL), 1) - OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/wgl_ctx.o - DEFINES += -DHAVE_OPENGL -DHAVE_OVERLAY + OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/wgl_ctx.o gfx/shader_glsl.o + DEFINES += -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_GLSL LIBS += -lopengl32 -lgdi32 endif @@ -145,10 +146,11 @@ ifeq ($(HAVE_RSOUND), 1) LIBS += -lrsound endif -ifeq ($(HAVE_XML), 1) - OBJ += gfx/shader_glsl.o cheats.o - DEFINES += -Ilibxml2 -DHAVE_XML -DHAVE_GLSL +ifeq ($(HAVE_LIBXML2), 1) + DEFINES += -Ilibxml2 -DHAVE_LIBXML2 -DHAVE_GLSL LIBS += -lxml2 -liconv +else + OBJ += compat/rxml/rxml.o endif ifeq ($(HAVE_DYLIB), 1) @@ -258,6 +260,7 @@ clean: rm -f audio/*.o rm -f audio/xaudio-c/*.o rm -f compat/*.o + rm -f compat/rxml/*.o rm -f conf/*.o rm -f gfx/scaler/*.o rm -f gfx/*.o diff --git a/cheats.c b/cheats.c index 5ddb3fae64..e69c82eb87 100644 --- a/cheats.c +++ b/cheats.c @@ -30,8 +30,13 @@ #include #include +#ifdef HAVE_LIBXML2 #include #include +#else +#define RXML_LIBXML2_COMPAT +#include "compat/rxml/rxml.h" +#endif struct cheat { @@ -252,11 +257,13 @@ cheat_manager_t *cheat_manager_new(const char *path) goto error; } +#ifdef HAVE_LIBXML2 if (ctx->valid == 0) { RARCH_ERR("Cannot validate XML file: %s\n", path); goto error; } +#endif head = xmlDocGetRootElement(doc); for (cur = head; cur; cur = cur->next) diff --git a/compat/rxml/Makefile b/compat/rxml/Makefile new file mode 100644 index 0000000000..30a4818eba --- /dev/null +++ b/compat/rxml/Makefile @@ -0,0 +1,20 @@ +TARGET := rxml + +SOURCES := $(wildcard *.c) +OBJS := $(SOURCES:.c=.o) + +CFLAGS += -Wall -pedantic -std=gnu99 -O3 -g + +all: $(TARGET) + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) + +$(TARGET): $(OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +clean: + rm -f $(TARGET) $(OBJS) + +.PHONY: clean + diff --git a/compat/rxml/rxml.c b/compat/rxml/rxml.c new file mode 100644 index 0000000000..95dbb6bab2 --- /dev/null +++ b/compat/rxml/rxml.c @@ -0,0 +1,426 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2013 - Hans-Kristian Arntzen + * + * RetroArch 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 Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch 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 RetroArch. + * If not, see . + */ + +#include "rxml.h" +#include +#include +#include +#include +#include +#include +#include "../../boolean.h" +#include "../../general.h" + +struct rxml_document +{ + struct rxml_node *root_node; +}; + +struct rxml_node *rxml_root_node(rxml_document_t *doc) +{ + return doc->root_node; +} + +static void rxml_free_node(struct rxml_node *node) +{ + for (struct rxml_node *head = node->children; head; ) + { + struct rxml_node *next_node = head->next; + rxml_free_node(head); + head = next_node; + } + + for (struct rxml_attrib_node *head = node->attrib; head; ) + { + struct rxml_attrib_node *next_attrib = head->next; + + free(head->attrib); + free(head->value); + free(head); + + head = next_attrib; + } + + free(node); +} + +static bool validate_header(const char **ptr) +{ + if (memcmp(*ptr, "\n"); + if (!eol) + return false; + + // Always use UTF-8. Don't really care to check. + *ptr = eol + 3; + return true; + } + else + return true; +} + +static bool range_is_space(const char *begin, const char *end) +{ + for (; begin < end; begin++) + if (!isspace(*begin)) + return false; + + return true; +} + +static void skip_spaces(const char **ptr_) +{ + const char *ptr = *ptr_; + while (isspace(*ptr)) + ptr++; + + *ptr_ = ptr; +} + +static char *strdup_range(const char *begin, const char *end) +{ + ptrdiff_t len = end - begin; + + char *ret = (char*)malloc(len + 1); + if (!ret) + return NULL; + + memcpy(ret, begin, len); + ret[len] = '\0'; + return ret; +} + +static char *strdup_range_escape(const char *begin, const char *end) +{ + return strdup_range(begin, end); // Escaping is ignored. Assume we don't deal with that. +} + +static struct rxml_attrib_node *rxml_parse_attrs(const char *str) +{ + char *copy = strdup(str); + if (!copy) + return NULL; + + char *last_char = copy + strlen(copy) - 1; + if (*last_char == '/') + *last_char = '\0'; + + struct rxml_attrib_node *list = NULL; + struct rxml_attrib_node *tail = NULL; + + char *save; + const char *elem = strtok_r(copy, " ", &save); + while (elem) + { + const char *eq = strstr(elem, "=\""); + if (!eq) + goto end; + + const char *end = strrchr(eq + 2, '\"'); + if (!end || end != (elem + strlen(elem) - 1)) + goto end; + + char *attrib = strdup_range_escape(elem, eq); + char *value = strdup_range_escape(eq + 2, end); + if (!attrib || !value) + goto end; + + struct rxml_attrib_node *new_node = (struct rxml_attrib_node*)calloc(1, sizeof(*new_node)); + if (!new_node) + goto end; + + new_node->attrib = attrib; + new_node->value = value; + + if (tail) + { + tail->next = new_node; + tail = new_node; + } + else + list = tail = new_node; + + elem = strtok_r(NULL, " ", &save); + } + +end: + free(copy); + return list; +} + +static bool rxml_parse_tag(struct rxml_node *node, const char *str) +{ + const char *str_ptr = str; + skip_spaces(&str_ptr); + + const char *name_end = strchr(str_ptr, ' '); + if (name_end) + { + node->name = strdup_range(str_ptr, name_end); + if (!node->name || !*node->name) + return false; + + node->attrib = rxml_parse_attrs(name_end); + return true; + } + else + { + node->name = strdup(str_ptr); + return node->name && *node->name; + } +} + +static struct rxml_node *rxml_parse_node(const char **ptr_) +{ + const char *ptr = NULL; + const char *closing = NULL; + char *str = NULL; + bool is_closing = false; + + struct rxml_node *node = (struct rxml_node*)calloc(1, sizeof(*node)); + if (!node) + return NULL; + + skip_spaces(ptr_); + + ptr = *ptr_; + if (*ptr != '<') + goto error; + + closing = strchr(ptr, '>'); + if (!closing) + goto error; + + str = strdup_range(ptr + 1, closing); + if (!str) + goto error; + + if (!rxml_parse_tag(node, str)) + goto error; + + is_closing = strstr(ptr, "/>") + 1 == closing; // Are spaces between / and > allowed? + + // Look for more data. Either child nodes or data. + if (!is_closing) + { + size_t closing_tag_size = strlen(node->name) + 4; + char *closing_tag = (char*)malloc(closing_tag_size); + + const char *cdata_start = NULL; + const char *child_start = NULL; + const char *closing_start = NULL; + + if (!closing_tag) + { + free(closing_tag); + goto error; + } + + snprintf(closing_tag, closing_tag_size, "", node->name); + + cdata_start = strstr(closing + 1, ""); + if (!cdata_end) + { + free(closing_tag); + goto error; + } + + node->data = strdup_range(cdata_start + strlen("data = strdup_range(closing + 1, closing_start); + else // Parse all child nodes. + { + struct rxml_node *list = NULL; + struct rxml_node *tail = NULL; + + const char *ptr = child_start; + + const char *first_start = strchr(ptr, '<'); + const char *first_closing = strstr(ptr, "next = new_node; + tail = new_node; + } + else + list = tail = new_node; + + first_start = strchr(ptr, '<'); + first_closing = strstr(ptr, "children = list; + + closing_start = strstr(ptr, closing_tag); + if (!closing_start) + { + free(closing_tag); + goto error; + } + } + + *ptr_ = closing_start + strlen(closing_tag); + free(closing_tag); + } + else + *ptr_ = closing + 1; + + free(str); + return node; + +error: + free(str); + rxml_free_node(node); + return NULL; +} + +static char *purge_xml_comments(const char *str) +{ + size_t len = strlen(str); + char *new_str = (char*)malloc(len + 1); + if (!new_str) + return NULL; + + new_str[len] = '\0'; + + char *copy_dest = new_str; + const char *copy_src = str; + for (;;) + { + const char *comment_start = strstr(copy_src, ""); + + if (!comment_start || !comment_end) + break; + + ptrdiff_t copy_len = comment_start - copy_src; + memcpy(copy_dest, copy_src, copy_len); + + copy_dest += copy_len; + copy_src = comment_end + strlen("-->"); + } + + // Avoid strcpy() as OpenBSD is anal and hates you for using it even when it's perfectly safe. + len = strlen(copy_src); + memcpy(copy_dest, copy_src, len); + copy_dest[len] = '\0'; + + return new_str; +} + +rxml_document_t *rxml_load_document(const char *path) +{ + RARCH_WARN("Using RXML as drop in for libxml2. Behavior might be very buggy.\n"); + + char *memory_buffer = NULL; + char *new_memory_buffer = NULL; + const char *mem_ptr = NULL; + long len = 0; + + FILE *file = fopen(path, "r"); + if (!file) + return NULL; + + rxml_document_t *doc = (rxml_document_t*)calloc(1, sizeof(*doc)); + if (!doc) + goto error; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + memory_buffer = (char*)malloc(len + 1); + if (!memory_buffer) + goto error; + + memory_buffer[len] = '\0'; + if (fread(memory_buffer, 1, len, file) != (size_t)len) + goto error; + + fclose(file); + file = NULL; + + mem_ptr = memory_buffer; + + if (!validate_header(&mem_ptr)) + goto error; + + new_memory_buffer = purge_xml_comments(mem_ptr); + if (!new_memory_buffer) + goto error; + + free(memory_buffer); + mem_ptr = memory_buffer = new_memory_buffer; + + doc->root_node = rxml_parse_node(&mem_ptr); + if (!doc->root_node) + goto error; + + free(memory_buffer); + return doc; + +error: + free(memory_buffer); + if (file) + fclose(file); + rxml_free_document(doc); + return NULL; +} + +void rxml_free_document(rxml_document_t *doc) +{ + if (!doc) + return; + + if (doc->root_node) + rxml_free_node(doc->root_node); + + free(doc); +} + +char *rxml_node_attrib(struct rxml_node *node, const char *attrib) +{ + for (struct rxml_attrib_node *attribs = node->attrib; attribs; attribs = attribs->next) + { + if (!strcmp(attrib, attribs->attrib)) + return attribs->value; + } + + return NULL; +} + diff --git a/compat/rxml/rxml.h b/compat/rxml/rxml.h new file mode 100644 index 0000000000..9a93cb3b34 --- /dev/null +++ b/compat/rxml/rxml.h @@ -0,0 +1,77 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2013 - Hans-Kristian Arntzen + * + * RetroArch 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 Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch 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 RetroArch. + * If not, see . + */ + +#ifndef RXML_H__ +#define RXML_H__ + +// Total NIH. Very trivial "XML" implementation for use in RetroArch. +// Error checking is minimal. Invalid documents may lead to very buggy behavior, but +// memory corruption should never happen. +// +// Only parts of standard that RetroArch cares about is supported. +// Nothing more, nothing less. "Clever" XML documents will probably break the implementation. +// +// Do *NOT* try to use this for anything else. You have been warned. + +typedef struct rxml_document rxml_document_t; + +struct rxml_attrib_node +{ + char *attrib; + char *value; + struct rxml_attrib_node *next; +}; + +struct rxml_node +{ + char *name; + char *data; + struct rxml_attrib_node *attrib; + + struct rxml_node *children; + struct rxml_node *next; + + int type; // Dummy. Used by libxml2 compat. Is always set to 0, so XML_ELEMENT_NODE check goes through. +}; + +rxml_document_t *rxml_load_document(const char *path); +void rxml_free_document(rxml_document_t *doc); + +struct rxml_node *rxml_root_node(rxml_document_t *doc); + +// Drop const-correctness here to avoid warnings when used as libxml2 compat. +// xmlGetProp() returns xmlChar*, which is supposed to be passed to xmlFree(). +char *rxml_node_attrib(struct rxml_node *node, const char *attrib); + +#ifdef RXML_LIBXML2_COMPAT +// Compat for part of libxml2 that RetroArch uses. +#define LIBXML_TEST_VERSION ((void)0) +typedef char xmlChar; // It's really unsigned char, but it doesn't matter. +typedef struct rxml_node *xmlNodePtr; +typedef void *xmlParserCtxtPtr; +typedef rxml_document_t *xmlDocPtr; +#define XML_ELEMENT_NODE (0) +#define xmlNewParserCtxt() ((void*)-1) +#define xmlCtxtReadFile(ctx, path, ...) rxml_load_document(path) +#define xmlGetProp(node, prop) rxml_node_attrib(node, prop) +#define xmlFree(p) ((void)0) +#define xmlNodeGetContent(node) (node->data) +#define xmlDocGetRootElement(doc) rxml_root_node(doc) +#define xmlFreeDoc(doc) rxml_free_document(doc) +#define xmlFreeParserCtxt(ctx) ((void)0) +#endif + +#endif + diff --git a/compat/rxml/rxml_test.c b/compat/rxml/rxml_test.c new file mode 100644 index 0000000000..047dd34656 --- /dev/null +++ b/compat/rxml/rxml_test.c @@ -0,0 +1,58 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2013 - Hans-Kristian Arntzen + * + * RetroArch 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 Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch 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 RetroArch. + * If not, see . + */ + +#include "rxml.h" +#include + +static void print_siblings(struct rxml_node *node, unsigned level) +{ + fprintf(stderr, "\n%*sName: %s\n", level * 4, "", node->name); + if (node->data) + fprintf(stderr, "%*sData: %s\n", level * 4, "", node->data); + + for (const struct rxml_attrib_node *attrib = node->attrib; attrib; attrib = attrib->next) + fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "", attrib->attrib, attrib->value); + + if (node->childs) + print_siblings(node->childs, level + 1); + + if (node->next) + print_siblings(node->next, level); +} + +static void rxml_log_document(const char *path) +{ + rxml_document_t *doc = rxml_load_document(path); + if (!doc) + { + fprintf(stderr, "rxml: Failed to load document: %s\n", path); + return; + } + + print_siblings(rxml_root_node(doc), 0); + rxml_free_document(doc); +} + +int main(int argc, char *argv[]) +{ + if (argc != 2) + { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 1; + } + + rxml_log_document(argv[1]); +} + diff --git a/config.features.h b/config.features.h index 2cf27822c7..6854ad08f6 100644 --- a/config.features.h +++ b/config.features.h @@ -116,10 +116,10 @@ static const bool _cg_supp = true; static const bool _cg_supp = false; #endif -#ifdef HAVE_XML -static const bool _xml_supp = true; +#ifdef HAVE_LIBXML2 +static const bool _libxml2_supp = true; #else -static const bool _xml_supp = false; +static const bool _libxml2_supp = false; #endif #ifdef HAVE_SDL_IMAGE diff --git a/driver.c b/driver.c index 5747fa7f74..16f5d470ad 100644 --- a/driver.c +++ b/driver.c @@ -561,7 +561,6 @@ error: } #endif -#ifdef HAVE_XML static void deinit_shader_dir(void) { // It handles NULL, no worries :D @@ -588,7 +587,6 @@ static void init_shader_dir(void) for (unsigned i = 0; i < g_extern.shader_dir.list->size; i++) RARCH_LOG("Found shader \"%s\"\n", g_extern.shader_dir.list->elems[i].data); } -#endif static void deinit_pixel_converter(void) { @@ -628,9 +626,7 @@ void init_video_input(void) init_filter(g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_XRGB8888); #endif -#ifdef HAVE_XML init_shader_dir(); -#endif const struct retro_game_geometry *geom = &g_extern.system.av_info.geometry; unsigned max_dim = max(geom->max_width, geom->max_height); @@ -776,9 +772,7 @@ void uninit_video_input(void) deinit_filter(); #endif -#ifdef HAVE_XML deinit_shader_dir(); -#endif } driver_t driver; diff --git a/file.c b/file.c index 4c240e9a2a..d4b8acf48e 100644 --- a/file.c +++ b/file.c @@ -277,10 +277,8 @@ static ssize_t read_rom_file(FILE *file, void **buf) } g_extern.cart_crc = crc32_calculate(ret_buf, ret); -#ifdef HAVE_XML sha256_hash(g_extern.sha256, ret_buf, ret); RARCH_LOG("SHA256 sum: %s\n", g_extern.sha256); -#endif *buf = ret_buf; return ret; } diff --git a/general.h b/general.h index 6aa6b36a8b..c791dce9ac 100644 --- a/general.h +++ b/general.h @@ -466,9 +466,7 @@ struct global char sha256[64 + 1]; -#ifdef HAVE_XML cheat_manager_t *cheat; -#endif // Settings and/or global state that is specific to a console-style implementation. struct diff --git a/gfx/gl.c b/gfx/gl.c index 59975c8b08..c8a4a6a207 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -236,7 +236,7 @@ static bool gl_shader_init(gl_t *gl) } #endif -#ifdef HAVE_XML +#ifdef HAVE_GLSL if (*g_settings.video.bsnes_shader_path) { backend = &gl_glsl_backend; @@ -253,7 +253,7 @@ static bool gl_shader_init(gl_t *gl) break; #endif -#ifdef HAVE_XML +#ifdef HAVE_GLSL case RARCH_SHADER_BSNES: backend = &gl_glsl_backend; shader_path = g_settings.video.bsnes_shader_path; @@ -1604,7 +1604,7 @@ static bool gl_focus(void *data) return context_has_focus_func(); } -#if defined(HAVE_XML) || defined(HAVE_CG) +#if defined(HAVE_GLSL) || defined(HAVE_CG) static bool gl_set_shader(void *data, enum rarch_shader_type type, const char *path) { gl_t *gl = (gl_t*)data; @@ -1618,7 +1618,7 @@ static bool gl_set_shader(void *data, enum rarch_shader_type type, const char *p switch (type) { -#ifdef HAVE_XML +#ifdef HAVE_GLSL case RARCH_SHADER_BSNES: if (!gl_glsl_init(path)) return false; @@ -1897,7 +1897,7 @@ const video_driver_t video_gl = { gl_alive, gl_focus, -#if defined(HAVE_XML) || defined(HAVE_CG) +#if defined(HAVE_GLSL) || defined(HAVE_CG) gl_set_shader, #else NULL, diff --git a/gfx/shader_glsl.c b/gfx/shader_glsl.c index d34af5fdf5..c5f9b7f839 100644 --- a/gfx/shader_glsl.c +++ b/gfx/shader_glsl.c @@ -52,9 +52,12 @@ #include "gfx_context.h" #include -#ifdef HAVE_XML +#ifdef HAVE_LIBXML2 #include #include +#else +#define RXML_LIBXML2_COMPAT +#include "../compat/rxml/rxml.h" #endif #include "gl_common.h" @@ -248,7 +251,6 @@ static const char *stock_fragment_modern = " gl_FragColor = color * texture2D(rubyTexture, tex_coord);\n" "}"; -#ifdef HAVE_XML static bool xml_get_prop(char *buf, size_t size, xmlNodePtr node, const char *prop) { if (!size) @@ -685,11 +687,13 @@ static unsigned get_xml_shaders(const char *path, struct shader_program *prog, s goto error; } +#ifdef HAVE_LIBXML2 if (ctx->valid == 0) { RARCH_ERR("Cannot validate XML shader: %s\n", path); goto error; } +#endif head = xmlDocGetRootElement(doc); @@ -818,7 +822,6 @@ error: xmlFreeParserCtxt(ctx); return 0; } -#endif // HAVE_XML static void print_shader_log(GLuint obj) { @@ -1072,7 +1075,6 @@ bool gl_glsl_init(const char *path) unsigned num_progs = 0; struct shader_program progs[RARCH_GLSL_MAX_SHADERS] = {{0}}; -#ifdef HAVE_XML if (path) { num_progs = get_xml_shaders(path, progs, RARCH_GLSL_MAX_SHADERS - 1); @@ -1084,7 +1086,6 @@ bool gl_glsl_init(const char *path) } } else -#endif { RARCH_WARN("[GL]: Stock GLSL shaders will be used.\n"); num_progs = 1; @@ -1126,7 +1127,6 @@ bool gl_glsl_init(const char *path) if (!compile_programs(&gl_program[1], progs, num_progs)) return false; -#ifdef HAVE_XML // RetroArch custom two-pass with two different files. if (num_progs == 1 && *g_settings.video.second_pass_shader && g_settings.video.render_to_texture) { @@ -1142,7 +1142,6 @@ bool gl_glsl_init(const char *path) return false; } } -#endif for (unsigned i = 0; i <= num_progs; i++) find_uniforms(gl_program[i], &gl_uniforms[i]); @@ -1152,7 +1151,6 @@ bool gl_glsl_init(const char *path) RARCH_WARN("Detected GL error in GLSL.\n"); #endif -#ifdef HAVE_XML if (gl_tracker_info_cnt > 0) { struct state_tracker_info info = {0}; @@ -1170,7 +1168,6 @@ bool gl_glsl_init(const char *path) if (!gl_state_tracker) RARCH_WARN("Failed to init state tracker.\n"); } -#endif glsl_enable = true; gl_num_programs = num_progs; diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 8f98e8984a..ab63813e8c 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -162,7 +162,7 @@ if [ "$HAVE_KMS" != "no" ]; then fi fi -check_pkgconf XML libxml-2.0 +check_pkgconf LIBXML2 libxml-2.0 if [ "$HAVE_EGL" = "yes" ]; then if [ "$HAVE_GLES" != "no" ]; then @@ -205,6 +205,6 @@ check_macro NEON __ARM_NEON__ add_define_make OS "$OS" # Creates config.mk and config.h. -VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL GLES VG EGL KMS GBM DRM DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE LIBPNG DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE FREETYPE XVIDEO X11 XEXT XF86VM XINERAMA NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 SINC BSV_MOVIE VIDEOCORE NEON" +VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL GLES VG EGL KMS GBM DRM DYLIB GETOPT_LONG THREADS CG LIBXML2 SDL_IMAGE LIBPNG DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE FREETYPE XVIDEO X11 XEXT XF86VM XINERAMA NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 SINC BSV_MOVIE VIDEOCORE NEON" create_config_make config.mk $VARS create_config_header config.h $VARS diff --git a/qb/config.params.sh b/qb/config.params.sh index 708e0b7d0d..38ccfa6f60 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -14,7 +14,7 @@ HAVE_KMS=auto # Enable KMS context support HAVE_EGL=auto # Enable EGL context support HAVE_VG=auto # Enable OpenVG support HAVE_CG=auto # Enable Cg shader support -HAVE_XML=auto # Enable bSNES-style XML shader support +HAVE_LIBXML2=auto # Enable libxml2 support HAVE_FBO=auto # Enable render-to-texture (FBO) support HAVE_ALSA=auto # Enable ALSA support HAVE_OSS=auto # Enable OSS support diff --git a/retroarch.c b/retroarch.c index 269d9c2ac4..e9c529d3bd 100644 --- a/retroarch.c +++ b/retroarch.c @@ -594,7 +594,7 @@ static void print_features(void) _PSUPP(al, "OpenAL", "audio driver"); _PSUPP(dylib, "External", "External filter and plugin support"); _PSUPP(cg, "Cg", "Cg pixel shaders"); - _PSUPP(xml, "XML", "bSNES XML pixel shaders"); + _PSUPP(libxml2, "libxml2", "libxml2 XML parsing"); _PSUPP(sdl_image, "SDL_image", "SDL_image image loading"); _PSUPP(libpng, "libpng", "libpng screenshot support"); _PSUPP(fbo, "FBO", "OpenGL render-to-texture (multi-pass shaders)"); @@ -1413,7 +1413,6 @@ void rarch_deinit_msg_queue(void) } } -#ifdef HAVE_XML static void init_cheats(void) { if (*g_settings.cheat_database) @@ -1425,7 +1424,6 @@ static void deinit_cheats(void) if (g_extern.cheat) cheat_manager_free(g_extern.cheat); } -#endif static void init_rewind(void) { @@ -2295,7 +2293,6 @@ static void check_turbo(void) input_input_state_func(binds, i, RETRO_DEVICE_JOYPAD, 0, RARCH_TURBO_ENABLE); } -#ifdef HAVE_XML static void check_shader_dir(void) { static bool old_pressed_next; @@ -2377,7 +2374,6 @@ static void check_cheats(void) old_pressed_next = pressed_next; old_pressed_toggle = pressed_toggle; } -#endif #if defined(HAVE_SCREENSHOTS) && !defined(_XBOX) static void check_screenshot(void) @@ -2549,10 +2545,8 @@ static void do_state_checks(void) check_movie(); #endif -#ifdef HAVE_XML check_shader_dir(); check_cheats(); -#endif #ifdef HAVE_DYLIB check_dsp_config(); @@ -2677,9 +2671,7 @@ int rarch_main_init(int argc, char *argv[]) pretro_init(); g_extern.use_sram = true; -#ifdef HAVE_XML bool allow_cheats = true; -#endif fill_pathnames(); set_savestate_auto_index(); @@ -2736,7 +2728,6 @@ int rarch_main_init(int argc, char *argv[]) init_autosave(); #endif -#ifdef HAVE_XML #ifdef HAVE_NETPLAY allow_cheats &= !g_extern.netplay; #endif @@ -2745,7 +2736,6 @@ int rarch_main_init(int argc, char *argv[]) #endif if (allow_cheats) init_cheats(); -#endif g_extern.error_in_init = false; return 0; @@ -2878,9 +2868,7 @@ void rarch_main_deinit(void) #endif deinit_rewind(); -#ifdef HAVE_XML deinit_cheats(); -#endif #ifdef HAVE_BSV_MOVIE deinit_movie(); diff --git a/settings.c b/settings.c index aec46fe48c..f21b92f345 100644 --- a/settings.c +++ b/settings.c @@ -180,7 +180,7 @@ void config_set_defaults(void) g_settings.video.msg_color_g = ((message_color >> 8) & 0xff) / 255.0f; g_settings.video.msg_color_b = ((message_color >> 0) & 0xff) / 255.0f; -#if defined(HAVE_CG) || defined(HAVE_XML) +#if defined(HAVE_CG) || defined(HAVE_GLSL) g_settings.video.render_to_texture = render_to_texture; g_settings.video.fbo.scale_x = fbo_scale_x; g_settings.video.fbo.scale_y = fbo_scale_y; @@ -412,7 +412,6 @@ bool config_load_file(const char *path) CONFIG_GET_PATH(video.filter_path, "video_filter"); #endif -#if defined(HAVE_CG) || defined(HAVE_XML) if (config_get_array(conf, "video_shader_type", tmp_str, sizeof(tmp_str))) { if (strcmp("cg", tmp_str) == 0) @@ -424,11 +423,8 @@ bool config_load_file(const char *path) else if (strcmp("none", tmp_str) == 0) g_settings.video.shader_type = RARCH_SHADER_NONE; } -#endif -#if defined(HAVE_XML) CONFIG_GET_PATH(video.shader_dir, "video_shader_dir"); -#endif CONFIG_GET_FLOAT(input.axis_threshold, "input_axis_threshold"); CONFIG_GET_BOOL(input.netplay_client_swap_input, "netplay_client_swap_input"); From 78a8e03f2ff83509377cd38bc50a87b4aaa78f04 Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 2 Jan 2013 15:23:22 +0100 Subject: [PATCH 2/4] Update griffin for RXML. Purge libxml2. --- console/griffin/griffin.c | 26 +- deps/libxml2/Copyright | 27 - deps/libxml2/NOTICE | 27 - deps/libxml2/SAX2.c | 1795 ---- deps/libxml2/chvalid.c | 336 - deps/libxml2/config.h | 308 - deps/libxml2/dict.c | 1079 -- deps/libxml2/elfgcchack.h | 6628 ------------ deps/libxml2/encoding.c | 2588 ----- deps/libxml2/entities.c | 869 -- deps/libxml2/error.c | 949 -- deps/libxml2/globals.c | 737 -- deps/libxml2/libxml.h | 52 - deps/libxml2/libxml/SAX.h | 22 - deps/libxml2/libxml/SAX2.h | 151 - deps/libxml2/libxml/chvalid.h | 230 - deps/libxml2/libxml/dict.h | 69 - deps/libxml2/libxml/encoding.h | 212 - deps/libxml2/libxml/entities.h | 129 - deps/libxml2/libxml/globals.h | 298 - deps/libxml2/libxml/hash.h | 233 - deps/libxml2/libxml/list.h | 137 - deps/libxml2/libxml/parser.h | 1114 -- deps/libxml2/libxml/parserInternals.h | 547 - deps/libxml2/libxml/pattern.h | 19 - deps/libxml2/libxml/relaxng.h | 18 - deps/libxml2/libxml/threads.h | 0 deps/libxml2/libxml/tree.h | 1152 --- deps/libxml2/libxml/uri.h | 94 - deps/libxml2/libxml/valid.h | 299 - deps/libxml2/libxml/xinclude.h | 20 - deps/libxml2/libxml/xlink.h | 17 - deps/libxml2/libxml/xmlIO.h | 191 - deps/libxml2/libxml/xmlerror.h | 940 -- deps/libxml2/libxml/xmlexports.h | 162 - deps/libxml2/libxml/xmlmemory.h | 166 - deps/libxml2/libxml/xmlreader.h | 388 - deps/libxml2/libxml/xmlsave.h | 20 - deps/libxml2/libxml/xmlstring.h | 140 - deps/libxml2/libxml/xmlversion.h | 181 - deps/libxml2/libxml_hash.c | 1116 -- deps/libxml2/libxml_list.c | 779 -- deps/libxml2/parser.c | 13007 ------------------------ deps/libxml2/parserInternals.c | 2112 ---- deps/libxml2/tree.c | 9621 ------------------ deps/libxml2/uri.c | 2392 ----- deps/libxml2/valid.c | 2090 ---- deps/libxml2/xmlIO.c | 2007 ---- deps/libxml2/xmllint.c | 2367 ----- deps/libxml2/xmlmemory.c | 754 -- deps/libxml2/xmlreader.c | 4440 -------- deps/libxml2/xmlstring.c | 984 -- 52 files changed, 3 insertions(+), 64036 deletions(-) delete mode 100644 deps/libxml2/Copyright delete mode 100644 deps/libxml2/NOTICE delete mode 100644 deps/libxml2/SAX2.c delete mode 100755 deps/libxml2/chvalid.c delete mode 100644 deps/libxml2/config.h delete mode 100644 deps/libxml2/dict.c delete mode 100644 deps/libxml2/elfgcchack.h delete mode 100644 deps/libxml2/encoding.c delete mode 100644 deps/libxml2/entities.c delete mode 100644 deps/libxml2/error.c delete mode 100644 deps/libxml2/globals.c delete mode 100644 deps/libxml2/libxml.h delete mode 100644 deps/libxml2/libxml/SAX.h delete mode 100644 deps/libxml2/libxml/SAX2.h delete mode 100644 deps/libxml2/libxml/chvalid.h delete mode 100644 deps/libxml2/libxml/dict.h delete mode 100644 deps/libxml2/libxml/encoding.h delete mode 100644 deps/libxml2/libxml/entities.h delete mode 100644 deps/libxml2/libxml/globals.h delete mode 100644 deps/libxml2/libxml/hash.h delete mode 100644 deps/libxml2/libxml/list.h delete mode 100644 deps/libxml2/libxml/parser.h delete mode 100644 deps/libxml2/libxml/parserInternals.h delete mode 100644 deps/libxml2/libxml/pattern.h delete mode 100644 deps/libxml2/libxml/relaxng.h delete mode 100644 deps/libxml2/libxml/threads.h delete mode 100644 deps/libxml2/libxml/tree.h delete mode 100644 deps/libxml2/libxml/uri.h delete mode 100644 deps/libxml2/libxml/valid.h delete mode 100644 deps/libxml2/libxml/xinclude.h delete mode 100644 deps/libxml2/libxml/xlink.h delete mode 100644 deps/libxml2/libxml/xmlIO.h delete mode 100644 deps/libxml2/libxml/xmlerror.h delete mode 100644 deps/libxml2/libxml/xmlexports.h delete mode 100644 deps/libxml2/libxml/xmlmemory.h delete mode 100644 deps/libxml2/libxml/xmlreader.h delete mode 100644 deps/libxml2/libxml/xmlsave.h delete mode 100644 deps/libxml2/libxml/xmlstring.h delete mode 100644 deps/libxml2/libxml/xmlversion.h delete mode 100644 deps/libxml2/libxml_hash.c delete mode 100644 deps/libxml2/libxml_list.c delete mode 100644 deps/libxml2/parser.c delete mode 100644 deps/libxml2/parserInternals.c delete mode 100644 deps/libxml2/tree.c delete mode 100644 deps/libxml2/uri.c delete mode 100644 deps/libxml2/valid.c delete mode 100644 deps/libxml2/xmlIO.c delete mode 100644 deps/libxml2/xmllint.c delete mode 100644 deps/libxml2/xmlmemory.c delete mode 100644 deps/libxml2/xmlreader.c delete mode 100644 deps/libxml2/xmlstring.c diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c index 1852f8acf9..3d8dea1dd8 100644 --- a/console/griffin/griffin.c +++ b/console/griffin/griffin.c @@ -109,10 +109,8 @@ CONFIG FILE /*============================================================ CHEATS ============================================================ */ -#ifdef HAVE_XML #include "../../cheats.c" #include "../../hash.c" -#endif /*============================================================ VIDEO CONTEXT @@ -440,28 +438,10 @@ RZLIB #endif /*============================================================ -LIBXML2 +XML ============================================================ */ -#ifdef WANT_LIBXML2 -#include "../../deps/libxml2/error.c" -#include "../../deps/libxml2/chvalid.c" -#include "../../deps/libxml2/dict.c" -#include "../../deps/libxml2/encoding.c" -#include "../../deps/libxml2/entities.c" -#include "../../deps/libxml2/globals.c" -#include "../../deps/libxml2/libxml_hash.c" -#include "../../deps/libxml2/libxml_list.c" -#include "../../deps/libxml2/parser.c" -#include "../../deps/libxml2/parserInternals.c" -#include "../../deps/libxml2/SAX2.c" -#include "../../deps/libxml2/tree.c" -#include "../../deps/libxml2/uri.c" -#include "../../deps/libxml2/valid.c" -#include "../../deps/libxml2/xmlIO.c" -#include "../../deps/libxml2/xmlmemory.c" -#include "../../deps/libxml2/xmlreader.c" -#include "../../deps/libxml2/xmlstring.c" -#endif +#define RXML_LIBXML2_COMPAT +#include "../../compat/rxml/rxml.c" #ifdef __cplusplus } diff --git a/deps/libxml2/Copyright b/deps/libxml2/Copyright deleted file mode 100644 index 417e95531f..0000000000 --- a/deps/libxml2/Copyright +++ /dev/null @@ -1,27 +0,0 @@ -Except where otherwise noted in the source code (e.g. the files hash.c, -list.c and the trio files, which are covered by a similar licence but -with different Copyright notices) all the files are: - - Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Daniel Veillard shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from him. - diff --git a/deps/libxml2/NOTICE b/deps/libxml2/NOTICE deleted file mode 100644 index 417e95531f..0000000000 --- a/deps/libxml2/NOTICE +++ /dev/null @@ -1,27 +0,0 @@ -Except where otherwise noted in the source code (e.g. the files hash.c, -list.c and the trio files, which are covered by a similar licence but -with different Copyright notices) all the files are: - - Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Daniel Veillard shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from him. - diff --git a/deps/libxml2/SAX2.c b/deps/libxml2/SAX2.c deleted file mode 100644 index dc36a9abeb..0000000000 --- a/deps/libxml2/SAX2.c +++ /dev/null @@ -1,1795 +0,0 @@ -/* - * SAX2.c : Default SAX2 handler to build a tree. - * - * See Copyright for the status of this software. - * - * Daniel Veillard - */ - - -#define IN_LIBXML -#include "libxml.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Define SIZE_T_MAX unless defined through . */ -#ifndef SIZE_T_MAX -# define SIZE_T_MAX ((size_t)-1) -#endif /* !SIZE_T_MAX */ - -/** - * TODO: - * - * macro to flag unimplemented blocks - * XML_CATALOG_PREFER user env to select between system/public prefered - * option. C.f. Richard Tobin - *> Just FYI, I am using an environment variable XML_CATALOG_PREFER with - *> values "system" and "public". I have made the default be "system" to - *> match yours. - */ -#define TODO \ - xmlGenericError(xmlGenericErrorContext, \ - "Unimplemented block at %s:%d\n", \ - __FILE__, __LINE__); - -/* - * xmlSAX2ErrMemory: - * @ctxt: an XML validation parser context - * @msg: a string to accompany the error message - */ -static void -xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) { - if (ctxt != NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "%s: out of memory\n", msg); - ctxt->errNo = XML_ERR_NO_MEMORY; - ctxt->instate = XML_PARSER_EOF; - ctxt->disableSAX = 1; - } -} - -/** - * xmlValidError: - * @ctxt: an XML validation parser context - * @error: the error number - * @msg: the error message - * @str1: extra data - * @str2: extra data - * - * Handle a validation error - */ -static void -SAXxmlErrValid(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const char *str1, const char *str2) -{ - xmlStructuredErrorFunc schannel = NULL; - - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) { - ctxt->errNo = error; - if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) - schannel = ctxt->sax->serror; - __xmlRaiseError(schannel, - ctxt->vctxt.error, ctxt->vctxt.userData, - ctxt, NULL, XML_FROM_DTD, error, - XML_ERR_ERROR, NULL, 0, (const char *) str1, - (const char *) str2, NULL, 0, 0, - msg, (const char *) str1, (const char *) str2); - ctxt->valid = 0; - } else { - __xmlRaiseError(schannel, - NULL, NULL, - ctxt, NULL, XML_FROM_DTD, error, - XML_ERR_ERROR, NULL, 0, (const char *) str1, - (const char *) str2, NULL, 0, 0, - msg, (const char *) str1, (const char *) str2); - } -} - -/** - * SAXxmlFatalErrMsg: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @str1: an error string - * @str2: an error string - * - * Handle a fatal parser error, i.e. violating Well-Formedness constraints - */ -static void -SAXxmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1, const xmlChar *str2) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_FATAL, NULL, 0, - (const char *) str1, (const char *) str2, - NULL, 0, 0, msg, str1, str2); - if (ctxt != NULL) { - ctxt->wellFormed = 0; - ctxt->valid = 0; - if (ctxt->recovery == 0) - ctxt->disableSAX = 1; - } -} - -/** - * xmlWarnMsg: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @str1: an error string - * @str2: an error string - * - * Handle a parser warning - */ -static void -xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_WARNING, NULL, 0, - (const char *) str1, NULL, - NULL, 0, 0, msg, str1); -} - -/** - * xmlNsErrMsg: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @str1: an error string - * @str2: an error string - * - * Handle a namespace error - */ -static void -xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1, const xmlChar *str2) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, - XML_ERR_ERROR, NULL, 0, - (const char *) str1, (const char *) str2, - NULL, 0, 0, msg, str1, str2); -} - -/** - * xmlNsWarnMsg: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @str1: an error string - * - * Handle a namespace warning - */ -static void -xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1, const xmlChar *str2) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, - XML_ERR_WARNING, NULL, 0, - (const char *) str1, (const char *) str2, - NULL, 0, 0, msg, str1, str2); -} - -/** - * xmlSAX2GetPublicId: - * @ctx: the user data (XML parser context) - * - * Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN" - * - * Returns a xmlChar * - */ -const xmlChar * -xmlSAX2GetPublicId(void *ctx ATTRIBUTE_UNUSED) -{ - /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ - return(NULL); -} - -/** - * xmlSAX2GetSystemId: - * @ctx: the user data (XML parser context) - * - * Provides the system ID, basically URL or filename e.g. - * http://www.sgmlsource.com/dtds/memo.dtd - * - * Returns a xmlChar * - */ -const xmlChar * -xmlSAX2GetSystemId(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL); - return((const xmlChar *) ctxt->input->filename); -} - -/** - * xmlSAX2GetLineNumber: - * @ctx: the user data (XML parser context) - * - * Provide the line number of the current parsing point. - * - * Returns an int - */ -int -xmlSAX2GetLineNumber(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if ((ctx == NULL) || (ctxt->input == NULL)) return(0); - return(ctxt->input->line); -} - -/** - * xmlSAX2GetColumnNumber: - * @ctx: the user data (XML parser context) - * - * Provide the column number of the current parsing point. - * - * Returns an int - */ -int -xmlSAX2GetColumnNumber(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if ((ctx == NULL) || (ctxt->input == NULL)) return(0); - return(ctxt->input->col); -} - -/** - * xmlSAX2IsStandalone: - * @ctx: the user data (XML parser context) - * - * Is this document tagged standalone ? - * - * Returns 1 if true - */ -int -xmlSAX2IsStandalone(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if ((ctx == NULL) || (ctxt->myDoc == NULL)) return(0); - return(ctxt->myDoc->standalone == 1); -} - -/** - * xmlSAX2HasInternalSubset: - * @ctx: the user data (XML parser context) - * - * Does this document has an internal subset - * - * Returns 1 if true - */ -int -xmlSAX2HasInternalSubset(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0); - return(ctxt->myDoc->intSubset != NULL); -} - -/** - * xmlSAX2HasExternalSubset: - * @ctx: the user data (XML parser context) - * - * Does this document has an external subset - * - * Returns 1 if true - */ -int -xmlSAX2HasExternalSubset(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0); - return(ctxt->myDoc->extSubset != NULL); -} - -/** - * xmlSAX2InternalSubset: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on internal subset declaration. - */ -void -xmlSAX2InternalSubset(void *ctx, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlDtdPtr dtd; - if (ctx == NULL) return; - - if (ctxt->myDoc == NULL) - return; - dtd = xmlGetIntSubset(ctxt->myDoc); - if (dtd != NULL) { - if (ctxt->html) - return; - xmlUnlinkNode((xmlNodePtr) dtd); - xmlFreeDtd(dtd); - ctxt->myDoc->intSubset = NULL; - } - ctxt->myDoc->intSubset = - xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID); - if (ctxt->myDoc->intSubset == NULL) - xmlSAX2ErrMemory(ctxt, "xmlSAX2InternalSubset"); -} - -/** - * xmlSAX2ExternalSubset: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on external subset declaration. - */ -void -xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if (ctx == NULL) return; - if (((ExternalID != NULL) || (SystemID != NULL)) && - (((ctxt->validate) || (ctxt->loadsubset != 0)) && - (ctxt->wellFormed && ctxt->myDoc))) { - /* - * Try to fetch and parse the external subset. - */ - xmlParserInputPtr oldinput; - int oldinputNr; - int oldinputMax; - xmlParserInputPtr *oldinputTab; - xmlParserInputPtr input = NULL; - xmlCharEncoding enc; - int oldcharset; - - /* - * Ask the Entity resolver to load the damn thing - */ - if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL)) - input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID, - SystemID); - if (input == NULL) { - return; - } - - xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID); - - /* - * make sure we won't destroy the main document context - */ - oldinput = ctxt->input; - oldinputNr = ctxt->inputNr; - oldinputMax = ctxt->inputMax; - oldinputTab = ctxt->inputTab; - oldcharset = ctxt->charset; - - ctxt->inputTab = (xmlParserInputPtr *) - xmlMalloc(5 * sizeof(xmlParserInputPtr)); - if (ctxt->inputTab == NULL) { - xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset"); - ctxt->input = oldinput; - ctxt->inputNr = oldinputNr; - ctxt->inputMax = oldinputMax; - ctxt->inputTab = oldinputTab; - ctxt->charset = oldcharset; - return; - } - ctxt->inputNr = 0; - ctxt->inputMax = 5; - ctxt->input = NULL; - xmlPushInput(ctxt, input); - - /* - * On the fly encoding conversion if needed - */ - if (ctxt->input->length >= 4) { - enc = xmlDetectCharEncoding(ctxt->input->cur, 4); - xmlSwitchEncoding(ctxt, enc); - } - - if (input->filename == NULL) - input->filename = (char *) xmlCanonicPath(SystemID); - input->line = 1; - input->col = 1; - input->base = ctxt->input->cur; - input->cur = ctxt->input->cur; - input->free = NULL; - - /* - * let's parse that entity knowing it's an external subset. - */ - xmlParseExternalSubset(ctxt, ExternalID, SystemID); - - /* - * Free up the external entities - */ - - while (ctxt->inputNr > 1) - xmlPopInput(ctxt); - xmlFreeInputStream(ctxt->input); - xmlFree(ctxt->inputTab); - - /* - * Restore the parsing context of the main entity - */ - ctxt->input = oldinput; - ctxt->inputNr = oldinputNr; - ctxt->inputMax = oldinputMax; - ctxt->inputTab = oldinputTab; - ctxt->charset = oldcharset; - /* ctxt->wellFormed = oldwellFormed; */ - } -} - -/** - * xmlSAX2ResolveEntity: - * @ctx: the user data (XML parser context) - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * The entity loader, to control the loading of external entities, - * the application can either: - * - override this xmlSAX2ResolveEntity() callback in the SAX block - * - or better use the xmlSetExternalEntityLoader() function to - * set up it's own entity resolution routine - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -xmlParserInputPtr -xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr ret; - xmlChar *URI; - const char *base = NULL; - - if (ctx == NULL) return(NULL); - if (ctxt->input != NULL) - base = ctxt->input->filename; - if (base == NULL) - base = ctxt->directory; - - URI = xmlBuildURI(systemId, (const xmlChar *) base); - - ret = xmlLoadExternalEntity((const char *) URI, - (const char *) publicId, ctxt); - if (URI != NULL) - xmlFree(URI); - return(ret); -} - -/** - * xmlSAX2GetEntity: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get an entity by name - * - * Returns the xmlEntityPtr if found. - */ -xmlEntityPtr -xmlSAX2GetEntity(void *ctx, const xmlChar *name) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlEntityPtr ret = NULL; - - if (ctx == NULL) return(NULL); - - if (ctxt->inSubset == 0) { - ret = xmlGetPredefinedEntity(name); - if (ret != NULL) - return(ret); - } - if ((ctxt->myDoc != NULL) && (ctxt->myDoc->standalone == 1)) { - if (ctxt->inSubset == 2) { - ctxt->myDoc->standalone = 0; - ret = xmlGetDocEntity(ctxt->myDoc, name); - ctxt->myDoc->standalone = 1; - } else { - ret = xmlGetDocEntity(ctxt->myDoc, name); - if (ret == NULL) { - ctxt->myDoc->standalone = 0; - ret = xmlGetDocEntity(ctxt->myDoc, name); - if (ret != NULL) { - SAXxmlFatalErrMsg(ctxt, XML_ERR_NOT_STANDALONE, - "Entity(%s) document marked standalone but requires external subset\n", - name, NULL); - } - ctxt->myDoc->standalone = 1; - } - } - } else { - ret = xmlGetDocEntity(ctxt->myDoc, name); - } - if ((ret != NULL) && - ((ctxt->validate) || (ctxt->replaceEntities)) && - (ret->children == NULL) && - (ret->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) { - int val; - - /* - * for validation purposes we really need to fetch and - * parse the external entity - */ - xmlNodePtr children; - - val = xmlParseCtxtExternalEntity(ctxt, ret->URI, - ret->ExternalID, &children); - if (val == 0) { - xmlAddChildList((xmlNodePtr) ret, children); - } else { - SAXxmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, - "Failure to process entity %s\n", name, NULL); - ctxt->validate = 0; - return(NULL); - } - ret->owner = 1; - if (ret->checked == 0) - ret->checked = 1; - } - return(ret); -} - -/** - * xmlSAX2GetParameterEntity: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get a parameter entity by name - * - * Returns the xmlEntityPtr if found. - */ -xmlEntityPtr -xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlEntityPtr ret; - - if (ctx == NULL) return(NULL); - - ret = xmlGetParameterEntity(ctxt->myDoc, name); - return(ret); -} - - -/** - * xmlSAX2EntityDecl: - * @ctx: the user data (XML parser context) - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed - */ -void -xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, - const xmlChar *publicId, const xmlChar *systemId, xmlChar *content) -{ - xmlEntityPtr ent; - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - - if (ctx == NULL) return; - if (ctxt->inSubset == 1) { - ent = xmlAddDocEntity(ctxt->myDoc, name, type, publicId, - systemId, content); - if ((ent == NULL) && (ctxt->pedantic)) - xmlWarnMsg(ctxt, XML_WAR_ENTITY_REDEFINED, - "Entity(%s) already defined in the internal subset\n", - name); - if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { - xmlChar *URI; - const char *base = NULL; - - if (ctxt->input != NULL) - base = ctxt->input->filename; - if (base == NULL) - base = ctxt->directory; - - URI = xmlBuildURI(systemId, (const xmlChar *) base); - ent->URI = URI; - } - } else if (ctxt->inSubset == 2) { - ent = xmlAddDtdEntity(ctxt->myDoc, name, type, publicId, - systemId, content); - if ((ent == NULL) && (ctxt->pedantic) && - (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, - "Entity(%s) already defined in the external subset\n", name); - if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { - xmlChar *URI; - const char *base = NULL; - - if (ctxt->input != NULL) - base = ctxt->input->filename; - if (base == NULL) - base = ctxt->directory; - - URI = xmlBuildURI(systemId, (const xmlChar *) base); - ent->URI = URI; - } - } else { - SAXxmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, - "SAX.xmlSAX2EntityDecl(%s) called while not in subset\n", - name, NULL); - } -} - -/** - * xmlSAX2AttributeDecl: - * @ctx: the user data (XML parser context) - * @elem: the name of the element - * @fullname: the attribute name - * @type: the attribute type - * @def: the type of default value - * @defaultValue: the attribute default value - * @tree: the tree of enumerated value set - * - * An attribute definition has been parsed - */ -void -xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, - int type, int def, const xmlChar *defaultValue, - xmlEnumerationPtr tree) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlAttributePtr attr; - xmlChar *name = NULL, *prefix = NULL; - - if ((ctxt == NULL) || (ctxt->myDoc == NULL)) - return; - - if ((xmlStrEqual(fullname, BAD_CAST "xml:id")) && - (type != XML_ATTRIBUTE_ID)) { - /* - * Raise the error but keep the validity flag - */ - int tmp = ctxt->valid; - SAXxmlErrValid(ctxt, XML_DTD_XMLID_TYPE, - "xml:id : attribute type should be ID\n", NULL, NULL); - ctxt->valid = tmp; - } - /* TODO: optimize name/prefix allocation */ - name = xmlSplitQName(ctxt, fullname, &prefix); - ctxt->vctxt.valid = 1; - if (ctxt->inSubset == 1) - attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem, - name, prefix, (xmlAttributeType) type, - (xmlAttributeDefault) def, defaultValue, tree); - else if (ctxt->inSubset == 2) - attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem, - name, prefix, (xmlAttributeType) type, - (xmlAttributeDefault) def, defaultValue, tree); - else { - SAXxmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, - "SAX.xmlSAX2AttributeDecl(%s) called while not in subset\n", - name, NULL); - xmlFreeEnumeration(tree); - return; - } - if (prefix != NULL) - xmlFree(prefix); - if (name != NULL) - xmlFree(name); -} - -/** - * xmlSAX2ElementDecl: - * @ctx: the user data (XML parser context) - * @name: the element name - * @type: the element type - * @content: the element value tree - * - * An element definition has been parsed - */ -void -xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type, - xmlElementContentPtr content) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlElementPtr elem = NULL; - - if ((ctxt == NULL) || (ctxt->myDoc == NULL)) - return; - - - if (ctxt->inSubset == 1) - elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, - name, (xmlElementTypeVal) type, content); - else if (ctxt->inSubset == 2) - elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, - name, (xmlElementTypeVal) type, content); - else { - SAXxmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, - "SAX.xmlSAX2ElementDecl(%s) called while not in subset\n", - name, NULL); - return; - } -} - -/** - * xmlSAX2NotationDecl: - * @ctx: the user data (XML parser context) - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -void -xmlSAX2NotationDecl(void *ctx, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlNotationPtr nota = NULL; - - if ((ctxt == NULL) || (ctxt->myDoc == NULL)) - return; - - - if ((publicId == NULL) && (systemId == NULL)) { - SAXxmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING, - "SAX.xmlSAX2NotationDecl(%s) externalID or PublicID missing\n", - name, NULL); - return; - } else if (ctxt->inSubset == 1) - nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name, - publicId, systemId); - else if (ctxt->inSubset == 2) - nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, name, - publicId, systemId); - else { - SAXxmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING, - "SAX.xmlSAX2NotationDecl(%s) called while not in subset\n", - name, NULL); - return; - } -} - -/** - * xmlSAX2UnparsedEntityDecl: - * @ctx: the user data (XML parser context) - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed - */ -void -xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId, - const xmlChar *notationName) -{ - xmlEntityPtr ent; - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if (ctx == NULL) return; - if (ctxt->inSubset == 1) { - ent = xmlAddDocEntity(ctxt->myDoc, name, - XML_EXTERNAL_GENERAL_UNPARSED_ENTITY, - publicId, systemId, notationName); - if ((ent == NULL) && (ctxt->pedantic) && - (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, - "Entity(%s) already defined in the internal subset\n", name); - if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { - xmlChar *URI; - const char *base = NULL; - - if (ctxt->input != NULL) - base = ctxt->input->filename; - if (base == NULL) - base = ctxt->directory; - - URI = xmlBuildURI(systemId, (const xmlChar *) base); - ent->URI = URI; - } - } else if (ctxt->inSubset == 2) { - ent = xmlAddDtdEntity(ctxt->myDoc, name, - XML_EXTERNAL_GENERAL_UNPARSED_ENTITY, - publicId, systemId, notationName); - if ((ent == NULL) && (ctxt->pedantic) && - (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) - ctxt->sax->warning(ctxt->userData, - "Entity(%s) already defined in the external subset\n", name); - if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { - xmlChar *URI; - const char *base = NULL; - - if (ctxt->input != NULL) - base = ctxt->input->filename; - if (base == NULL) - base = ctxt->directory; - - URI = xmlBuildURI(systemId, (const xmlChar *) base); - ent->URI = URI; - } - } else { - SAXxmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, - "SAX.xmlSAX2UnparsedEntityDecl(%s) called while not in subset\n", - name, NULL); - } -} - -/** - * xmlSAX2SetDocumentLocator: - * @ctx: the user data (XML parser context) - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator - * Everything is available on the context, so this is useless in our case. - */ -void -xmlSAX2SetDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED) -{ - /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ -} - -/** - * xmlSAX2StartDocument: - * @ctx: the user data (XML parser context) - * - * called when the document start being processed. - */ -void -xmlSAX2StartDocument(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlDocPtr doc; - - if (ctx == NULL) return; - - if (ctxt->html) { - xmlGenericError(xmlGenericErrorContext, - "libxml2 built without HTML support\n"); - ctxt->errNo = XML_ERR_INTERNAL_ERROR; - ctxt->instate = XML_PARSER_EOF; - ctxt->disableSAX = 1; - return; - } else { - doc = ctxt->myDoc = xmlNewDoc(ctxt->version); - if (doc != NULL) { - doc->properties = 0; - if (ctxt->options & XML_PARSE_OLD10) - doc->properties |= XML_DOC_OLD10; - doc->parseFlags = ctxt->options; - if (ctxt->encoding != NULL) - doc->encoding = xmlStrdup(ctxt->encoding); - else - doc->encoding = NULL; - doc->standalone = ctxt->standalone; - } else { - xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); - return; - } - if ((ctxt->dictNames) && (doc != NULL)) { - doc->dict = ctxt->dict; - xmlDictReference(doc->dict); - } - } - if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) && - (ctxt->input != NULL) && (ctxt->input->filename != NULL)) { - ctxt->myDoc->URL = xmlPathToURI((const xmlChar *)ctxt->input->filename); - if (ctxt->myDoc->URL == NULL) - xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); - } -} - -/** - * xmlSAX2EndDocument: - * @ctx: the user data (XML parser context) - * - * called when the document end has been detected. - */ -void -xmlSAX2EndDocument(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - if (ctx == NULL) return; - - /* - * Grab the encoding if it was added on-the-fly - */ - if ((ctxt->encoding != NULL) && (ctxt->myDoc != NULL) && - (ctxt->myDoc->encoding == NULL)) { - ctxt->myDoc->encoding = ctxt->encoding; - ctxt->encoding = NULL; - } - if ((ctxt->inputTab != NULL) && - (ctxt->inputNr > 0) && (ctxt->inputTab[0] != NULL) && - (ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) && - (ctxt->myDoc->encoding == NULL)) { - ctxt->myDoc->encoding = xmlStrdup(ctxt->inputTab[0]->encoding); - } - if ((ctxt->charset != XML_CHAR_ENCODING_NONE) && (ctxt->myDoc != NULL) && - (ctxt->myDoc->charset == XML_CHAR_ENCODING_NONE)) { - ctxt->myDoc->charset = ctxt->charset; - } -} - -/* - * xmlSAX2TextNode: - * @ctxt: the parser context - * @str: the input string - * @len: the string length - * - * Remove the entities from an attribute value - * - * Returns the newly allocated string or NULL if not needed or error - */ -static xmlNodePtr -xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) { - xmlNodePtr ret; - const xmlChar *intern = NULL; - - /* - * Allocate - */ - if (ctxt->freeElems != NULL) { - ret = ctxt->freeElems; - ctxt->freeElems = ret->next; - ctxt->freeElemsNr--; - } else { - ret = (xmlNodePtr) xmlMalloc(sizeof(xmlNode)); - } - if (ret == NULL) { - xmlErrMemory(ctxt, "xmlSAX2Characters"); - return(NULL); - } - memset(ret, 0, sizeof(xmlNode)); - /* - * intern the formatting blanks found between tags, or the - * very short strings - */ - if (ctxt->dictNames) { - xmlChar cur = str[len]; - - if ((len < (int) (2 * sizeof(void *))) && - (ctxt->options & XML_PARSE_COMPACT)) { - /* store the string in the node overrithing properties and nsDef */ - xmlChar *tmp = (xmlChar *) &(ret->properties); - memcpy(tmp, str, len); - tmp[len] = 0; - intern = tmp; - } else if ((len <= 3) && ((cur == '"') || (cur == '\'') || - ((cur == '<') && (str[len + 1] != '!')))) { - intern = xmlDictLookup(ctxt->dict, str, len); - } else if (IS_BLANK_CH(*str) && (len < 60) && (cur == '<') && - (str[len + 1] != '!')) { - int i; - - for (i = 1;i < len;i++) { - if (!IS_BLANK_CH(str[i])) goto skip; - } - intern = xmlDictLookup(ctxt->dict, str, len); - } - } -skip: - ret->type = XML_TEXT_NODE; - - ret->name = xmlStringText; - if (intern == NULL) { - ret->content = xmlStrndup(str, len); - if (ret->content == NULL) { - xmlSAX2ErrMemory(ctxt, "xmlSAX2TextNode"); - xmlFree(ret); - return(NULL); - } - } else - ret->content = (xmlChar *) intern; - - if (ctxt->input != NULL) - ret->line = ctxt->input->line; - - if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) - xmlRegisterNodeDefaultValue(ret); - return(ret); -} - -/** - * xmlSAX2AttributeNs: - * @ctx: the user data (XML parser context) - * @localname: the local name of the attribute - * @prefix: the attribute namespace prefix if available - * @URI: the attribute namespace name if available - * @value: Start of the attribute value - * @valueend: end of the attribute value - * - * Handle an attribute that has been read by the parser. - * The default handling is to convert the attribute into an - * DOM subtree and past it in a new xmlAttr element added to - * the element. - */ -static void -xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, - const xmlChar * localname, - const xmlChar * prefix, - const xmlChar * value, - const xmlChar * valueend) -{ - xmlAttrPtr ret; - xmlNsPtr namespace = NULL; - xmlChar *dup = NULL; - - /* - * Note: if prefix == NULL, the attribute is not in the default namespace - */ - if (prefix != NULL) - namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, prefix); - - /* - * allocate the node - */ - if (ctxt->freeAttrs != NULL) { - ret = ctxt->freeAttrs; - ctxt->freeAttrs = ret->next; - ctxt->freeAttrsNr--; - memset(ret, 0, sizeof(xmlAttr)); - ret->type = XML_ATTRIBUTE_NODE; - - ret->parent = ctxt->node; - ret->doc = ctxt->myDoc; - ret->ns = namespace; - - if (ctxt->dictNames) - ret->name = localname; - else - ret->name = xmlStrdup(localname); - - /* link at the end to preserv order, TODO speed up with a last */ - if (ctxt->node->properties == NULL) { - ctxt->node->properties = ret; - } else { - xmlAttrPtr prev = ctxt->node->properties; - - while (prev->next != NULL) prev = prev->next; - prev->next = ret; - ret->prev = prev; - } - - if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) - xmlRegisterNodeDefaultValue((xmlNodePtr)ret); - } else { - if (ctxt->dictNames) - ret = xmlNewNsPropEatName(ctxt->node, namespace, - (xmlChar *) localname, NULL); - else - ret = xmlNewNsProp(ctxt->node, namespace, localname, NULL); - if (ret == NULL) { - xmlErrMemory(ctxt, "xmlSAX2AttributeNs"); - return; - } - } - - if ((ctxt->replaceEntities == 0) && (!ctxt->html)) { - xmlNodePtr tmp; - - /* - * We know that if there is an entity reference, then - * the string has been dup'ed and terminates with 0 - * otherwise with ' or " - */ - if (*valueend != 0) { - tmp = xmlSAX2TextNode(ctxt, value, valueend - value); - ret->children = tmp; - ret->last = tmp; - if (tmp != NULL) { - tmp->doc = ret->doc; - tmp->parent = (xmlNodePtr) ret; - } - } else { - ret->children = xmlStringLenGetNodeList(ctxt->myDoc, value, - valueend - value); - tmp = ret->children; - while (tmp != NULL) { - tmp->doc = ret->doc; - tmp->parent = (xmlNodePtr) ret; - if (tmp->next == NULL) - ret->last = tmp; - tmp = tmp->next; - } - } - } else if (value != NULL) { - xmlNodePtr tmp; - - tmp = xmlSAX2TextNode(ctxt, value, valueend - value); - ret->children = tmp; - ret->last = tmp; - if (tmp != NULL) { - tmp->doc = ret->doc; - tmp->parent = (xmlNodePtr) ret; - } - } - - if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) && - (((ctxt->replaceEntities == 0) && (ctxt->external != 2)) || - ((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) { - /* - * when validating, the ID registration is done at the attribute - * validation level. Otherwise we have to do specific handling here. - */ - if ((prefix == ctxt->str_xml) && - (localname[0] == 'i') && (localname[1] == 'd') && - (localname[2] == 0)) { - /* - * Add the xml:id value - * - * Open issue: normalization of the value. - */ - if (dup == NULL) - dup = xmlStrndup(value, valueend - value); - xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); - } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) { - /* might be worth duplicate entry points and not copy */ - if (dup == NULL) - dup = xmlStrndup(value, valueend - value); - xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); - } else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret)) { - if (dup == NULL) - dup = xmlStrndup(value, valueend - value); - xmlAddRef(&ctxt->vctxt, ctxt->myDoc, dup, ret); - } - } - if (dup != NULL) - xmlFree(dup); -} - -/** - * xmlSAX2StartElementNs: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * @nb_namespaces: number of namespace definitions on that node - * @namespaces: pointer to the array of prefix/URI pairs namespace definitions - * @nb_attributes: the number of attributes on that node - * @nb_defaulted: the number of defaulted attributes. - * @attributes: pointer to the array of (localname/prefix/URI/value/end) - * attribute values. - * - * SAX2 callback when an element start has been detected by the parser. - * It provides the namespace informations for the element, as well as - * the new namespace declarations on the element. - */ -void -xmlSAX2StartElementNs(void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlNodePtr ret; - xmlNodePtr parent; - xmlNsPtr last = NULL, ns; - const xmlChar *uri, *pref; - xmlChar *lname = NULL; - int i, j; - - if (ctx == NULL) return; - parent = ctxt->node; - /* - * First check on validity: - */ - if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && - ((ctxt->myDoc->intSubset == NULL) || - ((ctxt->myDoc->intSubset->notations == NULL) && - (ctxt->myDoc->intSubset->elements == NULL) && - (ctxt->myDoc->intSubset->attributes == NULL) && - (ctxt->myDoc->intSubset->entities == NULL)))) { - SAXxmlErrValid(ctxt, XML_ERR_NO_DTD, - "Validation failed: no DTD found !", NULL, NULL); - ctxt->validate = 0; - } - - /* - * Take care of the rare case of an undefined namespace prefix - */ - if ((prefix != NULL) && (URI == NULL)) { - if (ctxt->dictNames) { - const xmlChar *fullname; - - fullname = xmlDictQLookup(ctxt->dict, prefix, localname); - if (fullname != NULL) - localname = fullname; - } else { - lname = xmlBuildQName(localname, prefix, NULL, 0); - } - } - /* - * allocate the node - */ - if (ctxt->freeElems != NULL) { - ret = ctxt->freeElems; - ctxt->freeElems = ret->next; - ctxt->freeElemsNr--; - memset(ret, 0, sizeof(xmlNode)); - ret->type = XML_ELEMENT_NODE; - - if (ctxt->dictNames) - ret->name = localname; - else { - if (lname == NULL) - ret->name = xmlStrdup(localname); - else - ret->name = lname; - if (ret->name == NULL) { - xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); - return; - } - } - if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) - xmlRegisterNodeDefaultValue(ret); - } else { - if (ctxt->dictNames) - ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, - (xmlChar *) localname, NULL); - else if (lname == NULL) - ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); - else - ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, - (xmlChar *) lname, NULL); - if (ret == NULL) { - xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); - return; - } - } - if (ctxt->linenumbers) { - if (ctxt->input != NULL) { - if (ctxt->input->line < 65535) - ret->line = (short) ctxt->input->line; - else - ret->line = 65535; - } - } - - if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { - xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); - } - /* - * Build the namespace list - */ - for (i = 0,j = 0;j < nb_namespaces;j++) { - pref = namespaces[i++]; - uri = namespaces[i++]; - ns = xmlNewNs(NULL, uri, pref); - if (ns != NULL) { - if (last == NULL) { - ret->nsDef = last = ns; - } else { - last->next = ns; - last = ns; - } - if ((URI != NULL) && (prefix == pref)) - ret->ns = ns; - } else { - /* - * any out of memory error would already have been raised - * but we can't be garanteed it's the actual error due to the - * API, best is to skip in this case - */ - continue; - } - } - ctxt->nodemem = -1; - - /* - * We are parsing a new node. - */ - nodePush(ctxt, ret); - - /* - * Link the child element - */ - if (parent != NULL) { - if (parent->type == XML_ELEMENT_NODE) { - xmlAddChild(parent, ret); - } else { - xmlAddSibling(parent, ret); - } - } - - /* - * Insert the defaulted attributes from the DTD only if requested: - */ - if ((nb_defaulted != 0) && - ((ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0)) - nb_attributes -= nb_defaulted; - - /* - * Search the namespace if it wasn't already found - * Note that, if prefix is NULL, this searches for the default Ns - */ - if ((URI != NULL) && (ret->ns == NULL)) { - ret->ns = xmlSearchNs(ctxt->myDoc, parent, prefix); - if ((ret->ns == NULL) && (xmlStrEqual(prefix, BAD_CAST "xml"))) { - ret->ns = xmlSearchNs(ctxt->myDoc, ret, prefix); - } - if (ret->ns == NULL) { - ns = xmlNewNs(ret, NULL, prefix); - if (ns == NULL) { - - xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); - return; - } - if (prefix != NULL) - xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, - "Namespace prefix %s was not found\n", - prefix, NULL); - else - xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, - "Namespace default prefix was not found\n", - NULL, NULL); - } - } - - /* - * process all the other attributes - */ - if (nb_attributes > 0) { - for (j = 0,i = 0;i < nb_attributes;i++,j+=5) { - /* - * Handle the rare case of an undefined atribute prefix - */ - if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) { - if (ctxt->dictNames) { - const xmlChar *fullname; - - fullname = xmlDictQLookup(ctxt->dict, attributes[j+1], - attributes[j]); - if (fullname != NULL) { - xmlSAX2AttributeNs(ctxt, fullname, NULL, - attributes[j+3], attributes[j+4]); - continue; - } - } else { - lname = xmlBuildQName(attributes[j], attributes[j+1], - NULL, 0); - if (lname != NULL) { - xmlSAX2AttributeNs(ctxt, lname, NULL, - attributes[j+3], attributes[j+4]); - xmlFree(lname); - continue; - } - } - } - xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1], - attributes[j+3], attributes[j+4]); - } - } - -} - -/** - * xmlSAX2EndElementNs: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * - * SAX2 callback when an element end has been detected by the parser. - * It provides the namespace informations for the element. - */ -void -xmlSAX2EndElementNs(void *ctx, - const xmlChar * localname ATTRIBUTE_UNUSED, - const xmlChar * prefix ATTRIBUTE_UNUSED, - const xmlChar * URI ATTRIBUTE_UNUSED) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserNodeInfo node_info; - xmlNodePtr cur; - - if (ctx == NULL) return; - cur = ctxt->node; - /* Capture end position and add node */ - if ((ctxt->record_info) && (cur != NULL)) { - node_info.end_pos = ctxt->input->cur - ctxt->input->base; - node_info.end_line = ctxt->input->line; - node_info.node = cur; - xmlParserAddNodeInfo(ctxt, &node_info); - } - ctxt->nodemem = -1; - - - /* - * end of parsing of this node. - */ - nodePop(ctxt); -} - -/** - * xmlSAX2Reference: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * called when an entity xmlSAX2Reference is detected. - */ -void -xmlSAX2Reference(void *ctx, const xmlChar *name) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlNodePtr ret; - - if (ctx == NULL) return; - if (name[0] == '#') - ret = xmlNewCharRef(ctxt->myDoc, name); - else - ret = xmlNewReference(ctxt->myDoc, name); - if (xmlAddChild(ctxt->node, ret) == NULL) { - xmlFreeNode(ret); - } -} - -/** - * xmlSAX2Characters: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some chars from the parser. - */ -void -xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlNodePtr lastChild; - - if (ctx == NULL) return; - /* - * Handle the data if any. If there is no child - * add it as content, otherwise if the last child is text, - * concatenate it, else create a new node of type text. - */ - - if (ctxt->node == NULL) { - return; - } - lastChild = ctxt->node->last; - - /* - * Here we needed an accelerator mechanism in case of very large - * elements. Use an attribute in the structure !!! - */ - if (lastChild == NULL) { - lastChild = xmlSAX2TextNode(ctxt, ch, len); - if (lastChild != NULL) { - ctxt->node->children = lastChild; - ctxt->node->last = lastChild; - lastChild->parent = ctxt->node; - lastChild->doc = ctxt->node->doc; - ctxt->nodelen = len; - ctxt->nodemem = len + 1; - } else { - xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); - return; - } - } else { - int coalesceText = (lastChild != NULL) && - (lastChild->type == XML_TEXT_NODE) && - (lastChild->name == xmlStringText); - if ((coalesceText) && (ctxt->nodemem != 0)) { - /* - * The whole point of maintaining nodelen and nodemem, - * xmlTextConcat is too costly, i.e. compute length, - * reallocate a new buffer, move data, append ch. Here - * We try to minimaze realloc() uses and avoid copying - * and recomputing length over and over. - */ - if (lastChild->content == (xmlChar *)&(lastChild->properties)) { - lastChild->content = xmlStrdup(lastChild->content); - lastChild->properties = NULL; - } else if ((ctxt->nodemem == ctxt->nodelen + 1) && - (xmlDictOwns(ctxt->dict, lastChild->content))) { - lastChild->content = xmlStrdup(lastChild->content); - } - if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node"); - return; - } - if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len || - (size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) { - xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented"); - return; - } - if (ctxt->nodelen + len >= ctxt->nodemem) { - xmlChar *newbuf; - size_t size; - - size = ctxt->nodemem + len; - size *= 2; - newbuf = (xmlChar *) xmlRealloc(lastChild->content,size); - if (newbuf == NULL) { - xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); - return; - } - ctxt->nodemem = size; - lastChild->content = newbuf; - } - memcpy(&lastChild->content[ctxt->nodelen], ch, len); - ctxt->nodelen += len; - lastChild->content[ctxt->nodelen] = 0; - } else if (coalesceText) { - if (xmlTextConcat(lastChild, ch, len)) { - xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); - } - if (ctxt->node->children != NULL) { - ctxt->nodelen = xmlStrlen(lastChild->content); - ctxt->nodemem = ctxt->nodelen + 1; - } - } else { - /* Mixed content, first time */ - lastChild = xmlSAX2TextNode(ctxt, ch, len); - if (lastChild != NULL) { - xmlAddChild(ctxt->node, lastChild); - if (ctxt->node->children != NULL) { - ctxt->nodelen = len; - ctxt->nodemem = len + 1; - } - } - } - } -} - -/** - * xmlSAX2IgnorableWhitespace: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some ignorable whitespaces from the parser. - * UNUSED: by default the DOM building will use xmlSAX2Characters - */ -void -xmlSAX2IgnorableWhitespace(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch ATTRIBUTE_UNUSED, int len ATTRIBUTE_UNUSED) -{ - /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ -} - -/** - * xmlSAX2ProcessingInstruction: - * @ctx: the user data (XML parser context) - * @target: the target name - * @data: the PI data's - * - * A processing instruction has been parsed. - */ -void -xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, - const xmlChar *data) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlNodePtr ret; - xmlNodePtr parent; - - if (ctx == NULL) return; - parent = ctxt->node; - - ret = xmlNewDocPI(ctxt->myDoc, target, data); - if (ret == NULL) return; - - if (ctxt->linenumbers) { - if (ctxt->input != NULL) { - if (ctxt->input->line < 65535) - ret->line = (short) ctxt->input->line; - else - ret->line = 65535; - } - } - if (ctxt->inSubset == 1) { - xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret); - return; - } else if (ctxt->inSubset == 2) { - xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); - return; - } - if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { - xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); - return; - } - if (parent->type == XML_ELEMENT_NODE) { - xmlAddChild(parent, ret); - } else { - xmlAddSibling(parent, ret); - } -} - -/** - * xmlSAX2Comment: - * @ctx: the user data (XML parser context) - * @value: the xmlSAX2Comment content - * - * A xmlSAX2Comment has been parsed. - */ -void -xmlSAX2Comment(void *ctx, const xmlChar *value) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlNodePtr ret; - xmlNodePtr parent; - - if (ctx == NULL) return; - parent = ctxt->node; - ret = xmlNewDocComment(ctxt->myDoc, value); - if (ret == NULL) return; - if (ctxt->linenumbers) { - if (ctxt->input != NULL) { - if (ctxt->input->line < 65535) - ret->line = (short) ctxt->input->line; - else - ret->line = 65535; - } - } - - if (ctxt->inSubset == 1) { - xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret); - return; - } else if (ctxt->inSubset == 2) { - xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); - return; - } - if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { - xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); - return; - } - if (parent->type == XML_ELEMENT_NODE) { - xmlAddChild(parent, ret); - } else { - xmlAddSibling(parent, ret); - } -} - -/** - * xmlSAX2CDataBlock: - * @ctx: the user data (XML parser context) - * @value: The pcdata content - * @len: the block length - * - * called when a pcdata block has been parsed - */ -void -xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlNodePtr ret, lastChild; - - if (ctx == NULL) return; - lastChild = xmlGetLastChild(ctxt->node); - if ((lastChild != NULL) && - (lastChild->type == XML_CDATA_SECTION_NODE)) { - xmlTextConcat(lastChild, value, len); - } else { - ret = xmlNewCDataBlock(ctxt->myDoc, value, len); - xmlAddChild(ctxt->node, ret); - } -} - -static int xmlSAX2DefaultVersionValue = 2; - -/** - * xmlSAXVersion: - * @hdlr: the SAX handler - * @version: the version, 1 or 2 - * - * Initialize the default XML SAX handler according to the version - * - * Returns 0 in case of success and -1 in case of error. - */ -int -xmlSAXVersion(xmlSAXHandler *hdlr, int version) -{ - if (hdlr == NULL) return(-1); - if (version == 2) { - hdlr->startElement = NULL; - hdlr->endElement = NULL; - hdlr->startElementNs = xmlSAX2StartElementNs; - hdlr->endElementNs = xmlSAX2EndElementNs; - hdlr->serror = NULL; - hdlr->initialized = XML_SAX2_MAGIC; - } else - return(-1); - hdlr->internalSubset = xmlSAX2InternalSubset; - hdlr->externalSubset = xmlSAX2ExternalSubset; - hdlr->isStandalone = xmlSAX2IsStandalone; - hdlr->hasInternalSubset = xmlSAX2HasInternalSubset; - hdlr->hasExternalSubset = xmlSAX2HasExternalSubset; - hdlr->resolveEntity = xmlSAX2ResolveEntity; - hdlr->getEntity = xmlSAX2GetEntity; - hdlr->getParameterEntity = xmlSAX2GetParameterEntity; - hdlr->entityDecl = xmlSAX2EntityDecl; - hdlr->attributeDecl = xmlSAX2AttributeDecl; - hdlr->elementDecl = xmlSAX2ElementDecl; - hdlr->notationDecl = xmlSAX2NotationDecl; - hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl; - hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator; - hdlr->startDocument = xmlSAX2StartDocument; - hdlr->endDocument = xmlSAX2EndDocument; - hdlr->reference = xmlSAX2Reference; - hdlr->characters = xmlSAX2Characters; - hdlr->cdataBlock = xmlSAX2CDataBlock; - hdlr->ignorableWhitespace = xmlSAX2Characters; - hdlr->processingInstruction = xmlSAX2ProcessingInstruction; - hdlr->comment = xmlSAX2Comment; - hdlr->warning = xmlParserWarning; - hdlr->error = xmlParserError; - hdlr->fatalError = xmlParserError; - - return(0); -} - -/** - * xmlSAX2InitDefaultSAXHandler: - * @hdlr: the SAX handler - * @warning: flag if non-zero sets the handler warning procedure - * - * Initialize the default XML SAX2 handler - */ -void -xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning) -{ - if ((hdlr == NULL) || (hdlr->initialized != 0)) - return; - - xmlSAXVersion(hdlr, xmlSAX2DefaultVersionValue); - if (warning == 0) - hdlr->warning = NULL; - else - hdlr->warning = xmlParserWarning; -} - -/** - * xmlDefaultSAXHandlerInit: - * - * Initialize the default SAX2 handler - */ -void -xmlDefaultSAXHandlerInit(void) -{ -} - -#define bottom_SAX2 -#include "elfgcchack.h" diff --git a/deps/libxml2/chvalid.c b/deps/libxml2/chvalid.c deleted file mode 100755 index 00dd962c33..0000000000 --- a/deps/libxml2/chvalid.c +++ /dev/null @@ -1,336 +0,0 @@ -/* - * chvalid.c: this module implements the character range - * validation APIs - * - * This file is automatically generated from the cvs source - * definition files using the genChRanges.py Python script - * - * Generation date: Mon Mar 27 11:09:48 2006 - * Sources: chvalid.def - * William Brack - */ - -#define IN_LIBXML -#include "libxml.h" -#include - -/* - * The initial tables ({func_name}_tab) are used to validate whether a - * single-byte character is within the specified group. Each table - * contains 256 bytes, with each byte representing one of the 256 - * possible characters. If the table byte is set, the character is - * allowed. - * - */ -const unsigned char xmlIsPubidChar_tab[256] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, - 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 }; - -static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131}, - {0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3}, - {0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8}, - {0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c}, - {0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da}, - {0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3}, - {0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481}, - {0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb}, - {0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559}, - {0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, - {0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce}, - {0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939}, - {0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990}, - {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, - {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a}, - {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, - {0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e}, - {0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91}, - {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, - {0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, - {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39}, - {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, - {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5}, - {0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, - {0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c}, - {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, - {0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, - {0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e}, - {0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82}, - {0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d}, - {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5}, - {0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0}, - {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47}, - {0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100}, - {0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c}, - {0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140}, - {0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155}, - {0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165}, - {0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173}, - {0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab}, - {0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2}, - {0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b}, - {0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, - {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, - {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, - {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, - {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, - {0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182}, - {0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}}; -const xmlChRangeGroup xmlIsBaseCharGroup = - {197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0}; - -static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff}, - {0xe000, 0xfffd}}; -static const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}}; -const xmlChRangeGroup xmlIsCharGroup = - {2, 1, xmlIsChar_srng, xmlIsChar_lrng}; - -static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345}, - {0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, - {0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, - {0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df}, - {0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903}, - {0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954}, - {0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be}, - {0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd}, - {0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c}, - {0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48}, - {0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc}, - {0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03}, - {0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d}, - {0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, - {0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44}, - {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83}, - {0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6}, - {0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d}, - {0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e}, - {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd}, - {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39}, - {0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b}, - {0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7}, - {0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f}, - {0x3099, 0x3099}, {0x309a, 0x309a}}; -const xmlChRangeGroup xmlIsCombiningGroup = - {95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0}; - -static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669}, - {0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f}, - {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f}, - {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, - {0xf20, 0xf29}}; -const xmlChRangeGroup xmlIsDigitGroup = - {14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0}; - -static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0}, - {0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46}, - {0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e}, - {0x30fc, 0x30fe}}; -const xmlChRangeGroup xmlIsExtenderGroup = - {10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0}; - -static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007}, - {0x3021, 0x3029}, {0x4e00, 0x9fa5}}; -const xmlChRangeGroup xmlIsIdeographicGroup = - {3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0}; - - -/** - * xmlCharInRange: - * @val: character to be validated - * @rptr: pointer to range to be used to validate - * - * Does a binary search of the range table to determine if char - * is valid - * - * Returns: true if character valid, false otherwise - */ -int -xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) { - int low, high, mid; - const xmlChSRange *sptr; - const xmlChLRange *lptr; - - if (rptr == NULL) return(0); - if (val < 0x10000) { /* is val in 'short' or 'long' array? */ - if (rptr->nbShortRange == 0) - return 0; - low = 0; - high = rptr->nbShortRange - 1; - sptr = rptr->shortRange; - while (low <= high) { - mid = (low + high) / 2; - if ((unsigned short) val < sptr[mid].low) { - high = mid - 1; - } else { - if ((unsigned short) val > sptr[mid].high) { - low = mid + 1; - } else { - return 1; - } - } - } - } else { - if (rptr->nbLongRange == 0) { - return 0; - } - low = 0; - high = rptr->nbLongRange - 1; - lptr = rptr->longRange; - while (low <= high) { - mid = (low + high) / 2; - if (val < lptr[mid].low) { - high = mid - 1; - } else { - if (val > lptr[mid].high) { - low = mid + 1; - } else { - return 1; - } - } - } - } - return 0; -} - - -/** - * xmlIsBaseChar: - * @ch: character to validate - * - * This function is DEPRECATED. - * Use xmlIsBaseChar_ch or xmlIsBaseCharQ instead - * - * Returns true if argument valid, false otherwise - */ -int -xmlIsBaseChar(unsigned int ch) { - return(xmlIsBaseCharQ(ch)); -} - - -/** - * xmlIsBlank: - * @ch: character to validate - * - * This function is DEPRECATED. - * Use xmlIsBlank_ch or xmlIsBlankQ instead - * - * Returns true if argument valid, false otherwise - */ -int -xmlIsBlank(unsigned int ch) { - return(xmlIsBlankQ(ch)); -} - - -/** - * xmlIsChar: - * @ch: character to validate - * - * This function is DEPRECATED. - * Use xmlIsChar_ch or xmlIsCharQ instead - * - * Returns true if argument valid, false otherwise - */ -int -xmlIsChar(unsigned int ch) { - return(xmlIsCharQ(ch)); -} - - -/** - * xmlIsCombining: - * @ch: character to validate - * - * This function is DEPRECATED. - * Use xmlIsCombiningQ instead - * - * Returns true if argument valid, false otherwise - */ -int -xmlIsCombining(unsigned int ch) { - return(xmlIsCombiningQ(ch)); -} - - -/** - * xmlIsDigit: - * @ch: character to validate - * - * This function is DEPRECATED. - * Use xmlIsDigit_ch or xmlIsDigitQ instead - * - * Returns true if argument valid, false otherwise - */ -int -xmlIsDigit(unsigned int ch) { - return(xmlIsDigitQ(ch)); -} - - -/** - * xmlIsExtender: - * @ch: character to validate - * - * This function is DEPRECATED. - * Use xmlIsExtender_ch or xmlIsExtenderQ instead - * - * Returns true if argument valid, false otherwise - */ -int -xmlIsExtender(unsigned int ch) { - return(xmlIsExtenderQ(ch)); -} - - -/** - * xmlIsIdeographic: - * @ch: character to validate - * - * This function is DEPRECATED. - * Use xmlIsIdeographicQ instead - * - * Returns true if argument valid, false otherwise - */ -int -xmlIsIdeographic(unsigned int ch) { - return(xmlIsIdeographicQ(ch)); -} - - -/** - * xmlIsPubidChar: - * @ch: character to validate - * - * This function is DEPRECATED. - * Use xmlIsPubidChar_ch or xmlIsPubidCharQ instead - * - * Returns true if argument valid, false otherwise - */ -int -xmlIsPubidChar(unsigned int ch) { - return(xmlIsPubidCharQ(ch)); -} - -#define bottom_chvalid -#include "elfgcchack.h" diff --git a/deps/libxml2/config.h b/deps/libxml2/config.h deleted file mode 100644 index c05f865e23..0000000000 --- a/deps/libxml2/config.h +++ /dev/null @@ -1,308 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ANSIDECL_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_NAMESER_H 1 - -/* Whether struct sockaddr::__ss_family exists */ -/* #undef HAVE_BROKEN_SS_FAMILY */ - -/* Define to 1 if you have the `class' function. */ -/* #undef HAVE_CLASS */ - -/* Define to 1 if you have the header file. */ -#define HAVE_CTYPE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Have dlopen based dso */ -#define HAVE_DLOPEN /**/ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DL_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `finite' function. */ -#define HAVE_FINITE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FLOAT_H 1 - -/* Define to 1 if you have the `fpclass' function. */ -/* #undef HAVE_FPCLASS */ - -/* Define to 1 if you have the `fprintf' function. */ -#define HAVE_FPRINTF 1 - -/* Define to 1 if you have the `fp_class' function. */ -/* #undef HAVE_FP_CLASS */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_FP_CLASS_H */ - -/* Define to 1 if you have the `ftime' function. */ -#define HAVE_FTIME 1 - -/* Define if getaddrinfo is there */ -/* #undef HAVE_GETADDRINFO */ - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_IEEEFP_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H_H */ - -/* Define if isinf is there */ -#define HAVE_ISINF /**/ - -/* Define if isnan is there */ -#define HAVE_ISNAN /**/ - -/* Define to 1 if you have the `isnand' function. */ -/* #undef HAVE_ISNAND */ - -/* Define if history library is there (-lhistory) */ -/* #undef HAVE_LIBHISTORY */ - -/* Have compression library */ -/* #undef HAVE_LIBLZMA */ - -/* Define if pthread library is there (-lpthread) */ -/* #undef HAVE_LIBPTHREAD */ - -/* Define if readline library is there (-lreadline) */ -/* #undef HAVE_LIBREADLINE */ - -/* Have compression library */ -/* #undef HAVE_LIBZ */ - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the `localtime' function. */ -#define HAVE_LOCALTIME 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LZMA_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MALLOC_H 1 Already defined in AndroidConfig.h */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MATH_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NAN_H */ - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -/* #undef HAVE_NDIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_NETDB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_POLL_H 1 - -/* Define to 1 if you have the `printf' function. */ -#define HAVE_PRINTF 1 - -/* Define if is there */ -/* #undef HAVE_PTHREAD_H */ - -/* Define to 1 if you have the `rand' function. */ -#define HAVE_RAND 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_RESOLV_H 1 - -/* Have shl_load based dso */ -/* #undef HAVE_SHLLOAD */ - -/* Define to 1 if you have the `signal' function. */ -#define HAVE_SIGNAL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define to 1 if you have the `sprintf' function. */ -#define HAVE_SPRINTF 1 - -/* Define to 1 if you have the `srand' function. */ -#define HAVE_SRAND 1 - -/* Define to 1 if you have the `sscanf' function. */ -#define HAVE_SSCANF 1 - -/* Define to 1 if you have the `stat' function. */ -#define HAVE_STAT 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the `strftime' function. */ -#define HAVE_STRFTIME 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strndup' function. */ -#define HAVE_STRNDUP 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIMEB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the `time' function. */ -#define HAVE_TIME 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Whether va_copy() is available */ -#define HAVE_VA_COPY 1 - -/* Define to 1 if you have the `vfprintf' function. */ -#define HAVE_VFPRINTF 1 - -/* Define to 1 if you have the `vsnprintf' function. */ -#define HAVE_VSNPRINTF 1 - -/* Define to 1 if you have the `vsprintf' function. */ -#define HAVE_VSPRINTF 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ZLIB_H */ - -/* Define to 1 if you have the `_stat' function. */ -/* #undef HAVE__STAT */ - -/* Whether __va_copy() is available */ -/* #undef HAVE___VA_COPY */ - -/* Define as const if the declaration of iconv() needs const. */ -/* #undef ICONV_CONST */ - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Name of package */ -#define PACKAGE "libxml2" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to 1 if the C compiler supports function prototypes. */ -#define PROTOTYPES 1 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Support for IPv6 */ -/* #undef SUPPORT_IP6 */ - -/* Version number of package */ -#define VERSION "2.7.8" - -/* Determine what socket length (socklen_t) data type is */ -#define XML_SOCKLEN_T socklen_t - -/* Using the Win32 Socket implementation */ -/* #undef _WINSOCKAPI_ */ - -/* Define like PROTOTYPES; this can be used by system headers. */ -#define __PROTOTYPES 1 - -/* Win32 Std C name mangling work-around */ -/* #undef snprintf */ - -/* ss_family is not defined here, use __ss_family instead */ -/* #undef ss_family */ - -/* Win32 Std C name mangling work-around */ -/* #undef vsnprintf */ diff --git a/deps/libxml2/dict.c b/deps/libxml2/dict.c deleted file mode 100644 index a9a7e2c7e0..0000000000 --- a/deps/libxml2/dict.c +++ /dev/null @@ -1,1079 +0,0 @@ -/* - * dict.c: dictionary of reusable strings, just used to avoid allocation - * and freeing operations. - * - * Copyright (C) 2003-2013 Daniel Veillard. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - * Author: daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif - -/* - * Following http://www.ocert.org/advisories/ocert-2011-003.html - * it seems that having hash randomization might be a good idea - * when using XML with untrusted data - * Note1: that it works correctly only if compiled with WITH_BIG_KEY - * which is the default. - * Note2: the fast function used for a small dict won't protect very - * well but since the attack is based on growing a very big hash - * list we will use the BigKey algo as soon as the hash size grows - * over MIN_DICT_SIZE so this actually works - */ -#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) -#define DICT_RANDOMIZATION -#endif - -#include -#ifdef HAVE_STDINT_H -#include -#else -#ifdef HAVE_INTTYPES_H -#include -#elif defined(WIN32) -typedef unsigned __int32 uint32_t; -#endif -#endif -#include -#include -#include -#include -#include - -#define MAX_HASH_LEN 3 -#define MIN_DICT_SIZE 128 -#define MAX_DICT_HASH 8 * 2048 -#define WITH_BIG_KEY - -#ifdef WITH_BIG_KEY -#define xmlDictComputeKey(dict, name, len) \ - (((dict)->size == MIN_DICT_SIZE) ? \ - xmlDictComputeFastKey(name, len, (dict)->seed) : \ - xmlDictComputeBigKey(name, len, (dict)->seed)) - -#define xmlDictComputeQKey(dict, prefix, plen, name, len) \ - (((prefix) == NULL) ? \ - (xmlDictComputeKey(dict, name, len)) : \ - (((dict)->size == MIN_DICT_SIZE) ? \ - xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed) : \ - xmlDictComputeBigQKey(prefix, plen, name, len, (dict)->seed))) - -#else /* !WITH_BIG_KEY */ -#define xmlDictComputeKey(dict, name, len) \ - xmlDictComputeFastKey(name, len, (dict)->seed) -#define xmlDictComputeQKey(dict, prefix, plen, name, len) \ - xmlDictComputeFastQKey(prefix, plen, name, len, (dict)->seed) -#endif /* WITH_BIG_KEY */ - -/* - * An entry in the dictionnary - */ -typedef struct _xmlDictEntry xmlDictEntry; -typedef xmlDictEntry *xmlDictEntryPtr; -struct _xmlDictEntry { - struct _xmlDictEntry *next; - const xmlChar *name; - int len; - int valid; - unsigned long okey; -}; - -typedef struct _xmlDictStrings xmlDictStrings; -typedef xmlDictStrings *xmlDictStringsPtr; -struct _xmlDictStrings { - xmlDictStringsPtr next; - xmlChar *free; - xmlChar *end; - int size; - int nbStrings; - xmlChar array[1]; -}; -/* - * The entire dictionnary - */ -struct _xmlDict { - int ref_counter; - - struct _xmlDictEntry *dict; - int size; - int nbElems; - xmlDictStringsPtr strings; - - struct _xmlDict *subdict; - /* used for randomization */ - int seed; -}; - -/* - * Whether the dictionary mutex was initialized. - */ -static int xmlDictInitialized = 0; - -/** - * xmlInitializeDict: - * - * Do the dictionary mutex initialization. - * this function is not thread safe, initialization should - * preferably be done once at startup - */ -static int xmlInitializeDict(void) { - if (xmlDictInitialized) - return(1); - -#ifdef DICT_RANDOMIZATION - srand(time(NULL)); -#endif - xmlDictInitialized = 1; - return(1); -} - -/** - * xmlDictCleanup: - * - * Free the dictionary mutex. - */ -void -xmlDictCleanup(void) { - if (!xmlDictInitialized) - return; - - xmlDictInitialized = 0; -} - -/* - * xmlDictAddString: - * @dict: the dictionnary - * @name: the name of the userdata - * @len: the length of the name, if -1 it is recomputed - * - * Add the string to the array[s] - * - * Returns the pointer of the local string, or NULL in case of error. - */ -static const xmlChar * -xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) { - xmlDictStringsPtr pool; - const xmlChar *ret; - int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ - - pool = dict->strings; - while (pool != NULL) { - if (pool->end - pool->free > namelen) - goto found_pool; - if (pool->size > size) size = pool->size; - pool = pool->next; - } - /* - * Not found, need to allocate - */ - if (pool == NULL) { - if (size == 0) size = 1000; - else size *= 4; /* exponential growth */ - if (size < 4 * namelen) - size = 4 * namelen; /* just in case ! */ - pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size); - if (pool == NULL) - return(NULL); - pool->size = size; - pool->nbStrings = 0; - pool->free = &pool->array[0]; - pool->end = &pool->array[size]; - pool->next = dict->strings; - dict->strings = pool; - } -found_pool: - ret = pool->free; - memcpy(pool->free, name, namelen); - pool->free += namelen; - *(pool->free++) = 0; - pool->nbStrings++; - return(ret); -} - -/* - * xmlDictAddQString: - * @dict: the dictionnary - * @prefix: the prefix of the userdata - * @plen: the prefix length - * @name: the name of the userdata - * @len: the length of the name, if -1 it is recomputed - * - * Add the QName to the array[s] - * - * Returns the pointer of the local string, or NULL in case of error. - */ -static const xmlChar * -xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, int plen, - const xmlChar *name, int namelen) -{ - xmlDictStringsPtr pool; - const xmlChar *ret; - int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */ - - if (prefix == NULL) return(xmlDictAddString(dict, name, namelen)); - - pool = dict->strings; - while (pool != NULL) { - if (pool->end - pool->free > namelen + plen + 1) - goto found_pool; - if (pool->size > size) size = pool->size; - pool = pool->next; - } - /* - * Not found, need to allocate - */ - if (pool == NULL) { - if (size == 0) size = 1000; - else size *= 4; /* exponential growth */ - if (size < 4 * (namelen + plen + 1)) - size = 4 * (namelen + plen + 1); /* just in case ! */ - pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size); - if (pool == NULL) - return(NULL); - pool->size = size; - pool->nbStrings = 0; - pool->free = &pool->array[0]; - pool->end = &pool->array[size]; - pool->next = dict->strings; - dict->strings = pool; - } -found_pool: - ret = pool->free; - memcpy(pool->free, prefix, plen); - pool->free += plen; - *(pool->free++) = ':'; - memcpy(pool->free, name, namelen); - pool->free += namelen; - *(pool->free++) = 0; - pool->nbStrings++; - return(ret); -} - -#ifdef WITH_BIG_KEY -/* - * xmlDictComputeBigKey: - * - * Calculate a hash key using a good hash function that works well for - * larger hash table sizes. - * - * Hash function by "One-at-a-Time Hash" see - * http://burtleburtle.net/bob/hash/doobs.html - */ - -static uint32_t -xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) { - uint32_t hash; - int i; - - if (namelen <= 0 || data == NULL) return(0); - - hash = seed; - - for (i = 0;i < namelen; i++) { - hash += data[i]; - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - - return hash; -} - -/* - * xmlDictComputeBigQKey: - * - * Calculate a hash key for two strings using a good hash function - * that works well for larger hash table sizes. - * - * Hash function by "One-at-a-Time Hash" see - * http://burtleburtle.net/bob/hash/doobs.html - * - * Neither of the two strings must be NULL. - */ -static unsigned long -xmlDictComputeBigQKey(const xmlChar *prefix, int plen, - const xmlChar *name, int len, int seed) -{ - uint32_t hash; - int i; - - hash = seed; - - for (i = 0;i < plen; i++) { - hash += prefix[i]; - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += ':'; - hash += (hash << 10); - hash ^= (hash >> 6); - - for (i = 0;i < len; i++) { - hash += name[i]; - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - - return hash; -} -#endif /* WITH_BIG_KEY */ - -/* - * xmlDictComputeFastKey: - * - * Calculate a hash key using a fast hash function that works well - * for low hash table fill. - */ -static unsigned long -xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) { - unsigned long value = seed; - - if (name == NULL) return(0); - value = *name; - value <<= 5; - if (namelen > 10) { - value += name[namelen - 1]; - namelen = 10; - } - switch (namelen) { - case 10: value += name[9]; - case 9: value += name[8]; - case 8: value += name[7]; - case 7: value += name[6]; - case 6: value += name[5]; - case 5: value += name[4]; - case 4: value += name[3]; - case 3: value += name[2]; - case 2: value += name[1]; - default: break; - } - return(value); -} - -/* - * xmlDictComputeFastQKey: - * - * Calculate a hash key for two strings using a fast hash function - * that works well for low hash table fill. - * - * Neither of the two strings must be NULL. - */ -static unsigned long -xmlDictComputeFastQKey(const xmlChar *prefix, int plen, - const xmlChar *name, int len, int seed) -{ - unsigned long value = (unsigned long) seed; - - if (plen == 0) - value += 30 * (unsigned long) ':'; - else - value += 30 * (*prefix); - - if (len > 10) { - value += name[len - (plen + 1 + 1)]; - len = 10; - if (plen > 10) - plen = 10; - } - switch (plen) { - case 10: value += prefix[9]; - case 9: value += prefix[8]; - case 8: value += prefix[7]; - case 7: value += prefix[6]; - case 6: value += prefix[5]; - case 5: value += prefix[4]; - case 4: value += prefix[3]; - case 3: value += prefix[2]; - case 2: value += prefix[1]; - case 1: value += prefix[0]; - default: break; - } - len -= plen; - if (len > 0) { - value += (unsigned long) ':'; - len--; - } - switch (len) { - case 10: value += name[9]; - case 9: value += name[8]; - case 8: value += name[7]; - case 7: value += name[6]; - case 6: value += name[5]; - case 5: value += name[4]; - case 4: value += name[3]; - case 3: value += name[2]; - case 2: value += name[1]; - case 1: value += name[0]; - default: break; - } - return(value); -} - -/** - * xmlDictCreate: - * - * Create a new dictionary - * - * Returns the newly created dictionnary, or NULL if an error occured. - */ -xmlDictPtr -xmlDictCreate(void) { - xmlDictPtr dict; - - if (!xmlDictInitialized) - if (!xmlInitializeDict()) - return(NULL); - - - dict = xmlMalloc(sizeof(xmlDict)); - if (dict) { - dict->ref_counter = 1; - - dict->size = MIN_DICT_SIZE; - dict->nbElems = 0; - dict->dict = xmlMalloc(MIN_DICT_SIZE * sizeof(xmlDictEntry)); - dict->strings = NULL; - dict->subdict = NULL; - if (dict->dict) { - memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry)); -#ifdef DICT_RANDOMIZATION - dict->seed = rand(); -#else - dict->seed = 0; -#endif - return(dict); - } - xmlFree(dict); - } - return(NULL); -} - -/** - * xmlDictCreateSub: - * @sub: an existing dictionnary - * - * Create a new dictionary, inheriting strings from the read-only - * dictionnary @sub. On lookup, strings are first searched in the - * new dictionnary, then in @sub, and if not found are created in the - * new dictionnary. - * - * Returns the newly created dictionnary, or NULL if an error occured. - */ -xmlDictPtr -xmlDictCreateSub(xmlDictPtr sub) { - xmlDictPtr dict = xmlDictCreate(); - - if ((dict != NULL) && (sub != NULL)) { - dict->seed = sub->seed; - dict->subdict = sub; - xmlDictReference(dict->subdict); - } - return(dict); -} - -/** - * xmlDictReference: - * @dict: the dictionnary - * - * Increment the reference counter of a dictionary - * - * Returns 0 in case of success and -1 in case of error - */ -int -xmlDictReference(xmlDictPtr dict) { - if (!xmlDictInitialized) - if (!xmlInitializeDict()) - return(-1); - - if (dict == NULL) return -1; - dict->ref_counter++; - return(0); -} - -/** - * xmlDictGrow: - * @dict: the dictionnary - * @size: the new size of the dictionnary - * - * resize the dictionnary - * - * Returns 0 in case of success, -1 in case of failure - */ -static int -xmlDictGrow(xmlDictPtr dict, int size) { - unsigned long key, okey; - int oldsize, i; - xmlDictEntryPtr iter, next; - struct _xmlDictEntry *olddict; - int ret = 0; - int keep_keys = 1; - - if (dict == NULL) - return(-1); - if (size < 8) - return(-1); - if (size > 8 * 2048) - return(-1); - - - oldsize = dict->size; - olddict = dict->dict; - if (olddict == NULL) - return(-1); - if (oldsize == MIN_DICT_SIZE) - keep_keys = 0; - - dict->dict = xmlMalloc(size * sizeof(xmlDictEntry)); - if (dict->dict == NULL) { - dict->dict = olddict; - return(-1); - } - memset(dict->dict, 0, size * sizeof(xmlDictEntry)); - dict->size = size; - - /* If the two loops are merged, there would be situations where - a new entry needs to allocated and data copied into it from - the main dict. It is nicer to run through the array twice, first - copying all the elements in the main array (less probability of - allocate) and then the rest, so we only free in the second loop. - */ - for (i = 0; i < oldsize; i++) { - if (olddict[i].valid == 0) - continue; - - if (keep_keys) - okey = olddict[i].okey; - else - okey = xmlDictComputeKey(dict, olddict[i].name, olddict[i].len); - key = okey % dict->size; - - if (dict->dict[key].valid == 0) { - memcpy(&(dict->dict[key]), &(olddict[i]), sizeof(xmlDictEntry)); - dict->dict[key].next = NULL; - dict->dict[key].okey = okey; - } else { - xmlDictEntryPtr entry; - - entry = xmlMalloc(sizeof(xmlDictEntry)); - if (entry != NULL) { - entry->name = olddict[i].name; - entry->len = olddict[i].len; - entry->okey = okey; - entry->next = dict->dict[key].next; - entry->valid = 1; - dict->dict[key].next = entry; - } else { - /* - * we don't have much ways to alert from herei - * result is loosing an entry and unicity garantee - */ - ret = -1; - } - } - } - - for (i = 0; i < oldsize; i++) { - iter = olddict[i].next; - while (iter) { - next = iter->next; - - /* - * put back the entry in the new dict - */ - - if (keep_keys) - okey = iter->okey; - else - okey = xmlDictComputeKey(dict, iter->name, iter->len); - key = okey % dict->size; - if (dict->dict[key].valid == 0) { - memcpy(&(dict->dict[key]), iter, sizeof(xmlDictEntry)); - dict->dict[key].next = NULL; - dict->dict[key].valid = 1; - dict->dict[key].okey = okey; - xmlFree(iter); - } else { - iter->next = dict->dict[key].next; - iter->okey = okey; - dict->dict[key].next = iter; - } - - - iter = next; - } - } - - xmlFree(olddict); - - - return(ret); -} - -/** - * xmlDictFree: - * @dict: the dictionnary - * - * Free the hash @dict and its contents. The userdata is - * deallocated with @f if provided. - */ -void -xmlDictFree(xmlDictPtr dict) { - int i; - xmlDictEntryPtr iter; - xmlDictEntryPtr next; - int inside_dict = 0; - xmlDictStringsPtr pool, nextp; - - if (dict == NULL) - return; - - if (!xmlDictInitialized) - if (!xmlInitializeDict()) - return; - - /* decrement the counter, it may be shared by a parser and docs */ - dict->ref_counter--; - if (dict->ref_counter > 0) { - return; - } - - if (dict->subdict != NULL) { - xmlDictFree(dict->subdict); - } - - if (dict->dict) { - for(i = 0; ((i < dict->size) && (dict->nbElems > 0)); i++) { - iter = &(dict->dict[i]); - if (iter->valid == 0) - continue; - inside_dict = 1; - while (iter) { - next = iter->next; - if (!inside_dict) - xmlFree(iter); - dict->nbElems--; - inside_dict = 0; - iter = next; - } - } - xmlFree(dict->dict); - } - pool = dict->strings; - while (pool != NULL) { - nextp = pool->next; - xmlFree(pool); - pool = nextp; - } - xmlFree(dict); -} - -/** - * xmlDictLookup: - * @dict: the dictionnary - * @name: the name of the userdata - * @len: the length of the name, if -1 it is recomputed - * - * Add the @name to the dictionnary @dict if not present. - * - * Returns the internal copy of the name or NULL in case of internal error - */ -const xmlChar * -xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) { - unsigned long key, okey, nbi = 0; - xmlDictEntryPtr entry; - xmlDictEntryPtr insert; - const xmlChar *ret; - - if ((dict == NULL) || (name == NULL)) - return(NULL); - - if (len < 0) - len = strlen((const char *) name); - - /* - * Check for duplicate and insertion location. - */ - okey = xmlDictComputeKey(dict, name, len); - key = okey % dict->size; - if (dict->dict[key].valid == 0) { - insert = NULL; - } else { - for (insert = &(dict->dict[key]); insert->next != NULL; - insert = insert->next) { -#ifdef __GNUC__ - if ((insert->okey == okey) && (insert->len == len)) { - if (!memcmp(insert->name, name, len)) - return(insert->name); - } -#else - if ((insert->okey == okey) && (insert->len == len) && - (!xmlStrncmp(insert->name, name, len))) - return(insert->name); -#endif - nbi++; - } -#ifdef __GNUC__ - if ((insert->okey == okey) && (insert->len == len)) { - if (!memcmp(insert->name, name, len)) - return(insert->name); - } -#else - if ((insert->okey == okey) && (insert->len == len) && - (!xmlStrncmp(insert->name, name, len))) - return(insert->name); -#endif - } - - if (dict->subdict) { - unsigned long skey; - - /* we cannot always reuse the same okey for the subdict */ - if (((dict->size == MIN_DICT_SIZE) && - (dict->subdict->size != MIN_DICT_SIZE)) || - ((dict->size != MIN_DICT_SIZE) && - (dict->subdict->size == MIN_DICT_SIZE))) - skey = xmlDictComputeKey(dict->subdict, name, len); - else - skey = okey; - - key = skey % dict->subdict->size; - if (dict->subdict->dict[key].valid != 0) { - xmlDictEntryPtr tmp; - - for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; - tmp = tmp->next) { -#ifdef __GNUC__ - if ((tmp->okey == skey) && (tmp->len == len)) { - if (!memcmp(tmp->name, name, len)) - return(tmp->name); - } -#else - if ((tmp->okey == skey) && (tmp->len == len) && - (!xmlStrncmp(tmp->name, name, len))) - return(tmp->name); -#endif - nbi++; - } -#ifdef __GNUC__ - if ((tmp->okey == skey) && (tmp->len == len)) { - if (!memcmp(tmp->name, name, len)) - return(tmp->name); - } -#else - if ((tmp->okey == skey) && (tmp->len == len) && - (!xmlStrncmp(tmp->name, name, len))) - return(tmp->name); -#endif - } - key = okey % dict->size; - } - - ret = xmlDictAddString(dict, name, len); - if (ret == NULL) - return(NULL); - if (insert == NULL) { - entry = &(dict->dict[key]); - } else { - entry = xmlMalloc(sizeof(xmlDictEntry)); - if (entry == NULL) - return(NULL); - } - entry->name = ret; - entry->len = len; - entry->next = NULL; - entry->valid = 1; - entry->okey = okey; - - - if (insert != NULL) - insert->next = entry; - - dict->nbElems++; - - if ((nbi > MAX_HASH_LEN) && - (dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN))) { - if (xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size) != 0) - return(NULL); - } - /* Note that entry may have been freed at this point by xmlDictGrow */ - - return(ret); -} - -/** - * xmlDictExists: - * @dict: the dictionnary - * @name: the name of the userdata - * @len: the length of the name, if -1 it is recomputed - * - * Check if the @name exists in the dictionnary @dict. - * - * Returns the internal copy of the name or NULL if not found. - */ -const xmlChar * -xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) { - unsigned long key, okey, nbi = 0; - xmlDictEntryPtr insert; - - if ((dict == NULL) || (name == NULL)) - return(NULL); - - if (len < 0) - len = strlen((const char *) name); - - /* - * Check for duplicate and insertion location. - */ - okey = xmlDictComputeKey(dict, name, len); - key = okey % dict->size; - if (dict->dict[key].valid == 0) { - insert = NULL; - } else { - for (insert = &(dict->dict[key]); insert->next != NULL; - insert = insert->next) { -#ifdef __GNUC__ - if ((insert->okey == okey) && (insert->len == len)) { - if (!memcmp(insert->name, name, len)) - return(insert->name); - } -#else - if ((insert->okey == okey) && (insert->len == len) && - (!xmlStrncmp(insert->name, name, len))) - return(insert->name); -#endif - nbi++; - } -#ifdef __GNUC__ - if ((insert->okey == okey) && (insert->len == len)) { - if (!memcmp(insert->name, name, len)) - return(insert->name); - } -#else - if ((insert->okey == okey) && (insert->len == len) && - (!xmlStrncmp(insert->name, name, len))) - return(insert->name); -#endif - } - - if (dict->subdict) { - unsigned long skey; - - /* we cannot always reuse the same okey for the subdict */ - if (((dict->size == MIN_DICT_SIZE) && - (dict->subdict->size != MIN_DICT_SIZE)) || - ((dict->size != MIN_DICT_SIZE) && - (dict->subdict->size == MIN_DICT_SIZE))) - skey = xmlDictComputeKey(dict->subdict, name, len); - else - skey = okey; - - key = skey % dict->subdict->size; - if (dict->subdict->dict[key].valid != 0) { - xmlDictEntryPtr tmp; - - for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; - tmp = tmp->next) { -#ifdef __GNUC__ - if ((tmp->okey == skey) && (tmp->len == len)) { - if (!memcmp(tmp->name, name, len)) - return(tmp->name); - } -#else - if ((tmp->okey == skey) && (tmp->len == len) && - (!xmlStrncmp(tmp->name, name, len))) - return(tmp->name); -#endif - nbi++; - } -#ifdef __GNUC__ - if ((tmp->okey == skey) && (tmp->len == len)) { - if (!memcmp(tmp->name, name, len)) - return(tmp->name); - } -#else - if ((tmp->okey == skey) && (tmp->len == len) && - (!xmlStrncmp(tmp->name, name, len))) - return(tmp->name); -#endif - } - } - - /* not found */ - return(NULL); -} - -/** - * xmlDictQLookup: - * @dict: the dictionnary - * @prefix: the prefix - * @name: the name - * - * Add the QName @prefix:@name to the hash @dict if not present. - * - * Returns the internal copy of the QName or NULL in case of internal error - */ -const xmlChar * -xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) { - unsigned long okey, key, nbi = 0; - xmlDictEntryPtr entry; - xmlDictEntryPtr insert; - const xmlChar *ret; - int len, plen, l; - - if ((dict == NULL) || (name == NULL)) - return(NULL); - if (prefix == NULL) - return(xmlDictLookup(dict, name, -1)); - - l = len = strlen((const char *) name); - plen = strlen((const char *) prefix); - len += 1 + plen; - - /* - * Check for duplicate and insertion location. - */ - okey = xmlDictComputeQKey(dict, prefix, plen, name, l); - key = okey % dict->size; - if (dict->dict[key].valid == 0) { - insert = NULL; - } else { - for (insert = &(dict->dict[key]); insert->next != NULL; - insert = insert->next) { - if ((insert->okey == okey) && (insert->len == len) && - (xmlStrQEqual(prefix, name, insert->name))) - return(insert->name); - nbi++; - } - if ((insert->okey == okey) && (insert->len == len) && - (xmlStrQEqual(prefix, name, insert->name))) - return(insert->name); - } - - if (dict->subdict) { - unsigned long skey; - - /* we cannot always reuse the same okey for the subdict */ - if (((dict->size == MIN_DICT_SIZE) && - (dict->subdict->size != MIN_DICT_SIZE)) || - ((dict->size != MIN_DICT_SIZE) && - (dict->subdict->size == MIN_DICT_SIZE))) - skey = xmlDictComputeQKey(dict->subdict, prefix, plen, name, l); - else - skey = okey; - - key = skey % dict->subdict->size; - if (dict->subdict->dict[key].valid != 0) { - xmlDictEntryPtr tmp; - for (tmp = &(dict->subdict->dict[key]); tmp->next != NULL; - tmp = tmp->next) { - if ((tmp->okey == skey) && (tmp->len == len) && - (xmlStrQEqual(prefix, name, tmp->name))) - return(tmp->name); - nbi++; - } - if ((tmp->okey == skey) && (tmp->len == len) && - (xmlStrQEqual(prefix, name, tmp->name))) - return(tmp->name); - } - key = okey % dict->size; - } - - ret = xmlDictAddQString(dict, prefix, plen, name, l); - if (ret == NULL) - return(NULL); - if (insert == NULL) { - entry = &(dict->dict[key]); - } else { - entry = xmlMalloc(sizeof(xmlDictEntry)); - if (entry == NULL) - return(NULL); - } - entry->name = ret; - entry->len = len; - entry->next = NULL; - entry->valid = 1; - entry->okey = okey; - - if (insert != NULL) - insert->next = entry; - - dict->nbElems++; - - if ((nbi > MAX_HASH_LEN) && - (dict->size <= ((MAX_DICT_HASH / 2) / MAX_HASH_LEN))) - xmlDictGrow(dict, MAX_HASH_LEN * 2 * dict->size); - /* Note that entry may have been freed at this point by xmlDictGrow */ - - return(ret); -} - -/** - * xmlDictOwns: - * @dict: the dictionnary - * @str: the string - * - * check if a string is owned by the disctionary - * - * Returns 1 if true, 0 if false and -1 in case of error - * -1 in case of error - */ -int -xmlDictOwns(xmlDictPtr dict, const xmlChar *str) { - xmlDictStringsPtr pool; - - if ((dict == NULL) || (str == NULL)) - return(-1); - pool = dict->strings; - while (pool != NULL) { - if ((str >= &pool->array[0]) && (str <= pool->free)) - return(1); - pool = pool->next; - } - if (dict->subdict) - return(xmlDictOwns(dict->subdict, str)); - return(0); -} - -/** - * xmlDictSize: - * @dict: the dictionnary - * - * Query the number of elements installed in the hash @dict. - * - * Returns the number of elements in the dictionnary or - * -1 in case of error - */ -int -xmlDictSize(xmlDictPtr dict) { - if (dict == NULL) - return(-1); - if (dict->subdict) - return(dict->nbElems + dict->subdict->nbElems); - return(dict->nbElems); -} - - -#define bottom_dict -#include "elfgcchack.h" diff --git a/deps/libxml2/elfgcchack.h b/deps/libxml2/elfgcchack.h deleted file mode 100644 index 7c22fafe47..0000000000 --- a/deps/libxml2/elfgcchack.h +++ /dev/null @@ -1,6628 +0,0 @@ -/* - * elfgcchack.h: hack by Arjan van de Ven to speed - * up the code when using gcc for call within the library. - * - * Based on the analysis http://people.redhat.com/drepper/dsohowto.pdf - * from Ulrich drepper. Rewritten to be generated from the XML description - * file for libxml2 API - * autogenerated with xsltproc doc/elfgcchack.xsl doc/libxml2-api.xml - */ - -#ifdef IN_LIBXML -#ifdef __GNUC__ -#ifdef PIC -#ifdef linux -#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) - -#include "libxml/c14n.h" -#include "libxml/catalog.h" -#include "libxml/chvalid.h" -#include "libxml/debugXML.h" -#include "libxml/dict.h" -#include "libxml/DOCBparser.h" -#include "libxml/encoding.h" -#include "libxml/entities.h" -#include "libxml/globals.h" -#include "libxml/hash.h" -#include "libxml/HTMLparser.h" -#include "libxml/HTMLtree.h" -#include "libxml/list.h" -#include "libxml/nanoftp.h" -#include "libxml/nanohttp.h" -#include "libxml/parser.h" -#include "libxml/parserInternals.h" -#include "libxml/pattern.h" -#include "libxml/relaxng.h" -#include "libxml/SAX2.h" -#include "libxml/SAX.h" -#include "libxml/schemasInternals.h" -#include "libxml/schematron.h" -#include "libxml/threads.h" -#include "libxml/tree.h" -#include "libxml/uri.h" -#include "libxml/valid.h" -#include "libxml/xinclude.h" -#include "libxml/xlink.h" -#include "libxml/xmlautomata.h" -#include "libxml/xmlerror.h" -#include "libxml/xmlexports.h" -#include "libxml/xmlIO.h" -#include "libxml/xmlmemory.h" -#include "libxml/xmlreader.h" -#include "libxml/xmlregexp.h" -#include "libxml/xmlschemas.h" -#include "libxml/xmlschemastypes.h" -#include "libxml/xmlstring.h" -#include "libxml/xmlunicode.h" -#include "libxml/xmlversion.h" -#include "libxml/xmlwriter.h" -#include "libxml/xpath.h" -#include "libxml/xpathInternals.h" -#include "libxml/xpointer.h" -#include "libxml/xmlmodule.h" - -/* special hot spot not exported ones */ - -#ifdef bottom_globals -#undef __xmlGenericError -extern __typeof (__xmlGenericError) __xmlGenericError __attribute((alias("__xmlGenericError__internal_alias"))); -#else -#ifndef __xmlGenericError -extern __typeof (__xmlGenericError) __xmlGenericError__internal_alias __attribute((visibility("hidden"))); -#define __xmlGenericError __xmlGenericError__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef __xmlGenericErrorContext -extern __typeof (__xmlGenericErrorContext) __xmlGenericErrorContext __attribute((alias("__xmlGenericErrorContext__internal_alias"))); -#else -#ifndef __xmlGenericErrorContext -extern __typeof (__xmlGenericErrorContext) __xmlGenericErrorContext__internal_alias __attribute((visibility("hidden"))); -#define __xmlGenericErrorContext __xmlGenericErrorContext__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef inputPop -extern __typeof (inputPop) inputPop __attribute((alias("inputPop__internal_alias"))); -#else -#ifndef inputPop -extern __typeof (inputPop) inputPop__internal_alias __attribute((visibility("hidden"))); -#define inputPop inputPop__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef inputPush -extern __typeof (inputPush) inputPush __attribute((alias("inputPush__internal_alias"))); -#else -#ifndef inputPush -extern __typeof (inputPush) inputPush__internal_alias __attribute((visibility("hidden"))); -#define inputPush inputPush__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef namePop -extern __typeof (namePop) namePop __attribute((alias("namePop__internal_alias"))); -#else -#ifndef namePop -extern __typeof (namePop) namePop__internal_alias __attribute((visibility("hidden"))); -#define namePop namePop__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef namePush -extern __typeof (namePush) namePush __attribute((alias("namePush__internal_alias"))); -#else -#ifndef namePush -extern __typeof (namePush) namePush__internal_alias __attribute((visibility("hidden"))); -#define namePush namePush__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef nodePop -extern __typeof (nodePop) nodePop __attribute((alias("nodePop__internal_alias"))); -#else -#ifndef nodePop -extern __typeof (nodePop) nodePop__internal_alias __attribute((visibility("hidden"))); -#define nodePop nodePop__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef nodePush -extern __typeof (nodePush) nodePush __attribute((alias("nodePush__internal_alias"))); -#else -#ifndef nodePush -extern __typeof (nodePush) nodePush__internal_alias __attribute((visibility("hidden"))); -#define nodePush nodePush__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlAddAttributeDecl -extern __typeof (xmlAddAttributeDecl) xmlAddAttributeDecl __attribute((alias("xmlAddAttributeDecl__internal_alias"))); -#else -#ifndef xmlAddAttributeDecl -extern __typeof (xmlAddAttributeDecl) xmlAddAttributeDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlAddAttributeDecl xmlAddAttributeDecl__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlAddChild -extern __typeof (xmlAddChild) xmlAddChild __attribute((alias("xmlAddChild__internal_alias"))); -#else -#ifndef xmlAddChild -extern __typeof (xmlAddChild) xmlAddChild__internal_alias __attribute((visibility("hidden"))); -#define xmlAddChild xmlAddChild__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlAddChildList -extern __typeof (xmlAddChildList) xmlAddChildList __attribute((alias("xmlAddChildList__internal_alias"))); -#else -#ifndef xmlAddChildList -extern __typeof (xmlAddChildList) xmlAddChildList__internal_alias __attribute((visibility("hidden"))); -#define xmlAddChildList xmlAddChildList__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlAddDocEntity -extern __typeof (xmlAddDocEntity) xmlAddDocEntity __attribute((alias("xmlAddDocEntity__internal_alias"))); -#else -#ifndef xmlAddDocEntity -extern __typeof (xmlAddDocEntity) xmlAddDocEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlAddDocEntity xmlAddDocEntity__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlAddDtdEntity -extern __typeof (xmlAddDtdEntity) xmlAddDtdEntity __attribute((alias("xmlAddDtdEntity__internal_alias"))); -#else -#ifndef xmlAddDtdEntity -extern __typeof (xmlAddDtdEntity) xmlAddDtdEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlAddDtdEntity xmlAddDtdEntity__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlAddElementDecl -extern __typeof (xmlAddElementDecl) xmlAddElementDecl __attribute((alias("xmlAddElementDecl__internal_alias"))); -#else -#ifndef xmlAddElementDecl -extern __typeof (xmlAddElementDecl) xmlAddElementDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlAddElementDecl xmlAddElementDecl__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlAddEncodingAlias -extern __typeof (xmlAddEncodingAlias) xmlAddEncodingAlias __attribute((alias("xmlAddEncodingAlias__internal_alias"))); -#else -#ifndef xmlAddEncodingAlias -extern __typeof (xmlAddEncodingAlias) xmlAddEncodingAlias__internal_alias __attribute((visibility("hidden"))); -#define xmlAddEncodingAlias xmlAddEncodingAlias__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlAddID -extern __typeof (xmlAddID) xmlAddID __attribute((alias("xmlAddID__internal_alias"))); -#else -#ifndef xmlAddID -extern __typeof (xmlAddID) xmlAddID__internal_alias __attribute((visibility("hidden"))); -#define xmlAddID xmlAddID__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlAddNextSibling -extern __typeof (xmlAddNextSibling) xmlAddNextSibling __attribute((alias("xmlAddNextSibling__internal_alias"))); -#else -#ifndef xmlAddNextSibling -extern __typeof (xmlAddNextSibling) xmlAddNextSibling__internal_alias __attribute((visibility("hidden"))); -#define xmlAddNextSibling xmlAddNextSibling__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlAddNotationDecl -extern __typeof (xmlAddNotationDecl) xmlAddNotationDecl __attribute((alias("xmlAddNotationDecl__internal_alias"))); -#else -#ifndef xmlAddNotationDecl -extern __typeof (xmlAddNotationDecl) xmlAddNotationDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlAddNotationDecl xmlAddNotationDecl__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlAddPrevSibling -extern __typeof (xmlAddPrevSibling) xmlAddPrevSibling __attribute((alias("xmlAddPrevSibling__internal_alias"))); -#else -#ifndef xmlAddPrevSibling -extern __typeof (xmlAddPrevSibling) xmlAddPrevSibling__internal_alias __attribute((visibility("hidden"))); -#define xmlAddPrevSibling xmlAddPrevSibling__internal_alias -#endif -#endif -#endif - -#ifdef bottom_valid -#undef xmlAddRef -extern __typeof (xmlAddRef) xmlAddRef __attribute((alias("xmlAddRef__internal_alias"))); -#else -#ifndef xmlAddRef -extern __typeof (xmlAddRef) xmlAddRef__internal_alias __attribute((visibility("hidden"))); -#define xmlAddRef xmlAddRef__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlAddSibling -extern __typeof (xmlAddSibling) xmlAddSibling __attribute((alias("xmlAddSibling__internal_alias"))); -#else -#ifndef xmlAddSibling -extern __typeof (xmlAddSibling) xmlAddSibling__internal_alias __attribute((visibility("hidden"))); -#define xmlAddSibling xmlAddSibling__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlAllocParserInputBuffer -extern __typeof (xmlAllocParserInputBuffer) xmlAllocParserInputBuffer __attribute((alias("xmlAllocParserInputBuffer__internal_alias"))); -#else -#ifndef xmlAllocParserInputBuffer -extern __typeof (xmlAllocParserInputBuffer) xmlAllocParserInputBuffer__internal_alias __attribute((visibility("hidden"))); -#define xmlAllocParserInputBuffer xmlAllocParserInputBuffer__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferAdd -extern __typeof (xmlBufferAdd) xmlBufferAdd __attribute((alias("xmlBufferAdd__internal_alias"))); -#else -#ifndef xmlBufferAdd -extern __typeof (xmlBufferAdd) xmlBufferAdd__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferAdd xmlBufferAdd__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferAddHead -extern __typeof (xmlBufferAddHead) xmlBufferAddHead __attribute((alias("xmlBufferAddHead__internal_alias"))); -#else -#ifndef xmlBufferAddHead -extern __typeof (xmlBufferAddHead) xmlBufferAddHead__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferAddHead xmlBufferAddHead__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferCCat -extern __typeof (xmlBufferCCat) xmlBufferCCat __attribute((alias("xmlBufferCCat__internal_alias"))); -#else -#ifndef xmlBufferCCat -extern __typeof (xmlBufferCCat) xmlBufferCCat__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferCCat xmlBufferCCat__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferCat -extern __typeof (xmlBufferCat) xmlBufferCat __attribute((alias("xmlBufferCat__internal_alias"))); -#else -#ifndef xmlBufferCat -extern __typeof (xmlBufferCat) xmlBufferCat__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferCat xmlBufferCat__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferContent -extern __typeof (xmlBufferContent) xmlBufferContent __attribute((alias("xmlBufferContent__internal_alias"))); -#else -#ifndef xmlBufferContent -extern __typeof (xmlBufferContent) xmlBufferContent__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferContent xmlBufferContent__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferCreate -extern __typeof (xmlBufferCreate) xmlBufferCreate __attribute((alias("xmlBufferCreate__internal_alias"))); -#else -#ifndef xmlBufferCreate -extern __typeof (xmlBufferCreate) xmlBufferCreate__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferCreate xmlBufferCreate__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferCreateSize -extern __typeof (xmlBufferCreateSize) xmlBufferCreateSize __attribute((alias("xmlBufferCreateSize__internal_alias"))); -#else -#ifndef xmlBufferCreateSize -extern __typeof (xmlBufferCreateSize) xmlBufferCreateSize__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferCreateSize xmlBufferCreateSize__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferCreateStatic -extern __typeof (xmlBufferCreateStatic) xmlBufferCreateStatic __attribute((alias("xmlBufferCreateStatic__internal_alias"))); -#else -#ifndef xmlBufferCreateStatic -extern __typeof (xmlBufferCreateStatic) xmlBufferCreateStatic__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferCreateStatic xmlBufferCreateStatic__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferDump -extern __typeof (xmlBufferDump) xmlBufferDump __attribute((alias("xmlBufferDump__internal_alias"))); -#else -#ifndef xmlBufferDump -extern __typeof (xmlBufferDump) xmlBufferDump__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferDump xmlBufferDump__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferEmpty -extern __typeof (xmlBufferEmpty) xmlBufferEmpty __attribute((alias("xmlBufferEmpty__internal_alias"))); -#else -#ifndef xmlBufferEmpty -extern __typeof (xmlBufferEmpty) xmlBufferEmpty__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferEmpty xmlBufferEmpty__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferFree -extern __typeof (xmlBufferFree) xmlBufferFree __attribute((alias("xmlBufferFree__internal_alias"))); -#else -#ifndef xmlBufferFree -extern __typeof (xmlBufferFree) xmlBufferFree__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferFree xmlBufferFree__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferGrow -extern __typeof (xmlBufferGrow) xmlBufferGrow __attribute((alias("xmlBufferGrow__internal_alias"))); -#else -#ifndef xmlBufferGrow -extern __typeof (xmlBufferGrow) xmlBufferGrow__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferGrow xmlBufferGrow__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferLength -extern __typeof (xmlBufferLength) xmlBufferLength __attribute((alias("xmlBufferLength__internal_alias"))); -#else -#ifndef xmlBufferLength -extern __typeof (xmlBufferLength) xmlBufferLength__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferLength xmlBufferLength__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferResize -extern __typeof (xmlBufferResize) xmlBufferResize __attribute((alias("xmlBufferResize__internal_alias"))); -#else -#ifndef xmlBufferResize -extern __typeof (xmlBufferResize) xmlBufferResize__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferResize xmlBufferResize__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferSetAllocationScheme -extern __typeof (xmlBufferSetAllocationScheme) xmlBufferSetAllocationScheme __attribute((alias("xmlBufferSetAllocationScheme__internal_alias"))); -#else -#ifndef xmlBufferSetAllocationScheme -extern __typeof (xmlBufferSetAllocationScheme) xmlBufferSetAllocationScheme__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferSetAllocationScheme xmlBufferSetAllocationScheme__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferShrink -extern __typeof (xmlBufferShrink) xmlBufferShrink __attribute((alias("xmlBufferShrink__internal_alias"))); -#else -#ifndef xmlBufferShrink -extern __typeof (xmlBufferShrink) xmlBufferShrink__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferShrink xmlBufferShrink__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferWriteCHAR -extern __typeof (xmlBufferWriteCHAR) xmlBufferWriteCHAR __attribute((alias("xmlBufferWriteCHAR__internal_alias"))); -#else -#ifndef xmlBufferWriteCHAR -extern __typeof (xmlBufferWriteCHAR) xmlBufferWriteCHAR__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferWriteCHAR xmlBufferWriteCHAR__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferWriteChar -extern __typeof (xmlBufferWriteChar) xmlBufferWriteChar __attribute((alias("xmlBufferWriteChar__internal_alias"))); -#else -#ifndef xmlBufferWriteChar -extern __typeof (xmlBufferWriteChar) xmlBufferWriteChar__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferWriteChar xmlBufferWriteChar__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBufferWriteQuotedString -extern __typeof (xmlBufferWriteQuotedString) xmlBufferWriteQuotedString __attribute((alias("xmlBufferWriteQuotedString__internal_alias"))); -#else -#ifndef xmlBufferWriteQuotedString -extern __typeof (xmlBufferWriteQuotedString) xmlBufferWriteQuotedString__internal_alias __attribute((visibility("hidden"))); -#define xmlBufferWriteQuotedString xmlBufferWriteQuotedString__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlBuildQName -extern __typeof (xmlBuildQName) xmlBuildQName __attribute((alias("xmlBuildQName__internal_alias"))); -#else -#ifndef xmlBuildQName -extern __typeof (xmlBuildQName) xmlBuildQName__internal_alias __attribute((visibility("hidden"))); -#define xmlBuildQName xmlBuildQName__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlBuildRelativeURI -extern __typeof (xmlBuildRelativeURI) xmlBuildRelativeURI __attribute((alias("xmlBuildRelativeURI__internal_alias"))); -#else -#ifndef xmlBuildRelativeURI -extern __typeof (xmlBuildRelativeURI) xmlBuildRelativeURI__internal_alias __attribute((visibility("hidden"))); -#define xmlBuildRelativeURI xmlBuildRelativeURI__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlBuildURI -extern __typeof (xmlBuildURI) xmlBuildURI __attribute((alias("xmlBuildURI__internal_alias"))); -#else -#ifndef xmlBuildURI -extern __typeof (xmlBuildURI) xmlBuildURI__internal_alias __attribute((visibility("hidden"))); -#define xmlBuildURI xmlBuildURI__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlByteConsumed -extern __typeof (xmlByteConsumed) xmlByteConsumed __attribute((alias("xmlByteConsumed__internal_alias"))); -#else -#ifndef xmlByteConsumed -extern __typeof (xmlByteConsumed) xmlByteConsumed__internal_alias __attribute((visibility("hidden"))); -#define xmlByteConsumed xmlByteConsumed__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlCanonicPath -extern __typeof (xmlCanonicPath) xmlCanonicPath __attribute((alias("xmlCanonicPath__internal_alias"))); -#else -#ifndef xmlCanonicPath -extern __typeof (xmlCanonicPath) xmlCanonicPath__internal_alias __attribute((visibility("hidden"))); -#define xmlCanonicPath xmlCanonicPath__internal_alias -#endif -#endif - - -#ifdef bottom_encoding -#undef xmlCharEncCloseFunc -extern __typeof (xmlCharEncCloseFunc) xmlCharEncCloseFunc __attribute((alias("xmlCharEncCloseFunc__internal_alias"))); -#else -#ifndef xmlCharEncCloseFunc -extern __typeof (xmlCharEncCloseFunc) xmlCharEncCloseFunc__internal_alias __attribute((visibility("hidden"))); -#define xmlCharEncCloseFunc xmlCharEncCloseFunc__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlCharEncFirstLine -extern __typeof (xmlCharEncFirstLine) xmlCharEncFirstLine __attribute((alias("xmlCharEncFirstLine__internal_alias"))); -#else -#ifndef xmlCharEncFirstLine -extern __typeof (xmlCharEncFirstLine) xmlCharEncFirstLine__internal_alias __attribute((visibility("hidden"))); -#define xmlCharEncFirstLine xmlCharEncFirstLine__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlCharEncInFunc -extern __typeof (xmlCharEncInFunc) xmlCharEncInFunc __attribute((alias("xmlCharEncInFunc__internal_alias"))); -#else -#ifndef xmlCharEncInFunc -extern __typeof (xmlCharEncInFunc) xmlCharEncInFunc__internal_alias __attribute((visibility("hidden"))); -#define xmlCharEncInFunc xmlCharEncInFunc__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlCharEncOutFunc -extern __typeof (xmlCharEncOutFunc) xmlCharEncOutFunc __attribute((alias("xmlCharEncOutFunc__internal_alias"))); -#else -#ifndef xmlCharEncOutFunc -extern __typeof (xmlCharEncOutFunc) xmlCharEncOutFunc__internal_alias __attribute((visibility("hidden"))); -#define xmlCharEncOutFunc xmlCharEncOutFunc__internal_alias -#endif -#endif - -#ifdef bottom_chvalid -#undef xmlCharInRange -extern __typeof (xmlCharInRange) xmlCharInRange __attribute((alias("xmlCharInRange__internal_alias"))); -#else -#ifndef xmlCharInRange -extern __typeof (xmlCharInRange) xmlCharInRange__internal_alias __attribute((visibility("hidden"))); -#define xmlCharInRange xmlCharInRange__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlCharStrdup -extern __typeof (xmlCharStrdup) xmlCharStrdup __attribute((alias("xmlCharStrdup__internal_alias"))); -#else -#ifndef xmlCharStrdup -extern __typeof (xmlCharStrdup) xmlCharStrdup__internal_alias __attribute((visibility("hidden"))); -#define xmlCharStrdup xmlCharStrdup__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlCharStrndup -extern __typeof (xmlCharStrndup) xmlCharStrndup __attribute((alias("xmlCharStrndup__internal_alias"))); -#else -#ifndef xmlCharStrndup -extern __typeof (xmlCharStrndup) xmlCharStrndup__internal_alias __attribute((visibility("hidden"))); -#define xmlCharStrndup xmlCharStrndup__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlCheckFilename -extern __typeof (xmlCheckFilename) xmlCheckFilename __attribute((alias("xmlCheckFilename__internal_alias"))); -#else -#ifndef xmlCheckFilename -extern __typeof (xmlCheckFilename) xmlCheckFilename__internal_alias __attribute((visibility("hidden"))); -#define xmlCheckFilename xmlCheckFilename__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlCheckHTTPInput -extern __typeof (xmlCheckHTTPInput) xmlCheckHTTPInput __attribute((alias("xmlCheckHTTPInput__internal_alias"))); -#else -#ifndef xmlCheckHTTPInput -extern __typeof (xmlCheckHTTPInput) xmlCheckHTTPInput__internal_alias __attribute((visibility("hidden"))); -#define xmlCheckHTTPInput xmlCheckHTTPInput__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCheckLanguageID -extern __typeof (xmlCheckLanguageID) xmlCheckLanguageID __attribute((alias("xmlCheckLanguageID__internal_alias"))); -#else -#ifndef xmlCheckLanguageID -extern __typeof (xmlCheckLanguageID) xmlCheckLanguageID__internal_alias __attribute((visibility("hidden"))); -#define xmlCheckLanguageID xmlCheckLanguageID__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlCheckUTF8 -extern __typeof (xmlCheckUTF8) xmlCheckUTF8 __attribute((alias("xmlCheckUTF8__internal_alias"))); -#else -#ifndef xmlCheckUTF8 -extern __typeof (xmlCheckUTF8) xmlCheckUTF8__internal_alias __attribute((visibility("hidden"))); -#define xmlCheckUTF8 xmlCheckUTF8__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlCheckVersion -extern __typeof (xmlCheckVersion) xmlCheckVersion __attribute((alias("xmlCheckVersion__internal_alias"))); -#else -#ifndef xmlCheckVersion -extern __typeof (xmlCheckVersion) xmlCheckVersion__internal_alias __attribute((visibility("hidden"))); -#define xmlCheckVersion xmlCheckVersion__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlChildElementCount -extern __typeof (xmlChildElementCount) xmlChildElementCount __attribute((alias("xmlChildElementCount__internal_alias"))); -#else -#ifndef xmlChildElementCount -extern __typeof (xmlChildElementCount) xmlChildElementCount__internal_alias __attribute((visibility("hidden"))); -#define xmlChildElementCount xmlChildElementCount__internal_alias -#endif -#endif -#endif - -#ifdef bottom_encoding -#undef xmlCleanupCharEncodingHandlers -extern __typeof (xmlCleanupCharEncodingHandlers) xmlCleanupCharEncodingHandlers __attribute((alias("xmlCleanupCharEncodingHandlers__internal_alias"))); -#else -#ifndef xmlCleanupCharEncodingHandlers -extern __typeof (xmlCleanupCharEncodingHandlers) xmlCleanupCharEncodingHandlers__internal_alias __attribute((visibility("hidden"))); -#define xmlCleanupCharEncodingHandlers xmlCleanupCharEncodingHandlers__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlCleanupEncodingAliases -extern __typeof (xmlCleanupEncodingAliases) xmlCleanupEncodingAliases __attribute((alias("xmlCleanupEncodingAliases__internal_alias"))); -#else -#ifndef xmlCleanupEncodingAliases -extern __typeof (xmlCleanupEncodingAliases) xmlCleanupEncodingAliases__internal_alias __attribute((visibility("hidden"))); -#define xmlCleanupEncodingAliases xmlCleanupEncodingAliases__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlCleanupGlobals -extern __typeof (xmlCleanupGlobals) xmlCleanupGlobals __attribute((alias("xmlCleanupGlobals__internal_alias"))); -#else -#ifndef xmlCleanupGlobals -extern __typeof (xmlCleanupGlobals) xmlCleanupGlobals__internal_alias __attribute((visibility("hidden"))); -#define xmlCleanupGlobals xmlCleanupGlobals__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlCleanupInputCallbacks -extern __typeof (xmlCleanupInputCallbacks) xmlCleanupInputCallbacks __attribute((alias("xmlCleanupInputCallbacks__internal_alias"))); -#else -#ifndef xmlCleanupInputCallbacks -extern __typeof (xmlCleanupInputCallbacks) xmlCleanupInputCallbacks__internal_alias __attribute((visibility("hidden"))); -#define xmlCleanupInputCallbacks xmlCleanupInputCallbacks__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlCleanupMemory -extern __typeof (xmlCleanupMemory) xmlCleanupMemory __attribute((alias("xmlCleanupMemory__internal_alias"))); -#else -#ifndef xmlCleanupMemory -extern __typeof (xmlCleanupMemory) xmlCleanupMemory__internal_alias __attribute((visibility("hidden"))); -#define xmlCleanupMemory xmlCleanupMemory__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCleanupParser -extern __typeof (xmlCleanupParser) xmlCleanupParser __attribute((alias("xmlCleanupParser__internal_alias"))); -#else -#ifndef xmlCleanupParser -extern __typeof (xmlCleanupParser) xmlCleanupParser__internal_alias __attribute((visibility("hidden"))); -#define xmlCleanupParser xmlCleanupParser__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlClearNodeInfoSeq -extern __typeof (xmlClearNodeInfoSeq) xmlClearNodeInfoSeq __attribute((alias("xmlClearNodeInfoSeq__internal_alias"))); -#else -#ifndef xmlClearNodeInfoSeq -extern __typeof (xmlClearNodeInfoSeq) xmlClearNodeInfoSeq__internal_alias __attribute((visibility("hidden"))); -#define xmlClearNodeInfoSeq xmlClearNodeInfoSeq__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlClearParserCtxt -extern __typeof (xmlClearParserCtxt) xmlClearParserCtxt __attribute((alias("xmlClearParserCtxt__internal_alias"))); -#else -#ifndef xmlClearParserCtxt -extern __typeof (xmlClearParserCtxt) xmlClearParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlClearParserCtxt xmlClearParserCtxt__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_valid -#undef xmlCopyAttributeTable -extern __typeof (xmlCopyAttributeTable) xmlCopyAttributeTable __attribute((alias("xmlCopyAttributeTable__internal_alias"))); -#else -#ifndef xmlCopyAttributeTable -extern __typeof (xmlCopyAttributeTable) xmlCopyAttributeTable__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyAttributeTable xmlCopyAttributeTable__internal_alias -#endif -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlCopyChar -extern __typeof (xmlCopyChar) xmlCopyChar __attribute((alias("xmlCopyChar__internal_alias"))); -#else -#ifndef xmlCopyChar -extern __typeof (xmlCopyChar) xmlCopyChar__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyChar xmlCopyChar__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlCopyCharMultiByte -extern __typeof (xmlCopyCharMultiByte) xmlCopyCharMultiByte __attribute((alias("xmlCopyCharMultiByte__internal_alias"))); -#else -#ifndef xmlCopyCharMultiByte -extern __typeof (xmlCopyCharMultiByte) xmlCopyCharMultiByte__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyCharMultiByte xmlCopyCharMultiByte__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlCopyDoc -extern __typeof (xmlCopyDoc) xmlCopyDoc __attribute((alias("xmlCopyDoc__internal_alias"))); -#else -#ifndef xmlCopyDoc -extern __typeof (xmlCopyDoc) xmlCopyDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyDoc xmlCopyDoc__internal_alias -#endif -#endif -#endif - -#ifdef bottom_valid -#undef xmlCopyDocElementContent -extern __typeof (xmlCopyDocElementContent) xmlCopyDocElementContent __attribute((alias("xmlCopyDocElementContent__internal_alias"))); -#else -#ifndef xmlCopyDocElementContent -extern __typeof (xmlCopyDocElementContent) xmlCopyDocElementContent__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyDocElementContent xmlCopyDocElementContent__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlCopyDtd -extern __typeof (xmlCopyDtd) xmlCopyDtd __attribute((alias("xmlCopyDtd__internal_alias"))); -#else -#ifndef xmlCopyDtd -extern __typeof (xmlCopyDtd) xmlCopyDtd__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyDtd xmlCopyDtd__internal_alias -#endif -#endif -#endif - -#ifdef bottom_valid -#undef xmlCopyElementContent -extern __typeof (xmlCopyElementContent) xmlCopyElementContent __attribute((alias("xmlCopyElementContent__internal_alias"))); -#else -#ifndef xmlCopyElementContent -extern __typeof (xmlCopyElementContent) xmlCopyElementContent__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyElementContent xmlCopyElementContent__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_valid -#undef xmlCopyElementTable -extern __typeof (xmlCopyElementTable) xmlCopyElementTable __attribute((alias("xmlCopyElementTable__internal_alias"))); -#else -#ifndef xmlCopyElementTable -extern __typeof (xmlCopyElementTable) xmlCopyElementTable__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyElementTable xmlCopyElementTable__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_entities -#undef xmlCopyEntitiesTable -extern __typeof (xmlCopyEntitiesTable) xmlCopyEntitiesTable __attribute((alias("xmlCopyEntitiesTable__internal_alias"))); -#else -#ifndef xmlCopyEntitiesTable -extern __typeof (xmlCopyEntitiesTable) xmlCopyEntitiesTable__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyEntitiesTable xmlCopyEntitiesTable__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_valid -#undef xmlCopyEnumeration -extern __typeof (xmlCopyEnumeration) xmlCopyEnumeration __attribute((alias("xmlCopyEnumeration__internal_alias"))); -#else -#ifndef xmlCopyEnumeration -extern __typeof (xmlCopyEnumeration) xmlCopyEnumeration__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyEnumeration xmlCopyEnumeration__internal_alias -#endif -#endif -#endif - -#ifdef bottom_error -#undef xmlCopyError -extern __typeof (xmlCopyError) xmlCopyError __attribute((alias("xmlCopyError__internal_alias"))); -#else -#ifndef xmlCopyError -extern __typeof (xmlCopyError) xmlCopyError__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyError xmlCopyError__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlCopyNamespace -extern __typeof (xmlCopyNamespace) xmlCopyNamespace __attribute((alias("xmlCopyNamespace__internal_alias"))); -#else -#ifndef xmlCopyNamespace -extern __typeof (xmlCopyNamespace) xmlCopyNamespace__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyNamespace xmlCopyNamespace__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlCopyNamespaceList -extern __typeof (xmlCopyNamespaceList) xmlCopyNamespaceList __attribute((alias("xmlCopyNamespaceList__internal_alias"))); -#else -#ifndef xmlCopyNamespaceList -extern __typeof (xmlCopyNamespaceList) xmlCopyNamespaceList__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyNamespaceList xmlCopyNamespaceList__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlCopyNode -extern __typeof (xmlCopyNode) xmlCopyNode __attribute((alias("xmlCopyNode__internal_alias"))); -#else -#ifndef xmlCopyNode -extern __typeof (xmlCopyNode) xmlCopyNode__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyNode xmlCopyNode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlCopyNodeList -extern __typeof (xmlCopyNodeList) xmlCopyNodeList __attribute((alias("xmlCopyNodeList__internal_alias"))); -#else -#ifndef xmlCopyNodeList -extern __typeof (xmlCopyNodeList) xmlCopyNodeList__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyNodeList xmlCopyNodeList__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_valid -#undef xmlCopyNotationTable -extern __typeof (xmlCopyNotationTable) xmlCopyNotationTable __attribute((alias("xmlCopyNotationTable__internal_alias"))); -#else -#ifndef xmlCopyNotationTable -extern __typeof (xmlCopyNotationTable) xmlCopyNotationTable__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyNotationTable xmlCopyNotationTable__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlCopyProp -extern __typeof (xmlCopyProp) xmlCopyProp __attribute((alias("xmlCopyProp__internal_alias"))); -#else -#ifndef xmlCopyProp -extern __typeof (xmlCopyProp) xmlCopyProp__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyProp xmlCopyProp__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlCopyPropList -extern __typeof (xmlCopyPropList) xmlCopyPropList __attribute((alias("xmlCopyPropList__internal_alias"))); -#else -#ifndef xmlCopyPropList -extern __typeof (xmlCopyPropList) xmlCopyPropList__internal_alias __attribute((visibility("hidden"))); -#define xmlCopyPropList xmlCopyPropList__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCreateDocParserCtxt -extern __typeof (xmlCreateDocParserCtxt) xmlCreateDocParserCtxt __attribute((alias("xmlCreateDocParserCtxt__internal_alias"))); -#else -#ifndef xmlCreateDocParserCtxt -extern __typeof (xmlCreateDocParserCtxt) xmlCreateDocParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateDocParserCtxt xmlCreateDocParserCtxt__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlCreateEntitiesTable -extern __typeof (xmlCreateEntitiesTable) xmlCreateEntitiesTable __attribute((alias("xmlCreateEntitiesTable__internal_alias"))); -#else -#ifndef xmlCreateEntitiesTable -extern __typeof (xmlCreateEntitiesTable) xmlCreateEntitiesTable__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateEntitiesTable xmlCreateEntitiesTable__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCreateEntityParserCtxt -extern __typeof (xmlCreateEntityParserCtxt) xmlCreateEntityParserCtxt __attribute((alias("xmlCreateEntityParserCtxt__internal_alias"))); -#else -#ifndef xmlCreateEntityParserCtxt -extern __typeof (xmlCreateEntityParserCtxt) xmlCreateEntityParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateEntityParserCtxt xmlCreateEntityParserCtxt__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlCreateEnumeration -extern __typeof (xmlCreateEnumeration) xmlCreateEnumeration __attribute((alias("xmlCreateEnumeration__internal_alias"))); -#else -#ifndef xmlCreateEnumeration -extern __typeof (xmlCreateEnumeration) xmlCreateEnumeration__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateEnumeration xmlCreateEnumeration__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCreateFileParserCtxt -extern __typeof (xmlCreateFileParserCtxt) xmlCreateFileParserCtxt __attribute((alias("xmlCreateFileParserCtxt__internal_alias"))); -#else -#ifndef xmlCreateFileParserCtxt -extern __typeof (xmlCreateFileParserCtxt) xmlCreateFileParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateFileParserCtxt xmlCreateFileParserCtxt__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCreateIOParserCtxt -extern __typeof (xmlCreateIOParserCtxt) xmlCreateIOParserCtxt __attribute((alias("xmlCreateIOParserCtxt__internal_alias"))); -#else -#ifndef xmlCreateIOParserCtxt -extern __typeof (xmlCreateIOParserCtxt) xmlCreateIOParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateIOParserCtxt xmlCreateIOParserCtxt__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlCreateIntSubset -extern __typeof (xmlCreateIntSubset) xmlCreateIntSubset __attribute((alias("xmlCreateIntSubset__internal_alias"))); -#else -#ifndef xmlCreateIntSubset -extern __typeof (xmlCreateIntSubset) xmlCreateIntSubset__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateIntSubset xmlCreateIntSubset__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCreateMemoryParserCtxt -extern __typeof (xmlCreateMemoryParserCtxt) xmlCreateMemoryParserCtxt __attribute((alias("xmlCreateMemoryParserCtxt__internal_alias"))); -#else -#ifndef xmlCreateMemoryParserCtxt -extern __typeof (xmlCreateMemoryParserCtxt) xmlCreateMemoryParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateMemoryParserCtxt xmlCreateMemoryParserCtxt__internal_alias -#endif -#endif - -#if defined(LIBXML_PUSH_ENABLED) -#ifdef bottom_parser -#undef xmlCreatePushParserCtxt -extern __typeof (xmlCreatePushParserCtxt) xmlCreatePushParserCtxt __attribute((alias("xmlCreatePushParserCtxt__internal_alias"))); -#else -#ifndef xmlCreatePushParserCtxt -extern __typeof (xmlCreatePushParserCtxt) xmlCreatePushParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlCreatePushParserCtxt xmlCreatePushParserCtxt__internal_alias -#endif -#endif -#endif - -#ifdef bottom_uri -#undef xmlCreateURI -extern __typeof (xmlCreateURI) xmlCreateURI __attribute((alias("xmlCreateURI__internal_alias"))); -#else -#ifndef xmlCreateURI -extern __typeof (xmlCreateURI) xmlCreateURI__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateURI xmlCreateURI__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCreateURLParserCtxt -extern __typeof (xmlCreateURLParserCtxt) xmlCreateURLParserCtxt __attribute((alias("xmlCreateURLParserCtxt__internal_alias"))); -#else -#ifndef xmlCreateURLParserCtxt -extern __typeof (xmlCreateURLParserCtxt) xmlCreateURLParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlCreateURLParserCtxt xmlCreateURLParserCtxt__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlCtxtGetLastError -extern __typeof (xmlCtxtGetLastError) xmlCtxtGetLastError __attribute((alias("xmlCtxtGetLastError__internal_alias"))); -#else -#ifndef xmlCtxtGetLastError -extern __typeof (xmlCtxtGetLastError) xmlCtxtGetLastError__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtGetLastError xmlCtxtGetLastError__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCtxtReadDoc -extern __typeof (xmlCtxtReadDoc) xmlCtxtReadDoc __attribute((alias("xmlCtxtReadDoc__internal_alias"))); -#else -#ifndef xmlCtxtReadDoc -extern __typeof (xmlCtxtReadDoc) xmlCtxtReadDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtReadDoc xmlCtxtReadDoc__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCtxtReadFd -extern __typeof (xmlCtxtReadFd) xmlCtxtReadFd __attribute((alias("xmlCtxtReadFd__internal_alias"))); -#else -#ifndef xmlCtxtReadFd -extern __typeof (xmlCtxtReadFd) xmlCtxtReadFd__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtReadFd xmlCtxtReadFd__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCtxtReadFile -extern __typeof (xmlCtxtReadFile) xmlCtxtReadFile __attribute((alias("xmlCtxtReadFile__internal_alias"))); -#else -#ifndef xmlCtxtReadFile -extern __typeof (xmlCtxtReadFile) xmlCtxtReadFile__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtReadFile xmlCtxtReadFile__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCtxtReadIO -extern __typeof (xmlCtxtReadIO) xmlCtxtReadIO __attribute((alias("xmlCtxtReadIO__internal_alias"))); -#else -#ifndef xmlCtxtReadIO -extern __typeof (xmlCtxtReadIO) xmlCtxtReadIO__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtReadIO xmlCtxtReadIO__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCtxtReadMemory -extern __typeof (xmlCtxtReadMemory) xmlCtxtReadMemory __attribute((alias("xmlCtxtReadMemory__internal_alias"))); -#else -#ifndef xmlCtxtReadMemory -extern __typeof (xmlCtxtReadMemory) xmlCtxtReadMemory__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtReadMemory xmlCtxtReadMemory__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCtxtReset -extern __typeof (xmlCtxtReset) xmlCtxtReset __attribute((alias("xmlCtxtReset__internal_alias"))); -#else -#ifndef xmlCtxtReset -extern __typeof (xmlCtxtReset) xmlCtxtReset__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtReset xmlCtxtReset__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlCtxtResetLastError -extern __typeof (xmlCtxtResetLastError) xmlCtxtResetLastError __attribute((alias("xmlCtxtResetLastError__internal_alias"))); -#else -#ifndef xmlCtxtResetLastError -extern __typeof (xmlCtxtResetLastError) xmlCtxtResetLastError__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtResetLastError xmlCtxtResetLastError__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCtxtResetPush -extern __typeof (xmlCtxtResetPush) xmlCtxtResetPush __attribute((alias("xmlCtxtResetPush__internal_alias"))); -#else -#ifndef xmlCtxtResetPush -extern __typeof (xmlCtxtResetPush) xmlCtxtResetPush__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtResetPush xmlCtxtResetPush__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlCtxtUseOptions -extern __typeof (xmlCtxtUseOptions) xmlCtxtUseOptions __attribute((alias("xmlCtxtUseOptions__internal_alias"))); -#else -#ifndef xmlCtxtUseOptions -extern __typeof (xmlCtxtUseOptions) xmlCtxtUseOptions__internal_alias __attribute((visibility("hidden"))); -#define xmlCtxtUseOptions xmlCtxtUseOptions__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlCurrentChar -extern __typeof (xmlCurrentChar) xmlCurrentChar __attribute((alias("xmlCurrentChar__internal_alias"))); -#else -#ifndef xmlCurrentChar -extern __typeof (xmlCurrentChar) xmlCurrentChar__internal_alias __attribute((visibility("hidden"))); -#define xmlCurrentChar xmlCurrentChar__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDOMWrapAdoptNode -extern __typeof (xmlDOMWrapAdoptNode) xmlDOMWrapAdoptNode __attribute((alias("xmlDOMWrapAdoptNode__internal_alias"))); -#else -#ifndef xmlDOMWrapAdoptNode -extern __typeof (xmlDOMWrapAdoptNode) xmlDOMWrapAdoptNode__internal_alias __attribute((visibility("hidden"))); -#define xmlDOMWrapAdoptNode xmlDOMWrapAdoptNode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDOMWrapCloneNode -extern __typeof (xmlDOMWrapCloneNode) xmlDOMWrapCloneNode __attribute((alias("xmlDOMWrapCloneNode__internal_alias"))); -#else -#ifndef xmlDOMWrapCloneNode -extern __typeof (xmlDOMWrapCloneNode) xmlDOMWrapCloneNode__internal_alias __attribute((visibility("hidden"))); -#define xmlDOMWrapCloneNode xmlDOMWrapCloneNode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDOMWrapFreeCtxt -extern __typeof (xmlDOMWrapFreeCtxt) xmlDOMWrapFreeCtxt __attribute((alias("xmlDOMWrapFreeCtxt__internal_alias"))); -#else -#ifndef xmlDOMWrapFreeCtxt -extern __typeof (xmlDOMWrapFreeCtxt) xmlDOMWrapFreeCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlDOMWrapFreeCtxt xmlDOMWrapFreeCtxt__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDOMWrapNewCtxt -extern __typeof (xmlDOMWrapNewCtxt) xmlDOMWrapNewCtxt __attribute((alias("xmlDOMWrapNewCtxt__internal_alias"))); -#else -#ifndef xmlDOMWrapNewCtxt -extern __typeof (xmlDOMWrapNewCtxt) xmlDOMWrapNewCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlDOMWrapNewCtxt xmlDOMWrapNewCtxt__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDOMWrapReconcileNamespaces -extern __typeof (xmlDOMWrapReconcileNamespaces) xmlDOMWrapReconcileNamespaces __attribute((alias("xmlDOMWrapReconcileNamespaces__internal_alias"))); -#else -#ifndef xmlDOMWrapReconcileNamespaces -extern __typeof (xmlDOMWrapReconcileNamespaces) xmlDOMWrapReconcileNamespaces__internal_alias __attribute((visibility("hidden"))); -#define xmlDOMWrapReconcileNamespaces xmlDOMWrapReconcileNamespaces__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDOMWrapRemoveNode -extern __typeof (xmlDOMWrapRemoveNode) xmlDOMWrapRemoveNode __attribute((alias("xmlDOMWrapRemoveNode__internal_alias"))); -#else -#ifndef xmlDOMWrapRemoveNode -extern __typeof (xmlDOMWrapRemoveNode) xmlDOMWrapRemoveNode__internal_alias __attribute((visibility("hidden"))); -#define xmlDOMWrapRemoveNode xmlDOMWrapRemoveNode__internal_alias -#endif -#endif - - -#ifdef bottom_SAX2 -#undef xmlDefaultSAXHandlerInit -extern __typeof (xmlDefaultSAXHandlerInit) xmlDefaultSAXHandlerInit __attribute((alias("xmlDefaultSAXHandlerInit__internal_alias"))); -#else -#ifndef xmlDefaultSAXHandlerInit -extern __typeof (xmlDefaultSAXHandlerInit) xmlDefaultSAXHandlerInit__internal_alias __attribute((visibility("hidden"))); -#define xmlDefaultSAXHandlerInit xmlDefaultSAXHandlerInit__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlDelEncodingAlias -extern __typeof (xmlDelEncodingAlias) xmlDelEncodingAlias __attribute((alias("xmlDelEncodingAlias__internal_alias"))); -#else -#ifndef xmlDelEncodingAlias -extern __typeof (xmlDelEncodingAlias) xmlDelEncodingAlias__internal_alias __attribute((visibility("hidden"))); -#define xmlDelEncodingAlias xmlDelEncodingAlias__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlDeregisterNodeDefault -extern __typeof (xmlDeregisterNodeDefault) xmlDeregisterNodeDefault __attribute((alias("xmlDeregisterNodeDefault__internal_alias"))); -#else -#ifndef xmlDeregisterNodeDefault -extern __typeof (xmlDeregisterNodeDefault) xmlDeregisterNodeDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlDeregisterNodeDefault xmlDeregisterNodeDefault__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlDetectCharEncoding -extern __typeof (xmlDetectCharEncoding) xmlDetectCharEncoding __attribute((alias("xmlDetectCharEncoding__internal_alias"))); -#else -#ifndef xmlDetectCharEncoding -extern __typeof (xmlDetectCharEncoding) xmlDetectCharEncoding__internal_alias __attribute((visibility("hidden"))); -#define xmlDetectCharEncoding xmlDetectCharEncoding__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictCleanup -extern __typeof (xmlDictCleanup) xmlDictCleanup __attribute((alias("xmlDictCleanup__internal_alias"))); -#else -#ifndef xmlDictCleanup -extern __typeof (xmlDictCleanup) xmlDictCleanup__internal_alias __attribute((visibility("hidden"))); -#define xmlDictCleanup xmlDictCleanup__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictCreate -extern __typeof (xmlDictCreate) xmlDictCreate __attribute((alias("xmlDictCreate__internal_alias"))); -#else -#ifndef xmlDictCreate -extern __typeof (xmlDictCreate) xmlDictCreate__internal_alias __attribute((visibility("hidden"))); -#define xmlDictCreate xmlDictCreate__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictCreateSub -extern __typeof (xmlDictCreateSub) xmlDictCreateSub __attribute((alias("xmlDictCreateSub__internal_alias"))); -#else -#ifndef xmlDictCreateSub -extern __typeof (xmlDictCreateSub) xmlDictCreateSub__internal_alias __attribute((visibility("hidden"))); -#define xmlDictCreateSub xmlDictCreateSub__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictExists -extern __typeof (xmlDictExists) xmlDictExists __attribute((alias("xmlDictExists__internal_alias"))); -#else -#ifndef xmlDictExists -extern __typeof (xmlDictExists) xmlDictExists__internal_alias __attribute((visibility("hidden"))); -#define xmlDictExists xmlDictExists__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictFree -extern __typeof (xmlDictFree) xmlDictFree __attribute((alias("xmlDictFree__internal_alias"))); -#else -#ifndef xmlDictFree -extern __typeof (xmlDictFree) xmlDictFree__internal_alias __attribute((visibility("hidden"))); -#define xmlDictFree xmlDictFree__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictLookup -extern __typeof (xmlDictLookup) xmlDictLookup __attribute((alias("xmlDictLookup__internal_alias"))); -#else -#ifndef xmlDictLookup -extern __typeof (xmlDictLookup) xmlDictLookup__internal_alias __attribute((visibility("hidden"))); -#define xmlDictLookup xmlDictLookup__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictOwns -extern __typeof (xmlDictOwns) xmlDictOwns __attribute((alias("xmlDictOwns__internal_alias"))); -#else -#ifndef xmlDictOwns -extern __typeof (xmlDictOwns) xmlDictOwns__internal_alias __attribute((visibility("hidden"))); -#define xmlDictOwns xmlDictOwns__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictQLookup -extern __typeof (xmlDictQLookup) xmlDictQLookup __attribute((alias("xmlDictQLookup__internal_alias"))); -#else -#ifndef xmlDictQLookup -extern __typeof (xmlDictQLookup) xmlDictQLookup__internal_alias __attribute((visibility("hidden"))); -#define xmlDictQLookup xmlDictQLookup__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictReference -extern __typeof (xmlDictReference) xmlDictReference __attribute((alias("xmlDictReference__internal_alias"))); -#else -#ifndef xmlDictReference -extern __typeof (xmlDictReference) xmlDictReference__internal_alias __attribute((visibility("hidden"))); -#define xmlDictReference xmlDictReference__internal_alias -#endif -#endif - -#ifdef bottom_dict -#undef xmlDictSize -extern __typeof (xmlDictSize) xmlDictSize __attribute((alias("xmlDictSize__internal_alias"))); -#else -#ifndef xmlDictSize -extern __typeof (xmlDictSize) xmlDictSize__internal_alias __attribute((visibility("hidden"))); -#define xmlDictSize xmlDictSize__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDocCopyNode -extern __typeof (xmlDocCopyNode) xmlDocCopyNode __attribute((alias("xmlDocCopyNode__internal_alias"))); -#else -#ifndef xmlDocCopyNode -extern __typeof (xmlDocCopyNode) xmlDocCopyNode__internal_alias __attribute((visibility("hidden"))); -#define xmlDocCopyNode xmlDocCopyNode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDocCopyNodeList -extern __typeof (xmlDocCopyNodeList) xmlDocCopyNodeList __attribute((alias("xmlDocCopyNodeList__internal_alias"))); -#else -#ifndef xmlDocCopyNodeList -extern __typeof (xmlDocCopyNodeList) xmlDocCopyNodeList__internal_alias __attribute((visibility("hidden"))); -#define xmlDocCopyNodeList xmlDocCopyNodeList__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlDocGetRootElement -extern __typeof (xmlDocGetRootElement) xmlDocGetRootElement __attribute((alias("xmlDocGetRootElement__internal_alias"))); -#else -#ifndef xmlDocGetRootElement -extern __typeof (xmlDocGetRootElement) xmlDocGetRootElement__internal_alias __attribute((visibility("hidden"))); -#define xmlDocGetRootElement xmlDocGetRootElement__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlDocSetRootElement -extern __typeof (xmlDocSetRootElement) xmlDocSetRootElement __attribute((alias("xmlDocSetRootElement__internal_alias"))); -#else -#ifndef xmlDocSetRootElement -extern __typeof (xmlDocSetRootElement) xmlDocSetRootElement__internal_alias __attribute((visibility("hidden"))); -#define xmlDocSetRootElement xmlDocSetRootElement__internal_alias -#endif -#endif -#endif - -#ifdef bottom_entities -#undef xmlEncodeEntitiesReentrant -extern __typeof (xmlEncodeEntitiesReentrant) xmlEncodeEntitiesReentrant __attribute((alias("xmlEncodeEntitiesReentrant__internal_alias"))); -#else -#ifndef xmlEncodeEntitiesReentrant -extern __typeof (xmlEncodeEntitiesReentrant) xmlEncodeEntitiesReentrant__internal_alias __attribute((visibility("hidden"))); -#define xmlEncodeEntitiesReentrant xmlEncodeEntitiesReentrant__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlEncodeSpecialChars -extern __typeof (xmlEncodeSpecialChars) xmlEncodeSpecialChars __attribute((alias("xmlEncodeSpecialChars__internal_alias"))); -#else -#ifndef xmlEncodeSpecialChars -extern __typeof (xmlEncodeSpecialChars) xmlEncodeSpecialChars__internal_alias __attribute((visibility("hidden"))); -#define xmlEncodeSpecialChars xmlEncodeSpecialChars__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlErrMemory -extern __typeof (xmlErrMemory) xmlErrMemory __attribute((alias("xmlErrMemory__internal_alias"))); -#else -#ifndef xmlErrMemory -extern __typeof (xmlErrMemory) xmlErrMemory__internal_alias __attribute((visibility("hidden"))); -#define xmlErrMemory xmlErrMemory__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlFileClose -extern __typeof (xmlFileClose) xmlFileClose __attribute((alias("xmlFileClose__internal_alias"))); -#else -#ifndef xmlFileClose -extern __typeof (xmlFileClose) xmlFileClose__internal_alias __attribute((visibility("hidden"))); -#define xmlFileClose xmlFileClose__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlFileMatch -extern __typeof (xmlFileMatch) xmlFileMatch __attribute((alias("xmlFileMatch__internal_alias"))); -#else -#ifndef xmlFileMatch -extern __typeof (xmlFileMatch) xmlFileMatch__internal_alias __attribute((visibility("hidden"))); -#define xmlFileMatch xmlFileMatch__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlFileOpen -extern __typeof (xmlFileOpen) xmlFileOpen __attribute((alias("xmlFileOpen__internal_alias"))); -#else -#ifndef xmlFileOpen -extern __typeof (xmlFileOpen) xmlFileOpen__internal_alias __attribute((visibility("hidden"))); -#define xmlFileOpen xmlFileOpen__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlFileRead -extern __typeof (xmlFileRead) xmlFileRead __attribute((alias("xmlFileRead__internal_alias"))); -#else -#ifndef xmlFileRead -extern __typeof (xmlFileRead) xmlFileRead__internal_alias __attribute((visibility("hidden"))); -#define xmlFileRead xmlFileRead__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlFindCharEncodingHandler -extern __typeof (xmlFindCharEncodingHandler) xmlFindCharEncodingHandler __attribute((alias("xmlFindCharEncodingHandler__internal_alias"))); -#else -#ifndef xmlFindCharEncodingHandler -extern __typeof (xmlFindCharEncodingHandler) xmlFindCharEncodingHandler__internal_alias __attribute((visibility("hidden"))); -#define xmlFindCharEncodingHandler xmlFindCharEncodingHandler__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlFirstElementChild -extern __typeof (xmlFirstElementChild) xmlFirstElementChild __attribute((alias("xmlFirstElementChild__internal_alias"))); -#else -#ifndef xmlFirstElementChild -extern __typeof (xmlFirstElementChild) xmlFirstElementChild__internal_alias __attribute((visibility("hidden"))); -#define xmlFirstElementChild xmlFirstElementChild__internal_alias -#endif -#endif -#endif - -#ifdef bottom_valid -#undef xmlFreeAttributeTable -extern __typeof (xmlFreeAttributeTable) xmlFreeAttributeTable __attribute((alias("xmlFreeAttributeTable__internal_alias"))); -#else -#ifndef xmlFreeAttributeTable -extern __typeof (xmlFreeAttributeTable) xmlFreeAttributeTable__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeAttributeTable xmlFreeAttributeTable__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlFreeDoc -extern __typeof (xmlFreeDoc) xmlFreeDoc __attribute((alias("xmlFreeDoc__internal_alias"))); -#else -#ifndef xmlFreeDoc -extern __typeof (xmlFreeDoc) xmlFreeDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeDoc xmlFreeDoc__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlFreeDocElementContent -extern __typeof (xmlFreeDocElementContent) xmlFreeDocElementContent __attribute((alias("xmlFreeDocElementContent__internal_alias"))); -#else -#ifndef xmlFreeDocElementContent -extern __typeof (xmlFreeDocElementContent) xmlFreeDocElementContent__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeDocElementContent xmlFreeDocElementContent__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlFreeDtd -extern __typeof (xmlFreeDtd) xmlFreeDtd __attribute((alias("xmlFreeDtd__internal_alias"))); -#else -#ifndef xmlFreeDtd -extern __typeof (xmlFreeDtd) xmlFreeDtd__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeDtd xmlFreeDtd__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlFreeElementContent -extern __typeof (xmlFreeElementContent) xmlFreeElementContent __attribute((alias("xmlFreeElementContent__internal_alias"))); -#else -#ifndef xmlFreeElementContent -extern __typeof (xmlFreeElementContent) xmlFreeElementContent__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeElementContent xmlFreeElementContent__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlFreeElementTable -extern __typeof (xmlFreeElementTable) xmlFreeElementTable __attribute((alias("xmlFreeElementTable__internal_alias"))); -#else -#ifndef xmlFreeElementTable -extern __typeof (xmlFreeElementTable) xmlFreeElementTable__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeElementTable xmlFreeElementTable__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlFreeEntitiesTable -extern __typeof (xmlFreeEntitiesTable) xmlFreeEntitiesTable __attribute((alias("xmlFreeEntitiesTable__internal_alias"))); -#else -#ifndef xmlFreeEntitiesTable -extern __typeof (xmlFreeEntitiesTable) xmlFreeEntitiesTable__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeEntitiesTable xmlFreeEntitiesTable__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlFreeEnumeration -extern __typeof (xmlFreeEnumeration) xmlFreeEnumeration __attribute((alias("xmlFreeEnumeration__internal_alias"))); -#else -#ifndef xmlFreeEnumeration -extern __typeof (xmlFreeEnumeration) xmlFreeEnumeration__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeEnumeration xmlFreeEnumeration__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlFreeIDTable -extern __typeof (xmlFreeIDTable) xmlFreeIDTable __attribute((alias("xmlFreeIDTable__internal_alias"))); -#else -#ifndef xmlFreeIDTable -extern __typeof (xmlFreeIDTable) xmlFreeIDTable__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeIDTable xmlFreeIDTable__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlFreeInputStream -extern __typeof (xmlFreeInputStream) xmlFreeInputStream __attribute((alias("xmlFreeInputStream__internal_alias"))); -#else -#ifndef xmlFreeInputStream -extern __typeof (xmlFreeInputStream) xmlFreeInputStream__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeInputStream xmlFreeInputStream__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlFreeNode -extern __typeof (xmlFreeNode) xmlFreeNode __attribute((alias("xmlFreeNode__internal_alias"))); -#else -#ifndef xmlFreeNode -extern __typeof (xmlFreeNode) xmlFreeNode__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeNode xmlFreeNode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlFreeNodeList -extern __typeof (xmlFreeNodeList) xmlFreeNodeList __attribute((alias("xmlFreeNodeList__internal_alias"))); -#else -#ifndef xmlFreeNodeList -extern __typeof (xmlFreeNodeList) xmlFreeNodeList__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeNodeList xmlFreeNodeList__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlFreeNotationTable -extern __typeof (xmlFreeNotationTable) xmlFreeNotationTable __attribute((alias("xmlFreeNotationTable__internal_alias"))); -#else -#ifndef xmlFreeNotationTable -extern __typeof (xmlFreeNotationTable) xmlFreeNotationTable__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeNotationTable xmlFreeNotationTable__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlFreeNs -extern __typeof (xmlFreeNs) xmlFreeNs __attribute((alias("xmlFreeNs__internal_alias"))); -#else -#ifndef xmlFreeNs -extern __typeof (xmlFreeNs) xmlFreeNs__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeNs xmlFreeNs__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlFreeNsList -extern __typeof (xmlFreeNsList) xmlFreeNsList __attribute((alias("xmlFreeNsList__internal_alias"))); -#else -#ifndef xmlFreeNsList -extern __typeof (xmlFreeNsList) xmlFreeNsList__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeNsList xmlFreeNsList__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlFreeParserCtxt -extern __typeof (xmlFreeParserCtxt) xmlFreeParserCtxt __attribute((alias("xmlFreeParserCtxt__internal_alias"))); -#else -#ifndef xmlFreeParserCtxt -extern __typeof (xmlFreeParserCtxt) xmlFreeParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeParserCtxt xmlFreeParserCtxt__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlFreeParserInputBuffer -extern __typeof (xmlFreeParserInputBuffer) xmlFreeParserInputBuffer __attribute((alias("xmlFreeParserInputBuffer__internal_alias"))); -#else -#ifndef xmlFreeParserInputBuffer -extern __typeof (xmlFreeParserInputBuffer) xmlFreeParserInputBuffer__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeParserInputBuffer xmlFreeParserInputBuffer__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlFreeProp -extern __typeof (xmlFreeProp) xmlFreeProp __attribute((alias("xmlFreeProp__internal_alias"))); -#else -#ifndef xmlFreeProp -extern __typeof (xmlFreeProp) xmlFreeProp__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeProp xmlFreeProp__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlFreePropList -extern __typeof (xmlFreePropList) xmlFreePropList __attribute((alias("xmlFreePropList__internal_alias"))); -#else -#ifndef xmlFreePropList -extern __typeof (xmlFreePropList) xmlFreePropList__internal_alias __attribute((visibility("hidden"))); -#define xmlFreePropList xmlFreePropList__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlFreeRefTable -extern __typeof (xmlFreeRefTable) xmlFreeRefTable __attribute((alias("xmlFreeRefTable__internal_alias"))); -#else -#ifndef xmlFreeRefTable -extern __typeof (xmlFreeRefTable) xmlFreeRefTable__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeRefTable xmlFreeRefTable__internal_alias -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlFreeTextReader -extern __typeof (xmlFreeTextReader) xmlFreeTextReader __attribute((alias("xmlFreeTextReader__internal_alias"))); -#else -#ifndef xmlFreeTextReader -extern __typeof (xmlFreeTextReader) xmlFreeTextReader__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeTextReader xmlFreeTextReader__internal_alias -#endif -#endif -#endif - -#ifdef bottom_uri -#undef xmlFreeURI -extern __typeof (xmlFreeURI) xmlFreeURI __attribute((alias("xmlFreeURI__internal_alias"))); -#else -#ifndef xmlFreeURI -extern __typeof (xmlFreeURI) xmlFreeURI__internal_alias __attribute((visibility("hidden"))); -#define xmlFreeURI xmlFreeURI__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlGcMemGet -extern __typeof (xmlGcMemGet) xmlGcMemGet __attribute((alias("xmlGcMemGet__internal_alias"))); -#else -#ifndef xmlGcMemGet -extern __typeof (xmlGcMemGet) xmlGcMemGet__internal_alias __attribute((visibility("hidden"))); -#define xmlGcMemGet xmlGcMemGet__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlGcMemSetup -extern __typeof (xmlGcMemSetup) xmlGcMemSetup __attribute((alias("xmlGcMemSetup__internal_alias"))); -#else -#ifndef xmlGcMemSetup -extern __typeof (xmlGcMemSetup) xmlGcMemSetup__internal_alias __attribute((visibility("hidden"))); -#define xmlGcMemSetup xmlGcMemSetup__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetBufferAllocationScheme -extern __typeof (xmlGetBufferAllocationScheme) xmlGetBufferAllocationScheme __attribute((alias("xmlGetBufferAllocationScheme__internal_alias"))); -#else -#ifndef xmlGetBufferAllocationScheme -extern __typeof (xmlGetBufferAllocationScheme) xmlGetBufferAllocationScheme__internal_alias __attribute((visibility("hidden"))); -#define xmlGetBufferAllocationScheme xmlGetBufferAllocationScheme__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlGetCharEncodingHandler -extern __typeof (xmlGetCharEncodingHandler) xmlGetCharEncodingHandler __attribute((alias("xmlGetCharEncodingHandler__internal_alias"))); -#else -#ifndef xmlGetCharEncodingHandler -extern __typeof (xmlGetCharEncodingHandler) xmlGetCharEncodingHandler__internal_alias __attribute((visibility("hidden"))); -#define xmlGetCharEncodingHandler xmlGetCharEncodingHandler__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlGetCharEncodingName -extern __typeof (xmlGetCharEncodingName) xmlGetCharEncodingName __attribute((alias("xmlGetCharEncodingName__internal_alias"))); -#else -#ifndef xmlGetCharEncodingName -extern __typeof (xmlGetCharEncodingName) xmlGetCharEncodingName__internal_alias __attribute((visibility("hidden"))); -#define xmlGetCharEncodingName xmlGetCharEncodingName__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetCompressMode -extern __typeof (xmlGetCompressMode) xmlGetCompressMode __attribute((alias("xmlGetCompressMode__internal_alias"))); -#else -#ifndef xmlGetCompressMode -extern __typeof (xmlGetCompressMode) xmlGetCompressMode__internal_alias __attribute((visibility("hidden"))); -#define xmlGetCompressMode xmlGetCompressMode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetDocCompressMode -extern __typeof (xmlGetDocCompressMode) xmlGetDocCompressMode __attribute((alias("xmlGetDocCompressMode__internal_alias"))); -#else -#ifndef xmlGetDocCompressMode -extern __typeof (xmlGetDocCompressMode) xmlGetDocCompressMode__internal_alias __attribute((visibility("hidden"))); -#define xmlGetDocCompressMode xmlGetDocCompressMode__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlGetDocEntity -extern __typeof (xmlGetDocEntity) xmlGetDocEntity __attribute((alias("xmlGetDocEntity__internal_alias"))); -#else -#ifndef xmlGetDocEntity -extern __typeof (xmlGetDocEntity) xmlGetDocEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlGetDocEntity xmlGetDocEntity__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlGetDtdAttrDesc -extern __typeof (xmlGetDtdAttrDesc) xmlGetDtdAttrDesc __attribute((alias("xmlGetDtdAttrDesc__internal_alias"))); -#else -#ifndef xmlGetDtdAttrDesc -extern __typeof (xmlGetDtdAttrDesc) xmlGetDtdAttrDesc__internal_alias __attribute((visibility("hidden"))); -#define xmlGetDtdAttrDesc xmlGetDtdAttrDesc__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlGetDtdElementDesc -extern __typeof (xmlGetDtdElementDesc) xmlGetDtdElementDesc __attribute((alias("xmlGetDtdElementDesc__internal_alias"))); -#else -#ifndef xmlGetDtdElementDesc -extern __typeof (xmlGetDtdElementDesc) xmlGetDtdElementDesc__internal_alias __attribute((visibility("hidden"))); -#define xmlGetDtdElementDesc xmlGetDtdElementDesc__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlGetDtdEntity -extern __typeof (xmlGetDtdEntity) xmlGetDtdEntity __attribute((alias("xmlGetDtdEntity__internal_alias"))); -#else -#ifndef xmlGetDtdEntity -extern __typeof (xmlGetDtdEntity) xmlGetDtdEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlGetDtdEntity xmlGetDtdEntity__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlGetDtdNotationDesc -extern __typeof (xmlGetDtdNotationDesc) xmlGetDtdNotationDesc __attribute((alias("xmlGetDtdNotationDesc__internal_alias"))); -#else -#ifndef xmlGetDtdNotationDesc -extern __typeof (xmlGetDtdNotationDesc) xmlGetDtdNotationDesc__internal_alias __attribute((visibility("hidden"))); -#define xmlGetDtdNotationDesc xmlGetDtdNotationDesc__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlGetDtdQAttrDesc -extern __typeof (xmlGetDtdQAttrDesc) xmlGetDtdQAttrDesc __attribute((alias("xmlGetDtdQAttrDesc__internal_alias"))); -#else -#ifndef xmlGetDtdQAttrDesc -extern __typeof (xmlGetDtdQAttrDesc) xmlGetDtdQAttrDesc__internal_alias __attribute((visibility("hidden"))); -#define xmlGetDtdQAttrDesc xmlGetDtdQAttrDesc__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlGetDtdQElementDesc -extern __typeof (xmlGetDtdQElementDesc) xmlGetDtdQElementDesc __attribute((alias("xmlGetDtdQElementDesc__internal_alias"))); -#else -#ifndef xmlGetDtdQElementDesc -extern __typeof (xmlGetDtdQElementDesc) xmlGetDtdQElementDesc__internal_alias __attribute((visibility("hidden"))); -#define xmlGetDtdQElementDesc xmlGetDtdQElementDesc__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlGetEncodingAlias -extern __typeof (xmlGetEncodingAlias) xmlGetEncodingAlias __attribute((alias("xmlGetEncodingAlias__internal_alias"))); -#else -#ifndef xmlGetEncodingAlias -extern __typeof (xmlGetEncodingAlias) xmlGetEncodingAlias__internal_alias __attribute((visibility("hidden"))); -#define xmlGetEncodingAlias xmlGetEncodingAlias__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlGetExternalEntityLoader -extern __typeof (xmlGetExternalEntityLoader) xmlGetExternalEntityLoader __attribute((alias("xmlGetExternalEntityLoader__internal_alias"))); -#else -#ifndef xmlGetExternalEntityLoader -extern __typeof (xmlGetExternalEntityLoader) xmlGetExternalEntityLoader__internal_alias __attribute((visibility("hidden"))); -#define xmlGetExternalEntityLoader xmlGetExternalEntityLoader__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlGetID -extern __typeof (xmlGetID) xmlGetID __attribute((alias("xmlGetID__internal_alias"))); -#else -#ifndef xmlGetID -extern __typeof (xmlGetID) xmlGetID__internal_alias __attribute((visibility("hidden"))); -#define xmlGetID xmlGetID__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetIntSubset -extern __typeof (xmlGetIntSubset) xmlGetIntSubset __attribute((alias("xmlGetIntSubset__internal_alias"))); -#else -#ifndef xmlGetIntSubset -extern __typeof (xmlGetIntSubset) xmlGetIntSubset__internal_alias __attribute((visibility("hidden"))); -#define xmlGetIntSubset xmlGetIntSubset__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetLastChild -extern __typeof (xmlGetLastChild) xmlGetLastChild __attribute((alias("xmlGetLastChild__internal_alias"))); -#else -#ifndef xmlGetLastChild -extern __typeof (xmlGetLastChild) xmlGetLastChild__internal_alias __attribute((visibility("hidden"))); -#define xmlGetLastChild xmlGetLastChild__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlGetLastError -extern __typeof (xmlGetLastError) xmlGetLastError __attribute((alias("xmlGetLastError__internal_alias"))); -#else -#ifndef xmlGetLastError -extern __typeof (xmlGetLastError) xmlGetLastError__internal_alias __attribute((visibility("hidden"))); -#define xmlGetLastError xmlGetLastError__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetLineNo -extern __typeof (xmlGetLineNo) xmlGetLineNo __attribute((alias("xmlGetLineNo__internal_alias"))); -#else -#ifndef xmlGetLineNo -extern __typeof (xmlGetLineNo) xmlGetLineNo__internal_alias __attribute((visibility("hidden"))); -#define xmlGetLineNo xmlGetLineNo__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetNoNsProp -extern __typeof (xmlGetNoNsProp) xmlGetNoNsProp __attribute((alias("xmlGetNoNsProp__internal_alias"))); -#else -#ifndef xmlGetNoNsProp -extern __typeof (xmlGetNoNsProp) xmlGetNoNsProp__internal_alias __attribute((visibility("hidden"))); -#define xmlGetNoNsProp xmlGetNoNsProp__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlGetNodePath -extern __typeof (xmlGetNodePath) xmlGetNodePath __attribute((alias("xmlGetNodePath__internal_alias"))); -#else -#ifndef xmlGetNodePath -extern __typeof (xmlGetNodePath) xmlGetNodePath__internal_alias __attribute((visibility("hidden"))); -#define xmlGetNodePath xmlGetNodePath__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlGetNsList -extern __typeof (xmlGetNsList) xmlGetNsList __attribute((alias("xmlGetNsList__internal_alias"))); -#else -#ifndef xmlGetNsList -extern __typeof (xmlGetNsList) xmlGetNsList__internal_alias __attribute((visibility("hidden"))); -#define xmlGetNsList xmlGetNsList__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetNsProp -extern __typeof (xmlGetNsProp) xmlGetNsProp __attribute((alias("xmlGetNsProp__internal_alias"))); -#else -#ifndef xmlGetNsProp -extern __typeof (xmlGetNsProp) xmlGetNsProp__internal_alias __attribute((visibility("hidden"))); -#define xmlGetNsProp xmlGetNsProp__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlGetParameterEntity -extern __typeof (xmlGetParameterEntity) xmlGetParameterEntity __attribute((alias("xmlGetParameterEntity__internal_alias"))); -#else -#ifndef xmlGetParameterEntity -extern __typeof (xmlGetParameterEntity) xmlGetParameterEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlGetParameterEntity xmlGetParameterEntity__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlGetPredefinedEntity -extern __typeof (xmlGetPredefinedEntity) xmlGetPredefinedEntity __attribute((alias("xmlGetPredefinedEntity__internal_alias"))); -#else -#ifndef xmlGetPredefinedEntity -extern __typeof (xmlGetPredefinedEntity) xmlGetPredefinedEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlGetPredefinedEntity xmlGetPredefinedEntity__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlGetProp -extern __typeof (xmlGetProp) xmlGetProp __attribute((alias("xmlGetProp__internal_alias"))); -#else -#ifndef xmlGetProp -extern __typeof (xmlGetProp) xmlGetProp__internal_alias __attribute((visibility("hidden"))); -#define xmlGetProp xmlGetProp__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlGetRefs -extern __typeof (xmlGetRefs) xmlGetRefs __attribute((alias("xmlGetRefs__internal_alias"))); -#else -#ifndef xmlGetRefs -extern __typeof (xmlGetRefs) xmlGetRefs__internal_alias __attribute((visibility("hidden"))); -#define xmlGetRefs xmlGetRefs__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlGetUTF8Char -extern __typeof (xmlGetUTF8Char) xmlGetUTF8Char __attribute((alias("xmlGetUTF8Char__internal_alias"))); -#else -#ifndef xmlGetUTF8Char -extern __typeof (xmlGetUTF8Char) xmlGetUTF8Char__internal_alias __attribute((visibility("hidden"))); -#define xmlGetUTF8Char xmlGetUTF8Char__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlHasFeature -extern __typeof (xmlHasFeature) xmlHasFeature __attribute((alias("xmlHasFeature__internal_alias"))); -#else -#ifndef xmlHasFeature -extern __typeof (xmlHasFeature) xmlHasFeature__internal_alias __attribute((visibility("hidden"))); -#define xmlHasFeature xmlHasFeature__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlHasNsProp -extern __typeof (xmlHasNsProp) xmlHasNsProp __attribute((alias("xmlHasNsProp__internal_alias"))); -#else -#ifndef xmlHasNsProp -extern __typeof (xmlHasNsProp) xmlHasNsProp__internal_alias __attribute((visibility("hidden"))); -#define xmlHasNsProp xmlHasNsProp__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlHasProp -extern __typeof (xmlHasProp) xmlHasProp __attribute((alias("xmlHasProp__internal_alias"))); -#else -#ifndef xmlHasProp -extern __typeof (xmlHasProp) xmlHasProp__internal_alias __attribute((visibility("hidden"))); -#define xmlHasProp xmlHasProp__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashAddEntry -extern __typeof (xmlHashAddEntry) xmlHashAddEntry __attribute((alias("xmlHashAddEntry__internal_alias"))); -#else -#ifndef xmlHashAddEntry -extern __typeof (xmlHashAddEntry) xmlHashAddEntry__internal_alias __attribute((visibility("hidden"))); -#define xmlHashAddEntry xmlHashAddEntry__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashAddEntry2 -extern __typeof (xmlHashAddEntry2) xmlHashAddEntry2 __attribute((alias("xmlHashAddEntry2__internal_alias"))); -#else -#ifndef xmlHashAddEntry2 -extern __typeof (xmlHashAddEntry2) xmlHashAddEntry2__internal_alias __attribute((visibility("hidden"))); -#define xmlHashAddEntry2 xmlHashAddEntry2__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashAddEntry3 -extern __typeof (xmlHashAddEntry3) xmlHashAddEntry3 __attribute((alias("xmlHashAddEntry3__internal_alias"))); -#else -#ifndef xmlHashAddEntry3 -extern __typeof (xmlHashAddEntry3) xmlHashAddEntry3__internal_alias __attribute((visibility("hidden"))); -#define xmlHashAddEntry3 xmlHashAddEntry3__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashCopy -extern __typeof (xmlHashCopy) xmlHashCopy __attribute((alias("xmlHashCopy__internal_alias"))); -#else -#ifndef xmlHashCopy -extern __typeof (xmlHashCopy) xmlHashCopy__internal_alias __attribute((visibility("hidden"))); -#define xmlHashCopy xmlHashCopy__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashCreate -extern __typeof (xmlHashCreate) xmlHashCreate __attribute((alias("xmlHashCreate__internal_alias"))); -#else -#ifndef xmlHashCreate -extern __typeof (xmlHashCreate) xmlHashCreate__internal_alias __attribute((visibility("hidden"))); -#define xmlHashCreate xmlHashCreate__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashCreateDict -extern __typeof (xmlHashCreateDict) xmlHashCreateDict __attribute((alias("xmlHashCreateDict__internal_alias"))); -#else -#ifndef xmlHashCreateDict -extern __typeof (xmlHashCreateDict) xmlHashCreateDict__internal_alias __attribute((visibility("hidden"))); -#define xmlHashCreateDict xmlHashCreateDict__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashFree -extern __typeof (xmlHashFree) xmlHashFree __attribute((alias("xmlHashFree__internal_alias"))); -#else -#ifndef xmlHashFree -extern __typeof (xmlHashFree) xmlHashFree__internal_alias __attribute((visibility("hidden"))); -#define xmlHashFree xmlHashFree__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashLookup -extern __typeof (xmlHashLookup) xmlHashLookup __attribute((alias("xmlHashLookup__internal_alias"))); -#else -#ifndef xmlHashLookup -extern __typeof (xmlHashLookup) xmlHashLookup__internal_alias __attribute((visibility("hidden"))); -#define xmlHashLookup xmlHashLookup__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashLookup2 -extern __typeof (xmlHashLookup2) xmlHashLookup2 __attribute((alias("xmlHashLookup2__internal_alias"))); -#else -#ifndef xmlHashLookup2 -extern __typeof (xmlHashLookup2) xmlHashLookup2__internal_alias __attribute((visibility("hidden"))); -#define xmlHashLookup2 xmlHashLookup2__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashLookup3 -extern __typeof (xmlHashLookup3) xmlHashLookup3 __attribute((alias("xmlHashLookup3__internal_alias"))); -#else -#ifndef xmlHashLookup3 -extern __typeof (xmlHashLookup3) xmlHashLookup3__internal_alias __attribute((visibility("hidden"))); -#define xmlHashLookup3 xmlHashLookup3__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashQLookup -extern __typeof (xmlHashQLookup) xmlHashQLookup __attribute((alias("xmlHashQLookup__internal_alias"))); -#else -#ifndef xmlHashQLookup -extern __typeof (xmlHashQLookup) xmlHashQLookup__internal_alias __attribute((visibility("hidden"))); -#define xmlHashQLookup xmlHashQLookup__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashQLookup2 -extern __typeof (xmlHashQLookup2) xmlHashQLookup2 __attribute((alias("xmlHashQLookup2__internal_alias"))); -#else -#ifndef xmlHashQLookup2 -extern __typeof (xmlHashQLookup2) xmlHashQLookup2__internal_alias __attribute((visibility("hidden"))); -#define xmlHashQLookup2 xmlHashQLookup2__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashQLookup3 -extern __typeof (xmlHashQLookup3) xmlHashQLookup3 __attribute((alias("xmlHashQLookup3__internal_alias"))); -#else -#ifndef xmlHashQLookup3 -extern __typeof (xmlHashQLookup3) xmlHashQLookup3__internal_alias __attribute((visibility("hidden"))); -#define xmlHashQLookup3 xmlHashQLookup3__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashRemoveEntry -extern __typeof (xmlHashRemoveEntry) xmlHashRemoveEntry __attribute((alias("xmlHashRemoveEntry__internal_alias"))); -#else -#ifndef xmlHashRemoveEntry -extern __typeof (xmlHashRemoveEntry) xmlHashRemoveEntry__internal_alias __attribute((visibility("hidden"))); -#define xmlHashRemoveEntry xmlHashRemoveEntry__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashRemoveEntry2 -extern __typeof (xmlHashRemoveEntry2) xmlHashRemoveEntry2 __attribute((alias("xmlHashRemoveEntry2__internal_alias"))); -#else -#ifndef xmlHashRemoveEntry2 -extern __typeof (xmlHashRemoveEntry2) xmlHashRemoveEntry2__internal_alias __attribute((visibility("hidden"))); -#define xmlHashRemoveEntry2 xmlHashRemoveEntry2__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashRemoveEntry3 -extern __typeof (xmlHashRemoveEntry3) xmlHashRemoveEntry3 __attribute((alias("xmlHashRemoveEntry3__internal_alias"))); -#else -#ifndef xmlHashRemoveEntry3 -extern __typeof (xmlHashRemoveEntry3) xmlHashRemoveEntry3__internal_alias __attribute((visibility("hidden"))); -#define xmlHashRemoveEntry3 xmlHashRemoveEntry3__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashScan -extern __typeof (xmlHashScan) xmlHashScan __attribute((alias("xmlHashScan__internal_alias"))); -#else -#ifndef xmlHashScan -extern __typeof (xmlHashScan) xmlHashScan__internal_alias __attribute((visibility("hidden"))); -#define xmlHashScan xmlHashScan__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashScan3 -extern __typeof (xmlHashScan3) xmlHashScan3 __attribute((alias("xmlHashScan3__internal_alias"))); -#else -#ifndef xmlHashScan3 -extern __typeof (xmlHashScan3) xmlHashScan3__internal_alias __attribute((visibility("hidden"))); -#define xmlHashScan3 xmlHashScan3__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashScanFull -extern __typeof (xmlHashScanFull) xmlHashScanFull __attribute((alias("xmlHashScanFull__internal_alias"))); -#else -#ifndef xmlHashScanFull -extern __typeof (xmlHashScanFull) xmlHashScanFull__internal_alias __attribute((visibility("hidden"))); -#define xmlHashScanFull xmlHashScanFull__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashScanFull3 -extern __typeof (xmlHashScanFull3) xmlHashScanFull3 __attribute((alias("xmlHashScanFull3__internal_alias"))); -#else -#ifndef xmlHashScanFull3 -extern __typeof (xmlHashScanFull3) xmlHashScanFull3__internal_alias __attribute((visibility("hidden"))); -#define xmlHashScanFull3 xmlHashScanFull3__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashSize -extern __typeof (xmlHashSize) xmlHashSize __attribute((alias("xmlHashSize__internal_alias"))); -#else -#ifndef xmlHashSize -extern __typeof (xmlHashSize) xmlHashSize__internal_alias __attribute((visibility("hidden"))); -#define xmlHashSize xmlHashSize__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashUpdateEntry -extern __typeof (xmlHashUpdateEntry) xmlHashUpdateEntry __attribute((alias("xmlHashUpdateEntry__internal_alias"))); -#else -#ifndef xmlHashUpdateEntry -extern __typeof (xmlHashUpdateEntry) xmlHashUpdateEntry__internal_alias __attribute((visibility("hidden"))); -#define xmlHashUpdateEntry xmlHashUpdateEntry__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashUpdateEntry2 -extern __typeof (xmlHashUpdateEntry2) xmlHashUpdateEntry2 __attribute((alias("xmlHashUpdateEntry2__internal_alias"))); -#else -#ifndef xmlHashUpdateEntry2 -extern __typeof (xmlHashUpdateEntry2) xmlHashUpdateEntry2__internal_alias __attribute((visibility("hidden"))); -#define xmlHashUpdateEntry2 xmlHashUpdateEntry2__internal_alias -#endif -#endif - -#ifdef bottom_hash -#undef xmlHashUpdateEntry3 -extern __typeof (xmlHashUpdateEntry3) xmlHashUpdateEntry3 __attribute((alias("xmlHashUpdateEntry3__internal_alias"))); -#else -#ifndef xmlHashUpdateEntry3 -extern __typeof (xmlHashUpdateEntry3) xmlHashUpdateEntry3__internal_alias __attribute((visibility("hidden"))); -#define xmlHashUpdateEntry3 xmlHashUpdateEntry3__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlInitCharEncodingHandlers -extern __typeof (xmlInitCharEncodingHandlers) xmlInitCharEncodingHandlers __attribute((alias("xmlInitCharEncodingHandlers__internal_alias"))); -#else -#ifndef xmlInitCharEncodingHandlers -extern __typeof (xmlInitCharEncodingHandlers) xmlInitCharEncodingHandlers__internal_alias __attribute((visibility("hidden"))); -#define xmlInitCharEncodingHandlers xmlInitCharEncodingHandlers__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlInitGlobals -extern __typeof (xmlInitGlobals) xmlInitGlobals __attribute((alias("xmlInitGlobals__internal_alias"))); -#else -#ifndef xmlInitGlobals -extern __typeof (xmlInitGlobals) xmlInitGlobals__internal_alias __attribute((visibility("hidden"))); -#define xmlInitGlobals xmlInitGlobals__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlInitMemory -extern __typeof (xmlInitMemory) xmlInitMemory __attribute((alias("xmlInitMemory__internal_alias"))); -#else -#ifndef xmlInitMemory -extern __typeof (xmlInitMemory) xmlInitMemory__internal_alias __attribute((visibility("hidden"))); -#define xmlInitMemory xmlInitMemory__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlInitNodeInfoSeq -extern __typeof (xmlInitNodeInfoSeq) xmlInitNodeInfoSeq __attribute((alias("xmlInitNodeInfoSeq__internal_alias"))); -#else -#ifndef xmlInitNodeInfoSeq -extern __typeof (xmlInitNodeInfoSeq) xmlInitNodeInfoSeq__internal_alias __attribute((visibility("hidden"))); -#define xmlInitNodeInfoSeq xmlInitNodeInfoSeq__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlInitParser -extern __typeof (xmlInitParser) xmlInitParser __attribute((alias("xmlInitParser__internal_alias"))); -#else -#ifndef xmlInitParser -extern __typeof (xmlInitParser) xmlInitParser__internal_alias __attribute((visibility("hidden"))); -#define xmlInitParser xmlInitParser__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlInitParserCtxt -extern __typeof (xmlInitParserCtxt) xmlInitParserCtxt __attribute((alias("xmlInitParserCtxt__internal_alias"))); -#else -#ifndef xmlInitParserCtxt -extern __typeof (xmlInitParserCtxt) xmlInitParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlInitParserCtxt xmlInitParserCtxt__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlInitializeGlobalState -extern __typeof (xmlInitializeGlobalState) xmlInitializeGlobalState __attribute((alias("xmlInitializeGlobalState__internal_alias"))); -#else -#ifndef xmlInitializeGlobalState -extern __typeof (xmlInitializeGlobalState) xmlInitializeGlobalState__internal_alias __attribute((visibility("hidden"))); -#define xmlInitializeGlobalState xmlInitializeGlobalState__internal_alias -#endif -#endif - - -#ifdef bottom_chvalid -#undef xmlIsBaseChar -extern __typeof (xmlIsBaseChar) xmlIsBaseChar __attribute((alias("xmlIsBaseChar__internal_alias"))); -#else -#ifndef xmlIsBaseChar -extern __typeof (xmlIsBaseChar) xmlIsBaseChar__internal_alias __attribute((visibility("hidden"))); -#define xmlIsBaseChar xmlIsBaseChar__internal_alias -#endif -#endif - -#ifdef bottom_chvalid -#undef xmlIsBlank -extern __typeof (xmlIsBlank) xmlIsBlank __attribute((alias("xmlIsBlank__internal_alias"))); -#else -#ifndef xmlIsBlank -extern __typeof (xmlIsBlank) xmlIsBlank__internal_alias __attribute((visibility("hidden"))); -#define xmlIsBlank xmlIsBlank__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlIsBlankNode -extern __typeof (xmlIsBlankNode) xmlIsBlankNode __attribute((alias("xmlIsBlankNode__internal_alias"))); -#else -#ifndef xmlIsBlankNode -extern __typeof (xmlIsBlankNode) xmlIsBlankNode__internal_alias __attribute((visibility("hidden"))); -#define xmlIsBlankNode xmlIsBlankNode__internal_alias -#endif -#endif - -#ifdef bottom_chvalid -#undef xmlIsChar -extern __typeof (xmlIsChar) xmlIsChar __attribute((alias("xmlIsChar__internal_alias"))); -#else -#ifndef xmlIsChar -extern __typeof (xmlIsChar) xmlIsChar__internal_alias __attribute((visibility("hidden"))); -#define xmlIsChar xmlIsChar__internal_alias -#endif -#endif - -#ifdef bottom_chvalid -#undef xmlIsCombining -extern __typeof (xmlIsCombining) xmlIsCombining __attribute((alias("xmlIsCombining__internal_alias"))); -#else -#ifndef xmlIsCombining -extern __typeof (xmlIsCombining) xmlIsCombining__internal_alias __attribute((visibility("hidden"))); -#define xmlIsCombining xmlIsCombining__internal_alias -#endif -#endif - -#ifdef bottom_chvalid -#undef xmlIsDigit -extern __typeof (xmlIsDigit) xmlIsDigit __attribute((alias("xmlIsDigit__internal_alias"))); -#else -#ifndef xmlIsDigit -extern __typeof (xmlIsDigit) xmlIsDigit__internal_alias __attribute((visibility("hidden"))); -#define xmlIsDigit xmlIsDigit__internal_alias -#endif -#endif - -#ifdef bottom_chvalid -#undef xmlIsExtender -extern __typeof (xmlIsExtender) xmlIsExtender __attribute((alias("xmlIsExtender__internal_alias"))); -#else -#ifndef xmlIsExtender -extern __typeof (xmlIsExtender) xmlIsExtender__internal_alias __attribute((visibility("hidden"))); -#define xmlIsExtender xmlIsExtender__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlIsID -extern __typeof (xmlIsID) xmlIsID __attribute((alias("xmlIsID__internal_alias"))); -#else -#ifndef xmlIsID -extern __typeof (xmlIsID) xmlIsID__internal_alias __attribute((visibility("hidden"))); -#define xmlIsID xmlIsID__internal_alias -#endif -#endif - -#ifdef bottom_chvalid -#undef xmlIsIdeographic -extern __typeof (xmlIsIdeographic) xmlIsIdeographic __attribute((alias("xmlIsIdeographic__internal_alias"))); -#else -#ifndef xmlIsIdeographic -extern __typeof (xmlIsIdeographic) xmlIsIdeographic__internal_alias __attribute((visibility("hidden"))); -#define xmlIsIdeographic xmlIsIdeographic__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlIsLetter -extern __typeof (xmlIsLetter) xmlIsLetter __attribute((alias("xmlIsLetter__internal_alias"))); -#else -#ifndef xmlIsLetter -extern __typeof (xmlIsLetter) xmlIsLetter__internal_alias __attribute((visibility("hidden"))); -#define xmlIsLetter xmlIsLetter__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlIsMixedElement -extern __typeof (xmlIsMixedElement) xmlIsMixedElement __attribute((alias("xmlIsMixedElement__internal_alias"))); -#else -#ifndef xmlIsMixedElement -extern __typeof (xmlIsMixedElement) xmlIsMixedElement__internal_alias __attribute((visibility("hidden"))); -#define xmlIsMixedElement xmlIsMixedElement__internal_alias -#endif -#endif - -#ifdef bottom_chvalid -#undef xmlIsPubidChar -extern __typeof (xmlIsPubidChar) xmlIsPubidChar __attribute((alias("xmlIsPubidChar__internal_alias"))); -#else -#ifndef xmlIsPubidChar -extern __typeof (xmlIsPubidChar) xmlIsPubidChar__internal_alias __attribute((visibility("hidden"))); -#define xmlIsPubidChar xmlIsPubidChar__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlIsRef -extern __typeof (xmlIsRef) xmlIsRef __attribute((alias("xmlIsRef__internal_alias"))); -#else -#ifndef xmlIsRef -extern __typeof (xmlIsRef) xmlIsRef__internal_alias __attribute((visibility("hidden"))); -#define xmlIsRef xmlIsRef__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlKeepBlanksDefault -extern __typeof (xmlKeepBlanksDefault) xmlKeepBlanksDefault __attribute((alias("xmlKeepBlanksDefault__internal_alias"))); -#else -#ifndef xmlKeepBlanksDefault -extern __typeof (xmlKeepBlanksDefault) xmlKeepBlanksDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlKeepBlanksDefault xmlKeepBlanksDefault__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlLastElementChild -extern __typeof (xmlLastElementChild) xmlLastElementChild __attribute((alias("xmlLastElementChild__internal_alias"))); -#else -#ifndef xmlLastElementChild -extern __typeof (xmlLastElementChild) xmlLastElementChild__internal_alias __attribute((visibility("hidden"))); -#define xmlLastElementChild xmlLastElementChild__internal_alias -#endif -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlLineNumbersDefault -extern __typeof (xmlLineNumbersDefault) xmlLineNumbersDefault __attribute((alias("xmlLineNumbersDefault__internal_alias"))); -#else -#ifndef xmlLineNumbersDefault -extern __typeof (xmlLineNumbersDefault) xmlLineNumbersDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlLineNumbersDefault xmlLineNumbersDefault__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlLinkGetData -extern __typeof (xmlLinkGetData) xmlLinkGetData __attribute((alias("xmlLinkGetData__internal_alias"))); -#else -#ifndef xmlLinkGetData -extern __typeof (xmlLinkGetData) xmlLinkGetData__internal_alias __attribute((visibility("hidden"))); -#define xmlLinkGetData xmlLinkGetData__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListAppend -extern __typeof (xmlListAppend) xmlListAppend __attribute((alias("xmlListAppend__internal_alias"))); -#else -#ifndef xmlListAppend -extern __typeof (xmlListAppend) xmlListAppend__internal_alias __attribute((visibility("hidden"))); -#define xmlListAppend xmlListAppend__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListClear -extern __typeof (xmlListClear) xmlListClear __attribute((alias("xmlListClear__internal_alias"))); -#else -#ifndef xmlListClear -extern __typeof (xmlListClear) xmlListClear__internal_alias __attribute((visibility("hidden"))); -#define xmlListClear xmlListClear__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListCopy -extern __typeof (xmlListCopy) xmlListCopy __attribute((alias("xmlListCopy__internal_alias"))); -#else -#ifndef xmlListCopy -extern __typeof (xmlListCopy) xmlListCopy__internal_alias __attribute((visibility("hidden"))); -#define xmlListCopy xmlListCopy__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListCreate -extern __typeof (xmlListCreate) xmlListCreate __attribute((alias("xmlListCreate__internal_alias"))); -#else -#ifndef xmlListCreate -extern __typeof (xmlListCreate) xmlListCreate__internal_alias __attribute((visibility("hidden"))); -#define xmlListCreate xmlListCreate__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListDelete -extern __typeof (xmlListDelete) xmlListDelete __attribute((alias("xmlListDelete__internal_alias"))); -#else -#ifndef xmlListDelete -extern __typeof (xmlListDelete) xmlListDelete__internal_alias __attribute((visibility("hidden"))); -#define xmlListDelete xmlListDelete__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListDup -extern __typeof (xmlListDup) xmlListDup __attribute((alias("xmlListDup__internal_alias"))); -#else -#ifndef xmlListDup -extern __typeof (xmlListDup) xmlListDup__internal_alias __attribute((visibility("hidden"))); -#define xmlListDup xmlListDup__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListEmpty -extern __typeof (xmlListEmpty) xmlListEmpty __attribute((alias("xmlListEmpty__internal_alias"))); -#else -#ifndef xmlListEmpty -extern __typeof (xmlListEmpty) xmlListEmpty__internal_alias __attribute((visibility("hidden"))); -#define xmlListEmpty xmlListEmpty__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListEnd -extern __typeof (xmlListEnd) xmlListEnd __attribute((alias("xmlListEnd__internal_alias"))); -#else -#ifndef xmlListEnd -extern __typeof (xmlListEnd) xmlListEnd__internal_alias __attribute((visibility("hidden"))); -#define xmlListEnd xmlListEnd__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListFront -extern __typeof (xmlListFront) xmlListFront __attribute((alias("xmlListFront__internal_alias"))); -#else -#ifndef xmlListFront -extern __typeof (xmlListFront) xmlListFront__internal_alias __attribute((visibility("hidden"))); -#define xmlListFront xmlListFront__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListInsert -extern __typeof (xmlListInsert) xmlListInsert __attribute((alias("xmlListInsert__internal_alias"))); -#else -#ifndef xmlListInsert -extern __typeof (xmlListInsert) xmlListInsert__internal_alias __attribute((visibility("hidden"))); -#define xmlListInsert xmlListInsert__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListMerge -extern __typeof (xmlListMerge) xmlListMerge __attribute((alias("xmlListMerge__internal_alias"))); -#else -#ifndef xmlListMerge -extern __typeof (xmlListMerge) xmlListMerge__internal_alias __attribute((visibility("hidden"))); -#define xmlListMerge xmlListMerge__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListPopBack -extern __typeof (xmlListPopBack) xmlListPopBack __attribute((alias("xmlListPopBack__internal_alias"))); -#else -#ifndef xmlListPopBack -extern __typeof (xmlListPopBack) xmlListPopBack__internal_alias __attribute((visibility("hidden"))); -#define xmlListPopBack xmlListPopBack__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListPopFront -extern __typeof (xmlListPopFront) xmlListPopFront __attribute((alias("xmlListPopFront__internal_alias"))); -#else -#ifndef xmlListPopFront -extern __typeof (xmlListPopFront) xmlListPopFront__internal_alias __attribute((visibility("hidden"))); -#define xmlListPopFront xmlListPopFront__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListPushBack -extern __typeof (xmlListPushBack) xmlListPushBack __attribute((alias("xmlListPushBack__internal_alias"))); -#else -#ifndef xmlListPushBack -extern __typeof (xmlListPushBack) xmlListPushBack__internal_alias __attribute((visibility("hidden"))); -#define xmlListPushBack xmlListPushBack__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListPushFront -extern __typeof (xmlListPushFront) xmlListPushFront __attribute((alias("xmlListPushFront__internal_alias"))); -#else -#ifndef xmlListPushFront -extern __typeof (xmlListPushFront) xmlListPushFront__internal_alias __attribute((visibility("hidden"))); -#define xmlListPushFront xmlListPushFront__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListRemoveAll -extern __typeof (xmlListRemoveAll) xmlListRemoveAll __attribute((alias("xmlListRemoveAll__internal_alias"))); -#else -#ifndef xmlListRemoveAll -extern __typeof (xmlListRemoveAll) xmlListRemoveAll__internal_alias __attribute((visibility("hidden"))); -#define xmlListRemoveAll xmlListRemoveAll__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListRemoveFirst -extern __typeof (xmlListRemoveFirst) xmlListRemoveFirst __attribute((alias("xmlListRemoveFirst__internal_alias"))); -#else -#ifndef xmlListRemoveFirst -extern __typeof (xmlListRemoveFirst) xmlListRemoveFirst__internal_alias __attribute((visibility("hidden"))); -#define xmlListRemoveFirst xmlListRemoveFirst__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListRemoveLast -extern __typeof (xmlListRemoveLast) xmlListRemoveLast __attribute((alias("xmlListRemoveLast__internal_alias"))); -#else -#ifndef xmlListRemoveLast -extern __typeof (xmlListRemoveLast) xmlListRemoveLast__internal_alias __attribute((visibility("hidden"))); -#define xmlListRemoveLast xmlListRemoveLast__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListReverse -extern __typeof (xmlListReverse) xmlListReverse __attribute((alias("xmlListReverse__internal_alias"))); -#else -#ifndef xmlListReverse -extern __typeof (xmlListReverse) xmlListReverse__internal_alias __attribute((visibility("hidden"))); -#define xmlListReverse xmlListReverse__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListReverseSearch -extern __typeof (xmlListReverseSearch) xmlListReverseSearch __attribute((alias("xmlListReverseSearch__internal_alias"))); -#else -#ifndef xmlListReverseSearch -extern __typeof (xmlListReverseSearch) xmlListReverseSearch__internal_alias __attribute((visibility("hidden"))); -#define xmlListReverseSearch xmlListReverseSearch__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListReverseWalk -extern __typeof (xmlListReverseWalk) xmlListReverseWalk __attribute((alias("xmlListReverseWalk__internal_alias"))); -#else -#ifndef xmlListReverseWalk -extern __typeof (xmlListReverseWalk) xmlListReverseWalk__internal_alias __attribute((visibility("hidden"))); -#define xmlListReverseWalk xmlListReverseWalk__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListSearch -extern __typeof (xmlListSearch) xmlListSearch __attribute((alias("xmlListSearch__internal_alias"))); -#else -#ifndef xmlListSearch -extern __typeof (xmlListSearch) xmlListSearch__internal_alias __attribute((visibility("hidden"))); -#define xmlListSearch xmlListSearch__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListSize -extern __typeof (xmlListSize) xmlListSize __attribute((alias("xmlListSize__internal_alias"))); -#else -#ifndef xmlListSize -extern __typeof (xmlListSize) xmlListSize__internal_alias __attribute((visibility("hidden"))); -#define xmlListSize xmlListSize__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListSort -extern __typeof (xmlListSort) xmlListSort __attribute((alias("xmlListSort__internal_alias"))); -#else -#ifndef xmlListSort -extern __typeof (xmlListSort) xmlListSort__internal_alias __attribute((visibility("hidden"))); -#define xmlListSort xmlListSort__internal_alias -#endif -#endif - -#ifdef bottom_list -#undef xmlListWalk -extern __typeof (xmlListWalk) xmlListWalk __attribute((alias("xmlListWalk__internal_alias"))); -#else -#ifndef xmlListWalk -extern __typeof (xmlListWalk) xmlListWalk__internal_alias __attribute((visibility("hidden"))); -#define xmlListWalk xmlListWalk__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlLoadExternalEntity -extern __typeof (xmlLoadExternalEntity) xmlLoadExternalEntity __attribute((alias("xmlLoadExternalEntity__internal_alias"))); -#else -#ifndef xmlLoadExternalEntity -extern __typeof (xmlLoadExternalEntity) xmlLoadExternalEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlLoadExternalEntity xmlLoadExternalEntity__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMallocAtomicLoc -extern __typeof (xmlMallocAtomicLoc) xmlMallocAtomicLoc __attribute((alias("xmlMallocAtomicLoc__internal_alias"))); -#else -#ifndef xmlMallocAtomicLoc -extern __typeof (xmlMallocAtomicLoc) xmlMallocAtomicLoc__internal_alias __attribute((visibility("hidden"))); -#define xmlMallocAtomicLoc xmlMallocAtomicLoc__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMallocLoc -extern __typeof (xmlMallocLoc) xmlMallocLoc __attribute((alias("xmlMallocLoc__internal_alias"))); -#else -#ifndef xmlMallocLoc -extern __typeof (xmlMallocLoc) xmlMallocLoc__internal_alias __attribute((visibility("hidden"))); -#define xmlMallocLoc xmlMallocLoc__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemBlocks -extern __typeof (xmlMemBlocks) xmlMemBlocks __attribute((alias("xmlMemBlocks__internal_alias"))); -#else -#ifndef xmlMemBlocks -extern __typeof (xmlMemBlocks) xmlMemBlocks__internal_alias __attribute((visibility("hidden"))); -#define xmlMemBlocks xmlMemBlocks__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemDisplay -extern __typeof (xmlMemDisplay) xmlMemDisplay __attribute((alias("xmlMemDisplay__internal_alias"))); -#else -#ifndef xmlMemDisplay -extern __typeof (xmlMemDisplay) xmlMemDisplay__internal_alias __attribute((visibility("hidden"))); -#define xmlMemDisplay xmlMemDisplay__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemDisplayLast -extern __typeof (xmlMemDisplayLast) xmlMemDisplayLast __attribute((alias("xmlMemDisplayLast__internal_alias"))); -#else -#ifndef xmlMemDisplayLast -extern __typeof (xmlMemDisplayLast) xmlMemDisplayLast__internal_alias __attribute((visibility("hidden"))); -#define xmlMemDisplayLast xmlMemDisplayLast__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemFree -extern __typeof (xmlMemFree) xmlMemFree __attribute((alias("xmlMemFree__internal_alias"))); -#else -#ifndef xmlMemFree -extern __typeof (xmlMemFree) xmlMemFree__internal_alias __attribute((visibility("hidden"))); -#define xmlMemFree xmlMemFree__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemGet -extern __typeof (xmlMemGet) xmlMemGet __attribute((alias("xmlMemGet__internal_alias"))); -#else -#ifndef xmlMemGet -extern __typeof (xmlMemGet) xmlMemGet__internal_alias __attribute((visibility("hidden"))); -#define xmlMemGet xmlMemGet__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemMalloc -extern __typeof (xmlMemMalloc) xmlMemMalloc __attribute((alias("xmlMemMalloc__internal_alias"))); -#else -#ifndef xmlMemMalloc -extern __typeof (xmlMemMalloc) xmlMemMalloc__internal_alias __attribute((visibility("hidden"))); -#define xmlMemMalloc xmlMemMalloc__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemRealloc -extern __typeof (xmlMemRealloc) xmlMemRealloc __attribute((alias("xmlMemRealloc__internal_alias"))); -#else -#ifndef xmlMemRealloc -extern __typeof (xmlMemRealloc) xmlMemRealloc__internal_alias __attribute((visibility("hidden"))); -#define xmlMemRealloc xmlMemRealloc__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemSetup -extern __typeof (xmlMemSetup) xmlMemSetup __attribute((alias("xmlMemSetup__internal_alias"))); -#else -#ifndef xmlMemSetup -extern __typeof (xmlMemSetup) xmlMemSetup__internal_alias __attribute((visibility("hidden"))); -#define xmlMemSetup xmlMemSetup__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemShow -extern __typeof (xmlMemShow) xmlMemShow __attribute((alias("xmlMemShow__internal_alias"))); -#else -#ifndef xmlMemShow -extern __typeof (xmlMemShow) xmlMemShow__internal_alias __attribute((visibility("hidden"))); -#define xmlMemShow xmlMemShow__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemStrdupLoc -extern __typeof (xmlMemStrdupLoc) xmlMemStrdupLoc __attribute((alias("xmlMemStrdupLoc__internal_alias"))); -#else -#ifndef xmlMemStrdupLoc -extern __typeof (xmlMemStrdupLoc) xmlMemStrdupLoc__internal_alias __attribute((visibility("hidden"))); -#define xmlMemStrdupLoc xmlMemStrdupLoc__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemUsed -extern __typeof (xmlMemUsed) xmlMemUsed __attribute((alias("xmlMemUsed__internal_alias"))); -#else -#ifndef xmlMemUsed -extern __typeof (xmlMemUsed) xmlMemUsed__internal_alias __attribute((visibility("hidden"))); -#define xmlMemUsed xmlMemUsed__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemoryDump -extern __typeof (xmlMemoryDump) xmlMemoryDump __attribute((alias("xmlMemoryDump__internal_alias"))); -#else -#ifndef xmlMemoryDump -extern __typeof (xmlMemoryDump) xmlMemoryDump__internal_alias __attribute((visibility("hidden"))); -#define xmlMemoryDump xmlMemoryDump__internal_alias -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlMemoryStrdup -extern __typeof (xmlMemoryStrdup) xmlMemoryStrdup __attribute((alias("xmlMemoryStrdup__internal_alias"))); -#else -#ifndef xmlMemoryStrdup -extern __typeof (xmlMemoryStrdup) xmlMemoryStrdup__internal_alias __attribute((visibility("hidden"))); -#define xmlMemoryStrdup xmlMemoryStrdup__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewCDataBlock -extern __typeof (xmlNewCDataBlock) xmlNewCDataBlock __attribute((alias("xmlNewCDataBlock__internal_alias"))); -#else -#ifndef xmlNewCDataBlock -extern __typeof (xmlNewCDataBlock) xmlNewCDataBlock__internal_alias __attribute((visibility("hidden"))); -#define xmlNewCDataBlock xmlNewCDataBlock__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlNewCharEncodingHandler -extern __typeof (xmlNewCharEncodingHandler) xmlNewCharEncodingHandler __attribute((alias("xmlNewCharEncodingHandler__internal_alias"))); -#else -#ifndef xmlNewCharEncodingHandler -extern __typeof (xmlNewCharEncodingHandler) xmlNewCharEncodingHandler__internal_alias __attribute((visibility("hidden"))); -#define xmlNewCharEncodingHandler xmlNewCharEncodingHandler__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewCharRef -extern __typeof (xmlNewCharRef) xmlNewCharRef __attribute((alias("xmlNewCharRef__internal_alias"))); -#else -#ifndef xmlNewCharRef -extern __typeof (xmlNewCharRef) xmlNewCharRef__internal_alias __attribute((visibility("hidden"))); -#define xmlNewCharRef xmlNewCharRef__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNewChild -extern __typeof (xmlNewChild) xmlNewChild __attribute((alias("xmlNewChild__internal_alias"))); -#else -#ifndef xmlNewChild -extern __typeof (xmlNewChild) xmlNewChild__internal_alias __attribute((visibility("hidden"))); -#define xmlNewChild xmlNewChild__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewComment -extern __typeof (xmlNewComment) xmlNewComment __attribute((alias("xmlNewComment__internal_alias"))); -#else -#ifndef xmlNewComment -extern __typeof (xmlNewComment) xmlNewComment__internal_alias __attribute((visibility("hidden"))); -#define xmlNewComment xmlNewComment__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDoc -extern __typeof (xmlNewDoc) xmlNewDoc __attribute((alias("xmlNewDoc__internal_alias"))); -#else -#ifndef xmlNewDoc -extern __typeof (xmlNewDoc) xmlNewDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDoc xmlNewDoc__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDocComment -extern __typeof (xmlNewDocComment) xmlNewDocComment __attribute((alias("xmlNewDocComment__internal_alias"))); -#else -#ifndef xmlNewDocComment -extern __typeof (xmlNewDocComment) xmlNewDocComment__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocComment xmlNewDocComment__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlNewDocElementContent -extern __typeof (xmlNewDocElementContent) xmlNewDocElementContent __attribute((alias("xmlNewDocElementContent__internal_alias"))); -#else -#ifndef xmlNewDocElementContent -extern __typeof (xmlNewDocElementContent) xmlNewDocElementContent__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocElementContent xmlNewDocElementContent__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNewDocFragment -extern __typeof (xmlNewDocFragment) xmlNewDocFragment __attribute((alias("xmlNewDocFragment__internal_alias"))); -#else -#ifndef xmlNewDocFragment -extern __typeof (xmlNewDocFragment) xmlNewDocFragment__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocFragment xmlNewDocFragment__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDocNode -extern __typeof (xmlNewDocNode) xmlNewDocNode __attribute((alias("xmlNewDocNode__internal_alias"))); -#else -#ifndef xmlNewDocNode -extern __typeof (xmlNewDocNode) xmlNewDocNode__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocNode xmlNewDocNode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDocNodeEatName -extern __typeof (xmlNewDocNodeEatName) xmlNewDocNodeEatName __attribute((alias("xmlNewDocNodeEatName__internal_alias"))); -#else -#ifndef xmlNewDocNodeEatName -extern __typeof (xmlNewDocNodeEatName) xmlNewDocNodeEatName__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocNodeEatName xmlNewDocNodeEatName__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDocPI -extern __typeof (xmlNewDocPI) xmlNewDocPI __attribute((alias("xmlNewDocPI__internal_alias"))); -#else -#ifndef xmlNewDocPI -extern __typeof (xmlNewDocPI) xmlNewDocPI__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocPI xmlNewDocPI__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDocProp -extern __typeof (xmlNewDocProp) xmlNewDocProp __attribute((alias("xmlNewDocProp__internal_alias"))); -#else -#ifndef xmlNewDocProp -extern __typeof (xmlNewDocProp) xmlNewDocProp__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocProp xmlNewDocProp__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNewDocRawNode -extern __typeof (xmlNewDocRawNode) xmlNewDocRawNode __attribute((alias("xmlNewDocRawNode__internal_alias"))); -#else -#ifndef xmlNewDocRawNode -extern __typeof (xmlNewDocRawNode) xmlNewDocRawNode__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocRawNode xmlNewDocRawNode__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDocText -extern __typeof (xmlNewDocText) xmlNewDocText __attribute((alias("xmlNewDocText__internal_alias"))); -#else -#ifndef xmlNewDocText -extern __typeof (xmlNewDocText) xmlNewDocText__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocText xmlNewDocText__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDocTextLen -extern __typeof (xmlNewDocTextLen) xmlNewDocTextLen __attribute((alias("xmlNewDocTextLen__internal_alias"))); -#else -#ifndef xmlNewDocTextLen -extern __typeof (xmlNewDocTextLen) xmlNewDocTextLen__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDocTextLen xmlNewDocTextLen__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewDtd -extern __typeof (xmlNewDtd) xmlNewDtd __attribute((alias("xmlNewDtd__internal_alias"))); -#else -#ifndef xmlNewDtd -extern __typeof (xmlNewDtd) xmlNewDtd__internal_alias __attribute((visibility("hidden"))); -#define xmlNewDtd xmlNewDtd__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlNewElementContent -extern __typeof (xmlNewElementContent) xmlNewElementContent __attribute((alias("xmlNewElementContent__internal_alias"))); -#else -#ifndef xmlNewElementContent -extern __typeof (xmlNewElementContent) xmlNewElementContent__internal_alias __attribute((visibility("hidden"))); -#define xmlNewElementContent xmlNewElementContent__internal_alias -#endif -#endif - -#ifdef bottom_entities -#undef xmlNewEntity -extern __typeof (xmlNewEntity) xmlNewEntity __attribute((alias("xmlNewEntity__internal_alias"))); -#else -#ifndef xmlNewEntity -extern __typeof (xmlNewEntity) xmlNewEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlNewEntity xmlNewEntity__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlNewEntityInputStream -extern __typeof (xmlNewEntityInputStream) xmlNewEntityInputStream __attribute((alias("xmlNewEntityInputStream__internal_alias"))); -#else -#ifndef xmlNewEntityInputStream -extern __typeof (xmlNewEntityInputStream) xmlNewEntityInputStream__internal_alias __attribute((visibility("hidden"))); -#define xmlNewEntityInputStream xmlNewEntityInputStream__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlNewIOInputStream -extern __typeof (xmlNewIOInputStream) xmlNewIOInputStream __attribute((alias("xmlNewIOInputStream__internal_alias"))); -#else -#ifndef xmlNewIOInputStream -extern __typeof (xmlNewIOInputStream) xmlNewIOInputStream__internal_alias __attribute((visibility("hidden"))); -#define xmlNewIOInputStream xmlNewIOInputStream__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlNewInputFromFile -extern __typeof (xmlNewInputFromFile) xmlNewInputFromFile __attribute((alias("xmlNewInputFromFile__internal_alias"))); -#else -#ifndef xmlNewInputFromFile -extern __typeof (xmlNewInputFromFile) xmlNewInputFromFile__internal_alias __attribute((visibility("hidden"))); -#define xmlNewInputFromFile xmlNewInputFromFile__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlNewInputStream -extern __typeof (xmlNewInputStream) xmlNewInputStream __attribute((alias("xmlNewInputStream__internal_alias"))); -#else -#ifndef xmlNewInputStream -extern __typeof (xmlNewInputStream) xmlNewInputStream__internal_alias __attribute((visibility("hidden"))); -#define xmlNewInputStream xmlNewInputStream__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewNode -extern __typeof (xmlNewNode) xmlNewNode __attribute((alias("xmlNewNode__internal_alias"))); -#else -#ifndef xmlNewNode -extern __typeof (xmlNewNode) xmlNewNode__internal_alias __attribute((visibility("hidden"))); -#define xmlNewNode xmlNewNode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewNodeEatName -extern __typeof (xmlNewNodeEatName) xmlNewNodeEatName __attribute((alias("xmlNewNodeEatName__internal_alias"))); -#else -#ifndef xmlNewNodeEatName -extern __typeof (xmlNewNodeEatName) xmlNewNodeEatName__internal_alias __attribute((visibility("hidden"))); -#define xmlNewNodeEatName xmlNewNodeEatName__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewNs -extern __typeof (xmlNewNs) xmlNewNs __attribute((alias("xmlNewNs__internal_alias"))); -#else -#ifndef xmlNewNs -extern __typeof (xmlNewNs) xmlNewNs__internal_alias __attribute((visibility("hidden"))); -#define xmlNewNs xmlNewNs__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewNsProp -extern __typeof (xmlNewNsProp) xmlNewNsProp __attribute((alias("xmlNewNsProp__internal_alias"))); -#else -#ifndef xmlNewNsProp -extern __typeof (xmlNewNsProp) xmlNewNsProp__internal_alias __attribute((visibility("hidden"))); -#define xmlNewNsProp xmlNewNsProp__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewNsPropEatName -extern __typeof (xmlNewNsPropEatName) xmlNewNsPropEatName __attribute((alias("xmlNewNsPropEatName__internal_alias"))); -#else -#ifndef xmlNewNsPropEatName -extern __typeof (xmlNewNsPropEatName) xmlNewNsPropEatName__internal_alias __attribute((visibility("hidden"))); -#define xmlNewNsPropEatName xmlNewNsPropEatName__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewPI -extern __typeof (xmlNewPI) xmlNewPI __attribute((alias("xmlNewPI__internal_alias"))); -#else -#ifndef xmlNewPI -extern __typeof (xmlNewPI) xmlNewPI__internal_alias __attribute((visibility("hidden"))); -#define xmlNewPI xmlNewPI__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlNewParserCtxt -extern __typeof (xmlNewParserCtxt) xmlNewParserCtxt __attribute((alias("xmlNewParserCtxt__internal_alias"))); -#else -#ifndef xmlNewParserCtxt -extern __typeof (xmlNewParserCtxt) xmlNewParserCtxt__internal_alias __attribute((visibility("hidden"))); -#define xmlNewParserCtxt xmlNewParserCtxt__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNewProp -extern __typeof (xmlNewProp) xmlNewProp __attribute((alias("xmlNewProp__internal_alias"))); -#else -#ifndef xmlNewProp -extern __typeof (xmlNewProp) xmlNewProp__internal_alias __attribute((visibility("hidden"))); -#define xmlNewProp xmlNewProp__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewReference -extern __typeof (xmlNewReference) xmlNewReference __attribute((alias("xmlNewReference__internal_alias"))); -#else -#ifndef xmlNewReference -extern __typeof (xmlNewReference) xmlNewReference__internal_alias __attribute((visibility("hidden"))); -#define xmlNewReference xmlNewReference__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlNewStringInputStream -extern __typeof (xmlNewStringInputStream) xmlNewStringInputStream __attribute((alias("xmlNewStringInputStream__internal_alias"))); -#else -#ifndef xmlNewStringInputStream -extern __typeof (xmlNewStringInputStream) xmlNewStringInputStream__internal_alias __attribute((visibility("hidden"))); -#define xmlNewStringInputStream xmlNewStringInputStream__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewText -extern __typeof (xmlNewText) xmlNewText __attribute((alias("xmlNewText__internal_alias"))); -#else -#ifndef xmlNewText -extern __typeof (xmlNewText) xmlNewText__internal_alias __attribute((visibility("hidden"))); -#define xmlNewText xmlNewText__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNewTextChild -extern __typeof (xmlNewTextChild) xmlNewTextChild __attribute((alias("xmlNewTextChild__internal_alias"))); -#else -#ifndef xmlNewTextChild -extern __typeof (xmlNewTextChild) xmlNewTextChild__internal_alias __attribute((visibility("hidden"))); -#define xmlNewTextChild xmlNewTextChild__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlNewTextLen -extern __typeof (xmlNewTextLen) xmlNewTextLen __attribute((alias("xmlNewTextLen__internal_alias"))); -#else -#ifndef xmlNewTextLen -extern __typeof (xmlNewTextLen) xmlNewTextLen__internal_alias __attribute((visibility("hidden"))); -#define xmlNewTextLen xmlNewTextLen__internal_alias -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlNewTextReader -extern __typeof (xmlNewTextReader) xmlNewTextReader __attribute((alias("xmlNewTextReader__internal_alias"))); -#else -#ifndef xmlNewTextReader -extern __typeof (xmlNewTextReader) xmlNewTextReader__internal_alias __attribute((visibility("hidden"))); -#define xmlNewTextReader xmlNewTextReader__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlNewTextReaderFilename -extern __typeof (xmlNewTextReaderFilename) xmlNewTextReaderFilename __attribute((alias("xmlNewTextReaderFilename__internal_alias"))); -#else -#ifndef xmlNewTextReaderFilename -extern __typeof (xmlNewTextReaderFilename) xmlNewTextReaderFilename__internal_alias __attribute((visibility("hidden"))); -#define xmlNewTextReaderFilename xmlNewTextReaderFilename__internal_alias -#endif -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlNextChar -extern __typeof (xmlNextChar) xmlNextChar __attribute((alias("xmlNextChar__internal_alias"))); -#else -#ifndef xmlNextChar -extern __typeof (xmlNextChar) xmlNextChar__internal_alias __attribute((visibility("hidden"))); -#define xmlNextChar xmlNextChar__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNextElementSibling -extern __typeof (xmlNextElementSibling) xmlNextElementSibling __attribute((alias("xmlNextElementSibling__internal_alias"))); -#else -#ifndef xmlNextElementSibling -extern __typeof (xmlNextElementSibling) xmlNextElementSibling__internal_alias __attribute((visibility("hidden"))); -#define xmlNextElementSibling xmlNextElementSibling__internal_alias -#endif -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlNoNetExternalEntityLoader -extern __typeof (xmlNoNetExternalEntityLoader) xmlNoNetExternalEntityLoader __attribute((alias("xmlNoNetExternalEntityLoader__internal_alias"))); -#else -#ifndef xmlNoNetExternalEntityLoader -extern __typeof (xmlNoNetExternalEntityLoader) xmlNoNetExternalEntityLoader__internal_alias __attribute((visibility("hidden"))); -#define xmlNoNetExternalEntityLoader xmlNoNetExternalEntityLoader__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeAddContent -extern __typeof (xmlNodeAddContent) xmlNodeAddContent __attribute((alias("xmlNodeAddContent__internal_alias"))); -#else -#ifndef xmlNodeAddContent -extern __typeof (xmlNodeAddContent) xmlNodeAddContent__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeAddContent xmlNodeAddContent__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeAddContentLen -extern __typeof (xmlNodeAddContentLen) xmlNodeAddContentLen __attribute((alias("xmlNodeAddContentLen__internal_alias"))); -#else -#ifndef xmlNodeAddContentLen -extern __typeof (xmlNodeAddContentLen) xmlNodeAddContentLen__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeAddContentLen xmlNodeAddContentLen__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeBufGetContent -extern __typeof (xmlNodeBufGetContent) xmlNodeBufGetContent __attribute((alias("xmlNodeBufGetContent__internal_alias"))); -#else -#ifndef xmlNodeBufGetContent -extern __typeof (xmlNodeBufGetContent) xmlNodeBufGetContent__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeBufGetContent xmlNodeBufGetContent__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeGetBase -extern __typeof (xmlNodeGetBase) xmlNodeGetBase __attribute((alias("xmlNodeGetBase__internal_alias"))); -#else -#ifndef xmlNodeGetBase -extern __typeof (xmlNodeGetBase) xmlNodeGetBase__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeGetBase xmlNodeGetBase__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeGetContent -extern __typeof (xmlNodeGetContent) xmlNodeGetContent __attribute((alias("xmlNodeGetContent__internal_alias"))); -#else -#ifndef xmlNodeGetContent -extern __typeof (xmlNodeGetContent) xmlNodeGetContent__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeGetContent xmlNodeGetContent__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeGetLang -extern __typeof (xmlNodeGetLang) xmlNodeGetLang __attribute((alias("xmlNodeGetLang__internal_alias"))); -#else -#ifndef xmlNodeGetLang -extern __typeof (xmlNodeGetLang) xmlNodeGetLang__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeGetLang xmlNodeGetLang__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeGetSpacePreserve -extern __typeof (xmlNodeGetSpacePreserve) xmlNodeGetSpacePreserve __attribute((alias("xmlNodeGetSpacePreserve__internal_alias"))); -#else -#ifndef xmlNodeGetSpacePreserve -extern __typeof (xmlNodeGetSpacePreserve) xmlNodeGetSpacePreserve__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeGetSpacePreserve xmlNodeGetSpacePreserve__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeIsText -extern __typeof (xmlNodeIsText) xmlNodeIsText __attribute((alias("xmlNodeIsText__internal_alias"))); -#else -#ifndef xmlNodeIsText -extern __typeof (xmlNodeIsText) xmlNodeIsText__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeIsText xmlNodeIsText__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNodeListGetRawString -extern __typeof (xmlNodeListGetRawString) xmlNodeListGetRawString __attribute((alias("xmlNodeListGetRawString__internal_alias"))); -#else -#ifndef xmlNodeListGetRawString -extern __typeof (xmlNodeListGetRawString) xmlNodeListGetRawString__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeListGetRawString xmlNodeListGetRawString__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeListGetString -extern __typeof (xmlNodeListGetString) xmlNodeListGetString __attribute((alias("xmlNodeListGetString__internal_alias"))); -#else -#ifndef xmlNodeListGetString -extern __typeof (xmlNodeListGetString) xmlNodeListGetString__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeListGetString xmlNodeListGetString__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNodeSetBase -extern __typeof (xmlNodeSetBase) xmlNodeSetBase __attribute((alias("xmlNodeSetBase__internal_alias"))); -#else -#ifndef xmlNodeSetBase -extern __typeof (xmlNodeSetBase) xmlNodeSetBase__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeSetBase xmlNodeSetBase__internal_alias -#endif -#endif -#endif - -#ifdef bottom_tree -#undef xmlNodeSetContent -extern __typeof (xmlNodeSetContent) xmlNodeSetContent __attribute((alias("xmlNodeSetContent__internal_alias"))); -#else -#ifndef xmlNodeSetContent -extern __typeof (xmlNodeSetContent) xmlNodeSetContent__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeSetContent xmlNodeSetContent__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNodeSetContentLen -extern __typeof (xmlNodeSetContentLen) xmlNodeSetContentLen __attribute((alias("xmlNodeSetContentLen__internal_alias"))); -#else -#ifndef xmlNodeSetContentLen -extern __typeof (xmlNodeSetContentLen) xmlNodeSetContentLen__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeSetContentLen xmlNodeSetContentLen__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNodeSetLang -extern __typeof (xmlNodeSetLang) xmlNodeSetLang __attribute((alias("xmlNodeSetLang__internal_alias"))); -#else -#ifndef xmlNodeSetLang -extern __typeof (xmlNodeSetLang) xmlNodeSetLang__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeSetLang xmlNodeSetLang__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNodeSetName -extern __typeof (xmlNodeSetName) xmlNodeSetName __attribute((alias("xmlNodeSetName__internal_alias"))); -#else -#ifndef xmlNodeSetName -extern __typeof (xmlNodeSetName) xmlNodeSetName__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeSetName xmlNodeSetName__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlNodeSetSpacePreserve -extern __typeof (xmlNodeSetSpacePreserve) xmlNodeSetSpacePreserve __attribute((alias("xmlNodeSetSpacePreserve__internal_alias"))); -#else -#ifndef xmlNodeSetSpacePreserve -extern __typeof (xmlNodeSetSpacePreserve) xmlNodeSetSpacePreserve__internal_alias __attribute((visibility("hidden"))); -#define xmlNodeSetSpacePreserve xmlNodeSetSpacePreserve__internal_alias -#endif -#endif -#endif - -#ifdef bottom_uri -#undef xmlNormalizeURIPath -extern __typeof (xmlNormalizeURIPath) xmlNormalizeURIPath __attribute((alias("xmlNormalizeURIPath__internal_alias"))); -#else -#ifndef xmlNormalizeURIPath -extern __typeof (xmlNormalizeURIPath) xmlNormalizeURIPath__internal_alias __attribute((visibility("hidden"))); -#define xmlNormalizeURIPath xmlNormalizeURIPath__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlNormalizeWindowsPath -extern __typeof (xmlNormalizeWindowsPath) xmlNormalizeWindowsPath __attribute((alias("xmlNormalizeWindowsPath__internal_alias"))); -#else -#ifndef xmlNormalizeWindowsPath -extern __typeof (xmlNormalizeWindowsPath) xmlNormalizeWindowsPath__internal_alias __attribute((visibility("hidden"))); -#define xmlNormalizeWindowsPath xmlNormalizeWindowsPath__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlOutputBufferCreateFilenameDefault -extern __typeof (xmlOutputBufferCreateFilenameDefault) xmlOutputBufferCreateFilenameDefault __attribute((alias("xmlOutputBufferCreateFilenameDefault__internal_alias"))); -#else -#ifndef xmlOutputBufferCreateFilenameDefault -extern __typeof (xmlOutputBufferCreateFilenameDefault) xmlOutputBufferCreateFilenameDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlOutputBufferCreateFilenameDefault xmlOutputBufferCreateFilenameDefault__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseAttValue -extern __typeof (xmlParseAttValue) xmlParseAttValue __attribute((alias("xmlParseAttValue__internal_alias"))); -#else -#ifndef xmlParseAttValue -extern __typeof (xmlParseAttValue) xmlParseAttValue__internal_alias __attribute((visibility("hidden"))); -#define xmlParseAttValue xmlParseAttValue__internal_alias -#endif -#endif - - -#ifdef bottom_parser -#undef xmlParseAttributeListDecl -extern __typeof (xmlParseAttributeListDecl) xmlParseAttributeListDecl __attribute((alias("xmlParseAttributeListDecl__internal_alias"))); -#else -#ifndef xmlParseAttributeListDecl -extern __typeof (xmlParseAttributeListDecl) xmlParseAttributeListDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseAttributeListDecl xmlParseAttributeListDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseAttributeType -extern __typeof (xmlParseAttributeType) xmlParseAttributeType __attribute((alias("xmlParseAttributeType__internal_alias"))); -#else -#ifndef xmlParseAttributeType -extern __typeof (xmlParseAttributeType) xmlParseAttributeType__internal_alias __attribute((visibility("hidden"))); -#define xmlParseAttributeType xmlParseAttributeType__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseCDSect -extern __typeof (xmlParseCDSect) xmlParseCDSect __attribute((alias("xmlParseCDSect__internal_alias"))); -#else -#ifndef xmlParseCDSect -extern __typeof (xmlParseCDSect) xmlParseCDSect__internal_alias __attribute((visibility("hidden"))); -#define xmlParseCDSect xmlParseCDSect__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseCharData -extern __typeof (xmlParseCharData) xmlParseCharData __attribute((alias("xmlParseCharData__internal_alias"))); -#else -#ifndef xmlParseCharData -extern __typeof (xmlParseCharData) xmlParseCharData__internal_alias __attribute((visibility("hidden"))); -#define xmlParseCharData xmlParseCharData__internal_alias -#endif -#endif - -#ifdef bottom_encoding -#undef xmlParseCharEncoding -extern __typeof (xmlParseCharEncoding) xmlParseCharEncoding __attribute((alias("xmlParseCharEncoding__internal_alias"))); -#else -#ifndef xmlParseCharEncoding -extern __typeof (xmlParseCharEncoding) xmlParseCharEncoding__internal_alias __attribute((visibility("hidden"))); -#define xmlParseCharEncoding xmlParseCharEncoding__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseCharRef -extern __typeof (xmlParseCharRef) xmlParseCharRef __attribute((alias("xmlParseCharRef__internal_alias"))); -#else -#ifndef xmlParseCharRef -extern __typeof (xmlParseCharRef) xmlParseCharRef__internal_alias __attribute((visibility("hidden"))); -#define xmlParseCharRef xmlParseCharRef__internal_alias -#endif -#endif - -#if defined(LIBXML_PUSH_ENABLED) -#ifdef bottom_parser -#undef xmlParseChunk -extern __typeof (xmlParseChunk) xmlParseChunk __attribute((alias("xmlParseChunk__internal_alias"))); -#else -#ifndef xmlParseChunk -extern __typeof (xmlParseChunk) xmlParseChunk__internal_alias __attribute((visibility("hidden"))); -#define xmlParseChunk xmlParseChunk__internal_alias -#endif -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseComment -extern __typeof (xmlParseComment) xmlParseComment __attribute((alias("xmlParseComment__internal_alias"))); -#else -#ifndef xmlParseComment -extern __typeof (xmlParseComment) xmlParseComment__internal_alias __attribute((visibility("hidden"))); -#define xmlParseComment xmlParseComment__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseContent -extern __typeof (xmlParseContent) xmlParseContent __attribute((alias("xmlParseContent__internal_alias"))); -#else -#ifndef xmlParseContent -extern __typeof (xmlParseContent) xmlParseContent__internal_alias __attribute((visibility("hidden"))); -#define xmlParseContent xmlParseContent__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseCtxtExternalEntity -extern __typeof (xmlParseCtxtExternalEntity) xmlParseCtxtExternalEntity __attribute((alias("xmlParseCtxtExternalEntity__internal_alias"))); -#else -#ifndef xmlParseCtxtExternalEntity -extern __typeof (xmlParseCtxtExternalEntity) xmlParseCtxtExternalEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlParseCtxtExternalEntity xmlParseCtxtExternalEntity__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseDefaultDecl -extern __typeof (xmlParseDefaultDecl) xmlParseDefaultDecl __attribute((alias("xmlParseDefaultDecl__internal_alias"))); -#else -#ifndef xmlParseDefaultDecl -extern __typeof (xmlParseDefaultDecl) xmlParseDefaultDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseDefaultDecl xmlParseDefaultDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseDocTypeDecl -extern __typeof (xmlParseDocTypeDecl) xmlParseDocTypeDecl __attribute((alias("xmlParseDocTypeDecl__internal_alias"))); -#else -#ifndef xmlParseDocTypeDecl -extern __typeof (xmlParseDocTypeDecl) xmlParseDocTypeDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseDocTypeDecl xmlParseDocTypeDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseDocument -extern __typeof (xmlParseDocument) xmlParseDocument __attribute((alias("xmlParseDocument__internal_alias"))); -#else -#ifndef xmlParseDocument -extern __typeof (xmlParseDocument) xmlParseDocument__internal_alias __attribute((visibility("hidden"))); -#define xmlParseDocument xmlParseDocument__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseElement -extern __typeof (xmlParseElement) xmlParseElement __attribute((alias("xmlParseElement__internal_alias"))); -#else -#ifndef xmlParseElement -extern __typeof (xmlParseElement) xmlParseElement__internal_alias __attribute((visibility("hidden"))); -#define xmlParseElement xmlParseElement__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseElementChildrenContentDecl -extern __typeof (xmlParseElementChildrenContentDecl) xmlParseElementChildrenContentDecl __attribute((alias("xmlParseElementChildrenContentDecl__internal_alias"))); -#else -#ifndef xmlParseElementChildrenContentDecl -extern __typeof (xmlParseElementChildrenContentDecl) xmlParseElementChildrenContentDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseElementChildrenContentDecl xmlParseElementChildrenContentDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseElementContentDecl -extern __typeof (xmlParseElementContentDecl) xmlParseElementContentDecl __attribute((alias("xmlParseElementContentDecl__internal_alias"))); -#else -#ifndef xmlParseElementContentDecl -extern __typeof (xmlParseElementContentDecl) xmlParseElementContentDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseElementContentDecl xmlParseElementContentDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseElementDecl -extern __typeof (xmlParseElementDecl) xmlParseElementDecl __attribute((alias("xmlParseElementDecl__internal_alias"))); -#else -#ifndef xmlParseElementDecl -extern __typeof (xmlParseElementDecl) xmlParseElementDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseElementDecl xmlParseElementDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseElementMixedContentDecl -extern __typeof (xmlParseElementMixedContentDecl) xmlParseElementMixedContentDecl __attribute((alias("xmlParseElementMixedContentDecl__internal_alias"))); -#else -#ifndef xmlParseElementMixedContentDecl -extern __typeof (xmlParseElementMixedContentDecl) xmlParseElementMixedContentDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseElementMixedContentDecl xmlParseElementMixedContentDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseEncName -extern __typeof (xmlParseEncName) xmlParseEncName __attribute((alias("xmlParseEncName__internal_alias"))); -#else -#ifndef xmlParseEncName -extern __typeof (xmlParseEncName) xmlParseEncName__internal_alias __attribute((visibility("hidden"))); -#define xmlParseEncName xmlParseEncName__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseEncodingDecl -extern __typeof (xmlParseEncodingDecl) xmlParseEncodingDecl __attribute((alias("xmlParseEncodingDecl__internal_alias"))); -#else -#ifndef xmlParseEncodingDecl -extern __typeof (xmlParseEncodingDecl) xmlParseEncodingDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseEncodingDecl xmlParseEncodingDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseEntityDecl -extern __typeof (xmlParseEntityDecl) xmlParseEntityDecl __attribute((alias("xmlParseEntityDecl__internal_alias"))); -#else -#ifndef xmlParseEntityDecl -extern __typeof (xmlParseEntityDecl) xmlParseEntityDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseEntityDecl xmlParseEntityDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseEntityRef -extern __typeof (xmlParseEntityRef) xmlParseEntityRef __attribute((alias("xmlParseEntityRef__internal_alias"))); -#else -#ifndef xmlParseEntityRef -extern __typeof (xmlParseEntityRef) xmlParseEntityRef__internal_alias __attribute((visibility("hidden"))); -#define xmlParseEntityRef xmlParseEntityRef__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseEntityValue -extern __typeof (xmlParseEntityValue) xmlParseEntityValue __attribute((alias("xmlParseEntityValue__internal_alias"))); -#else -#ifndef xmlParseEntityValue -extern __typeof (xmlParseEntityValue) xmlParseEntityValue__internal_alias __attribute((visibility("hidden"))); -#define xmlParseEntityValue xmlParseEntityValue__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseEnumeratedType -extern __typeof (xmlParseEnumeratedType) xmlParseEnumeratedType __attribute((alias("xmlParseEnumeratedType__internal_alias"))); -#else -#ifndef xmlParseEnumeratedType -extern __typeof (xmlParseEnumeratedType) xmlParseEnumeratedType__internal_alias __attribute((visibility("hidden"))); -#define xmlParseEnumeratedType xmlParseEnumeratedType__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseEnumerationType -extern __typeof (xmlParseEnumerationType) xmlParseEnumerationType __attribute((alias("xmlParseEnumerationType__internal_alias"))); -#else -#ifndef xmlParseEnumerationType -extern __typeof (xmlParseEnumerationType) xmlParseEnumerationType__internal_alias __attribute((visibility("hidden"))); -#define xmlParseEnumerationType xmlParseEnumerationType__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseExtParsedEnt -extern __typeof (xmlParseExtParsedEnt) xmlParseExtParsedEnt __attribute((alias("xmlParseExtParsedEnt__internal_alias"))); -#else -#ifndef xmlParseExtParsedEnt -extern __typeof (xmlParseExtParsedEnt) xmlParseExtParsedEnt__internal_alias __attribute((visibility("hidden"))); -#define xmlParseExtParsedEnt xmlParseExtParsedEnt__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseExternalID -extern __typeof (xmlParseExternalID) xmlParseExternalID __attribute((alias("xmlParseExternalID__internal_alias"))); -#else -#ifndef xmlParseExternalID -extern __typeof (xmlParseExternalID) xmlParseExternalID__internal_alias __attribute((visibility("hidden"))); -#define xmlParseExternalID xmlParseExternalID__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseExternalSubset -extern __typeof (xmlParseExternalSubset) xmlParseExternalSubset __attribute((alias("xmlParseExternalSubset__internal_alias"))); -#else -#ifndef xmlParseExternalSubset -extern __typeof (xmlParseExternalSubset) xmlParseExternalSubset__internal_alias __attribute((visibility("hidden"))); -#define xmlParseExternalSubset xmlParseExternalSubset__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseInNodeContext -extern __typeof (xmlParseInNodeContext) xmlParseInNodeContext __attribute((alias("xmlParseInNodeContext__internal_alias"))); -#else -#ifndef xmlParseInNodeContext -extern __typeof (xmlParseInNodeContext) xmlParseInNodeContext__internal_alias __attribute((visibility("hidden"))); -#define xmlParseInNodeContext xmlParseInNodeContext__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseMarkupDecl -extern __typeof (xmlParseMarkupDecl) xmlParseMarkupDecl __attribute((alias("xmlParseMarkupDecl__internal_alias"))); -#else -#ifndef xmlParseMarkupDecl -extern __typeof (xmlParseMarkupDecl) xmlParseMarkupDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseMarkupDecl xmlParseMarkupDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseMisc -extern __typeof (xmlParseMisc) xmlParseMisc __attribute((alias("xmlParseMisc__internal_alias"))); -#else -#ifndef xmlParseMisc -extern __typeof (xmlParseMisc) xmlParseMisc__internal_alias __attribute((visibility("hidden"))); -#define xmlParseMisc xmlParseMisc__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseName -extern __typeof (xmlParseName) xmlParseName __attribute((alias("xmlParseName__internal_alias"))); -#else -#ifndef xmlParseName -extern __typeof (xmlParseName) xmlParseName__internal_alias __attribute((visibility("hidden"))); -#define xmlParseName xmlParseName__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseNmtoken -extern __typeof (xmlParseNmtoken) xmlParseNmtoken __attribute((alias("xmlParseNmtoken__internal_alias"))); -#else -#ifndef xmlParseNmtoken -extern __typeof (xmlParseNmtoken) xmlParseNmtoken__internal_alias __attribute((visibility("hidden"))); -#define xmlParseNmtoken xmlParseNmtoken__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseNotationDecl -extern __typeof (xmlParseNotationDecl) xmlParseNotationDecl __attribute((alias("xmlParseNotationDecl__internal_alias"))); -#else -#ifndef xmlParseNotationDecl -extern __typeof (xmlParseNotationDecl) xmlParseNotationDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseNotationDecl xmlParseNotationDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseNotationType -extern __typeof (xmlParseNotationType) xmlParseNotationType __attribute((alias("xmlParseNotationType__internal_alias"))); -#else -#ifndef xmlParseNotationType -extern __typeof (xmlParseNotationType) xmlParseNotationType__internal_alias __attribute((visibility("hidden"))); -#define xmlParseNotationType xmlParseNotationType__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParsePEReference -extern __typeof (xmlParsePEReference) xmlParsePEReference __attribute((alias("xmlParsePEReference__internal_alias"))); -#else -#ifndef xmlParsePEReference -extern __typeof (xmlParsePEReference) xmlParsePEReference__internal_alias __attribute((visibility("hidden"))); -#define xmlParsePEReference xmlParsePEReference__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParsePI -extern __typeof (xmlParsePI) xmlParsePI __attribute((alias("xmlParsePI__internal_alias"))); -#else -#ifndef xmlParsePI -extern __typeof (xmlParsePI) xmlParsePI__internal_alias __attribute((visibility("hidden"))); -#define xmlParsePI xmlParsePI__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParsePITarget -extern __typeof (xmlParsePITarget) xmlParsePITarget __attribute((alias("xmlParsePITarget__internal_alias"))); -#else -#ifndef xmlParsePITarget -extern __typeof (xmlParsePITarget) xmlParsePITarget__internal_alias __attribute((visibility("hidden"))); -#define xmlParsePITarget xmlParsePITarget__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParsePubidLiteral -extern __typeof (xmlParsePubidLiteral) xmlParsePubidLiteral __attribute((alias("xmlParsePubidLiteral__internal_alias"))); -#else -#ifndef xmlParsePubidLiteral -extern __typeof (xmlParsePubidLiteral) xmlParsePubidLiteral__internal_alias __attribute((visibility("hidden"))); -#define xmlParsePubidLiteral xmlParsePubidLiteral__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseReference -extern __typeof (xmlParseReference) xmlParseReference __attribute((alias("xmlParseReference__internal_alias"))); -#else -#ifndef xmlParseReference -extern __typeof (xmlParseReference) xmlParseReference__internal_alias __attribute((visibility("hidden"))); -#define xmlParseReference xmlParseReference__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseSDDecl -extern __typeof (xmlParseSDDecl) xmlParseSDDecl __attribute((alias("xmlParseSDDecl__internal_alias"))); -#else -#ifndef xmlParseSDDecl -extern __typeof (xmlParseSDDecl) xmlParseSDDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseSDDecl xmlParseSDDecl__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseSystemLiteral -extern __typeof (xmlParseSystemLiteral) xmlParseSystemLiteral __attribute((alias("xmlParseSystemLiteral__internal_alias"))); -#else -#ifndef xmlParseSystemLiteral -extern __typeof (xmlParseSystemLiteral) xmlParseSystemLiteral__internal_alias __attribute((visibility("hidden"))); -#define xmlParseSystemLiteral xmlParseSystemLiteral__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseTextDecl -extern __typeof (xmlParseTextDecl) xmlParseTextDecl __attribute((alias("xmlParseTextDecl__internal_alias"))); -#else -#ifndef xmlParseTextDecl -extern __typeof (xmlParseTextDecl) xmlParseTextDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseTextDecl xmlParseTextDecl__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlParseURI -extern __typeof (xmlParseURI) xmlParseURI __attribute((alias("xmlParseURI__internal_alias"))); -#else -#ifndef xmlParseURI -extern __typeof (xmlParseURI) xmlParseURI__internal_alias __attribute((visibility("hidden"))); -#define xmlParseURI xmlParseURI__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlParseURIRaw -extern __typeof (xmlParseURIRaw) xmlParseURIRaw __attribute((alias("xmlParseURIRaw__internal_alias"))); -#else -#ifndef xmlParseURIRaw -extern __typeof (xmlParseURIRaw) xmlParseURIRaw__internal_alias __attribute((visibility("hidden"))); -#define xmlParseURIRaw xmlParseURIRaw__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlParseURIReference -extern __typeof (xmlParseURIReference) xmlParseURIReference __attribute((alias("xmlParseURIReference__internal_alias"))); -#else -#ifndef xmlParseURIReference -extern __typeof (xmlParseURIReference) xmlParseURIReference__internal_alias __attribute((visibility("hidden"))); -#define xmlParseURIReference xmlParseURIReference__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseVersionInfo -extern __typeof (xmlParseVersionInfo) xmlParseVersionInfo __attribute((alias("xmlParseVersionInfo__internal_alias"))); -#else -#ifndef xmlParseVersionInfo -extern __typeof (xmlParseVersionInfo) xmlParseVersionInfo__internal_alias __attribute((visibility("hidden"))); -#define xmlParseVersionInfo xmlParseVersionInfo__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseVersionNum -extern __typeof (xmlParseVersionNum) xmlParseVersionNum __attribute((alias("xmlParseVersionNum__internal_alias"))); -#else -#ifndef xmlParseVersionNum -extern __typeof (xmlParseVersionNum) xmlParseVersionNum__internal_alias __attribute((visibility("hidden"))); -#define xmlParseVersionNum xmlParseVersionNum__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParseXMLDecl -extern __typeof (xmlParseXMLDecl) xmlParseXMLDecl __attribute((alias("xmlParseXMLDecl__internal_alias"))); -#else -#ifndef xmlParseXMLDecl -extern __typeof (xmlParseXMLDecl) xmlParseXMLDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlParseXMLDecl xmlParseXMLDecl__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlParserAddNodeInfo -extern __typeof (xmlParserAddNodeInfo) xmlParserAddNodeInfo __attribute((alias("xmlParserAddNodeInfo__internal_alias"))); -#else -#ifndef xmlParserAddNodeInfo -extern __typeof (xmlParserAddNodeInfo) xmlParserAddNodeInfo__internal_alias __attribute((visibility("hidden"))); -#define xmlParserAddNodeInfo xmlParserAddNodeInfo__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlParserError -extern __typeof (xmlParserError) xmlParserError __attribute((alias("xmlParserError__internal_alias"))); -#else -#ifndef xmlParserError -extern __typeof (xmlParserError) xmlParserError__internal_alias __attribute((visibility("hidden"))); -#define xmlParserError xmlParserError__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlParserFindNodeInfo -extern __typeof (xmlParserFindNodeInfo) xmlParserFindNodeInfo __attribute((alias("xmlParserFindNodeInfo__internal_alias"))); -#else -#ifndef xmlParserFindNodeInfo -extern __typeof (xmlParserFindNodeInfo) xmlParserFindNodeInfo__internal_alias __attribute((visibility("hidden"))); -#define xmlParserFindNodeInfo xmlParserFindNodeInfo__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlParserFindNodeInfoIndex -extern __typeof (xmlParserFindNodeInfoIndex) xmlParserFindNodeInfoIndex __attribute((alias("xmlParserFindNodeInfoIndex__internal_alias"))); -#else -#ifndef xmlParserFindNodeInfoIndex -extern __typeof (xmlParserFindNodeInfoIndex) xmlParserFindNodeInfoIndex__internal_alias __attribute((visibility("hidden"))); -#define xmlParserFindNodeInfoIndex xmlParserFindNodeInfoIndex__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserGetDirectory -extern __typeof (xmlParserGetDirectory) xmlParserGetDirectory __attribute((alias("xmlParserGetDirectory__internal_alias"))); -#else -#ifndef xmlParserGetDirectory -extern __typeof (xmlParserGetDirectory) xmlParserGetDirectory__internal_alias __attribute((visibility("hidden"))); -#define xmlParserGetDirectory xmlParserGetDirectory__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlParserHandlePEReference -extern __typeof (xmlParserHandlePEReference) xmlParserHandlePEReference __attribute((alias("xmlParserHandlePEReference__internal_alias"))); -#else -#ifndef xmlParserHandlePEReference -extern __typeof (xmlParserHandlePEReference) xmlParserHandlePEReference__internal_alias __attribute((visibility("hidden"))); -#define xmlParserHandlePEReference xmlParserHandlePEReference__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferCreateFd -extern __typeof (xmlParserInputBufferCreateFd) xmlParserInputBufferCreateFd __attribute((alias("xmlParserInputBufferCreateFd__internal_alias"))); -#else -#ifndef xmlParserInputBufferCreateFd -extern __typeof (xmlParserInputBufferCreateFd) xmlParserInputBufferCreateFd__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferCreateFd xmlParserInputBufferCreateFd__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferCreateFile -extern __typeof (xmlParserInputBufferCreateFile) xmlParserInputBufferCreateFile __attribute((alias("xmlParserInputBufferCreateFile__internal_alias"))); -#else -#ifndef xmlParserInputBufferCreateFile -extern __typeof (xmlParserInputBufferCreateFile) xmlParserInputBufferCreateFile__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferCreateFile xmlParserInputBufferCreateFile__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferCreateFilename -extern __typeof (xmlParserInputBufferCreateFilename) xmlParserInputBufferCreateFilename __attribute((alias("xmlParserInputBufferCreateFilename__internal_alias"))); -#else -#ifndef xmlParserInputBufferCreateFilename -extern __typeof (xmlParserInputBufferCreateFilename) xmlParserInputBufferCreateFilename__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferCreateFilename xmlParserInputBufferCreateFilename__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferCreateFilenameDefault -extern __typeof (xmlParserInputBufferCreateFilenameDefault) xmlParserInputBufferCreateFilenameDefault __attribute((alias("xmlParserInputBufferCreateFilenameDefault__internal_alias"))); -#else -#ifndef xmlParserInputBufferCreateFilenameDefault -extern __typeof (xmlParserInputBufferCreateFilenameDefault) xmlParserInputBufferCreateFilenameDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferCreateFilenameDefault xmlParserInputBufferCreateFilenameDefault__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferCreateIO -extern __typeof (xmlParserInputBufferCreateIO) xmlParserInputBufferCreateIO __attribute((alias("xmlParserInputBufferCreateIO__internal_alias"))); -#else -#ifndef xmlParserInputBufferCreateIO -extern __typeof (xmlParserInputBufferCreateIO) xmlParserInputBufferCreateIO__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferCreateIO xmlParserInputBufferCreateIO__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferCreateMem -extern __typeof (xmlParserInputBufferCreateMem) xmlParserInputBufferCreateMem __attribute((alias("xmlParserInputBufferCreateMem__internal_alias"))); -#else -#ifndef xmlParserInputBufferCreateMem -extern __typeof (xmlParserInputBufferCreateMem) xmlParserInputBufferCreateMem__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferCreateMem xmlParserInputBufferCreateMem__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferCreateStatic -extern __typeof (xmlParserInputBufferCreateStatic) xmlParserInputBufferCreateStatic __attribute((alias("xmlParserInputBufferCreateStatic__internal_alias"))); -#else -#ifndef xmlParserInputBufferCreateStatic -extern __typeof (xmlParserInputBufferCreateStatic) xmlParserInputBufferCreateStatic__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferCreateStatic xmlParserInputBufferCreateStatic__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferGrow -extern __typeof (xmlParserInputBufferGrow) xmlParserInputBufferGrow __attribute((alias("xmlParserInputBufferGrow__internal_alias"))); -#else -#ifndef xmlParserInputBufferGrow -extern __typeof (xmlParserInputBufferGrow) xmlParserInputBufferGrow__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferGrow xmlParserInputBufferGrow__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferPush -extern __typeof (xmlParserInputBufferPush) xmlParserInputBufferPush __attribute((alias("xmlParserInputBufferPush__internal_alias"))); -#else -#ifndef xmlParserInputBufferPush -extern __typeof (xmlParserInputBufferPush) xmlParserInputBufferPush__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferPush xmlParserInputBufferPush__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlParserInputBufferRead -extern __typeof (xmlParserInputBufferRead) xmlParserInputBufferRead __attribute((alias("xmlParserInputBufferRead__internal_alias"))); -#else -#ifndef xmlParserInputBufferRead -extern __typeof (xmlParserInputBufferRead) xmlParserInputBufferRead__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputBufferRead xmlParserInputBufferRead__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlParserInputGrow -extern __typeof (xmlParserInputGrow) xmlParserInputGrow __attribute((alias("xmlParserInputGrow__internal_alias"))); -#else -#ifndef xmlParserInputGrow -extern __typeof (xmlParserInputGrow) xmlParserInputGrow__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputGrow xmlParserInputGrow__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlParserInputRead -extern __typeof (xmlParserInputRead) xmlParserInputRead __attribute((alias("xmlParserInputRead__internal_alias"))); -#else -#ifndef xmlParserInputRead -extern __typeof (xmlParserInputRead) xmlParserInputRead__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputRead xmlParserInputRead__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlParserInputShrink -extern __typeof (xmlParserInputShrink) xmlParserInputShrink __attribute((alias("xmlParserInputShrink__internal_alias"))); -#else -#ifndef xmlParserInputShrink -extern __typeof (xmlParserInputShrink) xmlParserInputShrink__internal_alias __attribute((visibility("hidden"))); -#define xmlParserInputShrink xmlParserInputShrink__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlParserPrintFileContext -extern __typeof (xmlParserPrintFileContext) xmlParserPrintFileContext __attribute((alias("xmlParserPrintFileContext__internal_alias"))); -#else -#ifndef xmlParserPrintFileContext -extern __typeof (xmlParserPrintFileContext) xmlParserPrintFileContext__internal_alias __attribute((visibility("hidden"))); -#define xmlParserPrintFileContext xmlParserPrintFileContext__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlParserPrintFileInfo -extern __typeof (xmlParserPrintFileInfo) xmlParserPrintFileInfo __attribute((alias("xmlParserPrintFileInfo__internal_alias"))); -#else -#ifndef xmlParserPrintFileInfo -extern __typeof (xmlParserPrintFileInfo) xmlParserPrintFileInfo__internal_alias __attribute((visibility("hidden"))); -#define xmlParserPrintFileInfo xmlParserPrintFileInfo__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlParserValidityError -extern __typeof (xmlParserValidityError) xmlParserValidityError __attribute((alias("xmlParserValidityError__internal_alias"))); -#else -#ifndef xmlParserValidityError -extern __typeof (xmlParserValidityError) xmlParserValidityError__internal_alias __attribute((visibility("hidden"))); -#define xmlParserValidityError xmlParserValidityError__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlParserValidityWarning -extern __typeof (xmlParserValidityWarning) xmlParserValidityWarning __attribute((alias("xmlParserValidityWarning__internal_alias"))); -#else -#ifndef xmlParserValidityWarning -extern __typeof (xmlParserValidityWarning) xmlParserValidityWarning__internal_alias __attribute((visibility("hidden"))); -#define xmlParserValidityWarning xmlParserValidityWarning__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlParserWarning -extern __typeof (xmlParserWarning) xmlParserWarning __attribute((alias("xmlParserWarning__internal_alias"))); -#else -#ifndef xmlParserWarning -extern __typeof (xmlParserWarning) xmlParserWarning__internal_alias __attribute((visibility("hidden"))); -#define xmlParserWarning xmlParserWarning__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlPathToURI -extern __typeof (xmlPathToURI) xmlPathToURI __attribute((alias("xmlPathToURI__internal_alias"))); -#else -#ifndef xmlPathToURI -extern __typeof (xmlPathToURI) xmlPathToURI__internal_alias __attribute((visibility("hidden"))); -#define xmlPathToURI xmlPathToURI__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlPedanticParserDefault -extern __typeof (xmlPedanticParserDefault) xmlPedanticParserDefault __attribute((alias("xmlPedanticParserDefault__internal_alias"))); -#else -#ifndef xmlPedanticParserDefault -extern __typeof (xmlPedanticParserDefault) xmlPedanticParserDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlPedanticParserDefault xmlPedanticParserDefault__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlPopInput -extern __typeof (xmlPopInput) xmlPopInput __attribute((alias("xmlPopInput__internal_alias"))); -#else -#ifndef xmlPopInput -extern __typeof (xmlPopInput) xmlPopInput__internal_alias __attribute((visibility("hidden"))); -#define xmlPopInput xmlPopInput__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlPopInputCallbacks -extern __typeof (xmlPopInputCallbacks) xmlPopInputCallbacks __attribute((alias("xmlPopInputCallbacks__internal_alias"))); -#else -#ifndef xmlPopInputCallbacks -extern __typeof (xmlPopInputCallbacks) xmlPopInputCallbacks__internal_alias __attribute((visibility("hidden"))); -#define xmlPopInputCallbacks xmlPopInputCallbacks__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlPreviousElementSibling -extern __typeof (xmlPreviousElementSibling) xmlPreviousElementSibling __attribute((alias("xmlPreviousElementSibling__internal_alias"))); -#else -#ifndef xmlPreviousElementSibling -extern __typeof (xmlPreviousElementSibling) xmlPreviousElementSibling__internal_alias __attribute((visibility("hidden"))); -#define xmlPreviousElementSibling xmlPreviousElementSibling__internal_alias -#endif -#endif -#endif - -#ifdef bottom_uri -#undef xmlPrintURI -extern __typeof (xmlPrintURI) xmlPrintURI __attribute((alias("xmlPrintURI__internal_alias"))); -#else -#ifndef xmlPrintURI -extern __typeof (xmlPrintURI) xmlPrintURI__internal_alias __attribute((visibility("hidden"))); -#define xmlPrintURI xmlPrintURI__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlPushInput -extern __typeof (xmlPushInput) xmlPushInput __attribute((alias("xmlPushInput__internal_alias"))); -#else -#ifndef xmlPushInput -extern __typeof (xmlPushInput) xmlPushInput__internal_alias __attribute((visibility("hidden"))); -#define xmlPushInput xmlPushInput__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlReadDoc -extern __typeof (xmlReadDoc) xmlReadDoc __attribute((alias("xmlReadDoc__internal_alias"))); -#else -#ifndef xmlReadDoc -extern __typeof (xmlReadDoc) xmlReadDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlReadDoc xmlReadDoc__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlReadFd -extern __typeof (xmlReadFd) xmlReadFd __attribute((alias("xmlReadFd__internal_alias"))); -#else -#ifndef xmlReadFd -extern __typeof (xmlReadFd) xmlReadFd__internal_alias __attribute((visibility("hidden"))); -#define xmlReadFd xmlReadFd__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlReadFile -extern __typeof (xmlReadFile) xmlReadFile __attribute((alias("xmlReadFile__internal_alias"))); -#else -#ifndef xmlReadFile -extern __typeof (xmlReadFile) xmlReadFile__internal_alias __attribute((visibility("hidden"))); -#define xmlReadFile xmlReadFile__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlReadIO -extern __typeof (xmlReadIO) xmlReadIO __attribute((alias("xmlReadIO__internal_alias"))); -#else -#ifndef xmlReadIO -extern __typeof (xmlReadIO) xmlReadIO__internal_alias __attribute((visibility("hidden"))); -#define xmlReadIO xmlReadIO__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlReadMemory -extern __typeof (xmlReadMemory) xmlReadMemory __attribute((alias("xmlReadMemory__internal_alias"))); -#else -#ifndef xmlReadMemory -extern __typeof (xmlReadMemory) xmlReadMemory__internal_alias __attribute((visibility("hidden"))); -#define xmlReadMemory xmlReadMemory__internal_alias -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderForDoc -extern __typeof (xmlReaderForDoc) xmlReaderForDoc __attribute((alias("xmlReaderForDoc__internal_alias"))); -#else -#ifndef xmlReaderForDoc -extern __typeof (xmlReaderForDoc) xmlReaderForDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderForDoc xmlReaderForDoc__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderForFd -extern __typeof (xmlReaderForFd) xmlReaderForFd __attribute((alias("xmlReaderForFd__internal_alias"))); -#else -#ifndef xmlReaderForFd -extern __typeof (xmlReaderForFd) xmlReaderForFd__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderForFd xmlReaderForFd__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderForFile -extern __typeof (xmlReaderForFile) xmlReaderForFile __attribute((alias("xmlReaderForFile__internal_alias"))); -#else -#ifndef xmlReaderForFile -extern __typeof (xmlReaderForFile) xmlReaderForFile__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderForFile xmlReaderForFile__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderForIO -extern __typeof (xmlReaderForIO) xmlReaderForIO __attribute((alias("xmlReaderForIO__internal_alias"))); -#else -#ifndef xmlReaderForIO -extern __typeof (xmlReaderForIO) xmlReaderForIO__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderForIO xmlReaderForIO__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderForMemory -extern __typeof (xmlReaderForMemory) xmlReaderForMemory __attribute((alias("xmlReaderForMemory__internal_alias"))); -#else -#ifndef xmlReaderForMemory -extern __typeof (xmlReaderForMemory) xmlReaderForMemory__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderForMemory xmlReaderForMemory__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderNewDoc -extern __typeof (xmlReaderNewDoc) xmlReaderNewDoc __attribute((alias("xmlReaderNewDoc__internal_alias"))); -#else -#ifndef xmlReaderNewDoc -extern __typeof (xmlReaderNewDoc) xmlReaderNewDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderNewDoc xmlReaderNewDoc__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderNewFd -extern __typeof (xmlReaderNewFd) xmlReaderNewFd __attribute((alias("xmlReaderNewFd__internal_alias"))); -#else -#ifndef xmlReaderNewFd -extern __typeof (xmlReaderNewFd) xmlReaderNewFd__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderNewFd xmlReaderNewFd__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderNewFile -extern __typeof (xmlReaderNewFile) xmlReaderNewFile __attribute((alias("xmlReaderNewFile__internal_alias"))); -#else -#ifndef xmlReaderNewFile -extern __typeof (xmlReaderNewFile) xmlReaderNewFile__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderNewFile xmlReaderNewFile__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderNewIO -extern __typeof (xmlReaderNewIO) xmlReaderNewIO __attribute((alias("xmlReaderNewIO__internal_alias"))); -#else -#ifndef xmlReaderNewIO -extern __typeof (xmlReaderNewIO) xmlReaderNewIO__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderNewIO xmlReaderNewIO__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderNewMemory -extern __typeof (xmlReaderNewMemory) xmlReaderNewMemory __attribute((alias("xmlReaderNewMemory__internal_alias"))); -#else -#ifndef xmlReaderNewMemory -extern __typeof (xmlReaderNewMemory) xmlReaderNewMemory__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderNewMemory xmlReaderNewMemory__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderNewWalker -extern __typeof (xmlReaderNewWalker) xmlReaderNewWalker __attribute((alias("xmlReaderNewWalker__internal_alias"))); -#else -#ifndef xmlReaderNewWalker -extern __typeof (xmlReaderNewWalker) xmlReaderNewWalker__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderNewWalker xmlReaderNewWalker__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlReaderWalker -extern __typeof (xmlReaderWalker) xmlReaderWalker __attribute((alias("xmlReaderWalker__internal_alias"))); -#else -#ifndef xmlReaderWalker -extern __typeof (xmlReaderWalker) xmlReaderWalker__internal_alias __attribute((visibility("hidden"))); -#define xmlReaderWalker xmlReaderWalker__internal_alias -#endif -#endif -#endif - -#ifdef bottom_xmlmemory -#undef xmlReallocLoc -extern __typeof (xmlReallocLoc) xmlReallocLoc __attribute((alias("xmlReallocLoc__internal_alias"))); -#else -#ifndef xmlReallocLoc -extern __typeof (xmlReallocLoc) xmlReallocLoc__internal_alias __attribute((visibility("hidden"))); -#define xmlReallocLoc xmlReallocLoc__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlReconciliateNs -extern __typeof (xmlReconciliateNs) xmlReconciliateNs __attribute((alias("xmlReconciliateNs__internal_alias"))); -#else -#ifndef xmlReconciliateNs -extern __typeof (xmlReconciliateNs) xmlReconciliateNs__internal_alias __attribute((visibility("hidden"))); -#define xmlReconciliateNs xmlReconciliateNs__internal_alias -#endif -#endif -#endif - -#ifdef bottom_encoding -#undef xmlRegisterCharEncodingHandler -extern __typeof (xmlRegisterCharEncodingHandler) xmlRegisterCharEncodingHandler __attribute((alias("xmlRegisterCharEncodingHandler__internal_alias"))); -#else -#ifndef xmlRegisterCharEncodingHandler -extern __typeof (xmlRegisterCharEncodingHandler) xmlRegisterCharEncodingHandler__internal_alias __attribute((visibility("hidden"))); -#define xmlRegisterCharEncodingHandler xmlRegisterCharEncodingHandler__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlRegisterDefaultInputCallbacks -extern __typeof (xmlRegisterDefaultInputCallbacks) xmlRegisterDefaultInputCallbacks __attribute((alias("xmlRegisterDefaultInputCallbacks__internal_alias"))); -#else -#ifndef xmlRegisterDefaultInputCallbacks -extern __typeof (xmlRegisterDefaultInputCallbacks) xmlRegisterDefaultInputCallbacks__internal_alias __attribute((visibility("hidden"))); -#define xmlRegisterDefaultInputCallbacks xmlRegisterDefaultInputCallbacks__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlRegisterInputCallbacks -extern __typeof (xmlRegisterInputCallbacks) xmlRegisterInputCallbacks __attribute((alias("xmlRegisterInputCallbacks__internal_alias"))); -#else -#ifndef xmlRegisterInputCallbacks -extern __typeof (xmlRegisterInputCallbacks) xmlRegisterInputCallbacks__internal_alias __attribute((visibility("hidden"))); -#define xmlRegisterInputCallbacks xmlRegisterInputCallbacks__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlRegisterNodeDefault -extern __typeof (xmlRegisterNodeDefault) xmlRegisterNodeDefault __attribute((alias("xmlRegisterNodeDefault__internal_alias"))); -#else -#ifndef xmlRegisterNodeDefault -extern __typeof (xmlRegisterNodeDefault) xmlRegisterNodeDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlRegisterNodeDefault xmlRegisterNodeDefault__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlRemoveID -extern __typeof (xmlRemoveID) xmlRemoveID __attribute((alias("xmlRemoveID__internal_alias"))); -#else -#ifndef xmlRemoveID -extern __typeof (xmlRemoveID) xmlRemoveID__internal_alias __attribute((visibility("hidden"))); -#define xmlRemoveID xmlRemoveID__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlRemoveProp -extern __typeof (xmlRemoveProp) xmlRemoveProp __attribute((alias("xmlRemoveProp__internal_alias"))); -#else -#ifndef xmlRemoveProp -extern __typeof (xmlRemoveProp) xmlRemoveProp__internal_alias __attribute((visibility("hidden"))); -#define xmlRemoveProp xmlRemoveProp__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlRemoveRef -extern __typeof (xmlRemoveRef) xmlRemoveRef __attribute((alias("xmlRemoveRef__internal_alias"))); -#else -#ifndef xmlRemoveRef -extern __typeof (xmlRemoveRef) xmlRemoveRef__internal_alias __attribute((visibility("hidden"))); -#define xmlRemoveRef xmlRemoveRef__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlReplaceNode -extern __typeof (xmlReplaceNode) xmlReplaceNode __attribute((alias("xmlReplaceNode__internal_alias"))); -#else -#ifndef xmlReplaceNode -extern __typeof (xmlReplaceNode) xmlReplaceNode__internal_alias __attribute((visibility("hidden"))); -#define xmlReplaceNode xmlReplaceNode__internal_alias -#endif -#endif -#endif - -#ifdef bottom_error -#undef xmlResetError -extern __typeof (xmlResetError) xmlResetError __attribute((alias("xmlResetError__internal_alias"))); -#else -#ifndef xmlResetError -extern __typeof (xmlResetError) xmlResetError__internal_alias __attribute((visibility("hidden"))); -#define xmlResetError xmlResetError__internal_alias -#endif -#endif - -#ifdef bottom_error -#undef xmlResetLastError -extern __typeof (xmlResetLastError) xmlResetLastError __attribute((alias("xmlResetLastError__internal_alias"))); -#else -#ifndef xmlResetLastError -extern __typeof (xmlResetLastError) xmlResetLastError__internal_alias __attribute((visibility("hidden"))); -#define xmlResetLastError xmlResetLastError__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2AttributeDecl -extern __typeof (xmlSAX2AttributeDecl) xmlSAX2AttributeDecl __attribute((alias("xmlSAX2AttributeDecl__internal_alias"))); -#else -#ifndef xmlSAX2AttributeDecl -extern __typeof (xmlSAX2AttributeDecl) xmlSAX2AttributeDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2AttributeDecl xmlSAX2AttributeDecl__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2CDataBlock -extern __typeof (xmlSAX2CDataBlock) xmlSAX2CDataBlock __attribute((alias("xmlSAX2CDataBlock__internal_alias"))); -#else -#ifndef xmlSAX2CDataBlock -extern __typeof (xmlSAX2CDataBlock) xmlSAX2CDataBlock__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2CDataBlock xmlSAX2CDataBlock__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2Characters -extern __typeof (xmlSAX2Characters) xmlSAX2Characters __attribute((alias("xmlSAX2Characters__internal_alias"))); -#else -#ifndef xmlSAX2Characters -extern __typeof (xmlSAX2Characters) xmlSAX2Characters__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2Characters xmlSAX2Characters__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2Comment -extern __typeof (xmlSAX2Comment) xmlSAX2Comment __attribute((alias("xmlSAX2Comment__internal_alias"))); -#else -#ifndef xmlSAX2Comment -extern __typeof (xmlSAX2Comment) xmlSAX2Comment__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2Comment xmlSAX2Comment__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2ElementDecl -extern __typeof (xmlSAX2ElementDecl) xmlSAX2ElementDecl __attribute((alias("xmlSAX2ElementDecl__internal_alias"))); -#else -#ifndef xmlSAX2ElementDecl -extern __typeof (xmlSAX2ElementDecl) xmlSAX2ElementDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2ElementDecl xmlSAX2ElementDecl__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2EndDocument -extern __typeof (xmlSAX2EndDocument) xmlSAX2EndDocument __attribute((alias("xmlSAX2EndDocument__internal_alias"))); -#else -#ifndef xmlSAX2EndDocument -extern __typeof (xmlSAX2EndDocument) xmlSAX2EndDocument__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2EndDocument xmlSAX2EndDocument__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2EndElementNs -extern __typeof (xmlSAX2EndElementNs) xmlSAX2EndElementNs __attribute((alias("xmlSAX2EndElementNs__internal_alias"))); -#else -#ifndef xmlSAX2EndElementNs -extern __typeof (xmlSAX2EndElementNs) xmlSAX2EndElementNs__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2EndElementNs xmlSAX2EndElementNs__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2EntityDecl -extern __typeof (xmlSAX2EntityDecl) xmlSAX2EntityDecl __attribute((alias("xmlSAX2EntityDecl__internal_alias"))); -#else -#ifndef xmlSAX2EntityDecl -extern __typeof (xmlSAX2EntityDecl) xmlSAX2EntityDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2EntityDecl xmlSAX2EntityDecl__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2ExternalSubset -extern __typeof (xmlSAX2ExternalSubset) xmlSAX2ExternalSubset __attribute((alias("xmlSAX2ExternalSubset__internal_alias"))); -#else -#ifndef xmlSAX2ExternalSubset -extern __typeof (xmlSAX2ExternalSubset) xmlSAX2ExternalSubset__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2ExternalSubset xmlSAX2ExternalSubset__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2GetColumnNumber -extern __typeof (xmlSAX2GetColumnNumber) xmlSAX2GetColumnNumber __attribute((alias("xmlSAX2GetColumnNumber__internal_alias"))); -#else -#ifndef xmlSAX2GetColumnNumber -extern __typeof (xmlSAX2GetColumnNumber) xmlSAX2GetColumnNumber__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2GetColumnNumber xmlSAX2GetColumnNumber__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2GetEntity -extern __typeof (xmlSAX2GetEntity) xmlSAX2GetEntity __attribute((alias("xmlSAX2GetEntity__internal_alias"))); -#else -#ifndef xmlSAX2GetEntity -extern __typeof (xmlSAX2GetEntity) xmlSAX2GetEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2GetEntity xmlSAX2GetEntity__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2GetLineNumber -extern __typeof (xmlSAX2GetLineNumber) xmlSAX2GetLineNumber __attribute((alias("xmlSAX2GetLineNumber__internal_alias"))); -#else -#ifndef xmlSAX2GetLineNumber -extern __typeof (xmlSAX2GetLineNumber) xmlSAX2GetLineNumber__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2GetLineNumber xmlSAX2GetLineNumber__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2GetParameterEntity -extern __typeof (xmlSAX2GetParameterEntity) xmlSAX2GetParameterEntity __attribute((alias("xmlSAX2GetParameterEntity__internal_alias"))); -#else -#ifndef xmlSAX2GetParameterEntity -extern __typeof (xmlSAX2GetParameterEntity) xmlSAX2GetParameterEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2GetParameterEntity xmlSAX2GetParameterEntity__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2GetPublicId -extern __typeof (xmlSAX2GetPublicId) xmlSAX2GetPublicId __attribute((alias("xmlSAX2GetPublicId__internal_alias"))); -#else -#ifndef xmlSAX2GetPublicId -extern __typeof (xmlSAX2GetPublicId) xmlSAX2GetPublicId__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2GetPublicId xmlSAX2GetPublicId__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2GetSystemId -extern __typeof (xmlSAX2GetSystemId) xmlSAX2GetSystemId __attribute((alias("xmlSAX2GetSystemId__internal_alias"))); -#else -#ifndef xmlSAX2GetSystemId -extern __typeof (xmlSAX2GetSystemId) xmlSAX2GetSystemId__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2GetSystemId xmlSAX2GetSystemId__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2HasExternalSubset -extern __typeof (xmlSAX2HasExternalSubset) xmlSAX2HasExternalSubset __attribute((alias("xmlSAX2HasExternalSubset__internal_alias"))); -#else -#ifndef xmlSAX2HasExternalSubset -extern __typeof (xmlSAX2HasExternalSubset) xmlSAX2HasExternalSubset__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2HasExternalSubset xmlSAX2HasExternalSubset__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2HasInternalSubset -extern __typeof (xmlSAX2HasInternalSubset) xmlSAX2HasInternalSubset __attribute((alias("xmlSAX2HasInternalSubset__internal_alias"))); -#else -#ifndef xmlSAX2HasInternalSubset -extern __typeof (xmlSAX2HasInternalSubset) xmlSAX2HasInternalSubset__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2HasInternalSubset xmlSAX2HasInternalSubset__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2IgnorableWhitespace -extern __typeof (xmlSAX2IgnorableWhitespace) xmlSAX2IgnorableWhitespace __attribute((alias("xmlSAX2IgnorableWhitespace__internal_alias"))); -#else -#ifndef xmlSAX2IgnorableWhitespace -extern __typeof (xmlSAX2IgnorableWhitespace) xmlSAX2IgnorableWhitespace__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2IgnorableWhitespace xmlSAX2IgnorableWhitespace__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2InitDefaultSAXHandler -extern __typeof (xmlSAX2InitDefaultSAXHandler) xmlSAX2InitDefaultSAXHandler __attribute((alias("xmlSAX2InitDefaultSAXHandler__internal_alias"))); -#else -#ifndef xmlSAX2InitDefaultSAXHandler -extern __typeof (xmlSAX2InitDefaultSAXHandler) xmlSAX2InitDefaultSAXHandler__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2InitDefaultSAXHandler xmlSAX2InitDefaultSAXHandler__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2InternalSubset -extern __typeof (xmlSAX2InternalSubset) xmlSAX2InternalSubset __attribute((alias("xmlSAX2InternalSubset__internal_alias"))); -#else -#ifndef xmlSAX2InternalSubset -extern __typeof (xmlSAX2InternalSubset) xmlSAX2InternalSubset__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2InternalSubset xmlSAX2InternalSubset__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2IsStandalone -extern __typeof (xmlSAX2IsStandalone) xmlSAX2IsStandalone __attribute((alias("xmlSAX2IsStandalone__internal_alias"))); -#else -#ifndef xmlSAX2IsStandalone -extern __typeof (xmlSAX2IsStandalone) xmlSAX2IsStandalone__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2IsStandalone xmlSAX2IsStandalone__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2NotationDecl -extern __typeof (xmlSAX2NotationDecl) xmlSAX2NotationDecl __attribute((alias("xmlSAX2NotationDecl__internal_alias"))); -#else -#ifndef xmlSAX2NotationDecl -extern __typeof (xmlSAX2NotationDecl) xmlSAX2NotationDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2NotationDecl xmlSAX2NotationDecl__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2ProcessingInstruction -extern __typeof (xmlSAX2ProcessingInstruction) xmlSAX2ProcessingInstruction __attribute((alias("xmlSAX2ProcessingInstruction__internal_alias"))); -#else -#ifndef xmlSAX2ProcessingInstruction -extern __typeof (xmlSAX2ProcessingInstruction) xmlSAX2ProcessingInstruction__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2ProcessingInstruction xmlSAX2ProcessingInstruction__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2Reference -extern __typeof (xmlSAX2Reference) xmlSAX2Reference __attribute((alias("xmlSAX2Reference__internal_alias"))); -#else -#ifndef xmlSAX2Reference -extern __typeof (xmlSAX2Reference) xmlSAX2Reference__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2Reference xmlSAX2Reference__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2ResolveEntity -extern __typeof (xmlSAX2ResolveEntity) xmlSAX2ResolveEntity __attribute((alias("xmlSAX2ResolveEntity__internal_alias"))); -#else -#ifndef xmlSAX2ResolveEntity -extern __typeof (xmlSAX2ResolveEntity) xmlSAX2ResolveEntity__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2ResolveEntity xmlSAX2ResolveEntity__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2SetDocumentLocator -extern __typeof (xmlSAX2SetDocumentLocator) xmlSAX2SetDocumentLocator __attribute((alias("xmlSAX2SetDocumentLocator__internal_alias"))); -#else -#ifndef xmlSAX2SetDocumentLocator -extern __typeof (xmlSAX2SetDocumentLocator) xmlSAX2SetDocumentLocator__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2SetDocumentLocator xmlSAX2SetDocumentLocator__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2StartDocument -extern __typeof (xmlSAX2StartDocument) xmlSAX2StartDocument __attribute((alias("xmlSAX2StartDocument__internal_alias"))); -#else -#ifndef xmlSAX2StartDocument -extern __typeof (xmlSAX2StartDocument) xmlSAX2StartDocument__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2StartDocument xmlSAX2StartDocument__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2StartElementNs -extern __typeof (xmlSAX2StartElementNs) xmlSAX2StartElementNs __attribute((alias("xmlSAX2StartElementNs__internal_alias"))); -#else -#ifndef xmlSAX2StartElementNs -extern __typeof (xmlSAX2StartElementNs) xmlSAX2StartElementNs__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2StartElementNs xmlSAX2StartElementNs__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAX2UnparsedEntityDecl -extern __typeof (xmlSAX2UnparsedEntityDecl) xmlSAX2UnparsedEntityDecl __attribute((alias("xmlSAX2UnparsedEntityDecl__internal_alias"))); -#else -#ifndef xmlSAX2UnparsedEntityDecl -extern __typeof (xmlSAX2UnparsedEntityDecl) xmlSAX2UnparsedEntityDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlSAX2UnparsedEntityDecl xmlSAX2UnparsedEntityDecl__internal_alias -#endif -#endif - -#ifdef bottom_SAX2 -#undef xmlSAXVersion -extern __typeof (xmlSAXVersion) xmlSAXVersion __attribute((alias("xmlSAXVersion__internal_alias"))); -#else -#ifndef xmlSAXVersion -extern __typeof (xmlSAXVersion) xmlSAXVersion__internal_alias __attribute((visibility("hidden"))); -#define xmlSAXVersion xmlSAXVersion__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlSaveUri -extern __typeof (xmlSaveUri) xmlSaveUri __attribute((alias("xmlSaveUri__internal_alias"))); -#else -#ifndef xmlSaveUri -extern __typeof (xmlSaveUri) xmlSaveUri__internal_alias __attribute((visibility("hidden"))); -#define xmlSaveUri xmlSaveUri__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSearchNs -extern __typeof (xmlSearchNs) xmlSearchNs __attribute((alias("xmlSearchNs__internal_alias"))); -#else -#ifndef xmlSearchNs -extern __typeof (xmlSearchNs) xmlSearchNs__internal_alias __attribute((visibility("hidden"))); -#define xmlSearchNs xmlSearchNs__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSearchNsByHref -extern __typeof (xmlSearchNsByHref) xmlSearchNsByHref __attribute((alias("xmlSearchNsByHref__internal_alias"))); -#else -#ifndef xmlSearchNsByHref -extern __typeof (xmlSearchNsByHref) xmlSearchNsByHref__internal_alias __attribute((visibility("hidden"))); -#define xmlSearchNsByHref xmlSearchNsByHref__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSetBufferAllocationScheme -extern __typeof (xmlSetBufferAllocationScheme) xmlSetBufferAllocationScheme __attribute((alias("xmlSetBufferAllocationScheme__internal_alias"))); -#else -#ifndef xmlSetBufferAllocationScheme -extern __typeof (xmlSetBufferAllocationScheme) xmlSetBufferAllocationScheme__internal_alias __attribute((visibility("hidden"))); -#define xmlSetBufferAllocationScheme xmlSetBufferAllocationScheme__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSetCompressMode -extern __typeof (xmlSetCompressMode) xmlSetCompressMode __attribute((alias("xmlSetCompressMode__internal_alias"))); -#else -#ifndef xmlSetCompressMode -extern __typeof (xmlSetCompressMode) xmlSetCompressMode__internal_alias __attribute((visibility("hidden"))); -#define xmlSetCompressMode xmlSetCompressMode__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSetDocCompressMode -extern __typeof (xmlSetDocCompressMode) xmlSetDocCompressMode __attribute((alias("xmlSetDocCompressMode__internal_alias"))); -#else -#ifndef xmlSetDocCompressMode -extern __typeof (xmlSetDocCompressMode) xmlSetDocCompressMode__internal_alias __attribute((visibility("hidden"))); -#define xmlSetDocCompressMode xmlSetDocCompressMode__internal_alias -#endif -#endif - -#ifdef bottom_xmlIO -#undef xmlSetExternalEntityLoader -extern __typeof (xmlSetExternalEntityLoader) xmlSetExternalEntityLoader __attribute((alias("xmlSetExternalEntityLoader__internal_alias"))); -#else -#ifndef xmlSetExternalEntityLoader -extern __typeof (xmlSetExternalEntityLoader) xmlSetExternalEntityLoader__internal_alias __attribute((visibility("hidden"))); -#define xmlSetExternalEntityLoader xmlSetExternalEntityLoader__internal_alias -#endif -#endif - - -#ifdef bottom_error -#undef xmlSetGenericErrorFunc -extern __typeof (xmlSetGenericErrorFunc) xmlSetGenericErrorFunc __attribute((alias("xmlSetGenericErrorFunc__internal_alias"))); -#else -#ifndef xmlSetGenericErrorFunc -extern __typeof (xmlSetGenericErrorFunc) xmlSetGenericErrorFunc__internal_alias __attribute((visibility("hidden"))); -#define xmlSetGenericErrorFunc xmlSetGenericErrorFunc__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSetListDoc -extern __typeof (xmlSetListDoc) xmlSetListDoc __attribute((alias("xmlSetListDoc__internal_alias"))); -#else -#ifndef xmlSetListDoc -extern __typeof (xmlSetListDoc) xmlSetListDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlSetListDoc xmlSetListDoc__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSetNs -extern __typeof (xmlSetNs) xmlSetNs __attribute((alias("xmlSetNs__internal_alias"))); -#else -#ifndef xmlSetNs -extern __typeof (xmlSetNs) xmlSetNs__internal_alias __attribute((visibility("hidden"))); -#define xmlSetNs xmlSetNs__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlSetNsProp -extern __typeof (xmlSetNsProp) xmlSetNsProp __attribute((alias("xmlSetNsProp__internal_alias"))); -#else -#ifndef xmlSetNsProp -extern __typeof (xmlSetNsProp) xmlSetNsProp__internal_alias __attribute((visibility("hidden"))); -#define xmlSetNsProp xmlSetNsProp__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlSetProp -extern __typeof (xmlSetProp) xmlSetProp __attribute((alias("xmlSetProp__internal_alias"))); -#else -#ifndef xmlSetProp -extern __typeof (xmlSetProp) xmlSetProp__internal_alias __attribute((visibility("hidden"))); -#define xmlSetProp xmlSetProp__internal_alias -#endif -#endif -#endif - -#ifdef bottom_error -#undef xmlSetStructuredErrorFunc -extern __typeof (xmlSetStructuredErrorFunc) xmlSetStructuredErrorFunc __attribute((alias("xmlSetStructuredErrorFunc__internal_alias"))); -#else -#ifndef xmlSetStructuredErrorFunc -extern __typeof (xmlSetStructuredErrorFunc) xmlSetStructuredErrorFunc__internal_alias __attribute((visibility("hidden"))); -#define xmlSetStructuredErrorFunc xmlSetStructuredErrorFunc__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSetTreeDoc -extern __typeof (xmlSetTreeDoc) xmlSetTreeDoc __attribute((alias("xmlSetTreeDoc__internal_alias"))); -#else -#ifndef xmlSetTreeDoc -extern __typeof (xmlSetTreeDoc) xmlSetTreeDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlSetTreeDoc xmlSetTreeDoc__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlSkipBlankChars -extern __typeof (xmlSkipBlankChars) xmlSkipBlankChars __attribute((alias("xmlSkipBlankChars__internal_alias"))); -#else -#ifndef xmlSkipBlankChars -extern __typeof (xmlSkipBlankChars) xmlSkipBlankChars__internal_alias __attribute((visibility("hidden"))); -#define xmlSkipBlankChars xmlSkipBlankChars__internal_alias -#endif -#endif - -#ifdef bottom_valid -#undef xmlSnprintfElementContent -extern __typeof (xmlSnprintfElementContent) xmlSnprintfElementContent __attribute((alias("xmlSnprintfElementContent__internal_alias"))); -#else -#ifndef xmlSnprintfElementContent -extern __typeof (xmlSnprintfElementContent) xmlSnprintfElementContent__internal_alias __attribute((visibility("hidden"))); -#define xmlSnprintfElementContent xmlSnprintfElementContent__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlSplitQName -extern __typeof (xmlSplitQName) xmlSplitQName __attribute((alias("xmlSplitQName__internal_alias"))); -#else -#ifndef xmlSplitQName -extern __typeof (xmlSplitQName) xmlSplitQName__internal_alias __attribute((visibility("hidden"))); -#define xmlSplitQName xmlSplitQName__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSplitQName2 -extern __typeof (xmlSplitQName2) xmlSplitQName2 __attribute((alias("xmlSplitQName2__internal_alias"))); -#else -#ifndef xmlSplitQName2 -extern __typeof (xmlSplitQName2) xmlSplitQName2__internal_alias __attribute((visibility("hidden"))); -#define xmlSplitQName2 xmlSplitQName2__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlSplitQName3 -extern __typeof (xmlSplitQName3) xmlSplitQName3 __attribute((alias("xmlSplitQName3__internal_alias"))); -#else -#ifndef xmlSplitQName3 -extern __typeof (xmlSplitQName3) xmlSplitQName3__internal_alias __attribute((visibility("hidden"))); -#define xmlSplitQName3 xmlSplitQName3__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlStopParser -extern __typeof (xmlStopParser) xmlStopParser __attribute((alias("xmlStopParser__internal_alias"))); -#else -#ifndef xmlStopParser -extern __typeof (xmlStopParser) xmlStopParser__internal_alias __attribute((visibility("hidden"))); -#define xmlStopParser xmlStopParser__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrEqual -extern __typeof (xmlStrEqual) xmlStrEqual __attribute((alias("xmlStrEqual__internal_alias"))); -#else -#ifndef xmlStrEqual -extern __typeof (xmlStrEqual) xmlStrEqual__internal_alias __attribute((visibility("hidden"))); -#define xmlStrEqual xmlStrEqual__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrPrintf -extern __typeof (xmlStrPrintf) xmlStrPrintf __attribute((alias("xmlStrPrintf__internal_alias"))); -#else -#ifndef xmlStrPrintf -extern __typeof (xmlStrPrintf) xmlStrPrintf__internal_alias __attribute((visibility("hidden"))); -#define xmlStrPrintf xmlStrPrintf__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrQEqual -extern __typeof (xmlStrQEqual) xmlStrQEqual __attribute((alias("xmlStrQEqual__internal_alias"))); -#else -#ifndef xmlStrQEqual -extern __typeof (xmlStrQEqual) xmlStrQEqual__internal_alias __attribute((visibility("hidden"))); -#define xmlStrQEqual xmlStrQEqual__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrVPrintf -extern __typeof (xmlStrVPrintf) xmlStrVPrintf __attribute((alias("xmlStrVPrintf__internal_alias"))); -#else -#ifndef xmlStrVPrintf -extern __typeof (xmlStrVPrintf) xmlStrVPrintf__internal_alias __attribute((visibility("hidden"))); -#define xmlStrVPrintf xmlStrVPrintf__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrcasecmp -extern __typeof (xmlStrcasecmp) xmlStrcasecmp __attribute((alias("xmlStrcasecmp__internal_alias"))); -#else -#ifndef xmlStrcasecmp -extern __typeof (xmlStrcasecmp) xmlStrcasecmp__internal_alias __attribute((visibility("hidden"))); -#define xmlStrcasecmp xmlStrcasecmp__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrcasestr -extern __typeof (xmlStrcasestr) xmlStrcasestr __attribute((alias("xmlStrcasestr__internal_alias"))); -#else -#ifndef xmlStrcasestr -extern __typeof (xmlStrcasestr) xmlStrcasestr__internal_alias __attribute((visibility("hidden"))); -#define xmlStrcasestr xmlStrcasestr__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrcat -extern __typeof (xmlStrcat) xmlStrcat __attribute((alias("xmlStrcat__internal_alias"))); -#else -#ifndef xmlStrcat -extern __typeof (xmlStrcat) xmlStrcat__internal_alias __attribute((visibility("hidden"))); -#define xmlStrcat xmlStrcat__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrchr -extern __typeof (xmlStrchr) xmlStrchr __attribute((alias("xmlStrchr__internal_alias"))); -#else -#ifndef xmlStrchr -extern __typeof (xmlStrchr) xmlStrchr__internal_alias __attribute((visibility("hidden"))); -#define xmlStrchr xmlStrchr__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrcmp -extern __typeof (xmlStrcmp) xmlStrcmp __attribute((alias("xmlStrcmp__internal_alias"))); -#else -#ifndef xmlStrcmp -extern __typeof (xmlStrcmp) xmlStrcmp__internal_alias __attribute((visibility("hidden"))); -#define xmlStrcmp xmlStrcmp__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrdup -extern __typeof (xmlStrdup) xmlStrdup __attribute((alias("xmlStrdup__internal_alias"))); -#else -#ifndef xmlStrdup -extern __typeof (xmlStrdup) xmlStrdup__internal_alias __attribute((visibility("hidden"))); -#define xmlStrdup xmlStrdup__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlStringCurrentChar -extern __typeof (xmlStringCurrentChar) xmlStringCurrentChar __attribute((alias("xmlStringCurrentChar__internal_alias"))); -#else -#ifndef xmlStringCurrentChar -extern __typeof (xmlStringCurrentChar) xmlStringCurrentChar__internal_alias __attribute((visibility("hidden"))); -#define xmlStringCurrentChar xmlStringCurrentChar__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlStringDecodeEntities -extern __typeof (xmlStringDecodeEntities) xmlStringDecodeEntities __attribute((alias("xmlStringDecodeEntities__internal_alias"))); -#else -#ifndef xmlStringDecodeEntities -extern __typeof (xmlStringDecodeEntities) xmlStringDecodeEntities__internal_alias __attribute((visibility("hidden"))); -#define xmlStringDecodeEntities xmlStringDecodeEntities__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlStringGetNodeList -extern __typeof (xmlStringGetNodeList) xmlStringGetNodeList __attribute((alias("xmlStringGetNodeList__internal_alias"))); -#else -#ifndef xmlStringGetNodeList -extern __typeof (xmlStringGetNodeList) xmlStringGetNodeList__internal_alias __attribute((visibility("hidden"))); -#define xmlStringGetNodeList xmlStringGetNodeList__internal_alias -#endif -#endif - -#ifdef bottom_parser -#undef xmlStringLenDecodeEntities -extern __typeof (xmlStringLenDecodeEntities) xmlStringLenDecodeEntities __attribute((alias("xmlStringLenDecodeEntities__internal_alias"))); -#else -#ifndef xmlStringLenDecodeEntities -extern __typeof (xmlStringLenDecodeEntities) xmlStringLenDecodeEntities__internal_alias __attribute((visibility("hidden"))); -#define xmlStringLenDecodeEntities xmlStringLenDecodeEntities__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlStringLenGetNodeList -extern __typeof (xmlStringLenGetNodeList) xmlStringLenGetNodeList __attribute((alias("xmlStringLenGetNodeList__internal_alias"))); -#else -#ifndef xmlStringLenGetNodeList -extern __typeof (xmlStringLenGetNodeList) xmlStringLenGetNodeList__internal_alias __attribute((visibility("hidden"))); -#define xmlStringLenGetNodeList xmlStringLenGetNodeList__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrlen -extern __typeof (xmlStrlen) xmlStrlen __attribute((alias("xmlStrlen__internal_alias"))); -#else -#ifndef xmlStrlen -extern __typeof (xmlStrlen) xmlStrlen__internal_alias __attribute((visibility("hidden"))); -#define xmlStrlen xmlStrlen__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrncasecmp -extern __typeof (xmlStrncasecmp) xmlStrncasecmp __attribute((alias("xmlStrncasecmp__internal_alias"))); -#else -#ifndef xmlStrncasecmp -extern __typeof (xmlStrncasecmp) xmlStrncasecmp__internal_alias __attribute((visibility("hidden"))); -#define xmlStrncasecmp xmlStrncasecmp__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrncat -extern __typeof (xmlStrncat) xmlStrncat __attribute((alias("xmlStrncat__internal_alias"))); -#else -#ifndef xmlStrncat -extern __typeof (xmlStrncat) xmlStrncat__internal_alias __attribute((visibility("hidden"))); -#define xmlStrncat xmlStrncat__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrncatNew -extern __typeof (xmlStrncatNew) xmlStrncatNew __attribute((alias("xmlStrncatNew__internal_alias"))); -#else -#ifndef xmlStrncatNew -extern __typeof (xmlStrncatNew) xmlStrncatNew__internal_alias __attribute((visibility("hidden"))); -#define xmlStrncatNew xmlStrncatNew__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrncmp -extern __typeof (xmlStrncmp) xmlStrncmp __attribute((alias("xmlStrncmp__internal_alias"))); -#else -#ifndef xmlStrncmp -extern __typeof (xmlStrncmp) xmlStrncmp__internal_alias __attribute((visibility("hidden"))); -#define xmlStrncmp xmlStrncmp__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrndup -extern __typeof (xmlStrndup) xmlStrndup __attribute((alias("xmlStrndup__internal_alias"))); -#else -#ifndef xmlStrndup -extern __typeof (xmlStrndup) xmlStrndup__internal_alias __attribute((visibility("hidden"))); -#define xmlStrndup xmlStrndup__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrstr -extern __typeof (xmlStrstr) xmlStrstr __attribute((alias("xmlStrstr__internal_alias"))); -#else -#ifndef xmlStrstr -extern __typeof (xmlStrstr) xmlStrstr__internal_alias __attribute((visibility("hidden"))); -#define xmlStrstr xmlStrstr__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlStrsub -extern __typeof (xmlStrsub) xmlStrsub __attribute((alias("xmlStrsub__internal_alias"))); -#else -#ifndef xmlStrsub -extern __typeof (xmlStrsub) xmlStrsub__internal_alias __attribute((visibility("hidden"))); -#define xmlStrsub xmlStrsub__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlSubstituteEntitiesDefault -extern __typeof (xmlSubstituteEntitiesDefault) xmlSubstituteEntitiesDefault __attribute((alias("xmlSubstituteEntitiesDefault__internal_alias"))); -#else -#ifndef xmlSubstituteEntitiesDefault -extern __typeof (xmlSubstituteEntitiesDefault) xmlSubstituteEntitiesDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlSubstituteEntitiesDefault xmlSubstituteEntitiesDefault__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlSwitchEncoding -extern __typeof (xmlSwitchEncoding) xmlSwitchEncoding __attribute((alias("xmlSwitchEncoding__internal_alias"))); -#else -#ifndef xmlSwitchEncoding -extern __typeof (xmlSwitchEncoding) xmlSwitchEncoding__internal_alias __attribute((visibility("hidden"))); -#define xmlSwitchEncoding xmlSwitchEncoding__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlSwitchInputEncoding -extern __typeof (xmlSwitchInputEncoding) xmlSwitchInputEncoding __attribute((alias("xmlSwitchInputEncoding__internal_alias"))); -#else -#ifndef xmlSwitchInputEncoding -extern __typeof (xmlSwitchInputEncoding) xmlSwitchInputEncoding__internal_alias __attribute((visibility("hidden"))); -#define xmlSwitchInputEncoding xmlSwitchInputEncoding__internal_alias -#endif -#endif - -#ifdef bottom_parserInternals -#undef xmlSwitchToEncoding -extern __typeof (xmlSwitchToEncoding) xmlSwitchToEncoding __attribute((alias("xmlSwitchToEncoding__internal_alias"))); -#else -#ifndef xmlSwitchToEncoding -extern __typeof (xmlSwitchToEncoding) xmlSwitchToEncoding__internal_alias __attribute((visibility("hidden"))); -#define xmlSwitchToEncoding xmlSwitchToEncoding__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlTextConcat -extern __typeof (xmlTextConcat) xmlTextConcat __attribute((alias("xmlTextConcat__internal_alias"))); -#else -#ifndef xmlTextConcat -extern __typeof (xmlTextConcat) xmlTextConcat__internal_alias __attribute((visibility("hidden"))); -#define xmlTextConcat xmlTextConcat__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlTextMerge -extern __typeof (xmlTextMerge) xmlTextMerge __attribute((alias("xmlTextMerge__internal_alias"))); -#else -#ifndef xmlTextMerge -extern __typeof (xmlTextMerge) xmlTextMerge__internal_alias __attribute((visibility("hidden"))); -#define xmlTextMerge xmlTextMerge__internal_alias -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderAttributeCount -extern __typeof (xmlTextReaderAttributeCount) xmlTextReaderAttributeCount __attribute((alias("xmlTextReaderAttributeCount__internal_alias"))); -#else -#ifndef xmlTextReaderAttributeCount -extern __typeof (xmlTextReaderAttributeCount) xmlTextReaderAttributeCount__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderAttributeCount xmlTextReaderAttributeCount__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderBaseUri -extern __typeof (xmlTextReaderBaseUri) xmlTextReaderBaseUri __attribute((alias("xmlTextReaderBaseUri__internal_alias"))); -#else -#ifndef xmlTextReaderBaseUri -extern __typeof (xmlTextReaderBaseUri) xmlTextReaderBaseUri__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderBaseUri xmlTextReaderBaseUri__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderByteConsumed -extern __typeof (xmlTextReaderByteConsumed) xmlTextReaderByteConsumed __attribute((alias("xmlTextReaderByteConsumed__internal_alias"))); -#else -#ifndef xmlTextReaderByteConsumed -extern __typeof (xmlTextReaderByteConsumed) xmlTextReaderByteConsumed__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderByteConsumed xmlTextReaderByteConsumed__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderClose -extern __typeof (xmlTextReaderClose) xmlTextReaderClose __attribute((alias("xmlTextReaderClose__internal_alias"))); -#else -#ifndef xmlTextReaderClose -extern __typeof (xmlTextReaderClose) xmlTextReaderClose__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderClose xmlTextReaderClose__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstBaseUri -extern __typeof (xmlTextReaderConstBaseUri) xmlTextReaderConstBaseUri __attribute((alias("xmlTextReaderConstBaseUri__internal_alias"))); -#else -#ifndef xmlTextReaderConstBaseUri -extern __typeof (xmlTextReaderConstBaseUri) xmlTextReaderConstBaseUri__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstBaseUri xmlTextReaderConstBaseUri__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstEncoding -extern __typeof (xmlTextReaderConstEncoding) xmlTextReaderConstEncoding __attribute((alias("xmlTextReaderConstEncoding__internal_alias"))); -#else -#ifndef xmlTextReaderConstEncoding -extern __typeof (xmlTextReaderConstEncoding) xmlTextReaderConstEncoding__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstEncoding xmlTextReaderConstEncoding__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstLocalName -extern __typeof (xmlTextReaderConstLocalName) xmlTextReaderConstLocalName __attribute((alias("xmlTextReaderConstLocalName__internal_alias"))); -#else -#ifndef xmlTextReaderConstLocalName -extern __typeof (xmlTextReaderConstLocalName) xmlTextReaderConstLocalName__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstLocalName xmlTextReaderConstLocalName__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstName -extern __typeof (xmlTextReaderConstName) xmlTextReaderConstName __attribute((alias("xmlTextReaderConstName__internal_alias"))); -#else -#ifndef xmlTextReaderConstName -extern __typeof (xmlTextReaderConstName) xmlTextReaderConstName__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstName xmlTextReaderConstName__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstNamespaceUri -extern __typeof (xmlTextReaderConstNamespaceUri) xmlTextReaderConstNamespaceUri __attribute((alias("xmlTextReaderConstNamespaceUri__internal_alias"))); -#else -#ifndef xmlTextReaderConstNamespaceUri -extern __typeof (xmlTextReaderConstNamespaceUri) xmlTextReaderConstNamespaceUri__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstNamespaceUri xmlTextReaderConstNamespaceUri__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstPrefix -extern __typeof (xmlTextReaderConstPrefix) xmlTextReaderConstPrefix __attribute((alias("xmlTextReaderConstPrefix__internal_alias"))); -#else -#ifndef xmlTextReaderConstPrefix -extern __typeof (xmlTextReaderConstPrefix) xmlTextReaderConstPrefix__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstPrefix xmlTextReaderConstPrefix__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstString -extern __typeof (xmlTextReaderConstString) xmlTextReaderConstString __attribute((alias("xmlTextReaderConstString__internal_alias"))); -#else -#ifndef xmlTextReaderConstString -extern __typeof (xmlTextReaderConstString) xmlTextReaderConstString__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstString xmlTextReaderConstString__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstValue -extern __typeof (xmlTextReaderConstValue) xmlTextReaderConstValue __attribute((alias("xmlTextReaderConstValue__internal_alias"))); -#else -#ifndef xmlTextReaderConstValue -extern __typeof (xmlTextReaderConstValue) xmlTextReaderConstValue__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstValue xmlTextReaderConstValue__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstXmlLang -extern __typeof (xmlTextReaderConstXmlLang) xmlTextReaderConstXmlLang __attribute((alias("xmlTextReaderConstXmlLang__internal_alias"))); -#else -#ifndef xmlTextReaderConstXmlLang -extern __typeof (xmlTextReaderConstXmlLang) xmlTextReaderConstXmlLang__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstXmlLang xmlTextReaderConstXmlLang__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderConstXmlVersion -extern __typeof (xmlTextReaderConstXmlVersion) xmlTextReaderConstXmlVersion __attribute((alias("xmlTextReaderConstXmlVersion__internal_alias"))); -#else -#ifndef xmlTextReaderConstXmlVersion -extern __typeof (xmlTextReaderConstXmlVersion) xmlTextReaderConstXmlVersion__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderConstXmlVersion xmlTextReaderConstXmlVersion__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderCurrentDoc -extern __typeof (xmlTextReaderCurrentDoc) xmlTextReaderCurrentDoc __attribute((alias("xmlTextReaderCurrentDoc__internal_alias"))); -#else -#ifndef xmlTextReaderCurrentDoc -extern __typeof (xmlTextReaderCurrentDoc) xmlTextReaderCurrentDoc__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderCurrentDoc xmlTextReaderCurrentDoc__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderCurrentNode -extern __typeof (xmlTextReaderCurrentNode) xmlTextReaderCurrentNode __attribute((alias("xmlTextReaderCurrentNode__internal_alias"))); -#else -#ifndef xmlTextReaderCurrentNode -extern __typeof (xmlTextReaderCurrentNode) xmlTextReaderCurrentNode__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderCurrentNode xmlTextReaderCurrentNode__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderDepth -extern __typeof (xmlTextReaderDepth) xmlTextReaderDepth __attribute((alias("xmlTextReaderDepth__internal_alias"))); -#else -#ifndef xmlTextReaderDepth -extern __typeof (xmlTextReaderDepth) xmlTextReaderDepth__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderDepth xmlTextReaderDepth__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderExpand -extern __typeof (xmlTextReaderExpand) xmlTextReaderExpand __attribute((alias("xmlTextReaderExpand__internal_alias"))); -#else -#ifndef xmlTextReaderExpand -extern __typeof (xmlTextReaderExpand) xmlTextReaderExpand__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderExpand xmlTextReaderExpand__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderGetAttribute -extern __typeof (xmlTextReaderGetAttribute) xmlTextReaderGetAttribute __attribute((alias("xmlTextReaderGetAttribute__internal_alias"))); -#else -#ifndef xmlTextReaderGetAttribute -extern __typeof (xmlTextReaderGetAttribute) xmlTextReaderGetAttribute__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderGetAttribute xmlTextReaderGetAttribute__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderGetAttributeNo -extern __typeof (xmlTextReaderGetAttributeNo) xmlTextReaderGetAttributeNo __attribute((alias("xmlTextReaderGetAttributeNo__internal_alias"))); -#else -#ifndef xmlTextReaderGetAttributeNo -extern __typeof (xmlTextReaderGetAttributeNo) xmlTextReaderGetAttributeNo__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderGetAttributeNo xmlTextReaderGetAttributeNo__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderGetAttributeNs -extern __typeof (xmlTextReaderGetAttributeNs) xmlTextReaderGetAttributeNs __attribute((alias("xmlTextReaderGetAttributeNs__internal_alias"))); -#else -#ifndef xmlTextReaderGetAttributeNs -extern __typeof (xmlTextReaderGetAttributeNs) xmlTextReaderGetAttributeNs__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderGetAttributeNs xmlTextReaderGetAttributeNs__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderGetErrorHandler -extern __typeof (xmlTextReaderGetErrorHandler) xmlTextReaderGetErrorHandler __attribute((alias("xmlTextReaderGetErrorHandler__internal_alias"))); -#else -#ifndef xmlTextReaderGetErrorHandler -extern __typeof (xmlTextReaderGetErrorHandler) xmlTextReaderGetErrorHandler__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderGetErrorHandler xmlTextReaderGetErrorHandler__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderGetParserColumnNumber -extern __typeof (xmlTextReaderGetParserColumnNumber) xmlTextReaderGetParserColumnNumber __attribute((alias("xmlTextReaderGetParserColumnNumber__internal_alias"))); -#else -#ifndef xmlTextReaderGetParserColumnNumber -extern __typeof (xmlTextReaderGetParserColumnNumber) xmlTextReaderGetParserColumnNumber__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderGetParserColumnNumber xmlTextReaderGetParserColumnNumber__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderGetParserLineNumber -extern __typeof (xmlTextReaderGetParserLineNumber) xmlTextReaderGetParserLineNumber __attribute((alias("xmlTextReaderGetParserLineNumber__internal_alias"))); -#else -#ifndef xmlTextReaderGetParserLineNumber -extern __typeof (xmlTextReaderGetParserLineNumber) xmlTextReaderGetParserLineNumber__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderGetParserLineNumber xmlTextReaderGetParserLineNumber__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderGetParserProp -extern __typeof (xmlTextReaderGetParserProp) xmlTextReaderGetParserProp __attribute((alias("xmlTextReaderGetParserProp__internal_alias"))); -#else -#ifndef xmlTextReaderGetParserProp -extern __typeof (xmlTextReaderGetParserProp) xmlTextReaderGetParserProp__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderGetParserProp xmlTextReaderGetParserProp__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderGetRemainder -extern __typeof (xmlTextReaderGetRemainder) xmlTextReaderGetRemainder __attribute((alias("xmlTextReaderGetRemainder__internal_alias"))); -#else -#ifndef xmlTextReaderGetRemainder -extern __typeof (xmlTextReaderGetRemainder) xmlTextReaderGetRemainder__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderGetRemainder xmlTextReaderGetRemainder__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderHasAttributes -extern __typeof (xmlTextReaderHasAttributes) xmlTextReaderHasAttributes __attribute((alias("xmlTextReaderHasAttributes__internal_alias"))); -#else -#ifndef xmlTextReaderHasAttributes -extern __typeof (xmlTextReaderHasAttributes) xmlTextReaderHasAttributes__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderHasAttributes xmlTextReaderHasAttributes__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderHasValue -extern __typeof (xmlTextReaderHasValue) xmlTextReaderHasValue __attribute((alias("xmlTextReaderHasValue__internal_alias"))); -#else -#ifndef xmlTextReaderHasValue -extern __typeof (xmlTextReaderHasValue) xmlTextReaderHasValue__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderHasValue xmlTextReaderHasValue__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderIsDefault -extern __typeof (xmlTextReaderIsDefault) xmlTextReaderIsDefault __attribute((alias("xmlTextReaderIsDefault__internal_alias"))); -#else -#ifndef xmlTextReaderIsDefault -extern __typeof (xmlTextReaderIsDefault) xmlTextReaderIsDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderIsDefault xmlTextReaderIsDefault__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderIsEmptyElement -extern __typeof (xmlTextReaderIsEmptyElement) xmlTextReaderIsEmptyElement __attribute((alias("xmlTextReaderIsEmptyElement__internal_alias"))); -#else -#ifndef xmlTextReaderIsEmptyElement -extern __typeof (xmlTextReaderIsEmptyElement) xmlTextReaderIsEmptyElement__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderIsEmptyElement xmlTextReaderIsEmptyElement__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderIsNamespaceDecl -extern __typeof (xmlTextReaderIsNamespaceDecl) xmlTextReaderIsNamespaceDecl __attribute((alias("xmlTextReaderIsNamespaceDecl__internal_alias"))); -#else -#ifndef xmlTextReaderIsNamespaceDecl -extern __typeof (xmlTextReaderIsNamespaceDecl) xmlTextReaderIsNamespaceDecl__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderIsNamespaceDecl xmlTextReaderIsNamespaceDecl__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderIsValid -extern __typeof (xmlTextReaderIsValid) xmlTextReaderIsValid __attribute((alias("xmlTextReaderIsValid__internal_alias"))); -#else -#ifndef xmlTextReaderIsValid -extern __typeof (xmlTextReaderIsValid) xmlTextReaderIsValid__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderIsValid xmlTextReaderIsValid__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderLocalName -extern __typeof (xmlTextReaderLocalName) xmlTextReaderLocalName __attribute((alias("xmlTextReaderLocalName__internal_alias"))); -#else -#ifndef xmlTextReaderLocalName -extern __typeof (xmlTextReaderLocalName) xmlTextReaderLocalName__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderLocalName xmlTextReaderLocalName__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderLocatorBaseURI -extern __typeof (xmlTextReaderLocatorBaseURI) xmlTextReaderLocatorBaseURI __attribute((alias("xmlTextReaderLocatorBaseURI__internal_alias"))); -#else -#ifndef xmlTextReaderLocatorBaseURI -extern __typeof (xmlTextReaderLocatorBaseURI) xmlTextReaderLocatorBaseURI__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderLocatorBaseURI xmlTextReaderLocatorBaseURI__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderLocatorLineNumber -extern __typeof (xmlTextReaderLocatorLineNumber) xmlTextReaderLocatorLineNumber __attribute((alias("xmlTextReaderLocatorLineNumber__internal_alias"))); -#else -#ifndef xmlTextReaderLocatorLineNumber -extern __typeof (xmlTextReaderLocatorLineNumber) xmlTextReaderLocatorLineNumber__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderLocatorLineNumber xmlTextReaderLocatorLineNumber__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderLookupNamespace -extern __typeof (xmlTextReaderLookupNamespace) xmlTextReaderLookupNamespace __attribute((alias("xmlTextReaderLookupNamespace__internal_alias"))); -#else -#ifndef xmlTextReaderLookupNamespace -extern __typeof (xmlTextReaderLookupNamespace) xmlTextReaderLookupNamespace__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderLookupNamespace xmlTextReaderLookupNamespace__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderMoveToAttribute -extern __typeof (xmlTextReaderMoveToAttribute) xmlTextReaderMoveToAttribute __attribute((alias("xmlTextReaderMoveToAttribute__internal_alias"))); -#else -#ifndef xmlTextReaderMoveToAttribute -extern __typeof (xmlTextReaderMoveToAttribute) xmlTextReaderMoveToAttribute__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderMoveToAttribute xmlTextReaderMoveToAttribute__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderMoveToAttributeNo -extern __typeof (xmlTextReaderMoveToAttributeNo) xmlTextReaderMoveToAttributeNo __attribute((alias("xmlTextReaderMoveToAttributeNo__internal_alias"))); -#else -#ifndef xmlTextReaderMoveToAttributeNo -extern __typeof (xmlTextReaderMoveToAttributeNo) xmlTextReaderMoveToAttributeNo__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderMoveToAttributeNo xmlTextReaderMoveToAttributeNo__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderMoveToAttributeNs -extern __typeof (xmlTextReaderMoveToAttributeNs) xmlTextReaderMoveToAttributeNs __attribute((alias("xmlTextReaderMoveToAttributeNs__internal_alias"))); -#else -#ifndef xmlTextReaderMoveToAttributeNs -extern __typeof (xmlTextReaderMoveToAttributeNs) xmlTextReaderMoveToAttributeNs__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderMoveToAttributeNs xmlTextReaderMoveToAttributeNs__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderMoveToElement -extern __typeof (xmlTextReaderMoveToElement) xmlTextReaderMoveToElement __attribute((alias("xmlTextReaderMoveToElement__internal_alias"))); -#else -#ifndef xmlTextReaderMoveToElement -extern __typeof (xmlTextReaderMoveToElement) xmlTextReaderMoveToElement__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderMoveToElement xmlTextReaderMoveToElement__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderMoveToFirstAttribute -extern __typeof (xmlTextReaderMoveToFirstAttribute) xmlTextReaderMoveToFirstAttribute __attribute((alias("xmlTextReaderMoveToFirstAttribute__internal_alias"))); -#else -#ifndef xmlTextReaderMoveToFirstAttribute -extern __typeof (xmlTextReaderMoveToFirstAttribute) xmlTextReaderMoveToFirstAttribute__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderMoveToFirstAttribute xmlTextReaderMoveToFirstAttribute__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderMoveToNextAttribute -extern __typeof (xmlTextReaderMoveToNextAttribute) xmlTextReaderMoveToNextAttribute __attribute((alias("xmlTextReaderMoveToNextAttribute__internal_alias"))); -#else -#ifndef xmlTextReaderMoveToNextAttribute -extern __typeof (xmlTextReaderMoveToNextAttribute) xmlTextReaderMoveToNextAttribute__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderMoveToNextAttribute xmlTextReaderMoveToNextAttribute__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderName -extern __typeof (xmlTextReaderName) xmlTextReaderName __attribute((alias("xmlTextReaderName__internal_alias"))); -#else -#ifndef xmlTextReaderName -extern __typeof (xmlTextReaderName) xmlTextReaderName__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderName xmlTextReaderName__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderNamespaceUri -extern __typeof (xmlTextReaderNamespaceUri) xmlTextReaderNamespaceUri __attribute((alias("xmlTextReaderNamespaceUri__internal_alias"))); -#else -#ifndef xmlTextReaderNamespaceUri -extern __typeof (xmlTextReaderNamespaceUri) xmlTextReaderNamespaceUri__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderNamespaceUri xmlTextReaderNamespaceUri__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderNext -extern __typeof (xmlTextReaderNext) xmlTextReaderNext __attribute((alias("xmlTextReaderNext__internal_alias"))); -#else -#ifndef xmlTextReaderNext -extern __typeof (xmlTextReaderNext) xmlTextReaderNext__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderNext xmlTextReaderNext__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderNextSibling -extern __typeof (xmlTextReaderNextSibling) xmlTextReaderNextSibling __attribute((alias("xmlTextReaderNextSibling__internal_alias"))); -#else -#ifndef xmlTextReaderNextSibling -extern __typeof (xmlTextReaderNextSibling) xmlTextReaderNextSibling__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderNextSibling xmlTextReaderNextSibling__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderNodeType -extern __typeof (xmlTextReaderNodeType) xmlTextReaderNodeType __attribute((alias("xmlTextReaderNodeType__internal_alias"))); -#else -#ifndef xmlTextReaderNodeType -extern __typeof (xmlTextReaderNodeType) xmlTextReaderNodeType__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderNodeType xmlTextReaderNodeType__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderNormalization -extern __typeof (xmlTextReaderNormalization) xmlTextReaderNormalization __attribute((alias("xmlTextReaderNormalization__internal_alias"))); -#else -#ifndef xmlTextReaderNormalization -extern __typeof (xmlTextReaderNormalization) xmlTextReaderNormalization__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderNormalization xmlTextReaderNormalization__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderPrefix -extern __typeof (xmlTextReaderPrefix) xmlTextReaderPrefix __attribute((alias("xmlTextReaderPrefix__internal_alias"))); -#else -#ifndef xmlTextReaderPrefix -extern __typeof (xmlTextReaderPrefix) xmlTextReaderPrefix__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderPrefix xmlTextReaderPrefix__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderPreserve -extern __typeof (xmlTextReaderPreserve) xmlTextReaderPreserve __attribute((alias("xmlTextReaderPreserve__internal_alias"))); -#else -#ifndef xmlTextReaderPreserve -extern __typeof (xmlTextReaderPreserve) xmlTextReaderPreserve__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderPreserve xmlTextReaderPreserve__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderQuoteChar -extern __typeof (xmlTextReaderQuoteChar) xmlTextReaderQuoteChar __attribute((alias("xmlTextReaderQuoteChar__internal_alias"))); -#else -#ifndef xmlTextReaderQuoteChar -extern __typeof (xmlTextReaderQuoteChar) xmlTextReaderQuoteChar__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderQuoteChar xmlTextReaderQuoteChar__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderRead -extern __typeof (xmlTextReaderRead) xmlTextReaderRead __attribute((alias("xmlTextReaderRead__internal_alias"))); -#else -#ifndef xmlTextReaderRead -extern __typeof (xmlTextReaderRead) xmlTextReaderRead__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderRead xmlTextReaderRead__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderReadAttributeValue -extern __typeof (xmlTextReaderReadAttributeValue) xmlTextReaderReadAttributeValue __attribute((alias("xmlTextReaderReadAttributeValue__internal_alias"))); -#else -#ifndef xmlTextReaderReadAttributeValue -extern __typeof (xmlTextReaderReadAttributeValue) xmlTextReaderReadAttributeValue__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderReadAttributeValue xmlTextReaderReadAttributeValue__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderReadState -extern __typeof (xmlTextReaderReadState) xmlTextReaderReadState __attribute((alias("xmlTextReaderReadState__internal_alias"))); -#else -#ifndef xmlTextReaderReadState -extern __typeof (xmlTextReaderReadState) xmlTextReaderReadState__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderReadState xmlTextReaderReadState__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderReadString -extern __typeof (xmlTextReaderReadString) xmlTextReaderReadString __attribute((alias("xmlTextReaderReadString__internal_alias"))); -#else -#ifndef xmlTextReaderReadString -extern __typeof (xmlTextReaderReadString) xmlTextReaderReadString__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderReadString xmlTextReaderReadString__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderSetErrorHandler -extern __typeof (xmlTextReaderSetErrorHandler) xmlTextReaderSetErrorHandler __attribute((alias("xmlTextReaderSetErrorHandler__internal_alias"))); -#else -#ifndef xmlTextReaderSetErrorHandler -extern __typeof (xmlTextReaderSetErrorHandler) xmlTextReaderSetErrorHandler__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderSetErrorHandler xmlTextReaderSetErrorHandler__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderSetParserProp -extern __typeof (xmlTextReaderSetParserProp) xmlTextReaderSetParserProp __attribute((alias("xmlTextReaderSetParserProp__internal_alias"))); -#else -#ifndef xmlTextReaderSetParserProp -extern __typeof (xmlTextReaderSetParserProp) xmlTextReaderSetParserProp__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderSetParserProp xmlTextReaderSetParserProp__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderSetStructuredErrorHandler -extern __typeof (xmlTextReaderSetStructuredErrorHandler) xmlTextReaderSetStructuredErrorHandler __attribute((alias("xmlTextReaderSetStructuredErrorHandler__internal_alias"))); -#else -#ifndef xmlTextReaderSetStructuredErrorHandler -extern __typeof (xmlTextReaderSetStructuredErrorHandler) xmlTextReaderSetStructuredErrorHandler__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderSetStructuredErrorHandler xmlTextReaderSetStructuredErrorHandler__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderSetup -extern __typeof (xmlTextReaderSetup) xmlTextReaderSetup __attribute((alias("xmlTextReaderSetup__internal_alias"))); -#else -#ifndef xmlTextReaderSetup -extern __typeof (xmlTextReaderSetup) xmlTextReaderSetup__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderSetup xmlTextReaderSetup__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderStandalone -extern __typeof (xmlTextReaderStandalone) xmlTextReaderStandalone __attribute((alias("xmlTextReaderStandalone__internal_alias"))); -#else -#ifndef xmlTextReaderStandalone -extern __typeof (xmlTextReaderStandalone) xmlTextReaderStandalone__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderStandalone xmlTextReaderStandalone__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderValue -extern __typeof (xmlTextReaderValue) xmlTextReaderValue __attribute((alias("xmlTextReaderValue__internal_alias"))); -#else -#ifndef xmlTextReaderValue -extern __typeof (xmlTextReaderValue) xmlTextReaderValue__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderValue xmlTextReaderValue__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_READER_ENABLED) -#ifdef bottom_xmlreader -#undef xmlTextReaderXmlLang -extern __typeof (xmlTextReaderXmlLang) xmlTextReaderXmlLang __attribute((alias("xmlTextReaderXmlLang__internal_alias"))); -#else -#ifndef xmlTextReaderXmlLang -extern __typeof (xmlTextReaderXmlLang) xmlTextReaderXmlLang__internal_alias __attribute((visibility("hidden"))); -#define xmlTextReaderXmlLang xmlTextReaderXmlLang__internal_alias -#endif -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefBufferAllocScheme -extern __typeof (xmlThrDefBufferAllocScheme) xmlThrDefBufferAllocScheme __attribute((alias("xmlThrDefBufferAllocScheme__internal_alias"))); -#else -#ifndef xmlThrDefBufferAllocScheme -extern __typeof (xmlThrDefBufferAllocScheme) xmlThrDefBufferAllocScheme__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefBufferAllocScheme xmlThrDefBufferAllocScheme__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefDefaultBufferSize -extern __typeof (xmlThrDefDefaultBufferSize) xmlThrDefDefaultBufferSize __attribute((alias("xmlThrDefDefaultBufferSize__internal_alias"))); -#else -#ifndef xmlThrDefDefaultBufferSize -extern __typeof (xmlThrDefDefaultBufferSize) xmlThrDefDefaultBufferSize__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefDefaultBufferSize xmlThrDefDefaultBufferSize__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefDeregisterNodeDefault -extern __typeof (xmlThrDefDeregisterNodeDefault) xmlThrDefDeregisterNodeDefault __attribute((alias("xmlThrDefDeregisterNodeDefault__internal_alias"))); -#else -#ifndef xmlThrDefDeregisterNodeDefault -extern __typeof (xmlThrDefDeregisterNodeDefault) xmlThrDefDeregisterNodeDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefDeregisterNodeDefault xmlThrDefDeregisterNodeDefault__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefDoValidityCheckingDefaultValue -extern __typeof (xmlThrDefDoValidityCheckingDefaultValue) xmlThrDefDoValidityCheckingDefaultValue __attribute((alias("xmlThrDefDoValidityCheckingDefaultValue__internal_alias"))); -#else -#ifndef xmlThrDefDoValidityCheckingDefaultValue -extern __typeof (xmlThrDefDoValidityCheckingDefaultValue) xmlThrDefDoValidityCheckingDefaultValue__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefDoValidityCheckingDefaultValue xmlThrDefDoValidityCheckingDefaultValue__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefGetWarningsDefaultValue -extern __typeof (xmlThrDefGetWarningsDefaultValue) xmlThrDefGetWarningsDefaultValue __attribute((alias("xmlThrDefGetWarningsDefaultValue__internal_alias"))); -#else -#ifndef xmlThrDefGetWarningsDefaultValue -extern __typeof (xmlThrDefGetWarningsDefaultValue) xmlThrDefGetWarningsDefaultValue__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefGetWarningsDefaultValue xmlThrDefGetWarningsDefaultValue__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefIndentTreeOutput -extern __typeof (xmlThrDefIndentTreeOutput) xmlThrDefIndentTreeOutput __attribute((alias("xmlThrDefIndentTreeOutput__internal_alias"))); -#else -#ifndef xmlThrDefIndentTreeOutput -extern __typeof (xmlThrDefIndentTreeOutput) xmlThrDefIndentTreeOutput__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefIndentTreeOutput xmlThrDefIndentTreeOutput__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefKeepBlanksDefaultValue -extern __typeof (xmlThrDefKeepBlanksDefaultValue) xmlThrDefKeepBlanksDefaultValue __attribute((alias("xmlThrDefKeepBlanksDefaultValue__internal_alias"))); -#else -#ifndef xmlThrDefKeepBlanksDefaultValue -extern __typeof (xmlThrDefKeepBlanksDefaultValue) xmlThrDefKeepBlanksDefaultValue__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefKeepBlanksDefaultValue xmlThrDefKeepBlanksDefaultValue__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefLineNumbersDefaultValue -extern __typeof (xmlThrDefLineNumbersDefaultValue) xmlThrDefLineNumbersDefaultValue __attribute((alias("xmlThrDefLineNumbersDefaultValue__internal_alias"))); -#else -#ifndef xmlThrDefLineNumbersDefaultValue -extern __typeof (xmlThrDefLineNumbersDefaultValue) xmlThrDefLineNumbersDefaultValue__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefLineNumbersDefaultValue xmlThrDefLineNumbersDefaultValue__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefLoadExtDtdDefaultValue -extern __typeof (xmlThrDefLoadExtDtdDefaultValue) xmlThrDefLoadExtDtdDefaultValue __attribute((alias("xmlThrDefLoadExtDtdDefaultValue__internal_alias"))); -#else -#ifndef xmlThrDefLoadExtDtdDefaultValue -extern __typeof (xmlThrDefLoadExtDtdDefaultValue) xmlThrDefLoadExtDtdDefaultValue__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefLoadExtDtdDefaultValue xmlThrDefLoadExtDtdDefaultValue__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefOutputBufferCreateFilenameDefault -extern __typeof (xmlThrDefOutputBufferCreateFilenameDefault) xmlThrDefOutputBufferCreateFilenameDefault __attribute((alias("xmlThrDefOutputBufferCreateFilenameDefault__internal_alias"))); -#else -#ifndef xmlThrDefOutputBufferCreateFilenameDefault -extern __typeof (xmlThrDefOutputBufferCreateFilenameDefault) xmlThrDefOutputBufferCreateFilenameDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefOutputBufferCreateFilenameDefault xmlThrDefOutputBufferCreateFilenameDefault__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefParserDebugEntities -extern __typeof (xmlThrDefParserDebugEntities) xmlThrDefParserDebugEntities __attribute((alias("xmlThrDefParserDebugEntities__internal_alias"))); -#else -#ifndef xmlThrDefParserDebugEntities -extern __typeof (xmlThrDefParserDebugEntities) xmlThrDefParserDebugEntities__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefParserDebugEntities xmlThrDefParserDebugEntities__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefParserInputBufferCreateFilenameDefault -extern __typeof (xmlThrDefParserInputBufferCreateFilenameDefault) xmlThrDefParserInputBufferCreateFilenameDefault __attribute((alias("xmlThrDefParserInputBufferCreateFilenameDefault__internal_alias"))); -#else -#ifndef xmlThrDefParserInputBufferCreateFilenameDefault -extern __typeof (xmlThrDefParserInputBufferCreateFilenameDefault) xmlThrDefParserInputBufferCreateFilenameDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefParserInputBufferCreateFilenameDefault xmlThrDefParserInputBufferCreateFilenameDefault__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefPedanticParserDefaultValue -extern __typeof (xmlThrDefPedanticParserDefaultValue) xmlThrDefPedanticParserDefaultValue __attribute((alias("xmlThrDefPedanticParserDefaultValue__internal_alias"))); -#else -#ifndef xmlThrDefPedanticParserDefaultValue -extern __typeof (xmlThrDefPedanticParserDefaultValue) xmlThrDefPedanticParserDefaultValue__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefPedanticParserDefaultValue xmlThrDefPedanticParserDefaultValue__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefRegisterNodeDefault -extern __typeof (xmlThrDefRegisterNodeDefault) xmlThrDefRegisterNodeDefault __attribute((alias("xmlThrDefRegisterNodeDefault__internal_alias"))); -#else -#ifndef xmlThrDefRegisterNodeDefault -extern __typeof (xmlThrDefRegisterNodeDefault) xmlThrDefRegisterNodeDefault__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefRegisterNodeDefault xmlThrDefRegisterNodeDefault__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefSaveNoEmptyTags -extern __typeof (xmlThrDefSaveNoEmptyTags) xmlThrDefSaveNoEmptyTags __attribute((alias("xmlThrDefSaveNoEmptyTags__internal_alias"))); -#else -#ifndef xmlThrDefSaveNoEmptyTags -extern __typeof (xmlThrDefSaveNoEmptyTags) xmlThrDefSaveNoEmptyTags__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefSaveNoEmptyTags xmlThrDefSaveNoEmptyTags__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefSetGenericErrorFunc -extern __typeof (xmlThrDefSetGenericErrorFunc) xmlThrDefSetGenericErrorFunc __attribute((alias("xmlThrDefSetGenericErrorFunc__internal_alias"))); -#else -#ifndef xmlThrDefSetGenericErrorFunc -extern __typeof (xmlThrDefSetGenericErrorFunc) xmlThrDefSetGenericErrorFunc__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefSetGenericErrorFunc xmlThrDefSetGenericErrorFunc__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefSetStructuredErrorFunc -extern __typeof (xmlThrDefSetStructuredErrorFunc) xmlThrDefSetStructuredErrorFunc __attribute((alias("xmlThrDefSetStructuredErrorFunc__internal_alias"))); -#else -#ifndef xmlThrDefSetStructuredErrorFunc -extern __typeof (xmlThrDefSetStructuredErrorFunc) xmlThrDefSetStructuredErrorFunc__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefSetStructuredErrorFunc xmlThrDefSetStructuredErrorFunc__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefSubstituteEntitiesDefaultValue -extern __typeof (xmlThrDefSubstituteEntitiesDefaultValue) xmlThrDefSubstituteEntitiesDefaultValue __attribute((alias("xmlThrDefSubstituteEntitiesDefaultValue__internal_alias"))); -#else -#ifndef xmlThrDefSubstituteEntitiesDefaultValue -extern __typeof (xmlThrDefSubstituteEntitiesDefaultValue) xmlThrDefSubstituteEntitiesDefaultValue__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefSubstituteEntitiesDefaultValue xmlThrDefSubstituteEntitiesDefaultValue__internal_alias -#endif -#endif - -#ifdef bottom_globals -#undef xmlThrDefTreeIndentString -extern __typeof (xmlThrDefTreeIndentString) xmlThrDefTreeIndentString __attribute((alias("xmlThrDefTreeIndentString__internal_alias"))); -#else -#ifndef xmlThrDefTreeIndentString -extern __typeof (xmlThrDefTreeIndentString) xmlThrDefTreeIndentString__internal_alias __attribute((visibility("hidden"))); -#define xmlThrDefTreeIndentString xmlThrDefTreeIndentString__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlURIEscape -extern __typeof (xmlURIEscape) xmlURIEscape __attribute((alias("xmlURIEscape__internal_alias"))); -#else -#ifndef xmlURIEscape -extern __typeof (xmlURIEscape) xmlURIEscape__internal_alias __attribute((visibility("hidden"))); -#define xmlURIEscape xmlURIEscape__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlURIEscapeStr -extern __typeof (xmlURIEscapeStr) xmlURIEscapeStr __attribute((alias("xmlURIEscapeStr__internal_alias"))); -#else -#ifndef xmlURIEscapeStr -extern __typeof (xmlURIEscapeStr) xmlURIEscapeStr__internal_alias __attribute((visibility("hidden"))); -#define xmlURIEscapeStr xmlURIEscapeStr__internal_alias -#endif -#endif - -#ifdef bottom_uri -#undef xmlURIUnescapeString -extern __typeof (xmlURIUnescapeString) xmlURIUnescapeString __attribute((alias("xmlURIUnescapeString__internal_alias"))); -#else -#ifndef xmlURIUnescapeString -extern __typeof (xmlURIUnescapeString) xmlURIUnescapeString__internal_alias __attribute((visibility("hidden"))); -#define xmlURIUnescapeString xmlURIUnescapeString__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlUTF8Charcmp -extern __typeof (xmlUTF8Charcmp) xmlUTF8Charcmp __attribute((alias("xmlUTF8Charcmp__internal_alias"))); -#else -#ifndef xmlUTF8Charcmp -extern __typeof (xmlUTF8Charcmp) xmlUTF8Charcmp__internal_alias __attribute((visibility("hidden"))); -#define xmlUTF8Charcmp xmlUTF8Charcmp__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlUTF8Size -extern __typeof (xmlUTF8Size) xmlUTF8Size __attribute((alias("xmlUTF8Size__internal_alias"))); -#else -#ifndef xmlUTF8Size -extern __typeof (xmlUTF8Size) xmlUTF8Size__internal_alias __attribute((visibility("hidden"))); -#define xmlUTF8Size xmlUTF8Size__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlUTF8Strlen -extern __typeof (xmlUTF8Strlen) xmlUTF8Strlen __attribute((alias("xmlUTF8Strlen__internal_alias"))); -#else -#ifndef xmlUTF8Strlen -extern __typeof (xmlUTF8Strlen) xmlUTF8Strlen__internal_alias __attribute((visibility("hidden"))); -#define xmlUTF8Strlen xmlUTF8Strlen__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlUTF8Strloc -extern __typeof (xmlUTF8Strloc) xmlUTF8Strloc __attribute((alias("xmlUTF8Strloc__internal_alias"))); -#else -#ifndef xmlUTF8Strloc -extern __typeof (xmlUTF8Strloc) xmlUTF8Strloc__internal_alias __attribute((visibility("hidden"))); -#define xmlUTF8Strloc xmlUTF8Strloc__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlUTF8Strndup -extern __typeof (xmlUTF8Strndup) xmlUTF8Strndup __attribute((alias("xmlUTF8Strndup__internal_alias"))); -#else -#ifndef xmlUTF8Strndup -extern __typeof (xmlUTF8Strndup) xmlUTF8Strndup__internal_alias __attribute((visibility("hidden"))); -#define xmlUTF8Strndup xmlUTF8Strndup__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlUTF8Strpos -extern __typeof (xmlUTF8Strpos) xmlUTF8Strpos __attribute((alias("xmlUTF8Strpos__internal_alias"))); -#else -#ifndef xmlUTF8Strpos -extern __typeof (xmlUTF8Strpos) xmlUTF8Strpos__internal_alias __attribute((visibility("hidden"))); -#define xmlUTF8Strpos xmlUTF8Strpos__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlUTF8Strsize -extern __typeof (xmlUTF8Strsize) xmlUTF8Strsize __attribute((alias("xmlUTF8Strsize__internal_alias"))); -#else -#ifndef xmlUTF8Strsize -extern __typeof (xmlUTF8Strsize) xmlUTF8Strsize__internal_alias __attribute((visibility("hidden"))); -#define xmlUTF8Strsize xmlUTF8Strsize__internal_alias -#endif -#endif - -#ifdef bottom_xmlstring -#undef xmlUTF8Strsub -extern __typeof (xmlUTF8Strsub) xmlUTF8Strsub __attribute((alias("xmlUTF8Strsub__internal_alias"))); -#else -#ifndef xmlUTF8Strsub -extern __typeof (xmlUTF8Strsub) xmlUTF8Strsub__internal_alias __attribute((visibility("hidden"))); -#define xmlUTF8Strsub xmlUTF8Strsub__internal_alias -#endif -#endif - -#ifdef bottom_tree -#undef xmlUnlinkNode -extern __typeof (xmlUnlinkNode) xmlUnlinkNode __attribute((alias("xmlUnlinkNode__internal_alias"))); -#else -#ifndef xmlUnlinkNode -extern __typeof (xmlUnlinkNode) xmlUnlinkNode__internal_alias __attribute((visibility("hidden"))); -#define xmlUnlinkNode xmlUnlinkNode__internal_alias -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlUnsetNsProp -extern __typeof (xmlUnsetNsProp) xmlUnsetNsProp __attribute((alias("xmlUnsetNsProp__internal_alias"))); -#else -#ifndef xmlUnsetNsProp -extern __typeof (xmlUnsetNsProp) xmlUnsetNsProp__internal_alias __attribute((visibility("hidden"))); -#define xmlUnsetNsProp xmlUnsetNsProp__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlUnsetProp -extern __typeof (xmlUnsetProp) xmlUnsetProp __attribute((alias("xmlUnsetProp__internal_alias"))); -#else -#ifndef xmlUnsetProp -extern __typeof (xmlUnsetProp) xmlUnsetProp__internal_alias __attribute((visibility("hidden"))); -#define xmlUnsetProp xmlUnsetProp__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlValidateNCName -extern __typeof (xmlValidateNCName) xmlValidateNCName __attribute((alias("xmlValidateNCName__internal_alias"))); -#else -#ifndef xmlValidateNCName -extern __typeof (xmlValidateNCName) xmlValidateNCName__internal_alias __attribute((visibility("hidden"))); -#define xmlValidateNCName xmlValidateNCName__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlValidateNMToken -extern __typeof (xmlValidateNMToken) xmlValidateNMToken __attribute((alias("xmlValidateNMToken__internal_alias"))); -#else -#ifndef xmlValidateNMToken -extern __typeof (xmlValidateNMToken) xmlValidateNMToken__internal_alias __attribute((visibility("hidden"))); -#define xmlValidateNMToken xmlValidateNMToken__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlValidateName -extern __typeof (xmlValidateName) xmlValidateName __attribute((alias("xmlValidateName__internal_alias"))); -#else -#ifndef xmlValidateName -extern __typeof (xmlValidateName) xmlValidateName__internal_alias __attribute((visibility("hidden"))); -#define xmlValidateName xmlValidateName__internal_alias -#endif -#endif -#endif - -#if defined(LIBXML_TREE_ENABLED) -#ifdef bottom_tree -#undef xmlValidateQName -extern __typeof (xmlValidateQName) xmlValidateQName __attribute((alias("xmlValidateQName__internal_alias"))); -#else -#ifndef xmlValidateQName -extern __typeof (xmlValidateQName) xmlValidateQName__internal_alias __attribute((visibility("hidden"))); -#define xmlValidateQName xmlValidateQName__internal_alias -#endif -#endif -#endif - -#endif -#endif -#endif -#endif -#endif - diff --git a/deps/libxml2/encoding.c b/deps/libxml2/encoding.c deleted file mode 100644 index 3fc6a8dbd9..0000000000 --- a/deps/libxml2/encoding.c +++ /dev/null @@ -1,2588 +0,0 @@ -/* - * encoding.c : implements the encoding conversion functions needed for XML - * - * Related specs: - * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies - * rfc2781 UTF-16, an encoding of ISO 10646, P. Hoffman, F. Yergeau - * [ISO-10646] UTF-8 and UTF-16 in Annexes - * [ISO-8859-1] ISO Latin-1 characters codes. - * [UNICODE] The Unicode Consortium, "The Unicode Standard -- - * Worldwide Character Encoding -- Version 1.0", Addison- - * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is - * described in Unicode Technical Report #4. - * [US-ASCII] Coded Character Set--7-bit American Standard Code for - * Information Interchange, ANSI X3.4-1986. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - * - * Original code for IsoLatin1 and UTF-16 by "Martin J. Duerst" - */ - -#define IN_LIBXML -#include "libxml.h" - -#include - -#ifdef HAVE_CTYPE_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#include -#include -#include -#include - -static xmlCharEncodingHandlerPtr xmlUTF16LEHandler = NULL; -static xmlCharEncodingHandlerPtr xmlUTF16BEHandler = NULL; - -typedef struct _xmlCharEncodingAlias xmlCharEncodingAlias; -typedef xmlCharEncodingAlias *xmlCharEncodingAliasPtr; -struct _xmlCharEncodingAlias { - const char *name; - const char *alias; -}; - -static xmlCharEncodingAliasPtr xmlCharEncodingAliases = NULL; -static int xmlCharEncodingAliasesNb = 0; -static int xmlCharEncodingAliasesMax = 0; - -#ifdef LIBXML_ISO8859X_ENABLED -static void xmlRegisterCharEncodingHandlersISO8859x (void); -#endif - -static int xmlLittleEndian = 1; - -/** - * xmlEncodingErrMemory: - * @extra: extra informations - * - * Handle an out of memory condition - */ -static void -xmlEncodingErrMemory(const char *extra) -{ - __xmlSimpleError(XML_FROM_I18N, XML_ERR_NO_MEMORY, NULL, NULL, extra); -} - -/** - * xmlErrEncoding: - * @error: the error number - * @msg: the error message - * - * n encoding error - */ -static void -xmlEncodingErr(xmlParserErrors error, const char *msg, const char *val) -{ - __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, - XML_FROM_I18N, error, XML_ERR_FATAL, - NULL, 0, val, NULL, NULL, 0, 0, msg, val); -} - -/************************************************************************ - * * - * Conversions To/From UTF8 encoding * - * * - ************************************************************************/ - -/** - * asciiToUTF8: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of ASCII chars - * @inlen: the length of @in - * - * Take a block of ASCII chars in and try to convert it to an UTF-8 - * block of chars out. - * Returns 0 if success, or -1 otherwise - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. - */ -static int -asciiToUTF8(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - unsigned char* outstart = out; - const unsigned char* base = in; - const unsigned char* processed = in; - unsigned char* outend = out + *outlen; - const unsigned char* inend; - unsigned int c; - - inend = in + (*inlen); - while ((in < inend) && (out - outstart + 5 < *outlen)) { - c= *in++; - - if (out >= outend) - break; - if (c < 0x80) { - *out++ = c; - } else { - *outlen = out - outstart; - *inlen = processed - base; - return(-1); - } - - processed = (const unsigned char*) in; - } - *outlen = out - outstart; - *inlen = processed - base; - return(*outlen); -} - -/** - * isolat1ToUTF8: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of ISO Latin 1 chars - * @inlen: the length of @in - * - * Take a block of ISO Latin 1 chars in and try to convert it to an UTF-8 - * block of chars out. - * Returns the number of bytes written if success, or -1 otherwise - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictable. - * The value of @outlen after return is the number of octets consumed. - */ -int -isolat1ToUTF8(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - unsigned char* outstart = out; - const unsigned char* base = in; - unsigned char* outend; - const unsigned char* inend; - const unsigned char* instop; - - if ((out == NULL) || (in == NULL) || (outlen == NULL) || (inlen == NULL)) - return(-1); - - outend = out + *outlen; - inend = in + (*inlen); - instop = inend; - - while ((in < inend) && (out < outend - 1)) { - if (*in >= 0x80) { - *out++ = (((*in) >> 6) & 0x1F) | 0xC0; - *out++ = ((*in) & 0x3F) | 0x80; - ++in; - } - if ((instop - in) > (outend - out)) instop = in + (outend - out); - while ((in < instop) && (*in < 0x80)) { - *out++ = *in++; - } - } - if ((in < inend) && (out < outend) && (*in < 0x80)) { - *out++ = *in++; - } - *outlen = out - outstart; - *inlen = in - base; - return(*outlen); -} - -/** - * UTF8ToUTF8: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @inb: a pointer to an array of UTF-8 chars - * @inlenb: the length of @in in UTF-8 chars - * - * No op copy operation for UTF8 handling. - * - * Returns the number of bytes written, or -1 if lack of space. - * The value of *inlen after return is the number of octets consumed - * if the return value is positive, else unpredictable. - */ -static int -UTF8ToUTF8(unsigned char* out, int *outlen, - const unsigned char* inb, int *inlenb) -{ - int len; - - if ((out == NULL) || (inb == NULL) || (outlen == NULL) || (inlenb == NULL)) - return(-1); - if (*outlen > *inlenb) { - len = *inlenb; - } else { - len = *outlen; - } - if (len < 0) - return(-1); - - memcpy(out, inb, len); - - *outlen = len; - *inlenb = len; - return(*outlen); -} - -/** - * UTF16LEToUTF8: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @inb: a pointer to an array of UTF-16LE passwd as a byte array - * @inlenb: the length of @in in UTF-16LE chars - * - * Take a block of UTF-16LE ushorts in and try to convert it to an UTF-8 - * block of chars out. This function assumes the endian property - * is the same between the native type of this machine and the - * inputed one. - * - * Returns the number of bytes written, or -1 if lack of space, or -2 - * if the transcoding fails (if *in is not a valid utf16 string) - * The value of *inlen after return is the number of octets consumed - * if the return value is positive, else unpredictable. - */ -static int -UTF16LEToUTF8(unsigned char* out, int *outlen, - const unsigned char* inb, int *inlenb) -{ - unsigned char* outstart = out; - const unsigned char* processed = inb; - unsigned char* outend = out + *outlen; - unsigned short* in = (unsigned short*) inb; - unsigned short* inend; - unsigned int c, d, inlen; - unsigned char *tmp; - int bits; - - if ((*inlenb % 2) == 1) - (*inlenb)--; - inlen = *inlenb / 2; - inend = in + inlen; - while ((in < inend) && (out - outstart + 5 < *outlen)) { - if (xmlLittleEndian) { - c= *in++; - } else { - tmp = (unsigned char *) in; - c = *tmp++; - c = c | (((unsigned int)*tmp) << 8); - in++; - } - if ((c & 0xFC00) == 0xD800) { /* surrogates */ - if (in >= inend) { /* (in > inend) shouldn't happens */ - break; - } - if (xmlLittleEndian) { - d = *in++; - } else { - tmp = (unsigned char *) in; - d = *tmp++; - d = d | (((unsigned int)*tmp) << 8); - in++; - } - if ((d & 0xFC00) == 0xDC00) { - c &= 0x03FF; - c <<= 10; - c |= d & 0x03FF; - c += 0x10000; - } - else { - *outlen = out - outstart; - *inlenb = processed - inb; - return(-2); - } - } - - /* assertion: c is a single UTF-4 value */ - if (out >= outend) - break; - if (c < 0x80) { *out++= c; bits= -6; } - else if (c < 0x800) { *out++= ((c >> 6) & 0x1F) | 0xC0; bits= 0; } - else if (c < 0x10000) { *out++= ((c >> 12) & 0x0F) | 0xE0; bits= 6; } - else { *out++= ((c >> 18) & 0x07) | 0xF0; bits= 12; } - - for ( ; bits >= 0; bits-= 6) { - if (out >= outend) - break; - *out++= ((c >> bits) & 0x3F) | 0x80; - } - processed = (const unsigned char*) in; - } - *outlen = out - outstart; - *inlenb = processed - inb; - return(*outlen); -} - -/** - * UTF16BEToUTF8: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @inb: a pointer to an array of UTF-16 passed as a byte array - * @inlenb: the length of @in in UTF-16 chars - * - * Take a block of UTF-16 ushorts in and try to convert it to an UTF-8 - * block of chars out. This function assumes the endian property - * is the same between the native type of this machine and the - * inputed one. - * - * Returns the number of bytes written, or -1 if lack of space, or -2 - * if the transcoding fails (if *in is not a valid utf16 string) - * The value of *inlen after return is the number of octets consumed - * if the return value is positive, else unpredictable. - */ -static int -UTF16BEToUTF8(unsigned char* out, int *outlen, - const unsigned char* inb, int *inlenb) -{ - unsigned char* outstart = out; - const unsigned char* processed = inb; - unsigned char* outend = out + *outlen; - unsigned short* in = (unsigned short*) inb; - unsigned short* inend; - unsigned int c, d, inlen; - unsigned char *tmp; - int bits; - - if ((*inlenb % 2) == 1) - (*inlenb)--; - inlen = *inlenb / 2; - inend= in + inlen; - while (in < inend) { - if (xmlLittleEndian) { - tmp = (unsigned char *) in; - c = *tmp++; - c = c << 8; - c = c | (unsigned int) *tmp; - in++; - } else { - c= *in++; - } - if ((c & 0xFC00) == 0xD800) { /* surrogates */ - if (in >= inend) { /* (in > inend) shouldn't happens */ - *outlen = out - outstart; - *inlenb = processed - inb; - return(-2); - } - if (xmlLittleEndian) { - tmp = (unsigned char *) in; - d = *tmp++; - d = d << 8; - d = d | (unsigned int) *tmp; - in++; - } else { - d= *in++; - } - if ((d & 0xFC00) == 0xDC00) { - c &= 0x03FF; - c <<= 10; - c |= d & 0x03FF; - c += 0x10000; - } - else { - *outlen = out - outstart; - *inlenb = processed - inb; - return(-2); - } - } - - /* assertion: c is a single UTF-4 value */ - if (out >= outend) - break; - if (c < 0x80) { *out++= c; bits= -6; } - else if (c < 0x800) { *out++= ((c >> 6) & 0x1F) | 0xC0; bits= 0; } - else if (c < 0x10000) { *out++= ((c >> 12) & 0x0F) | 0xE0; bits= 6; } - else { *out++= ((c >> 18) & 0x07) | 0xF0; bits= 12; } - - for ( ; bits >= 0; bits-= 6) { - if (out >= outend) - break; - *out++= ((c >> bits) & 0x3F) | 0x80; - } - processed = (const unsigned char*) in; - } - *outlen = out - outstart; - *inlenb = processed - inb; - return(*outlen); -} - -/************************************************************************ - * * - * Generic encoding handling routines * - * * - ************************************************************************/ - -/** - * xmlDetectCharEncoding: - * @in: a pointer to the first bytes of the XML entity, must be at least - * 2 bytes long (at least 4 if encoding is UTF4 variant). - * @len: pointer to the length of the buffer - * - * Guess the encoding of the entity using the first bytes of the entity content - * according to the non-normative appendix F of the XML-1.0 recommendation. - * - * Returns one of the XML_CHAR_ENCODING_... values. - */ -xmlCharEncoding -xmlDetectCharEncoding(const unsigned char* in, int len) -{ - if (in == NULL) - return(XML_CHAR_ENCODING_NONE); - if (len >= 4) { - if ((in[0] == 0x00) && (in[1] == 0x00) && - (in[2] == 0x00) && (in[3] == 0x3C)) - return(XML_CHAR_ENCODING_UCS4BE); - if ((in[0] == 0x3C) && (in[1] == 0x00) && - (in[2] == 0x00) && (in[3] == 0x00)) - return(XML_CHAR_ENCODING_UCS4LE); - if ((in[0] == 0x00) && (in[1] == 0x00) && - (in[2] == 0x3C) && (in[3] == 0x00)) - return(XML_CHAR_ENCODING_UCS4_2143); - if ((in[0] == 0x00) && (in[1] == 0x3C) && - (in[2] == 0x00) && (in[3] == 0x00)) - return(XML_CHAR_ENCODING_UCS4_3412); - if ((in[0] == 0x4C) && (in[1] == 0x6F) && - (in[2] == 0xA7) && (in[3] == 0x94)) - return(XML_CHAR_ENCODING_EBCDIC); - if ((in[0] == 0x3C) && (in[1] == 0x3F) && - (in[2] == 0x78) && (in[3] == 0x6D)) - return(XML_CHAR_ENCODING_UTF8); - /* - * Although not part of the recommendation, we also - * attempt an "auto-recognition" of UTF-16LE and - * UTF-16BE encodings. - */ - if ((in[0] == 0x3C) && (in[1] == 0x00) && - (in[2] == 0x3F) && (in[3] == 0x00)) - return(XML_CHAR_ENCODING_UTF16LE); - if ((in[0] == 0x00) && (in[1] == 0x3C) && - (in[2] == 0x00) && (in[3] == 0x3F)) - return(XML_CHAR_ENCODING_UTF16BE); - } - if (len >= 3) { - /* - * Errata on XML-1.0 June 20 2001 - * We now allow an UTF8 encoded BOM - */ - if ((in[0] == 0xEF) && (in[1] == 0xBB) && - (in[2] == 0xBF)) - return(XML_CHAR_ENCODING_UTF8); - } - /* For UTF-16 we can recognize by the BOM */ - if (len >= 2) { - if ((in[0] == 0xFE) && (in[1] == 0xFF)) - return(XML_CHAR_ENCODING_UTF16BE); - if ((in[0] == 0xFF) && (in[1] == 0xFE)) - return(XML_CHAR_ENCODING_UTF16LE); - } - return(XML_CHAR_ENCODING_NONE); -} - -/** - * xmlCleanupEncodingAliases: - * - * Unregisters all aliases - */ -void -xmlCleanupEncodingAliases(void) { - int i; - - if (xmlCharEncodingAliases == NULL) - return; - - for (i = 0;i < xmlCharEncodingAliasesNb;i++) { - if (xmlCharEncodingAliases[i].name != NULL) - xmlFree((char *) xmlCharEncodingAliases[i].name); - if (xmlCharEncodingAliases[i].alias != NULL) - xmlFree((char *) xmlCharEncodingAliases[i].alias); - } - xmlCharEncodingAliasesNb = 0; - xmlCharEncodingAliasesMax = 0; - xmlFree(xmlCharEncodingAliases); - xmlCharEncodingAliases = NULL; -} - -/** - * xmlGetEncodingAlias: - * @alias: the alias name as parsed, in UTF-8 format (ASCII actually) - * - * Lookup an encoding name for the given alias. - * - * Returns NULL if not found, otherwise the original name - */ -const char * -xmlGetEncodingAlias(const char *alias) { - int i; - char upper[100]; - - if (alias == NULL) - return(NULL); - - if (xmlCharEncodingAliases == NULL) - return(NULL); - - for (i = 0;i < 99;i++) { - upper[i] = toupper(alias[i]); - if (upper[i] == 0) break; - } - upper[i] = 0; - - /* - * Walk down the list looking for a definition of the alias - */ - for (i = 0;i < xmlCharEncodingAliasesNb;i++) { - if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) { - return(xmlCharEncodingAliases[i].name); - } - } - return(NULL); -} - -/** - * xmlAddEncodingAlias: - * @name: the encoding name as parsed, in UTF-8 format (ASCII actually) - * @alias: the alias name as parsed, in UTF-8 format (ASCII actually) - * - * Registers an alias @alias for an encoding named @name. Existing alias - * will be overwritten. - * - * Returns 0 in case of success, -1 in case of error - */ -int -xmlAddEncodingAlias(const char *name, const char *alias) { - int i; - char upper[100]; - - if ((name == NULL) || (alias == NULL)) - return(-1); - - for (i = 0;i < 99;i++) { - upper[i] = toupper(alias[i]); - if (upper[i] == 0) break; - } - upper[i] = 0; - - if (xmlCharEncodingAliases == NULL) { - xmlCharEncodingAliasesNb = 0; - xmlCharEncodingAliasesMax = 20; - xmlCharEncodingAliases = (xmlCharEncodingAliasPtr) - xmlMalloc(xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias)); - if (xmlCharEncodingAliases == NULL) - return(-1); - } else if (xmlCharEncodingAliasesNb >= xmlCharEncodingAliasesMax) { - xmlCharEncodingAliasesMax *= 2; - xmlCharEncodingAliases = (xmlCharEncodingAliasPtr) - xmlRealloc(xmlCharEncodingAliases, - xmlCharEncodingAliasesMax * sizeof(xmlCharEncodingAlias)); - } - /* - * Walk down the list looking for a definition of the alias - */ - for (i = 0;i < xmlCharEncodingAliasesNb;i++) { - if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) { - /* - * Replace the definition. - */ - xmlFree((char *) xmlCharEncodingAliases[i].name); - xmlCharEncodingAliases[i].name = xmlMemStrdup(name); - return(0); - } - } - /* - * Add the definition - */ - xmlCharEncodingAliases[xmlCharEncodingAliasesNb].name = xmlMemStrdup(name); - xmlCharEncodingAliases[xmlCharEncodingAliasesNb].alias = xmlMemStrdup(upper); - xmlCharEncodingAliasesNb++; - return(0); -} - -/** - * xmlDelEncodingAlias: - * @alias: the alias name as parsed, in UTF-8 format (ASCII actually) - * - * Unregisters an encoding alias @alias - * - * Returns 0 in case of success, -1 in case of error - */ -int -xmlDelEncodingAlias(const char *alias) { - int i; - - if (alias == NULL) - return(-1); - - if (xmlCharEncodingAliases == NULL) - return(-1); - /* - * Walk down the list looking for a definition of the alias - */ - for (i = 0;i < xmlCharEncodingAliasesNb;i++) { - if (!strcmp(xmlCharEncodingAliases[i].alias, alias)) { - xmlFree((char *) xmlCharEncodingAliases[i].name); - xmlFree((char *) xmlCharEncodingAliases[i].alias); - xmlCharEncodingAliasesNb--; - memmove(&xmlCharEncodingAliases[i], &xmlCharEncodingAliases[i + 1], - sizeof(xmlCharEncodingAlias) * (xmlCharEncodingAliasesNb - i)); - return(0); - } - } - return(-1); -} - -/** - * xmlParseCharEncoding: - * @name: the encoding name as parsed, in UTF-8 format (ASCII actually) - * - * Compare the string to the encoding schemes already known. Note - * that the comparison is case insensitive accordingly to the section - * [XML] 4.3.3 Character Encoding in Entities. - * - * Returns one of the XML_CHAR_ENCODING_... values or XML_CHAR_ENCODING_NONE - * if not recognized. - */ -xmlCharEncoding -xmlParseCharEncoding(const char* name) -{ - const char *alias; - char upper[500]; - int i; - - if (name == NULL) - return(XML_CHAR_ENCODING_NONE); - - /* - * Do the alias resolution - */ - alias = xmlGetEncodingAlias(name); - if (alias != NULL) - name = alias; - - for (i = 0;i < 499;i++) { - upper[i] = toupper(name[i]); - if (upper[i] == 0) break; - } - upper[i] = 0; - - if (!strcmp(upper, "")) return(XML_CHAR_ENCODING_NONE); - if (!strcmp(upper, "UTF-8")) return(XML_CHAR_ENCODING_UTF8); - if (!strcmp(upper, "UTF8")) return(XML_CHAR_ENCODING_UTF8); - - /* - * NOTE: if we were able to parse this, the endianness of UTF16 is - * already found and in use - */ - if (!strcmp(upper, "UTF-16")) return(XML_CHAR_ENCODING_UTF16LE); - if (!strcmp(upper, "UTF16")) return(XML_CHAR_ENCODING_UTF16LE); - - if (!strcmp(upper, "ISO-10646-UCS-2")) return(XML_CHAR_ENCODING_UCS2); - if (!strcmp(upper, "UCS-2")) return(XML_CHAR_ENCODING_UCS2); - if (!strcmp(upper, "UCS2")) return(XML_CHAR_ENCODING_UCS2); - - /* - * NOTE: if we were able to parse this, the endianness of UCS4 is - * already found and in use - */ - if (!strcmp(upper, "ISO-10646-UCS-4")) return(XML_CHAR_ENCODING_UCS4LE); - if (!strcmp(upper, "UCS-4")) return(XML_CHAR_ENCODING_UCS4LE); - if (!strcmp(upper, "UCS4")) return(XML_CHAR_ENCODING_UCS4LE); - - - if (!strcmp(upper, "ISO-8859-1")) return(XML_CHAR_ENCODING_8859_1); - if (!strcmp(upper, "ISO-LATIN-1")) return(XML_CHAR_ENCODING_8859_1); - if (!strcmp(upper, "ISO LATIN 1")) return(XML_CHAR_ENCODING_8859_1); - - if (!strcmp(upper, "ISO-8859-2")) return(XML_CHAR_ENCODING_8859_2); - if (!strcmp(upper, "ISO-LATIN-2")) return(XML_CHAR_ENCODING_8859_2); - if (!strcmp(upper, "ISO LATIN 2")) return(XML_CHAR_ENCODING_8859_2); - - if (!strcmp(upper, "ISO-8859-3")) return(XML_CHAR_ENCODING_8859_3); - if (!strcmp(upper, "ISO-8859-4")) return(XML_CHAR_ENCODING_8859_4); - if (!strcmp(upper, "ISO-8859-5")) return(XML_CHAR_ENCODING_8859_5); - if (!strcmp(upper, "ISO-8859-6")) return(XML_CHAR_ENCODING_8859_6); - if (!strcmp(upper, "ISO-8859-7")) return(XML_CHAR_ENCODING_8859_7); - if (!strcmp(upper, "ISO-8859-8")) return(XML_CHAR_ENCODING_8859_8); - if (!strcmp(upper, "ISO-8859-9")) return(XML_CHAR_ENCODING_8859_9); - - if (!strcmp(upper, "ISO-2022-JP")) return(XML_CHAR_ENCODING_2022_JP); - if (!strcmp(upper, "SHIFT_JIS")) return(XML_CHAR_ENCODING_SHIFT_JIS); - if (!strcmp(upper, "EUC-JP")) return(XML_CHAR_ENCODING_EUC_JP); - - return(XML_CHAR_ENCODING_ERROR); -} - -/** - * xmlGetCharEncodingName: - * @enc: the encoding - * - * The "canonical" name for XML encoding. - * C.f. http://www.w3.org/TR/REC-xml#charencoding - * Section 4.3.3 Character Encoding in Entities - * - * Returns the canonical name for the given encoding - */ - -const char* -xmlGetCharEncodingName(xmlCharEncoding enc) { - switch (enc) { - case XML_CHAR_ENCODING_ERROR: - return(NULL); - case XML_CHAR_ENCODING_NONE: - return(NULL); - case XML_CHAR_ENCODING_UTF8: - return("UTF-8"); - case XML_CHAR_ENCODING_UTF16LE: - return("UTF-16"); - case XML_CHAR_ENCODING_UTF16BE: - return("UTF-16"); - case XML_CHAR_ENCODING_EBCDIC: - return("EBCDIC"); - case XML_CHAR_ENCODING_UCS4LE: - return("ISO-10646-UCS-4"); - case XML_CHAR_ENCODING_UCS4BE: - return("ISO-10646-UCS-4"); - case XML_CHAR_ENCODING_UCS4_2143: - return("ISO-10646-UCS-4"); - case XML_CHAR_ENCODING_UCS4_3412: - return("ISO-10646-UCS-4"); - case XML_CHAR_ENCODING_UCS2: - return("ISO-10646-UCS-2"); - case XML_CHAR_ENCODING_8859_1: - return("ISO-8859-1"); - case XML_CHAR_ENCODING_8859_2: - return("ISO-8859-2"); - case XML_CHAR_ENCODING_8859_3: - return("ISO-8859-3"); - case XML_CHAR_ENCODING_8859_4: - return("ISO-8859-4"); - case XML_CHAR_ENCODING_8859_5: - return("ISO-8859-5"); - case XML_CHAR_ENCODING_8859_6: - return("ISO-8859-6"); - case XML_CHAR_ENCODING_8859_7: - return("ISO-8859-7"); - case XML_CHAR_ENCODING_8859_8: - return("ISO-8859-8"); - case XML_CHAR_ENCODING_8859_9: - return("ISO-8859-9"); - case XML_CHAR_ENCODING_2022_JP: - return("ISO-2022-JP"); - case XML_CHAR_ENCODING_SHIFT_JIS: - return("Shift-JIS"); - case XML_CHAR_ENCODING_EUC_JP: - return("EUC-JP"); - case XML_CHAR_ENCODING_ASCII: - return(NULL); - } - return(NULL); -} - -/************************************************************************ - * * - * Char encoding handlers * - * * - ************************************************************************/ - - -/* the size should be growable, but it's not a big deal ... */ -#define MAX_ENCODING_HANDLERS 50 -static xmlCharEncodingHandlerPtr *handlers = NULL; -static int nbCharEncodingHandler = 0; - -/* - * The default is UTF-8 for XML, that's also the default used for the - * parser internals, so the default encoding handler is NULL - */ - -static xmlCharEncodingHandlerPtr xmlDefaultCharEncodingHandler = NULL; - -/** - * xmlNewCharEncodingHandler: - * @name: the encoding name, in UTF-8 format (ASCII actually) - * @input: the xmlCharEncodingInputFunc to read that encoding - * @output: the xmlCharEncodingOutputFunc to write that encoding - * - * Create and registers an xmlCharEncodingHandler. - * - * Returns the xmlCharEncodingHandlerPtr created (or NULL in case of error). - */ -xmlCharEncodingHandlerPtr -xmlNewCharEncodingHandler(const char *name, - xmlCharEncodingInputFunc input, - xmlCharEncodingOutputFunc output) { - xmlCharEncodingHandlerPtr handler; - const char *alias; - char upper[500]; - int i; - char *up = NULL; - - /* - * Do the alias resolution - */ - alias = xmlGetEncodingAlias(name); - if (alias != NULL) - name = alias; - - /* - * Keep only the uppercase version of the encoding. - */ - if (name == NULL) { - xmlEncodingErr(XML_I18N_NO_NAME, - "xmlNewCharEncodingHandler : no name !\n", NULL); - return(NULL); - } - for (i = 0;i < 499;i++) { - upper[i] = toupper(name[i]); - if (upper[i] == 0) break; - } - upper[i] = 0; - up = xmlMemStrdup(upper); - if (up == NULL) { - xmlEncodingErrMemory("xmlNewCharEncodingHandler : out of memory !\n"); - return(NULL); - } - - /* - * allocate and fill-up an handler block. - */ - handler = (xmlCharEncodingHandlerPtr) - xmlMalloc(sizeof(xmlCharEncodingHandler)); - if (handler == NULL) { - xmlFree(up); - xmlEncodingErrMemory("xmlNewCharEncodingHandler : out of memory !\n"); - return(NULL); - } - memset(handler, 0, sizeof(xmlCharEncodingHandler)); - handler->input = input; - handler->output = output; - handler->name = up; - - /* - * registers and returns the handler. - */ - xmlRegisterCharEncodingHandler(handler); - return(handler); -} - -/** - * xmlInitCharEncodingHandlers: - * - * Initialize the char encoding support, it registers the default - * encoding supported. - * NOTE: while public, this function usually doesn't need to be called - * in normal processing. - */ -void -xmlInitCharEncodingHandlers(void) { - unsigned short int tst = 0x1234; - unsigned char *ptr = (unsigned char *) &tst; - - if (handlers != NULL) return; - - handlers = (xmlCharEncodingHandlerPtr *) - xmlMalloc(MAX_ENCODING_HANDLERS * sizeof(xmlCharEncodingHandlerPtr)); - - if (*ptr == 0x12) xmlLittleEndian = 0; - else if (*ptr == 0x34) xmlLittleEndian = 1; - else { - xmlEncodingErr(XML_ERR_INTERNAL_ERROR, - "Odd problem at endianness detection\n", NULL); - } - - if (handlers == NULL) { - xmlEncodingErrMemory("xmlInitCharEncodingHandlers : out of memory !\n"); - return; - } - xmlNewCharEncodingHandler("UTF-8", UTF8ToUTF8, UTF8ToUTF8); - xmlUTF16LEHandler = - xmlNewCharEncodingHandler("UTF-16LE", UTF16LEToUTF8, NULL); - xmlUTF16BEHandler = - xmlNewCharEncodingHandler("UTF-16BE", UTF16BEToUTF8, NULL); - xmlNewCharEncodingHandler("UTF-16", UTF16LEToUTF8, NULL); - xmlNewCharEncodingHandler("ISO-8859-1", isolat1ToUTF8, NULL); - xmlNewCharEncodingHandler("ASCII", asciiToUTF8, NULL); - xmlNewCharEncodingHandler("US-ASCII", asciiToUTF8, NULL); -#ifdef LIBXML_ISO8859X_ENABLED - xmlRegisterCharEncodingHandlersISO8859x (); -#endif - -} - -/** - * xmlCleanupCharEncodingHandlers: - * - * Cleanup the memory allocated for the char encoding support, it - * unregisters all the encoding handlers and the aliases. - */ -void -xmlCleanupCharEncodingHandlers(void) { - xmlCleanupEncodingAliases(); - - if (handlers == NULL) return; - - for (;nbCharEncodingHandler > 0;) { - nbCharEncodingHandler--; - if (handlers[nbCharEncodingHandler] != NULL) { - if (handlers[nbCharEncodingHandler]->name != NULL) - xmlFree(handlers[nbCharEncodingHandler]->name); - xmlFree(handlers[nbCharEncodingHandler]); - } - } - xmlFree(handlers); - handlers = NULL; - nbCharEncodingHandler = 0; - xmlDefaultCharEncodingHandler = NULL; -} - -/** - * xmlRegisterCharEncodingHandler: - * @handler: the xmlCharEncodingHandlerPtr handler block - * - * Register the char encoding handler, surprising, isn't it ? - */ -void -xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) { - if (handlers == NULL) xmlInitCharEncodingHandlers(); - if ((handler == NULL) || (handlers == NULL)) { - xmlEncodingErr(XML_I18N_NO_HANDLER, - "xmlRegisterCharEncodingHandler: NULL handler !\n", NULL); - return; - } - - if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) { - xmlEncodingErr(XML_I18N_EXCESS_HANDLER, - "xmlRegisterCharEncodingHandler: Too many handler registered, see %s\n", - "MAX_ENCODING_HANDLERS"); - return; - } - handlers[nbCharEncodingHandler++] = handler; -} - -/** - * xmlGetCharEncodingHandler: - * @enc: an xmlCharEncoding value. - * - * Search in the registered set the handler able to read/write that encoding. - * - * Returns the handler or NULL if not found - */ -xmlCharEncodingHandlerPtr -xmlGetCharEncodingHandler(xmlCharEncoding enc) { - xmlCharEncodingHandlerPtr handler; - - if (handlers == NULL) xmlInitCharEncodingHandlers(); - switch (enc) { - case XML_CHAR_ENCODING_ERROR: - return(NULL); - case XML_CHAR_ENCODING_NONE: - return(NULL); - case XML_CHAR_ENCODING_UTF8: - return(NULL); - case XML_CHAR_ENCODING_UTF16LE: - return(xmlUTF16LEHandler); - case XML_CHAR_ENCODING_UTF16BE: - return(xmlUTF16BEHandler); - case XML_CHAR_ENCODING_EBCDIC: - handler = xmlFindCharEncodingHandler("EBCDIC"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("ebcdic"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("EBCDIC-US"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_UCS4BE: - handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("UCS-4"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("UCS4"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_UCS4LE: - handler = xmlFindCharEncodingHandler("ISO-10646-UCS-4"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("UCS-4"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("UCS4"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_UCS4_2143: - break; - case XML_CHAR_ENCODING_UCS4_3412: - break; - case XML_CHAR_ENCODING_UCS2: - handler = xmlFindCharEncodingHandler("ISO-10646-UCS-2"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("UCS-2"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("UCS2"); - if (handler != NULL) return(handler); - break; - - /* - * We used to keep ISO Latin encodings native in the - * generated data. This led to so many problems that - * this has been removed. One can still change this - * back by registering no-ops encoders for those - */ - case XML_CHAR_ENCODING_8859_1: - handler = xmlFindCharEncodingHandler("ISO-8859-1"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_8859_2: - handler = xmlFindCharEncodingHandler("ISO-8859-2"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_8859_3: - handler = xmlFindCharEncodingHandler("ISO-8859-3"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_8859_4: - handler = xmlFindCharEncodingHandler("ISO-8859-4"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_8859_5: - handler = xmlFindCharEncodingHandler("ISO-8859-5"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_8859_6: - handler = xmlFindCharEncodingHandler("ISO-8859-6"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_8859_7: - handler = xmlFindCharEncodingHandler("ISO-8859-7"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_8859_8: - handler = xmlFindCharEncodingHandler("ISO-8859-8"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_8859_9: - handler = xmlFindCharEncodingHandler("ISO-8859-9"); - if (handler != NULL) return(handler); - break; - - - case XML_CHAR_ENCODING_2022_JP: - handler = xmlFindCharEncodingHandler("ISO-2022-JP"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_SHIFT_JIS: - handler = xmlFindCharEncodingHandler("SHIFT-JIS"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("SHIFT_JIS"); - if (handler != NULL) return(handler); - handler = xmlFindCharEncodingHandler("Shift_JIS"); - if (handler != NULL) return(handler); - break; - case XML_CHAR_ENCODING_EUC_JP: - handler = xmlFindCharEncodingHandler("EUC-JP"); - if (handler != NULL) return(handler); - break; - default: - break; - } - - return(NULL); -} - -/** - * xmlFindCharEncodingHandler: - * @name: a string describing the char encoding. - * - * Search in the registered set the handler able to read/write that encoding. - * - * Returns the handler or NULL if not found - */ -xmlCharEncodingHandlerPtr -xmlFindCharEncodingHandler(const char *name) { - const char *nalias; - const char *norig; - xmlCharEncoding alias; - char upper[100]; - int i; - - if (handlers == NULL) xmlInitCharEncodingHandlers(); - if (name == NULL) return(xmlDefaultCharEncodingHandler); - if (name[0] == 0) return(xmlDefaultCharEncodingHandler); - - /* - * Do the alias resolution - */ - norig = name; - nalias = xmlGetEncodingAlias(name); - if (nalias != NULL) - name = nalias; - - /* - * Check first for directly registered encoding names - */ - for (i = 0;i < 99;i++) { - upper[i] = toupper(name[i]); - if (upper[i] == 0) break; - } - upper[i] = 0; - - if (handlers != NULL) { - for (i = 0;i < nbCharEncodingHandler; i++) { - if (!strcmp(upper, handlers[i]->name)) { - return(handlers[i]); - } - } - } - - /* - * Fallback using the canonical names - */ - alias = xmlParseCharEncoding(norig); - if (alias != XML_CHAR_ENCODING_ERROR) { - const char* canon; - canon = xmlGetCharEncodingName(alias); - if ((canon != NULL) && (strcmp(name, canon))) { - return(xmlFindCharEncodingHandler(canon)); - } - } - - /* If "none of the above", give up */ - return(NULL); -} - -/************************************************************************ - * * - * The real API used by libxml for on-the-fly conversion * - * * - ************************************************************************/ -int -xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, - xmlBufferPtr in, int len); - -/** - * xmlCharEncFirstLineInt: - * @handler: char enconding transformation data structure - * @out: an xmlBuffer for the output. - * @in: an xmlBuffer for the input - * @len: number of bytes to convert for the first line, or -1 - * - * Front-end for the encoding handler input function, but handle only - * the very first line, i.e. limit itself to 45 chars. - * - * Returns the number of byte written if success, or - * -1 general error - * -2 if the transcoding fails (for *in is not valid utf8 string or - * the result of transformation can't fit into the encoding we want), or - */ -int -xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, - xmlBufferPtr in, int len) { - int ret = -2; - int written; - int toconv; - - if (handler == NULL) return(-1); - if (out == NULL) return(-1); - if (in == NULL) return(-1); - - /* calculate space available */ - written = out->size - out->use - 1; /* count '\0' */ - toconv = in->use; - /* - * echo '' | wc -c => 38 - * 45 chars should be sufficient to reach the end of the encoding - * declaration without going too far inside the document content. - * on UTF-16 this means 90bytes, on UCS4 this means 180 - * The actual value depending on guessed encoding is passed as @len - * if provided - */ - if (len >= 0) { - if (toconv > len) - toconv = len; - } else { - if (toconv > 180) - toconv = 180; - } - if (toconv * 2 >= written) { - xmlBufferGrow(out, toconv); - written = out->size - out->use - 1; - } - - if (handler->input != NULL) { - ret = handler->input(&out->content[out->use], &written, - in->content, &toconv); - xmlBufferShrink(in, toconv); - out->use += written; - out->content[out->use] = 0; - } - /* - * Ignore when input buffer is not on a boundary - */ - if (ret == -3) ret = 0; - if (ret == -1) ret = 0; - return(ret); -} - -/** - * xmlCharEncFirstLine: - * @handler: char enconding transformation data structure - * @out: an xmlBuffer for the output. - * @in: an xmlBuffer for the input - * - * Front-end for the encoding handler input function, but handle only - * the very first line, i.e. limit itself to 45 chars. - * - * Returns the number of byte written if success, or - * -1 general error - * -2 if the transcoding fails (for *in is not valid utf8 string or - * the result of transformation can't fit into the encoding we want), or - */ -int -xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, - xmlBufferPtr in) { - return(xmlCharEncFirstLineInt(handler, out, in, -1)); -} - -/** - * xmlCharEncInFunc: - * @handler: char encoding transformation data structure - * @out: an xmlBuffer for the output. - * @in: an xmlBuffer for the input - * - * Generic front-end for the encoding handler input function - * - * Returns the number of byte written if success, or - * -1 general error - * -2 if the transcoding fails (for *in is not valid utf8 string or - * the result of transformation can't fit into the encoding we want), or - */ -int -xmlCharEncInFunc(xmlCharEncodingHandler * handler, xmlBufferPtr out, - xmlBufferPtr in) -{ - int ret = -2; - int written; - int toconv; - - if (handler == NULL) - return (-1); - if (out == NULL) - return (-1); - if (in == NULL) - return (-1); - - toconv = in->use; - if (toconv == 0) - return (0); - written = out->size - out->use -1; /* count '\0' */ - if (toconv * 2 >= written) { - xmlBufferGrow(out, out->size + toconv * 2); - written = out->size - out->use - 1; - } - if (handler->input != NULL) { - ret = handler->input(&out->content[out->use], &written, - in->content, &toconv); - xmlBufferShrink(in, toconv); - out->use += written; - out->content[out->use] = 0; - } - switch (ret) { - case 0: - break; - case -1: - break; - case -3: - break; - case -2: { - char buf[50]; - - snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", - in->content[0], in->content[1], - in->content[2], in->content[3]); - buf[49] = 0; - xmlEncodingErr(XML_I18N_CONV_FAILED, - "input conversion failed due to input error, bytes %s\n", - buf); - } - } - /* - * Ignore when input buffer is not on a boundary - */ - if (ret == -3) - ret = 0; - return (written? written : ret); -} - -/** - * xmlCharEncOutFunc: - * @handler: char enconding transformation data structure - * @out: an xmlBuffer for the output. - * @in: an xmlBuffer for the input - * - * Generic front-end for the encoding handler output function - * a first call with @in == NULL has to be made firs to initiate the - * output in case of non-stateless encoding needing to initiate their - * state or the output (like the BOM in UTF16). - * In case of UTF8 sequence conversion errors for the given encoder, - * the content will be automatically remapped to a CharRef sequence. - * - * Returns the number of byte written if success, or - * -1 general error - * -2 if the transcoding fails (for *in is not valid utf8 string or - * the result of transformation can't fit into the encoding we want), or - */ -int -xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out, - xmlBufferPtr in) { - int ret = -2; - int written; - int writtentot = 0; - int toconv; - int output = 0; - - if (handler == NULL) return(-1); - if (out == NULL) return(-1); - -retry: - - written = out->size - out->use; - - if (written > 0) - written--; /* Gennady: count '/0' */ - - /* - * First specific handling of in = NULL, i.e. the initialization call - */ - if (in == NULL) { - toconv = 0; - if (handler->output != NULL) { - ret = handler->output(&out->content[out->use], &written, - NULL, &toconv); - if (ret >= 0) { /* Gennady: check return value */ - out->use += written; - out->content[out->use] = 0; - } - } - return(0); - } - - /* - * Conversion itself. - */ - toconv = in->use; - if (toconv == 0) - return(0); - if (toconv * 4 >= written) { - xmlBufferGrow(out, toconv * 4); - written = out->size - out->use - 1; - } - if (handler->output != NULL) { - ret = handler->output(&out->content[out->use], &written, - in->content, &toconv); - if (written > 0) { - xmlBufferShrink(in, toconv); - out->use += written; - writtentot += written; - } - out->content[out->use] = 0; - } - else { - xmlEncodingErr(XML_I18N_NO_OUTPUT, - "xmlCharEncOutFunc: no output function !\n", NULL); - return(-1); - } - - if (ret >= 0) output += ret; - - /* - * Attempt to handle error cases - */ - switch (ret) { - case 0: - break; - case -1: - break; - case -3: - break; - case -2: { - int len = in->use; - const xmlChar *utf = (const xmlChar *) in->content; - int cur; - - cur = xmlGetUTF8Char(utf, &len); - if (cur > 0) { - xmlChar charref[20]; - - /* - * Removes the UTF8 sequence, and replace it by a charref - * and continue the transcoding phase, hoping the error - * did not mangle the encoder state. - */ - snprintf((char *) &charref[0], sizeof(charref), "&#%d;", cur); - xmlBufferShrink(in, len); - xmlBufferAddHead(in, charref, -1); - - goto retry; - } else { - char buf[50]; - - snprintf(&buf[0], 49, "0x%02X 0x%02X 0x%02X 0x%02X", - in->content[0], in->content[1], - in->content[2], in->content[3]); - buf[49] = 0; - xmlEncodingErr(XML_I18N_CONV_FAILED, - "output conversion failed due to conv error, bytes %s\n", - buf); - if (in->alloc != XML_BUFFER_ALLOC_IMMUTABLE) - in->content[0] = ' '; - } - break; - } - } - return(ret); -} - -/** - * xmlCharEncCloseFunc: - * @handler: char enconding transformation data structure - * - * Generic front-end for encoding handler close function - * - * Returns 0 if success, or -1 in case of error - */ -int -xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) { - int ret = 0; - int tofree = 0; - if (handler == NULL) return(-1); - if (handler->name == NULL) return(-1); - if (tofree) { - /* free up only dynamic handlers iconv/uconv */ - if (handler->name != NULL) - xmlFree(handler->name); - handler->name = NULL; - xmlFree(handler); - } - - return(ret); -} - -/** - * xmlByteConsumed: - * @ctxt: an XML parser context - * - * This function provides the current index of the parser relative - * to the start of the current entity. This function is computed in - * bytes from the beginning starting at zero and finishing at the - * size in byte of the file if parsing a file. The function is - * of constant cost if the input is UTF-8 but can be costly if run - * on non-UTF-8 input. - * - * Returns the index in bytes from the beginning of the entity or -1 - * in case the index could not be computed. - */ -long -xmlByteConsumed(xmlParserCtxtPtr ctxt) { - xmlParserInputPtr in; - - if (ctxt == NULL) return(-1); - in = ctxt->input; - if (in == NULL) return(-1); - if ((in->buf != NULL) && (in->buf->encoder != NULL)) { - unsigned int unused = 0; - xmlCharEncodingHandler * handler = in->buf->encoder; - /* - * Encoding conversion, compute the number of unused original - * bytes from the input not consumed and substract that from - * the raw consumed value, this is not a cheap operation - */ - if (in->end - in->cur > 0) { - unsigned char convbuf[32000]; - const unsigned char *cur = (const unsigned char *)in->cur; - int toconv = in->end - in->cur, written = 32000; - - int ret; - - if (handler->output != NULL) { - do { - toconv = in->end - cur; - written = 32000; - ret = handler->output(&convbuf[0], &written, - cur, &toconv); - if (ret == -1) return(-1); - unused += written; - cur += toconv; - } while (ret == -2); - } else { - /* could not find a converter */ - return(-1); - } - } - if (in->buf->rawconsumed < unused) - return(-1); - return(in->buf->rawconsumed - unused); - } - return(in->consumed + (in->cur - in->base)); -} - -#ifdef LIBXML_ISO8859X_ENABLED - -/** - * UTF8ToISO8859x: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of UTF-8 chars - * @inlen: the length of @in - * @xlattable: the 2-level transcoding table - * - * Take a block of UTF-8 chars in and try to convert it to an ISO 8859-* - * block of chars out. - * - * Returns 0 if success, -2 if the transcoding fails, or -1 otherwise - * The value of @inlen after return is the number of octets consumed - * as the return value is positive, else unpredictable. - * The value of @outlen after return is the number of ocetes consumed. - */ -static int -UTF8ToISO8859x(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen, - unsigned char const *xlattable) { - const unsigned char* outstart = out; - const unsigned char* inend; - const unsigned char* instart = in; - const unsigned char* processed = in; - - if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || - (xlattable == NULL)) - return(-1); - if (in == NULL) { - /* - * initialization nothing to do - */ - *outlen = 0; - *inlen = 0; - return(0); - } - inend = in + (*inlen); - while (in < inend) { - unsigned char d = *in++; - if (d < 0x80) { - *out++ = d; - } else if (d < 0xC0) { - /* trailing byte in leading position */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } else if (d < 0xE0) { - unsigned char c; - if (!(in < inend)) { - /* trailing byte not in input buffer */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-3); - } - c = *in++; - if ((c & 0xC0) != 0x80) { - /* not a trailing byte */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - c = c & 0x3F; - d = d & 0x1F; - d = xlattable [48 + c + xlattable [d] * 64]; - if (d == 0) { - /* not in character set */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - *out++ = d; - } else if (d < 0xF0) { - unsigned char c1; - unsigned char c2; - if (!(in < inend - 1)) { - /* trailing bytes not in input buffer */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-3); - } - c1 = *in++; - if ((c1 & 0xC0) != 0x80) { - /* not a trailing byte (c1) */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - c2 = *in++; - if ((c2 & 0xC0) != 0x80) { - /* not a trailing byte (c2) */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - c1 = c1 & 0x3F; - c2 = c2 & 0x3F; - d = d & 0x0F; - d = xlattable [48 + c2 + xlattable [48 + c1 + - xlattable [32 + d] * 64] * 64]; - if (d == 0) { - /* not in character set */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - *out++ = d; - } else { - /* cannot transcode >= U+010000 */ - *outlen = out - outstart; - *inlen = processed - instart; - return(-2); - } - processed = in; - } - *outlen = out - outstart; - *inlen = processed - instart; - return(*outlen); -} - -/** - * ISO8859xToUTF8 - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of ISO Latin 1 chars - * @inlen: the length of @in - * - * Take a block of ISO 8859-* chars in and try to convert it to an UTF-8 - * block of chars out. - * Returns 0 if success, or -1 otherwise - * The value of @inlen after return is the number of octets consumed - * The value of @outlen after return is the number of ocetes produced. - */ -static int -ISO8859xToUTF8(unsigned char* out, int *outlen, - const unsigned char* in, int *inlen, - unsigned short const *unicodetable) { - unsigned char* outstart = out; - unsigned char* outend; - const unsigned char* instart = in; - const unsigned char* inend; - const unsigned char* instop; - unsigned int c; - - if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || - (in == NULL) || (unicodetable == NULL)) - return(-1); - outend = out + *outlen; - inend = in + *inlen; - instop = inend; - - while ((in < inend) && (out < outend - 2)) { - if (*in >= 0x80) { - c = unicodetable [*in - 0x80]; - if (c == 0) { - /* undefined code point */ - *outlen = out - outstart; - *inlen = in - instart; - return (-1); - } - if (c < 0x800) { - *out++ = ((c >> 6) & 0x1F) | 0xC0; - *out++ = (c & 0x3F) | 0x80; - } else { - *out++ = ((c >> 12) & 0x0F) | 0xE0; - *out++ = ((c >> 6) & 0x3F) | 0x80; - *out++ = (c & 0x3F) | 0x80; - } - ++in; - } - if (instop - in > outend - out) instop = in + (outend - out); - while ((*in < 0x80) && (in < instop)) { - *out++ = *in++; - } - } - if ((in < inend) && (out < outend) && (*in < 0x80)) { - *out++ = *in++; - } - if ((in < inend) && (out < outend) && (*in < 0x80)) { - *out++ = *in++; - } - *outlen = out - outstart; - *inlen = in - instart; - return (*outlen); -} - - -/************************************************************************ - * Lookup tables for ISO-8859-2..ISO-8859-16 transcoding * - ************************************************************************/ - -static unsigned short const xmlunicodetable_ISO8859_2 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, - 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, - 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, - 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, - 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, - 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, - 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, - 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, - 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, - 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, -}; - -static unsigned char const xmltranscodetable_ISO8859_2 [48 + 6 * 64] = { - "\x00\x00\x01\x05\x02\x04\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\x00\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\x00" - "\xb0\x00\x00\x00\xb4\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\xc3\xe3\xa1\xb1\xc6\xe6\x00\x00\x00\x00\xc8\xe8\xcf\xef" - "\xd0\xf0\x00\x00\x00\x00\x00\x00\xca\xea\xcc\xec\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc5\xe5\x00\x00\xa5\xb5\x00" - "\x00\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\xa2\xff\x00\xb2\x00\xbd\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\xa3\xb3\xd1\xf1\x00\x00\xd2\xf2\x00\x00\x00\x00\x00\x00\x00" - "\xd5\xf5\x00\x00\xc0\xe0\x00\x00\xd8\xf8\xa6\xb6\x00\x00\xaa\xba" - "\xa9\xb9\xde\xfe\xab\xbb\x00\x00\x00\x00\x00\x00\x00\x00\xd9\xf9" - "\xdb\xfb\x00\x00\x00\x00\x00\x00\x00\xac\xbc\xaf\xbf\xae\xbe\x00" - "\x00\xc1\xc2\x00\xc4\x00\x00\xc7\x00\xc9\x00\xcb\x00\xcd\xce\x00" - "\x00\x00\x00\xd3\xd4\x00\xd6\xd7\x00\x00\xda\x00\xdc\xdd\x00\xdf" - "\x00\xe1\xe2\x00\xe4\x00\x00\xe7\x00\xe9\x00\xeb\x00\xed\xee\x00" - "\x00\x00\x00\xf3\xf4\x00\xf6\xf7\x00\x00\xfa\x00\xfc\xfd\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_3 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0x0000, 0x0124, 0x00a7, - 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0x0000, 0x017b, - 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, - 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0x0000, 0x017c, - 0x00c0, 0x00c1, 0x00c2, 0x0000, 0x00c4, 0x010a, 0x0108, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x0000, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, - 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x0000, 0x00e4, 0x010b, 0x0109, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x0000, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, - 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, -}; - -static unsigned char const xmltranscodetable_ISO8859_3 [48 + 7 * 64] = { - "\x04\x00\x01\x06\x02\x05\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\xa3\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\x00" - "\xb0\x00\xb2\xb3\xb4\xb5\x00\xb7\xb8\x00\x00\x00\x00\xbd\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\xc6\xe6\xc5\xe5\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd8\xf8\xab\xbb" - "\xd5\xf5\x00\x00\xa6\xb6\xa1\xb1\x00\x00\x00\x00\x00\x00\x00\x00" - "\xa9\xb9\x00\x00\xac\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\xa2\xff\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xfe\xaa\xba" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdd\xfd\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaf\xbf\x00\x00\x00" - "\xc0\xc1\xc2\x00\xc4\x00\x00\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\x00\xd1\xd2\xd3\xd4\x00\xd6\xd7\x00\xd9\xda\xdb\xdc\x00\x00\xdf" - "\xe0\xe1\xe2\x00\xe4\x00\x00\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\x00\xf1\xf2\xf3\xf4\x00\xf6\xf7\x00\xf9\xfa\xfb\xfc\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_4 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, - 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, - 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, - 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, - 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, - 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, - 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, - 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, -}; - -static unsigned char const xmltranscodetable_ISO8859_4 [48 + 6 * 64] = { - "\x00\x00\x01\x05\x02\x03\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\x00\xa4\x00\x00\xa7\xa8\x00\x00\x00\x00\xad\x00\xaf" - "\xb0\x00\x00\x00\xb4\x00\x00\x00\xb8\x00\x00\x00\x00\x00\x00\x00" - "\xc0\xe0\x00\x00\xa1\xb1\x00\x00\x00\x00\x00\x00\xc8\xe8\x00\x00" - "\xd0\xf0\xaa\xba\x00\x00\xcc\xec\xca\xea\x00\x00\x00\x00\x00\x00" - "\x00\x00\xab\xbb\x00\x00\x00\x00\xa5\xb5\xcf\xef\x00\x00\xc7\xe7" - "\x00\x00\x00\x00\x00\x00\xd3\xf3\xa2\x00\x00\xa6\xb6\x00\x00\x00" - "\x00\x00\x00\x00\x00\xd1\xf1\x00\x00\x00\xbd\xbf\xd2\xf2\x00\x00" - "\x00\x00\x00\x00\x00\x00\xa3\xb3\x00\x00\x00\x00\x00\x00\x00\x00" - "\xa9\xb9\x00\x00\x00\x00\xac\xbc\xdd\xfd\xde\xfe\x00\x00\x00\x00" - "\x00\x00\xd9\xf9\x00\x00\x00\x00\x00\x00\x00\x00\x00\xae\xbe\x00" - "\x00\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\xb2\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\xc1\xc2\xc3\xc4\xc5\xc6\x00\x00\xc9\x00\xcb\x00\xcd\xce\x00" - "\x00\x00\x00\x00\xd4\xd5\xd6\xd7\xd8\x00\xda\xdb\xdc\x00\x00\xdf" - "\x00\xe1\xe2\xe3\xe4\xe5\xe6\x00\x00\xe9\x00\xeb\x00\xed\xee\x00" - "\x00\x00\x00\x00\xf4\xf5\xf6\xf7\xf8\x00\xfa\xfb\xfc\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_5 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, - 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, -}; - -static unsigned char const xmltranscodetable_ISO8859_5 [48 + 6 * 64] = { - "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\x00\x00\x00\x00\xfd\x00\x00\x00\x00\x00\xad\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\x00\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\x00\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\x00\xfe\xff" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_6 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x060c, 0x00ad, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, - 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, - 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, - 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, - 0x0650, 0x0651, 0x0652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -}; - -static unsigned char const xmltranscodetable_ISO8859_6 [48 + 5 * 64] = { - "\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x04\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\x00\xa4\x00\x00\x00\x00\x00\x00\x00\x00\xad\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbb\x00\x00\x00\xbf" - "\x00\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\x00\x00\x00\x00\x00" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_7 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x2018, 0x2019, 0x00a3, 0x0000, 0x0000, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x0000, 0x00ab, 0x00ac, 0x00ad, 0x0000, 0x2015, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, - 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, - 0x03a0, 0x03a1, 0x0000, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, - 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, - 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0000, -}; - -static unsigned char const xmltranscodetable_ISO8859_7 [48 + 7 * 64] = { - "\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x06" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\xa3\x00\x00\xa6\xa7\xa8\xa9\x00\xab\xac\xad\x00\x00" - "\xb0\xb1\xb2\xb3\x00\x00\x00\xb7\x00\x00\x00\xbb\x00\xbd\x00\x00" - "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\xaf\x00\x00\xa1\xa2\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\xb4\xb5\xb6\x00\xb8\xb9\xba\x00\xbc\x00\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\x00\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_8 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0000, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2017, - 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, - 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, - 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, - 0x05e8, 0x05e9, 0x05ea, 0x0000, 0x0000, 0x200e, 0x200f, 0x0000, -}; - -static unsigned char const xmltranscodetable_ISO8859_8 [48 + 7 * 64] = { - "\x02\x00\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\x00\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\x00\xbb\xbc\xbd\xbe\x00" - "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\xaa\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\xba\x00\x00\x00\x00\x00\x00\x00\x00" - "\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfd\xfe" - "\x00\x00\x00\x00\x00\x00\x00\xdf\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_9 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, -}; - -static unsigned char const xmltranscodetable_ISO8859_9 [48 + 5 * 64] = { - "\x00\x00\x01\x02\x03\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\x00\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\x00\x00\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\x00\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\x00\x00\xff" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd0\xf0" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xdd\xfd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xde\xfe" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_10 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7, - 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, - 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, - 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, - 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, - 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, - 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, - 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, - 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, - 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, -}; - -static unsigned char const xmltranscodetable_ISO8859_10 [48 + 7 * 64] = { - "\x00\x00\x01\x06\x02\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\x00\x00\x00\x00\xa7\x00\x00\x00\x00\x00\xad\x00\x00" - "\xb0\x00\x00\x00\x00\x00\x00\xb7\x00\x00\x00\x00\x00\x00\x00\x00" - "\xc0\xe0\x00\x00\xa1\xb1\x00\x00\x00\x00\x00\x00\xc8\xe8\x00\x00" - "\xa9\xb9\xa2\xb2\x00\x00\xcc\xec\xca\xea\x00\x00\x00\x00\x00\x00" - "\x00\x00\xa3\xb3\x00\x00\x00\x00\xa5\xb5\xa4\xb4\x00\x00\xc7\xe7" - "\x00\x00\x00\x00\x00\x00\xa6\xb6\xff\x00\x00\xa8\xb8\x00\x00\x00" - "\x00\x00\x00\x00\x00\xd1\xf1\x00\x00\x00\xaf\xbf\xd2\xf2\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xaa\xba\x00\x00\x00\x00\xab\xbb\xd7\xf7\xae\xbe\x00\x00\x00\x00" - "\x00\x00\xd9\xf9\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\xbc\x00" - "\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\xbd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\xc1\xc2\xc3\xc4\xc5\xc6\x00\x00\xc9\x00\xcb\x00\xcd\xce\xcf" - "\xd0\x00\x00\xd3\xd4\xd5\xd6\x00\xd8\x00\xda\xdb\xdc\xdd\xde\xdf" - "\x00\xe1\xe2\xe3\xe4\xe5\xe6\x00\x00\xe9\x00\xeb\x00\xed\xee\xef" - "\xf0\x00\x00\xf3\xf4\xf5\xf6\x00\xf8\x00\xfa\xfb\xfc\xfd\xfe\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_11 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, - 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e3f, - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0x0000, 0x0000, 0x0000, 0x0000, -}; - -static unsigned char const xmltranscodetable_ISO8859_11 [48 + 6 * 64] = { - "\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x05\x00\x00\x00\x00\x00\x00" - "\x00\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\x00\x00\x00\x00\xdf" - "\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_13 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, - 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, - 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, - 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, - 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, - 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, - 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, - 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, - 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, - 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, - 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019, -}; - -static unsigned char const xmltranscodetable_ISO8859_13 [48 + 7 * 64] = { - "\x00\x00\x01\x04\x06\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\xa2\xa3\xa4\x00\xa6\xa7\x00\xa9\x00\xab\xac\xad\xae\x00" - "\xb0\xb1\xb2\xb3\x00\xb5\xb6\xb7\x00\xb9\x00\xbb\xbc\xbd\xbe\x00" - "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x00\x00\xb4\xa1\xa5\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\xc4\xc5\xaf\x00\x00\xc9\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\xd3\x00\xd5\xd6\xd7\xa8\x00\x00\x00\xdc\x00\x00\xdf" - "\x00\x00\x00\x00\xe4\xe5\xbf\x00\x00\xe9\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\xf3\x00\xf5\xf6\xf7\xb8\x00\x00\x00\xfc\x00\x00\x00" - "\x00\xd9\xf9\xd1\xf1\xd2\xf2\x00\x00\x00\x00\x00\xd4\xf4\x00\x00" - "\x00\x00\x00\x00\x00\x00\xaa\xba\x00\x00\xda\xfa\x00\x00\x00\x00" - "\xd0\xf0\x00\x00\x00\x00\x00\x00\x00\x00\xdb\xfb\x00\x00\x00\x00" - "\x00\x00\xd8\xf8\x00\x00\x00\x00\x00\xca\xea\xdd\xfd\xde\xfe\x00" - "\xc2\xe2\x00\x00\xc0\xe0\xc3\xe3\x00\x00\x00\x00\xc8\xe8\x00\x00" - "\x00\x00\xc7\xe7\x00\x00\xcb\xeb\xc6\xe6\x00\x00\x00\x00\x00\x00" - "\x00\x00\xcc\xec\x00\x00\x00\x00\x00\x00\xce\xee\x00\x00\xc1\xe1" - "\x00\x00\x00\x00\x00\x00\xcd\xed\x00\x00\x00\xcf\xef\x00\x00\x00" -}; - -static unsigned short const xmlunicodetable_ISO8859_14 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, - 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, - 0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, - 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff, -}; - -static unsigned char const xmltranscodetable_ISO8859_14 [48 + 10 * 64] = { - "\x00\x00\x01\x09\x04\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\xa3\x00\x00\x00\xa7\x00\xa9\x00\x00\x00\xad\xae\x00" - "\x00\x00\x00\x00\x00\x00\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x03\x08\x05\x06\x00\x00\x00\x00" - "\x00\x00\xa1\xa2\x00\x00\x00\x00\x00\x00\xa6\xab\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0\xb1" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\xa5\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xb2\xb3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xa8\xb8\xaa\xba\xbd\xbe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\xac\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\xd0\xf0\xde\xfe\xaf\x00\x00\x00\x00\x00\x00\x00" - "\xb4\xb5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\xb7\xb9\x00\x00\x00\x00\x00\x00\x00\x00" - "\xbb\xbf\x00\x00\x00\x00\x00\x00\x00\x00\xd7\xf7\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\x00\xd1\xd2\xd3\xd4\xd5\xd6\x00\xd8\xd9\xda\xdb\xdc\xdd\x00\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\x00\xf1\xf2\xf3\xf4\xf5\xf6\x00\xf8\xf9\xfa\xfb\xfc\xfd\x00\xff" -}; - -static unsigned short const xmlunicodetable_ISO8859_15 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, - 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, - 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff, -}; - -static unsigned char const xmltranscodetable_ISO8859_15 [48 + 6 * 64] = { - "\x00\x00\x01\x05\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\xa1\xa2\xa3\x00\xa5\x00\xa7\x00\xa9\xaa\xab\xac\xad\xae\xaf" - "\xb0\xb1\xb2\xb3\x00\xb5\xb6\xb7\x00\xb9\xba\xbb\x00\x00\x00\xbf" - "\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\xbc\xbd\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xa6\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\xbe\x00\x00\x00\x00\xb4\xb8\x00" - "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf" - "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" -}; - -static unsigned short const xmlunicodetable_ISO8859_16 [128] = { - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, - 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, - 0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, - 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c, - 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - 0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a, - 0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df, - 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, - 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff, -}; - -static unsigned char const xmltranscodetable_ISO8859_16 [48 + 9 * 64] = { - "\x00\x00\x01\x08\x02\x03\x00\x00\x07\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f" - "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f" - "\xa0\x00\x00\x00\x00\x00\x00\xa7\x00\xa9\x00\xab\x00\xad\x00\x00" - "\xb0\xb1\x00\x00\x00\x00\xb6\xb7\x00\x00\x00\xbb\x00\x00\x00\x00" - "\x00\x00\xc3\xe3\xa1\xa2\xc5\xe5\x00\x00\x00\x00\xb2\xb9\x00\x00" - "\xd0\xf0\x00\x00\x00\x00\x00\x00\xdd\xfd\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\xa3\xb3\xd1\xf1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xd5\xf5\xbc\xbd\x00\x00\x00\x00\x00\x00\xd7\xf7\x00\x00\x00\x00" - "\xa6\xa8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xd8\xf8\x00\x00\x00\x00\x00\x00\xbe\xac\xae\xaf\xbf\xb4\xb8\x00" - "\x06\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb5\xa5\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\xaa\xba\xde\xfe\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\xc0\xc1\xc2\x00\xc4\x00\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf" - "\x00\x00\xd2\xd3\xd4\x00\xd6\x00\x00\xd9\xda\xdb\xdc\x00\x00\xdf" - "\xe0\xe1\xe2\x00\xe4\x00\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef" - "\x00\x00\xf2\xf3\xf4\x00\xf6\x00\x00\xf9\xfa\xfb\xfc\x00\x00\xff" -}; - - -/* - * auto-generated functions for ISO-8859-2 .. ISO-8859-16 - */ - -static int ISO8859_2ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_2); -} -static int UTF8ToISO8859_2 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_2); -} - -static int ISO8859_3ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_3); -} -static int UTF8ToISO8859_3 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_3); -} - -static int ISO8859_4ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_4); -} -static int UTF8ToISO8859_4 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_4); -} - -static int ISO8859_5ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_5); -} -static int UTF8ToISO8859_5 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_5); -} - -static int ISO8859_6ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_6); -} -static int UTF8ToISO8859_6 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_6); -} - -static int ISO8859_7ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_7); -} -static int UTF8ToISO8859_7 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_7); -} - -static int ISO8859_8ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_8); -} -static int UTF8ToISO8859_8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_8); -} - -static int ISO8859_9ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_9); -} -static int UTF8ToISO8859_9 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_9); -} - -static int ISO8859_10ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_10); -} -static int UTF8ToISO8859_10 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_10); -} - -static int ISO8859_11ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_11); -} -static int UTF8ToISO8859_11 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_11); -} - -static int ISO8859_13ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_13); -} -static int UTF8ToISO8859_13 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_13); -} - -static int ISO8859_14ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_14); -} -static int UTF8ToISO8859_14 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_14); -} - -static int ISO8859_15ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_15); -} -static int UTF8ToISO8859_15 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_15); -} - -static int ISO8859_16ToUTF8 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return ISO8859xToUTF8 (out, outlen, in, inlen, xmlunicodetable_ISO8859_16); -} -static int UTF8ToISO8859_16 (unsigned char* out, int *outlen, - const unsigned char* in, int *inlen) { - return UTF8ToISO8859x (out, outlen, in, inlen, xmltranscodetable_ISO8859_16); -} - -static void -xmlRegisterCharEncodingHandlersISO8859x (void) { - xmlNewCharEncodingHandler ("ISO-8859-2", ISO8859_2ToUTF8, UTF8ToISO8859_2); - xmlNewCharEncodingHandler ("ISO-8859-3", ISO8859_3ToUTF8, UTF8ToISO8859_3); - xmlNewCharEncodingHandler ("ISO-8859-4", ISO8859_4ToUTF8, UTF8ToISO8859_4); - xmlNewCharEncodingHandler ("ISO-8859-5", ISO8859_5ToUTF8, UTF8ToISO8859_5); - xmlNewCharEncodingHandler ("ISO-8859-6", ISO8859_6ToUTF8, UTF8ToISO8859_6); - xmlNewCharEncodingHandler ("ISO-8859-7", ISO8859_7ToUTF8, UTF8ToISO8859_7); - xmlNewCharEncodingHandler ("ISO-8859-8", ISO8859_8ToUTF8, UTF8ToISO8859_8); - xmlNewCharEncodingHandler ("ISO-8859-9", ISO8859_9ToUTF8, UTF8ToISO8859_9); - xmlNewCharEncodingHandler ("ISO-8859-10", ISO8859_10ToUTF8, UTF8ToISO8859_10); - xmlNewCharEncodingHandler ("ISO-8859-11", ISO8859_11ToUTF8, UTF8ToISO8859_11); - xmlNewCharEncodingHandler ("ISO-8859-13", ISO8859_13ToUTF8, UTF8ToISO8859_13); - xmlNewCharEncodingHandler ("ISO-8859-14", ISO8859_14ToUTF8, UTF8ToISO8859_14); - xmlNewCharEncodingHandler ("ISO-8859-15", ISO8859_15ToUTF8, UTF8ToISO8859_15); - xmlNewCharEncodingHandler ("ISO-8859-16", ISO8859_16ToUTF8, UTF8ToISO8859_16); -} - -#endif - -#define bottom_encoding -#include "elfgcchack.h" diff --git a/deps/libxml2/entities.c b/deps/libxml2/entities.c deleted file mode 100644 index a24ea84651..0000000000 --- a/deps/libxml2/entities.c +++ /dev/null @@ -1,869 +0,0 @@ -/* - * entities.c : implementation for the XML entities handling - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#include -#ifdef HAVE_STDLIB_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * The XML predefined entities. - */ - -static xmlEntity xmlEntityLt = { - NULL, XML_ENTITY_DECL, BAD_CAST "lt", - NULL, NULL, NULL, NULL, NULL, NULL, - BAD_CAST "<", BAD_CAST "<", 1, - XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1 -}; -static xmlEntity xmlEntityGt = { - NULL, XML_ENTITY_DECL, BAD_CAST "gt", - NULL, NULL, NULL, NULL, NULL, NULL, - BAD_CAST ">", BAD_CAST ">", 1, - XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1 -}; -static xmlEntity xmlEntityAmp = { - NULL, XML_ENTITY_DECL, BAD_CAST "amp", - NULL, NULL, NULL, NULL, NULL, NULL, - BAD_CAST "&", BAD_CAST "&", 1, - XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1 -}; -static xmlEntity xmlEntityQuot = { - NULL, XML_ENTITY_DECL, BAD_CAST "quot", - NULL, NULL, NULL, NULL, NULL, NULL, - BAD_CAST "\"", BAD_CAST "\"", 1, - XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1 -}; -static xmlEntity xmlEntityApos = { - NULL, XML_ENTITY_DECL, BAD_CAST "apos", - NULL, NULL, NULL, NULL, NULL, NULL, - BAD_CAST "'", BAD_CAST "'", 1, - XML_INTERNAL_PREDEFINED_ENTITY, - NULL, NULL, NULL, NULL, 0, 1 -}; - -/** - * xmlEntitiesErrMemory: - * @extra: extra informations - * - * Handle an out of memory condition - */ -static void -xmlEntitiesErrMemory(const char *extra) -{ - __xmlSimpleError(XML_FROM_TREE, XML_ERR_NO_MEMORY, NULL, NULL, extra); -} - -/** - * xmlEntitiesErr: - * @code: the error code - * @msg: the message - * - * Handle an out of memory condition - */ -static void -xmlEntitiesErr(xmlParserErrors code, const char *msg) -{ - __xmlSimpleError(XML_FROM_TREE, code, NULL, msg, NULL); -} - -/* - * xmlFreeEntity : clean-up an entity record. - */ -static void -xmlFreeEntity(xmlEntityPtr entity) -{ - xmlDictPtr dict = NULL; - - if (entity == NULL) - return; - - if (entity->doc != NULL) - dict = entity->doc->dict; - - - if ((entity->children) && (entity->owner == 1) && - (entity == (xmlEntityPtr) entity->children->parent)) - xmlFreeNodeList(entity->children); - if (dict != NULL) { - if ((entity->name != NULL) && (!xmlDictOwns(dict, entity->name))) - xmlFree((char *) entity->name); - if ((entity->ExternalID != NULL) && - (!xmlDictOwns(dict, entity->ExternalID))) - xmlFree((char *) entity->ExternalID); - if ((entity->SystemID != NULL) && - (!xmlDictOwns(dict, entity->SystemID))) - xmlFree((char *) entity->SystemID); - if ((entity->URI != NULL) && (!xmlDictOwns(dict, entity->URI))) - xmlFree((char *) entity->URI); - if ((entity->content != NULL) - && (!xmlDictOwns(dict, entity->content))) - xmlFree((char *) entity->content); - if ((entity->orig != NULL) && (!xmlDictOwns(dict, entity->orig))) - xmlFree((char *) entity->orig); - } else { - if (entity->name != NULL) - xmlFree((char *) entity->name); - if (entity->ExternalID != NULL) - xmlFree((char *) entity->ExternalID); - if (entity->SystemID != NULL) - xmlFree((char *) entity->SystemID); - if (entity->URI != NULL) - xmlFree((char *) entity->URI); - if (entity->content != NULL) - xmlFree((char *) entity->content); - if (entity->orig != NULL) - xmlFree((char *) entity->orig); - } - xmlFree(entity); -} - -/* - * xmlCreateEntity: - * - * internal routine doing the entity node strutures allocations - */ -static xmlEntityPtr -xmlCreateEntity(xmlDictPtr dict, const xmlChar *name, int type, - const xmlChar *ExternalID, const xmlChar *SystemID, - const xmlChar *content) { - xmlEntityPtr ret; - - ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); - if (ret == NULL) { - xmlEntitiesErrMemory("xmlCreateEntity: malloc failed"); - return(NULL); - } - memset(ret, 0, sizeof(xmlEntity)); - ret->type = XML_ENTITY_DECL; - ret->checked = 0; - - /* - * fill the structure. - */ - ret->etype = (xmlEntityType) type; - if (dict == NULL) { - ret->name = xmlStrdup(name); - if (ExternalID != NULL) - ret->ExternalID = xmlStrdup(ExternalID); - if (SystemID != NULL) - ret->SystemID = xmlStrdup(SystemID); - } else { - ret->name = xmlDictLookup(dict, name, -1); - if (ExternalID != NULL) - ret->ExternalID = xmlDictLookup(dict, ExternalID, -1); - if (SystemID != NULL) - ret->SystemID = xmlDictLookup(dict, SystemID, -1); - } - if (content != NULL) { - ret->length = xmlStrlen(content); - if ((dict != NULL) && (ret->length < 5)) - ret->content = (xmlChar *) - xmlDictLookup(dict, content, ret->length); - else - ret->content = xmlStrndup(content, ret->length); - } else { - ret->length = 0; - ret->content = NULL; - } - ret->URI = NULL; /* to be computed by the layer knowing - the defining entity */ - ret->orig = NULL; - ret->owner = 0; - - return(ret); -} - -/* - * xmlAddEntity : register a new entity for an entities table. - */ -static xmlEntityPtr -xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, - const xmlChar *ExternalID, const xmlChar *SystemID, - const xmlChar *content) { - xmlDictPtr dict = NULL; - xmlEntitiesTablePtr table = NULL; - xmlEntityPtr ret; - - if (name == NULL) - return(NULL); - if (dtd == NULL) - return(NULL); - if (dtd->doc != NULL) - dict = dtd->doc->dict; - - switch (type) { - case XML_INTERNAL_GENERAL_ENTITY: - case XML_EXTERNAL_GENERAL_PARSED_ENTITY: - case XML_EXTERNAL_GENERAL_UNPARSED_ENTITY: - if (dtd->entities == NULL) - dtd->entities = xmlHashCreateDict(0, dict); - table = dtd->entities; - break; - case XML_INTERNAL_PARAMETER_ENTITY: - case XML_EXTERNAL_PARAMETER_ENTITY: - if (dtd->pentities == NULL) - dtd->pentities = xmlHashCreateDict(0, dict); - table = dtd->pentities; - break; - case XML_INTERNAL_PREDEFINED_ENTITY: - return(NULL); - } - if (table == NULL) - return(NULL); - ret = xmlCreateEntity(dict, name, type, ExternalID, SystemID, content); - if (ret == NULL) - return(NULL); - ret->doc = dtd->doc; - - if (xmlHashAddEntry(table, name, ret)) { - /* - * entity was already defined at another level. - */ - xmlFreeEntity(ret); - return(NULL); - } - return(ret); -} - -/** - * xmlGetPredefinedEntity: - * @name: the entity name - * - * Check whether this name is an predefined entity. - * - * Returns NULL if not, otherwise the entity - */ -xmlEntityPtr -xmlGetPredefinedEntity(const xmlChar *name) { - if (name == NULL) return(NULL); - switch (name[0]) { - case 'l': - if (xmlStrEqual(name, BAD_CAST "lt")) - return(&xmlEntityLt); - break; - case 'g': - if (xmlStrEqual(name, BAD_CAST "gt")) - return(&xmlEntityGt); - break; - case 'a': - if (xmlStrEqual(name, BAD_CAST "amp")) - return(&xmlEntityAmp); - if (xmlStrEqual(name, BAD_CAST "apos")) - return(&xmlEntityApos); - break; - case 'q': - if (xmlStrEqual(name, BAD_CAST "quot")) - return(&xmlEntityQuot); - break; - default: - break; - } - return(NULL); -} - -/** - * xmlAddDtdEntity: - * @doc: the document - * @name: the entity name - * @type: the entity type XML_xxx_yyy_ENTITY - * @ExternalID: the entity external ID if available - * @SystemID: the entity system ID if available - * @content: the entity content - * - * Register a new entity for this document DTD external subset. - * - * Returns a pointer to the entity or NULL in case of error - */ -xmlEntityPtr -xmlAddDtdEntity(xmlDocPtr doc, const xmlChar *name, int type, - const xmlChar *ExternalID, const xmlChar *SystemID, - const xmlChar *content) { - xmlEntityPtr ret; - xmlDtdPtr dtd; - - if (doc == NULL) { - xmlEntitiesErr(XML_DTD_NO_DOC, - "xmlAddDtdEntity: document is NULL"); - return(NULL); - } - if (doc->extSubset == NULL) { - xmlEntitiesErr(XML_DTD_NO_DTD, - "xmlAddDtdEntity: document without external subset"); - return(NULL); - } - dtd = doc->extSubset; - ret = xmlAddEntity(dtd, name, type, ExternalID, SystemID, content); - if (ret == NULL) return(NULL); - - /* - * Link it to the DTD - */ - ret->parent = dtd; - ret->doc = dtd->doc; - if (dtd->last == NULL) { - dtd->children = dtd->last = (xmlNodePtr) ret; - } else { - dtd->last->next = (xmlNodePtr) ret; - ret->prev = dtd->last; - dtd->last = (xmlNodePtr) ret; - } - return(ret); -} - -/** - * xmlAddDocEntity: - * @doc: the document - * @name: the entity name - * @type: the entity type XML_xxx_yyy_ENTITY - * @ExternalID: the entity external ID if available - * @SystemID: the entity system ID if available - * @content: the entity content - * - * Register a new entity for this document. - * - * Returns a pointer to the entity or NULL in case of error - */ -xmlEntityPtr -xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, - const xmlChar *ExternalID, const xmlChar *SystemID, - const xmlChar *content) { - xmlEntityPtr ret; - xmlDtdPtr dtd; - - if (doc == NULL) { - xmlEntitiesErr(XML_DTD_NO_DOC, - "xmlAddDocEntity: document is NULL"); - return(NULL); - } - if (doc->intSubset == NULL) { - xmlEntitiesErr(XML_DTD_NO_DTD, - "xmlAddDocEntity: document without internal subset"); - return(NULL); - } - dtd = doc->intSubset; - ret = xmlAddEntity(dtd, name, type, ExternalID, SystemID, content); - if (ret == NULL) return(NULL); - - /* - * Link it to the DTD - */ - ret->parent = dtd; - ret->doc = dtd->doc; - if (dtd->last == NULL) { - dtd->children = dtd->last = (xmlNodePtr) ret; - } else { - dtd->last->next = (xmlNodePtr) ret; - ret->prev = dtd->last; - dtd->last = (xmlNodePtr) ret; - } - return(ret); -} - -/** - * xmlNewEntity: - * @doc: the document - * @name: the entity name - * @type: the entity type XML_xxx_yyy_ENTITY - * @ExternalID: the entity external ID if available - * @SystemID: the entity system ID if available - * @content: the entity content - * - * Create a new entity, this differs from xmlAddDocEntity() that if - * the document is NULL or has no internal subset defined, then an - * unlinked entity structure will be returned, it is then the responsability - * of the caller to link it to the document later or free it when not needed - * anymore. - * - * Returns a pointer to the entity or NULL in case of error - */ -xmlEntityPtr -xmlNewEntity(xmlDocPtr doc, const xmlChar *name, int type, - const xmlChar *ExternalID, const xmlChar *SystemID, - const xmlChar *content) { - xmlEntityPtr ret; - xmlDictPtr dict; - - if ((doc != NULL) && (doc->intSubset != NULL)) { - return(xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content)); - } - if (doc != NULL) - dict = doc->dict; - else - dict = NULL; - ret = xmlCreateEntity(dict, name, type, ExternalID, SystemID, content); - if (ret == NULL) - return(NULL); - ret->doc = doc; - return(ret); -} - -/** - * xmlGetEntityFromTable: - * @table: an entity table - * @name: the entity name - * @parameter: look for parameter entities - * - * Do an entity lookup in the table. - * returns the corresponding parameter entity, if found. - * - * Returns A pointer to the entity structure or NULL if not found. - */ -static xmlEntityPtr -xmlGetEntityFromTable(xmlEntitiesTablePtr table, const xmlChar *name) { - return((xmlEntityPtr) xmlHashLookup(table, name)); -} - -/** - * xmlGetParameterEntity: - * @doc: the document referencing the entity - * @name: the entity name - * - * Do an entity lookup in the internal and external subsets and - * returns the corresponding parameter entity, if found. - * - * Returns A pointer to the entity structure or NULL if not found. - */ -xmlEntityPtr -xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name) { - xmlEntitiesTablePtr table; - xmlEntityPtr ret; - - if (doc == NULL) - return(NULL); - if ((doc->intSubset != NULL) && (doc->intSubset->pentities != NULL)) { - table = (xmlEntitiesTablePtr) doc->intSubset->pentities; - ret = xmlGetEntityFromTable(table, name); - if (ret != NULL) - return(ret); - } - if ((doc->extSubset != NULL) && (doc->extSubset->pentities != NULL)) { - table = (xmlEntitiesTablePtr) doc->extSubset->pentities; - return(xmlGetEntityFromTable(table, name)); - } - return(NULL); -} - -/** - * xmlGetDtdEntity: - * @doc: the document referencing the entity - * @name: the entity name - * - * Do an entity lookup in the DTD entity hash table and - * returns the corresponding entity, if found. - * Note: the first argument is the document node, not the DTD node. - * - * Returns A pointer to the entity structure or NULL if not found. - */ -xmlEntityPtr -xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) { - xmlEntitiesTablePtr table; - - if (doc == NULL) - return(NULL); - if ((doc->extSubset != NULL) && (doc->extSubset->entities != NULL)) { - table = (xmlEntitiesTablePtr) doc->extSubset->entities; - return(xmlGetEntityFromTable(table, name)); - } - return(NULL); -} - -/** - * xmlGetDocEntity: - * @doc: the document referencing the entity - * @name: the entity name - * - * Do an entity lookup in the document entity hash table and - * returns the corresponding entity, otherwise a lookup is done - * in the predefined entities too. - * - * Returns A pointer to the entity structure or NULL if not found. - */ -xmlEntityPtr -xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { - xmlEntityPtr cur; - xmlEntitiesTablePtr table; - - if (doc != NULL) { - if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { - table = (xmlEntitiesTablePtr) doc->intSubset->entities; - cur = xmlGetEntityFromTable(table, name); - if (cur != NULL) - return(cur); - } - if (doc->standalone != 1) { - if ((doc->extSubset != NULL) && - (doc->extSubset->entities != NULL)) { - table = (xmlEntitiesTablePtr) doc->extSubset->entities; - cur = xmlGetEntityFromTable(table, name); - if (cur != NULL) - return(cur); - } - } - } - return(xmlGetPredefinedEntity(name)); -} - -/* - * Macro used to grow the current buffer. - */ -#define growBufferReentrant() { \ - buffer_size *= 2; \ - buffer = (xmlChar *) \ - xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ - if (buffer == NULL) { \ - xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: realloc failed");\ - return(NULL); \ - } \ -} - - -/** - * xmlEncodeEntitiesReentrant: - * @doc: the document containing the string - * @input: A string to convert to XML. - * - * Do a global encoding of a string, replacing the predefined entities - * and non ASCII values with their entities and CharRef counterparts. - * Contrary to xmlEncodeEntities, this routine is reentrant, and result - * must be deallocated. - * - * Returns A newly allocated string with the substitution done. - */ -xmlChar * -xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { - const xmlChar *cur = input; - xmlChar *buffer = NULL; - xmlChar *out = NULL; - int buffer_size = 0; - int html = 0; - - if (input == NULL) return(NULL); - if (doc != NULL) - html = (doc->type == XML_HTML_DOCUMENT_NODE); - - /* - * allocate an translation buffer. - */ - buffer_size = 1000; - buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); - if (buffer == NULL) { - xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: malloc failed"); - return(NULL); - } - out = buffer; - - while (*cur != '\0') { - if (out - buffer > buffer_size - 100) { - int indx = out - buffer; - - growBufferReentrant(); - out = &buffer[indx]; - } - - /* - * By default one have to encode at least '<', '>', '"' and '&' ! - */ - if (*cur == '<') { - *out++ = '&'; - *out++ = 'l'; - *out++ = 't'; - *out++ = ';'; - } else if (*cur == '>') { - *out++ = '&'; - *out++ = 'g'; - *out++ = 't'; - *out++ = ';'; - } else if (*cur == '&') { - *out++ = '&'; - *out++ = 'a'; - *out++ = 'm'; - *out++ = 'p'; - *out++ = ';'; - } else if (((*cur >= 0x20) && (*cur < 0x80)) || - (*cur == '\n') || (*cur == '\t') || ((html) && (*cur == '\r'))) { - /* - * default case, just copy ! - */ - *out++ = *cur; - } else if (*cur >= 0x80) { - if (((doc != NULL) && (doc->encoding != NULL)) || (html)) { - /* - * Bjørn Reese provided the patch - xmlChar xc; - xc = (*cur & 0x3F) << 6; - if (cur[1] != 0) { - xc += *(++cur) & 0x3F; - *out++ = xc; - } else - */ - *out++ = *cur; - } else { - /* - * We assume we have UTF-8 input. - */ - char buf[11], *ptr; - int val = 0, l = 1; - - if (*cur < 0xC0) { - xmlEntitiesErr(XML_CHECK_NOT_UTF8, - "xmlEncodeEntitiesReentrant : input not UTF-8"); - if (doc != NULL) - doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); - snprintf(buf, sizeof(buf), "&#%d;", *cur); - buf[sizeof(buf) - 1] = 0; - ptr = buf; - while (*ptr != 0) *out++ = *ptr++; - cur++; - continue; - } else if (*cur < 0xE0) { - val = (cur[0]) & 0x1F; - val <<= 6; - val |= (cur[1]) & 0x3F; - l = 2; - } else if (*cur < 0xF0) { - val = (cur[0]) & 0x0F; - val <<= 6; - val |= (cur[1]) & 0x3F; - val <<= 6; - val |= (cur[2]) & 0x3F; - l = 3; - } else if (*cur < 0xF8) { - val = (cur[0]) & 0x07; - val <<= 6; - val |= (cur[1]) & 0x3F; - val <<= 6; - val |= (cur[2]) & 0x3F; - val <<= 6; - val |= (cur[3]) & 0x3F; - l = 4; - } - if ((l == 1) || (!IS_CHAR(val))) { - xmlEntitiesErr(XML_ERR_INVALID_CHAR, - "xmlEncodeEntitiesReentrant : char out of range\n"); - if (doc != NULL) - doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); - snprintf(buf, sizeof(buf), "&#%d;", *cur); - buf[sizeof(buf) - 1] = 0; - ptr = buf; - while (*ptr != 0) *out++ = *ptr++; - cur++; - continue; - } - /* - * We could do multiple things here. Just save as a char ref - */ - snprintf(buf, sizeof(buf), "&#x%X;", val); - buf[sizeof(buf) - 1] = 0; - ptr = buf; - while (*ptr != 0) *out++ = *ptr++; - cur += l; - continue; - } - } else if (IS_BYTE_CHAR(*cur)) { - char buf[11], *ptr; - - snprintf(buf, sizeof(buf), "&#%d;", *cur); - buf[sizeof(buf) - 1] = 0; - ptr = buf; - while (*ptr != 0) *out++ = *ptr++; - } - cur++; - } - *out = 0; - return(buffer); -} - -/** - * xmlEncodeSpecialChars: - * @doc: the document containing the string - * @input: A string to convert to XML. - * - * Do a global encoding of a string, replacing the predefined entities - * this routine is reentrant, and result must be deallocated. - * - * Returns A newly allocated string with the substitution done. - */ -xmlChar * -xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) { - const xmlChar *cur = input; - xmlChar *buffer = NULL; - xmlChar *out = NULL; - int buffer_size = 0; - if (input == NULL) return(NULL); - - /* - * allocate an translation buffer. - */ - buffer_size = 1000; - buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); - if (buffer == NULL) { - xmlEntitiesErrMemory("xmlEncodeSpecialChars: malloc failed"); - return(NULL); - } - out = buffer; - - while (*cur != '\0') { - if (out - buffer > buffer_size - 10) { - int indx = out - buffer; - - growBufferReentrant(); - out = &buffer[indx]; - } - - /* - * By default one have to encode at least '<', '>', '"' and '&' ! - */ - if (*cur == '<') { - *out++ = '&'; - *out++ = 'l'; - *out++ = 't'; - *out++ = ';'; - } else if (*cur == '>') { - *out++ = '&'; - *out++ = 'g'; - *out++ = 't'; - *out++ = ';'; - } else if (*cur == '&') { - *out++ = '&'; - *out++ = 'a'; - *out++ = 'm'; - *out++ = 'p'; - *out++ = ';'; - } else if (*cur == '"') { - *out++ = '&'; - *out++ = 'q'; - *out++ = 'u'; - *out++ = 'o'; - *out++ = 't'; - *out++ = ';'; - } else if (*cur == '\r') { - *out++ = '&'; - *out++ = '#'; - *out++ = '1'; - *out++ = '3'; - *out++ = ';'; - } else { - /* - * Works because on UTF-8, all extended sequences cannot - * result in bytes in the ASCII range. - */ - *out++ = *cur; - } - cur++; - } - *out = 0; - return(buffer); -} - -/** - * xmlCreateEntitiesTable: - * - * create and initialize an empty entities hash table. - * This really doesn't make sense and should be deprecated - * - * Returns the xmlEntitiesTablePtr just created or NULL in case of error. - */ -xmlEntitiesTablePtr -xmlCreateEntitiesTable(void) { - return((xmlEntitiesTablePtr) xmlHashCreate(0)); -} - -/** - * xmlFreeEntityWrapper: - * @entity: An entity - * @name: its name - * - * Deallocate the memory used by an entities in the hash table. - */ -static void -xmlFreeEntityWrapper(xmlEntityPtr entity, - const xmlChar *name ATTRIBUTE_UNUSED) { - if (entity != NULL) - xmlFreeEntity(entity); -} - -/** - * xmlFreeEntitiesTable: - * @table: An entity table - * - * Deallocate the memory used by an entities hash table. - */ -void -xmlFreeEntitiesTable(xmlEntitiesTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeEntityWrapper); -} - -#ifdef LIBXML_TREE_ENABLED -/** - * xmlCopyEntity: - * @ent: An entity - * - * Build a copy of an entity - * - * Returns the new xmlEntitiesPtr or NULL in case of error. - */ -static xmlEntityPtr -xmlCopyEntity(xmlEntityPtr ent) { - xmlEntityPtr cur; - - cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); - if (cur == NULL) { - xmlEntitiesErrMemory("xmlCopyEntity:: malloc failed"); - return(NULL); - } - memset(cur, 0, sizeof(xmlEntity)); - cur->type = XML_ENTITY_DECL; - - cur->etype = ent->etype; - if (ent->name != NULL) - cur->name = xmlStrdup(ent->name); - if (ent->ExternalID != NULL) - cur->ExternalID = xmlStrdup(ent->ExternalID); - if (ent->SystemID != NULL) - cur->SystemID = xmlStrdup(ent->SystemID); - if (ent->content != NULL) - cur->content = xmlStrdup(ent->content); - if (ent->orig != NULL) - cur->orig = xmlStrdup(ent->orig); - if (ent->URI != NULL) - cur->URI = xmlStrdup(ent->URI); - return(cur); -} - -/** - * xmlCopyEntitiesTable: - * @table: An entity table - * - * Build a copy of an entity table. - * - * Returns the new xmlEntitiesTablePtr or NULL in case of error. - */ -xmlEntitiesTablePtr -xmlCopyEntitiesTable(xmlEntitiesTablePtr table) { - return(xmlHashCopy(table, (xmlHashCopier) xmlCopyEntity)); -} -#endif /* LIBXML_TREE_ENABLED */ - -#define bottom_entities -#include "elfgcchack.h" diff --git a/deps/libxml2/error.c b/deps/libxml2/error.c deleted file mode 100644 index 05c2a1def0..0000000000 --- a/deps/libxml2/error.c +++ /dev/null @@ -1,949 +0,0 @@ -/* - * error.c: module displaying/handling XML parser errors - * - * See Copyright for the status of this software. - * - * Daniel Veillard - */ - -#define IN_LIBXML -#include "libxml.h" - -#include -#include -#include -#include -#include -#include - -void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, - const char *msg, - ...); - -#define XML_GET_VAR_STR(msg, str) { \ - int size, prev_size = -1; \ - int chars; \ - char *larger; \ - va_list ap; \ - \ - str = (char *) xmlMalloc(150); \ - if (str != NULL) { \ - \ - size = 150; \ - \ - while (size < 64000) { \ - va_start(ap, msg); \ - chars = vsnprintf(str, size, msg, ap); \ - va_end(ap); \ - if ((chars > -1) && (chars < size)) { \ - if (prev_size == chars) { \ - break; \ - } else { \ - prev_size = chars; \ - } \ - } \ - if (chars > -1) \ - size += chars + 1; \ - else \ - size += 100; \ - if ((larger = (char *) xmlRealloc(str, size)) == NULL) {\ - break; \ - } \ - str = larger; \ - }} \ -} - -/************************************************************************ - * * - * Handling of out of context errors * - * * - ************************************************************************/ - -/** - * xmlGenericErrorDefaultFunc: - * @ctx: an error context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Default handler for out of context error messages. - */ -void XMLCDECL -xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { - va_list args; - - if (xmlGenericErrorContext == NULL) - xmlGenericErrorContext = (void *) stderr; - - va_start(args, msg); - vfprintf((FILE *)xmlGenericErrorContext, msg, args); - va_end(args); -} - -/** - * initGenericErrorDefaultFunc: - * @handler: the handler - * - * Set or reset (if NULL) the default handler for generic errors - * to the builtin error function. - */ -void -initGenericErrorDefaultFunc(xmlGenericErrorFunc * handler) -{ - if (handler == NULL) - xmlGenericError = xmlGenericErrorDefaultFunc; - else - xmlGenericError = (*handler); -} - -/** - * xmlSetGenericErrorFunc: - * @ctx: the new error handling context - * @handler: the new handler function - * - * Function to reset the handler and the error context for out of - * context error messages. - * This simply means that @handler will be called for subsequent - * error messages while not parsing nor validating. And @ctx will - * be passed as first argument to @handler - * One can simply force messages to be emitted to another FILE * than - * stderr by setting @ctx to this file handle and @handler to NULL. - * For multi-threaded applications, this must be set separately for each thread. - */ -void -xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { - xmlGenericErrorContext = ctx; - if (handler != NULL) - xmlGenericError = handler; - else - xmlGenericError = xmlGenericErrorDefaultFunc; -} - -/** - * xmlSetStructuredErrorFunc: - * @ctx: the new error handling context - * @handler: the new handler function - * - * Function to reset the handler and the error context for out of - * context structured error messages. - * This simply means that @handler will be called for subsequent - * error messages while not parsing nor validating. And @ctx will - * be passed as first argument to @handler - * For multi-threaded applications, this must be set separately for each thread. - */ -void -xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { - xmlStructuredErrorContext = ctx; - xmlStructuredError = handler; -} - -/************************************************************************ - * * - * Handling of parsing errors * - * * - ************************************************************************/ - -/** - * xmlParserPrintFileInfo: - * @input: an xmlParserInputPtr input - * - * Displays the associated file and line informations for the current input - */ - -void -xmlParserPrintFileInfo(xmlParserInputPtr input) { - if (input != NULL) { - if (input->filename) - xmlGenericError(xmlGenericErrorContext, - "%s:%d: ", input->filename, - input->line); - else - xmlGenericError(xmlGenericErrorContext, - "Entity: line %d: ", input->line); - } -} - -/** - * xmlParserPrintFileContext: - * @input: an xmlParserInputPtr input - * - * Displays current context within the input content for error tracking - */ - -static void -xmlParserPrintFileContextInternal(xmlParserInputPtr input , - xmlGenericErrorFunc channel, void *data ) { - const xmlChar *cur, *base; - unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */ - xmlChar content[81]; /* space for 80 chars + line terminator */ - xmlChar *ctnt; - - if (input == NULL) return; - cur = input->cur; - base = input->base; - /* skip backwards over any end-of-lines */ - while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { - cur--; - } - n = 0; - /* search backwards for beginning-of-line (to max buff size) */ - while ((n++ < (sizeof(content)-1)) && (cur > base) && - (*(cur) != '\n') && (*(cur) != '\r')) - cur--; - if ((*(cur) == '\n') || (*(cur) == '\r')) cur++; - /* calculate the error position in terms of the current position */ - col = input->cur - cur; - /* search forward for end-of-line (to max buff size) */ - n = 0; - ctnt = content; - /* copy selected text to our buffer */ - while ((*cur != 0) && (*(cur) != '\n') && - (*(cur) != '\r') && (n < sizeof(content)-1)) { - *ctnt++ = *cur++; - n++; - } - *ctnt = 0; - /* print out the selected text */ - channel(data ,"%s\n", content); - /* create blank line with problem pointer */ - n = 0; - ctnt = content; - /* (leave buffer space for pointer + line terminator) */ - while ((nfile; - line = err->line; - code = err->code; - domain = err->domain; - level = err->level; - node = err->node; - - if (code == XML_ERR_OK) - return; - - if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) - name = node->name; - - /* - * Maintain the compatibility with the legacy error handling - */ - if (ctxt != NULL) { - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && - (ctxt->inputNr > 1)) { - cur = input; - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - if (input != NULL) { - if (input->filename) - channel(data, "%s:%d: ", input->filename, input->line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: ", input->line); - } - } else { - if (file != NULL) - channel(data, "%s:%d: ", file, line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: ", line); - } - if (name != NULL) { - channel(data, "element %s: ", name); - } - switch (domain) { - case XML_FROM_PARSER: - channel(data, "parser "); - break; - case XML_FROM_NAMESPACE: - channel(data, "namespace "); - break; - case XML_FROM_DTD: - case XML_FROM_VALID: - channel(data, "validity "); - break; - case XML_FROM_HTML: - channel(data, "HTML parser "); - break; - case XML_FROM_MEMORY: - channel(data, "memory "); - break; - case XML_FROM_OUTPUT: - channel(data, "output "); - break; - case XML_FROM_IO: - channel(data, "I/O "); - break; - case XML_FROM_XINCLUDE: - channel(data, "XInclude "); - break; - case XML_FROM_XPATH: - channel(data, "XPath "); - break; - case XML_FROM_XPOINTER: - channel(data, "parser "); - break; - case XML_FROM_REGEXP: - channel(data, "regexp "); - break; - case XML_FROM_MODULE: - channel(data, "module "); - break; - case XML_FROM_SCHEMASV: - channel(data, "Schemas validity "); - break; - case XML_FROM_SCHEMASP: - channel(data, "Schemas parser "); - break; - case XML_FROM_RELAXNGP: - channel(data, "Relax-NG parser "); - break; - case XML_FROM_RELAXNGV: - channel(data, "Relax-NG validity "); - break; - case XML_FROM_CATALOG: - channel(data, "Catalog "); - break; - case XML_FROM_C14N: - channel(data, "C14N "); - break; - case XML_FROM_XSLT: - channel(data, "XSLT "); - break; - case XML_FROM_I18N: - channel(data, "encoding "); - break; - default: - break; - } - switch (level) { - case XML_ERR_NONE: - channel(data, ": "); - break; - case XML_ERR_WARNING: - channel(data, "warning : "); - break; - case XML_ERR_ERROR: - channel(data, "error : "); - break; - case XML_ERR_FATAL: - channel(data, "error : "); - break; - } - if (str != NULL) { - int len; - len = xmlStrlen((const xmlChar *)str); - if ((len > 0) && (str[len - 1] != '\n')) - channel(data, "%s\n", str); - else - channel(data, "%s", str); - } else { - channel(data, "%s\n", "out of memory error"); - } - - if (ctxt != NULL) { - xmlParserPrintFileContextInternal(input, channel, data); - if (cur != NULL) { - if (cur->filename) - channel(data, "%s:%d: \n", cur->filename, cur->line); - else if ((line != 0) && (domain == XML_FROM_PARSER)) - channel(data, "Entity: line %d: \n", cur->line); - xmlParserPrintFileContextInternal(cur, channel, data); - } - } - if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) && - (err->int1 < 100) && - (err->int1 < xmlStrlen((const xmlChar *)err->str1))) { - xmlChar buf[150]; - int i; - - channel(data, "%s\n", err->str1); - for (i=0;i < err->int1;i++) - buf[i] = ' '; - buf[i++] = '^'; - buf[i] = 0; - channel(data, "%s\n", buf); - } -} - -/** - * __xmlRaiseError: - * @schannel: the structured callback channel - * @channel: the old callback channel - * @data: the callback data - * @ctx: the parser context or NULL - * @ctx: the parser context or NULL - * @domain: the domain for the error - * @code: the code for the error - * @level: the xmlErrorLevel for the error - * @file: the file source of the error (or NULL) - * @line: the line of the error or 0 if N/A - * @str1: extra string info - * @str2: extra string info - * @str3: extra string info - * @int1: extra int info - * @col: column number of the error or 0 if N/A - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Update the appropriate global or contextual error structure, - * then forward the error message down the parser or generic - * error callback handler - */ -void XMLCDECL -__xmlRaiseError(xmlStructuredErrorFunc schannel, - xmlGenericErrorFunc channel, void *data, void *ctx, - void *nod, int domain, int code, xmlErrorLevel level, - const char *file, int line, const char *str1, - const char *str2, const char *str3, int int1, int col, - const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = NULL; - xmlNodePtr node = (xmlNodePtr) nod; - char *str = NULL; - xmlParserInputPtr input = NULL; - xmlErrorPtr to = &xmlLastError; - xmlNodePtr baseptr = NULL; - - if (code == XML_ERR_OK) - return; - if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING)) - return; - if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || - (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) || - (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { - ctxt = (xmlParserCtxtPtr) ctx; - if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && - (ctxt->sax->initialized == XML_SAX2_MAGIC) && - (ctxt->sax->serror != NULL)) { - schannel = ctxt->sax->serror; - data = ctxt->userData; - } - } - /* - * Check if structured error handler set - */ - if (schannel == NULL) { - schannel = xmlStructuredError; - /* - * if user has defined handler, change data ptr to user's choice - */ - if (schannel != NULL) - data = xmlStructuredErrorContext; - } - /* - * Formatting the message - */ - if (msg == NULL) { - str = (char *) xmlStrdup(BAD_CAST "No error message provided"); - } else { - XML_GET_VAR_STR(msg, str); - } - - /* - * specific processing if a parser context is provided - */ - if (ctxt != NULL) { - if (file == NULL) { - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && - (ctxt->inputNr > 1)) { - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - if (input != NULL) { - file = input->filename; - line = input->line; - col = input->col; - } - } - to = &ctxt->lastError; - } else if ((node != NULL) && (file == NULL)) { - int i; - - if ((node->doc != NULL) && (node->doc->URL != NULL)) { - baseptr = node; -/* file = (const char *) node->doc->URL; */ - } - for (i = 0; - ((i < 10) && (node != NULL) && (node->type != XML_ELEMENT_NODE)); - i++) - node = node->parent; - if ((baseptr == NULL) && (node != NULL) && - (node->doc != NULL) && (node->doc->URL != NULL)) - baseptr = node; - - if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) - line = node->line; - } - - /* - * Save the information about the error - */ - xmlResetError(to); - to->domain = domain; - to->code = code; - to->message = str; - to->level = level; - if (file != NULL) - to->file = (char *) xmlStrdup((const xmlChar *) file); - else if (baseptr != NULL) { - to->file = (char *) xmlStrdup(baseptr->doc->URL); - if ((to->file == NULL) && (node != NULL) && (node->doc != NULL)) { - to->file = (char *) xmlStrdup(node->doc->URL); - } - } - to->line = line; - if (str1 != NULL) - to->str1 = (char *) xmlStrdup((const xmlChar *) str1); - if (str2 != NULL) - to->str2 = (char *) xmlStrdup((const xmlChar *) str2); - if (str3 != NULL) - to->str3 = (char *) xmlStrdup((const xmlChar *) str3); - to->int1 = int1; - to->int2 = col; - to->node = node; - to->ctxt = ctx; - - if (to != &xmlLastError) - xmlCopyError(to,&xmlLastError); - - if (schannel != NULL) { - schannel(data, to); - return; - } - - /* - * Find the callback channel if channel param is NULL - */ - if ((ctxt != NULL) && (channel == NULL) && - (xmlStructuredError == NULL) && (ctxt->sax != NULL)) { - if (level == XML_ERR_WARNING) - channel = ctxt->sax->warning; - else - channel = ctxt->sax->error; - data = ctxt->userData; - } else if (channel == NULL) { - channel = xmlGenericError; - if (!data) - data = xmlGenericErrorContext; - } - if (channel == NULL) - return; - - if ((channel == xmlParserError) || - (channel == xmlParserWarning) || - (channel == xmlParserValidityError) || - (channel == xmlParserValidityWarning)) - xmlReportError(to, ctxt, str, NULL, NULL); - else if ((channel == (xmlGenericErrorFunc) fprintf) || - (channel == xmlGenericErrorDefaultFunc)) - xmlReportError(to, ctxt, str, channel, data); - else - channel(data, "%s", str); -} - -/** - * __xmlSimpleError: - * @domain: where the error comes from - * @code: the error code - * @node: the context node - * @extra: extra informations - * - * Handle an out of memory condition - */ -void -__xmlSimpleError(int domain, int code, xmlNodePtr node, - const char *msg, const char *extra) -{ - - if (code == XML_ERR_NO_MEMORY) { - if (extra) - __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, - XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra, - NULL, NULL, 0, 0, - "Memory allocation failed : %s\n", extra); - else - __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, - XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL, - NULL, NULL, 0, 0, "Memory allocation failed\n"); - } else { - __xmlRaiseError(NULL, NULL, NULL, NULL, node, domain, - code, XML_ERR_ERROR, NULL, 0, extra, - NULL, NULL, 0, 0, msg, extra); - } -} -/** - * xmlParserError: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format an error messages, gives file, line, position and - * extra parameters. - */ -void XMLCDECL -xmlParserError(void *ctx, const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr input = NULL; - xmlParserInputPtr cur = NULL; - char * str; - - if (ctxt != NULL) { - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && - (ctxt->inputNr > 1)) { - cur = input; - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - xmlParserPrintFileInfo(input); - } - - xmlGenericError(xmlGenericErrorContext, "error: "); - XML_GET_VAR_STR(msg, str); - xmlGenericError(xmlGenericErrorContext, "%s", str); - if (str != NULL) - xmlFree(str); - - if (ctxt != NULL) { - xmlParserPrintFileContext(input); - if (cur != NULL) { - xmlParserPrintFileInfo(cur); - xmlGenericError(xmlGenericErrorContext, "\n"); - xmlParserPrintFileContext(cur); - } - } -} - -/** - * xmlParserWarning: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a warning messages, gives file, line, position and - * extra parameters. - */ -void XMLCDECL -xmlParserWarning(void *ctx, const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr input = NULL; - xmlParserInputPtr cur = NULL; - char * str; - - if (ctxt != NULL) { - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && - (ctxt->inputNr > 1)) { - cur = input; - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - xmlParserPrintFileInfo(input); - } - - xmlGenericError(xmlGenericErrorContext, "warning: "); - XML_GET_VAR_STR(msg, str); - xmlGenericError(xmlGenericErrorContext, "%s", str); - if (str != NULL) - xmlFree(str); - - if (ctxt != NULL) { - xmlParserPrintFileContext(input); - if (cur != NULL) { - xmlParserPrintFileInfo(cur); - xmlGenericError(xmlGenericErrorContext, "\n"); - xmlParserPrintFileContext(cur); - } - } -} - -/************************************************************************ - * * - * Handling of validation errors * - * * - ************************************************************************/ - -/** - * xmlParserValidityError: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format an validity error messages, gives file, - * line, position and extra parameters. - */ -void XMLCDECL -xmlParserValidityError(void *ctx, const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr input = NULL; - char * str; - int len = xmlStrlen((const xmlChar *) msg); - static int had_info = 0; - - if ((len > 1) && (msg[len - 2] != ':')) { - if (ctxt != NULL) { - input = ctxt->input; - if ((input->filename == NULL) && (ctxt->inputNr > 1)) - input = ctxt->inputTab[ctxt->inputNr - 2]; - - if (had_info == 0) { - xmlParserPrintFileInfo(input); - } - } - xmlGenericError(xmlGenericErrorContext, "validity error: "); - had_info = 0; - } else { - had_info = 1; - } - - XML_GET_VAR_STR(msg, str); - xmlGenericError(xmlGenericErrorContext, "%s", str); - if (str != NULL) - xmlFree(str); - - if ((ctxt != NULL) && (input != NULL)) { - xmlParserPrintFileContext(input); - } -} - -/** - * xmlParserValidityWarning: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a validity warning messages, gives file, line, - * position and extra parameters. - */ -void XMLCDECL -xmlParserValidityWarning(void *ctx, const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr input = NULL; - char * str; - int len = xmlStrlen((const xmlChar *) msg); - - if ((ctxt != NULL) && (len != 0) && (msg[len - 1] != ':')) { - input = ctxt->input; - if ((input->filename == NULL) && (ctxt->inputNr > 1)) - input = ctxt->inputTab[ctxt->inputNr - 2]; - - xmlParserPrintFileInfo(input); - } - - xmlGenericError(xmlGenericErrorContext, "validity warning: "); - XML_GET_VAR_STR(msg, str); - xmlGenericError(xmlGenericErrorContext, "%s", str); - if (str != NULL) - xmlFree(str); - - if (ctxt != NULL) { - xmlParserPrintFileContext(input); - } -} - - -/************************************************************************ - * * - * Extended Error Handling * - * * - ************************************************************************/ - -/** - * xmlGetLastError: - * - * Get the last global error registered. This is per thread if compiled - * with thread support. - * - * Returns NULL if no error occured or a pointer to the error - */ -xmlErrorPtr -xmlGetLastError(void) -{ - if (xmlLastError.code == XML_ERR_OK) - return (NULL); - return (&xmlLastError); -} - -/** - * xmlResetError: - * @err: pointer to the error. - * - * Cleanup the error. - */ -void -xmlResetError(xmlErrorPtr err) -{ - if (err == NULL) - return; - if (err->code == XML_ERR_OK) - return; - if (err->message != NULL) - xmlFree(err->message); - if (err->file != NULL) - xmlFree(err->file); - if (err->str1 != NULL) - xmlFree(err->str1); - if (err->str2 != NULL) - xmlFree(err->str2); - if (err->str3 != NULL) - xmlFree(err->str3); - memset(err, 0, sizeof(xmlError)); - err->code = XML_ERR_OK; -} - -/** - * xmlResetLastError: - * - * Cleanup the last global error registered. For parsing error - * this does not change the well-formedness result. - */ -void -xmlResetLastError(void) -{ - if (xmlLastError.code == XML_ERR_OK) - return; - xmlResetError(&xmlLastError); -} - -/** - * xmlCtxtGetLastError: - * @ctx: an XML parser context - * - * Get the last parsing error registered. - * - * Returns NULL if no error occured or a pointer to the error - */ -xmlErrorPtr -xmlCtxtGetLastError(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - - if (ctxt == NULL) - return (NULL); - if (ctxt->lastError.code == XML_ERR_OK) - return (NULL); - return (&ctxt->lastError); -} - -/** - * xmlCtxtResetLastError: - * @ctx: an XML parser context - * - * Cleanup the last global error registered. For parsing error - * this does not change the well-formedness result. - */ -void -xmlCtxtResetLastError(void *ctx) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - - if (ctxt == NULL) - return; - ctxt->errNo = XML_ERR_OK; - if (ctxt->lastError.code == XML_ERR_OK) - return; - xmlResetError(&ctxt->lastError); -} - -/** - * xmlCopyError: - * @from: a source error - * @to: a target error - * - * Save the original error to the new place. - * - * Returns 0 in case of success and -1 in case of error. - */ -int -xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) { - char *message, *file, *str1, *str2, *str3; - - if ((from == NULL) || (to == NULL)) - return(-1); - - message = (char *) xmlStrdup((xmlChar *) from->message); - file = (char *) xmlStrdup ((xmlChar *) from->file); - str1 = (char *) xmlStrdup ((xmlChar *) from->str1); - str2 = (char *) xmlStrdup ((xmlChar *) from->str2); - str3 = (char *) xmlStrdup ((xmlChar *) from->str3); - - if (to->message != NULL) - xmlFree(to->message); - if (to->file != NULL) - xmlFree(to->file); - if (to->str1 != NULL) - xmlFree(to->str1); - if (to->str2 != NULL) - xmlFree(to->str2); - if (to->str3 != NULL) - xmlFree(to->str3); - to->domain = from->domain; - to->code = from->code; - to->level = from->level; - to->line = from->line; - to->node = from->node; - to->int1 = from->int1; - to->int2 = from->int2; - to->node = from->node; - to->ctxt = from->ctxt; - to->message = message; - to->file = file; - to->str1 = str1; - to->str2 = str2; - to->str3 = str3; - - return 0; -} - -#define bottom_error -#include "elfgcchack.h" diff --git a/deps/libxml2/globals.c b/deps/libxml2/globals.c deleted file mode 100644 index ffbbe0f8d3..0000000000 --- a/deps/libxml2/globals.c +++ /dev/null @@ -1,737 +0,0 @@ -/* - * globals.c: definition and handling of the set of global variables - * of the library - * - * The bottom of this file is automatically generated by build_glob.py - * based on the description file global.data - * - * See Copyright for the status of this software. - * - * Gary Pennington - * daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#ifdef HAVE_STDLIB_H -#include -#endif -#include - -#include -#include -#include - -/** - * xmlInitGlobals: - * - * Additional initialisation for multi-threading - */ -void xmlInitGlobals(void) -{ -} - -/** - * xmlCleanupGlobals: - * - * Additional cleanup for multi-threading - */ -void xmlCleanupGlobals(void) -{ -} - -/************************************************************************ - * * - * All the user accessible global variables of the library * - * * - ************************************************************************/ - -/* - * Memory allocation routines - */ -#undef xmlFree -#undef xmlMalloc -#undef xmlMallocAtomic -#undef xmlMemStrdup -#undef xmlRealloc - -/** - * xmlFree: - * @mem: an already allocated block of memory - * - * The variable holding the libxml free() implementation - */ -xmlFreeFunc xmlFree = (xmlFreeFunc) free; -/** - * xmlMalloc: - * @size: the size requested in bytes - * - * The variable holding the libxml malloc() implementation - * - * Returns a pointer to the newly allocated block or NULL in case of error - */ -xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc; -/** - * xmlMallocAtomic: - * @size: the size requested in bytes - * - * The variable holding the libxml malloc() implementation for atomic - * data (i.e. blocks not containings pointers), useful when using a - * garbage collecting allocator. - * - * Returns a pointer to the newly allocated block or NULL in case of error - */ -xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc; -/** - * xmlRealloc: - * @mem: an already allocated block of memory - * @size: the new size requested in bytes - * - * The variable holding the libxml realloc() implementation - * - * Returns a pointer to the newly reallocated block or NULL in case of error - */ -xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc; -/** - * xmlMemStrdup: - * @str: a zero terminated string - * - * The variable holding the libxml strdup() implementation - * - * Returns the copy of the string or NULL in case of error - */ -xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; - -#include -#include -#include - -#undef docbDefaultSAXHandler -#undef htmlDefaultSAXHandler -#undef oldXMLWDcompatibility -#undef xmlBufferAllocScheme -#undef xmlDefaultBufferSize -#undef xmlDefaultSAXHandler -#undef xmlDefaultSAXLocator -#undef xmlDoValidityCheckingDefaultValue -#undef xmlGenericError -#undef xmlStructuredError -#undef xmlGenericErrorContext -#undef xmlStructuredErrorContext -#undef xmlGetWarningsDefaultValue -#undef xmlIndentTreeOutput -#undef xmlTreeIndentString -#undef xmlKeepBlanksDefaultValue -#undef xmlLineNumbersDefaultValue -#undef xmlLoadExtDtdDefaultValue -#undef xmlParserDebugEntities -#undef xmlParserVersion -#undef xmlPedanticParserDefaultValue -#undef xmlSaveNoEmptyTags -#undef xmlSubstituteEntitiesDefaultValue -#undef xmlRegisterNodeDefaultValue -#undef xmlDeregisterNodeDefaultValue -#undef xmlLastError - -#undef xmlParserInputBufferCreateFilenameValue -#undef xmlOutputBufferCreateFilenameValue -/** - * xmlParserVersion: - * - * Constant string describing the internal version of the library - */ -const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA; - -/** - * xmlBufferAllocScheme: - * - * Global setting, default allocation policy for buffers, default is - * XML_BUFFER_ALLOC_EXACT - */ -xmlBufferAllocationScheme xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT; -static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_EXACT; -/** - * xmlDefaultBufferSize: - * - * Global setting, default buffer size. Default value is BASE_BUFFER_SIZE - */ -int xmlDefaultBufferSize = BASE_BUFFER_SIZE; -static int xmlDefaultBufferSizeThrDef = BASE_BUFFER_SIZE; - -/* - * Parser defaults - */ - -/** - * oldXMLWDcompatibility: - * - * Global setting, DEPRECATED. - */ -int oldXMLWDcompatibility = 0; /* DEPRECATED */ -/** - * xmlParserDebugEntities: - * - * Global setting, asking the parser to print out debugging informations. - * while handling entities. - * Disabled by default - */ -int xmlParserDebugEntities = 0; -static int xmlParserDebugEntitiesThrDef = 0; -/** - * xmlDoValidityCheckingDefaultValue: - * - * Global setting, indicate that the parser should work in validating mode. - * Disabled by default. - */ -int xmlDoValidityCheckingDefaultValue = 0; -static int xmlDoValidityCheckingDefaultValueThrDef = 0; -/** - * xmlGetWarningsDefaultValue: - * - * Global setting, indicate that the parser should provide warnings. - * Activated by default. - */ -int xmlGetWarningsDefaultValue = 1; -static int xmlGetWarningsDefaultValueThrDef = 1; -/** - * xmlLoadExtDtdDefaultValue: - * - * Global setting, indicate that the parser should load DTD while not - * validating. - * Disabled by default. - */ -int xmlLoadExtDtdDefaultValue = 0; -static int xmlLoadExtDtdDefaultValueThrDef = 0; -/** - * xmlPedanticParserDefaultValue: - * - * Global setting, indicate that the parser be pedantic - * Disabled by default. - */ -int xmlPedanticParserDefaultValue = 0; -static int xmlPedanticParserDefaultValueThrDef = 0; -/** - * xmlLineNumbersDefaultValue: - * - * Global setting, indicate that the parser should store the line number - * in the content field of elements in the DOM tree. - * Disabled by default since this may not be safe for old classes of - * applicaton. - */ -int xmlLineNumbersDefaultValue = 0; -static int xmlLineNumbersDefaultValueThrDef = 0; -/** - * xmlKeepBlanksDefaultValue: - * - * Global setting, indicate that the parser should keep all blanks - * nodes found in the content - * Activated by default, this is actually needed to have the parser - * conformant to the XML Recommendation, however the option is kept - * for some applications since this was libxml1 default behaviour. - */ -int xmlKeepBlanksDefaultValue = 1; -static int xmlKeepBlanksDefaultValueThrDef = 1; -/** - * xmlSubstituteEntitiesDefaultValue: - * - * Global setting, indicate that the parser should not generate entity - * references but replace them with the actual content of the entity - * Disabled by default, this should be activated when using XPath since - * the XPath data model requires entities replacement and the XPath - * engine does not handle entities references transparently. - */ -int xmlSubstituteEntitiesDefaultValue = 0; -static int xmlSubstituteEntitiesDefaultValueThrDef = 0; - -xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL; -static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL; -xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL; -static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL; - -xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL; -static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL; - -xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL; -static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL; - -/* - * Error handling - */ - -/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */ -/* Must initialize xmlGenericError in xmlInitParser */ -void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, - const char *msg, - ...); -/** - * xmlGenericError: - * - * Global setting: function used for generic error callbacks - */ -xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; -static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc; -/** - * xmlStructuredError: - * - * Global setting: function used for structured error callbacks - */ -xmlStructuredErrorFunc xmlStructuredError = NULL; -static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL; -/** - * xmlGenericErrorContext: - * - * Global setting passed to generic error callbacks - */ -void *xmlGenericErrorContext = NULL; -static void *xmlGenericErrorContextThrDef = NULL; -/** - * xmlStructuredErrorContext: - * - * Global setting passed to structured error callbacks - */ -void *xmlStructuredErrorContext = NULL; -static void *xmlStructuredErrorContextThrDef = NULL; -xmlError xmlLastError; - -/* - * output defaults - */ -/** - * xmlIndentTreeOutput: - * - * Global setting, asking the serializer to indent the output tree by default - * Enabled by default - */ -int xmlIndentTreeOutput = 1; -static int xmlIndentTreeOutputThrDef = 1; - -/** - * xmlTreeIndentString: - * - * The string used to do one-level indent. By default is equal to " " (two spaces) - */ -const char *xmlTreeIndentString = " "; -static const char *xmlTreeIndentStringThrDef = " "; - -/** - * xmlSaveNoEmptyTags: - * - * Global setting, asking the serializer to not output empty tags - * as but . those two forms are undistinguishable - * once parsed. - * Disabled by default - */ -int xmlSaveNoEmptyTags = 0; -static int xmlSaveNoEmptyTagsThrDef = 0; - -/** - * xmlDefaultSAXLocator: - * - * The default SAX Locator - * { getPublicId, getSystemId, getLineNumber, getColumnNumber} - */ -xmlSAXLocator xmlDefaultSAXLocator = { - xmlSAX2GetPublicId, - xmlSAX2GetSystemId, - xmlSAX2GetLineNumber, - xmlSAX2GetColumnNumber -}; - -/** - * xmlInitializeGlobalState: - * @gs: a pointer to a newly allocated global state - * - * xmlInitializeGlobalState() initialize a global state with all the - * default values of the library. - */ -void -xmlInitializeGlobalState(xmlGlobalStatePtr gs) -{ - /* - * Perform initialization as required by libxml - */ - - gs->oldXMLWDcompatibility = 0; - gs->xmlBufferAllocScheme = xmlBufferAllocSchemeThrDef; - gs->xmlDefaultBufferSize = xmlDefaultBufferSizeThrDef; - gs->xmlDefaultSAXLocator.getPublicId = xmlSAX2GetPublicId; - gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId; - gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber; - gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber; - gs->xmlDoValidityCheckingDefaultValue = - xmlDoValidityCheckingDefaultValueThrDef; - gs->xmlFree = (xmlFreeFunc) free; - gs->xmlMalloc = (xmlMallocFunc) malloc; - gs->xmlMallocAtomic = (xmlMallocFunc) malloc; - gs->xmlRealloc = (xmlReallocFunc) realloc; - gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; - gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef; - gs->xmlIndentTreeOutput = xmlIndentTreeOutputThrDef; - gs->xmlTreeIndentString = xmlTreeIndentStringThrDef; - gs->xmlKeepBlanksDefaultValue = xmlKeepBlanksDefaultValueThrDef; - gs->xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef; - gs->xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef; - gs->xmlParserDebugEntities = xmlParserDebugEntitiesThrDef; - gs->xmlParserVersion = LIBXML_VERSION_STRING; - gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef; - gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef; - gs->xmlSubstituteEntitiesDefaultValue = - xmlSubstituteEntitiesDefaultValueThrDef; - - gs->xmlGenericError = xmlGenericErrorThrDef; - gs->xmlStructuredError = xmlStructuredErrorThrDef; - gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef; - gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef; - gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef; - gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef; - - gs->xmlParserInputBufferCreateFilenameValue = xmlParserInputBufferCreateFilenameValueThrDef; - gs->xmlOutputBufferCreateFilenameValue = xmlOutputBufferCreateFilenameValueThrDef; - memset(&gs->xmlLastError, 0, sizeof(xmlError)); -} - -/** - * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions, - * those are really internal work - */ -void -xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { - xmlGenericErrorContextThrDef = ctx; - if (handler != NULL) - xmlGenericErrorThrDef = handler; - else - xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc; -} - -void -xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { - xmlStructuredErrorContextThrDef = ctx; - xmlStructuredErrorThrDef = handler; -} - -/** - * xmlRegisterNodeDefault: - * @func: function pointer to the new RegisterNodeFunc - * - * Registers a callback for node creation - * - * Returns the old value of the registration function - */ -xmlRegisterNodeFunc -xmlRegisterNodeDefault(xmlRegisterNodeFunc func) -{ - xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue; - - __xmlRegisterCallbacks = 1; - xmlRegisterNodeDefaultValue = func; - return(old); -} - -xmlRegisterNodeFunc -xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func) -{ - xmlRegisterNodeFunc old; - - old = xmlRegisterNodeDefaultValueThrDef; - - __xmlRegisterCallbacks = 1; - xmlRegisterNodeDefaultValueThrDef = func; - - return(old); -} - -/** - * xmlDeregisterNodeDefault: - * @func: function pointer to the new DeregisterNodeFunc - * - * Registers a callback for node destruction - * - * Returns the previous value of the deregistration function - */ -xmlDeregisterNodeFunc -xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func) -{ - xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue; - - __xmlRegisterCallbacks = 1; - xmlDeregisterNodeDefaultValue = func; - return(old); -} - -xmlDeregisterNodeFunc -xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func) -{ - xmlDeregisterNodeFunc old; - - old = xmlDeregisterNodeDefaultValueThrDef; - - __xmlRegisterCallbacks = 1; - xmlDeregisterNodeDefaultValueThrDef = func; - - return(old); -} - -xmlParserInputBufferCreateFilenameFunc -xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func) -{ - xmlParserInputBufferCreateFilenameFunc old; - - old = xmlParserInputBufferCreateFilenameValueThrDef; - if (old == NULL) { - old = __xmlParserInputBufferCreateFilename; - } - - xmlParserInputBufferCreateFilenameValueThrDef = func; - - return(old); -} - -xmlOutputBufferCreateFilenameFunc -xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func) -{ - xmlOutputBufferCreateFilenameFunc old; - - old = xmlOutputBufferCreateFilenameValueThrDef; - xmlOutputBufferCreateFilenameValueThrDef = func; - - return(old); -} - -#undef xmlLastError -xmlError * -__xmlLastError(void) { - return (&xmlLastError); -} - -/* - * Everything starting from the line below is - * Automatically generated by build_glob.py. - * Do not modify the previous line. - */ - - -#undef oldXMLWDcompatibility -int * -__oldXMLWDcompatibility(void) { - return (&oldXMLWDcompatibility); -} - -#undef xmlBufferAllocScheme -xmlBufferAllocationScheme * -__xmlBufferAllocScheme(void) { - return (&xmlBufferAllocScheme); -} -xmlBufferAllocationScheme xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v) { - xmlBufferAllocationScheme ret; - ret = xmlBufferAllocSchemeThrDef; - xmlBufferAllocSchemeThrDef = v; - return ret; -} - -#undef xmlDefaultBufferSize -int * -__xmlDefaultBufferSize(void) { - return (&xmlDefaultBufferSize); -} -int xmlThrDefDefaultBufferSize(int v) { - int ret; - ret = xmlDefaultBufferSizeThrDef; - xmlDefaultBufferSizeThrDef = v; - return ret; -} - -#undef xmlDefaultSAXLocator -xmlSAXLocator * -__xmlDefaultSAXLocator(void) { - return (&xmlDefaultSAXLocator); -} - -#undef xmlDoValidityCheckingDefaultValue -int * -__xmlDoValidityCheckingDefaultValue(void) { - return (&xmlDoValidityCheckingDefaultValue); -} -int xmlThrDefDoValidityCheckingDefaultValue(int v) { - int ret; - ret = xmlDoValidityCheckingDefaultValueThrDef; - xmlDoValidityCheckingDefaultValueThrDef = v; - return ret; -} - -#undef xmlGenericError -xmlGenericErrorFunc * -__xmlGenericError(void) { - return (&xmlGenericError); -} - -#undef xmlStructuredError -xmlStructuredErrorFunc * -__xmlStructuredError(void) { - return (&xmlStructuredError); -} - -#undef xmlGenericErrorContext -void * * -__xmlGenericErrorContext(void) { - return (&xmlGenericErrorContext); -} - -#undef xmlStructuredErrorContext -void * * -__xmlStructuredErrorContext(void) { - return (&xmlStructuredErrorContext); -} - -#undef xmlGetWarningsDefaultValue -int * -__xmlGetWarningsDefaultValue(void) { - return (&xmlGetWarningsDefaultValue); -} -int xmlThrDefGetWarningsDefaultValue(int v) { - int ret; - ret = xmlGetWarningsDefaultValueThrDef; - xmlGetWarningsDefaultValueThrDef = v; - return ret; -} - -#undef xmlIndentTreeOutput -int * -__xmlIndentTreeOutput(void) { - return (&xmlIndentTreeOutput); -} -int xmlThrDefIndentTreeOutput(int v) { - int ret; - ret = xmlIndentTreeOutputThrDef; - xmlIndentTreeOutputThrDef = v; - return ret; -} - -#undef xmlTreeIndentString -const char * * -__xmlTreeIndentString(void) { - return (&xmlTreeIndentString); -} -const char * xmlThrDefTreeIndentString(const char * v) { - const char * ret; - ret = xmlTreeIndentStringThrDef; - xmlTreeIndentStringThrDef = v; - return ret; -} - -#undef xmlKeepBlanksDefaultValue -int * -__xmlKeepBlanksDefaultValue(void) { - return (&xmlKeepBlanksDefaultValue); -} -int xmlThrDefKeepBlanksDefaultValue(int v) { - int ret; - ret = xmlKeepBlanksDefaultValueThrDef; - xmlKeepBlanksDefaultValueThrDef = v; - return ret; -} - -#undef xmlLineNumbersDefaultValue -int * -__xmlLineNumbersDefaultValue(void) { - return (&xmlLineNumbersDefaultValue); -} -int xmlThrDefLineNumbersDefaultValue(int v) { - int ret; - ret = xmlLineNumbersDefaultValueThrDef; - xmlLineNumbersDefaultValueThrDef = v; - return ret; -} - -#undef xmlLoadExtDtdDefaultValue -int * -__xmlLoadExtDtdDefaultValue(void) { - return (&xmlLoadExtDtdDefaultValue); -} -int xmlThrDefLoadExtDtdDefaultValue(int v) { - int ret; - ret = xmlLoadExtDtdDefaultValueThrDef; - xmlLoadExtDtdDefaultValueThrDef = v; - return ret; -} - -#undef xmlParserDebugEntities -int * -__xmlParserDebugEntities(void) { - return (&xmlParserDebugEntities); -} -int xmlThrDefParserDebugEntities(int v) { - int ret; - ret = xmlParserDebugEntitiesThrDef; - xmlParserDebugEntitiesThrDef = v; - return ret; -} - -#undef xmlParserVersion -const char * * -__xmlParserVersion(void) { - return (&xmlParserVersion); -} - -#undef xmlPedanticParserDefaultValue -int * -__xmlPedanticParserDefaultValue(void) { - return (&xmlPedanticParserDefaultValue); -} -int xmlThrDefPedanticParserDefaultValue(int v) { - int ret; - ret = xmlPedanticParserDefaultValueThrDef; - xmlPedanticParserDefaultValueThrDef = v; - return ret; -} - -#undef xmlSaveNoEmptyTags -int * -__xmlSaveNoEmptyTags(void) { - return (&xmlSaveNoEmptyTags); -} -int xmlThrDefSaveNoEmptyTags(int v) { - int ret; - ret = xmlSaveNoEmptyTagsThrDef; - xmlSaveNoEmptyTagsThrDef = v; - return ret; -} - -#undef xmlSubstituteEntitiesDefaultValue -int * -__xmlSubstituteEntitiesDefaultValue(void) { - return (&xmlSubstituteEntitiesDefaultValue); -} -int xmlThrDefSubstituteEntitiesDefaultValue(int v) { - int ret; - ret = xmlSubstituteEntitiesDefaultValueThrDef; - xmlSubstituteEntitiesDefaultValueThrDef = v; - return ret; -} - -#undef xmlRegisterNodeDefaultValue -xmlRegisterNodeFunc * -__xmlRegisterNodeDefaultValue(void) { - return (&xmlRegisterNodeDefaultValue); -} - -#undef xmlDeregisterNodeDefaultValue -xmlDeregisterNodeFunc * -__xmlDeregisterNodeDefaultValue(void) { - return (&xmlDeregisterNodeDefaultValue); -} - -#undef xmlParserInputBufferCreateFilenameValue -xmlParserInputBufferCreateFilenameFunc * -__xmlParserInputBufferCreateFilenameValue(void) { - return (&xmlParserInputBufferCreateFilenameValue); -} - -#undef xmlOutputBufferCreateFilenameValue -xmlOutputBufferCreateFilenameFunc * -__xmlOutputBufferCreateFilenameValue(void) { - return (&xmlOutputBufferCreateFilenameValue); -} - -#define bottom_globals -#include "elfgcchack.h" diff --git a/deps/libxml2/libxml.h b/deps/libxml2/libxml.h deleted file mode 100644 index 1a87b6f8bd..0000000000 --- a/deps/libxml2/libxml.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * libxml.h: internal header only used during the compilation of libxml - * - * See COPYRIGHT for the status of this software - * - * Author: breese@users.sourceforge.net - */ - -#ifndef __XML_LIBXML_H__ -#define __XML_LIBXML_H__ - -#ifndef NO_LARGEFILE_SOURCE -#ifndef _LARGEFILE_SOURCE -#define _LARGEFILE_SOURCE -#endif -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 64 -#endif -#endif - -#include "config.h" -#include - -#include - -/* - * Internal variable indicating if a callback has been registered for - * node creation/destruction. It avoids spending a lot of time in locking - * function while checking if the callback exists. - */ -extern int __xmlRegisterCallbacks; -/* - * internal error reporting routines, shared but not partof the API. - */ -void __xmlIOErr(int domain, int code, const char *extra); -void __xmlLoaderErr(void *ctx, const char *msg, const char *filename); - -#ifdef IN_LIBXML -#ifdef __GNUC__ -#ifdef PIC -#ifdef linux -#if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3) -#include "elfgcchack.h" -#endif -#endif -#endif -#endif -#endif -#if !defined(PIC) && !defined(NOLIBTOOL) -# define LIBXML_STATIC -#endif -#endif /* ! __XML_LIBXML_H__ */ diff --git a/deps/libxml2/libxml/SAX.h b/deps/libxml2/libxml/SAX.h deleted file mode 100644 index 71311ad843..0000000000 --- a/deps/libxml2/libxml/SAX.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Summary: Old SAX version 1 handler, deprecated - * Description: DEPRECATED set of SAX version 1 interfaces used to - * build the DOM tree. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SAX_H__ -#define __XML_SAX_H__ - -#include -#include -#include -#include -#include - - -#endif /* __XML_SAX_H__ */ diff --git a/deps/libxml2/libxml/SAX2.h b/deps/libxml2/libxml/SAX2.h deleted file mode 100644 index 67de7d7789..0000000000 --- a/deps/libxml2/libxml/SAX2.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Summary: SAX2 parser interface used to build the DOM tree - * Description: those are the default SAX2 interfaces used by - * the library when building DOM tree. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_SAX2_H__ -#define __XML_SAX2_H__ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -XMLPUBFUN const xmlChar * XMLCALL - xmlSAX2GetPublicId (void *ctx); -XMLPUBFUN const xmlChar * XMLCALL - xmlSAX2GetSystemId (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2SetDocumentLocator (void *ctx, - xmlSAXLocatorPtr loc); - -XMLPUBFUN int XMLCALL - xmlSAX2GetLineNumber (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2GetColumnNumber (void *ctx); - -XMLPUBFUN int XMLCALL - xmlSAX2IsStandalone (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2HasInternalSubset (void *ctx); -XMLPUBFUN int XMLCALL - xmlSAX2HasExternalSubset (void *ctx); - -XMLPUBFUN void XMLCALL - xmlSAX2InternalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN void XMLCALL - xmlSAX2ExternalSubset (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlSAX2GetEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlSAX2GetParameterEntity (void *ctx, - const xmlChar *name); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlSAX2ResolveEntity (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); - -XMLPUBFUN void XMLCALL - xmlSAX2EntityDecl (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -XMLPUBFUN void XMLCALL - xmlSAX2AttributeDecl (void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -XMLPUBFUN void XMLCALL - xmlSAX2ElementDecl (void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlSAX2NotationDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -XMLPUBFUN void XMLCALL - xmlSAX2UnparsedEntityDecl (void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); - -XMLPUBFUN void XMLCALL - xmlSAX2StartDocument (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2EndDocument (void *ctx); -XMLPUBFUN void XMLCALL - xmlSAX2StartElementNs (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes); -XMLPUBFUN void XMLCALL - xmlSAX2EndElementNs (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI); -XMLPUBFUN void XMLCALL - xmlSAX2Reference (void *ctx, - const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlSAX2Characters (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - xmlSAX2IgnorableWhitespace (void *ctx, - const xmlChar *ch, - int len); -XMLPUBFUN void XMLCALL - xmlSAX2ProcessingInstruction (void *ctx, - const xmlChar *target, - const xmlChar *data); -XMLPUBFUN void XMLCALL - xmlSAX2Comment (void *ctx, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlSAX2CDataBlock (void *ctx, - const xmlChar *value, - int len); - - -XMLPUBFUN int XMLCALL - xmlSAXVersion (xmlSAXHandler *hdlr, - int version); -XMLPUBFUN void XMLCALL - xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, - int warning); -XMLPUBFUN void XMLCALL - xmlDefaultSAXHandlerInit (void); -#ifdef __cplusplus -} -#endif -#endif /* __XML_SAX2_H__ */ diff --git a/deps/libxml2/libxml/chvalid.h b/deps/libxml2/libxml/chvalid.h deleted file mode 100644 index fb43016982..0000000000 --- a/deps/libxml2/libxml/chvalid.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Summary: Unicode character range checking - * Description: this module exports interfaces for the character - * range validation APIs - * - * This file is automatically generated from the cvs source - * definition files using the genChRanges.py Python script - * - * Generation date: Mon Mar 27 11:09:48 2006 - * Sources: chvalid.def - * Author: William Brack - */ - -#ifndef __XML_CHVALID_H__ -#define __XML_CHVALID_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define our typedefs and structures - * - */ -typedef struct _xmlChSRange xmlChSRange; -typedef xmlChSRange *xmlChSRangePtr; -struct _xmlChSRange { - unsigned short low; - unsigned short high; -}; - -typedef struct _xmlChLRange xmlChLRange; -typedef xmlChLRange *xmlChLRangePtr; -struct _xmlChLRange { - unsigned int low; - unsigned int high; -}; - -typedef struct _xmlChRangeGroup xmlChRangeGroup; -typedef xmlChRangeGroup *xmlChRangeGroupPtr; -struct _xmlChRangeGroup { - int nbShortRange; - int nbLongRange; - const xmlChSRange *shortRange; /* points to an array of ranges */ - const xmlChLRange *longRange; -}; - -/** - * Range checking routine - */ -XMLPUBFUN int XMLCALL - xmlCharInRange(unsigned int val, const xmlChRangeGroup *group); - - -/** - * xmlIsBaseChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ - ((0x61 <= (c)) && ((c) <= 0x7a)) || \ - ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ - ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ - (0xf8 <= (c))) - -/** - * xmlIsBaseCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ - xmlIsBaseChar_ch((c)) : \ - xmlCharInRange((c), &xmlIsBaseCharGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; - -/** - * xmlIsBlank_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBlank_ch(c) (((c) == 0x20) || \ - ((0x9 <= (c)) && ((c) <= 0xa)) || \ - ((c) == 0xd)) - -/** - * xmlIsBlankQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsBlankQ(c) (((c) < 0x100) ? \ - xmlIsBlank_ch((c)) : 0) - - -/** - * xmlIsChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ - ((c) == 0xd) || \ - (0x20 <= (c))) - -/** - * xmlIsCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsCharQ(c) (((c) < 0x100) ? \ - xmlIsChar_ch((c)) :\ - (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ - ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ - ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) - -XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; - -/** - * xmlIsCombiningQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ - 0 : \ - xmlCharInRange((c), &xmlIsCombiningGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; - -/** - * xmlIsDigit_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) - -/** - * xmlIsDigitQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsDigitQ(c) (((c) < 0x100) ? \ - xmlIsDigit_ch((c)) : \ - xmlCharInRange((c), &xmlIsDigitGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; - -/** - * xmlIsExtender_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsExtender_ch(c) (((c) == 0xb7)) - -/** - * xmlIsExtenderQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ - xmlIsExtender_ch((c)) : \ - xmlCharInRange((c), &xmlIsExtenderGroup)) - -XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; - -/** - * xmlIsIdeographicQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ - 0 :\ - (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ - ((c) == 0x3007) || \ - ((0x3021 <= (c)) && ((c) <= 0x3029)))) - -XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; -XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; - -/** - * xmlIsPubidChar_ch: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) - -/** - * xmlIsPubidCharQ: - * @c: char to validate - * - * Automatically generated by genChRanges.py - */ -#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ - xmlIsPubidChar_ch((c)) : 0) - -XMLPUBFUN int XMLCALL - xmlIsBaseChar(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsBlank(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsChar(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsCombining(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsDigit(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsExtender(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsIdeographic(unsigned int ch); -XMLPUBFUN int XMLCALL - xmlIsPubidChar(unsigned int ch); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_CHVALID_H__ */ diff --git a/deps/libxml2/libxml/dict.h b/deps/libxml2/libxml/dict.h deleted file mode 100644 index abb8339cb8..0000000000 --- a/deps/libxml2/libxml/dict.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Summary: string dictionnary - * Description: dictionary of reusable strings, just used to avoid allocation - * and freeing operations. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_DICT_H__ -#define __XML_DICT_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The dictionnary. - */ -typedef struct _xmlDict xmlDict; -typedef xmlDict *xmlDictPtr; - -/* - * Constructor and destructor. - */ -XMLPUBFUN xmlDictPtr XMLCALL - xmlDictCreate (void); -XMLPUBFUN xmlDictPtr XMLCALL - xmlDictCreateSub(xmlDictPtr sub); -XMLPUBFUN int XMLCALL - xmlDictReference(xmlDictPtr dict); -XMLPUBFUN void XMLCALL - xmlDictFree (xmlDictPtr dict); - -/* - * Lookup of entry in the dictionnary. - */ -XMLPUBFUN const xmlChar * XMLCALL - xmlDictLookup (xmlDictPtr dict, - const xmlChar *name, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlDictExists (xmlDictPtr dict, - const xmlChar *name, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlDictQLookup (xmlDictPtr dict, - const xmlChar *prefix, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlDictOwns (xmlDictPtr dict, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlDictSize (xmlDictPtr dict); - -/* - * Cleanup function - */ -XMLPUBFUN void XMLCALL - xmlDictCleanup (void); - -#ifdef __cplusplus -} -#endif -#endif /* ! __XML_DICT_H__ */ diff --git a/deps/libxml2/libxml/encoding.h b/deps/libxml2/libxml/encoding.h deleted file mode 100644 index c5e2542d8c..0000000000 --- a/deps/libxml2/libxml/encoding.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Summary: interface for the encoding conversion functions - * Description: interface for the encoding conversion functions needed for - * XML basic encoding and iconv() support. - * - * Related specs are - * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies - * [ISO-10646] UTF-8 and UTF-16 in Annexes - * [ISO-8859-1] ISO Latin-1 characters codes. - * [UNICODE] The Unicode Consortium, "The Unicode Standard -- - * Worldwide Character Encoding -- Version 1.0", Addison- - * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is - * described in Unicode Technical Report #4. - * [US-ASCII] Coded Character Set--7-bit American Standard Code for - * Information Interchange, ANSI X3.4-1986. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_CHAR_ENCODING_H__ -#define __XML_CHAR_ENCODING_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * xmlCharEncoding: - * - * Predefined values for some standard encodings. - * Libxml does not do beforehand translation on UTF8 and ISOLatinX. - * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. - * - * Anything else would have to be translated to UTF8 before being - * given to the parser itself. The BOM for UTF16 and the encoding - * declaration are looked at and a converter is looked for at that - * point. If not found the parser stops here as asked by the XML REC. A - * converter can be registered by the user using xmlRegisterCharEncodingHandler - * but the current form doesn't allow stateful transcoding (a serious - * problem agreed !). If iconv has been found it will be used - * automatically and allow stateful transcoding, the simplest is then - * to be sure to enable iconv and to provide iconv libs for the encoding - * support needed. - * - * Note that the generic "UTF-16" is not a predefined value. Instead, only - * the specific UTF-16LE and UTF-16BE are present. - */ -typedef enum { - XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ - XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ - XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ - XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ - XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ - XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ - XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ - XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ - XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ - XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ - XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ - XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ - XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ - XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ - XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ - XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ - XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ - XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ - XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ - XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ - XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ - XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ - XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ - XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ -} xmlCharEncoding; - -/** - * xmlCharEncodingInputFunc: - * @out: a pointer to an array of bytes to store the UTF-8 result - * @outlen: the length of @out - * @in: a pointer to an array of chars in the original encoding - * @inlen: the length of @in - * - * Take a block of chars in the original encoding and try to convert - * it to an UTF-8 block of chars out. - * - * Returns the number of bytes written, -1 if lack of space, or -2 - * if the transcoding failed. - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictiable. - * The value of @outlen after return is the number of octets consumed. - */ -typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, - const unsigned char *in, int *inlen); - - -/** - * xmlCharEncodingOutputFunc: - * @out: a pointer to an array of bytes to store the result - * @outlen: the length of @out - * @in: a pointer to an array of UTF-8 chars - * @inlen: the length of @in - * - * Take a block of UTF-8 chars in and try to convert it to another - * encoding. - * Note: a first call designed to produce heading info is called with - * in = NULL. If stateful this should also initialize the encoder state. - * - * Returns the number of bytes written, -1 if lack of space, or -2 - * if the transcoding failed. - * The value of @inlen after return is the number of octets consumed - * if the return value is positive, else unpredictiable. - * The value of @outlen after return is the number of octets produced. - */ -typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, - const unsigned char *in, int *inlen); - - -/* - * Block defining the handlers for non UTF-8 encodings. - * If iconv is supported, there are two extra fields. - */ - -typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; -typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; -struct _xmlCharEncodingHandler { - char *name; - xmlCharEncodingInputFunc input; - xmlCharEncodingOutputFunc output; -}; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Interfaces for encoding handlers. - */ -XMLPUBFUN void XMLCALL - xmlInitCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL - xmlCleanupCharEncodingHandlers (void); -XMLPUBFUN void XMLCALL - xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlGetCharEncodingHandler (xmlCharEncoding enc); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlFindCharEncodingHandler (const char *name); -XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL - xmlNewCharEncodingHandler (const char *name, - xmlCharEncodingInputFunc input, - xmlCharEncodingOutputFunc output); - -/* - * Interfaces for encoding names and aliases. - */ -XMLPUBFUN int XMLCALL - xmlAddEncodingAlias (const char *name, - const char *alias); -XMLPUBFUN int XMLCALL - xmlDelEncodingAlias (const char *alias); -XMLPUBFUN const char * XMLCALL - xmlGetEncodingAlias (const char *alias); -XMLPUBFUN void XMLCALL - xmlCleanupEncodingAliases (void); -XMLPUBFUN xmlCharEncoding XMLCALL - xmlParseCharEncoding (const char *name); -XMLPUBFUN const char * XMLCALL - xmlGetCharEncodingName (xmlCharEncoding enc); - -/* - * Interfaces directly used by the parsers. - */ -XMLPUBFUN xmlCharEncoding XMLCALL - xmlDetectCharEncoding (const unsigned char *in, - int len); - -XMLPUBFUN int XMLCALL - xmlCharEncOutFunc (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); - -XMLPUBFUN int XMLCALL - xmlCharEncInFunc (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); -XMLPUBFUN int XMLCALL - xmlCharEncFirstLine (xmlCharEncodingHandler *handler, - xmlBufferPtr out, - xmlBufferPtr in); -XMLPUBFUN int XMLCALL - xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); - -/* - * Export a few useful functions - */ -XMLPUBFUN int XMLCALL - isolat1ToUTF8 (unsigned char *out, - int *outlen, - const unsigned char *in, - int *inlen); -#ifdef __cplusplus -} -#endif - -#endif /* __XML_CHAR_ENCODING_H__ */ diff --git a/deps/libxml2/libxml/entities.h b/deps/libxml2/libxml/entities.h deleted file mode 100644 index e59ff7ae7d..0000000000 --- a/deps/libxml2/libxml/entities.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Summary: interface for the XML entities handling - * Description: this module provides some of the entity API needed - * for the parser and applications. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_ENTITIES_H__ -#define __XML_ENTITIES_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The different valid entity types. - */ -typedef enum { - XML_INTERNAL_GENERAL_ENTITY = 1, - XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, - XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, - XML_INTERNAL_PARAMETER_ENTITY = 4, - XML_EXTERNAL_PARAMETER_ENTITY = 5, - XML_INTERNAL_PREDEFINED_ENTITY = 6 -} xmlEntityType; - -/* - * An unit of storage for an entity, contains the string, the value - * and the linkind data needed for the linking in the hash table. - */ - -struct _xmlEntity { - void *_private; /* application data */ - xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ - const xmlChar *name; /* Entity name */ - struct _xmlNode *children; /* First child link */ - struct _xmlNode *last; /* Last child link */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - xmlChar *orig; /* content without ref substitution */ - xmlChar *content; /* content or ndata if unparsed */ - int length; /* the content length */ - xmlEntityType etype; /* The entity type */ - const xmlChar *ExternalID; /* External identifier for PUBLIC */ - const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ - - struct _xmlEntity *nexte; /* unused */ - const xmlChar *URI; /* the full URI as computed */ - int owner; /* does the entity own the childrens */ - int checked; /* was the entity content checked */ - /* this is also used to count entites - * references done from that entity */ -}; - -/* - * All entities are stored in an hash table. - * There is 2 separate hash tables for global and parameter entities. - */ - -typedef struct _xmlHashTable xmlEntitiesTable; -typedef xmlEntitiesTable *xmlEntitiesTablePtr; - -/* - * External functions: - */ - - -XMLPUBFUN xmlEntityPtr XMLCALL - xmlNewEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlAddDocEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlAddDtdEntity (xmlDocPtr doc, - const xmlChar *name, - int type, - const xmlChar *ExternalID, - const xmlChar *SystemID, - const xmlChar *content); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetPredefinedEntity (const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDocEntity (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetDtdEntity (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlGetParameterEntity (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeEntitiesReentrant(xmlDocPtr doc, - const xmlChar *input); -XMLPUBFUN xmlChar * XMLCALL - xmlEncodeSpecialChars (xmlDocPtr doc, - const xmlChar *input); -XMLPUBFUN xmlEntitiesTablePtr XMLCALL - xmlCreateEntitiesTable (void); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEntitiesTablePtr XMLCALL - xmlCopyEntitiesTable (xmlEntitiesTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeEntitiesTable (xmlEntitiesTablePtr table); - - -#ifdef __cplusplus -} -#endif - -# endif /* __XML_ENTITIES_H__ */ diff --git a/deps/libxml2/libxml/globals.h b/deps/libxml2/libxml/globals.h deleted file mode 100644 index 4f2b6c7a46..0000000000 --- a/deps/libxml2/libxml/globals.h +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Summary: interface for all global variables of the library - * Description: all the global variables and thread handling for - * those variables is handled by this module. - * - * The bottom of this file is automatically generated by build_glob.py - * based on the description file global.data - * - * Copy: See Copyright for the status of this software. - * - * Author: Gary Pennington , Daniel Veillard - */ - -#ifndef __XML_GLOBALS_H -#define __XML_GLOBALS_H - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -XMLPUBFUN void XMLCALL xmlInitGlobals(void); -XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); - -/** - * xmlParserInputBufferCreateFilenameFunc: - * @URI: the URI to read from - * @enc: the requested source encoding - * - * Signature for the function doing the lookup for a suitable input method - * corresponding to an URI. - * - * Returns the new xmlParserInputBufferPtr in case of success or NULL if no - * method was found. - */ -typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, xmlCharEncoding enc); - -/** - * xmlOutputBufferCreateFilenameFunc: - * @URI: the URI to write to - * @enc: the requested target encoding - * - * Signature for the function doing the lookup for a suitable output method - * corresponding to an URI. - * - * Returns the new xmlOutputBufferPtr in case of success or NULL if no - * method was found. - */ -typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, xmlCharEncodingHandlerPtr encoder, int compression); - -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc -XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); -XMLPUBFUN xmlOutputBufferCreateFilenameFunc -XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func); - -/* - * Externally global symbols which need to be protected for backwards - * compatibility support. - */ - -#undef docbDefaultSAXHandler -#undef htmlDefaultSAXHandler -#undef oldXMLWDcompatibility -#undef xmlBufferAllocScheme -#undef xmlDefaultBufferSize -#undef xmlDefaultSAXHandler -#undef xmlDefaultSAXLocator -#undef xmlDoValidityCheckingDefaultValue -#undef xmlFree -#undef xmlGenericError -#undef xmlStructuredError -#undef xmlGenericErrorContext -#undef xmlStructuredErrorContext -#undef xmlGetWarningsDefaultValue -#undef xmlIndentTreeOutput -#undef xmlTreeIndentString -#undef xmlKeepBlanksDefaultValue -#undef xmlLineNumbersDefaultValue -#undef xmlLoadExtDtdDefaultValue -#undef xmlMalloc -#undef xmlMallocAtomic -#undef xmlMemStrdup -#undef xmlParserDebugEntities -#undef xmlParserVersion -#undef xmlPedanticParserDefaultValue -#undef xmlRealloc -#undef xmlSaveNoEmptyTags -#undef xmlSubstituteEntitiesDefaultValue -#undef xmlRegisterNodeDefaultValue -#undef xmlDeregisterNodeDefaultValue -#undef xmlLastError -#undef xmlParserInputBufferCreateFilenameValue -#undef xmlOutputBufferCreateFilenameValue - -/** - * xmlRegisterNodeFunc: - * @node: the current node - * - * Signature for the registration callback of a created node - */ -typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); -/** - * xmlDeregisterNodeFunc: - * @node: the current node - * - * Signature for the deregistration callback of a discarded node - */ -typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); - -typedef struct _xmlGlobalState xmlGlobalState; -typedef xmlGlobalState *xmlGlobalStatePtr; -struct _xmlGlobalState -{ - const char *xmlParserVersion; - - xmlSAXLocator xmlDefaultSAXLocator; - xmlSAXHandlerV1 xmlDefaultSAXHandler; - xmlSAXHandlerV1 docbDefaultSAXHandler; - xmlSAXHandlerV1 htmlDefaultSAXHandler; - - xmlFreeFunc xmlFree; - xmlMallocFunc xmlMalloc; - xmlStrdupFunc xmlMemStrdup; - xmlReallocFunc xmlRealloc; - - xmlGenericErrorFunc xmlGenericError; - xmlStructuredErrorFunc xmlStructuredError; - void *xmlGenericErrorContext; - - int oldXMLWDcompatibility; - - xmlBufferAllocationScheme xmlBufferAllocScheme; - int xmlDefaultBufferSize; - - int xmlSubstituteEntitiesDefaultValue; - int xmlDoValidityCheckingDefaultValue; - int xmlGetWarningsDefaultValue; - int xmlKeepBlanksDefaultValue; - int xmlLineNumbersDefaultValue; - int xmlLoadExtDtdDefaultValue; - int xmlParserDebugEntities; - int xmlPedanticParserDefaultValue; - - int xmlSaveNoEmptyTags; - int xmlIndentTreeOutput; - const char *xmlTreeIndentString; - - xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; - xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; - - xmlMallocFunc xmlMallocAtomic; - xmlError xmlLastError; - - xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; - xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; - - void *xmlStructuredErrorContext; -}; - -#ifdef __cplusplus -} -#endif -#include -#ifdef __cplusplus -extern "C" { -#endif - -XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs); - -XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); - -XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); - -XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func); -XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); -XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); -XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); - -XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL - xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL - xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func); - -XMLPUBVAR xmlMallocFunc xmlMalloc; -XMLPUBVAR xmlMallocFunc xmlMallocAtomic; -XMLPUBVAR xmlReallocFunc xmlRealloc; -XMLPUBVAR xmlFreeFunc xmlFree; -XMLPUBVAR xmlStrdupFunc xmlMemStrdup; - -XMLPUBFUN xmlError * XMLCALL __xmlLastError(void); -XMLPUBVAR xmlError xmlLastError; - -/* - * Everything starting from the line below is - * Automatically generated by build_glob.py. - * Do not modify the previous line. - */ - - -XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void); -XMLPUBVAR int oldXMLWDcompatibility; - -XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void); -XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme; -XMLPUBFUN xmlBufferAllocationScheme XMLCALL xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); - -XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void); -XMLPUBVAR int xmlDefaultBufferSize; -XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v); - -XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void); -XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler; - -XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void); -XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator; - -XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void); -XMLPUBVAR int xmlDoValidityCheckingDefaultValue; -XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v); - -XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void); -XMLPUBVAR xmlGenericErrorFunc xmlGenericError; - -XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void); -XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError; - -XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void); -XMLPUBVAR void * xmlGenericErrorContext; - -XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void); -XMLPUBVAR void * xmlStructuredErrorContext; - -XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void); -XMLPUBVAR int xmlGetWarningsDefaultValue; -XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void); -XMLPUBVAR int xmlIndentTreeOutput; -XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v); - -XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void); -XMLPUBVAR const char * xmlTreeIndentString; -XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v); - -XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void); -XMLPUBVAR int xmlKeepBlanksDefaultValue; -XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void); -XMLPUBVAR int xmlLineNumbersDefaultValue; -XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void); -XMLPUBVAR int xmlLoadExtDtdDefaultValue; -XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void); -XMLPUBVAR int xmlParserDebugEntities; -XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v); - -XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void); -XMLPUBVAR const char * xmlParserVersion; - -XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void); -XMLPUBVAR int xmlPedanticParserDefaultValue; -XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v); - -XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void); -XMLPUBVAR int xmlSaveNoEmptyTags; -XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v); - -XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void); -XMLPUBVAR int xmlSubstituteEntitiesDefaultValue; -XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v); - -XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void); -XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; - -XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void); -XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; - -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL __xmlParserInputBufferCreateFilenameValue(void); -XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; - -XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void); -XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_GLOBALS_H */ diff --git a/deps/libxml2/libxml/hash.h b/deps/libxml2/libxml/hash.h deleted file mode 100644 index 7fe4be754c..0000000000 --- a/deps/libxml2/libxml/hash.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Summary: Chained hash tables - * Description: This module implements the hash table support used in - * various places in the library. - * - * Copy: See Copyright for the status of this software. - * - * Author: Bjorn Reese - */ - -#ifndef __XML_HASH_H__ -#define __XML_HASH_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The hash table. - */ -typedef struct _xmlHashTable xmlHashTable; -typedef xmlHashTable *xmlHashTablePtr; - -#ifdef __cplusplus -} -#endif - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Recent version of gcc produce a warning when a function pointer is assigned - * to an object pointer, or vice versa. The following macro is a dirty hack - * to allow suppression of the warning. If your architecture has function - * pointers which are a different size than a void pointer, there may be some - * serious trouble within the library. - */ -/** - * XML_CAST_FPTR: - * @fptr: pointer to a function - * - * Macro to do a casting from an object pointer to a - * function pointer without encountering a warning from - * gcc - * - * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) - * This macro violated ISO C aliasing rules (gcc4 on s390 broke) - * so it is disabled now - */ - -#define XML_CAST_FPTR(fptr) fptr - - -/* - * function types: - */ -/** - * xmlHashDeallocator: - * @payload: the data in the hash - * @name: the name associated - * - * Callback to free data from a hash. - */ -typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); -/** - * xmlHashCopier: - * @payload: the data in the hash - * @name: the name associated - * - * Callback to copy data from a hash. - * - * Returns a copy of the data or NULL in case of error. - */ -typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); -/** - * xmlHashScanner: - * @payload: the data in the hash - * @data: extra scannner data - * @name: the name associated - * - * Callback when scanning data in a hash with the simple scanner. - */ -typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); -/** - * xmlHashScannerFull: - * @payload: the data in the hash - * @data: extra scannner data - * @name: the name associated - * @name2: the second name associated - * @name3: the third name associated - * - * Callback when scanning data in a hash with the full scanner. - */ -typedef void (*xmlHashScannerFull)(void *payload, void *data, - const xmlChar *name, const xmlChar *name2, - const xmlChar *name3); - -/* - * Constructor and destructor. - */ -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCreate (int size); -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCreateDict(int size, - xmlDictPtr dict); -XMLPUBFUN void XMLCALL - xmlHashFree (xmlHashTablePtr table, - xmlHashDeallocator f); - -/* - * Add a new entry to the hash table. - */ -XMLPUBFUN int XMLCALL - xmlHashAddEntry (xmlHashTablePtr table, - const xmlChar *name, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry(xmlHashTablePtr table, - const xmlChar *name, - void *userdata, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashAddEntry2(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry2(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - void *userdata, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashAddEntry3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - void *userdata); -XMLPUBFUN int XMLCALL - xmlHashUpdateEntry3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - void *userdata, - xmlHashDeallocator f); - -/* - * Remove an entry from the hash table. - */ -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, - xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, xmlHashDeallocator f); -XMLPUBFUN int XMLCALL - xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, - xmlHashDeallocator f); - -/* - * Retrieve the userdata. - */ -XMLPUBFUN void * XMLCALL - xmlHashLookup (xmlHashTablePtr table, - const xmlChar *name); -XMLPUBFUN void * XMLCALL - xmlHashLookup2 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2); -XMLPUBFUN void * XMLCALL - xmlHashLookup3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3); -XMLPUBFUN void * XMLCALL - xmlHashQLookup (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN void * XMLCALL - xmlHashQLookup2 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix, - const xmlChar *name2, - const xmlChar *prefix2); -XMLPUBFUN void * XMLCALL - xmlHashQLookup3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *prefix, - const xmlChar *name2, - const xmlChar *prefix2, - const xmlChar *name3, - const xmlChar *prefix3); - -/* - * Helpers. - */ -XMLPUBFUN xmlHashTablePtr XMLCALL - xmlHashCopy (xmlHashTablePtr table, - xmlHashCopier f); -XMLPUBFUN int XMLCALL - xmlHashSize (xmlHashTablePtr table); -XMLPUBFUN void XMLCALL - xmlHashScan (xmlHashTablePtr table, - xmlHashScanner f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScan3 (xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - xmlHashScanner f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScanFull (xmlHashTablePtr table, - xmlHashScannerFull f, - void *data); -XMLPUBFUN void XMLCALL - xmlHashScanFull3(xmlHashTablePtr table, - const xmlChar *name, - const xmlChar *name2, - const xmlChar *name3, - xmlHashScannerFull f, - void *data); -#ifdef __cplusplus -} -#endif -#endif /* ! __XML_HASH_H__ */ diff --git a/deps/libxml2/libxml/list.h b/deps/libxml2/libxml/list.h deleted file mode 100644 index 1d83482430..0000000000 --- a/deps/libxml2/libxml/list.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Summary: lists interfaces - * Description: this module implement the list support used in - * various place in the library. - * - * Copy: See Copyright for the status of this software. - * - * Author: Gary Pennington - */ - -#ifndef __XML_LINK_INCLUDE__ -#define __XML_LINK_INCLUDE__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _xmlLink xmlLink; -typedef xmlLink *xmlLinkPtr; - -typedef struct _xmlList xmlList; -typedef xmlList *xmlListPtr; - -/** - * xmlListDeallocator: - * @lk: the data to deallocate - * - * Callback function used to free data from a list. - */ -typedef void (*xmlListDeallocator) (xmlLinkPtr lk); -/** - * xmlListDataCompare: - * @data0: the first data - * @data1: the second data - * - * Callback function used to compare 2 data. - * - * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. - */ -typedef int (*xmlListDataCompare) (const void *data0, const void *data1); -/** - * xmlListWalker: - * @data: the data found in the list - * @user: extra user provided data to the walker - * - * Callback function used when walking a list with xmlListWalk(). - * - * Returns 0 to stop walking the list, 1 otherwise. - */ -typedef int (*xmlListWalker) (const void *data, const void *user); - -/* Creation/Deletion */ -XMLPUBFUN xmlListPtr XMLCALL - xmlListCreate (xmlListDeallocator deallocator, - xmlListDataCompare compare); -XMLPUBFUN void XMLCALL - xmlListDelete (xmlListPtr l); - -/* Basic Operators */ -XMLPUBFUN void * XMLCALL - xmlListSearch (xmlListPtr l, - void *data); -XMLPUBFUN void * XMLCALL - xmlListReverseSearch (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListInsert (xmlListPtr l, - void *data) ; -XMLPUBFUN int XMLCALL - xmlListAppend (xmlListPtr l, - void *data) ; -XMLPUBFUN int XMLCALL - xmlListRemoveFirst (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListRemoveLast (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListRemoveAll (xmlListPtr l, - void *data); -XMLPUBFUN void XMLCALL - xmlListClear (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListEmpty (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL - xmlListFront (xmlListPtr l); -XMLPUBFUN xmlLinkPtr XMLCALL - xmlListEnd (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListSize (xmlListPtr l); - -XMLPUBFUN void XMLCALL - xmlListPopFront (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListPopBack (xmlListPtr l); -XMLPUBFUN int XMLCALL - xmlListPushFront (xmlListPtr l, - void *data); -XMLPUBFUN int XMLCALL - xmlListPushBack (xmlListPtr l, - void *data); - -/* Advanced Operators */ -XMLPUBFUN void XMLCALL - xmlListReverse (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListSort (xmlListPtr l); -XMLPUBFUN void XMLCALL - xmlListWalk (xmlListPtr l, - xmlListWalker walker, - const void *user); -XMLPUBFUN void XMLCALL - xmlListReverseWalk (xmlListPtr l, - xmlListWalker walker, - const void *user); -XMLPUBFUN void XMLCALL - xmlListMerge (xmlListPtr l1, - xmlListPtr l2); -XMLPUBFUN xmlListPtr XMLCALL - xmlListDup (const xmlListPtr old); -XMLPUBFUN int XMLCALL - xmlListCopy (xmlListPtr cur, - const xmlListPtr old); -/* Link operators */ -XMLPUBFUN void * XMLCALL - xmlLinkGetData (xmlLinkPtr lk); - -/* xmlListUnique() */ -/* xmlListSwap */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_LINK_INCLUDE__ */ diff --git a/deps/libxml2/libxml/parser.h b/deps/libxml2/libxml/parser.h deleted file mode 100644 index df5266a59f..0000000000 --- a/deps/libxml2/libxml/parser.h +++ /dev/null @@ -1,1114 +0,0 @@ -/* - * Summary: the core parser module - * Description: Interfaces, constants and types related to the XML parser - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PARSER_H__ -#define __XML_PARSER_H__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * XML_DEFAULT_VERSION: - * - * The default version of XML used: 1.0 - */ -#define XML_DEFAULT_VERSION "1.0" - -/** - * xmlParserInput: - * - * An xmlParserInput is an input flow for the XML processor. - * Each entity parsed is associated an xmlParserInput (except the - * few predefined ones). This is the case both for internal entities - * - in which case the flow is already completely in memory - or - * external entities - in which case we use the buf structure for - * progressive reading and I18N conversions to the internal UTF-8 format. - */ - -/** - * xmlParserInputDeallocate: - * @str: the string to deallocate - * - * Callback for freeing some parser input allocations. - */ -typedef void (* xmlParserInputDeallocate)(xmlChar *str); - -struct _xmlParserInput { - /* Input buffer */ - xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ - - const char *filename; /* The file analyzed, if any */ - const char *directory; /* the directory/base of the file */ - const xmlChar *base; /* Base of the array to parse */ - const xmlChar *cur; /* Current char being parsed */ - const xmlChar *end; /* end of the array to parse */ - int length; /* length if known */ - int line; /* Current line */ - int col; /* Current column */ - /* - * NOTE: consumed is only tested for equality in the parser code, - * so even if there is an overflow this should not give troubles - * for parsing very large instances. - */ - unsigned long consumed; /* How many xmlChars already consumed */ - xmlParserInputDeallocate free; /* function to deallocate the base */ - const xmlChar *encoding; /* the encoding string for entity */ - const xmlChar *version; /* the version string for entity */ - int standalone; /* Was that entity marked standalone */ - int id; /* an unique identifier for the entity */ -}; - -/** - * xmlParserNodeInfo: - * - * The parser can be asked to collect Node informations, i.e. at what - * place in the file they were detected. - * NOTE: This is off by default and not very well tested. - */ -typedef struct _xmlParserNodeInfo xmlParserNodeInfo; -typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; - -struct _xmlParserNodeInfo { - const struct _xmlNode* node; - /* Position & line # that text that created the node begins & ends on */ - unsigned long begin_pos; - unsigned long begin_line; - unsigned long end_pos; - unsigned long end_line; -}; - -typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; -typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; -struct _xmlParserNodeInfoSeq { - unsigned long maximum; - unsigned long length; - xmlParserNodeInfo* buffer; -}; - -/** - * xmlParserInputState: - * - * The parser is now working also as a state based parser. - * The recursive one use the state info for entities processing. - */ -typedef enum { - XML_PARSER_EOF = -1, /* nothing is to be parsed */ - XML_PARSER_START = 0, /* nothing has been parsed */ - XML_PARSER_MISC, /* Misc* before int subset */ - XML_PARSER_PI, /* Within a processing instruction */ - XML_PARSER_DTD, /* within some DTD content */ - XML_PARSER_PROLOG, /* Misc* after internal subset */ - XML_PARSER_COMMENT, /* within a comment */ - XML_PARSER_START_TAG, /* within a start tag */ - XML_PARSER_CONTENT, /* within the content */ - XML_PARSER_CDATA_SECTION, /* within a CDATA section */ - XML_PARSER_END_TAG, /* within a closing tag */ - XML_PARSER_ENTITY_DECL, /* within an entity declaration */ - XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ - XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ - XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ - XML_PARSER_EPILOG, /* the Misc* after the last end tag */ - XML_PARSER_IGNORE, /* within an IGNORED section */ - XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ -} xmlParserInputState; - -/** - * XML_DETECT_IDS: - * - * Bit in the loadsubset context field to tell to do ID/REFs lookups. - * Use it to initialize xmlLoadExtDtdDefaultValue. - */ -#define XML_DETECT_IDS 2 - -/** - * XML_COMPLETE_ATTRS: - * - * Bit in the loadsubset context field to tell to do complete the - * elements attributes lists with the ones defaulted from the DTDs. - * Use it to initialize xmlLoadExtDtdDefaultValue. - */ -#define XML_COMPLETE_ATTRS 4 - -/** - * XML_SKIP_IDS: - * - * Bit in the loadsubset context field to tell to not do ID/REFs registration. - * Used to initialize xmlLoadExtDtdDefaultValue in some special cases. - */ -#define XML_SKIP_IDS 8 - -/** - * xmlParserMode: - * - * A parser can operate in various modes - */ -typedef enum { - XML_PARSE_UNKNOWN = 0, - XML_PARSE_DOM = 1, - XML_PARSE_SAX = 2, - XML_PARSE_PUSH_DOM = 3, - XML_PARSE_PUSH_SAX = 4, - XML_PARSE_READER = 5 -} xmlParserMode; - -/** - * xmlParserCtxt: - * - * The parser context. - * NOTE This doesn't completely define the parser state, the (current ?) - * design of the parser uses recursive function calls since this allow - * and easy mapping from the production rules of the specification - * to the actual code. The drawback is that the actual function call - * also reflect the parser state. However most of the parsing routines - * takes as the only argument the parser context pointer, so migrating - * to a state based parser for progressive parsing shouldn't be too hard. - */ -struct _xmlParserCtxt { - struct _xmlSAXHandler *sax; /* The SAX handler */ - void *userData; /* For SAX interface only, used by DOM build */ - xmlDocPtr myDoc; /* the document being built */ - int wellFormed; /* is the document well formed */ - int replaceEntities; /* shall we replace entities ? */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* the declared encoding, if any */ - int standalone; /* standalone document */ - int html; /* an HTML(1)/Docbook(2) document - * 3 is HTML after - * 10 is HTML after - */ - - /* Input stream stack */ - xmlParserInputPtr input; /* Current input stream */ - int inputNr; /* Number of current input streams */ - int inputMax; /* Max number of input streams */ - xmlParserInputPtr *inputTab; /* stack of inputs */ - - /* Node analysis stack only used for DOM building */ - xmlNodePtr node; /* Current parsed Node */ - int nodeNr; /* Depth of the parsing stack */ - int nodeMax; /* Max depth of the parsing stack */ - xmlNodePtr *nodeTab; /* array of nodes */ - - int record_info; /* Whether node info should be kept */ - xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ - - int errNo; /* error code */ - - int hasExternalSubset; /* reference and external subset */ - int hasPErefs; /* the internal subset has PE refs */ - int external; /* are we parsing an external entity */ - - int valid; /* is the document valid */ - int validate; /* shall we try to validate ? */ - xmlValidCtxt vctxt; /* The validity context */ - - xmlParserInputState instate; /* current type of input */ - int token; /* next char look-ahead */ - - char *directory; /* the data directory */ - - /* Node name stack */ - const xmlChar *name; /* Current parsed Node */ - int nameNr; /* Depth of the parsing stack */ - int nameMax; /* Max depth of the parsing stack */ - const xmlChar * *nameTab; /* array of nodes */ - - long nbChars; /* number of xmlChar processed */ - long checkIndex; /* used by progressive parsing lookup */ - int keepBlanks; /* ugly but ... */ - int disableSAX; /* SAX callbacks are disabled */ - int inSubset; /* Parsing is in int 1/ext 2 subset */ - const xmlChar * intSubName; /* name of subset */ - xmlChar * extSubURI; /* URI of external subset */ - xmlChar * extSubSystem; /* SYSTEM ID of external subset */ - - /* xml:space values */ - int * space; /* Should the parser preserve spaces */ - int spaceNr; /* Depth of the parsing stack */ - int spaceMax; /* Max depth of the parsing stack */ - int * spaceTab; /* array of space infos */ - - int depth; /* to prevent entity substitution loops */ - xmlParserInputPtr entity; /* used to check entities boundaries */ - int charset; /* encoding of the in-memory content - actually an xmlCharEncoding */ - int nodelen; /* Those two fields are there to */ - int nodemem; /* Speed up large node parsing */ - int pedantic; /* signal pedantic warnings */ - void *_private; /* For user data, libxml won't touch it */ - - int loadsubset; /* should the external subset be loaded */ - int linenumbers; /* set line number in element content */ - void *catalogs; /* document's own catalog */ - int recovery; /* run in recovery mode */ - int progressive; /* is this a progressive parsing */ - xmlDictPtr dict; /* dictionnary for the parser */ - const xmlChar * *atts; /* array for the attributes callbacks */ - int maxatts; /* the size of the array */ - int docdict; /* use strings from dict to build tree */ - - /* - * pre-interned strings - */ - const xmlChar *str_xml; - const xmlChar *str_xmlns; - const xmlChar *str_xml_ns; - - /* - * Everything below is used only by the new SAX mode - */ - int sax2; /* operating in the new SAX mode */ - int nsNr; /* the number of inherited namespaces */ - int nsMax; /* the size of the arrays */ - const xmlChar * *nsTab; /* the array of prefix/namespace name */ - int *attallocs; /* which attribute were allocated */ - void * *pushTab; /* array of data for push */ - xmlHashTablePtr attsDefault; /* defaulted attributes if any */ - xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ - int nsWellFormed; /* is the document XML Nanespace okay */ - int options; /* Extra options */ - - /* - * Those fields are needed only for treaming parsing so far - */ - int dictNames; /* Use dictionary names for the tree */ - int freeElemsNr; /* number of freed element nodes */ - xmlNodePtr freeElems; /* List of freed element nodes */ - int freeAttrsNr; /* number of freed attributes nodes */ - xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ - - /* - * the complete error informations for the last error. - */ - xmlError lastError; - xmlParserMode parseMode; /* the parser mode */ - unsigned long nbentities; /* number of entities references */ - unsigned long sizeentities; /* size of parsed entities */ - - /* for use by HTML non-recursive parser */ - xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */ - int nodeInfoNr; /* Depth of the parsing stack */ - int nodeInfoMax; /* Max depth of the parsing stack */ - xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ -}; - -/** - * xmlSAXLocator: - * - * A SAX Locator. - */ -struct _xmlSAXLocator { - const xmlChar *(*getPublicId)(void *ctx); - const xmlChar *(*getSystemId)(void *ctx); - int (*getLineNumber)(void *ctx); - int (*getColumnNumber)(void *ctx); -}; - -/** - * xmlSAXHandler: - * - * A SAX handler is bunch of callbacks called by the parser when processing - * of the input generate data or structure informations. - */ - -/** - * resolveEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Callback: - * The entity loader, to control the loading of external entities, - * the application can either: - * - override this resolveEntity() callback in the SAX block - * - or better use the xmlSetExternalEntityLoader() function to - * set up it's own entity resolution routine - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, - const xmlChar *publicId, - const xmlChar *systemId); -/** - * internalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on internal subset declaration. - */ -typedef void (*internalSubsetSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * externalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the root element name - * @ExternalID: the external ID - * @SystemID: the SYSTEM ID (e.g. filename or URL) - * - * Callback on external subset declaration. - */ -typedef void (*externalSubsetSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * getEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get an entity by name. - * - * Returns the xmlEntityPtr if found. - */ -typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, - const xmlChar *name); -/** - * getParameterEntitySAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Get a parameter entity by name. - * - * Returns the xmlEntityPtr if found. - */ -typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, - const xmlChar *name); -/** - * entityDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed. - */ -typedef void (*entityDeclSAXFunc) (void *ctx, - const xmlChar *name, - int type, - const xmlChar *publicId, - const xmlChar *systemId, - xmlChar *content); -/** - * notationDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -typedef void (*notationDeclSAXFunc)(void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId); -/** - * attributeDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @elem: the name of the element - * @fullname: the attribute name - * @type: the attribute type - * @def: the type of default value - * @defaultValue: the attribute default value - * @tree: the tree of enumerated value set - * - * An attribute definition has been parsed. - */ -typedef void (*attributeDeclSAXFunc)(void *ctx, - const xmlChar *elem, - const xmlChar *fullname, - int type, - int def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -/** - * elementDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: the element name - * @type: the element type - * @content: the element value tree - * - * An element definition has been parsed. - */ -typedef void (*elementDeclSAXFunc)(void *ctx, - const xmlChar *name, - int type, - xmlElementContentPtr content); -/** - * unparsedEntityDeclSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed. - */ -typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, - const xmlChar *name, - const xmlChar *publicId, - const xmlChar *systemId, - const xmlChar *notationName); -/** - * setDocumentLocatorSAXFunc: - * @ctx: the user data (XML parser context) - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator. - * Everything is available on the context, so this is useless in our case. - */ -typedef void (*setDocumentLocatorSAXFunc) (void *ctx, - xmlSAXLocatorPtr loc); -/** - * startDocumentSAXFunc: - * @ctx: the user data (XML parser context) - * - * Called when the document start being processed. - */ -typedef void (*startDocumentSAXFunc) (void *ctx); -/** - * endDocumentSAXFunc: - * @ctx: the user data (XML parser context) - * - * Called when the document end has been detected. - */ -typedef void (*endDocumentSAXFunc) (void *ctx); -/** - * startElementSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The element name, including namespace prefix - * @atts: An array of name/value attributes pairs, NULL terminated - * - * Called when an opening tag has been processed. - */ -typedef void (*startElementSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar **atts); -/** - * endElementSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The element name - * - * Called when the end of an element has been detected. - */ -typedef void (*endElementSAXFunc) (void *ctx, - const xmlChar *name); -/** - * attributeSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The attribute name, including namespace prefix - * @value: The attribute value - * - * Handle an attribute that has been read by the parser. - * The default handling is to convert the attribute into an - * DOM subtree and past it in a new xmlAttr element added to - * the element. - */ -typedef void (*attributeSAXFunc) (void *ctx, - const xmlChar *name, - const xmlChar *value); -/** - * referenceSAXFunc: - * @ctx: the user data (XML parser context) - * @name: The entity name - * - * Called when an entity reference is detected. - */ -typedef void (*referenceSAXFunc) (void *ctx, - const xmlChar *name); -/** - * charactersSAXFunc: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * Receiving some chars from the parser. - */ -typedef void (*charactersSAXFunc) (void *ctx, - const xmlChar *ch, - int len); -/** - * ignorableWhitespaceSAXFunc: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * Receiving some ignorable whitespaces from the parser. - * UNUSED: by default the DOM building will use characters. - */ -typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, - const xmlChar *ch, - int len); -/** - * processingInstructionSAXFunc: - * @ctx: the user data (XML parser context) - * @target: the target name - * @data: the PI data's - * - * A processing instruction has been parsed. - */ -typedef void (*processingInstructionSAXFunc) (void *ctx, - const xmlChar *target, - const xmlChar *data); -/** - * commentSAXFunc: - * @ctx: the user data (XML parser context) - * @value: the comment content - * - * A comment has been parsed. - */ -typedef void (*commentSAXFunc) (void *ctx, - const xmlChar *value); -/** - * cdataBlockSAXFunc: - * @ctx: the user data (XML parser context) - * @value: The pcdata content - * @len: the block length - * - * Called when a pcdata block has been parsed. - */ -typedef void (*cdataBlockSAXFunc) ( - void *ctx, - const xmlChar *value, - int len); -/** - * warningSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a warning messages, callback. - */ -typedef void (XMLCDECL *warningSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * errorSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format an error messages, callback. - */ -typedef void (XMLCDECL *errorSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * fatalErrorSAXFunc: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format fatal error messages, callback. - * Note: so far fatalError() SAX callbacks are not used, error() - * get all the callbacks for errors. - */ -typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx, - const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -/** - * isStandaloneSAXFunc: - * @ctx: the user data (XML parser context) - * - * Is this document tagged standalone? - * - * Returns 1 if true - */ -typedef int (*isStandaloneSAXFunc) (void *ctx); -/** - * hasInternalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * - * Does this document has an internal subset. - * - * Returns 1 if true - */ -typedef int (*hasInternalSubsetSAXFunc) (void *ctx); - -/** - * hasExternalSubsetSAXFunc: - * @ctx: the user data (XML parser context) - * - * Does this document has an external subset? - * - * Returns 1 if true - */ -typedef int (*hasExternalSubsetSAXFunc) (void *ctx); - -/************************************************************************ - * * - * The SAX version 2 API extensions * - * * - ************************************************************************/ -/** - * XML_SAX2_MAGIC: - * - * Special constant found in SAX2 blocks initialized fields - */ -#define XML_SAX2_MAGIC 0xDEEDBEAF - -/** - * startElementNsSAX2Func: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * @nb_namespaces: number of namespace definitions on that node - * @namespaces: pointer to the array of prefix/URI pairs namespace definitions - * @nb_attributes: the number of attributes on that node - * @nb_defaulted: the number of defaulted attributes. The defaulted - * ones are at the end of the array - * @attributes: pointer to the array of (localname/prefix/URI/value/end) - * attribute values. - * - * SAX2 callback when an element start has been detected by the parser. - * It provides the namespace informations for the element, as well as - * the new namespace declarations on the element. - */ - -typedef void (*startElementNsSAX2Func) (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes); - -/** - * endElementNsSAX2Func: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * - * SAX2 callback when an element end has been detected by the parser. - * It provides the namespace informations for the element. - */ - -typedef void (*endElementNsSAX2Func) (void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI); - - -struct _xmlSAXHandler { - internalSubsetSAXFunc internalSubset; - isStandaloneSAXFunc isStandalone; - hasInternalSubsetSAXFunc hasInternalSubset; - hasExternalSubsetSAXFunc hasExternalSubset; - resolveEntitySAXFunc resolveEntity; - getEntitySAXFunc getEntity; - entityDeclSAXFunc entityDecl; - notationDeclSAXFunc notationDecl; - attributeDeclSAXFunc attributeDecl; - elementDeclSAXFunc elementDecl; - unparsedEntityDeclSAXFunc unparsedEntityDecl; - setDocumentLocatorSAXFunc setDocumentLocator; - startDocumentSAXFunc startDocument; - endDocumentSAXFunc endDocument; - startElementSAXFunc startElement; - endElementSAXFunc endElement; - referenceSAXFunc reference; - charactersSAXFunc characters; - ignorableWhitespaceSAXFunc ignorableWhitespace; - processingInstructionSAXFunc processingInstruction; - commentSAXFunc comment; - warningSAXFunc warning; - errorSAXFunc error; - fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ - getParameterEntitySAXFunc getParameterEntity; - cdataBlockSAXFunc cdataBlock; - externalSubsetSAXFunc externalSubset; - unsigned int initialized; - /* The following fields are extensions available only on version 2 */ - void *_private; - startElementNsSAX2Func startElementNs; - endElementNsSAX2Func endElementNs; - xmlStructuredErrorFunc serror; -}; - -/* - * SAX Version 1 - */ -typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; -typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; -struct _xmlSAXHandlerV1 { - internalSubsetSAXFunc internalSubset; - isStandaloneSAXFunc isStandalone; - hasInternalSubsetSAXFunc hasInternalSubset; - hasExternalSubsetSAXFunc hasExternalSubset; - resolveEntitySAXFunc resolveEntity; - getEntitySAXFunc getEntity; - entityDeclSAXFunc entityDecl; - notationDeclSAXFunc notationDecl; - attributeDeclSAXFunc attributeDecl; - elementDeclSAXFunc elementDecl; - unparsedEntityDeclSAXFunc unparsedEntityDecl; - setDocumentLocatorSAXFunc setDocumentLocator; - startDocumentSAXFunc startDocument; - endDocumentSAXFunc endDocument; - startElementSAXFunc startElement; - endElementSAXFunc endElement; - referenceSAXFunc reference; - charactersSAXFunc characters; - ignorableWhitespaceSAXFunc ignorableWhitespace; - processingInstructionSAXFunc processingInstruction; - commentSAXFunc comment; - warningSAXFunc warning; - errorSAXFunc error; - fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ - getParameterEntitySAXFunc getParameterEntity; - cdataBlockSAXFunc cdataBlock; - externalSubsetSAXFunc externalSubset; - unsigned int initialized; -}; - - -/** - * xmlExternalEntityLoader: - * @URL: The System ID of the resource requested - * @ID: The Public ID of the resource requested - * @context: the XML parser context - * - * External entity loaders types. - * - * Returns the entity input parser. - */ -typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, - const char *ID, - xmlParserCtxtPtr context); - -#ifdef __cplusplus -} -#endif - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/* - * Init/Cleanup - */ -XMLPUBFUN void XMLCALL - xmlInitParser (void); -XMLPUBFUN void XMLCALL - xmlCleanupParser (void); - -/* - * Input functions - */ -XMLPUBFUN int XMLCALL - xmlParserInputRead (xmlParserInputPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputGrow (xmlParserInputPtr in, - int len); - -/* - * Basic parsing Interfaces - */ -XMLPUBFUN int XMLCALL - xmlSubstituteEntitiesDefault(int val); -XMLPUBFUN int XMLCALL - xmlKeepBlanksDefault (int val); -XMLPUBFUN void XMLCALL - xmlStopParser (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlPedanticParserDefault(int val); -XMLPUBFUN int XMLCALL - xmlLineNumbersDefault (int val); - - -/* - * Less common routines and SAX interfaces - */ -XMLPUBFUN int XMLCALL - xmlParseDocument (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); - -XMLPUBFUN xmlParserErrors XMLCALL - xmlParseInNodeContext (xmlNodePtr node, - const char *data, - int datalen, - int options, - xmlNodePtr *lst); -XMLPUBFUN int XMLCALL - xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, - const xmlChar *URL, - const xmlChar *ID, - xmlNodePtr *lst); - -/* - * Parser contexts handling. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlNewParserCtxt (void); -XMLPUBFUN int XMLCALL - xmlInitParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlClearParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateDocParserCtxt (const xmlChar *cur); - - -#ifdef LIBXML_PUSH_ENABLED -/* - * Interfaces for the Push mode. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, - void *user_data, - const char *chunk, - int size, - const char *filename); -XMLPUBFUN int XMLCALL - xmlParseChunk (xmlParserCtxtPtr ctxt, - const char *chunk, - int size, - int terminate); -#endif /* LIBXML_PUSH_ENABLED */ - -/* - * Special I/O mode. - */ - -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, - void *user_data, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - xmlCharEncoding enc); - -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewIOInputStream (xmlParserCtxtPtr ctxt, - xmlParserInputBufferPtr input, - xmlCharEncoding enc); - -/* - * Node infos. - */ -XMLPUBFUN const xmlParserNodeInfo* XMLCALL - xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, - const xmlNodePtr node); -XMLPUBFUN void XMLCALL - xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN void XMLCALL - xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); -XMLPUBFUN unsigned long XMLCALL - xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, - const xmlNodePtr node); -XMLPUBFUN void XMLCALL - xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, - const xmlParserNodeInfoPtr info); - -/* - * External entities handling actually implemented in xmlIO. - */ - -XMLPUBFUN void XMLCALL - xmlSetExternalEntityLoader(xmlExternalEntityLoader f); -XMLPUBFUN xmlExternalEntityLoader XMLCALL - xmlGetExternalEntityLoader(void); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlLoadExternalEntity (const char *URL, - const char *ID, - xmlParserCtxtPtr ctxt); - -/* - * Index lookup, actually implemented in the encoding module - */ -XMLPUBFUN long XMLCALL - xmlByteConsumed (xmlParserCtxtPtr ctxt); - -/* - * New set of simpler/more flexible APIs - */ -/** - * xmlParserOption: - * - * This is the set of XML parser options that can be passed down - * to the xmlReadDoc() and similar calls. - */ -typedef enum { - XML_PARSE_RECOVER = 1<<0, /* recover on errors */ - XML_PARSE_NOENT = 1<<1, /* substitute entities */ - XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ - XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ - XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ - XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ - XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ - XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ - XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ - XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ - XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ - XML_PARSE_NONET = 1<<11,/* Forbid network access */ - XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionnary */ - XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ - XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ - XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ - XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of - the tree allowed afterwards (will possibly - crash if you try to modify the tree) */ - XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ - XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ - XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ - XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */ - XML_PARSE_IGNORE_ENC= 1<<21 /* ignore internal document encoding hint */ -} xmlParserOption; - -XMLPUBFUN void XMLCALL - xmlCtxtReset (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlCtxtResetPush (xmlParserCtxtPtr ctxt, - const char *chunk, - int size, - const char *filename, - const char *encoding); -XMLPUBFUN int XMLCALL - xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadDoc (const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadFile (const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlReadIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadFile (xmlParserCtxtPtr ctxt, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadFd (xmlParserCtxtPtr ctxt, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlDocPtr XMLCALL - xmlCtxtReadIO (xmlParserCtxtPtr ctxt, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -/* - * Library wide options - */ -/** - * xmlFeature: - * - * Used to examine the existance of features that can be enabled - * or disabled at compile-time. - * They used to be called XML_FEATURE_xxx but this clashed with Expat - */ -typedef enum { - XML_WITH_THREAD = 1, - XML_WITH_TREE = 2, - XML_WITH_OUTPUT = 3, - XML_WITH_PUSH = 4, - XML_WITH_READER = 5, - XML_WITH_PATTERN = 6, - XML_WITH_WRITER = 7, - XML_WITH_SAX1 = 8, - XML_WITH_FTP = 9, - XML_WITH_HTTP = 10, - XML_WITH_VALID = 11, - XML_WITH_HTML = 12, - XML_WITH_LEGACY = 13, - XML_WITH_C14N = 14, - XML_WITH_CATALOG = 15, - XML_WITH_XPATH = 16, - XML_WITH_XPTR = 17, - XML_WITH_XINCLUDE = 18, - XML_WITH_ICONV = 19, - XML_WITH_ISO8859X = 20, - XML_WITH_UNICODE = 21, - XML_WITH_REGEXP = 22, - XML_WITH_AUTOMATA = 23, - XML_WITH_EXPR = 24, - XML_WITH_SCHEMAS = 25, - XML_WITH_SCHEMATRON = 26, - XML_WITH_MODULES = 27, - XML_WITH_DEBUG = 28, - XML_WITH_DEBUG_MEM = 29, - XML_WITH_DEBUG_RUN = 30, - XML_WITH_ZLIB = 31, - XML_WITH_ICU = 32, - XML_WITH_LZMA = 33, - XML_WITH_NONE = 99999 /* just to be sure of allocation size */ -} xmlFeature; - -XMLPUBFUN int XMLCALL - xmlHasFeature (xmlFeature feature); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_H__ */ diff --git a/deps/libxml2/libxml/parserInternals.h b/deps/libxml2/libxml/parserInternals.h deleted file mode 100644 index f43dba8f35..0000000000 --- a/deps/libxml2/libxml/parserInternals.h +++ /dev/null @@ -1,547 +0,0 @@ -/* - * Summary: internals routines exported by the parser. - * Description: this module exports a number of internal parsing routines - * they are not really all intended for applications but - * can prove useful doing low level processing. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PARSER_INTERNALS_H__ -#define __XML_PARSER_INTERNALS_H__ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlParserMaxDepth: - * - * arbitrary depth limit for the XML documents that we allow to - * process. This is not a limitation of the parser but a safety - * boundary feature, use XML_PARSE_HUGE option to override it. - */ -XMLPUBVAR unsigned int xmlParserMaxDepth; - -/** - * XML_MAX_TEXT_LENGTH: - * - * Maximum size allowed for a single text node when building a tree. - * This is not a limitation of the parser but a safety boundary feature, - * use XML_PARSE_HUGE option to override it. - */ -#define XML_MAX_TEXT_LENGTH 10000000 - -/** - * XML_MAX_NAMELEN: - * - * Identifiers can be longer, but this will be more costly - * at runtime. - */ -#define XML_MAX_NAMELEN 100 - -/** - * INPUT_CHUNK: - * - * The parser tries to always have that amount of input ready. - * One of the point is providing context when reporting errors. - */ -#define INPUT_CHUNK 250 - -/************************************************************************ - * * - * UNICODE version of the macros. * - * * - ************************************************************************/ -/** - * IS_BYTE_CHAR: - * @c: an byte value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20...] - * any byte character in the accepted range - */ -#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) - -/** - * IS_CHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] - * | [#x10000-#x10FFFF] - * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. - */ -#define IS_CHAR(c) xmlIsCharQ(c) - -/** - * IS_CHAR_CH: - * @c: an xmlChar (usually an unsigned char) - * - * Behaves like IS_CHAR on single-byte value - */ -#define IS_CHAR_CH(c) xmlIsChar_ch(c) - -/** - * IS_BLANK: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [3] S ::= (#x20 | #x9 | #xD | #xA)+ - */ -#define IS_BLANK(c) xmlIsBlankQ(c) - -/** - * IS_BLANK_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Behaviour same as IS_BLANK - */ -#define IS_BLANK_CH(c) xmlIsBlank_ch(c) - -/** - * IS_BASECHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [85] BaseChar ::= ... long list see REC ... - */ -#define IS_BASECHAR(c) xmlIsBaseCharQ(c) - -/** - * IS_DIGIT: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [88] Digit ::= ... long list see REC ... - */ -#define IS_DIGIT(c) xmlIsDigitQ(c) - -/** - * IS_DIGIT_CH: - * @c: an xmlChar value (usually an unsigned char) - * - * Behaves like IS_DIGIT but with a single byte argument - */ -#define IS_DIGIT_CH(c) xmlIsDigit_ch(c) - -/** - * IS_COMBINING: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * [87] CombiningChar ::= ... long list see REC ... - */ -#define IS_COMBINING(c) xmlIsCombiningQ(c) - -/** - * IS_COMBINING_CH: - * @c: an xmlChar (usually an unsigned char) - * - * Always false (all combining chars > 0xff) - */ -#define IS_COMBINING_CH(c) 0 - -/** - * IS_EXTENDER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | - * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | - * [#x309D-#x309E] | [#x30FC-#x30FE] - */ -#define IS_EXTENDER(c) xmlIsExtenderQ(c) - -/** - * IS_EXTENDER_CH: - * @c: an xmlChar value (usually an unsigned char) - * - * Behaves like IS_EXTENDER but with a single-byte argument - */ -#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) - -/** - * IS_IDEOGRAPHIC: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] - */ -#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) - -/** - * IS_LETTER: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [84] Letter ::= BaseChar | Ideographic - */ -#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) - -/** - * IS_LETTER_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Macro behaves like IS_LETTER, but only check base chars - * - */ -#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) - -/** - * IS_ASCII_LETTER: - * @c: an xmlChar value - * - * Macro to check [a-zA-Z] - * - */ -#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ - ((0x61 <= (c)) && ((c) <= 0x7a))) - -/** - * IS_ASCII_DIGIT: - * @c: an xmlChar value - * - * Macro to check [0-9] - * - */ -#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) - -/** - * IS_PUBIDCHAR: - * @c: an UNICODE value (int) - * - * Macro to check the following production in the XML spec: - * - * - * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] - */ -#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) - -/** - * IS_PUBIDCHAR_CH: - * @c: an xmlChar value (normally unsigned char) - * - * Same as IS_PUBIDCHAR but for single-byte value - */ -#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) - -/** - * SKIP_EOL: - * @p: and UTF8 string pointer - * - * Skips the end of line chars. - */ -#define SKIP_EOL(p) \ - if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ - if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } - -/** - * MOVETO_ENDTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '>' char. - */ -#define MOVETO_ENDTAG(p) \ - while ((*p) && (*(p) != '>')) (p)++ - -/** - * MOVETO_STARTTAG: - * @p: and UTF8 string pointer - * - * Skips to the next '<' char. - */ -#define MOVETO_STARTTAG(p) \ - while ((*p) && (*(p) != '<')) (p)++ - -/** - * Global variables used for predefined strings. - */ -XMLPUBVAR const xmlChar xmlStringText[]; -XMLPUBVAR const xmlChar xmlStringTextNoenc[]; -XMLPUBVAR const xmlChar xmlStringComment[]; - -/* - * Function to finish the work of the macros where needed. - */ -XMLPUBFUN int XMLCALL xmlIsLetter (int c); - -/** - * Parser context. - */ -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateFileParserCtxt (const char *filename); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateURLParserCtxt (const char *filename, - int options); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateMemoryParserCtxt(const char *buffer, - int size); -XMLPUBFUN xmlParserCtxtPtr XMLCALL - xmlCreateEntityParserCtxt(const xmlChar *URL, - const xmlChar *ID, - const xmlChar *base); -XMLPUBFUN int XMLCALL - xmlSwitchEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, - xmlCharEncodingHandlerPtr handler); -XMLPUBFUN int XMLCALL - xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input, - xmlCharEncodingHandlerPtr handler); - -#ifdef IN_LIBXML -/* internal error reporting */ -XMLPUBFUN void XMLCALL - __xmlErrEncoding (xmlParserCtxtPtr ctxt, - xmlParserErrors xmlerr, - const char *msg, - const xmlChar * str1, - const xmlChar * str2); -#endif - -/** - * Input Streams. - */ -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewStringInputStream (xmlParserCtxtPtr ctxt, - const xmlChar *buffer); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, - xmlEntityPtr entity); -XMLPUBFUN int XMLCALL - xmlPushInput (xmlParserCtxtPtr ctxt, - xmlParserInputPtr input); -XMLPUBFUN xmlChar XMLCALL - xmlPopInput (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlFreeInputStream (xmlParserInputPtr input); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewInputFromFile (xmlParserCtxtPtr ctxt, - const char *filename); -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNewInputStream (xmlParserCtxtPtr ctxt); - -/** - * Namespaces. - */ -XMLPUBFUN xmlChar * XMLCALL - xmlSplitQName (xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlChar **prefix); - -/** - * Generic production rules. - */ -XMLPUBFUN const xmlChar * XMLCALL - xmlParseName (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseNmtoken (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseEntityValue (xmlParserCtxtPtr ctxt, - xmlChar **orig); -XMLPUBFUN xmlChar * XMLCALL - xmlParseAttValue (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseCharData (xmlParserCtxtPtr ctxt, - int cdata); -XMLPUBFUN xmlChar * XMLCALL - xmlParseExternalID (xmlParserCtxtPtr ctxt, - xmlChar **publicID, - int strict); -XMLPUBFUN void XMLCALL - xmlParseComment (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL - xmlParsePITarget (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParsePI (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseNotationDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseEntityDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, - xmlChar **value); -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlParseNotationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlParseEnumerationType (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -XMLPUBFUN int XMLCALL - xmlParseAttributeType (xmlParserCtxtPtr ctxt, - xmlEnumerationPtr *tree); -XMLPUBFUN void XMLCALL - xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlParseElementMixedContentDecl - (xmlParserCtxtPtr ctxt, - int inputchk); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlParseElementChildrenContentDecl - (xmlParserCtxtPtr ctxt, - int inputchk); -XMLPUBFUN int XMLCALL - xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, - const xmlChar *name, - xmlElementContentPtr *result); -XMLPUBFUN int XMLCALL - xmlParseElementDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseCharRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlEntityPtr XMLCALL - xmlParseEntityRef (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParsePEReference (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseCDSect (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseContent (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseElement (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseVersionNum (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseVersionInfo (xmlParserCtxtPtr ctxt); -XMLPUBFUN xmlChar * XMLCALL - xmlParseEncName (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL - xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlParseSDDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseXMLDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseTextDecl (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseMisc (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL - xmlParseExternalSubset (xmlParserCtxtPtr ctxt, - const xmlChar *ExternalID, - const xmlChar *SystemID); -/** - * XML_SUBSTITUTE_NONE: - * - * If no entities need to be substituted. - */ -#define XML_SUBSTITUTE_NONE 0 -/** - * XML_SUBSTITUTE_REF: - * - * Whether general entities need to be substituted. - */ -#define XML_SUBSTITUTE_REF 1 -/** - * XML_SUBSTITUTE_PEREF: - * - * Whether parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_PEREF 2 -/** - * XML_SUBSTITUTE_BOTH: - * - * Both general and parameter entities need to be substituted. - */ -#define XML_SUBSTITUTE_BOTH 3 - -XMLPUBFUN xmlChar * XMLCALL - xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); -XMLPUBFUN xmlChar * XMLCALL - xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, - const xmlChar *str, - int len, - int what, - xmlChar end, - xmlChar end2, - xmlChar end3); - -/* - * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. - */ -XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt, - xmlNodePtr value); -XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt, - xmlParserInputPtr value); -XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt); -XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt, - const xmlChar *value); - -/* - * other commodities shared between parser.c and parserInternals. - */ -XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt, - const xmlChar *cur, - int *len); -XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); -XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang); - -/* - * Really core function shared with HTML parser. - */ -XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt, - int *len); -XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, - int val); -XMLPUBFUN int XMLCALL xmlCopyChar (int len, - xmlChar *out, - int val); -XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt); -XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); - -/* - * Specific function to keep track of entities references - * and used by the XSLT debugger. - */ - -#ifdef IN_LIBXML -/* - * internal only - */ -XMLPUBFUN void XMLCALL - xmlErrMemory (xmlParserCtxtPtr ctxt, - const char *extra); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* __XML_PARSER_INTERNALS_H__ */ diff --git a/deps/libxml2/libxml/pattern.h b/deps/libxml2/libxml/pattern.h deleted file mode 100644 index 0fe3efb52c..0000000000 --- a/deps/libxml2/libxml/pattern.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Summary: pattern expression handling - * Description: allows to compile and test pattern expressions for nodes - * either in a tree or based on a parser state. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_PATTERN_H__ -#define __XML_PATTERN_H__ - -#include -#include -#include - - -#endif /* __XML_PATTERN_H__ */ diff --git a/deps/libxml2/libxml/relaxng.h b/deps/libxml2/libxml/relaxng.h deleted file mode 100644 index b662a91551..0000000000 --- a/deps/libxml2/libxml/relaxng.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Summary: implementation of the Relax-NG validation - * Description: implementation of the Relax-NG validation - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_RELAX_NG__ -#define __XML_RELAX_NG__ - -#include -#include -#include - - -#endif /* __XML_RELAX_NG__ */ diff --git a/deps/libxml2/libxml/threads.h b/deps/libxml2/libxml/threads.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/deps/libxml2/libxml/tree.h b/deps/libxml2/libxml/tree.h deleted file mode 100644 index 5120de2dce..0000000000 --- a/deps/libxml2/libxml/tree.h +++ /dev/null @@ -1,1152 +0,0 @@ -/* - * Summary: interfaces for tree manipulation - * Description: this module describes the structures found in an tree resulting - * from an XML or HTML parsing, as well as the API provided for - * various processing on that tree - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_TREE_H__ -#define __XML_TREE_H__ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Some of the basic types pointer to structures: - */ -/* xmlIO.h */ -typedef struct _xmlParserInputBuffer xmlParserInputBuffer; -typedef xmlParserInputBuffer *xmlParserInputBufferPtr; - -typedef struct _xmlOutputBuffer xmlOutputBuffer; -typedef xmlOutputBuffer *xmlOutputBufferPtr; - -/* parser.h */ -typedef struct _xmlParserInput xmlParserInput; -typedef xmlParserInput *xmlParserInputPtr; - -typedef struct _xmlParserCtxt xmlParserCtxt; -typedef xmlParserCtxt *xmlParserCtxtPtr; - -typedef struct _xmlSAXLocator xmlSAXLocator; -typedef xmlSAXLocator *xmlSAXLocatorPtr; - -typedef struct _xmlSAXHandler xmlSAXHandler; -typedef xmlSAXHandler *xmlSAXHandlerPtr; - -/* entities.h */ -typedef struct _xmlEntity xmlEntity; -typedef xmlEntity *xmlEntityPtr; - -/** - * BASE_BUFFER_SIZE: - * - * default buffer size 4000. - */ -#define BASE_BUFFER_SIZE 4096 - -/** - * LIBXML_NAMESPACE_DICT: - * - * Defines experimental behaviour: - * 1) xmlNs gets an additional field @context (a xmlDoc) - * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc. - */ -/* #define LIBXML_NAMESPACE_DICT */ - -/** - * xmlBufferAllocationScheme: - * - * A buffer allocation scheme can be defined to either match exactly the - * need or double it's allocated size each time it is found too small. - */ - -typedef enum { - XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ - XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ - XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ - XML_BUFFER_ALLOC_IO /* special allocation scheme used for I/O */ -} xmlBufferAllocationScheme; - -/** - * xmlBuffer: - * - * A buffer structure. - */ -typedef struct _xmlBuffer xmlBuffer; -typedef xmlBuffer *xmlBufferPtr; -struct _xmlBuffer { - xmlChar *content; /* The buffer content UTF8 */ - unsigned int use; /* The buffer size used */ - unsigned int size; /* The buffer size */ - xmlBufferAllocationScheme alloc; /* The realloc method */ - xmlChar *contentIO; /* in IO mode we may have a different base */ -}; - -/** - * XML_XML_NAMESPACE: - * - * This is the namespace for the special xml: prefix predefined in the - * XML Namespace specification. - */ -#define XML_XML_NAMESPACE \ - (const xmlChar *) "http://www.w3.org/XML/1998/namespace" - -/** - * XML_XML_ID: - * - * This is the name for the special xml:id attribute - */ -#define XML_XML_ID (const xmlChar *) "xml:id" - -/* - * The different element types carried by an XML tree. - * - * NOTE: This is synchronized with DOM Level1 values - * See http://www.w3.org/TR/REC-DOM-Level-1/ - * - * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should - * be deprecated to use an XML_DTD_NODE. - */ -typedef enum { - XML_ELEMENT_NODE= 1, - XML_ATTRIBUTE_NODE= 2, - XML_TEXT_NODE= 3, - XML_CDATA_SECTION_NODE= 4, - XML_ENTITY_REF_NODE= 5, - XML_ENTITY_NODE= 6, - XML_PI_NODE= 7, - XML_COMMENT_NODE= 8, - XML_DOCUMENT_NODE= 9, - XML_DOCUMENT_TYPE_NODE= 10, - XML_DOCUMENT_FRAG_NODE= 11, - XML_NOTATION_NODE= 12, - XML_HTML_DOCUMENT_NODE= 13, - XML_DTD_NODE= 14, - XML_ELEMENT_DECL= 15, - XML_ATTRIBUTE_DECL= 16, - XML_ENTITY_DECL= 17, - XML_NAMESPACE_DECL= 18, - XML_XINCLUDE_START= 19, - XML_XINCLUDE_END= 20 -} xmlElementType; - - -/** - * xmlNotation: - * - * A DTD Notation definition. - */ - -typedef struct _xmlNotation xmlNotation; -typedef xmlNotation *xmlNotationPtr; -struct _xmlNotation { - const xmlChar *name; /* Notation name */ - const xmlChar *PublicID; /* Public identifier, if any */ - const xmlChar *SystemID; /* System identifier, if any */ -}; - -/** - * xmlAttributeType: - * - * A DTD Attribute type definition. - */ - -typedef enum { - XML_ATTRIBUTE_CDATA = 1, - XML_ATTRIBUTE_ID, - XML_ATTRIBUTE_IDREF , - XML_ATTRIBUTE_IDREFS, - XML_ATTRIBUTE_ENTITY, - XML_ATTRIBUTE_ENTITIES, - XML_ATTRIBUTE_NMTOKEN, - XML_ATTRIBUTE_NMTOKENS, - XML_ATTRIBUTE_ENUMERATION, - XML_ATTRIBUTE_NOTATION -} xmlAttributeType; - -/** - * xmlAttributeDefault: - * - * A DTD Attribute default definition. - */ - -typedef enum { - XML_ATTRIBUTE_NONE = 1, - XML_ATTRIBUTE_REQUIRED, - XML_ATTRIBUTE_IMPLIED, - XML_ATTRIBUTE_FIXED -} xmlAttributeDefault; - -/** - * xmlEnumeration: - * - * List structure used when there is an enumeration in DTDs. - */ - -typedef struct _xmlEnumeration xmlEnumeration; -typedef xmlEnumeration *xmlEnumerationPtr; -struct _xmlEnumeration { - struct _xmlEnumeration *next; /* next one */ - const xmlChar *name; /* Enumeration name */ -}; - -/** - * xmlAttribute: - * - * An Attribute declaration in a DTD. - */ - -typedef struct _xmlAttribute xmlAttribute; -typedef xmlAttribute *xmlAttributePtr; -struct _xmlAttribute { - void *_private; /* application data */ - xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ - const xmlChar *name; /* Attribute name */ - struct _xmlNode *children; /* NULL */ - struct _xmlNode *last; /* NULL */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - struct _xmlAttribute *nexth; /* next in hash table */ - xmlAttributeType atype; /* The attribute type */ - xmlAttributeDefault def; /* the default */ - const xmlChar *defaultValue; /* or the default value */ - xmlEnumerationPtr tree; /* or the enumeration tree if any */ - const xmlChar *prefix; /* the namespace prefix if any */ - const xmlChar *elem; /* Element holding the attribute */ -}; - -/** - * xmlElementContentType: - * - * Possible definitions of element content types. - */ -typedef enum { - XML_ELEMENT_CONTENT_PCDATA = 1, - XML_ELEMENT_CONTENT_ELEMENT, - XML_ELEMENT_CONTENT_SEQ, - XML_ELEMENT_CONTENT_OR -} xmlElementContentType; - -/** - * xmlElementContentOccur: - * - * Possible definitions of element content occurrences. - */ -typedef enum { - XML_ELEMENT_CONTENT_ONCE = 1, - XML_ELEMENT_CONTENT_OPT, - XML_ELEMENT_CONTENT_MULT, - XML_ELEMENT_CONTENT_PLUS -} xmlElementContentOccur; - -/** - * xmlElementContent: - * - * An XML Element content as stored after parsing an element definition - * in a DTD. - */ - -typedef struct _xmlElementContent xmlElementContent; -typedef xmlElementContent *xmlElementContentPtr; -struct _xmlElementContent { - xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ - xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ - const xmlChar *name; /* Element name */ - struct _xmlElementContent *c1; /* first child */ - struct _xmlElementContent *c2; /* second child */ - struct _xmlElementContent *parent; /* parent */ - const xmlChar *prefix; /* Namespace prefix */ -}; - -/** - * xmlElementTypeVal: - * - * The different possibilities for an element content type. - */ - -typedef enum { - XML_ELEMENT_TYPE_UNDEFINED = 0, - XML_ELEMENT_TYPE_EMPTY = 1, - XML_ELEMENT_TYPE_ANY, - XML_ELEMENT_TYPE_MIXED, - XML_ELEMENT_TYPE_ELEMENT -} xmlElementTypeVal; - -#ifdef __cplusplus -} -#endif -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlElement: - * - * An XML Element declaration from a DTD. - */ - -typedef struct _xmlElement xmlElement; -typedef xmlElement *xmlElementPtr; -struct _xmlElement { - void *_private; /* application data */ - xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ - const xmlChar *name; /* Element name */ - struct _xmlNode *children; /* NULL */ - struct _xmlNode *last; /* NULL */ - struct _xmlDtd *parent; /* -> DTD */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - xmlElementTypeVal etype; /* The type */ - xmlElementContentPtr content; /* the allowed element content */ - xmlAttributePtr attributes; /* List of the declared attributes */ - const xmlChar *prefix; /* the namespace prefix if any */ - void *contModel; -}; - - -/** - * XML_LOCAL_NAMESPACE: - * - * A namespace declaration node. - */ -#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL -typedef xmlElementType xmlNsType; - -/** - * xmlNs: - * - * An XML namespace. - * Note that prefix == NULL is valid, it defines the default namespace - * within the subtree (until overridden). - * - * xmlNsType is unified with xmlElementType. - */ - -typedef struct _xmlNs xmlNs; -typedef xmlNs *xmlNsPtr; -struct _xmlNs { - struct _xmlNs *next; /* next Ns link for this node */ - xmlNsType type; /* global or local */ - const xmlChar *href; /* URL for the namespace */ - const xmlChar *prefix; /* prefix for the namespace */ - void *_private; /* application data */ - struct _xmlDoc *context; /* normally an xmlDoc */ -}; - -/** - * xmlDtd: - * - * An XML DTD, as defined by parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - /* End of common part */ - void *notations; /* Hash table for notations if any */ - void *elements; /* Hash table for elements if any */ - void *attributes; /* Hash table for attributes if any */ - void *entities; /* Hash table for entities if any */ - const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ - const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ - void *pentities; /* Hash table for param entities if any */ -}; - -/** - * xmlAttr: - * - * An attribute on an XML node. - */ -typedef struct _xmlAttr xmlAttr; -typedef xmlAttr *xmlAttrPtr; -struct _xmlAttr { - void *_private; /* application data */ - xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ - const xmlChar *name; /* the name of the property */ - struct _xmlNode *children; /* the value of the property */ - struct _xmlNode *last; /* NULL */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlAttr *next; /* next sibling link */ - struct _xmlAttr *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - xmlNs *ns; /* pointer to the associated namespace */ - xmlAttributeType atype; /* the attribute type if validating */ - void *psvi; /* for type/PSVI informations */ -}; - -/** - * xmlID: - * - * An XML ID instance. - */ - -typedef struct _xmlID xmlID; -typedef xmlID *xmlIDPtr; -struct _xmlID { - struct _xmlID *next; /* next ID */ - const xmlChar *value; /* The ID name */ - xmlAttrPtr attr; /* The attribute holding it */ - const xmlChar *name; /* The attribute if attr is not available */ - int lineno; /* The line number if attr is not available */ - struct _xmlDoc *doc; /* The document holding the ID */ -}; - -/** - * xmlRef: - * - * An XML IDREF instance. - */ - -typedef struct _xmlRef xmlRef; -typedef xmlRef *xmlRefPtr; -struct _xmlRef { - struct _xmlRef *next; /* next Ref */ - const xmlChar *value; /* The Ref name */ - xmlAttrPtr attr; /* The attribute holding it */ - const xmlChar *name; /* The attribute if attr is not available */ - int lineno; /* The line number if attr is not available */ -}; - -/** - * xmlNode: - * - * A node in an XML tree. - */ -typedef struct _xmlNode xmlNode; -typedef xmlNode *xmlNodePtr; -struct _xmlNode { - void *_private; /* application data */ - xmlElementType type; /* type number, must be second ! */ - const xmlChar *name; /* the name of the node, or the entity */ - struct _xmlNode *children; /* parent->childs link */ - struct _xmlNode *last; /* last child link */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* the containing document */ - - /* End of common part */ - xmlNs *ns; /* pointer to the associated namespace */ - xmlChar *content; /* the content */ - struct _xmlAttr *properties;/* properties list */ - xmlNs *nsDef; /* namespace definitions on this node */ - void *psvi; /* for type/PSVI informations */ - unsigned short line; /* line number */ - unsigned short extra; /* extra data for XPath/XSLT */ -}; - -/** - * XML_GET_CONTENT: - * - * Macro to extract the content pointer of a node. - */ -#define XML_GET_CONTENT(n) \ - ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) - -/** - * XML_GET_LINE: - * - * Macro to extract the line number of an element node. - */ -#define XML_GET_LINE(n) \ - (xmlGetLineNo(n)) - -/** - * xmlDocProperty - * - * Set of properties of the document as found by the parser - * Some of them are linked to similary named xmlParserOption - */ -typedef enum { - XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ - XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ - XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ - XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ - XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ - XML_DOC_USERBUILT = 1<<5, /* Document was built using the API - and not by parsing an instance */ - XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ - XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ -} xmlDocProperties; - -/** - * xmlDoc: - * - * An XML document. - */ -typedef struct _xmlDoc xmlDoc; -typedef xmlDoc *xmlDocPtr; -struct _xmlDoc { - void *_private; /* application data */ - xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ - char *name; /* name/filename/URI of the document */ - struct _xmlNode *children; /* the document tree */ - struct _xmlNode *last; /* last child link */ - struct _xmlNode *parent; /* child->parent link */ - struct _xmlNode *next; /* next sibling link */ - struct _xmlNode *prev; /* previous sibling link */ - struct _xmlDoc *doc; /* autoreference to itself */ - - /* End of common part */ - int compression;/* level of zlib compression */ - int standalone; /* standalone document (no external refs) - 1 if standalone="yes" - 0 if standalone="no" - -1 if there is no XML declaration - -2 if there is an XML declaration, but no - standalone attribute was specified */ - struct _xmlDtd *intSubset; /* the document internal subset */ - struct _xmlDtd *extSubset; /* the document external subset */ - struct _xmlNs *oldNs; /* Global namespace, the old way */ - const xmlChar *version; /* the XML version string */ - const xmlChar *encoding; /* external initial encoding, if any */ - void *ids; /* Hash table for ID attributes if any */ - void *refs; /* Hash table for IDREFs attributes if any */ - const xmlChar *URL; /* The URI for that document */ - int charset; /* encoding of the in-memory content - actually an xmlCharEncoding */ - struct _xmlDict *dict; /* dict used to allocate names or NULL */ - void *psvi; /* for type/PSVI informations */ - int parseFlags; /* set of xmlParserOption used to parse the - document */ - int properties; /* set of xmlDocProperties for this document - set at the end of parsing */ -}; - - -typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; -typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; - -/** - * xmlDOMWrapAcquireNsFunction: - * @ctxt: a DOM wrapper context - * @node: the context node (element or attribute) - * @nsName: the requested namespace name - * @nsPrefix: the requested namespace prefix - * - * A function called to acquire namespaces (xmlNs) from the wrapper. - * - * Returns an xmlNsPtr or NULL in case of an error. - */ -typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, - xmlNodePtr node, - const xmlChar *nsName, - const xmlChar *nsPrefix); - -/** - * xmlDOMWrapCtxt: - * - * Context for DOM wrapper-operations. - */ -struct _xmlDOMWrapCtxt { - void * _private; - /* - * The type of this context, just in case we need specialized - * contexts in the future. - */ - int type; - /* - * Internal namespace map used for various operations. - */ - void * namespaceMap; - /* - * Use this one to acquire an xmlNsPtr intended for node->ns. - * (Note that this is not intended for elem->nsDef). - */ - xmlDOMWrapAcquireNsFunction getNsForNodeFunc; -}; - -/** - * xmlChildrenNode: - * - * Macro for compatibility naming layer with libxml1. Maps - * to "children." - */ -#ifndef xmlChildrenNode -#define xmlChildrenNode children -#endif - -/** - * xmlRootNode: - * - * Macro for compatibility naming layer with libxml1. Maps - * to "children". - */ -#ifndef xmlRootNode -#define xmlRootNode children -#endif - -/* - * Variables. - */ - -/* - * Some helper functions - */ -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateNCName (const xmlChar *value, - int space); -#endif - -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN int XMLCALL - xmlValidateQName (const xmlChar *value, - int space); -XMLPUBFUN int XMLCALL - xmlValidateName (const xmlChar *value, - int space); -XMLPUBFUN int XMLCALL - xmlValidateNMToken (const xmlChar *value, - int space); -#endif - -XMLPUBFUN xmlChar * XMLCALL - xmlBuildQName (const xmlChar *ncname, - const xmlChar *prefix, - xmlChar *memory, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlSplitQName2 (const xmlChar *name, - xmlChar **prefix); -XMLPUBFUN const xmlChar * XMLCALL - xmlSplitQName3 (const xmlChar *name, - int *len); - -/* - * Handling Buffers. - */ - -XMLPUBFUN void XMLCALL - xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); -XMLPUBFUN xmlBufferAllocationScheme XMLCALL - xmlGetBufferAllocationScheme(void); - -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreate (void); -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreateSize (size_t size); -XMLPUBFUN xmlBufferPtr XMLCALL - xmlBufferCreateStatic (void *mem, - size_t size); -XMLPUBFUN int XMLCALL - xmlBufferResize (xmlBufferPtr buf, - unsigned int size); -XMLPUBFUN void XMLCALL - xmlBufferFree (xmlBufferPtr buf); -XMLPUBFUN int XMLCALL - xmlBufferDump (FILE *file, - xmlBufferPtr buf); -XMLPUBFUN int XMLCALL - xmlBufferAdd (xmlBufferPtr buf, - const xmlChar *str, - int len); -XMLPUBFUN int XMLCALL - xmlBufferAddHead (xmlBufferPtr buf, - const xmlChar *str, - int len); -XMLPUBFUN int XMLCALL - xmlBufferCat (xmlBufferPtr buf, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlBufferCCat (xmlBufferPtr buf, - const char *str); -XMLPUBFUN int XMLCALL - xmlBufferShrink (xmlBufferPtr buf, - unsigned int len); -XMLPUBFUN int XMLCALL - xmlBufferGrow (xmlBufferPtr buf, - unsigned int len); -XMLPUBFUN void XMLCALL - xmlBufferEmpty (xmlBufferPtr buf); -XMLPUBFUN const xmlChar* XMLCALL - xmlBufferContent (const xmlBufferPtr buf); -XMLPUBFUN void XMLCALL - xmlBufferSetAllocationScheme(xmlBufferPtr buf, - xmlBufferAllocationScheme scheme); -XMLPUBFUN int XMLCALL - xmlBufferLength (const xmlBufferPtr buf); - -/* - * Creating/freeing new structures. - */ -XMLPUBFUN xmlDtdPtr XMLCALL - xmlCreateIntSubset (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlNewDtd (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *ExternalID, - const xmlChar *SystemID); -XMLPUBFUN xmlDtdPtr XMLCALL - xmlGetIntSubset (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlFreeDtd (xmlDtdPtr cur); -XMLPUBFUN xmlNsPtr XMLCALL - xmlNewNs (xmlNodePtr node, - const xmlChar *href, - const xmlChar *prefix); -XMLPUBFUN void XMLCALL - xmlFreeNs (xmlNsPtr cur); -XMLPUBFUN void XMLCALL - xmlFreeNsList (xmlNsPtr cur); -XMLPUBFUN xmlDocPtr XMLCALL - xmlNewDoc (const xmlChar *version); -XMLPUBFUN void XMLCALL - xmlFreeDoc (xmlDocPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewDocProp (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *value); -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *value); -#endif -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlNewNsPropEatName (xmlNodePtr node, - xmlNsPtr ns, - xmlChar *name, - const xmlChar *value); -XMLPUBFUN void XMLCALL - xmlFreePropList (xmlAttrPtr cur); -XMLPUBFUN void XMLCALL - xmlFreeProp (xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlCopyProp (xmlNodePtr target, - xmlAttrPtr cur); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlCopyPropList (xmlNodePtr target, - xmlAttrPtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlDtdPtr XMLCALL - xmlCopyDtd (xmlDtdPtr dtd); -#endif /* LIBXML_TREE_ENABLED */ -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlDocPtr XMLCALL - xmlCopyDoc (xmlDocPtr doc, - int recursive); -#endif /* defined(LIBXML_TREE_ENABLED) */ -/* - * Creating new nodes. - */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocNode (xmlDocPtr doc, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocNodeEatName (xmlDocPtr doc, - xmlNsPtr ns, - xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewNode (xmlNsPtr ns, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewNodeEatName (xmlNsPtr ns, - xmlChar *name); -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewChild (xmlNodePtr parent, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -#endif -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocText (xmlDocPtr doc, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewText (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocPI (xmlDocPtr doc, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewPI (const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocTextLen (xmlDocPtr doc, - const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewTextLen (const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocComment (xmlDocPtr doc, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewComment (const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewCDataBlock (xmlDocPtr doc, - const xmlChar *content, - int len); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewCharRef (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewReference (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlNodePtr XMLCALL - xmlCopyNode (const xmlNodePtr node, - int recursive); -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocCopyNode (const xmlNodePtr node, - xmlDocPtr doc, - int recursive); -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocCopyNodeList (xmlDocPtr doc, - const xmlNodePtr node); -XMLPUBFUN xmlNodePtr XMLCALL - xmlCopyNodeList (const xmlNodePtr node); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewTextChild (xmlNodePtr parent, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocRawNode (xmlDocPtr doc, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *content); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNewDocFragment (xmlDocPtr doc); -#endif /* LIBXML_TREE_ENABLED */ - -/* - * Navigating. - */ -XMLPUBFUN long XMLCALL - xmlGetLineNo (xmlNodePtr node); -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlChar * XMLCALL - xmlGetNodePath (xmlNodePtr node); -#endif /* defined(LIBXML_TREE_ENABLED) */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocGetRootElement (xmlDocPtr doc); -XMLPUBFUN xmlNodePtr XMLCALL - xmlGetLastChild (xmlNodePtr parent); -XMLPUBFUN int XMLCALL - xmlNodeIsText (xmlNodePtr node); -XMLPUBFUN int XMLCALL - xmlIsBlankNode (xmlNodePtr node); - -/* - * Changing the structure. - */ -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlDocSetRootElement (xmlDocPtr doc, - xmlNodePtr root); -#endif /* defined(LIBXML_TREE_ENABLED) */ -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetName (xmlNodePtr cur, - const xmlChar *name); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddChild (xmlNodePtr parent, - xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddChildList (xmlNodePtr parent, - xmlNodePtr cur); -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlReplaceNode (xmlNodePtr old, - xmlNodePtr cur); -#endif /* defined(LIBXML_TREE_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddPrevSibling (xmlNodePtr cur, - xmlNodePtr elem); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddSibling (xmlNodePtr cur, - xmlNodePtr elem); -XMLPUBFUN xmlNodePtr XMLCALL - xmlAddNextSibling (xmlNodePtr cur, - xmlNodePtr elem); -XMLPUBFUN void XMLCALL - xmlUnlinkNode (xmlNodePtr cur); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextMerge (xmlNodePtr first, - xmlNodePtr second); -XMLPUBFUN int XMLCALL - xmlTextConcat (xmlNodePtr node, - const xmlChar *content, - int len); -XMLPUBFUN void XMLCALL - xmlFreeNodeList (xmlNodePtr cur); -XMLPUBFUN void XMLCALL - xmlFreeNode (xmlNodePtr cur); -XMLPUBFUN void XMLCALL - xmlSetTreeDoc (xmlNodePtr tree, - xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSetListDoc (xmlNodePtr list, - xmlDocPtr doc); -/* - * Namespaces. - */ -XMLPUBFUN xmlNsPtr XMLCALL - xmlSearchNs (xmlDocPtr doc, - xmlNodePtr node, - const xmlChar *nameSpace); -XMLPUBFUN xmlNsPtr XMLCALL - xmlSearchNsByHref (xmlDocPtr doc, - xmlNodePtr node, - const xmlChar *href); -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlNsPtr * XMLCALL - xmlGetNsList (xmlDocPtr doc, - xmlNodePtr node); -#endif /* defined(LIBXML_TREE_ENABLED) */ - -XMLPUBFUN void XMLCALL - xmlSetNs (xmlNodePtr node, - xmlNsPtr ns); -XMLPUBFUN xmlNsPtr XMLCALL - xmlCopyNamespace (xmlNsPtr cur); -XMLPUBFUN xmlNsPtr XMLCALL - xmlCopyNamespaceList (xmlNsPtr cur); - -/* - * Changing the content. - */ -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN xmlAttrPtr XMLCALL - xmlSetProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *value); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlSetNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name, - const xmlChar *value); -#endif /* defined(LIBXML_TREE_ENABLED) */ -XMLPUBFUN xmlChar * XMLCALL - xmlGetNoNsProp (xmlNodePtr node, - const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL - xmlGetProp (xmlNodePtr node, - const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlHasProp (xmlNodePtr node, - const xmlChar *name); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlHasNsProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *nameSpace); -XMLPUBFUN xmlChar * XMLCALL - xmlGetNsProp (xmlNodePtr node, - const xmlChar *name, - const xmlChar *nameSpace); -XMLPUBFUN xmlNodePtr XMLCALL - xmlStringGetNodeList (xmlDocPtr doc, - const xmlChar *value); -XMLPUBFUN xmlNodePtr XMLCALL - xmlStringLenGetNodeList (xmlDocPtr doc, - const xmlChar *value, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeListGetString (xmlDocPtr doc, - xmlNodePtr list, - int inLine); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlChar * XMLCALL - xmlNodeListGetRawString (xmlDocPtr doc, - xmlNodePtr list, - int inLine); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlNodeSetContent (xmlNodePtr cur, - const xmlChar *content); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetContentLen (xmlNodePtr cur, - const xmlChar *content, - int len); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlNodeAddContent (xmlNodePtr cur, - const xmlChar *content); -XMLPUBFUN void XMLCALL - xmlNodeAddContentLen (xmlNodePtr cur, - const xmlChar *content, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetContent (xmlNodePtr cur); -XMLPUBFUN int XMLCALL - xmlNodeBufGetContent (xmlBufferPtr buffer, - xmlNodePtr cur); -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetLang (xmlNodePtr cur); -XMLPUBFUN int XMLCALL - xmlNodeGetSpacePreserve (xmlNodePtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN void XMLCALL - xmlNodeSetLang (xmlNodePtr cur, - const xmlChar *lang); -XMLPUBFUN void XMLCALL - xmlNodeSetSpacePreserve (xmlNodePtr cur, - int val); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN xmlChar * XMLCALL - xmlNodeGetBase (xmlDocPtr doc, - xmlNodePtr cur); -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN void XMLCALL - xmlNodeSetBase (xmlNodePtr cur, - const xmlChar *uri); -#endif - -/* - * Removing content. - */ -XMLPUBFUN int XMLCALL - xmlRemoveProp (xmlAttrPtr cur); -#if defined(LIBXML_TREE_ENABLED) -XMLPUBFUN int XMLCALL - xmlUnsetNsProp (xmlNodePtr node, - xmlNsPtr ns, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlUnsetProp (xmlNodePtr node, - const xmlChar *name); -#endif /* defined(LIBXML_TREE_ENABLED) */ - -/* - * Internal, don't use. - */ -XMLPUBFUN void XMLCALL - xmlBufferWriteCHAR (xmlBufferPtr buf, - const xmlChar *string); -XMLPUBFUN void XMLCALL - xmlBufferWriteChar (xmlBufferPtr buf, - const char *string); -XMLPUBFUN void XMLCALL - xmlBufferWriteQuotedString(xmlBufferPtr buf, - const xmlChar *string); - - -#ifdef LIBXML_TREE_ENABLED -/* - * Namespace handling. - */ -XMLPUBFUN int XMLCALL - xmlReconciliateNs (xmlDocPtr doc, - xmlNodePtr tree); -#endif - -/* - * XHTML - */ -XMLPUBFUN int XMLCALL - xmlIsXHTML (const xmlChar *systemID, - const xmlChar *publicID); - -/* - * Compression. - */ -XMLPUBFUN int XMLCALL - xmlGetDocCompressMode (xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlSetDocCompressMode (xmlDocPtr doc, - int mode); -XMLPUBFUN int XMLCALL - xmlGetCompressMode (void); -XMLPUBFUN void XMLCALL - xmlSetCompressMode (int mode); - -/* -* DOM-wrapper helper functions. -*/ -XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL - xmlDOMWrapNewCtxt (void); -XMLPUBFUN void XMLCALL - xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); -XMLPUBFUN int XMLCALL - xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, - xmlNodePtr elem, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr sourceDoc, - xmlNodePtr node, - xmlDocPtr destDoc, - xmlNodePtr destParent, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr doc, - xmlNodePtr node, - int options); -XMLPUBFUN int XMLCALL - xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr sourceDoc, - xmlNodePtr node, - xmlNodePtr *clonedNode, - xmlDocPtr destDoc, - xmlNodePtr destParent, - int deep, - int options); - -#ifdef LIBXML_TREE_ENABLED -/* - * 5 interfaces from DOM ElementTraversal, but different in entities - * traversal. - */ -XMLPUBFUN unsigned long XMLCALL - xmlChildElementCount (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlNextElementSibling (xmlNodePtr node); -XMLPUBFUN xmlNodePtr XMLCALL - xmlFirstElementChild (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlLastElementChild (xmlNodePtr parent); -XMLPUBFUN xmlNodePtr XMLCALL - xmlPreviousElementSibling (xmlNodePtr node); -#endif -#ifdef __cplusplus -} -#endif -#ifndef __XML_PARSER_H__ -#include -#endif - -#endif /* __XML_TREE_H__ */ - diff --git a/deps/libxml2/libxml/uri.h b/deps/libxml2/libxml/uri.h deleted file mode 100644 index db48262b13..0000000000 --- a/deps/libxml2/libxml/uri.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Summary: library of generic URI related routines - * Description: library of generic URI related routines - * Implements RFC 2396 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_URI_H__ -#define __XML_URI_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlURI: - * - * A parsed URI reference. This is a struct containing the various fields - * as described in RFC 2396 but separated for further processing. - * - * Note: query is a deprecated field which is incorrectly unescaped. - * query_raw takes precedence over query if the former is set. - * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 - */ -typedef struct _xmlURI xmlURI; -typedef xmlURI *xmlURIPtr; -struct _xmlURI { - char *scheme; /* the URI scheme */ - char *opaque; /* opaque part */ - char *authority; /* the authority part */ - char *server; /* the server part */ - char *user; /* the user part */ - int port; /* the port number */ - char *path; /* the path string */ - char *query; /* the query string (deprecated - use with caution) */ - char *fragment; /* the fragment identifier */ - int cleanup; /* parsing potentially unclean URI */ - char *query_raw; /* the query string (as it appears in the URI) */ -}; - -/* - * This function is in tree.h: - * xmlChar * xmlNodeGetBase (xmlDocPtr doc, - * xmlNodePtr cur); - */ -XMLPUBFUN xmlURIPtr XMLCALL - xmlCreateURI (void); -XMLPUBFUN xmlChar * XMLCALL - xmlBuildURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlChar * XMLCALL - xmlBuildRelativeURI (const xmlChar *URI, - const xmlChar *base); -XMLPUBFUN xmlURIPtr XMLCALL - xmlParseURI (const char *str); -XMLPUBFUN xmlURIPtr XMLCALL - xmlParseURIRaw (const char *str, - int raw); -XMLPUBFUN int XMLCALL - xmlParseURIReference (xmlURIPtr uri, - const char *str); -XMLPUBFUN xmlChar * XMLCALL - xmlSaveUri (xmlURIPtr uri); -XMLPUBFUN void XMLCALL - xmlPrintURI (FILE *stream, - xmlURIPtr uri); -XMLPUBFUN xmlChar * XMLCALL - xmlURIEscapeStr (const xmlChar *str, - const xmlChar *list); -XMLPUBFUN char * XMLCALL - xmlURIUnescapeString (const char *str, - int len, - char *target); -XMLPUBFUN int XMLCALL - xmlNormalizeURIPath (char *path); -XMLPUBFUN xmlChar * XMLCALL - xmlURIEscape (const xmlChar *str); -XMLPUBFUN void XMLCALL - xmlFreeURI (xmlURIPtr uri); -XMLPUBFUN xmlChar* XMLCALL - xmlCanonicPath (const xmlChar *path); -XMLPUBFUN xmlChar* XMLCALL - xmlPathToURI (const xmlChar *path); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_URI_H__ */ diff --git a/deps/libxml2/libxml/valid.h b/deps/libxml2/libxml/valid.h deleted file mode 100644 index c4a5bd8feb..0000000000 --- a/deps/libxml2/libxml/valid.h +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Summary: The DTD validation - * Description: API for the DTD handling and the validity checking - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __XML_VALID_H__ -#define __XML_VALID_H__ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Validation state added for non-determinist content model. - */ -typedef struct _xmlValidState xmlValidState; -typedef xmlValidState *xmlValidStatePtr; - -/** - * xmlValidityErrorFunc: - * @ctx: usually an xmlValidCtxtPtr to a validity error context, - * but comes from ctxt->userData (which normally contains such - * a pointer); ctxt->userData can be changed by the user. - * @msg: the string to format *printf like vararg - * @...: remaining arguments to the format - * - * Callback called when a validity error is found. This is a message - * oriented function similar to an *printf function. - */ -typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); - -/** - * xmlValidityWarningFunc: - * @ctx: usually an xmlValidCtxtPtr to a validity error context, - * but comes from ctxt->userData (which normally contains such - * a pointer); ctxt->userData can be changed by the user. - * @msg: the string to format *printf like vararg - * @...: remaining arguments to the format - * - * Callback called when a validity warning is found. This is a message - * oriented function similar to an *printf function. - */ -typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); - -/** - * XML_CTXT_FINISH_DTD_0: - * - * Special value for finishDtd field when embedded in an xmlParserCtxt - */ -#ifndef XML_CTXT_FINISH_DTD_0 -#define XML_CTXT_FINISH_DTD_0 0xabcd1234 -#endif - -/** - * XML_CTXT_FINISH_DTD_1: - * - * Special value for finishDtd field when embedded in an xmlParserCtxt - */ -#ifndef XML_CTXT_FINISH_DTD_1 -#define XML_CTXT_FINISH_DTD_1 0xabcd1235 -#endif - -/* - * xmlValidCtxt: - * An xmlValidCtxt is used for error reporting when validating. - */ -typedef struct _xmlValidCtxt xmlValidCtxt; -typedef xmlValidCtxt *xmlValidCtxtPtr; -struct _xmlValidCtxt { - void *userData; /* user specific data block */ - xmlValidityErrorFunc error; /* the callback in case of errors */ - xmlValidityWarningFunc warning; /* the callback in case of warning */ - - /* Node analysis stack used when validating within entities */ - xmlNodePtr node; /* Current parsed Node */ - int nodeNr; /* Depth of the parsing stack */ - int nodeMax; /* Max depth of the parsing stack */ - xmlNodePtr *nodeTab; /* array of nodes */ - - unsigned int finishDtd; /* finished validating the Dtd ? */ - xmlDocPtr doc; /* the document */ - int valid; /* temporary validity check result */ - - /* state state used for non-determinist content validation */ - xmlValidState *vstate; /* current state */ - int vstateNr; /* Depth of the validation stack */ - int vstateMax; /* Max depth of the validation stack */ - xmlValidState *vstateTab; /* array of validation states */ - - void *am; - void *state; -}; - -/* - * ALL notation declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlNotationTable; -typedef xmlNotationTable *xmlNotationTablePtr; - -/* - * ALL element declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlElementTable; -typedef xmlElementTable *xmlElementTablePtr; - -/* - * ALL attribute declarations are stored in a table. - * There is one table per DTD. - */ - -typedef struct _xmlHashTable xmlAttributeTable; -typedef xmlAttributeTable *xmlAttributeTablePtr; - -/* - * ALL IDs attributes are stored in a table. - * There is one table per document. - */ - -typedef struct _xmlHashTable xmlIDTable; -typedef xmlIDTable *xmlIDTablePtr; - -/* - * ALL Refs attributes are stored in a table. - * There is one table per document. - */ - -typedef struct _xmlHashTable xmlRefTable; -typedef xmlRefTable *xmlRefTablePtr; - -/* Notation */ -XMLPUBFUN xmlNotationPtr XMLCALL - xmlAddNotationDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *PublicID, - const xmlChar *SystemID); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlNotationTablePtr XMLCALL - xmlCopyNotationTable (xmlNotationTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeNotationTable (xmlNotationTablePtr table); - -/* Element Content */ -/* the non Doc version are being deprecated */ -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlNewElementContent (const xmlChar *name, - xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlCopyElementContent (xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlFreeElementContent (xmlElementContentPtr cur); -/* the new versions with doc argument */ -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlNewDocElementContent (xmlDocPtr doc, - const xmlChar *name, - xmlElementContentType type); -XMLPUBFUN xmlElementContentPtr XMLCALL - xmlCopyDocElementContent(xmlDocPtr doc, - xmlElementContentPtr content); -XMLPUBFUN void XMLCALL - xmlFreeDocElementContent(xmlDocPtr doc, - xmlElementContentPtr cur); -XMLPUBFUN void XMLCALL - xmlSnprintfElementContent(char *buf, - int size, - xmlElementContentPtr content, - int englob); -/* DEPRECATED */ - -/* Element */ -XMLPUBFUN xmlElementPtr XMLCALL - xmlAddElementDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *name, - xmlElementTypeVal type, - xmlElementContentPtr content); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlElementTablePtr XMLCALL - xmlCopyElementTable (xmlElementTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeElementTable (xmlElementTablePtr table); - -/* Enumeration */ -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlCreateEnumeration (const xmlChar *name); -XMLPUBFUN void XMLCALL - xmlFreeEnumeration (xmlEnumerationPtr cur); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlEnumerationPtr XMLCALL - xmlCopyEnumeration (xmlEnumerationPtr cur); -#endif /* LIBXML_TREE_ENABLED */ - -/* Attribute */ -XMLPUBFUN xmlAttributePtr XMLCALL - xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name, - const xmlChar *ns, - xmlAttributeType type, - xmlAttributeDefault def, - const xmlChar *defaultValue, - xmlEnumerationPtr tree); -#ifdef LIBXML_TREE_ENABLED -XMLPUBFUN xmlAttributeTablePtr XMLCALL - xmlCopyAttributeTable (xmlAttributeTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ -XMLPUBFUN void XMLCALL - xmlFreeAttributeTable (xmlAttributeTablePtr table); - -/* IDs */ -XMLPUBFUN xmlIDPtr XMLCALL - xmlAddID (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *value, - xmlAttrPtr attr); -XMLPUBFUN void XMLCALL - xmlFreeIDTable (xmlIDTablePtr table); -XMLPUBFUN xmlAttrPtr XMLCALL - xmlGetID (xmlDocPtr doc, - const xmlChar *ID); -XMLPUBFUN int XMLCALL - xmlIsID (xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveID (xmlDocPtr doc, - xmlAttrPtr attr); - -/* IDREFs */ -XMLPUBFUN xmlRefPtr XMLCALL - xmlAddRef (xmlValidCtxtPtr ctxt, - xmlDocPtr doc, - const xmlChar *value, - xmlAttrPtr attr); -XMLPUBFUN void XMLCALL - xmlFreeRefTable (xmlRefTablePtr table); -XMLPUBFUN int XMLCALL - xmlIsRef (xmlDocPtr doc, - xmlNodePtr elem, - xmlAttrPtr attr); -XMLPUBFUN int XMLCALL - xmlRemoveRef (xmlDocPtr doc, - xmlAttrPtr attr); -XMLPUBFUN xmlListPtr XMLCALL - xmlGetRefs (xmlDocPtr doc, - const xmlChar *ID); - -/** - * The public function calls related to validity checking. - */ - -XMLPUBFUN int XMLCALL - xmlIsMixedElement (xmlDocPtr doc, - const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL - xmlGetDtdAttrDesc (xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name); -XMLPUBFUN xmlAttributePtr XMLCALL - xmlGetDtdQAttrDesc (xmlDtdPtr dtd, - const xmlChar *elem, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN xmlNotationPtr XMLCALL - xmlGetDtdNotationDesc (xmlDtdPtr dtd, - const xmlChar *name); -XMLPUBFUN xmlElementPtr XMLCALL - xmlGetDtdQElementDesc (xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *prefix); -XMLPUBFUN xmlElementPtr XMLCALL - xmlGetDtdElementDesc (xmlDtdPtr dtd, - const xmlChar *name); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_VALID_H__ */ diff --git a/deps/libxml2/libxml/xinclude.h b/deps/libxml2/libxml/xinclude.h deleted file mode 100644 index cf345a694e..0000000000 --- a/deps/libxml2/libxml/xinclude.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Summary: implementation of XInclude - * Description: API to handle XInclude processing, - * implements the - * World Wide Web Consortium Last Call Working Draft 10 November 2003 - * http://www.w3.org/TR/2003/WD-xinclude-20031110 - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XINCLUDE_H__ -#define __XML_XINCLUDE_H__ - -#include -#include - - -#endif /* __XML_XINCLUDE_H__ */ diff --git a/deps/libxml2/libxml/xlink.h b/deps/libxml2/libxml/xlink.h deleted file mode 100644 index d0b6731b7a..0000000000 --- a/deps/libxml2/libxml/xlink.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Summary: unfinished XLink detection module - * Description: unfinished XLink detection module - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XLINK_H__ -#define __XML_XLINK_H__ - -#include -#include - - -#endif /* __XML_XLINK_H__ */ diff --git a/deps/libxml2/libxml/xmlIO.h b/deps/libxml2/libxml/xmlIO.h deleted file mode 100644 index 3f0efc61dd..0000000000 --- a/deps/libxml2/libxml/xmlIO.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Summary: interface for the I/O interfaces used by the parser - * Description: interface for the I/O interfaces used by the parser - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_IO_H__ -#define __XML_IO_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Those are the functions and datatypes for the parser input - * I/O structures. - */ - -/** - * xmlInputMatchCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Input API to detect if the current handler - * can provide input fonctionnalities for this resource. - * - * Returns 1 if yes and 0 if another Input module should be used - */ -typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename); -/** - * xmlInputOpenCallback: - * @filename: the filename or URI - * - * Callback used in the I/O Input API to open the resource - * - * Returns an Input context or NULL in case or error - */ -typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename); -/** - * xmlInputReadCallback: - * @context: an Input context - * @buffer: the buffer to store data read - * @len: the length of the buffer in bytes - * - * Callback used in the I/O Input API to read the resource - * - * Returns the number of bytes read or -1 in case of error - */ -typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len); -/** - * xmlInputCloseCallback: - * @context: an Input context - * - * Callback used in the I/O Input API to close the resource - * - * Returns 0 or -1 in case of error - */ -typedef int (XMLCALL *xmlInputCloseCallback) (void * context); - - -#ifdef __cplusplus -} -#endif - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif -struct _xmlParserInputBuffer { - void* context; - xmlInputReadCallback readcallback; - xmlInputCloseCallback closecallback; - - xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ - - xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */ - xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */ - int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ - int error; - unsigned long rawconsumed;/* amount consumed from raw */ -}; - - -/* - * Interfaces for input - */ -XMLPUBFUN void XMLCALL - xmlCleanupInputCallbacks (void); - -XMLPUBFUN int XMLCALL - xmlPopInputCallbacks (void); - -XMLPUBFUN void XMLCALL - xmlRegisterDefaultInputCallbacks (void); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlAllocParserInputBuffer (xmlCharEncoding enc); - -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFilename (const char *URI, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFile (FILE *file, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateFd (int fd, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateMem (const char *mem, int size, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateStatic (const char *mem, int size, - xmlCharEncoding enc); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlParserInputBufferCreateIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - xmlCharEncoding enc); -XMLPUBFUN int XMLCALL - xmlParserInputBufferRead (xmlParserInputBufferPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputBufferGrow (xmlParserInputBufferPtr in, - int len); -XMLPUBFUN int XMLCALL - xmlParserInputBufferPush (xmlParserInputBufferPtr in, - int len, - const char *buf); -XMLPUBFUN void XMLCALL - xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); -XMLPUBFUN char * XMLCALL - xmlParserGetDirectory (const char *filename); - -XMLPUBFUN int XMLCALL - xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, - xmlInputOpenCallback openFunc, - xmlInputReadCallback readFunc, - xmlInputCloseCallback closeFunc); - -xmlParserInputBufferPtr - __xmlParserInputBufferCreateFilename(const char *URI, - xmlCharEncoding enc); - -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlCheckHTTPInput (xmlParserCtxtPtr ctxt, - xmlParserInputPtr ret); - -/* - * A predefined entity loader disabling network accesses - */ -XMLPUBFUN xmlParserInputPtr XMLCALL - xmlNoNetExternalEntityLoader (const char *URL, - const char *ID, - xmlParserCtxtPtr ctxt); - -/* - * xmlNormalizeWindowsPath is obsolete, don't use it. - * Check xmlCanonicPath in uri.h for a better alternative. - */ -XMLPUBFUN xmlChar * XMLCALL - xmlNormalizeWindowsPath (const xmlChar *path); - -XMLPUBFUN int XMLCALL - xmlCheckFilename (const char *path); -/** - * Default 'file://' protocol callbacks - */ -XMLPUBFUN int XMLCALL - xmlFileMatch (const char *filename); -XMLPUBFUN void * XMLCALL - xmlFileOpen (const char *filename); -XMLPUBFUN int XMLCALL - xmlFileRead (void * context, - char * buffer, - int len); -XMLPUBFUN int XMLCALL - xmlFileClose (void * context); - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_IO_H__ */ diff --git a/deps/libxml2/libxml/xmlerror.h b/deps/libxml2/libxml/xmlerror.h deleted file mode 100644 index 1a232b4ea7..0000000000 --- a/deps/libxml2/libxml/xmlerror.h +++ /dev/null @@ -1,940 +0,0 @@ -/* - * Summary: error handling - * Description: the API used to report errors - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#include - -#ifndef __XML_ERROR_H__ -#define __XML_ERROR_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlErrorLevel: - * - * Indicates the level of an error - */ -typedef enum { - XML_ERR_NONE = 0, - XML_ERR_WARNING = 1, /* A simple warning */ - XML_ERR_ERROR = 2, /* A recoverable error */ - XML_ERR_FATAL = 3 /* A fatal error */ -} xmlErrorLevel; - -/** - * xmlErrorDomain: - * - * Indicates where an error may have come from - */ -typedef enum { - XML_FROM_NONE = 0, - XML_FROM_PARSER, /* The XML parser */ - XML_FROM_TREE, /* The tree module */ - XML_FROM_NAMESPACE, /* The XML Namespace module */ - XML_FROM_DTD, /* The XML DTD validation with parser context*/ - XML_FROM_HTML, /* The HTML parser */ - XML_FROM_MEMORY, /* The memory allocator */ - XML_FROM_OUTPUT, /* The serialization code */ - XML_FROM_IO, /* The Input/Output stack */ - XML_FROM_FTP, /* The FTP module */ - XML_FROM_HTTP, /* The HTTP module */ - XML_FROM_XINCLUDE, /* The XInclude processing */ - XML_FROM_XPATH, /* The XPath module */ - XML_FROM_XPOINTER, /* The XPointer module */ - XML_FROM_REGEXP, /* The regular expressions module */ - XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */ - XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */ - XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */ - XML_FROM_RELAXNGP, /* The Relax-NG parser module */ - XML_FROM_RELAXNGV, /* The Relax-NG validator module */ - XML_FROM_CATALOG, /* The Catalog module */ - XML_FROM_C14N, /* The Canonicalization module */ - XML_FROM_XSLT, /* The XSLT engine from libxslt */ - XML_FROM_VALID, /* The XML DTD validation with valid context */ - XML_FROM_CHECK, /* The error checking module */ - XML_FROM_WRITER, /* The xmlwriter module */ - XML_FROM_MODULE, /* The dynamically loaded module module*/ - XML_FROM_I18N, /* The module handling character conversion */ - XML_FROM_SCHEMATRONV /* The Schematron validator module */ -} xmlErrorDomain; - -/** - * xmlError: - * - * An XML Error instance. - */ - -typedef struct _xmlError xmlError; -typedef xmlError *xmlErrorPtr; -struct _xmlError { - int domain; /* What part of the library raised this error */ - int code; /* The error code, e.g. an xmlParserError */ - char *message;/* human-readable informative error message */ - xmlErrorLevel level;/* how consequent is the error */ - char *file; /* the filename */ - int line; /* the line number if available */ - char *str1; /* extra string information */ - char *str2; /* extra string information */ - char *str3; /* extra string information */ - int int1; /* extra number information */ - int int2; /* column number of the error or 0 if N/A (todo: rename this field when we would break ABI) */ - void *ctxt; /* the parser context if available */ - void *node; /* the node in the tree */ -}; - -/** - * xmlParserError: - * - * This is an error that the XML (or HTML) parser can generate - */ -typedef enum { - XML_ERR_OK = 0, - XML_ERR_INTERNAL_ERROR, /* 1 */ - XML_ERR_NO_MEMORY, /* 2 */ - XML_ERR_DOCUMENT_START, /* 3 */ - XML_ERR_DOCUMENT_EMPTY, /* 4 */ - XML_ERR_DOCUMENT_END, /* 5 */ - XML_ERR_INVALID_HEX_CHARREF, /* 6 */ - XML_ERR_INVALID_DEC_CHARREF, /* 7 */ - XML_ERR_INVALID_CHARREF, /* 8 */ - XML_ERR_INVALID_CHAR, /* 9 */ - XML_ERR_CHARREF_AT_EOF, /* 10 */ - XML_ERR_CHARREF_IN_PROLOG, /* 11 */ - XML_ERR_CHARREF_IN_EPILOG, /* 12 */ - XML_ERR_CHARREF_IN_DTD, /* 13 */ - XML_ERR_ENTITYREF_AT_EOF, /* 14 */ - XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */ - XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */ - XML_ERR_ENTITYREF_IN_DTD, /* 17 */ - XML_ERR_PEREF_AT_EOF, /* 18 */ - XML_ERR_PEREF_IN_PROLOG, /* 19 */ - XML_ERR_PEREF_IN_EPILOG, /* 20 */ - XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */ - XML_ERR_ENTITYREF_NO_NAME, /* 22 */ - XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */ - XML_ERR_PEREF_NO_NAME, /* 24 */ - XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */ - XML_ERR_UNDECLARED_ENTITY, /* 26 */ - XML_WAR_UNDECLARED_ENTITY, /* 27 */ - XML_ERR_UNPARSED_ENTITY, /* 28 */ - XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */ - XML_ERR_ENTITY_IS_PARAMETER, /* 30 */ - XML_ERR_UNKNOWN_ENCODING, /* 31 */ - XML_ERR_UNSUPPORTED_ENCODING, /* 32 */ - XML_ERR_STRING_NOT_STARTED, /* 33 */ - XML_ERR_STRING_NOT_CLOSED, /* 34 */ - XML_ERR_NS_DECL_ERROR, /* 35 */ - XML_ERR_ENTITY_NOT_STARTED, /* 36 */ - XML_ERR_ENTITY_NOT_FINISHED, /* 37 */ - XML_ERR_LT_IN_ATTRIBUTE, /* 38 */ - XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */ - XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */ - XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */ - XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */ - XML_ERR_LITERAL_NOT_STARTED, /* 43 */ - XML_ERR_LITERAL_NOT_FINISHED, /* 44 */ - XML_ERR_COMMENT_NOT_FINISHED, /* 45 */ - XML_ERR_PI_NOT_STARTED, /* 46 */ - XML_ERR_PI_NOT_FINISHED, /* 47 */ - XML_ERR_NOTATION_NOT_STARTED, /* 48 */ - XML_ERR_NOTATION_NOT_FINISHED, /* 49 */ - XML_ERR_ATTLIST_NOT_STARTED, /* 50 */ - XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */ - XML_ERR_MIXED_NOT_STARTED, /* 52 */ - XML_ERR_MIXED_NOT_FINISHED, /* 53 */ - XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */ - XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */ - XML_ERR_XMLDECL_NOT_STARTED, /* 56 */ - XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */ - XML_ERR_CONDSEC_NOT_STARTED, /* 58 */ - XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */ - XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */ - XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */ - XML_ERR_MISPLACED_CDATA_END, /* 62 */ - XML_ERR_CDATA_NOT_FINISHED, /* 63 */ - XML_ERR_RESERVED_XML_NAME, /* 64 */ - XML_ERR_SPACE_REQUIRED, /* 65 */ - XML_ERR_SEPARATOR_REQUIRED, /* 66 */ - XML_ERR_NMTOKEN_REQUIRED, /* 67 */ - XML_ERR_NAME_REQUIRED, /* 68 */ - XML_ERR_PCDATA_REQUIRED, /* 69 */ - XML_ERR_URI_REQUIRED, /* 70 */ - XML_ERR_PUBID_REQUIRED, /* 71 */ - XML_ERR_LT_REQUIRED, /* 72 */ - XML_ERR_GT_REQUIRED, /* 73 */ - XML_ERR_LTSLASH_REQUIRED, /* 74 */ - XML_ERR_EQUAL_REQUIRED, /* 75 */ - XML_ERR_TAG_NAME_MISMATCH, /* 76 */ - XML_ERR_TAG_NOT_FINISHED, /* 77 */ - XML_ERR_STANDALONE_VALUE, /* 78 */ - XML_ERR_ENCODING_NAME, /* 79 */ - XML_ERR_HYPHEN_IN_COMMENT, /* 80 */ - XML_ERR_INVALID_ENCODING, /* 81 */ - XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */ - XML_ERR_CONDSEC_INVALID, /* 83 */ - XML_ERR_VALUE_REQUIRED, /* 84 */ - XML_ERR_NOT_WELL_BALANCED, /* 85 */ - XML_ERR_EXTRA_CONTENT, /* 86 */ - XML_ERR_ENTITY_CHAR_ERROR, /* 87 */ - XML_ERR_ENTITY_PE_INTERNAL, /* 88 */ - XML_ERR_ENTITY_LOOP, /* 89 */ - XML_ERR_ENTITY_BOUNDARY, /* 90 */ - XML_ERR_INVALID_URI, /* 91 */ - XML_ERR_URI_FRAGMENT, /* 92 */ - XML_WAR_CATALOG_PI, /* 93 */ - XML_ERR_NO_DTD, /* 94 */ - XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */ - XML_ERR_VERSION_MISSING, /* 96 */ - XML_WAR_UNKNOWN_VERSION, /* 97 */ - XML_WAR_LANG_VALUE, /* 98 */ - XML_WAR_NS_URI, /* 99 */ - XML_WAR_NS_URI_RELATIVE, /* 100 */ - XML_ERR_MISSING_ENCODING, /* 101 */ - XML_WAR_SPACE_VALUE, /* 102 */ - XML_ERR_NOT_STANDALONE, /* 103 */ - XML_ERR_ENTITY_PROCESSING, /* 104 */ - XML_ERR_NOTATION_PROCESSING, /* 105 */ - XML_WAR_NS_COLUMN, /* 106 */ - XML_WAR_ENTITY_REDEFINED, /* 107 */ - XML_ERR_UNKNOWN_VERSION, /* 108 */ - XML_ERR_VERSION_MISMATCH, /* 109 */ - XML_NS_ERR_XML_NAMESPACE = 200, - XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ - XML_NS_ERR_QNAME, /* 202 */ - XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ - XML_NS_ERR_EMPTY, /* 204 */ - XML_NS_ERR_COLON, /* 205 */ - XML_DTD_ATTRIBUTE_DEFAULT = 500, - XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ - XML_DTD_ATTRIBUTE_VALUE, /* 502 */ - XML_DTD_CONTENT_ERROR, /* 503 */ - XML_DTD_CONTENT_MODEL, /* 504 */ - XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */ - XML_DTD_DIFFERENT_PREFIX, /* 506 */ - XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */ - XML_DTD_ELEM_NAMESPACE, /* 508 */ - XML_DTD_ELEM_REDEFINED, /* 509 */ - XML_DTD_EMPTY_NOTATION, /* 510 */ - XML_DTD_ENTITY_TYPE, /* 511 */ - XML_DTD_ID_FIXED, /* 512 */ - XML_DTD_ID_REDEFINED, /* 513 */ - XML_DTD_ID_SUBSET, /* 514 */ - XML_DTD_INVALID_CHILD, /* 515 */ - XML_DTD_INVALID_DEFAULT, /* 516 */ - XML_DTD_LOAD_ERROR, /* 517 */ - XML_DTD_MISSING_ATTRIBUTE, /* 518 */ - XML_DTD_MIXED_CORRUPT, /* 519 */ - XML_DTD_MULTIPLE_ID, /* 520 */ - XML_DTD_NO_DOC, /* 521 */ - XML_DTD_NO_DTD, /* 522 */ - XML_DTD_NO_ELEM_NAME, /* 523 */ - XML_DTD_NO_PREFIX, /* 524 */ - XML_DTD_NO_ROOT, /* 525 */ - XML_DTD_NOTATION_REDEFINED, /* 526 */ - XML_DTD_NOTATION_VALUE, /* 527 */ - XML_DTD_NOT_EMPTY, /* 528 */ - XML_DTD_NOT_PCDATA, /* 529 */ - XML_DTD_NOT_STANDALONE, /* 530 */ - XML_DTD_ROOT_NAME, /* 531 */ - XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */ - XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */ - XML_DTD_UNKNOWN_ELEM, /* 534 */ - XML_DTD_UNKNOWN_ENTITY, /* 535 */ - XML_DTD_UNKNOWN_ID, /* 536 */ - XML_DTD_UNKNOWN_NOTATION, /* 537 */ - XML_DTD_STANDALONE_DEFAULTED, /* 538 */ - XML_DTD_XMLID_VALUE, /* 539 */ - XML_DTD_XMLID_TYPE, /* 540 */ - XML_DTD_DUP_TOKEN, /* 541 */ - XML_HTML_STRUCURE_ERROR = 800, - XML_HTML_UNKNOWN_TAG, /* 801 */ - XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, - XML_RNGP_ATTR_CONFLICT, /* 1001 */ - XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */ - XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */ - XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */ - XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */ - XML_RNGP_CHOICE_CONTENT, /* 1006 */ - XML_RNGP_CHOICE_EMPTY, /* 1007 */ - XML_RNGP_CREATE_FAILURE, /* 1008 */ - XML_RNGP_DATA_CONTENT, /* 1009 */ - XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */ - XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */ - XML_RNGP_DEFINE_EMPTY, /* 1012 */ - XML_RNGP_DEFINE_MISSING, /* 1013 */ - XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */ - XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */ - XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */ - XML_RNGP_ELEMENT_EMPTY, /* 1017 */ - XML_RNGP_ELEMENT_CONTENT, /* 1018 */ - XML_RNGP_ELEMENT_NAME, /* 1019 */ - XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */ - XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */ - XML_RNGP_EMPTY, /* 1022 */ - XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */ - XML_RNGP_EMPTY_CONTENT, /* 1024 */ - XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */ - XML_RNGP_ERROR_TYPE_LIB, /* 1026 */ - XML_RNGP_EXCEPT_EMPTY, /* 1027 */ - XML_RNGP_EXCEPT_MISSING, /* 1028 */ - XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */ - XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */ - XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */ - XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */ - XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */ - XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */ - XML_RNGP_FOREIGN_ELEMENT, /* 1035 */ - XML_RNGP_GRAMMAR_CONTENT, /* 1036 */ - XML_RNGP_GRAMMAR_EMPTY, /* 1037 */ - XML_RNGP_GRAMMAR_MISSING, /* 1038 */ - XML_RNGP_GRAMMAR_NO_START, /* 1039 */ - XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */ - XML_RNGP_HREF_ERROR, /* 1041 */ - XML_RNGP_INCLUDE_EMPTY, /* 1042 */ - XML_RNGP_INCLUDE_FAILURE, /* 1043 */ - XML_RNGP_INCLUDE_RECURSE, /* 1044 */ - XML_RNGP_INTERLEAVE_ADD, /* 1045 */ - XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */ - XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */ - XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */ - XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */ - XML_RNGP_INVALID_URI, /* 1050 */ - XML_RNGP_INVALID_VALUE, /* 1051 */ - XML_RNGP_MISSING_HREF, /* 1052 */ - XML_RNGP_NAME_MISSING, /* 1053 */ - XML_RNGP_NEED_COMBINE, /* 1054 */ - XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */ - XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */ - XML_RNGP_NSNAME_NO_NS, /* 1057 */ - XML_RNGP_PARAM_FORBIDDEN, /* 1058 */ - XML_RNGP_PARAM_NAME_MISSING, /* 1059 */ - XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */ - XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */ - XML_RNGP_PARENTREF_NO_NAME, /* 1062 */ - XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */ - XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */ - XML_RNGP_PARSE_ERROR, /* 1065 */ - XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */ - XML_RNGP_PAT_ATTR_ATTR, /* 1067 */ - XML_RNGP_PAT_ATTR_ELEM, /* 1068 */ - XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */ - XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */ - XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */ - XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */ - XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */ - XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */ - XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */ - XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */ - XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */ - XML_RNGP_PAT_LIST_ATTR, /* 1078 */ - XML_RNGP_PAT_LIST_ELEM, /* 1079 */ - XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */ - XML_RNGP_PAT_LIST_LIST, /* 1081 */ - XML_RNGP_PAT_LIST_REF, /* 1082 */ - XML_RNGP_PAT_LIST_TEXT, /* 1083 */ - XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */ - XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */ - XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */ - XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */ - XML_RNGP_PAT_START_ATTR, /* 1088 */ - XML_RNGP_PAT_START_DATA, /* 1089 */ - XML_RNGP_PAT_START_EMPTY, /* 1090 */ - XML_RNGP_PAT_START_GROUP, /* 1091 */ - XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */ - XML_RNGP_PAT_START_LIST, /* 1093 */ - XML_RNGP_PAT_START_ONEMORE, /* 1094 */ - XML_RNGP_PAT_START_TEXT, /* 1095 */ - XML_RNGP_PAT_START_VALUE, /* 1096 */ - XML_RNGP_PREFIX_UNDEFINED, /* 1097 */ - XML_RNGP_REF_CREATE_FAILED, /* 1098 */ - XML_RNGP_REF_CYCLE, /* 1099 */ - XML_RNGP_REF_NAME_INVALID, /* 1100 */ - XML_RNGP_REF_NO_DEF, /* 1101 */ - XML_RNGP_REF_NO_NAME, /* 1102 */ - XML_RNGP_REF_NOT_EMPTY, /* 1103 */ - XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */ - XML_RNGP_START_CONTENT, /* 1105 */ - XML_RNGP_START_EMPTY, /* 1106 */ - XML_RNGP_START_MISSING, /* 1107 */ - XML_RNGP_TEXT_EXPECTED, /* 1108 */ - XML_RNGP_TEXT_HAS_CHILD, /* 1109 */ - XML_RNGP_TYPE_MISSING, /* 1110 */ - XML_RNGP_TYPE_NOT_FOUND, /* 1111 */ - XML_RNGP_TYPE_VALUE, /* 1112 */ - XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */ - XML_RNGP_UNKNOWN_COMBINE, /* 1114 */ - XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */ - XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */ - XML_RNGP_URI_FRAGMENT, /* 1117 */ - XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */ - XML_RNGP_VALUE_EMPTY, /* 1119 */ - XML_RNGP_VALUE_NO_CONTENT, /* 1120 */ - XML_RNGP_XMLNS_NAME, /* 1121 */ - XML_RNGP_XML_NS, /* 1122 */ - XML_XPATH_EXPRESSION_OK = 1200, - XML_XPATH_NUMBER_ERROR, /* 1201 */ - XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */ - XML_XPATH_START_LITERAL_ERROR, /* 1203 */ - XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */ - XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */ - XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */ - XML_XPATH_EXPR_ERROR, /* 1207 */ - XML_XPATH_UNCLOSED_ERROR, /* 1208 */ - XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */ - XML_XPATH_INVALID_OPERAND, /* 1210 */ - XML_XPATH_INVALID_TYPE, /* 1211 */ - XML_XPATH_INVALID_ARITY, /* 1212 */ - XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */ - XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */ - XML_XPATH_MEMORY_ERROR, /* 1215 */ - XML_XPTR_SYNTAX_ERROR, /* 1216 */ - XML_XPTR_RESOURCE_ERROR, /* 1217 */ - XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */ - XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */ - XML_XPATH_ENCODING_ERROR, /* 1220 */ - XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */ - XML_TREE_INVALID_HEX = 1300, - XML_TREE_INVALID_DEC, /* 1301 */ - XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ - XML_TREE_NOT_UTF8, /* 1303 */ - XML_SAVE_NOT_UTF8 = 1400, - XML_SAVE_CHAR_INVALID, /* 1401 */ - XML_SAVE_NO_DOCTYPE, /* 1402 */ - XML_SAVE_UNKNOWN_ENCODING, /* 1403 */ - XML_REGEXP_COMPILE_ERROR = 1450, - XML_IO_UNKNOWN = 1500, - XML_IO_EACCES, /* 1501 */ - XML_IO_EAGAIN, /* 1502 */ - XML_IO_EBADF, /* 1503 */ - XML_IO_EBADMSG, /* 1504 */ - XML_IO_EBUSY, /* 1505 */ - XML_IO_ECANCELED, /* 1506 */ - XML_IO_ECHILD, /* 1507 */ - XML_IO_EDEADLK, /* 1508 */ - XML_IO_EDOM, /* 1509 */ - XML_IO_EEXIST, /* 1510 */ - XML_IO_EFAULT, /* 1511 */ - XML_IO_EFBIG, /* 1512 */ - XML_IO_EINPROGRESS, /* 1513 */ - XML_IO_EINTR, /* 1514 */ - XML_IO_EINVAL, /* 1515 */ - XML_IO_EIO, /* 1516 */ - XML_IO_EISDIR, /* 1517 */ - XML_IO_EMFILE, /* 1518 */ - XML_IO_EMLINK, /* 1519 */ - XML_IO_EMSGSIZE, /* 1520 */ - XML_IO_ENAMETOOLONG, /* 1521 */ - XML_IO_ENFILE, /* 1522 */ - XML_IO_ENODEV, /* 1523 */ - XML_IO_ENOENT, /* 1524 */ - XML_IO_ENOEXEC, /* 1525 */ - XML_IO_ENOLCK, /* 1526 */ - XML_IO_ENOMEM, /* 1527 */ - XML_IO_ENOSPC, /* 1528 */ - XML_IO_ENOSYS, /* 1529 */ - XML_IO_ENOTDIR, /* 1530 */ - XML_IO_ENOTEMPTY, /* 1531 */ - XML_IO_ENOTSUP, /* 1532 */ - XML_IO_ENOTTY, /* 1533 */ - XML_IO_ENXIO, /* 1534 */ - XML_IO_EPERM, /* 1535 */ - XML_IO_EPIPE, /* 1536 */ - XML_IO_ERANGE, /* 1537 */ - XML_IO_EROFS, /* 1538 */ - XML_IO_ESPIPE, /* 1539 */ - XML_IO_ESRCH, /* 1540 */ - XML_IO_ETIMEDOUT, /* 1541 */ - XML_IO_EXDEV, /* 1542 */ - XML_IO_NETWORK_ATTEMPT, /* 1543 */ - XML_IO_ENCODER, /* 1544 */ - XML_IO_FLUSH, /* 1545 */ - XML_IO_WRITE, /* 1546 */ - XML_IO_NO_INPUT, /* 1547 */ - XML_IO_BUFFER_FULL, /* 1548 */ - XML_IO_LOAD_ERROR, /* 1549 */ - XML_IO_ENOTSOCK, /* 1550 */ - XML_IO_EISCONN, /* 1551 */ - XML_IO_ECONNREFUSED, /* 1552 */ - XML_IO_ENETUNREACH, /* 1553 */ - XML_IO_EADDRINUSE, /* 1554 */ - XML_IO_EALREADY, /* 1555 */ - XML_IO_EAFNOSUPPORT, /* 1556 */ - XML_XINCLUDE_RECURSION=1600, - XML_XINCLUDE_PARSE_VALUE, /* 1601 */ - XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */ - XML_XINCLUDE_NO_HREF, /* 1603 */ - XML_XINCLUDE_NO_FALLBACK, /* 1604 */ - XML_XINCLUDE_HREF_URI, /* 1605 */ - XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */ - XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */ - XML_XINCLUDE_INVALID_CHAR, /* 1608 */ - XML_XINCLUDE_BUILD_FAILED, /* 1609 */ - XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */ - XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */ - XML_XINCLUDE_XPTR_FAILED, /* 1612 */ - XML_XINCLUDE_XPTR_RESULT, /* 1613 */ - XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */ - XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */ - XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */ - XML_XINCLUDE_DEPRECATED_NS, /* 1617 */ - XML_XINCLUDE_FRAGMENT_ID, /* 1618 */ - XML_CATALOG_MISSING_ATTR = 1650, - XML_CATALOG_ENTRY_BROKEN, /* 1651 */ - XML_CATALOG_PREFER_VALUE, /* 1652 */ - XML_CATALOG_NOT_CATALOG, /* 1653 */ - XML_CATALOG_RECURSION, /* 1654 */ - XML_SCHEMAP_PREFIX_UNDEFINED = 1700, - XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */ - XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */ - XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */ - XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */ - XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */ - XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */ - XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */ - XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */ - XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */ - XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */ - XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */ - XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */ - XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */ - XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */ - XML_SCHEMAP_INVALID_ENUM, /* 1715 */ - XML_SCHEMAP_INVALID_FACET, /* 1716 */ - XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */ - XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */ - XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */ - XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */ - XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */ - XML_SCHEMAP_NOATTR_NOREF, /* 1722 */ - XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */ - XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */ - XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */ - XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */ - XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */ - XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */ - XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */ - XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */ - XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */ - XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */ - XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */ - XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */ - XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */ - XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */ - XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */ - XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */ - XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */ - XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */ - XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */ - XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */ - XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */ - XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */ - XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */ - XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */ - XML_SCHEMAP_UNKNOWN_REF, /* 1747 */ - XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */ - XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */ - XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */ - XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */ - XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */ - XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */ - XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */ - XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */ - XML_SCHEMAP_REGEXP_INVALID, /* 1756 */ - XML_SCHEMAP_FAILED_LOAD, /* 1757 */ - XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */ - XML_SCHEMAP_NOROOT, /* 1759 */ - XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */ - XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */ - XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */ - XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */ - XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */ - XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */ - XML_SCHEMAP_FAILED_PARSE, /* 1766 */ - XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */ - XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */ - XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */ - XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */ - XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */ - XML_SCHEMAP_NOT_SCHEMA, /* 1772 */ - XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */ - XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */ - XML_SCHEMAP_RECURSIVE, /* 1775 */ - XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */ - XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */ - XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */ - XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */ - XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */ - XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */ - XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */ - XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */ - XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */ - XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */ - XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */ - XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */ - XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */ - XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */ - XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */ - XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */ - XML_SCHEMAV_NOROOT = 1801, - XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */ - XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */ - XML_SCHEMAV_MISSING, /* 1804 */ - XML_SCHEMAV_WRONGELEM, /* 1805 */ - XML_SCHEMAV_NOTYPE, /* 1806 */ - XML_SCHEMAV_NOROLLBACK, /* 1807 */ - XML_SCHEMAV_ISABSTRACT, /* 1808 */ - XML_SCHEMAV_NOTEMPTY, /* 1809 */ - XML_SCHEMAV_ELEMCONT, /* 1810 */ - XML_SCHEMAV_HAVEDEFAULT, /* 1811 */ - XML_SCHEMAV_NOTNILLABLE, /* 1812 */ - XML_SCHEMAV_EXTRACONTENT, /* 1813 */ - XML_SCHEMAV_INVALIDATTR, /* 1814 */ - XML_SCHEMAV_INVALIDELEM, /* 1815 */ - XML_SCHEMAV_NOTDETERMINIST, /* 1816 */ - XML_SCHEMAV_CONSTRUCT, /* 1817 */ - XML_SCHEMAV_INTERNAL, /* 1818 */ - XML_SCHEMAV_NOTSIMPLE, /* 1819 */ - XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */ - XML_SCHEMAV_ATTRINVALID, /* 1821 */ - XML_SCHEMAV_VALUE, /* 1822 */ - XML_SCHEMAV_FACET, /* 1823 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */ - XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */ - XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */ - XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */ - XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */ - XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */ - XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */ - XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */ - XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */ - XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */ - XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */ - XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */ - XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */ - XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */ - XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */ - XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */ - XML_SCHEMAV_CVC_ELT_1, /* 1845 */ - XML_SCHEMAV_CVC_ELT_2, /* 1846 */ - XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */ - XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */ - XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */ - XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */ - XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */ - XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */ - XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */ - XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */ - XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */ - XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */ - XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */ - XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */ - XML_SCHEMAV_CVC_ELT_6, /* 1859 */ - XML_SCHEMAV_CVC_ELT_7, /* 1860 */ - XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */ - XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */ - XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */ - XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */ - XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */ - XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */ - XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */ - XML_SCHEMAV_CVC_AU, /* 1874 */ - XML_SCHEMAV_CVC_TYPE_1, /* 1875 */ - XML_SCHEMAV_CVC_TYPE_2, /* 1876 */ - XML_SCHEMAV_CVC_IDC, /* 1877 */ - XML_SCHEMAV_CVC_WILDCARD, /* 1878 */ - XML_SCHEMAV_MISC, /* 1879 */ - XML_XPTR_UNKNOWN_SCHEME = 1900, - XML_XPTR_CHILDSEQ_START, /* 1901 */ - XML_XPTR_EVAL_FAILED, /* 1902 */ - XML_XPTR_EXTRA_OBJECTS, /* 1903 */ - XML_C14N_CREATE_CTXT = 1950, - XML_C14N_REQUIRES_UTF8, /* 1951 */ - XML_C14N_CREATE_STACK, /* 1952 */ - XML_C14N_INVALID_NODE, /* 1953 */ - XML_C14N_UNKNOW_NODE, /* 1954 */ - XML_C14N_RELATIVE_NAMESPACE, /* 1955 */ - XML_FTP_PASV_ANSWER = 2000, - XML_FTP_EPSV_ANSWER, /* 2001 */ - XML_FTP_ACCNT, /* 2002 */ - XML_FTP_URL_SYNTAX, /* 2003 */ - XML_HTTP_URL_SYNTAX = 2020, - XML_HTTP_USE_IP, /* 2021 */ - XML_HTTP_UNKNOWN_HOST, /* 2022 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000, - XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */ - XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */ - XML_SCHEMAP_SRC_RESOLVE, /* 3004 */ - XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */ - XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */ - XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */ - XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */ - XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */ - XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */ - XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */ - XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */ - XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */ - XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */ - XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */ - XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */ - XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */ - XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */ - XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */ - XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */ - XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */ - XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */ - XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */ - XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */ - XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */ - XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */ - XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */ - XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */ - XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */ - XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */ - XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */ - XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */ - XML_SCHEMAP_SRC_INCLUDE, /* 3050 */ - XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */ - XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */ - XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */ - XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */ - XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */ - XML_SCHEMAP_NO_XMLNS, /* 3056 */ - XML_SCHEMAP_NO_XSI, /* 3057 */ - XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */ - XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */ - XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */ - XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */ - XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */ - XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */ - XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */ - XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */ - XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */ - XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */ - XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */ - XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */ - XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */ - XML_SCHEMAP_SRC_CT_1, /* 3076 */ - XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */ - XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */ - XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */ - XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */ - XML_SCHEMAP_SRC_REDEFINE, /* 3081 */ - XML_SCHEMAP_SRC_IMPORT, /* 3082 */ - XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */ - XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */ - XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */ - XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */ - XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */ - XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */ - XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ - XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ - XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ - XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ - XML_SCHEMATRONV_REPORT, - XML_MODULE_OPEN = 4900, /* 4900 */ - XML_MODULE_CLOSE, /* 4901 */ - XML_CHECK_FOUND_ELEMENT = 5000, - XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */ - XML_CHECK_FOUND_TEXT, /* 5002 */ - XML_CHECK_FOUND_CDATA, /* 5003 */ - XML_CHECK_FOUND_ENTITYREF, /* 5004 */ - XML_CHECK_FOUND_ENTITY, /* 5005 */ - XML_CHECK_FOUND_PI, /* 5006 */ - XML_CHECK_FOUND_COMMENT, /* 5007 */ - XML_CHECK_FOUND_DOCTYPE, /* 5008 */ - XML_CHECK_FOUND_FRAGMENT, /* 5009 */ - XML_CHECK_FOUND_NOTATION, /* 5010 */ - XML_CHECK_UNKNOWN_NODE, /* 5011 */ - XML_CHECK_ENTITY_TYPE, /* 5012 */ - XML_CHECK_NO_PARENT, /* 5013 */ - XML_CHECK_NO_DOC, /* 5014 */ - XML_CHECK_NO_NAME, /* 5015 */ - XML_CHECK_NO_ELEM, /* 5016 */ - XML_CHECK_WRONG_DOC, /* 5017 */ - XML_CHECK_NO_PREV, /* 5018 */ - XML_CHECK_WRONG_PREV, /* 5019 */ - XML_CHECK_NO_NEXT, /* 5020 */ - XML_CHECK_WRONG_NEXT, /* 5021 */ - XML_CHECK_NOT_DTD, /* 5022 */ - XML_CHECK_NOT_ATTR, /* 5023 */ - XML_CHECK_NOT_ATTR_DECL, /* 5024 */ - XML_CHECK_NOT_ELEM_DECL, /* 5025 */ - XML_CHECK_NOT_ENTITY_DECL, /* 5026 */ - XML_CHECK_NOT_NS_DECL, /* 5027 */ - XML_CHECK_NO_HREF, /* 5028 */ - XML_CHECK_WRONG_PARENT,/* 5029 */ - XML_CHECK_NS_SCOPE, /* 5030 */ - XML_CHECK_NS_ANCESTOR, /* 5031 */ - XML_CHECK_NOT_UTF8, /* 5032 */ - XML_CHECK_NO_DICT, /* 5033 */ - XML_CHECK_NOT_NCNAME, /* 5034 */ - XML_CHECK_OUTSIDE_DICT, /* 5035 */ - XML_CHECK_WRONG_NAME, /* 5036 */ - XML_CHECK_NAME_NOT_NULL, /* 5037 */ - XML_I18N_NO_NAME = 6000, - XML_I18N_NO_HANDLER, /* 6001 */ - XML_I18N_EXCESS_HANDLER, /* 6002 */ - XML_I18N_CONV_FAILED, /* 6003 */ - XML_I18N_NO_OUTPUT /* 6004 */ -} xmlParserErrors; - -/** - * xmlGenericErrorFunc: - * @ctx: a parsing context - * @msg: the message - * @...: the extra arguments of the varags to format the message - * - * Signature of the function to use when there is an error and - * no parsing or validity context available . - */ -typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -/** - * xmlStructuredErrorFunc: - * @userData: user provided data for the error callback - * @error: the error being raised. - * - * Signature of the function to use when there is an error and - * the module handles the new error reporting mechanism. - */ -typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); - -/* - * Use the following function to reset the two global variables - * xmlGenericError and xmlGenericErrorContext. - */ -XMLPUBFUN void XMLCALL - xmlSetGenericErrorFunc (void *ctx, - xmlGenericErrorFunc handler); -XMLPUBFUN void XMLCALL - initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); - -XMLPUBFUN void XMLCALL - xmlSetStructuredErrorFunc (void *ctx, - xmlStructuredErrorFunc handler); -/* - * Default message routines used by SAX and Valid context for error - * and warning reporting. - */ -XMLPUBFUN void XMLCDECL - xmlParserError (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -XMLPUBFUN void XMLCDECL - xmlParserWarning (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -XMLPUBFUN void XMLCDECL - xmlParserValidityError (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -XMLPUBFUN void XMLCDECL - xmlParserValidityWarning (void *ctx, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); -XMLPUBFUN void XMLCALL - xmlParserPrintFileInfo (xmlParserInputPtr input); -XMLPUBFUN void XMLCALL - xmlParserPrintFileContext (xmlParserInputPtr input); - -/* - * Extended error information routines - */ -XMLPUBFUN xmlErrorPtr XMLCALL - xmlGetLastError (void); -XMLPUBFUN void XMLCALL - xmlResetLastError (void); -XMLPUBFUN xmlErrorPtr XMLCALL - xmlCtxtGetLastError (void *ctx); -XMLPUBFUN void XMLCALL - xmlCtxtResetLastError (void *ctx); -XMLPUBFUN void XMLCALL - xmlResetError (xmlErrorPtr err); -XMLPUBFUN int XMLCALL - xmlCopyError (xmlErrorPtr from, - xmlErrorPtr to); - -#ifdef IN_LIBXML -/* - * Internal callback reporting routine - */ -XMLPUBFUN void XMLCALL - __xmlRaiseError (xmlStructuredErrorFunc schannel, - xmlGenericErrorFunc channel, - void *data, - void *ctx, - void *node, - int domain, - int code, - xmlErrorLevel level, - const char *file, - int line, - const char *str1, - const char *str2, - const char *str3, - int int1, - int col, - const char *msg, - ...) LIBXML_ATTR_FORMAT(16,17); -XMLPUBFUN void XMLCALL - __xmlSimpleError (int domain, - int code, - xmlNodePtr node, - const char *msg, - const char *extra); -#endif -#ifdef __cplusplus -} -#endif -#endif /* __XML_ERROR_H__ */ diff --git a/deps/libxml2/libxml/xmlexports.h b/deps/libxml2/libxml/xmlexports.h deleted file mode 100644 index 9c6790c80f..0000000000 --- a/deps/libxml2/libxml/xmlexports.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Summary: macros for marking symbols as exportable/importable. - * Description: macros for marking symbols as exportable/importable. - * - * Copy: See Copyright for the status of this software. - * - * Author: Igor Zlatovic - */ - -#ifndef __XML_EXPORTS_H__ -#define __XML_EXPORTS_H__ - -/** - * XMLPUBFUN, XMLPUBVAR, XMLCALL - * - * Macros which declare an exportable function, an exportable variable and - * the calling convention used for functions. - * - * Please use an extra block for every platform/compiler combination when - * modifying this, rather than overlong #ifdef lines. This helps - * readability as well as the fact that different compilers on the same - * platform might need different definitions. - */ - -/** - * XMLPUBFUN: - * - * Macros which declare an exportable function - */ -#define XMLPUBFUN -/** - * XMLPUBVAR: - * - * Macros which declare an exportable variable - */ -#define XMLPUBVAR extern -/** - * XMLCALL: - * - * Macros which declare the called convention for exported functions - */ -#define XMLCALL -/** - * XMLCDECL: - * - * Macro which declares the calling convention for exported functions that - * use '...'. - */ -#define XMLCDECL - -/** DOC_DISABLE */ - -/* Windows platform with MS compiler */ -#if defined(_WIN32) && defined(_MSC_VER) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #if defined(LIBXML_FASTCALL) - #define XMLCALL __fastcall - #else - #define XMLCALL __cdecl - #endif - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Windows platform with Borland compiler */ -#if defined(_WIN32) && defined(__BORLANDC__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) extern - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Windows platform with GNU compiler (Mingw) */ -#if defined(_WIN32) && defined(__MINGW32__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - /* - * if defined(IN_LIBXML) this raises problems on mingw with msys - * _imp__xmlFree listed as missing. Try to workaround the problem - * by also making that declaration when compiling client code. - */ - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR extern - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Cygwin platform, GNU compiler */ -#if defined(_WIN32) && defined(__CYGWIN__) - #undef XMLPUBFUN - #undef XMLPUBVAR - #undef XMLCALL - #undef XMLCDECL - #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) - #define XMLPUBFUN __declspec(dllexport) - #define XMLPUBVAR __declspec(dllexport) - #else - #define XMLPUBFUN - #if !defined(LIBXML_STATIC) - #define XMLPUBVAR __declspec(dllimport) extern - #else - #define XMLPUBVAR - #endif - #endif - #define XMLCALL __cdecl - #define XMLCDECL __cdecl -#endif - -/* Compatibility */ -#if !defined(LIBXML_DLL_IMPORT) -#define LIBXML_DLL_IMPORT XMLPUBVAR -#endif - -#endif /* __XML_EXPORTS_H__ */ - - diff --git a/deps/libxml2/libxml/xmlmemory.h b/deps/libxml2/libxml/xmlmemory.h deleted file mode 100644 index b97db1ffe9..0000000000 --- a/deps/libxml2/libxml/xmlmemory.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Summary: interface for the memory allocator - * Description: provides interfaces for the memory allocator, - * including debugging capabilities. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - - -#ifndef __DEBUG_MEMORY_ALLOC__ -#define __DEBUG_MEMORY_ALLOC__ - -#include -#include - -/** - * DEBUG_MEMORY: - * - * DEBUG_MEMORY replaces the allocator with a collect and debug - * shell to the libc allocator. - * DEBUG_MEMORY should only be activated when debugging - * libxml i.e. if libxml has been configured with --with-debug-mem too. - */ -/* #define DEBUG_MEMORY_FREED */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The XML memory wrapper support 4 basic overloadable functions. - */ -/** - * xmlFreeFunc: - * @mem: an already allocated block of memory - * - * Signature for a free() implementation. - */ -typedef void (XMLCALL *xmlFreeFunc)(void *mem); -/** - * xmlMallocFunc: - * @size: the size requested in bytes - * - * Signature for a malloc() implementation. - * - * Returns a pointer to the newly allocated block or NULL in case of error. - */ -typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size); - -/** - * xmlReallocFunc: - * @mem: an already allocated block of memory - * @size: the new size requested in bytes - * - * Signature for a realloc() implementation. - * - * Returns a pointer to the newly reallocated block or NULL in case of error. - */ -typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size); - -/** - * xmlStrdupFunc: - * @str: a zero terminated string - * - * Signature for an strdup() implementation. - * - * Returns the copy of the string or NULL in case of error. - */ -typedef char *(XMLCALL *xmlStrdupFunc)(const char *str); - -/* - * The 4 interfaces used for all memory handling within libxml. -LIBXML_DLL_IMPORT xmlFreeFunc xmlFree; -LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc; -LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic; -LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc; -LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup; - */ - -/* - * The way to overload the existing functions. - * The xmlGc function have an extra entry for atomic block - * allocations useful for garbage collected memory allocators - */ -XMLPUBFUN int XMLCALL - xmlMemSetup (xmlFreeFunc freeFunc, - xmlMallocFunc mallocFunc, - xmlReallocFunc reallocFunc, - xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL - xmlMemGet (xmlFreeFunc *freeFunc, - xmlMallocFunc *mallocFunc, - xmlReallocFunc *reallocFunc, - xmlStrdupFunc *strdupFunc); -XMLPUBFUN int XMLCALL - xmlGcMemSetup (xmlFreeFunc freeFunc, - xmlMallocFunc mallocFunc, - xmlMallocFunc mallocAtomicFunc, - xmlReallocFunc reallocFunc, - xmlStrdupFunc strdupFunc); -XMLPUBFUN int XMLCALL - xmlGcMemGet (xmlFreeFunc *freeFunc, - xmlMallocFunc *mallocFunc, - xmlMallocFunc *mallocAtomicFunc, - xmlReallocFunc *reallocFunc, - xmlStrdupFunc *strdupFunc); - -/* - * Initialization of the memory layer. - */ -XMLPUBFUN int XMLCALL - xmlInitMemory (void); - -/* - * Cleanup of the memory layer. - */ -XMLPUBFUN void XMLCALL - xmlCleanupMemory (void); -/* - * These are specific to the XML debug memory wrapper. - */ -XMLPUBFUN int XMLCALL - xmlMemUsed (void); -XMLPUBFUN int XMLCALL - xmlMemBlocks (void); -XMLPUBFUN void XMLCALL - xmlMemDisplay (FILE *fp); -XMLPUBFUN void XMLCALL - xmlMemDisplayLast(FILE *fp, long nbBytes); -XMLPUBFUN void XMLCALL - xmlMemShow (FILE *fp, int nr); -XMLPUBFUN void XMLCALL - xmlMemoryDump (void); -XMLPUBFUN void * XMLCALL - xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); -XMLPUBFUN void * XMLCALL - xmlMemRealloc (void *ptr,size_t size); -XMLPUBFUN void XMLCALL - xmlMemFree (void *ptr); -XMLPUBFUN char * XMLCALL - xmlMemoryStrdup (const char *str); -XMLPUBFUN void * XMLCALL - xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); -XMLPUBFUN void * XMLCALL - xmlReallocLoc (void *ptr, size_t size, const char *file, int line); -XMLPUBFUN void * XMLCALL - xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); -XMLPUBFUN char * XMLCALL - xmlMemStrdupLoc (const char *str, const char *file, int line); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#ifndef __XML_GLOBALS_H -#ifndef __XML_THREADS_H__ -#include -#include -#endif -#endif - -#endif /* __DEBUG_MEMORY_ALLOC__ */ - diff --git a/deps/libxml2/libxml/xmlreader.h b/deps/libxml2/libxml/xmlreader.h deleted file mode 100644 index febcf4fa43..0000000000 --- a/deps/libxml2/libxml/xmlreader.h +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Summary: the XMLReader implementation - * Description: API of the XML streaming API based on C# interfaces. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XMLREADER_H__ -#define __XML_XMLREADER_H__ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlParserSeverities: - * - * How severe an error callback is when the per-reader error callback API - * is used. - */ -typedef enum { - XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, - XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, - XML_PARSER_SEVERITY_WARNING = 3, - XML_PARSER_SEVERITY_ERROR = 4 -} xmlParserSeverities; - -#ifdef LIBXML_READER_ENABLED - -/** - * xmlTextReaderMode: - * - * Internal state values for the reader. - */ -typedef enum { - XML_TEXTREADER_MODE_INITIAL = 0, - XML_TEXTREADER_MODE_INTERACTIVE = 1, - XML_TEXTREADER_MODE_ERROR = 2, - XML_TEXTREADER_MODE_EOF =3, - XML_TEXTREADER_MODE_CLOSED = 4, - XML_TEXTREADER_MODE_READING = 5 -} xmlTextReaderMode; - -/** - * xmlParserProperties: - * - * Some common options to use with xmlTextReaderSetParserProp, but it - * is better to use xmlParserOption and the xmlReaderNewxxx and - * xmlReaderForxxx APIs now. - */ -typedef enum { - XML_PARSER_LOADDTD = 1, - XML_PARSER_DEFAULTATTRS = 2, - XML_PARSER_VALIDATE = 3, - XML_PARSER_SUBST_ENTITIES = 4 -} xmlParserProperties; - -/** - * xmlReaderTypes: - * - * Predefined constants for the different types of nodes. - */ -typedef enum { - XML_READER_TYPE_NONE = 0, - XML_READER_TYPE_ELEMENT = 1, - XML_READER_TYPE_ATTRIBUTE = 2, - XML_READER_TYPE_TEXT = 3, - XML_READER_TYPE_CDATA = 4, - XML_READER_TYPE_ENTITY_REFERENCE = 5, - XML_READER_TYPE_ENTITY = 6, - XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, - XML_READER_TYPE_COMMENT = 8, - XML_READER_TYPE_DOCUMENT = 9, - XML_READER_TYPE_DOCUMENT_TYPE = 10, - XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, - XML_READER_TYPE_NOTATION = 12, - XML_READER_TYPE_WHITESPACE = 13, - XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, - XML_READER_TYPE_END_ELEMENT = 15, - XML_READER_TYPE_END_ENTITY = 16, - XML_READER_TYPE_XML_DECLARATION = 17 -} xmlReaderTypes; - -/** - * xmlTextReader: - * - * Structure for an xmlReader context. - */ -typedef struct _xmlTextReader xmlTextReader; - -/** - * xmlTextReaderPtr: - * - * Pointer to an xmlReader context. - */ -typedef xmlTextReader *xmlTextReaderPtr; - -/* - * Constructors & Destructor - */ -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlNewTextReader (xmlParserInputBufferPtr input, - const char *URI); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlNewTextReaderFilename(const char *URI); - -XMLPUBFUN void XMLCALL - xmlFreeTextReader (xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderSetup(xmlTextReaderPtr reader, - xmlParserInputBufferPtr input, const char *URL, - const char *encoding, int options); - -/* - * Iterators - */ -XMLPUBFUN int XMLCALL - xmlTextReaderRead (xmlTextReaderPtr reader); - -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderReadString (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderReadAttributeValue (xmlTextReaderPtr reader); - -/* - * Attributes of the node - */ -XMLPUBFUN int XMLCALL - xmlTextReaderAttributeCount(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderDepth (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderHasAttributes(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderHasValue(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsDefault (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNodeType (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderQuoteChar (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderReadState (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); - -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstLocalName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstName (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstPrefix (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstString (xmlTextReaderPtr reader, - const xmlChar *str); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstValue (xmlTextReaderPtr reader); - -/* - * use the Const version of the routine for - * better performance and simpler code - */ -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderBaseUri (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLocalName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderName (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderPrefix (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderXmlLang (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderValue (xmlTextReaderPtr reader); - -/* - * Methods of the XmlTextReader - */ -XMLPUBFUN int XMLCALL - xmlTextReaderClose (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, - int no); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttribute (xmlTextReaderPtr reader, - const xmlChar *name); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, - const xmlChar *localName, - const xmlChar *namespaceURI); -XMLPUBFUN xmlParserInputBufferPtr XMLCALL - xmlTextReaderGetRemainder (xmlTextReaderPtr reader); -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, - const xmlChar *prefix); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, - int no); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, - const xmlChar *name); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, - const xmlChar *localName, - const xmlChar *namespaceURI); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderMoveToElement (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNormalization (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstEncoding (xmlTextReaderPtr reader); - -/* - * Extensions - */ -XMLPUBFUN int XMLCALL - xmlTextReaderSetParserProp (xmlTextReaderPtr reader, - int prop, - int value); -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserProp (xmlTextReaderPtr reader, - int prop); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderCurrentNode (xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); - -XMLPUBFUN int XMLCALL - xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); - -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderPreserve (xmlTextReaderPtr reader); -XMLPUBFUN xmlDocPtr XMLCALL - xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); -XMLPUBFUN xmlNodePtr XMLCALL - xmlTextReaderExpand (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNext (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderNextSibling (xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderIsValid (xmlTextReaderPtr reader); -XMLPUBFUN const xmlChar * XMLCALL - xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); -XMLPUBFUN int XMLCALL - xmlTextReaderStandalone (xmlTextReaderPtr reader); - - -/* - * Index lookup - */ -XMLPUBFUN long XMLCALL - xmlTextReaderByteConsumed (xmlTextReaderPtr reader); - -/* - * New more complete APIs for simpler creation and reuse of readers - */ -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderWalker (xmlDocPtr doc); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForDoc (const xmlChar * cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForFile (const char *filename, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForMemory (const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForFd (int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN xmlTextReaderPtr XMLCALL - xmlReaderForIO (xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); - -XMLPUBFUN int XMLCALL - xmlReaderNewWalker (xmlTextReaderPtr reader, - xmlDocPtr doc); -XMLPUBFUN int XMLCALL - xmlReaderNewDoc (xmlTextReaderPtr reader, - const xmlChar * cur, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewFile (xmlTextReaderPtr reader, - const char *filename, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewMemory (xmlTextReaderPtr reader, - const char *buffer, - int size, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewFd (xmlTextReaderPtr reader, - int fd, - const char *URL, - const char *encoding, - int options); -XMLPUBFUN int XMLCALL - xmlReaderNewIO (xmlTextReaderPtr reader, - xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, - void *ioctx, - const char *URL, - const char *encoding, - int options); -/* - * Error handling extensions - */ -typedef void * xmlTextReaderLocatorPtr; - -/** - * xmlTextReaderErrorFunc: - * @arg: the user argument - * @msg: the message - * @severity: the severity of the error - * @locator: a locator indicating where the error occured - * - * Signature of an error callback from a reader parser - */ -typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, - const char *msg, - xmlParserSeverities severity, - xmlTextReaderLocatorPtr locator); -XMLPUBFUN int XMLCALL - xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); -/*int xmlTextReaderLocatorLinePosition(xmlTextReaderLocatorPtr locator);*/ -XMLPUBFUN xmlChar * XMLCALL - xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); -XMLPUBFUN void XMLCALL - xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc f, - void *arg); -XMLPUBFUN void XMLCALL - xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, - xmlStructuredErrorFunc f, - void *arg); -XMLPUBFUN void XMLCALL - xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc *f, - void **arg); - -#endif /* LIBXML_READER_ENABLED */ - -#ifdef __cplusplus -} -#endif - -#endif /* __XML_XMLREADER_H__ */ - diff --git a/deps/libxml2/libxml/xmlsave.h b/deps/libxml2/libxml/xmlsave.h deleted file mode 100644 index e72cb7bcb8..0000000000 --- a/deps/libxml2/libxml/xmlsave.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Summary: the XML document serializer - * Description: API to save document or subtree of document - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_XMLSAVE_H__ -#define __XML_XMLSAVE_H__ - -#include -#include -#include -#include - -#endif /* __XML_XMLSAVE_H__ */ - - diff --git a/deps/libxml2/libxml/xmlstring.h b/deps/libxml2/libxml/xmlstring.h deleted file mode 100644 index 0bc6888865..0000000000 --- a/deps/libxml2/libxml/xmlstring.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Summary: set of routines to process strings - * Description: type and interfaces needed for the internal string handling - * of the library, especially UTF8 processing. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_STRING_H__ -#define __XML_STRING_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * xmlChar: - * - * This is a basic byte in an UTF-8 encoded string. - * It's unsigned allowing to pinpoint case where char * are assigned - * to xmlChar * (possibly making serialization back impossible). - */ -typedef unsigned char xmlChar; - -/** - * BAD_CAST: - * - * Macro to cast a string to an xmlChar * when one know its safe. - */ -#define BAD_CAST (xmlChar *) - -/* - * xmlChar handling - */ -XMLPUBFUN xmlChar * XMLCALL - xmlStrdup (const xmlChar *cur); -XMLPUBFUN xmlChar * XMLCALL - xmlStrndup (const xmlChar *cur, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlCharStrndup (const char *cur, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlCharStrdup (const char *cur); -XMLPUBFUN xmlChar * XMLCALL - xmlStrsub (const xmlChar *str, - int start, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrchr (const xmlChar *str, - xmlChar val); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrstr (const xmlChar *str, - const xmlChar *val); -XMLPUBFUN const xmlChar * XMLCALL - xmlStrcasestr (const xmlChar *str, - const xmlChar *val); -XMLPUBFUN int XMLCALL - xmlStrcmp (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrncmp (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrcasecmp (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrncasecmp (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrEqual (const xmlChar *str1, - const xmlChar *str2); -XMLPUBFUN int XMLCALL - xmlStrQEqual (const xmlChar *pref, - const xmlChar *name, - const xmlChar *str); -XMLPUBFUN int XMLCALL - xmlStrlen (const xmlChar *str); -XMLPUBFUN xmlChar * XMLCALL - xmlStrcat (xmlChar *cur, - const xmlChar *add); -XMLPUBFUN xmlChar * XMLCALL - xmlStrncat (xmlChar *cur, - const xmlChar *add, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlStrncatNew (const xmlChar *str1, - const xmlChar *str2, - int len); -XMLPUBFUN int XMLCALL - xmlStrPrintf (xmlChar *buf, - int len, - const xmlChar *msg, - ...); -XMLPUBFUN int XMLCALL - xmlStrVPrintf (xmlChar *buf, - int len, - const xmlChar *msg, - va_list ap); - -XMLPUBFUN int XMLCALL - xmlGetUTF8Char (const unsigned char *utf, - int *len); -XMLPUBFUN int XMLCALL - xmlCheckUTF8 (const unsigned char *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Strsize (const xmlChar *utf, - int len); -XMLPUBFUN xmlChar * XMLCALL - xmlUTF8Strndup (const xmlChar *utf, - int len); -XMLPUBFUN const xmlChar * XMLCALL - xmlUTF8Strpos (const xmlChar *utf, - int pos); -XMLPUBFUN int XMLCALL - xmlUTF8Strloc (const xmlChar *utf, - const xmlChar *utfchar); -XMLPUBFUN xmlChar * XMLCALL - xmlUTF8Strsub (const xmlChar *utf, - int start, - int len); -XMLPUBFUN int XMLCALL - xmlUTF8Strlen (const xmlChar *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Size (const xmlChar *utf); -XMLPUBFUN int XMLCALL - xmlUTF8Charcmp (const xmlChar *utf1, - const xmlChar *utf2); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_STRING_H__ */ diff --git a/deps/libxml2/libxml/xmlversion.h b/deps/libxml2/libxml/xmlversion.h deleted file mode 100644 index 8dd676b7eb..0000000000 --- a/deps/libxml2/libxml/xmlversion.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Summary: compile-time version informations - * Description: compile-time version informations for the XML library - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_VERSION_H__ -#define __XML_VERSION_H__ - -#include "xmlexports.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * use those to be sure nothing nasty will happen if - * your library and includes mismatch - */ -#ifndef LIBXML2_COMPILING_MSCCDEF -XMLPUBFUN void XMLCALL xmlCheckVersion(int version); -#endif /* LIBXML2_COMPILING_MSCCDEF */ - -/** - * LIBXML_DOTTED_VERSION: - * - * the version string like "1.2.3" - */ -#define LIBXML_DOTTED_VERSION "2.7.8" - -/** - * LIBXML_VERSION: - * - * the version number: 1.2.3 value is 10203 - */ -#define LIBXML_VERSION 20708 - -/** - * LIBXML_VERSION_STRING: - * - * the version number string, 1.2.3 value is "10203" - */ -#define LIBXML_VERSION_STRING "20708" - -/** - * LIBXML_VERSION_EXTRA: - * - * extra version information, used to show a CVS compilation - */ -#define LIBXML_VERSION_EXTRA "-GITv2.7.8-56-g8973d58" - -/** - * LIBXML_TEST_VERSION: - * - * Macro to check that the libxml version in use is compatible with - * the version the software has been compiled against - */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20708); - -/** - * LIBXML_TREE_ENABLED: - * - * Whether the DOM like tree manipulation API support is configured in - */ -#if 1 -#define LIBXML_TREE_ENABLED -#endif - -/** - * LIBXML_PUSH_ENABLED: - * - * Whether the push parsing interfaces are configured in - */ -#if 1 -#define LIBXML_PUSH_ENABLED -#endif - -/** - * LIBXML_READER_ENABLED: - * - * Whether the xmlReader parsing interface is configured in - */ -#if 1 -#define LIBXML_READER_ENABLED -#endif - -/** - * LIBXML_ISO8859X_ENABLED: - * - * Whether ISO-8859-* support is made available in case iconv is not - */ -#if 1 -#define LIBXML_ISO8859X_ENABLED -#endif - -/** - * LIBXML_LZMA_ENABLED: - * - * Whether the Lzma support is compiled in - */ -#if 0 -#define LIBXML_LZMA_ENABLED -#endif - -#ifdef __GNUC__ -#ifdef HAVE_ANSIDECL_H -#include -#endif - -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ - -#ifndef ATTRIBUTE_UNUSED -#define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ - -#ifndef LIBXML_ATTR_ALLOC_SIZE -# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) -# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) -# else -# define LIBXML_ATTR_ALLOC_SIZE(x) -# endif -#else -# define LIBXML_ATTR_ALLOC_SIZE(x) -#endif - -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ - -#ifndef LIBXML_ATTR_FORMAT -# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) -# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) -# else -# define LIBXML_ATTR_FORMAT(fmt,args) -# endif -#else -# define LIBXML_ATTR_FORMAT(fmt,args) -#endif - -#else /* ! __GNUC__ */ -/** - * ATTRIBUTE_UNUSED: - * - * Macro used to signal to GCC unused function parameters - */ -#define ATTRIBUTE_UNUSED -/** - * LIBXML_ATTR_ALLOC_SIZE: - * - * Macro used to indicate to GCC this is an allocator function - */ -#define LIBXML_ATTR_ALLOC_SIZE(x) -/** - * LIBXML_ATTR_FORMAT: - * - * Macro used to indicate to GCC the parameter are printf like - */ -#define LIBXML_ATTR_FORMAT(fmt,args) -#endif /* __GNUC__ */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif - - diff --git a/deps/libxml2/libxml_hash.c b/deps/libxml2/libxml_hash.c deleted file mode 100644 index 47813db768..0000000000 --- a/deps/libxml2/libxml_hash.c +++ /dev/null @@ -1,1116 +0,0 @@ -/* - * hash.c: chained hash tables - * - * Reference: Your favorite introductory book on algorithms - * - * Copyright (C) 2000,2012 Bjorn Reese and Daniel Veillard. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - * Author: breese@users.sourceforge.net - */ - -#define IN_LIBXML -#include "libxml.h" - -#include -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif - -/* - * Following http://www.ocert.org/advisories/ocert-2011-003.html - * it seems that having hash randomization might be a good idea - * when using XML with untrusted data - */ -#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) -#define HASH_RANDOMIZATION -#endif - -#include -#include -#include -#include -#include - -#ifndef MAX_HASH_LEN -#undef MAX_HASH_LEN -#define MAX_HASH_LEN 8 -#endif - -#ifdef HASH_RANDOMIZATION -static int hash_initialized = 0; -#endif - -/* - * A single entry in the hash table - */ -typedef struct _xmlHashEntry xmlHashEntry; -typedef xmlHashEntry *xmlHashEntryPtr; -struct _xmlHashEntry { - struct _xmlHashEntry *next; - xmlChar *name; - xmlChar *name2; - xmlChar *name3; - void *payload; - int valid; -}; - -/* - * The entire hash table - */ -struct _xmlHashTable { - struct _xmlHashEntry *table; - int size; - int nbElems; - xmlDictPtr dict; -#ifdef HASH_RANDOMIZATION - int random_seed; -#endif -}; - -/* - * xmlHashComputeKey: - * Calculate the hash key - */ -static unsigned long -xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3) { - unsigned long value = 0L; - char ch; - -#ifdef HASH_RANDOMIZATION - value = table->random_seed; -#endif - if (name != NULL) { - value += 30 * (*name); - while ((ch = *name++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - } - if (name2 != NULL) { - while ((ch = *name2++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - } - if (name3 != NULL) { - while ((ch = *name3++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - } - return (value % table->size); -} - -static unsigned long -xmlHashComputeQKey(xmlHashTablePtr table, - const xmlChar *prefix, const xmlChar *name, - const xmlChar *prefix2, const xmlChar *name2, - const xmlChar *prefix3, const xmlChar *name3) { - unsigned long value = 0L; - char ch; - -#ifdef HASH_RANDOMIZATION - value = table->random_seed; -#endif - if (prefix != NULL) - value += 30 * (*prefix); - else - value += 30 * (*name); - - if (prefix != NULL) { - while ((ch = *prefix++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':'); - } - if (name != NULL) { - while ((ch = *name++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - } - if (prefix2 != NULL) { - while ((ch = *prefix2++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':'); - } - if (name2 != NULL) { - while ((ch = *name2++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - } - if (prefix3 != NULL) { - while ((ch = *prefix3++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':'); - } - if (name3 != NULL) { - while ((ch = *name3++) != 0) { - value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch); - } - } - return (value % table->size); -} - -/** - * xmlHashCreate: - * @size: the size of the hash table - * - * Create a new xmlHashTablePtr. - * - * Returns the newly created object, or NULL if an error occured. - */ -xmlHashTablePtr -xmlHashCreate(int size) { - xmlHashTablePtr table; - - if (size <= 0) - size = 256; - - table = xmlMalloc(sizeof(xmlHashTable)); - if (table) { - table->dict = NULL; - table->size = size; - table->nbElems = 0; - table->table = xmlMalloc(size * sizeof(xmlHashEntry)); - if (table->table) { - memset(table->table, 0, size * sizeof(xmlHashEntry)); -#ifdef HASH_RANDOMIZATION - if (!hash_initialized) { - srand(time(NULL)); - hash_initialized = 1; - } - table->random_seed = rand(); -#endif - return(table); - } - xmlFree(table); - } - return(NULL); -} - -/** - * xmlHashCreateDict: - * @size: the size of the hash table - * @dict: a dictionary to use for the hash - * - * Create a new xmlHashTablePtr which will use @dict as the internal dictionary - * - * Returns the newly created object, or NULL if an error occured. - */ -xmlHashTablePtr -xmlHashCreateDict(int size, xmlDictPtr dict) { - xmlHashTablePtr table; - - table = xmlHashCreate(size); - if (table != NULL) { - table->dict = dict; - xmlDictReference(dict); - } - return(table); -} - -/** - * xmlHashGrow: - * @table: the hash table - * @size: the new size of the hash table - * - * resize the hash table - * - * Returns 0 in case of success, -1 in case of failure - */ -static int -xmlHashGrow(xmlHashTablePtr table, int size) { - unsigned long key; - int oldsize, i; - xmlHashEntryPtr iter, next; - struct _xmlHashEntry *oldtable; - - if (table == NULL) - return(-1); - if (size < 8) - return(-1); - if (size > 8 * 2048) - return(-1); - - oldsize = table->size; - oldtable = table->table; - if (oldtable == NULL) - return(-1); - - table->table = xmlMalloc(size * sizeof(xmlHashEntry)); - if (table->table == NULL) { - table->table = oldtable; - return(-1); - } - memset(table->table, 0, size * sizeof(xmlHashEntry)); - table->size = size; - - /* If the two loops are merged, there would be situations where - a new entry needs to allocated and data copied into it from - the main table. So instead, we run through the array twice, first - copying all the elements in the main array (where we can't get - conflicts) and then the rest, so we only free (and don't allocate) - */ - for (i = 0; i < oldsize; i++) { - if (oldtable[i].valid == 0) - continue; - key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2, - oldtable[i].name3); - memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry)); - table->table[key].next = NULL; - } - - for (i = 0; i < oldsize; i++) { - iter = oldtable[i].next; - while (iter) { - next = iter->next; - - /* - * put back the entry in the new table - */ - - key = xmlHashComputeKey(table, iter->name, iter->name2, - iter->name3); - if (table->table[key].valid == 0) { - memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry)); - table->table[key].next = NULL; - xmlFree(iter); - } else { - iter->next = table->table[key].next; - table->table[key].next = iter; - } - - - iter = next; - } - } - - xmlFree(oldtable); - - - return(0); -} - -/** - * xmlHashFree: - * @table: the hash table - * @f: the deallocator function for items in the hash - * - * Free the hash @table and its contents. The userdata is - * deallocated with @f if provided. - */ -void -xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f) { - int i; - xmlHashEntryPtr iter; - xmlHashEntryPtr next; - int inside_table = 0; - int nbElems; - - if (table == NULL) - return; - if (table->table) { - nbElems = table->nbElems; - for(i = 0; (i < table->size) && (nbElems > 0); i++) { - iter = &(table->table[i]); - if (iter->valid == 0) - continue; - inside_table = 1; - while (iter) { - next = iter->next; - if ((f != NULL) && (iter->payload != NULL)) - f(iter->payload, iter->name); - if (table->dict == NULL) { - if (iter->name) - xmlFree(iter->name); - if (iter->name2) - xmlFree(iter->name2); - if (iter->name3) - xmlFree(iter->name3); - } - iter->payload = NULL; - if (!inside_table) - xmlFree(iter); - nbElems--; - inside_table = 0; - iter = next; - } - } - xmlFree(table->table); - } - if (table->dict) - xmlDictFree(table->dict); - xmlFree(table); -} - -/** - * xmlHashAddEntry: - * @table: the hash table - * @name: the name of the userdata - * @userdata: a pointer to the userdata - * - * Add the @userdata to the hash @table. This can later be retrieved - * by using the @name. Duplicate names generate errors. - * - * Returns 0 the addition succeeded and -1 in case of error. - */ -int -xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata) { - return(xmlHashAddEntry3(table, name, NULL, NULL, userdata)); -} - -/** - * xmlHashAddEntry2: - * @table: the hash table - * @name: the name of the userdata - * @name2: a second name of the userdata - * @userdata: a pointer to the userdata - * - * Add the @userdata to the hash @table. This can later be retrieved - * by using the (@name, @name2) tuple. Duplicate tuples generate errors. - * - * Returns 0 the addition succeeded and -1 in case of error. - */ -int -xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, void *userdata) { - return(xmlHashAddEntry3(table, name, name2, NULL, userdata)); -} - -/** - * xmlHashUpdateEntry: - * @table: the hash table - * @name: the name of the userdata - * @userdata: a pointer to the userdata - * @f: the deallocator function for replaced item (if any) - * - * Add the @userdata to the hash @table. This can later be retrieved - * by using the @name. Existing entry for this @name will be removed - * and freed with @f if found. - * - * Returns 0 the addition succeeded and -1 in case of error. - */ -int -xmlHashUpdateEntry(xmlHashTablePtr table, const xmlChar *name, - void *userdata, xmlHashDeallocator f) { - return(xmlHashUpdateEntry3(table, name, NULL, NULL, userdata, f)); -} - -/** - * xmlHashUpdateEntry2: - * @table: the hash table - * @name: the name of the userdata - * @name2: a second name of the userdata - * @userdata: a pointer to the userdata - * @f: the deallocator function for replaced item (if any) - * - * Add the @userdata to the hash @table. This can later be retrieved - * by using the (@name, @name2) tuple. Existing entry for this tuple will - * be removed and freed with @f if found. - * - * Returns 0 the addition succeeded and -1 in case of error. - */ -int -xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, void *userdata, - xmlHashDeallocator f) { - return(xmlHashUpdateEntry3(table, name, name2, NULL, userdata, f)); -} - -/** - * xmlHashLookup: - * @table: the hash table - * @name: the name of the userdata - * - * Find the userdata specified by the @name. - * - * Returns the pointer to the userdata - */ -void * -xmlHashLookup(xmlHashTablePtr table, const xmlChar *name) { - return(xmlHashLookup3(table, name, NULL, NULL)); -} - -/** - * xmlHashLookup2: - * @table: the hash table - * @name: the name of the userdata - * @name2: a second name of the userdata - * - * Find the userdata specified by the (@name, @name2) tuple. - * - * Returns the pointer to the userdata - */ -void * -xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2) { - return(xmlHashLookup3(table, name, name2, NULL)); -} - -/** - * xmlHashQLookup: - * @table: the hash table - * @prefix: the prefix of the userdata - * @name: the name of the userdata - * - * Find the userdata specified by the QName @prefix:@name/@name. - * - * Returns the pointer to the userdata - */ -void * -xmlHashQLookup(xmlHashTablePtr table, const xmlChar *prefix, - const xmlChar *name) { - return(xmlHashQLookup3(table, prefix, name, NULL, NULL, NULL, NULL)); -} - -/** - * xmlHashQLookup2: - * @table: the hash table - * @prefix: the prefix of the userdata - * @name: the name of the userdata - * @prefix2: the second prefix of the userdata - * @name2: a second name of the userdata - * - * Find the userdata specified by the QNames tuple - * - * Returns the pointer to the userdata - */ -void * -xmlHashQLookup2(xmlHashTablePtr table, const xmlChar *prefix, - const xmlChar *name, const xmlChar *prefix2, - const xmlChar *name2) { - return(xmlHashQLookup3(table, prefix, name, prefix2, name2, NULL, NULL)); -} - -/** - * xmlHashAddEntry3: - * @table: the hash table - * @name: the name of the userdata - * @name2: a second name of the userdata - * @name3: a third name of the userdata - * @userdata: a pointer to the userdata - * - * Add the @userdata to the hash @table. This can later be retrieved - * by using the tuple (@name, @name2, @name3). Duplicate entries generate - * errors. - * - * Returns 0 the addition succeeded and -1 in case of error. - */ -int -xmlHashAddEntry3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, - void *userdata) { - unsigned long key, len = 0; - xmlHashEntryPtr entry; - xmlHashEntryPtr insert; - - if ((table == NULL) || (name == NULL)) - return(-1); - - /* - * If using a dict internalize if needed - */ - if (table->dict) { - if (!xmlDictOwns(table->dict, name)) { - name = xmlDictLookup(table->dict, name, -1); - if (name == NULL) - return(-1); - } - if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { - name2 = xmlDictLookup(table->dict, name2, -1); - if (name2 == NULL) - return(-1); - } - if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { - name3 = xmlDictLookup(table->dict, name3, -1); - if (name3 == NULL) - return(-1); - } - } - - /* - * Check for duplicate and insertion location. - */ - key = xmlHashComputeKey(table, name, name2, name3); - if (table->table[key].valid == 0) { - insert = NULL; - } else { - if (table->dict) { - for (insert = &(table->table[key]); insert->next != NULL; - insert = insert->next) { - if ((insert->name == name) && - (insert->name2 == name2) && - (insert->name3 == name3)) - return(-1); - len++; - } - if ((insert->name == name) && - (insert->name2 == name2) && - (insert->name3 == name3)) - return(-1); - } else { - for (insert = &(table->table[key]); insert->next != NULL; - insert = insert->next) { - if ((xmlStrEqual(insert->name, name)) && - (xmlStrEqual(insert->name2, name2)) && - (xmlStrEqual(insert->name3, name3))) - return(-1); - len++; - } - if ((xmlStrEqual(insert->name, name)) && - (xmlStrEqual(insert->name2, name2)) && - (xmlStrEqual(insert->name3, name3))) - return(-1); - } - } - - if (insert == NULL) { - entry = &(table->table[key]); - } else { - entry = xmlMalloc(sizeof(xmlHashEntry)); - if (entry == NULL) - return(-1); - } - - if (table->dict != NULL) { - entry->name = (xmlChar *) name; - entry->name2 = (xmlChar *) name2; - entry->name3 = (xmlChar *) name3; - } else { - entry->name = xmlStrdup(name); - entry->name2 = xmlStrdup(name2); - entry->name3 = xmlStrdup(name3); - } - entry->payload = userdata; - entry->next = NULL; - entry->valid = 1; - - - if (insert != NULL) - insert->next = entry; - - table->nbElems++; - - if (len > MAX_HASH_LEN) - xmlHashGrow(table, MAX_HASH_LEN * table->size); - - return(0); -} - -/** - * xmlHashUpdateEntry3: - * @table: the hash table - * @name: the name of the userdata - * @name2: a second name of the userdata - * @name3: a third name of the userdata - * @userdata: a pointer to the userdata - * @f: the deallocator function for replaced item (if any) - * - * Add the @userdata to the hash @table. This can later be retrieved - * by using the tuple (@name, @name2, @name3). Existing entry for this tuple - * will be removed and freed with @f if found. - * - * Returns 0 the addition succeeded and -1 in case of error. - */ -int -xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, - void *userdata, xmlHashDeallocator f) { - unsigned long key; - xmlHashEntryPtr entry; - xmlHashEntryPtr insert; - - if ((table == NULL) || name == NULL) - return(-1); - - /* - * If using a dict internalize if needed - */ - if (table->dict) { - if (!xmlDictOwns(table->dict, name)) { - name = xmlDictLookup(table->dict, name, -1); - if (name == NULL) - return(-1); - } - if ((name2 != NULL) && (!xmlDictOwns(table->dict, name2))) { - name2 = xmlDictLookup(table->dict, name2, -1); - if (name2 == NULL) - return(-1); - } - if ((name3 != NULL) && (!xmlDictOwns(table->dict, name3))) { - name3 = xmlDictLookup(table->dict, name3, -1); - if (name3 == NULL) - return(-1); - } - } - - /* - * Check for duplicate and insertion location. - */ - key = xmlHashComputeKey(table, name, name2, name3); - if (table->table[key].valid == 0) { - insert = NULL; - } else { - if (table ->dict) { - for (insert = &(table->table[key]); insert->next != NULL; - insert = insert->next) { - if ((insert->name == name) && - (insert->name2 == name2) && - (insert->name3 == name3)) { - if (f) - f(insert->payload, insert->name); - insert->payload = userdata; - return(0); - } - } - if ((insert->name == name) && - (insert->name2 == name2) && - (insert->name3 == name3)) { - if (f) - f(insert->payload, insert->name); - insert->payload = userdata; - return(0); - } - } else { - for (insert = &(table->table[key]); insert->next != NULL; - insert = insert->next) { - if ((xmlStrEqual(insert->name, name)) && - (xmlStrEqual(insert->name2, name2)) && - (xmlStrEqual(insert->name3, name3))) { - if (f) - f(insert->payload, insert->name); - insert->payload = userdata; - return(0); - } - } - if ((xmlStrEqual(insert->name, name)) && - (xmlStrEqual(insert->name2, name2)) && - (xmlStrEqual(insert->name3, name3))) { - if (f) - f(insert->payload, insert->name); - insert->payload = userdata; - return(0); - } - } - } - - if (insert == NULL) { - entry = &(table->table[key]); - } else { - entry = xmlMalloc(sizeof(xmlHashEntry)); - if (entry == NULL) - return(-1); - } - - if (table->dict != NULL) { - entry->name = (xmlChar *) name; - entry->name2 = (xmlChar *) name2; - entry->name3 = (xmlChar *) name3; - } else { - entry->name = xmlStrdup(name); - entry->name2 = xmlStrdup(name2); - entry->name3 = xmlStrdup(name3); - } - entry->payload = userdata; - entry->next = NULL; - entry->valid = 1; - table->nbElems++; - - - if (insert != NULL) { - insert->next = entry; - } - return(0); -} - -/** - * xmlHashLookup3: - * @table: the hash table - * @name: the name of the userdata - * @name2: a second name of the userdata - * @name3: a third name of the userdata - * - * Find the userdata specified by the (@name, @name2, @name3) tuple. - * - * Returns the a pointer to the userdata - */ -void * -xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3) { - unsigned long key; - xmlHashEntryPtr entry; - - if (table == NULL) - return(NULL); - if (name == NULL) - return(NULL); - key = xmlHashComputeKey(table, name, name2, name3); - if (table->table[key].valid == 0) - return(NULL); - if (table->dict) { - for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { - if ((entry->name == name) && - (entry->name2 == name2) && - (entry->name3 == name3)) - return(entry->payload); - } - } - for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { - if ((xmlStrEqual(entry->name, name)) && - (xmlStrEqual(entry->name2, name2)) && - (xmlStrEqual(entry->name3, name3))) - return(entry->payload); - } - return(NULL); -} - -/** - * xmlHashQLookup3: - * @table: the hash table - * @prefix: the prefix of the userdata - * @name: the name of the userdata - * @prefix2: the second prefix of the userdata - * @name2: a second name of the userdata - * @prefix3: the third prefix of the userdata - * @name3: a third name of the userdata - * - * Find the userdata specified by the (@name, @name2, @name3) tuple. - * - * Returns the a pointer to the userdata - */ -void * -xmlHashQLookup3(xmlHashTablePtr table, - const xmlChar *prefix, const xmlChar *name, - const xmlChar *prefix2, const xmlChar *name2, - const xmlChar *prefix3, const xmlChar *name3) { - unsigned long key; - xmlHashEntryPtr entry; - - if (table == NULL) - return(NULL); - if (name == NULL) - return(NULL); - key = xmlHashComputeQKey(table, prefix, name, prefix2, - name2, prefix3, name3); - if (table->table[key].valid == 0) - return(NULL); - for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { - if ((xmlStrQEqual(prefix, name, entry->name)) && - (xmlStrQEqual(prefix2, name2, entry->name2)) && - (xmlStrQEqual(prefix3, name3, entry->name3))) - return(entry->payload); - } - return(NULL); -} - -typedef struct { - xmlHashScanner hashscanner; - void *data; -} stubData; - -static void -stubHashScannerFull (void *payload, void *data, const xmlChar *name, - const xmlChar *name2 ATTRIBUTE_UNUSED, - const xmlChar *name3 ATTRIBUTE_UNUSED) { - stubData *stubdata = (stubData *) data; - stubdata->hashscanner (payload, stubdata->data, (xmlChar *) name); -} - -/** - * xmlHashScan: - * @table: the hash table - * @f: the scanner function for items in the hash - * @data: extra data passed to f - * - * Scan the hash @table and applied @f to each value. - */ -void -xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { - stubData stubdata; - stubdata.data = data; - stubdata.hashscanner = f; - xmlHashScanFull (table, stubHashScannerFull, &stubdata); -} - -/** - * xmlHashScanFull: - * @table: the hash table - * @f: the scanner function for items in the hash - * @data: extra data passed to f - * - * Scan the hash @table and applied @f to each value. - */ -void -xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { - int i, nb; - xmlHashEntryPtr iter; - xmlHashEntryPtr next; - - if (table == NULL) - return; - if (f == NULL) - return; - - if (table->table) { - for(i = 0; i < table->size; i++) { - if (table->table[i].valid == 0) - continue; - iter = &(table->table[i]); - while (iter) { - next = iter->next; - nb = table->nbElems; - if ((f != NULL) && (iter->payload != NULL)) - f(iter->payload, data, iter->name, - iter->name2, iter->name3); - if (nb != table->nbElems) { - /* table was modified by the callback, be careful */ - if (iter == &(table->table[i])) { - if (table->table[i].valid == 0) - iter = NULL; - if (table->table[i].next != next) - iter = &(table->table[i]); - } else - iter = next; - } else - iter = next; - } - } - } -} - -/** - * xmlHashScan3: - * @table: the hash table - * @name: the name of the userdata or NULL - * @name2: a second name of the userdata or NULL - * @name3: a third name of the userdata or NULL - * @f: the scanner function for items in the hash - * @data: extra data passed to f - * - * Scan the hash @table and applied @f to each value matching - * (@name, @name2, @name3) tuple. If one of the names is null, - * the comparison is considered to match. - */ -void -xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, - xmlHashScanner f, void *data) { - xmlHashScanFull3 (table, name, name2, name3, - (xmlHashScannerFull) f, data); -} - -/** - * xmlHashScanFull3: - * @table: the hash table - * @name: the name of the userdata or NULL - * @name2: a second name of the userdata or NULL - * @name3: a third name of the userdata or NULL - * @f: the scanner function for items in the hash - * @data: extra data passed to f - * - * Scan the hash @table and applied @f to each value matching - * (@name, @name2, @name3) tuple. If one of the names is null, - * the comparison is considered to match. - */ -void -xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, - xmlHashScannerFull f, void *data) { - int i; - xmlHashEntryPtr iter; - xmlHashEntryPtr next; - - if (table == NULL) - return; - if (f == NULL) - return; - - if (table->table) { - for(i = 0; i < table->size; i++) { - if (table->table[i].valid == 0) - continue; - iter = &(table->table[i]); - while (iter) { - next = iter->next; - if (((name == NULL) || (xmlStrEqual(name, iter->name))) && - ((name2 == NULL) || (xmlStrEqual(name2, iter->name2))) && - ((name3 == NULL) || (xmlStrEqual(name3, iter->name3))) && - (iter->payload != NULL)) { - f(iter->payload, data, iter->name, - iter->name2, iter->name3); - } - iter = next; - } - } - } -} - -/** - * xmlHashCopy: - * @table: the hash table - * @f: the copier function for items in the hash - * - * Scan the hash @table and applied @f to each value. - * - * Returns the new table or NULL in case of error. - */ -xmlHashTablePtr -xmlHashCopy(xmlHashTablePtr table, xmlHashCopier f) { - int i; - xmlHashEntryPtr iter; - xmlHashEntryPtr next; - xmlHashTablePtr ret; - - if (table == NULL) - return(NULL); - if (f == NULL) - return(NULL); - - ret = xmlHashCreate(table->size); - if (table->table) { - for(i = 0; i < table->size; i++) { - if (table->table[i].valid == 0) - continue; - iter = &(table->table[i]); - while (iter) { - next = iter->next; - xmlHashAddEntry3(ret, iter->name, iter->name2, - iter->name3, f(iter->payload, iter->name)); - iter = next; - } - } - } - ret->nbElems = table->nbElems; - return(ret); -} - -/** - * xmlHashSize: - * @table: the hash table - * - * Query the number of elements installed in the hash @table. - * - * Returns the number of elements in the hash table or - * -1 in case of error - */ -int -xmlHashSize(xmlHashTablePtr table) { - if (table == NULL) - return(-1); - return(table->nbElems); -} - -/** - * xmlHashRemoveEntry: - * @table: the hash table - * @name: the name of the userdata - * @f: the deallocator function for removed item (if any) - * - * Find the userdata specified by the @name and remove - * it from the hash @table. Existing userdata for this tuple will be removed - * and freed with @f. - * - * Returns 0 if the removal succeeded and -1 in case of error or not found. - */ -int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, - xmlHashDeallocator f) { - return(xmlHashRemoveEntry3(table, name, NULL, NULL, f)); -} - -/** - * xmlHashRemoveEntry2: - * @table: the hash table - * @name: the name of the userdata - * @name2: a second name of the userdata - * @f: the deallocator function for removed item (if any) - * - * Find the userdata specified by the (@name, @name2) tuple and remove - * it from the hash @table. Existing userdata for this tuple will be removed - * and freed with @f. - * - * Returns 0 if the removal succeeded and -1 in case of error or not found. - */ -int -xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, xmlHashDeallocator f) { - return(xmlHashRemoveEntry3(table, name, name2, NULL, f)); -} - -/** - * xmlHashRemoveEntry3: - * @table: the hash table - * @name: the name of the userdata - * @name2: a second name of the userdata - * @name3: a third name of the userdata - * @f: the deallocator function for removed item (if any) - * - * Find the userdata specified by the (@name, @name2, @name3) tuple and remove - * it from the hash @table. Existing userdata for this tuple will be removed - * and freed with @f. - * - * Returns 0 if the removal succeeded and -1 in case of error or not found. - */ -int -xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, - const xmlChar *name2, const xmlChar *name3, xmlHashDeallocator f) { - unsigned long key; - xmlHashEntryPtr entry; - xmlHashEntryPtr prev = NULL; - - if (table == NULL || name == NULL) - return(-1); - - key = xmlHashComputeKey(table, name, name2, name3); - if (table->table[key].valid == 0) { - return(-1); - } else { - for (entry = &(table->table[key]); entry != NULL; entry = entry->next) { - if (xmlStrEqual(entry->name, name) && - xmlStrEqual(entry->name2, name2) && - xmlStrEqual(entry->name3, name3)) { - if ((f != NULL) && (entry->payload != NULL)) - f(entry->payload, entry->name); - entry->payload = NULL; - if (table->dict == NULL) { - if(entry->name) - xmlFree(entry->name); - if(entry->name2) - xmlFree(entry->name2); - if(entry->name3) - xmlFree(entry->name3); - } - if(prev) { - prev->next = entry->next; - xmlFree(entry); - } else { - if (entry->next == NULL) { - entry->valid = 0; - } else { - entry = entry->next; - memcpy(&(table->table[key]), entry, sizeof(xmlHashEntry)); - xmlFree(entry); - } - } - table->nbElems--; - return(0); - } - prev = entry; - } - return(-1); - } -} - -#define bottom_hash -#include "elfgcchack.h" diff --git a/deps/libxml2/libxml_list.c b/deps/libxml2/libxml_list.c deleted file mode 100644 index 5c01c83586..0000000000 --- a/deps/libxml2/libxml_list.c +++ /dev/null @@ -1,779 +0,0 @@ -/* - * list.c: lists handling implementation - * - * Copyright (C) 2000 Gary Pennington and Daniel Veillard. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - * Author: Gary.Pennington@uk.sun.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#include -#include -#include -#include -#include - -/* - * Type definition are kept internal - */ - -struct _xmlLink -{ - struct _xmlLink *next; - struct _xmlLink *prev; - void *data; -}; - -struct _xmlList -{ - xmlLinkPtr sentinel; - void (*linkDeallocator)(xmlLinkPtr ); - int (*linkCompare)(const void *, const void*); -}; - -/************************************************************************ - * * - * Interfaces * - * * - ************************************************************************/ - -/** - * xmlLinkDeallocator: - * @l: a list - * @lk: a link - * - * Unlink and deallocate @lk from list @l - */ -static void -xmlLinkDeallocator(xmlListPtr l, xmlLinkPtr lk) -{ - (lk->prev)->next = lk->next; - (lk->next)->prev = lk->prev; - if(l->linkDeallocator) - l->linkDeallocator(lk); - xmlFree(lk); -} - -/** - * xmlLinkCompare: - * @data0: first data - * @data1: second data - * - * Compares two arbitrary data - * - * Returns -1, 0 or 1 depending on whether data1 is greater equal or smaller - * than data0 - */ -static int -xmlLinkCompare(const void *data0, const void *data1) -{ - if (data0 < data1) - return (-1); - else if (data0 == data1) - return (0); - return (1); -} - -/** - * xmlListLowerSearch: - * @l: a list - * @data: a data - * - * Search data in the ordered list walking from the beginning - * - * Returns the link containing the data or NULL - */ -static xmlLinkPtr -xmlListLowerSearch(xmlListPtr l, void *data) -{ - xmlLinkPtr lk; - - if (l == NULL) - return(NULL); - for(lk = l->sentinel->next;lk != l->sentinel && l->linkCompare(lk->data, data) <0 ;lk = lk->next); - return lk; -} - -/** - * xmlListHigherSearch: - * @l: a list - * @data: a data - * - * Search data in the ordered list walking backward from the end - * - * Returns the link containing the data or NULL - */ -static xmlLinkPtr -xmlListHigherSearch(xmlListPtr l, void *data) -{ - xmlLinkPtr lk; - - if (l == NULL) - return(NULL); - for(lk = l->sentinel->prev;lk != l->sentinel && l->linkCompare(lk->data, data) >0 ;lk = lk->prev); - return lk; -} - -/** - * xmlListSearch: - * @l: a list - * @data: a data - * - * Search data in the list - * - * Returns the link containing the data or NULL - */ -static xmlLinkPtr -xmlListLinkSearch(xmlListPtr l, void *data) -{ - xmlLinkPtr lk; - if (l == NULL) - return(NULL); - lk = xmlListLowerSearch(l, data); - if (lk == l->sentinel) - return NULL; - else { - if (l->linkCompare(lk->data, data) ==0) - return lk; - return NULL; - } -} - -/** - * xmlListLinkReverseSearch: - * @l: a list - * @data: a data - * - * Search data in the list processing backward - * - * Returns the link containing the data or NULL - */ -static xmlLinkPtr -xmlListLinkReverseSearch(xmlListPtr l, void *data) -{ - xmlLinkPtr lk; - if (l == NULL) - return(NULL); - lk = xmlListHigherSearch(l, data); - if (lk == l->sentinel) - return NULL; - else { - if (l->linkCompare(lk->data, data) ==0) - return lk; - return NULL; - } -} - -/** - * xmlListCreate: - * @deallocator: an optional deallocator function - * @compare: an optional comparison function - * - * Create a new list - * - * Returns the new list or NULL in case of error - */ -xmlListPtr -xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare) -{ - xmlListPtr l; - if (NULL == (l = (xmlListPtr )xmlMalloc( sizeof(xmlList)))) { - xmlGenericError(xmlGenericErrorContext, - "Cannot initialize memory for list"); - return (NULL); - } - /* Initialize the list to NULL */ - memset(l, 0, sizeof(xmlList)); - - /* Add the sentinel */ - if (NULL ==(l->sentinel = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) { - xmlGenericError(xmlGenericErrorContext, - "Cannot initialize memory for sentinel"); - xmlFree(l); - return (NULL); - } - l->sentinel->next = l->sentinel; - l->sentinel->prev = l->sentinel; - l->sentinel->data = NULL; - - /* If there is a link deallocator, use it */ - if (deallocator != NULL) - l->linkDeallocator = deallocator; - /* If there is a link comparator, use it */ - if (compare != NULL) - l->linkCompare = compare; - else /* Use our own */ - l->linkCompare = xmlLinkCompare; - return l; -} - -/** - * xmlListSearch: - * @l: a list - * @data: a search value - * - * Search the list for an existing value of @data - * - * Returns the value associated to @data or NULL in case of error - */ -void * -xmlListSearch(xmlListPtr l, void *data) -{ - xmlLinkPtr lk; - if (l == NULL) - return(NULL); - lk = xmlListLinkSearch(l, data); - if (lk) - return (lk->data); - return NULL; -} - -/** - * xmlListReverseSearch: - * @l: a list - * @data: a search value - * - * Search the list in reverse order for an existing value of @data - * - * Returns the value associated to @data or NULL in case of error - */ -void * -xmlListReverseSearch(xmlListPtr l, void *data) -{ - xmlLinkPtr lk; - if (l == NULL) - return(NULL); - lk = xmlListLinkReverseSearch(l, data); - if (lk) - return (lk->data); - return NULL; -} - -/** - * xmlListInsert: - * @l: a list - * @data: the data - * - * Insert data in the ordered list at the beginning for this value - * - * Returns 0 in case of success, 1 in case of failure - */ -int -xmlListInsert(xmlListPtr l, void *data) -{ - xmlLinkPtr lkPlace, lkNew; - - if (l == NULL) - return(1); - lkPlace = xmlListLowerSearch(l, data); - /* Add the new link */ - lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); - if (lkNew == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot initialize memory for new link"); - return (1); - } - lkNew->data = data; - lkPlace = lkPlace->prev; - lkNew->next = lkPlace->next; - (lkPlace->next)->prev = lkNew; - lkPlace->next = lkNew; - lkNew->prev = lkPlace; - return 0; -} - -/** - * xmlListAppend: - * @l: a list - * @data: the data - * - * Insert data in the ordered list at the end for this value - * - * Returns 0 in case of success, 1 in case of failure - */ -int xmlListAppend(xmlListPtr l, void *data) -{ - xmlLinkPtr lkPlace, lkNew; - - if (l == NULL) - return(1); - lkPlace = xmlListHigherSearch(l, data); - /* Add the new link */ - lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); - if (lkNew == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot initialize memory for new link"); - return (1); - } - lkNew->data = data; - lkNew->next = lkPlace->next; - (lkPlace->next)->prev = lkNew; - lkPlace->next = lkNew; - lkNew->prev = lkPlace; - return 0; -} - -/** - * xmlListDelete: - * @l: a list - * - * Deletes the list and its associated data - */ -void xmlListDelete(xmlListPtr l) -{ - if (l == NULL) - return; - - xmlListClear(l); - xmlFree(l->sentinel); - xmlFree(l); -} - -/** - * xmlListRemoveFirst: - * @l: a list - * @data: list data - * - * Remove the first instance associated to data in the list - * - * Returns 1 if a deallocation occured, or 0 if not found - */ -int -xmlListRemoveFirst(xmlListPtr l, void *data) -{ - xmlLinkPtr lk; - - if (l == NULL) - return(0); - /*Find the first instance of this data */ - lk = xmlListLinkSearch(l, data); - if (lk != NULL) { - xmlLinkDeallocator(l, lk); - return 1; - } - return 0; -} - -/** - * xmlListRemoveLast: - * @l: a list - * @data: list data - * - * Remove the last instance associated to data in the list - * - * Returns 1 if a deallocation occured, or 0 if not found - */ -int -xmlListRemoveLast(xmlListPtr l, void *data) -{ - xmlLinkPtr lk; - - if (l == NULL) - return(0); - /*Find the last instance of this data */ - lk = xmlListLinkReverseSearch(l, data); - if (lk != NULL) { - xmlLinkDeallocator(l, lk); - return 1; - } - return 0; -} - -/** - * xmlListRemoveAll: - * @l: a list - * @data: list data - * - * Remove the all instance associated to data in the list - * - * Returns the number of deallocation, or 0 if not found - */ -int -xmlListRemoveAll(xmlListPtr l, void *data) -{ - int count=0; - - if (l == NULL) - return(0); - - while(xmlListRemoveFirst(l, data)) - count++; - return count; -} - -/** - * xmlListClear: - * @l: a list - * - * Remove the all data in the list - */ -void -xmlListClear(xmlListPtr l) -{ - xmlLinkPtr lk; - - if (l == NULL) - return; - lk = l->sentinel->next; - while(lk != l->sentinel) { - xmlLinkPtr next = lk->next; - - xmlLinkDeallocator(l, lk); - lk = next; - } -} - -/** - * xmlListEmpty: - * @l: a list - * - * Is the list empty ? - * - * Returns 1 if the list is empty, 0 if not empty and -1 in case of error - */ -int -xmlListEmpty(xmlListPtr l) -{ - if (l == NULL) - return(-1); - return (l->sentinel->next == l->sentinel); -} - -/** - * xmlListFront: - * @l: a list - * - * Get the first element in the list - * - * Returns the first element in the list, or NULL - */ -xmlLinkPtr -xmlListFront(xmlListPtr l) -{ - if (l == NULL) - return(NULL); - return (l->sentinel->next); -} - -/** - * xmlListEnd: - * @l: a list - * - * Get the last element in the list - * - * Returns the last element in the list, or NULL - */ -xmlLinkPtr -xmlListEnd(xmlListPtr l) -{ - if (l == NULL) - return(NULL); - return (l->sentinel->prev); -} - -/** - * xmlListSize: - * @l: a list - * - * Get the number of elements in the list - * - * Returns the number of elements in the list or -1 in case of error - */ -int -xmlListSize(xmlListPtr l) -{ - xmlLinkPtr lk; - int count=0; - - if (l == NULL) - return(-1); - /* TODO: keep a counter in xmlList instead */ - for(lk = l->sentinel->next; lk != l->sentinel; lk = lk->next, count++); - return count; -} - -/** - * xmlListPopFront: - * @l: a list - * - * Removes the first element in the list - */ -void -xmlListPopFront(xmlListPtr l) -{ - if(!xmlListEmpty(l)) - xmlLinkDeallocator(l, l->sentinel->next); -} - -/** - * xmlListPopBack: - * @l: a list - * - * Removes the last element in the list - */ -void -xmlListPopBack(xmlListPtr l) -{ - if(!xmlListEmpty(l)) - xmlLinkDeallocator(l, l->sentinel->prev); -} - -/** - * xmlListPushFront: - * @l: a list - * @data: new data - * - * add the new data at the beginning of the list - * - * Returns 1 if successful, 0 otherwise - */ -int -xmlListPushFront(xmlListPtr l, void *data) -{ - xmlLinkPtr lkPlace, lkNew; - - if (l == NULL) - return(0); - lkPlace = l->sentinel; - /* Add the new link */ - lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); - if (lkNew == NULL) { - xmlGenericError(xmlGenericErrorContext, - "Cannot initialize memory for new link"); - return (0); - } - lkNew->data = data; - lkNew->next = lkPlace->next; - (lkPlace->next)->prev = lkNew; - lkPlace->next = lkNew; - lkNew->prev = lkPlace; - return 1; -} - -/** - * xmlListPushBack: - * @l: a list - * @data: new data - * - * add the new data at the end of the list - * - * Returns 1 if successful, 0 otherwise - */ -int -xmlListPushBack(xmlListPtr l, void *data) -{ - xmlLinkPtr lkPlace, lkNew; - - if (l == NULL) - return(0); - lkPlace = l->sentinel->prev; - /* Add the new link */ - if (NULL ==(lkNew = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) { - xmlGenericError(xmlGenericErrorContext, - "Cannot initialize memory for new link"); - return (0); - } - lkNew->data = data; - lkNew->next = lkPlace->next; - (lkPlace->next)->prev = lkNew; - lkPlace->next = lkNew; - lkNew->prev = lkPlace; - return 1; -} - -/** - * xmlLinkGetData: - * @lk: a link - * - * See Returns. - * - * Returns a pointer to the data referenced from this link - */ -void * -xmlLinkGetData(xmlLinkPtr lk) -{ - if (lk == NULL) - return(NULL); - return lk->data; -} - -/** - * xmlListReverse: - * @l: a list - * - * Reverse the order of the elements in the list - */ -void -xmlListReverse(xmlListPtr l) -{ - xmlLinkPtr lk; - xmlLinkPtr lkPrev; - - if (l == NULL) - return; - lkPrev = l->sentinel; - for (lk = l->sentinel->next; lk != l->sentinel; lk = lk->next) { - lkPrev->next = lkPrev->prev; - lkPrev->prev = lk; - lkPrev = lk; - } - /* Fix up the last node */ - lkPrev->next = lkPrev->prev; - lkPrev->prev = lk; -} - -/** - * xmlListSort: - * @l: a list - * - * Sort all the elements in the list - */ -void -xmlListSort(xmlListPtr l) -{ - xmlListPtr lTemp; - - if (l == NULL) - return; - if(xmlListEmpty(l)) - return; - - /* I think that the real answer is to implement quicksort, the - * alternative is to implement some list copying procedure which - * would be based on a list copy followed by a clear followed by - * an insert. This is slow... - */ - - if (NULL ==(lTemp = xmlListDup(l))) - return; - xmlListClear(l); - xmlListMerge(l, lTemp); - xmlListDelete(lTemp); - return; -} - -/** - * xmlListWalk: - * @l: a list - * @walker: a processing function - * @user: a user parameter passed to the walker function - * - * Walk all the element of the first from first to last and - * apply the walker function to it - */ -void -xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user) { - xmlLinkPtr lk; - - if ((l == NULL) || (walker == NULL)) - return; - for(lk = l->sentinel->next; lk != l->sentinel; lk = lk->next) { - if((walker(lk->data, user)) == 0) - break; - } -} - -/** - * xmlListReverseWalk: - * @l: a list - * @walker: a processing function - * @user: a user parameter passed to the walker function - * - * Walk all the element of the list in reverse order and - * apply the walker function to it - */ -void -xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, const void *user) { - xmlLinkPtr lk; - - if ((l == NULL) || (walker == NULL)) - return; - for(lk = l->sentinel->prev; lk != l->sentinel; lk = lk->prev) { - if((walker(lk->data, user)) == 0) - break; - } -} - -/** - * xmlListMerge: - * @l1: the original list - * @l2: the new list - * - * include all the elements of the second list in the first one and - * clear the second list - */ -void -xmlListMerge(xmlListPtr l1, xmlListPtr l2) -{ - xmlListCopy(l1, l2); - xmlListClear(l2); -} - -/** - * xmlListDup: - * @old: the list - * - * Duplicate the list - * - * Returns a new copy of the list or NULL in case of error - */ -xmlListPtr -xmlListDup(const xmlListPtr old) -{ - xmlListPtr cur; - - if (old == NULL) - return(NULL); - /* Hmmm, how to best deal with allocation issues when copying - * lists. If there is a de-allocator, should responsibility lie with - * the new list or the old list. Surely not both. I'll arbitrarily - * set it to be the old list for the time being whilst I work out - * the answer - */ - if (NULL ==(cur = xmlListCreate(NULL, old->linkCompare))) - return (NULL); - if (0 != xmlListCopy(cur, old)) - return NULL; - return cur; -} - -/** - * xmlListCopy: - * @cur: the new list - * @old: the old list - * - * Move all the element from the old list in the new list - * - * Returns 0 in case of success 1 in case of error - */ -int -xmlListCopy(xmlListPtr cur, const xmlListPtr old) -{ - /* Walk the old tree and insert the data into the new one */ - xmlLinkPtr lk; - - if ((old == NULL) || (cur == NULL)) - return(1); - for(lk = old->sentinel->next; lk != old->sentinel; lk = lk->next) { - if (0 !=xmlListInsert(cur, lk->data)) { - xmlListDelete(cur); - return (1); - } - } - return (0); -} -/* xmlListUnique() */ -/* xmlListSwap */ -#define bottom_list -#include "elfgcchack.h" diff --git a/deps/libxml2/parser.c b/deps/libxml2/parser.c deleted file mode 100644 index 05f1931f98..0000000000 --- a/deps/libxml2/parser.c +++ /dev/null @@ -1,13007 +0,0 @@ -/* - * parser.c : an XML 1.0 parser, namespaces and validity support are mostly - * implemented on top of the SAX interfaces - * - * References: - * The XML specification: - * http://www.w3.org/TR/REC-xml - * Original 1.0 version: - * http://www.w3.org/TR/1998/REC-xml-19980210 - * XML second edition working draft - * http://www.w3.org/TR/2000/WD-xml-2e-20000814 - * - * Okay this is a big file, the parser core is around 7000 lines, then it - * is followed by the progressive parser top routines, then the various - * high level APIs to call the parser and a few miscellaneous functions. - * A number of helper functions and deprecated ones have been moved to - * parserInternals.c to reduce this file size. - * As much as possible the functions are associated with their relative - * production in the XML specification. A few productions defining the - * different ranges of character are actually implanted either in - * parserInternals.h or parserInternals.c - * The DOM tree build is realized from the default SAX callbacks in - * the module SAX.c. - * The routines doing the validation checks are in valid.c and called either - * from the SAX callbacks or as standalone functions using a preparsed - * document. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#if defined(WIN32) && !defined (__CYGWIN__) -#define XML_DIR_SEP '\\' -#else -#define XML_DIR_SEP '/' -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_CTYPE_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_ZLIB_H -#include -#endif -#ifdef HAVE_LZMA_H -#include -#endif - -static void -xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info); - -static xmlParserCtxtPtr -xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID, - const xmlChar *base, xmlParserCtxtPtr pctx); - -/************************************************************************ - * * - * Arbitrary limits set in the parser. See XML_PARSE_HUGE * - * * - ************************************************************************/ - -#define XML_PARSER_BIG_ENTITY 1000 -#define XML_PARSER_LOT_ENTITY 5000 - -/* - * XML_PARSER_NON_LINEAR is the threshold where the ratio of parsed entity - * replacement over the size in byte of the input indicates that you have - * and eponential behaviour. A value of 10 correspond to at least 3 entity - * replacement per byte of input. - */ -#define XML_PARSER_NON_LINEAR 10 - -/* - * xmlParserEntityCheck - * - * Function to check non-linear entity expansion behaviour - * This is here to detect and stop exponential linear entity expansion - * This is not a limitation of the parser but a safety - * boundary feature. It can be disabled with the XML_PARSE_HUGE - * parser option. - */ -static int -xmlParserEntityCheck(xmlParserCtxtPtr ctxt, unsigned long size, - xmlEntityPtr ent) -{ - unsigned long consumed = 0; - - if ((ctxt == NULL) || (ctxt->options & XML_PARSE_HUGE)) - return (0); - if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) - return (1); - if (size != 0) { - /* - * Do the check based on the replacement size of the entity - */ - if (size < XML_PARSER_BIG_ENTITY) - return(0); - - /* - * A limit on the amount of text data reasonably used - */ - if (ctxt->input != NULL) { - consumed = ctxt->input->consumed + - (ctxt->input->cur - ctxt->input->base); - } - consumed += ctxt->sizeentities; - - if ((size < XML_PARSER_NON_LINEAR * consumed) && - (ctxt->nbentities * 3 < XML_PARSER_NON_LINEAR * consumed)) - return (0); - } else if (ent != NULL) { - /* - * use the number of parsed entities in the replacement - */ - size = ent->checked; - - /* - * The amount of data parsed counting entities size only once - */ - if (ctxt->input != NULL) { - consumed = ctxt->input->consumed + - (ctxt->input->cur - ctxt->input->base); - } - consumed += ctxt->sizeentities; - - /* - * Check the density of entities for the amount of data - * knowing an entity reference will take at least 3 bytes - */ - if (size * 3 < consumed * XML_PARSER_NON_LINEAR) - return (0); - } else { - /* - * strange we got no data for checking just return - */ - return (0); - } - - xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); - return (1); -} - -/** - * xmlParserMaxDepth: - * - * arbitrary depth limit for the XML documents that we allow to - * process. This is not a limitation of the parser but a safety - * boundary feature. It can be disabled with the XML_PARSE_HUGE - * parser option. - */ -unsigned int xmlParserMaxDepth = 256; - - - -#define SAX2 1 -#define XML_PARSER_BIG_BUFFER_SIZE 300 -#define XML_PARSER_BUFFER_SIZE 100 -#define SAX_COMPAT_MODE BAD_CAST "SAX compatibility mode document" - -/* - * List of XML prefixed PI allowed by W3C specs - */ - -static const char *xmlW3CPIs[] = { - "xml-stylesheet", - "xml-model", - NULL -}; - - -/* DEPR void xmlParserHandleReference(xmlParserCtxtPtr ctxt); */ -static xmlEntityPtr xmlParseStringPEReference(xmlParserCtxtPtr ctxt, - const xmlChar **str); - -static xmlParserErrors -xmlParseExternalEntityPrivate(xmlDocPtr doc, xmlParserCtxtPtr oldctxt, - xmlSAXHandlerPtr sax, - void *user_data, int depth, const xmlChar *URL, - const xmlChar *ID, xmlNodePtr *list); - -static int -xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, - const char *encoding); - -static xmlParserErrors -xmlParseBalancedChunkMemoryInternal(xmlParserCtxtPtr oldctxt, - const xmlChar *string, void *user_data, xmlNodePtr *lst); - -static int -xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity); - -/************************************************************************ - * * - * Some factorized error routines * - * * - ************************************************************************/ - -/** - * xmlErrAttributeDup: - * @ctxt: an XML parser context - * @prefix: the attribute prefix - * @localname: the attribute localname - * - * Handle a redefinition of attribute error - */ -static void -xmlErrAttributeDup(xmlParserCtxtPtr ctxt, const xmlChar * prefix, - const xmlChar * localname) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = XML_ERR_ATTRIBUTE_REDEFINED; - - if (prefix == NULL) - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, - XML_ERR_ATTRIBUTE_REDEFINED, XML_ERR_FATAL, NULL, 0, - (const char *) localname, NULL, NULL, 0, 0, - "Attribute %s redefined\n", localname); - else - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, - XML_ERR_ATTRIBUTE_REDEFINED, XML_ERR_FATAL, NULL, 0, - (const char *) prefix, (const char *) localname, - NULL, 0, 0, "Attribute %s:%s redefined\n", prefix, - localname); - if (ctxt != NULL) { - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) - ctxt->disableSAX = 1; - } -} - -/** - * xmlFatalErr: - * @ctxt: an XML parser context - * @error: the error number - * @extra: extra information string - * - * Handle a fatal parser error, i.e. violating Well-Formedness constraints - */ -static void -xmlFatalErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *info) -{ - const char *errmsg; - - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - switch (error) { - case XML_ERR_INVALID_HEX_CHARREF: - errmsg = "CharRef: invalid hexadecimal value\n"; - break; - case XML_ERR_INVALID_DEC_CHARREF: - errmsg = "CharRef: invalid decimal value\n"; - break; - case XML_ERR_INVALID_CHARREF: - errmsg = "CharRef: invalid value\n"; - break; - case XML_ERR_INTERNAL_ERROR: - errmsg = "internal error"; - break; - case XML_ERR_PEREF_AT_EOF: - errmsg = "PEReference at end of document\n"; - break; - case XML_ERR_PEREF_IN_PROLOG: - errmsg = "PEReference in prolog\n"; - break; - case XML_ERR_PEREF_IN_EPILOG: - errmsg = "PEReference in epilog\n"; - break; - case XML_ERR_PEREF_NO_NAME: - errmsg = "PEReference: no name\n"; - break; - case XML_ERR_PEREF_SEMICOL_MISSING: - errmsg = "PEReference: expecting ';'\n"; - break; - case XML_ERR_ENTITY_LOOP: - errmsg = "Detected an entity reference loop\n"; - break; - case XML_ERR_ENTITY_NOT_STARTED: - errmsg = "EntityValue: \" or ' expected\n"; - break; - case XML_ERR_ENTITY_PE_INTERNAL: - errmsg = "PEReferences forbidden in internal subset\n"; - break; - case XML_ERR_ENTITY_NOT_FINISHED: - errmsg = "EntityValue: \" or ' expected\n"; - break; - case XML_ERR_ATTRIBUTE_NOT_STARTED: - errmsg = "AttValue: \" or ' expected\n"; - break; - case XML_ERR_LT_IN_ATTRIBUTE: - errmsg = "Unescaped '<' not allowed in attributes values\n"; - break; - case XML_ERR_LITERAL_NOT_STARTED: - errmsg = "SystemLiteral \" or ' expected\n"; - break; - case XML_ERR_LITERAL_NOT_FINISHED: - errmsg = "Unfinished System or Public ID \" or ' expected\n"; - break; - case XML_ERR_MISPLACED_CDATA_END: - errmsg = "Sequence ']]>' not allowed in content\n"; - break; - case XML_ERR_URI_REQUIRED: - errmsg = "SYSTEM or PUBLIC, the URI is missing\n"; - break; - case XML_ERR_PUBID_REQUIRED: - errmsg = "PUBLIC, the Public Identifier is missing\n"; - break; - case XML_ERR_HYPHEN_IN_COMMENT: - errmsg = "Comment must not contain '--' (double-hyphen)\n"; - break; - case XML_ERR_PI_NOT_STARTED: - errmsg = "xmlParsePI : no target name\n"; - break; - case XML_ERR_RESERVED_XML_NAME: - errmsg = "Invalid PI name\n"; - break; - case XML_ERR_NOTATION_NOT_STARTED: - errmsg = "NOTATION: Name expected here\n"; - break; - case XML_ERR_NOTATION_NOT_FINISHED: - errmsg = "'>' required to close NOTATION declaration\n"; - break; - case XML_ERR_VALUE_REQUIRED: - errmsg = "Entity value required\n"; - break; - case XML_ERR_URI_FRAGMENT: - errmsg = "Fragment not allowed"; - break; - case XML_ERR_ATTLIST_NOT_STARTED: - errmsg = "'(' required to start ATTLIST enumeration\n"; - break; - case XML_ERR_NMTOKEN_REQUIRED: - errmsg = "NmToken expected in ATTLIST enumeration\n"; - break; - case XML_ERR_ATTLIST_NOT_FINISHED: - errmsg = "')' required to finish ATTLIST enumeration\n"; - break; - case XML_ERR_MIXED_NOT_STARTED: - errmsg = "MixedContentDecl : '|' or ')*' expected\n"; - break; - case XML_ERR_PCDATA_REQUIRED: - errmsg = "MixedContentDecl : '#PCDATA' expected\n"; - break; - case XML_ERR_ELEMCONTENT_NOT_STARTED: - errmsg = "ContentDecl : Name or '(' expected\n"; - break; - case XML_ERR_ELEMCONTENT_NOT_FINISHED: - errmsg = "ContentDecl : ',' '|' or ')' expected\n"; - break; - case XML_ERR_PEREF_IN_INT_SUBSET: - errmsg = - "PEReference: forbidden within markup decl in internal subset\n"; - break; - case XML_ERR_GT_REQUIRED: - errmsg = "expected '>'\n"; - break; - case XML_ERR_CONDSEC_INVALID: - errmsg = "XML conditional section '[' expected\n"; - break; - case XML_ERR_EXT_SUBSET_NOT_FINISHED: - errmsg = "Content error in the external subset\n"; - break; - case XML_ERR_CONDSEC_INVALID_KEYWORD: - errmsg = - "conditional section INCLUDE or IGNORE keyword expected\n"; - break; - case XML_ERR_CONDSEC_NOT_FINISHED: - errmsg = "XML conditional section not closed\n"; - break; - case XML_ERR_XMLDECL_NOT_STARTED: - errmsg = "Text declaration '' expected\n"; - break; - case XML_ERR_EXT_ENTITY_STANDALONE: - errmsg = "external parsed entities cannot be standalone\n"; - break; - case XML_ERR_ENTITYREF_SEMICOL_MISSING: - errmsg = "EntityRef: expecting ';'\n"; - break; - case XML_ERR_DOCTYPE_NOT_FINISHED: - errmsg = "DOCTYPE improperly terminated\n"; - break; - case XML_ERR_LTSLASH_REQUIRED: - errmsg = "EndTag: 'errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_FATAL, NULL, 0, info, NULL, NULL, 0, 0, errmsg, - info); - if (ctxt != NULL) { - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) - ctxt->disableSAX = 1; - } -} - -/** - * xmlFatalErrMsg: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * - * Handle a fatal parser error, i.e. violating Well-Formedness constraints - */ -static void -xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg); - if (ctxt != NULL) { - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) - ctxt->disableSAX = 1; - } -} - -/** - * xmlWarningMsg: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @str1: extra data - * @str2: extra data - * - * Handle a warning. - */ -static void -xmlWarningMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1, const xmlChar *str2) -{ - xmlStructuredErrorFunc schannel = NULL; - - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if ((ctxt != NULL) && (ctxt->sax != NULL) && - (ctxt->sax->initialized == XML_SAX2_MAGIC)) - schannel = ctxt->sax->serror; - if (ctxt != NULL) { - __xmlRaiseError(schannel, - (ctxt->sax) ? ctxt->sax->warning : NULL, - ctxt->userData, - ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_WARNING, NULL, 0, - (const char *) str1, (const char *) str2, NULL, 0, 0, - msg, (const char *) str1, (const char *) str2); - } else { - __xmlRaiseError(schannel, NULL, NULL, - ctxt, NULL, XML_FROM_PARSER, error, - XML_ERR_WARNING, NULL, 0, - (const char *) str1, (const char *) str2, NULL, 0, 0, - msg, (const char *) str1, (const char *) str2); - } -} - -/** - * xmlValidityError: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @str1: extra data - * - * Handle a validity error. - */ -static void -xmlValidityError(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1, const xmlChar *str2) -{ - xmlStructuredErrorFunc schannel = NULL; - - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) { - ctxt->errNo = error; - if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) - schannel = ctxt->sax->serror; - } - if (ctxt != NULL) { - __xmlRaiseError(schannel, - ctxt->vctxt.error, ctxt->vctxt.userData, - ctxt, NULL, XML_FROM_DTD, error, - XML_ERR_ERROR, NULL, 0, (const char *) str1, - (const char *) str2, NULL, 0, 0, - msg, (const char *) str1, (const char *) str2); - ctxt->valid = 0; - } else { - __xmlRaiseError(schannel, NULL, NULL, - ctxt, NULL, XML_FROM_DTD, error, - XML_ERR_ERROR, NULL, 0, (const char *) str1, - (const char *) str2, NULL, 0, 0, - msg, (const char *) str1, (const char *) str2); - } -} - -/** - * xmlFatalErrMsgInt: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @val: an integer value - * - * Handle a fatal parser error, i.e. violating Well-Formedness constraints - */ -static void -xmlFatalErrMsgInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, int val) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, - ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, - NULL, 0, NULL, NULL, NULL, val, 0, msg, val); - if (ctxt != NULL) { - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) - ctxt->disableSAX = 1; - } -} - -/** - * xmlFatalErrMsgStrIntStr: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @str1: an string info - * @val: an integer value - * @str2: an string info - * - * Handle a fatal parser error, i.e. violating Well-Formedness constraints - */ -static void -xmlFatalErrMsgStrIntStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar *str1, int val, - const xmlChar *str2) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, - ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, - NULL, 0, (const char *) str1, (const char *) str2, - NULL, val, 0, msg, str1, val, str2); - if (ctxt != NULL) { - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) - ctxt->disableSAX = 1; - } -} - -/** - * xmlFatalErrMsgStr: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @val: a string value - * - * Handle a fatal parser error, i.e. violating Well-Formedness constraints - */ -static void -xmlFatalErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar * val) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, - XML_FROM_PARSER, error, XML_ERR_FATAL, - NULL, 0, (const char *) val, NULL, NULL, 0, 0, msg, - val); - if (ctxt != NULL) { - ctxt->wellFormed = 0; - if (ctxt->recovery == 0) - ctxt->disableSAX = 1; - } -} - -/** - * xmlErrMsgStr: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the error message - * @val: a string value - * - * Handle a non fatal parser error - */ -static void -xmlErrMsgStr(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const xmlChar * val) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, - XML_FROM_PARSER, error, XML_ERR_ERROR, - NULL, 0, (const char *) val, NULL, NULL, 0, 0, msg, - val); -} - -/** - * xmlNsErr: - * @ctxt: an XML parser context - * @error: the error number - * @msg: the message - * @info1: extra information string - * @info2: extra information string - * - * Handle a fatal parser error, i.e. violating Well-Formedness constraints - */ -static void -xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, - const xmlChar * info1, const xmlChar * info2, - const xmlChar * info3) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if (ctxt != NULL) - ctxt->errNo = error; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, - XML_ERR_ERROR, NULL, 0, (const char *) info1, - (const char *) info2, (const char *) info3, 0, 0, msg, - info1, info2, info3); - if (ctxt != NULL) - ctxt->nsWellFormed = 0; -} - -/** - * xmlNsWarn - * @ctxt: an XML parser context - * @error: the error number - * @msg: the message - * @info1: extra information string - * @info2: extra information string - * - * Handle a fatal parser error, i.e. violating Well-Formedness constraints - */ -static void -xmlNsWarn(xmlParserCtxtPtr ctxt, xmlParserErrors error, - const char *msg, - const xmlChar * info1, const xmlChar * info2, - const xmlChar * info3) -{ - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, - XML_ERR_WARNING, NULL, 0, (const char *) info1, - (const char *) info2, (const char *) info3, 0, 0, msg, - info1, info2, info3); -} - -/************************************************************************ - * * - * Library wide options * - * * - ************************************************************************/ - -/** - * xmlHasFeature: - * @feature: the feature to be examined - * - * Examines if the library has been compiled with a given feature. - * - * Returns a non-zero value if the feature exist, otherwise zero. - * Returns zero (0) if the feature does not exist or an unknown - * unknown feature is requested, non-zero otherwise. - */ -int -xmlHasFeature(xmlFeature feature) -{ - switch (feature) { - case XML_WITH_THREAD: - return(0); - case XML_WITH_TREE: -#ifdef LIBXML_TREE_ENABLED - return(1); -#else - return(0); -#endif - case XML_WITH_OUTPUT: - return(0); - case XML_WITH_PUSH: -#ifdef LIBXML_PUSH_ENABLED - return(1); -#else - return(0); -#endif - case XML_WITH_READER: -#ifdef LIBXML_READER_ENABLED - return(1); -#else - return(0); -#endif - case XML_WITH_PATTERN: - return(0); - case XML_WITH_WRITER: - return(0); - case XML_WITH_SAX1: - return(0); - case XML_WITH_FTP: - return(0); - case XML_WITH_HTTP: - return(0); - case XML_WITH_VALID: - return(0); - case XML_WITH_HTML: - return(0); - case XML_WITH_LEGACY: - return(0); - case XML_WITH_C14N: - return(0); - case XML_WITH_CATALOG: - return(0); - case XML_WITH_XPATH: - return(0); - case XML_WITH_XPTR: - return(0); - case XML_WITH_XINCLUDE: - return(0); - case XML_WITH_ICONV: - return(0); - case XML_WITH_ISO8859X: -#ifdef LIBXML_ISO8859X_ENABLED - return(1); -#else - return(0); -#endif - case XML_WITH_UNICODE: - return(0); - case XML_WITH_REGEXP: - return(0); - case XML_WITH_AUTOMATA: - return(0); - case XML_WITH_EXPR: - return(0); - case XML_WITH_SCHEMAS: - return(0); - case XML_WITH_SCHEMATRON: - return(0); - case XML_WITH_MODULES: - return(0); - case XML_WITH_DEBUG: - return(0); - case XML_WITH_DEBUG_MEM: - return(0); - case XML_WITH_DEBUG_RUN: - return(0); - case XML_WITH_ZLIB: - return(0); - case XML_WITH_LZMA: -#ifdef LIBXML_LZMA_ENABLED - return(1); -#else - return(0); -#endif - case XML_WITH_ICU: - return(0); - default: - break; - } - return(0); -} - -/************************************************************************ - * * - * SAX2 defaulted attributes handling * - * * - ************************************************************************/ - -/** - * xmlDetectSAX2: - * @ctxt: an XML parser context - * - * Do the SAX2 detection and specific intialization - */ -static void -xmlDetectSAX2(xmlParserCtxtPtr ctxt) { - if (ctxt == NULL) return; - ctxt->sax2 = 1; - - ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3); - ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5); - ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); - if ((ctxt->str_xml==NULL) || (ctxt->str_xmlns==NULL) || - (ctxt->str_xml_ns == NULL)) { - xmlErrMemory(ctxt, NULL); - } -} - -typedef struct _xmlDefAttrs xmlDefAttrs; -typedef xmlDefAttrs *xmlDefAttrsPtr; -struct _xmlDefAttrs { - int nbAttrs; /* number of defaulted attributes on that element */ - int maxAttrs; /* the size of the array */ - const xmlChar *values[5]; /* array of localname/prefix/values/external */ -}; - -/** - * xmlAttrNormalizeSpace: - * @src: the source string - * @dst: the target string - * - * Normalize the space in non CDATA attribute values: - * If the attribute type is not CDATA, then the XML processor MUST further - * process the normalized attribute value by discarding any leading and - * trailing space (#x20) characters, and by replacing sequences of space - * (#x20) characters by a single space (#x20) character. - * Note that the size of dst need to be at least src, and if one doesn't need - * to preserve dst (and it doesn't come from a dictionary or read-only) then - * passing src as dst is just fine. - * - * Returns a pointer to the normalized value (dst) or NULL if no conversion - * is needed. - */ -static xmlChar * -xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst) -{ - if ((src == NULL) || (dst == NULL)) - return(NULL); - - while (*src == 0x20) src++; - while (*src != 0) { - if (*src == 0x20) { - while (*src == 0x20) src++; - if (*src != 0) - *dst++ = 0x20; - } else { - *dst++ = *src++; - } - } - *dst = 0; - if (dst == src) - return(NULL); - return(dst); -} - -/** - * xmlAttrNormalizeSpace2: - * @src: the source string - * - * Normalize the space in non CDATA attribute values, a slightly more complex - * front end to avoid allocation problems when running on attribute values - * coming from the input. - * - * Returns a pointer to the normalized value (dst) or NULL if no conversion - * is needed. - */ -static const xmlChar * -xmlAttrNormalizeSpace2(xmlParserCtxtPtr ctxt, xmlChar *src, int *len) -{ - int i; - int remove_head = 0; - int need_realloc = 0; - const xmlChar *cur; - - if ((ctxt == NULL) || (src == NULL) || (len == NULL)) - return(NULL); - i = *len; - if (i <= 0) - return(NULL); - - cur = src; - while (*cur == 0x20) { - cur++; - remove_head++; - } - while (*cur != 0) { - if (*cur == 0x20) { - cur++; - if ((*cur == 0x20) || (*cur == 0)) { - need_realloc = 1; - break; - } - } else - cur++; - } - if (need_realloc) { - xmlChar *ret; - - ret = xmlStrndup(src + remove_head, i - remove_head + 1); - if (ret == NULL) { - xmlErrMemory(ctxt, NULL); - return(NULL); - } - xmlAttrNormalizeSpace(ret, ret); - *len = (int) strlen((const char *)ret); - return(ret); - } else if (remove_head) { - *len -= remove_head; - memmove(src, src + remove_head, 1 + *len); - return(src); - } - return(NULL); -} - -/** - * xmlAddDefAttrs: - * @ctxt: an XML parser context - * @fullname: the element fullname - * @fullattr: the attribute fullname - * @value: the attribute value - * - * Add a defaulted attribute for an element - */ -static void -xmlAddDefAttrs(xmlParserCtxtPtr ctxt, - const xmlChar *fullname, - const xmlChar *fullattr, - const xmlChar *value) { - xmlDefAttrsPtr defaults; - int len; - const xmlChar *name; - const xmlChar *prefix; - - /* - * Allows to detect attribute redefinitions - */ - if (ctxt->attsSpecial != NULL) { - if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL) - return; - } - - if (ctxt->attsDefault == NULL) { - ctxt->attsDefault = xmlHashCreateDict(10, ctxt->dict); - if (ctxt->attsDefault == NULL) - goto mem_error; - } - - /* - * split the element name into prefix:localname , the string found - * are within the DTD and then not associated to namespace names. - */ - name = xmlSplitQName3(fullname, &len); - if (name == NULL) { - name = xmlDictLookup(ctxt->dict, fullname, -1); - prefix = NULL; - } else { - name = xmlDictLookup(ctxt->dict, name, -1); - prefix = xmlDictLookup(ctxt->dict, fullname, len); - } - - /* - * make sure there is some storage - */ - defaults = xmlHashLookup2(ctxt->attsDefault, name, prefix); - if (defaults == NULL) { - defaults = (xmlDefAttrsPtr) xmlMalloc(sizeof(xmlDefAttrs) + - (4 * 5) * sizeof(const xmlChar *)); - if (defaults == NULL) - goto mem_error; - defaults->nbAttrs = 0; - defaults->maxAttrs = 4; - if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, - defaults, NULL) < 0) { - xmlFree(defaults); - goto mem_error; - } - } else if (defaults->nbAttrs >= defaults->maxAttrs) { - xmlDefAttrsPtr temp; - - temp = (xmlDefAttrsPtr) xmlRealloc(defaults, sizeof(xmlDefAttrs) + - (2 * defaults->maxAttrs * 5) * sizeof(const xmlChar *)); - if (temp == NULL) - goto mem_error; - defaults = temp; - defaults->maxAttrs *= 2; - if (xmlHashUpdateEntry2(ctxt->attsDefault, name, prefix, - defaults, NULL) < 0) { - xmlFree(defaults); - goto mem_error; - } - } - - /* - * Split the element name into prefix:localname , the string found - * are within the DTD and hen not associated to namespace names. - */ - name = xmlSplitQName3(fullattr, &len); - if (name == NULL) { - name = xmlDictLookup(ctxt->dict, fullattr, -1); - prefix = NULL; - } else { - name = xmlDictLookup(ctxt->dict, name, -1); - prefix = xmlDictLookup(ctxt->dict, fullattr, len); - } - - defaults->values[5 * defaults->nbAttrs] = name; - defaults->values[5 * defaults->nbAttrs + 1] = prefix; - /* intern the string and precompute the end */ - len = xmlStrlen(value); - value = xmlDictLookup(ctxt->dict, value, len); - defaults->values[5 * defaults->nbAttrs + 2] = value; - defaults->values[5 * defaults->nbAttrs + 3] = value + len; - if (ctxt->external) - defaults->values[5 * defaults->nbAttrs + 4] = BAD_CAST "external"; - else - defaults->values[5 * defaults->nbAttrs + 4] = NULL; - defaults->nbAttrs++; - - return; - -mem_error: - xmlErrMemory(ctxt, NULL); - return; -} - -/** - * xmlAddSpecialAttr: - * @ctxt: an XML parser context - * @fullname: the element fullname - * @fullattr: the attribute fullname - * @type: the attribute type - * - * Register this attribute type - */ -static void -xmlAddSpecialAttr(xmlParserCtxtPtr ctxt, - const xmlChar *fullname, - const xmlChar *fullattr, - int type) -{ - if (ctxt->attsSpecial == NULL) { - ctxt->attsSpecial = xmlHashCreateDict(10, ctxt->dict); - if (ctxt->attsSpecial == NULL) - goto mem_error; - } - - if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL) - return; - - xmlHashAddEntry2(ctxt->attsSpecial, fullname, fullattr, - (void *) (long) type); - return; - -mem_error: - xmlErrMemory(ctxt, NULL); - return; -} - -/** - * xmlCleanSpecialAttrCallback: - * - * Removes CDATA attributes from the special attribute table - */ -static void -xmlCleanSpecialAttrCallback(void *payload, void *data, - const xmlChar *fullname, const xmlChar *fullattr, - const xmlChar *unused ATTRIBUTE_UNUSED) { - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) data; - - if (((long) payload) == XML_ATTRIBUTE_CDATA) { - xmlHashRemoveEntry2(ctxt->attsSpecial, fullname, fullattr, NULL); - } -} - -/** - * xmlCleanSpecialAttr: - * @ctxt: an XML parser context - * - * Trim the list of attributes defined to remove all those of type - * CDATA as they are not special. This call should be done when finishing - * to parse the DTD and before starting to parse the document root. - */ -static void -xmlCleanSpecialAttr(xmlParserCtxtPtr ctxt) -{ - if (ctxt->attsSpecial == NULL) - return; - - xmlHashScanFull(ctxt->attsSpecial, xmlCleanSpecialAttrCallback, ctxt); - - if (xmlHashSize(ctxt->attsSpecial) == 0) { - xmlHashFree(ctxt->attsSpecial, NULL); - ctxt->attsSpecial = NULL; - } - return; -} - -/** - * xmlCheckLanguageID: - * @lang: pointer to the string value - * - * Checks that the value conforms to the LanguageID production: - * - * NOTE: this is somewhat deprecated, those productions were removed from - * the XML Second edition. - * - * [33] LanguageID ::= Langcode ('-' Subcode)* - * [34] Langcode ::= ISO639Code | IanaCode | UserCode - * [35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z]) - * [36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+ - * [37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+ - * [38] Subcode ::= ([a-z] | [A-Z])+ - * - * The current REC reference the sucessors of RFC 1766, currently 5646 - * - * http://www.rfc-editor.org/rfc/rfc5646.txt - * langtag = language - * ["-" script] - * ["-" region] - * *("-" variant) - * *("-" extension) - * ["-" privateuse] - * language = 2*3ALPHA ; shortest ISO 639 code - * ["-" extlang] ; sometimes followed by - * ; extended language subtags - * / 4ALPHA ; or reserved for future use - * / 5*8ALPHA ; or registered language subtag - * - * extlang = 3ALPHA ; selected ISO 639 codes - * *2("-" 3ALPHA) ; permanently reserved - * - * script = 4ALPHA ; ISO 15924 code - * - * region = 2ALPHA ; ISO 3166-1 code - * / 3DIGIT ; UN M.49 code - * - * variant = 5*8alphanum ; registered variants - * / (DIGIT 3alphanum) - * - * extension = singleton 1*("-" (2*8alphanum)) - * - * ; Single alphanumerics - * ; "x" reserved for private use - * singleton = DIGIT ; 0 - 9 - * / %x41-57 ; A - W - * / %x59-5A ; Y - Z - * / %x61-77 ; a - w - * / %x79-7A ; y - z - * - * it sounds right to still allow Irregular i-xxx IANA and user codes too - * The parser below doesn't try to cope with extension or privateuse - * that could be added but that's not interoperable anyway - * - * Returns 1 if correct 0 otherwise - **/ -int -xmlCheckLanguageID(const xmlChar * lang) -{ - const xmlChar *cur = lang, *nxt; - - if (cur == NULL) - return (0); - if (((cur[0] == 'i') && (cur[1] == '-')) || - ((cur[0] == 'I') && (cur[1] == '-')) || - ((cur[0] == 'x') && (cur[1] == '-')) || - ((cur[0] == 'X') && (cur[1] == '-'))) { - /* - * Still allow IANA code and user code which were coming - * from the previous version of the XML-1.0 specification - * it's deprecated but we should not fail - */ - cur += 2; - while (((cur[0] >= 'A') && (cur[0] <= 'Z')) || - ((cur[0] >= 'a') && (cur[0] <= 'z'))) - cur++; - return(cur[0] == 0); - } - nxt = cur; - while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || - ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) - nxt++; - if (nxt - cur >= 4) { - /* - * Reserved - */ - if ((nxt - cur > 8) || (nxt[0] != 0)) - return(0); - return(1); - } - if (nxt - cur < 2) - return(0); - /* we got an ISO 639 code */ - if (nxt[0] == 0) - return(1); - if (nxt[0] != '-') - return(0); - - nxt++; - cur = nxt; - /* now we can have extlang or script or region or variant */ - if ((nxt[0] >= '0') && (nxt[0] <= '9')) - goto region_m49; - - while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || - ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) - nxt++; - if (nxt - cur == 4) - goto script; - if (nxt - cur == 2) - goto region; - if ((nxt - cur >= 5) && (nxt - cur <= 8)) - goto variant; - if (nxt - cur != 3) - return(0); - /* we parsed an extlang */ - if (nxt[0] == 0) - return(1); - if (nxt[0] != '-') - return(0); - - nxt++; - cur = nxt; - /* now we can have script or region or variant */ - if ((nxt[0] >= '0') && (nxt[0] <= '9')) - goto region_m49; - - while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || - ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) - nxt++; - if (nxt - cur == 2) - goto region; - if ((nxt - cur >= 5) && (nxt - cur <= 8)) - goto variant; - if (nxt - cur != 4) - return(0); - /* we parsed a script */ -script: - if (nxt[0] == 0) - return(1); - if (nxt[0] != '-') - return(0); - - nxt++; - cur = nxt; - /* now we can have region or variant */ - if ((nxt[0] >= '0') && (nxt[0] <= '9')) - goto region_m49; - - while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || - ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) - nxt++; - - if ((nxt - cur >= 5) && (nxt - cur <= 8)) - goto variant; - if (nxt - cur != 2) - return(0); - /* we parsed a region */ -region: - if (nxt[0] == 0) - return(1); - if (nxt[0] != '-') - return(0); - - nxt++; - cur = nxt; - /* now we can just have a variant */ - while (((nxt[0] >= 'A') && (nxt[0] <= 'Z')) || - ((nxt[0] >= 'a') && (nxt[0] <= 'z'))) - nxt++; - - if ((nxt - cur < 5) || (nxt - cur > 8)) - return(0); - - /* we parsed a variant */ -variant: - if (nxt[0] == 0) - return(1); - if (nxt[0] != '-') - return(0); - /* extensions and private use subtags not checked */ - return (1); - -region_m49: - if (((nxt[1] >= '0') && (nxt[1] <= '9')) && - ((nxt[2] >= '0') && (nxt[2] <= '9'))) { - nxt += 3; - goto region; - } - return(0); -} - -/************************************************************************ - * * - * Parser stacks related functions and macros * - * * - ************************************************************************/ - -static xmlEntityPtr xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, - const xmlChar ** str); - -#ifdef SAX2 -/** - * nsPush: - * @ctxt: an XML parser context - * @prefix: the namespace prefix or NULL - * @URL: the namespace name - * - * Pushes a new parser namespace on top of the ns stack - * - * Returns -1 in case of error, -2 if the namespace should be discarded - * and the index in the stack otherwise. - */ -static int -nsPush(xmlParserCtxtPtr ctxt, const xmlChar *prefix, const xmlChar *URL) -{ - if (ctxt->options & XML_PARSE_NSCLEAN) { - int i; - for (i = 0;i < ctxt->nsNr;i += 2) { - if (ctxt->nsTab[i] == prefix) { - /* in scope */ - if (ctxt->nsTab[i + 1] == URL) - return(-2); - /* out of scope keep it */ - break; - } - } - } - if ((ctxt->nsMax == 0) || (ctxt->nsTab == NULL)) { - ctxt->nsMax = 10; - ctxt->nsNr = 0; - ctxt->nsTab = (const xmlChar **) - xmlMalloc(ctxt->nsMax * sizeof(xmlChar *)); - if (ctxt->nsTab == NULL) { - xmlErrMemory(ctxt, NULL); - ctxt->nsMax = 0; - return (-1); - } - } else if (ctxt->nsNr >= ctxt->nsMax) { - const xmlChar ** tmp; - ctxt->nsMax *= 2; - tmp = (const xmlChar **) xmlRealloc((char *) ctxt->nsTab, - ctxt->nsMax * sizeof(ctxt->nsTab[0])); - if (tmp == NULL) { - xmlErrMemory(ctxt, NULL); - ctxt->nsMax /= 2; - return (-1); - } - ctxt->nsTab = tmp; - } - ctxt->nsTab[ctxt->nsNr++] = prefix; - ctxt->nsTab[ctxt->nsNr++] = URL; - return (ctxt->nsNr); -} -/** - * nsPop: - * @ctxt: an XML parser context - * @nr: the number to pop - * - * Pops the top @nr parser prefix/namespace from the ns stack - * - * Returns the number of namespaces removed - */ -static int -nsPop(xmlParserCtxtPtr ctxt, int nr) -{ - int i; - - if (ctxt->nsTab == NULL) return(0); - if (ctxt->nsNr < nr) { - xmlGenericError(xmlGenericErrorContext, "Pbm popping %d NS\n", nr); - nr = ctxt->nsNr; - } - if (ctxt->nsNr <= 0) - return (0); - - for (i = 0;i < nr;i++) { - ctxt->nsNr--; - ctxt->nsTab[ctxt->nsNr] = NULL; - } - return(nr); -} -#endif - -static int -xmlCtxtGrowAttrs(xmlParserCtxtPtr ctxt, int nr) { - const xmlChar **atts; - int *attallocs; - int maxatts; - - if (ctxt->atts == NULL) { - maxatts = 55; /* allow for 10 attrs by default */ - atts = (const xmlChar **) - xmlMalloc(maxatts * sizeof(xmlChar *)); - if (atts == NULL) goto mem_error; - ctxt->atts = atts; - attallocs = (int *) xmlMalloc((maxatts / 5) * sizeof(int)); - if (attallocs == NULL) goto mem_error; - ctxt->attallocs = attallocs; - ctxt->maxatts = maxatts; - } else if (nr + 5 > ctxt->maxatts) { - maxatts = (nr + 5) * 2; - atts = (const xmlChar **) xmlRealloc((void *) ctxt->atts, - maxatts * sizeof(const xmlChar *)); - if (atts == NULL) goto mem_error; - ctxt->atts = atts; - attallocs = (int *) xmlRealloc((void *) ctxt->attallocs, - (maxatts / 5) * sizeof(int)); - if (attallocs == NULL) goto mem_error; - ctxt->attallocs = attallocs; - ctxt->maxatts = maxatts; - } - return(ctxt->maxatts); -mem_error: - xmlErrMemory(ctxt, NULL); - return(-1); -} - -/** - * inputPush: - * @ctxt: an XML parser context - * @value: the parser input - * - * Pushes a new parser input on top of the input stack - * - * Returns -1 in case of error, the index in the stack otherwise - */ -int -inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value) -{ - if ((ctxt == NULL) || (value == NULL)) - return(-1); - if (ctxt->inputNr >= ctxt->inputMax) { - ctxt->inputMax *= 2; - ctxt->inputTab = - (xmlParserInputPtr *) xmlRealloc(ctxt->inputTab, - ctxt->inputMax * - sizeof(ctxt->inputTab[0])); - if (ctxt->inputTab == NULL) { - xmlErrMemory(ctxt, NULL); - xmlFreeInputStream(value); - ctxt->inputMax /= 2; - value = NULL; - return (-1); - } - } - ctxt->inputTab[ctxt->inputNr] = value; - ctxt->input = value; - return (ctxt->inputNr++); -} -/** - * inputPop: - * @ctxt: an XML parser context - * - * Pops the top parser input from the input stack - * - * Returns the input just removed - */ -xmlParserInputPtr -inputPop(xmlParserCtxtPtr ctxt) -{ - xmlParserInputPtr ret; - - if (ctxt == NULL) - return(NULL); - if (ctxt->inputNr <= 0) - return (NULL); - ctxt->inputNr--; - if (ctxt->inputNr > 0) - ctxt->input = ctxt->inputTab[ctxt->inputNr - 1]; - else - ctxt->input = NULL; - ret = ctxt->inputTab[ctxt->inputNr]; - ctxt->inputTab[ctxt->inputNr] = NULL; - return (ret); -} -/** - * nodePush: - * @ctxt: an XML parser context - * @value: the element node - * - * Pushes a new element node on top of the node stack - * - * Returns -1 in case of error, the index in the stack otherwise - */ -int -nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value) -{ - if (ctxt == NULL) return(0); - if (ctxt->nodeNr >= ctxt->nodeMax) { - xmlNodePtr *tmp; - - tmp = (xmlNodePtr *) xmlRealloc(ctxt->nodeTab, - ctxt->nodeMax * 2 * - sizeof(ctxt->nodeTab[0])); - if (tmp == NULL) { - xmlErrMemory(ctxt, NULL); - return (-1); - } - ctxt->nodeTab = tmp; - ctxt->nodeMax *= 2; - } - if ((((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) { - xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, - "Excessive depth in document: %d use XML_PARSE_HUGE option\n", - xmlParserMaxDepth); - ctxt->instate = XML_PARSER_EOF; - return(-1); - } - ctxt->nodeTab[ctxt->nodeNr] = value; - ctxt->node = value; - return (ctxt->nodeNr++); -} - -/** - * nodePop: - * @ctxt: an XML parser context - * - * Pops the top element node from the node stack - * - * Returns the node just removed - */ -xmlNodePtr -nodePop(xmlParserCtxtPtr ctxt) -{ - xmlNodePtr ret; - - if (ctxt == NULL) return(NULL); - if (ctxt->nodeNr <= 0) - return (NULL); - ctxt->nodeNr--; - if (ctxt->nodeNr > 0) - ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1]; - else - ctxt->node = NULL; - ret = ctxt->nodeTab[ctxt->nodeNr]; - ctxt->nodeTab[ctxt->nodeNr] = NULL; - return (ret); -} - -#ifdef LIBXML_PUSH_ENABLED -/** - * nameNsPush: - * @ctxt: an XML parser context - * @value: the element name - * @prefix: the element prefix - * @URI: the element namespace name - * - * Pushes a new element name/prefix/URL on top of the name stack - * - * Returns -1 in case of error, the index in the stack otherwise - */ -static int -nameNsPush(xmlParserCtxtPtr ctxt, const xmlChar * value, - const xmlChar *prefix, const xmlChar *URI, int nsNr) -{ - if (ctxt->nameNr >= ctxt->nameMax) { - const xmlChar * *tmp; - void **tmp2; - ctxt->nameMax *= 2; - tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab, - ctxt->nameMax * - sizeof(ctxt->nameTab[0])); - if (tmp == NULL) { - ctxt->nameMax /= 2; - goto mem_error; - } - ctxt->nameTab = tmp; - tmp2 = (void **) xmlRealloc((void * *)ctxt->pushTab, - ctxt->nameMax * 3 * - sizeof(ctxt->pushTab[0])); - if (tmp2 == NULL) { - ctxt->nameMax /= 2; - goto mem_error; - } - ctxt->pushTab = tmp2; - } - ctxt->nameTab[ctxt->nameNr] = value; - ctxt->name = value; - ctxt->pushTab[ctxt->nameNr * 3] = (void *) prefix; - ctxt->pushTab[ctxt->nameNr * 3 + 1] = (void *) URI; - ctxt->pushTab[ctxt->nameNr * 3 + 2] = (void *) (long) nsNr; - return (ctxt->nameNr++); -mem_error: - xmlErrMemory(ctxt, NULL); - return (-1); -} -/** - * nameNsPop: - * @ctxt: an XML parser context - * - * Pops the top element/prefix/URI name from the name stack - * - * Returns the name just removed - */ -static const xmlChar * -nameNsPop(xmlParserCtxtPtr ctxt) -{ - const xmlChar *ret; - - if (ctxt->nameNr <= 0) - return (NULL); - ctxt->nameNr--; - if (ctxt->nameNr > 0) - ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; - else - ctxt->name = NULL; - ret = ctxt->nameTab[ctxt->nameNr]; - ctxt->nameTab[ctxt->nameNr] = NULL; - return (ret); -} -#endif /* LIBXML_PUSH_ENABLED */ - -/** - * namePush: - * @ctxt: an XML parser context - * @value: the element name - * - * Pushes a new element name on top of the name stack - * - * Returns -1 in case of error, the index in the stack otherwise - */ -int -namePush(xmlParserCtxtPtr ctxt, const xmlChar * value) -{ - if (ctxt == NULL) return (-1); - - if (ctxt->nameNr >= ctxt->nameMax) { - const xmlChar * *tmp; - tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab, - ctxt->nameMax * 2 * - sizeof(ctxt->nameTab[0])); - if (tmp == NULL) { - goto mem_error; - } - ctxt->nameTab = tmp; - ctxt->nameMax *= 2; - } - ctxt->nameTab[ctxt->nameNr] = value; - ctxt->name = value; - return (ctxt->nameNr++); -mem_error: - xmlErrMemory(ctxt, NULL); - return (-1); -} -/** - * namePop: - * @ctxt: an XML parser context - * - * Pops the top element name from the name stack - * - * Returns the name just removed - */ -const xmlChar * -namePop(xmlParserCtxtPtr ctxt) -{ - const xmlChar *ret; - - if ((ctxt == NULL) || (ctxt->nameNr <= 0)) - return (NULL); - ctxt->nameNr--; - if (ctxt->nameNr > 0) - ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; - else - ctxt->name = NULL; - ret = ctxt->nameTab[ctxt->nameNr]; - ctxt->nameTab[ctxt->nameNr] = NULL; - return (ret); -} - -static int spacePush(xmlParserCtxtPtr ctxt, int val) { - if (ctxt->spaceNr >= ctxt->spaceMax) { - int *tmp; - - ctxt->spaceMax *= 2; - tmp = (int *) xmlRealloc(ctxt->spaceTab, - ctxt->spaceMax * sizeof(ctxt->spaceTab[0])); - if (tmp == NULL) { - xmlErrMemory(ctxt, NULL); - ctxt->spaceMax /=2; - return(-1); - } - ctxt->spaceTab = tmp; - } - ctxt->spaceTab[ctxt->spaceNr] = val; - ctxt->space = &ctxt->spaceTab[ctxt->spaceNr]; - return(ctxt->spaceNr++); -} - -static int spacePop(xmlParserCtxtPtr ctxt) { - int ret; - if (ctxt->spaceNr <= 0) return(0); - ctxt->spaceNr--; - if (ctxt->spaceNr > 0) - ctxt->space = &ctxt->spaceTab[ctxt->spaceNr - 1]; - else - ctxt->space = &ctxt->spaceTab[0]; - ret = ctxt->spaceTab[ctxt->spaceNr]; - ctxt->spaceTab[ctxt->spaceNr] = -1; - return(ret); -} - -/* - * Macros for accessing the content. Those should be used only by the parser, - * and not exported. - * - * Dirty macros, i.e. one often need to make assumption on the context to - * use them - * - * CUR_PTR return the current pointer to the xmlChar to be parsed. - * To be used with extreme caution since operations consuming - * characters may move the input buffer to a different location ! - * CUR returns the current xmlChar value, i.e. a 8 bit value if compiled - * This should be used internally by the parser - * only to compare to ASCII values otherwise it would break when - * running with UTF-8 encoding. - * RAW same as CUR but in the input buffer, bypass any token - * extraction that may have been done - * NXT(n) returns the n'th next xmlChar. Same as CUR is should be used only - * to compare on ASCII based substring. - * SKIP(n) Skip n xmlChar, and must also be used only to skip ASCII defined - * strings without newlines within the parser. - * NEXT1(l) Skip 1 xmlChar, and must also be used only to skip 1 non-newline ASCII - * defined char within the parser. - * Clean macros, not dependent of an ASCII context, expect UTF-8 encoding - * - * NEXT Skip to the next character, this does the proper decoding - * in UTF-8 mode. It also pop-up unfinished entities on the fly. - * NEXTL(l) Skip the current unicode character of l xmlChars long. - * CUR_CHAR(l) returns the current unicode character (int), set l - * to the number of xmlChars used for the encoding [0-5]. - * CUR_SCHAR same but operate on a string instead of the context - * COPY_BUF copy the current unicode char to the target buffer, increment - * the index - * GROW, SHRINK handling of input buffers - */ - -#define RAW (*ctxt->input->cur) -#define CUR (*ctxt->input->cur) -#define NXT(val) ctxt->input->cur[(val)] -#define CUR_PTR ctxt->input->cur - -#define CMP4( s, c1, c2, c3, c4 ) \ - ( ((unsigned char *) s)[ 0 ] == c1 && ((unsigned char *) s)[ 1 ] == c2 && \ - ((unsigned char *) s)[ 2 ] == c3 && ((unsigned char *) s)[ 3 ] == c4 ) -#define CMP5( s, c1, c2, c3, c4, c5 ) \ - ( CMP4( s, c1, c2, c3, c4 ) && ((unsigned char *) s)[ 4 ] == c5 ) -#define CMP6( s, c1, c2, c3, c4, c5, c6 ) \ - ( CMP5( s, c1, c2, c3, c4, c5 ) && ((unsigned char *) s)[ 5 ] == c6 ) -#define CMP7( s, c1, c2, c3, c4, c5, c6, c7 ) \ - ( CMP6( s, c1, c2, c3, c4, c5, c6 ) && ((unsigned char *) s)[ 6 ] == c7 ) -#define CMP8( s, c1, c2, c3, c4, c5, c6, c7, c8 ) \ - ( CMP7( s, c1, c2, c3, c4, c5, c6, c7 ) && ((unsigned char *) s)[ 7 ] == c8 ) -#define CMP9( s, c1, c2, c3, c4, c5, c6, c7, c8, c9 ) \ - ( CMP8( s, c1, c2, c3, c4, c5, c6, c7, c8 ) && \ - ((unsigned char *) s)[ 8 ] == c9 ) -#define CMP10( s, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 ) \ - ( CMP9( s, c1, c2, c3, c4, c5, c6, c7, c8, c9 ) && \ - ((unsigned char *) s)[ 9 ] == c10 ) - -#define SKIP(val) do { \ - ctxt->nbChars += (val),ctxt->input->cur += (val),ctxt->input->col+=(val); \ - if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \ - if ((*ctxt->input->cur == 0) && \ - (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) \ - xmlPopInput(ctxt); \ - } while (0) - -#define SKIPL(val) do { \ - int skipl; \ - for(skipl=0; skiplinput->cur) == '\n') { \ - ctxt->input->line++; ctxt->input->col = 1; \ - } else ctxt->input->col++; \ - ctxt->nbChars++; \ - ctxt->input->cur++; \ - } \ - if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \ - if ((*ctxt->input->cur == 0) && \ - (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) \ - xmlPopInput(ctxt); \ - } while (0) - -#define SHRINK if ((ctxt->progressive == 0) && \ - (ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \ - (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \ - xmlSHRINK (ctxt); - -static void xmlSHRINK (xmlParserCtxtPtr ctxt) { - xmlParserInputShrink(ctxt->input); - if ((*ctxt->input->cur == 0) && - (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) - xmlPopInput(ctxt); - } - -#define GROW if ((ctxt->progressive == 0) && \ - (ctxt->input->end - ctxt->input->cur < INPUT_CHUNK)) \ - xmlGROW (ctxt); - -static void xmlGROW (xmlParserCtxtPtr ctxt) { - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - if ((ctxt->input->cur != NULL) && (*ctxt->input->cur == 0) && - (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) - xmlPopInput(ctxt); -} - -#define SKIP_BLANKS xmlSkipBlankChars(ctxt) - -#define NEXT xmlNextChar(ctxt) - -#define NEXT1 { \ - ctxt->input->col++; \ - ctxt->input->cur++; \ - ctxt->nbChars++; \ - if (*ctxt->input->cur == 0) \ - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \ - } - -#define NEXTL(l) do { \ - if (*(ctxt->input->cur) == '\n') { \ - ctxt->input->line++; ctxt->input->col = 1; \ - } else ctxt->input->col++; \ - ctxt->input->cur += l; \ - if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); \ - } while (0) - -#define CUR_CHAR(l) xmlCurrentChar(ctxt, &l) -#define CUR_SCHAR(s, l) xmlStringCurrentChar(ctxt, s, &l) - -#define COPY_BUF(l,b,i,v) \ - if (l == 1) b[i++] = (xmlChar) v; \ - else i += xmlCopyCharMultiByte(&b[i],v) - -/** - * xmlSkipBlankChars: - * @ctxt: the XML parser context - * - * skip all blanks character found at that point in the input streams. - * It pops up finished entities in the process if allowable at that point. - * - * Returns the number of space chars skipped - */ - -int -xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { - int res = 0; - - /* - * It's Okay to use CUR/NEXT here since all the blanks are on - * the ASCII range. - */ - if ((ctxt->inputNr == 1) && (ctxt->instate != XML_PARSER_DTD)) { - const xmlChar *cur; - /* - * if we are in the document content, go really fast - */ - cur = ctxt->input->cur; - while (IS_BLANK_CH(*cur)) { - if (*cur == '\n') { - ctxt->input->line++; ctxt->input->col = 1; - } - cur++; - res++; - if (*cur == 0) { - ctxt->input->cur = cur; - xmlParserInputGrow(ctxt->input, INPUT_CHUNK); - cur = ctxt->input->cur; - } - } - ctxt->input->cur = cur; - } else { - int cur; - do { - cur = CUR; - while (IS_BLANK_CH(cur)) { /* CHECKED tstblanks.xml */ - NEXT; - cur = CUR; - res++; - } - while ((cur == 0) && (ctxt->inputNr > 1) && - (ctxt->instate != XML_PARSER_COMMENT)) { - xmlPopInput(ctxt); - cur = CUR; - } - /* - * Need to handle support of entities branching here - */ - if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt); - } while (IS_BLANK(cur)); /* CHECKED tstblanks.xml */ - } - return(res); -} - -/************************************************************************ - * * - * Commodity functions to handle entities * - * * - ************************************************************************/ - -/** - * xmlPopInput: - * @ctxt: an XML parser context - * - * xmlPopInput: the current input pointed by ctxt->input came to an end - * pop it and return the next char. - * - * Returns the current xmlChar in the parser context - */ -xmlChar -xmlPopInput(xmlParserCtxtPtr ctxt) { - if ((ctxt == NULL) || (ctxt->inputNr <= 1)) return(0); - if (xmlParserDebugEntities) - xmlGenericError(xmlGenericErrorContext, - "Popping input %d\n", ctxt->inputNr); - xmlFreeInputStream(inputPop(ctxt)); - if ((*ctxt->input->cur == 0) && - (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) - return(xmlPopInput(ctxt)); - return(CUR); -} - -/** - * xmlPushInput: - * @ctxt: an XML parser context - * @input: an XML parser input fragment (entity, XML fragment ...). - * - * xmlPushInput: switch to a new input stream which is stacked on top - * of the previous one(s). - * Returns -1 in case of error or the index in the input stack - */ -int -xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input) { - int ret; - if (input == NULL) return(-1); - - if (xmlParserDebugEntities) { - if ((ctxt->input != NULL) && (ctxt->input->filename)) - xmlGenericError(xmlGenericErrorContext, - "%s(%d): ", ctxt->input->filename, - ctxt->input->line); - xmlGenericError(xmlGenericErrorContext, - "Pushing input %d : %.30s\n", ctxt->inputNr+1, input->cur); - } - ret = inputPush(ctxt, input); - GROW; - return(ret); -} - -/** - * xmlParseCharRef: - * @ctxt: an XML parser context - * - * parse Reference declarations - * - * [66] CharRef ::= '&#' [0-9]+ ';' | - * '&#x' [0-9a-fA-F]+ ';' - * - * [ WFC: Legal Character ] - * Characters referred to using character references must match the - * production for Char. - * - * Returns the value parsed (as an int), 0 in case of error - */ -int -xmlParseCharRef(xmlParserCtxtPtr ctxt) { - unsigned int val = 0; - int count = 0; - unsigned int outofrange = 0; - - /* - * Using RAW/CUR/NEXT is okay since we are working on ASCII range here - */ - if ((RAW == '&') && (NXT(1) == '#') && - (NXT(2) == 'x')) { - SKIP(3); - GROW; - while (RAW != ';') { /* loop blocked by count */ - if (count++ > 20) { - count = 0; - GROW; - } - if ((RAW >= '0') && (RAW <= '9')) - val = val * 16 + (CUR - '0'); - else if ((RAW >= 'a') && (RAW <= 'f') && (count < 20)) - val = val * 16 + (CUR - 'a') + 10; - else if ((RAW >= 'A') && (RAW <= 'F') && (count < 20)) - val = val * 16 + (CUR - 'A') + 10; - else { - xmlFatalErr(ctxt, XML_ERR_INVALID_HEX_CHARREF, NULL); - val = 0; - break; - } - if (val > 0x10FFFF) - outofrange = val; - - NEXT; - count++; - } - if (RAW == ';') { - /* on purpose to avoid reentrancy problems with NEXT and SKIP */ - ctxt->input->col++; - ctxt->nbChars ++; - ctxt->input->cur++; - } - } else if ((RAW == '&') && (NXT(1) == '#')) { - SKIP(2); - GROW; - while (RAW != ';') { /* loop blocked by count */ - if (count++ > 20) { - count = 0; - GROW; - } - if ((RAW >= '0') && (RAW <= '9')) - val = val * 10 + (CUR - '0'); - else { - xmlFatalErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, NULL); - val = 0; - break; - } - if (val > 0x10FFFF) - outofrange = val; - - NEXT; - count++; - } - if (RAW == ';') { - /* on purpose to avoid reentrancy problems with NEXT and SKIP */ - ctxt->input->col++; - ctxt->nbChars ++; - ctxt->input->cur++; - } - } else { - xmlFatalErr(ctxt, XML_ERR_INVALID_CHARREF, NULL); - } - - /* - * [ WFC: Legal Character ] - * Characters referred to using character references must match the - * production for Char. - */ - if ((IS_CHAR(val) && (outofrange == 0))) { - return(val); - } else { - xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, - "xmlParseCharRef: invalid xmlChar value %d\n", - val); - } - return(0); -} - -/** - * xmlParseStringCharRef: - * @ctxt: an XML parser context - * @str: a pointer to an index in the string - * - * parse Reference declarations, variant parsing from a string rather - * than an an input flow. - * - * [66] CharRef ::= '&#' [0-9]+ ';' | - * '&#x' [0-9a-fA-F]+ ';' - * - * [ WFC: Legal Character ] - * Characters referred to using character references must match the - * production for Char. - * - * Returns the value parsed (as an int), 0 in case of error, str will be - * updated to the current value of the index - */ -static int -xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) { - const xmlChar *ptr; - xmlChar cur; - unsigned int val = 0; - unsigned int outofrange = 0; - - if ((str == NULL) || (*str == NULL)) return(0); - ptr = *str; - cur = *ptr; - if ((cur == '&') && (ptr[1] == '#') && (ptr[2] == 'x')) { - ptr += 3; - cur = *ptr; - while (cur != ';') { /* Non input consuming loop */ - if ((cur >= '0') && (cur <= '9')) - val = val * 16 + (cur - '0'); - else if ((cur >= 'a') && (cur <= 'f')) - val = val * 16 + (cur - 'a') + 10; - else if ((cur >= 'A') && (cur <= 'F')) - val = val * 16 + (cur - 'A') + 10; - else { - xmlFatalErr(ctxt, XML_ERR_INVALID_HEX_CHARREF, NULL); - val = 0; - break; - } - if (val > 0x10FFFF) - outofrange = val; - - ptr++; - cur = *ptr; - } - if (cur == ';') - ptr++; - } else if ((cur == '&') && (ptr[1] == '#')){ - ptr += 2; - cur = *ptr; - while (cur != ';') { /* Non input consuming loops */ - if ((cur >= '0') && (cur <= '9')) - val = val * 10 + (cur - '0'); - else { - xmlFatalErr(ctxt, XML_ERR_INVALID_DEC_CHARREF, NULL); - val = 0; - break; - } - if (val > 0x10FFFF) - outofrange = val; - - ptr++; - cur = *ptr; - } - if (cur == ';') - ptr++; - } else { - xmlFatalErr(ctxt, XML_ERR_INVALID_CHARREF, NULL); - return(0); - } - *str = ptr; - - /* - * [ WFC: Legal Character ] - * Characters referred to using character references must match the - * production for Char. - */ - if ((IS_CHAR(val) && (outofrange == 0))) { - return(val); - } else { - xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, - "xmlParseStringCharRef: invalid xmlChar value %d\n", - val); - } - return(0); -} - -/** - * xmlNewBlanksWrapperInputStream: - * @ctxt: an XML parser context - * @entity: an Entity pointer - * - * Create a new input stream for wrapping - * blanks around a PEReference - * - * Returns the new input stream or NULL - */ - -static void deallocblankswrapper (xmlChar *str) {xmlFree(str);} - -static xmlParserInputPtr -xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { - xmlParserInputPtr input; - xmlChar *buffer; - size_t length; - if (entity == NULL) { - xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, - "xmlNewBlanksWrapperInputStream entity\n"); - return(NULL); - } - if (xmlParserDebugEntities) - xmlGenericError(xmlGenericErrorContext, - "new blanks wrapper for entity: %s\n", entity->name); - input = xmlNewInputStream(ctxt); - if (input == NULL) { - return(NULL); - } - length = xmlStrlen(entity->name) + 5; - buffer = xmlMallocAtomic(length); - if (buffer == NULL) { - xmlErrMemory(ctxt, NULL); - xmlFree(input); - return(NULL); - } - buffer [0] = ' '; - buffer [1] = '%'; - buffer [length-3] = ';'; - buffer [length-2] = ' '; - buffer [length-1] = 0; - memcpy(buffer + 2, entity->name, length - 5); - input->free = deallocblankswrapper; - input->base = buffer; - input->cur = buffer; - input->length = length; - input->end = &buffer[length]; - return(input); -} - -/** - * xmlParserHandlePEReference: - * @ctxt: the parser context - * - * [69] PEReference ::= '%' Name ';' - * - * [ WFC: No Recursion ] - * A parsed entity must not contain a recursive - * reference to itself, either directly or indirectly. - * - * [ WFC: Entity Declared ] - * In a document without any DTD, a document with only an internal DTD - * subset which contains no parameter entity references, or a document - * with "standalone='yes'", ... ... The declaration of a parameter - * entity must precede any reference to it... - * - * [ VC: Entity Declared ] - * In a document with an external subset or external parameter entities - * with "standalone='no'", ... ... The declaration of a parameter entity - * must precede any reference to it... - * - * [ WFC: In DTD ] - * Parameter-entity references may only appear in the DTD. - * NOTE: misleading but this is handled. - * - * A PEReference may have been detected in the current input stream - * the handling is done accordingly to - * http://www.w3.org/TR/REC-xml#entproc - * i.e. - * - Included in literal in entity values - * - Included as Parameter Entity reference within DTDs - */ -void -xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) { - const xmlChar *name; - xmlEntityPtr entity = NULL; - xmlParserInputPtr input; - - if (RAW != '%') return; - switch(ctxt->instate) { - case XML_PARSER_CDATA_SECTION: - return; - case XML_PARSER_COMMENT: - return; - case XML_PARSER_START_TAG: - return; - case XML_PARSER_END_TAG: - return; - case XML_PARSER_EOF: - xmlFatalErr(ctxt, XML_ERR_PEREF_AT_EOF, NULL); - return; - case XML_PARSER_PROLOG: - case XML_PARSER_START: - case XML_PARSER_MISC: - xmlFatalErr(ctxt, XML_ERR_PEREF_IN_PROLOG, NULL); - return; - case XML_PARSER_ENTITY_DECL: - case XML_PARSER_CONTENT: - case XML_PARSER_ATTRIBUTE_VALUE: - case XML_PARSER_PI: - case XML_PARSER_SYSTEM_LITERAL: - case XML_PARSER_PUBLIC_LITERAL: - /* we just ignore it there */ - return; - case XML_PARSER_EPILOG: - xmlFatalErr(ctxt, XML_ERR_PEREF_IN_EPILOG, NULL); - return; - case XML_PARSER_ENTITY_VALUE: - /* - * NOTE: in the case of entity values, we don't do the - * substitution here since we need the literal - * entity value to be able to save the internal - * subset of the document. - * This will be handled by xmlStringDecodeEntities - */ - return; - case XML_PARSER_DTD: - /* - * [WFC: Well-Formedness Constraint: PEs in Internal Subset] - * In the internal DTD subset, parameter-entity references - * can occur only where markup declarations can occur, not - * within markup declarations. - * In that case this is handled in xmlParseMarkupDecl - */ - if ((ctxt->external == 0) && (ctxt->inputNr == 1)) - return; - if (IS_BLANK_CH(NXT(1)) || NXT(1) == 0) - return; - break; - case XML_PARSER_IGNORE: - return; - } - - NEXT; - name = xmlParseName(ctxt); - if (xmlParserDebugEntities) - xmlGenericError(xmlGenericErrorContext, - "PEReference: %s\n", name); - if (name == NULL) { - xmlFatalErr(ctxt, XML_ERR_PEREF_NO_NAME, NULL); - } else { - if (RAW == ';') { - NEXT; - if ((ctxt->sax != NULL) && (ctxt->sax->getParameterEntity != NULL)) - entity = ctxt->sax->getParameterEntity(ctxt->userData, name); - if (entity == NULL) { - - /* - * [ WFC: Entity Declared ] - * In a document without any DTD, a document with only an - * internal DTD subset which contains no parameter entity - * references, or a document with "standalone='yes'", ... - * ... The declaration of a parameter entity must precede - * any reference to it... - */ - if ((ctxt->standalone == 1) || - ((ctxt->hasExternalSubset == 0) && - (ctxt->hasPErefs == 0))) { - xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY, - "PEReference: %%%s; not found\n", name); - } else { - /* - * [ VC: Entity Declared ] - * In a document with an external subset or external - * parameter entities with "standalone='no'", ... - * ... The declaration of a parameter entity must precede - * any reference to it... - */ - if ((ctxt->validate) && (ctxt->vctxt.error != NULL)) { - xmlValidityError(ctxt, XML_WAR_UNDECLARED_ENTITY, - "PEReference: %%%s; not found\n", - name, NULL); - } else - xmlWarningMsg(ctxt, XML_WAR_UNDECLARED_ENTITY, - "PEReference: %%%s; not found\n", - name, NULL); - ctxt->valid = 0; - } - } else if (ctxt->input->free != deallocblankswrapper) { - input = xmlNewBlanksWrapperInputStream(ctxt, entity); - if (xmlPushInput(ctxt, input) < 0) - return; - } else { - if ((entity->etype == XML_INTERNAL_PARAMETER_ENTITY) || - (entity->etype == XML_EXTERNAL_PARAMETER_ENTITY)) { - xmlChar start[4]; - xmlCharEncoding enc; - - /* - * handle the extra spaces added before and after - * c.f. http://www.w3.org/TR/REC-xml#as-PE - * this is done independently. - */ - input = xmlNewEntityInputStream(ctxt, entity); - if (xmlPushInput(ctxt, input) < 0) - return; - - /* - * Get the 4 first bytes and decode the charset - * if enc != XML_CHAR_ENCODING_NONE - * plug some encoding conversion routines. - * Note that, since we may have some non-UTF8 - * encoding (like UTF16, bug 135229), the 'length' - * is not known, but we can calculate based upon - * the amount of data in the buffer. - */ - GROW - if ((ctxt->input->end - ctxt->input->cur)>=4) { - start[0] = RAW; - start[1] = NXT(1); - start[2] = NXT(2); - start[3] = NXT(3); - enc = xmlDetectCharEncoding(start, 4); - if (enc != XML_CHAR_ENCODING_NONE) { - xmlSwitchEncoding(ctxt, enc); - } - } - - if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) && - (CMP5(CUR_PTR, '<', '?', 'x', 'm', 'l' )) && - (IS_BLANK_CH(NXT(5)))) { - xmlParseTextDecl(ctxt); - } - } else { - xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_IS_PARAMETER, - "PEReference: %s is not a parameter entity\n", - name); - } - } - } else { - xmlFatalErr(ctxt, XML_ERR_PEREF_SEMICOL_MISSING, NULL); - } - } -} - -/* - * Macro used to grow the current buffer. - */ -#define growBuffer(buffer, n) { \ - xmlChar *tmp; \ - buffer##_size *= 2; \ - buffer##_size += n; \ - tmp = (xmlChar *) \ - xmlRealloc(buffer, buffer##_size * sizeof(xmlChar)); \ - if (tmp == NULL) goto mem_error; \ - buffer = tmp; \ -} - -/** - * xmlStringLenDecodeEntities: - * @ctxt: the parser context - * @str: the input string - * @len: the string length - * @what: combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF - * @end: an end marker xmlChar, 0 if none - * @end2: an end marker xmlChar, 0 if none - * @end3: an end marker xmlChar, 0 if none - * - * Takes a entity string content and process to do the adequate substitutions. - * - * [67] Reference ::= EntityRef | CharRef - * - * [69] PEReference ::= '%' Name ';' - * - * Returns A newly allocated string with the substitution done. The caller - * must deallocate it ! - */ -xmlChar * -xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, - int what, xmlChar end, xmlChar end2, xmlChar end3) { - xmlChar *buffer = NULL; - int buffer_size = 0; - - xmlChar *current = NULL; - xmlChar *rep = NULL; - const xmlChar *last; - xmlEntityPtr ent; - int c,l; - int nbchars = 0; - - if ((ctxt == NULL) || (str == NULL) || (len < 0)) - return(NULL); - last = str + len; - - if (((ctxt->depth > 40) && - ((ctxt->options & XML_PARSE_HUGE) == 0)) || - (ctxt->depth > 1024)) { - xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL); - return(NULL); - } - - /* - * allocate a translation buffer. - */ - buffer_size = XML_PARSER_BIG_BUFFER_SIZE; - buffer = (xmlChar *) xmlMallocAtomic(buffer_size * sizeof(xmlChar)); - if (buffer == NULL) goto mem_error; - - /* - * OK loop until we reach one of the ending char or a size limit. - * we are operating on already parsed values. - */ - if (str < last) - c = CUR_SCHAR(str, l); - else - c = 0; - while ((c != 0) && (c != end) && /* non input consuming loop */ - (c != end2) && (c != end3)) { - - if (c == 0) break; - if ((c == '&') && (str[1] == '#')) { - int val = xmlParseStringCharRef(ctxt, &str); - if (val != 0) { - COPY_BUF(0,buffer,nbchars,val); - } - if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer, XML_PARSER_BUFFER_SIZE); - } - } else if ((c == '&') && (what & XML_SUBSTITUTE_REF)) { - if (xmlParserDebugEntities) - xmlGenericError(xmlGenericErrorContext, - "String decoding Entity Reference: %.30s\n", - str); - ent = xmlParseStringEntityRef(ctxt, &str); - if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) || - (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR)) - goto int_error; - if (ent != NULL) - ctxt->nbentities += ent->checked; - if ((ent != NULL) && - (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { - if (ent->content != NULL) { - COPY_BUF(0,buffer,nbchars,ent->content[0]); - if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer, XML_PARSER_BUFFER_SIZE); - } - } else { - xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, - "predefined entity has no content\n"); - } - } else if ((ent != NULL) && (ent->content != NULL)) { - ctxt->depth++; - rep = xmlStringDecodeEntities(ctxt, ent->content, what, - 0, 0, 0); - ctxt->depth--; - - if (rep != NULL) { - current = rep; - while (*current != 0) { /* non input consuming loop */ - buffer[nbchars++] = *current++; - if (nbchars > - buffer_size - XML_PARSER_BUFFER_SIZE) { - if (xmlParserEntityCheck(ctxt, nbchars, ent)) - goto int_error; - growBuffer(buffer, XML_PARSER_BUFFER_SIZE); - } - } - xmlFree(rep); - rep = NULL; - } - } else if (ent != NULL) { - int i = xmlStrlen(ent->name); - const xmlChar *cur = ent->name; - - buffer[nbchars++] = '&'; - if (nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer, i + XML_PARSER_BUFFER_SIZE); - } - for (;i > 0;i--) - buffer[nbchars++] = *cur++; - buffer[nbchars++] = ';'; - } - } else if (c == '%' && (what & XML_SUBSTITUTE_PEREF)) { - if (xmlParserDebugEntities) - xmlGenericError(xmlGenericErrorContext, - "String decoding PE Reference: %.30s\n", str); - ent = xmlParseStringPEReference(ctxt, &str); - if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP) - goto int_error; - if (ent != NULL) - ctxt->nbentities += ent->checked; - if (ent != NULL) { - if (ent->content == NULL) { - xmlLoadEntityContent(ctxt, ent); - } - ctxt->depth++; - rep = xmlStringDecodeEntities(ctxt, ent->content, what, - 0, 0, 0); - ctxt->depth--; - if (rep != NULL) { - current = rep; - while (*current != 0) { /* non input consuming loop */ - buffer[nbchars++] = *current++; - if (nbchars > - buffer_size - XML_PARSER_BUFFER_SIZE) { - if (xmlParserEntityCheck(ctxt, nbchars, ent)) - goto int_error; - growBuffer(buffer, XML_PARSER_BUFFER_SIZE); - } - } - xmlFree(rep); - rep = NULL; - } - } - } else { - COPY_BUF(l,buffer,nbchars,c); - str += l; - if (nbchars > buffer_size - XML_PARSER_BUFFER_SIZE) { - growBuffer(buffer, XML_PARSER_BUFFER_SIZE); - } - } - if (str < last) - c = CUR_SCHAR(str, l); - else - c = 0; - } - buffer[nbchars] = 0; - return(buffer); - -mem_error: - xmlErrMemory(ctxt, NULL); -int_error: - if (rep != NULL) - xmlFree(rep); - if (buffer != NULL) - xmlFree(buffer); - return(NULL); -} - -/** - * xmlStringDecodeEntities: - * @ctxt: the parser context - * @str: the input string - * @what: combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF - * @end: an end marker xmlChar, 0 if none - * @end2: an end marker xmlChar, 0 if none - * @end3: an end marker xmlChar, 0 if none - * - * Takes a entity string content and process to do the adequate substitutions. - * - * [67] Reference ::= EntityRef | CharRef - * - * [69] PEReference ::= '%' Name ';' - * - * Returns A newly allocated string with the substitution done. The caller - * must deallocate it ! - */ -xmlChar * -xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what, - xmlChar end, xmlChar end2, xmlChar end3) { - if ((ctxt == NULL) || (str == NULL)) return(NULL); - return(xmlStringLenDecodeEntities(ctxt, str, xmlStrlen(str), what, - end, end2, end3)); -} - -/************************************************************************ - * * - * Commodity functions, cleanup needed ? * - * * - ************************************************************************/ - -/** - * areBlanks: - * @ctxt: an XML parser context - * @str: a xmlChar * - * @len: the size of @str - * @blank_chars: we know the chars are blanks - * - * Is this a sequence of blank chars that one can ignore ? - * - * Returns 1 if ignorable 0 otherwise. - */ - -static int areBlanks(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, - int blank_chars) { - int i, ret; - xmlNodePtr lastChild; - - /* - * Don't spend time trying to differentiate them, the same callback is - * used ! - */ - if (ctxt->sax->ignorableWhitespace == ctxt->sax->characters) - return(0); - - /* - * Check for xml:space value. - */ - if ((ctxt->space == NULL) || (*(ctxt->space) == 1) || - (*(ctxt->space) == -2)) - return(0); - - /* - * Check that the string is made of blanks - */ - if (blank_chars == 0) { - for (i = 0;i < len;i++) - if (!(IS_BLANK_CH(str[i]))) return(0); - } - - /* - * Look if the element is mixed content in the DTD if available - */ - if (ctxt->node == NULL) return(0); - if (ctxt->myDoc != NULL) { - ret = xmlIsMixedElement(ctxt->myDoc, ctxt->node->name); - if (ret == 0) return(1); - if (ret == 1) return(0); - } - - /* - * Otherwise, heuristic :-\ - */ - if ((RAW != '<') && (RAW != 0xD)) return(0); - if ((ctxt->node->children == NULL) && - (RAW == '<') && (NXT(1) == '/')) return(0); - - lastChild = xmlGetLastChild(ctxt->node); - if (lastChild == NULL) { - if ((ctxt->node->type != XML_ELEMENT_NODE) && - (ctxt->node->content != NULL)) return(0); - } else if (xmlNodeIsText(lastChild)) - return(0); - else if ((ctxt->node->children != NULL) && - (xmlNodeIsText(ctxt->node->children))) - return(0); - return(1); -} - -/************************************************************************ - * * - * Extra stuff for namespace support * - * Relates to http://www.w3.org/TR/WD-xml-names * - * * - ************************************************************************/ - -/** - * xmlSplitQName: - * @ctxt: an XML parser context - * @name: an XML parser context - * @prefix: a xmlChar ** - * - * parse an UTF8 encoded XML qualified name string - * - * [NS 5] QName ::= (Prefix ':')? LocalPart - * - * [NS 6] Prefix ::= NCName - * - * [NS 7] LocalPart ::= NCName - * - * Returns the local part, and prefix is updated - * to get the Prefix if any. - */ - -xmlChar * -xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { - xmlChar buf[XML_MAX_NAMELEN + 5]; - xmlChar *buffer = NULL; - int len = 0; - int max = XML_MAX_NAMELEN; - xmlChar *ret = NULL; - const xmlChar *cur = name; - int c; - - if (prefix == NULL) return(NULL); - *prefix = NULL; - - if (cur == NULL) return(NULL); - -#ifndef XML_XML_NAMESPACE - /* xml: prefix is not really a namespace */ - if ((cur[0] == 'x') && (cur[1] == 'm') && - (cur[2] == 'l') && (cur[3] == ':')) - return(xmlStrdup(name)); -#endif - - /* nasty but well=formed */ - if (cur[0] == ':') - return(xmlStrdup(name)); - - c = *cur++; - while ((c != 0) && (c != ':') && (len < max)) { /* tested bigname.xml */ - buf[len++] = c; - c = *cur++; - } - if (len >= max) { - /* - * Okay someone managed to make a huge name, so he's ready to pay - * for the processing speed. - */ - max = len * 2; - - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); - if (buffer == NULL) { - xmlErrMemory(ctxt, NULL); - return(NULL); - } - memcpy(buffer, buf, len); - while ((c != 0) && (c != ':')) { /* tested bigname.xml */ - if (len + 10 > max) { - xmlChar *tmp; - - max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); - if (tmp == NULL) { - xmlFree(buffer); - xmlErrMemory(ctxt, NULL); - return(NULL); - } - buffer = tmp; - } - buffer[len++] = c; - c = *cur++; - } - buffer[len] = 0; - } - - if ((c == ':') && (*cur == 0)) { - if (buffer != NULL) - xmlFree(buffer); - *prefix = NULL; - return(xmlStrdup(name)); - } - - if (buffer == NULL) - ret = xmlStrndup(buf, len); - else { - ret = buffer; - buffer = NULL; - max = XML_MAX_NAMELEN; - } - - - if (c == ':') { - c = *cur; - *prefix = ret; - if (c == 0) { - return(xmlStrndup(BAD_CAST "", 0)); - } - len = 0; - - /* - * Check that the first character is proper to start - * a new name - */ - if (!(((c >= 0x61) && (c <= 0x7A)) || - ((c >= 0x41) && (c <= 0x5A)) || - (c == '_') || (c == ':'))) { - int l; - int first = CUR_SCHAR(cur, l); - - if (!IS_LETTER(first) && (first != '_')) { - xmlFatalErrMsgStr(ctxt, XML_NS_ERR_QNAME, - "Name %s is not XML Namespace compliant\n", - name); - } - } - cur++; - - while ((c != 0) && (len < max)) { /* tested bigname2.xml */ - buf[len++] = c; - c = *cur++; - } - if (len >= max) { - /* - * Okay someone managed to make a huge name, so he's ready to pay - * for the processing speed. - */ - max = len * 2; - - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); - if (buffer == NULL) { - xmlErrMemory(ctxt, NULL); - return(NULL); - } - memcpy(buffer, buf, len); - while (c != 0) { /* tested bigname2.xml */ - if (len + 10 > max) { - xmlChar *tmp; - - max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); - if (tmp == NULL) { - xmlErrMemory(ctxt, NULL); - xmlFree(buffer); - return(NULL); - } - buffer = tmp; - } - buffer[len++] = c; - c = *cur++; - } - buffer[len] = 0; - } - - if (buffer == NULL) - ret = xmlStrndup(buf, len); - else { - ret = buffer; - } - } - - return(ret); -} - -/************************************************************************ - * * - * The parser itself * - * Relates to http://www.w3.org/TR/REC-xml * - * * - ************************************************************************/ - -/************************************************************************ - * * - * Routines to parse Name, NCName and NmToken * - * * - ************************************************************************/ - -/* - * The two following functions are related to the change of accepted - * characters for Name and NmToken in the Revision 5 of XML-1.0 - * They correspond to the modified production [4] and the new production [4a] - * changes in that revision. Also note that the macros used for the - * productions Letter, Digit, CombiningChar and Extender are not needed - * anymore. - * We still keep compatibility to pre-revision5 parsing semantic if the - * new XML_PARSE_OLD10 option is given to the parser. - */ -static int -xmlIsNameStartChar(xmlParserCtxtPtr ctxt, int c) { - if ((ctxt->options & XML_PARSE_OLD10) == 0) { - /* - * Use the new checks of production [4] [4a] amd [5] of the - * Update 5 of XML-1.0 - */ - if ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ - (((c >= 'a') && (c <= 'z')) || - ((c >= 'A') && (c <= 'Z')) || - (c == '_') || (c == ':') || - ((c >= 0xC0) && (c <= 0xD6)) || - ((c >= 0xD8) && (c <= 0xF6)) || - ((c >= 0xF8) && (c <= 0x2FF)) || - ((c >= 0x370) && (c <= 0x37D)) || - ((c >= 0x37F) && (c <= 0x1FFF)) || - ((c >= 0x200C) && (c <= 0x200D)) || - ((c >= 0x2070) && (c <= 0x218F)) || - ((c >= 0x2C00) && (c <= 0x2FEF)) || - ((c >= 0x3001) && (c <= 0xD7FF)) || - ((c >= 0xF900) && (c <= 0xFDCF)) || - ((c >= 0xFDF0) && (c <= 0xFFFD)) || - ((c >= 0x10000) && (c <= 0xEFFFF)))) - return(1); - } else { - if (IS_LETTER(c) || (c == '_') || (c == ':')) - return(1); - } - return(0); -} - -static int -xmlIsNameChar(xmlParserCtxtPtr ctxt, int c) { - if ((ctxt->options & XML_PARSE_OLD10) == 0) { - /* - * Use the new checks of production [4] [4a] amd [5] of the - * Update 5 of XML-1.0 - */ - if ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ - (((c >= 'a') && (c <= 'z')) || - ((c >= 'A') && (c <= 'Z')) || - ((c >= '0') && (c <= '9')) || /* !start */ - (c == '_') || (c == ':') || - (c == '-') || (c == '.') || (c == 0xB7) || /* !start */ - ((c >= 0xC0) && (c <= 0xD6)) || - ((c >= 0xD8) && (c <= 0xF6)) || - ((c >= 0xF8) && (c <= 0x2FF)) || - ((c >= 0x300) && (c <= 0x36F)) || /* !start */ - ((c >= 0x370) && (c <= 0x37D)) || - ((c >= 0x37F) && (c <= 0x1FFF)) || - ((c >= 0x200C) && (c <= 0x200D)) || - ((c >= 0x203F) && (c <= 0x2040)) || /* !start */ - ((c >= 0x2070) && (c <= 0x218F)) || - ((c >= 0x2C00) && (c <= 0x2FEF)) || - ((c >= 0x3001) && (c <= 0xD7FF)) || - ((c >= 0xF900) && (c <= 0xFDCF)) || - ((c >= 0xFDF0) && (c <= 0xFFFD)) || - ((c >= 0x10000) && (c <= 0xEFFFF)))) - return(1); - } else { - if ((IS_LETTER(c)) || (IS_DIGIT(c)) || - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c))) - return(1); - } - return(0); -} - -static xmlChar * xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, - int *len, int *alloc, int normalize); - -static const xmlChar * -xmlParseNameComplex(xmlParserCtxtPtr ctxt) { - int len = 0, l; - int c; - int count = 0; - - /* - * Handler for more complex cases - */ - GROW; - c = CUR_CHAR(l); - if ((ctxt->options & XML_PARSE_OLD10) == 0) { - /* - * Use the new checks of production [4] [4a] amd [5] of the - * Update 5 of XML-1.0 - */ - if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ - (!(((c >= 'a') && (c <= 'z')) || - ((c >= 'A') && (c <= 'Z')) || - (c == '_') || (c == ':') || - ((c >= 0xC0) && (c <= 0xD6)) || - ((c >= 0xD8) && (c <= 0xF6)) || - ((c >= 0xF8) && (c <= 0x2FF)) || - ((c >= 0x370) && (c <= 0x37D)) || - ((c >= 0x37F) && (c <= 0x1FFF)) || - ((c >= 0x200C) && (c <= 0x200D)) || - ((c >= 0x2070) && (c <= 0x218F)) || - ((c >= 0x2C00) && (c <= 0x2FEF)) || - ((c >= 0x3001) && (c <= 0xD7FF)) || - ((c >= 0xF900) && (c <= 0xFDCF)) || - ((c >= 0xFDF0) && (c <= 0xFFFD)) || - ((c >= 0x10000) && (c <= 0xEFFFF))))) { - return(NULL); - } - len += l; - NEXTL(l); - c = CUR_CHAR(l); - while ((c != ' ') && (c != '>') && (c != '/') && /* accelerators */ - (((c >= 'a') && (c <= 'z')) || - ((c >= 'A') && (c <= 'Z')) || - ((c >= '0') && (c <= '9')) || /* !start */ - (c == '_') || (c == ':') || - (c == '-') || (c == '.') || (c == 0xB7) || /* !start */ - ((c >= 0xC0) && (c <= 0xD6)) || - ((c >= 0xD8) && (c <= 0xF6)) || - ((c >= 0xF8) && (c <= 0x2FF)) || - ((c >= 0x300) && (c <= 0x36F)) || /* !start */ - ((c >= 0x370) && (c <= 0x37D)) || - ((c >= 0x37F) && (c <= 0x1FFF)) || - ((c >= 0x200C) && (c <= 0x200D)) || - ((c >= 0x203F) && (c <= 0x2040)) || /* !start */ - ((c >= 0x2070) && (c <= 0x218F)) || - ((c >= 0x2C00) && (c <= 0x2FEF)) || - ((c >= 0x3001) && (c <= 0xD7FF)) || - ((c >= 0xF900) && (c <= 0xFDCF)) || - ((c >= 0xFDF0) && (c <= 0xFFFD)) || - ((c >= 0x10000) && (c <= 0xEFFFF)) - )) { - if (count++ > 100) { - count = 0; - GROW; - } - len += l; - NEXTL(l); - c = CUR_CHAR(l); - } - } else { - if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ - (!IS_LETTER(c) && (c != '_') && - (c != ':'))) { - return(NULL); - } - len += l; - NEXTL(l); - c = CUR_CHAR(l); - - while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ - ((IS_LETTER(c)) || (IS_DIGIT(c)) || - (c == '.') || (c == '-') || - (c == '_') || (c == ':') || - (IS_COMBINING(c)) || - (IS_EXTENDER(c)))) { - if (count++ > 100) { - count = 0; - GROW; - } - len += l; - NEXTL(l); - c = CUR_CHAR(l); - } - } - if ((*ctxt->input->cur == '\n') && (ctxt->input->cur[-1] == '\r')) - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - (len + 1), len)); - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); -} - -/** - * xmlParseName: - * @ctxt: an XML parser context - * - * parse an XML name. - * - * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | - * CombiningChar | Extender - * - * [5] Name ::= (Letter | '_' | ':') (NameChar)* - * - * [6] Names ::= Name (#x20 Name)* - * - * Returns the Name parsed or NULL - */ - -const xmlChar * -xmlParseName(xmlParserCtxtPtr ctxt) { - const xmlChar *in; - const xmlChar *ret; - int count = 0; - - GROW; - - /* - * Accelerator for simple ASCII names - */ - in = ctxt->input->cur; - if (((*in >= 0x61) && (*in <= 0x7A)) || - ((*in >= 0x41) && (*in <= 0x5A)) || - (*in == '_') || (*in == ':')) { - in++; - while (((*in >= 0x61) && (*in <= 0x7A)) || - ((*in >= 0x41) && (*in <= 0x5A)) || - ((*in >= 0x30) && (*in <= 0x39)) || - (*in == '_') || (*in == '-') || - (*in == ':') || (*in == '.')) - in++; - if ((*in > 0) && (*in < 0x80)) { - count = in - ctxt->input->cur; - ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); - ctxt->input->cur = in; - ctxt->nbChars += count; - ctxt->input->col += count; - if (ret == NULL) - xmlErrMemory(ctxt, NULL); - return(ret); - } - } - /* accelerator for special cases */ - return(xmlParseNameComplex(ctxt)); -} - -static const xmlChar * -xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { - int len = 0, l; - int c; - int count = 0; - - /* - * Handler for more complex cases - */ - GROW; - c = CUR_CHAR(l); - if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ - (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) { - return(NULL); - } - - while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ - (xmlIsNameChar(ctxt, c) && (c != ':'))) { - if (count++ > 100) { - count = 0; - GROW; - } - len += l; - NEXTL(l); - c = CUR_CHAR(l); - } - return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); -} - -/** - * xmlParseNCName: - * @ctxt: an XML parser context - * @len: lenght of the string parsed - * - * parse an XML name. - * - * [4NS] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | - * CombiningChar | Extender - * - * [5NS] NCName ::= (Letter | '_') (NCNameChar)* - * - * Returns the Name parsed or NULL - */ - -static const xmlChar * -xmlParseNCName(xmlParserCtxtPtr ctxt) { - const xmlChar *in; - const xmlChar *ret; - int count = 0; - - /* - * Accelerator for simple ASCII names - */ - in = ctxt->input->cur; - if (((*in >= 0x61) && (*in <= 0x7A)) || - ((*in >= 0x41) && (*in <= 0x5A)) || - (*in == '_')) { - in++; - while (((*in >= 0x61) && (*in <= 0x7A)) || - ((*in >= 0x41) && (*in <= 0x5A)) || - ((*in >= 0x30) && (*in <= 0x39)) || - (*in == '_') || (*in == '-') || - (*in == '.')) - in++; - if ((*in > 0) && (*in < 0x80)) { - count = in - ctxt->input->cur; - ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); - ctxt->input->cur = in; - ctxt->nbChars += count; - ctxt->input->col += count; - if (ret == NULL) { - xmlErrMemory(ctxt, NULL); - } - return(ret); - } - } - return(xmlParseNCNameComplex(ctxt)); -} - -/** - * xmlParseNameAndCompare: - * @ctxt: an XML parser context - * - * parse an XML name and compares for match - * (specialized for endtag parsing) - * - * Returns NULL for an illegal name, (xmlChar*) 1 for success - * and the name for mismatch - */ - -static const xmlChar * -xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) { - register const xmlChar *cmp = other; - register const xmlChar *in; - const xmlChar *ret; - - GROW; - - in = ctxt->input->cur; - while (*in != 0 && *in == *cmp) { - ++in; - ++cmp; - ctxt->input->col++; - } - if (*cmp == 0 && (*in == '>' || IS_BLANK_CH (*in))) { - /* success */ - ctxt->input->cur = in; - return (const xmlChar*) 1; - } - /* failure (or end of input buffer), check with full function */ - ret = xmlParseName (ctxt); - /* strings coming from the dictionnary direct compare possible */ - if (ret == other) { - return (const xmlChar*) 1; - } - return ret; -} - -/** - * xmlParseStringName: - * @ctxt: an XML parser context - * @str: a pointer to the string pointer (IN/OUT) - * - * parse an XML name. - * - * [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | - * CombiningChar | Extender - * - * [5] Name ::= (Letter | '_' | ':') (NameChar)* - * - * [6] Names ::= Name (#x20 Name)* - * - * Returns the Name parsed or NULL. The @str pointer - * is updated to the current location in the string. - */ - -static xmlChar * -xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) { - xmlChar buf[XML_MAX_NAMELEN + 5]; - const xmlChar *cur = *str; - int len = 0, l; - int c; - - c = CUR_SCHAR(cur, l); - if (!xmlIsNameStartChar(ctxt, c)) { - return(NULL); - } - - COPY_BUF(l,buf,len,c); - cur += l; - c = CUR_SCHAR(cur, l); - while (xmlIsNameChar(ctxt, c)) { - COPY_BUF(l,buf,len,c); - cur += l; - c = CUR_SCHAR(cur, l); - if (len >= XML_MAX_NAMELEN) { /* test bigentname.xml */ - /* - * Okay someone managed to make a huge name, so he's ready to pay - * for the processing speed. - */ - xmlChar *buffer; - int max = len * 2; - - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); - if (buffer == NULL) { - xmlErrMemory(ctxt, NULL); - return(NULL); - } - memcpy(buffer, buf, len); - while (xmlIsNameChar(ctxt, c)) { - if (len + 10 > max) { - xmlChar *tmp; - max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); - if (tmp == NULL) { - xmlErrMemory(ctxt, NULL); - xmlFree(buffer); - return(NULL); - } - buffer = tmp; - } - COPY_BUF(l,buffer,len,c); - cur += l; - c = CUR_SCHAR(cur, l); - } - buffer[len] = 0; - *str = cur; - return(buffer); - } - } - *str = cur; - return(xmlStrndup(buf, len)); -} - -/** - * xmlParseNmtoken: - * @ctxt: an XML parser context - * - * parse an XML Nmtoken. - * - * [7] Nmtoken ::= (NameChar)+ - * - * [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* - * - * Returns the Nmtoken parsed or NULL - */ - -xmlChar * -xmlParseNmtoken(xmlParserCtxtPtr ctxt) { - xmlChar buf[XML_MAX_NAMELEN + 5]; - int len = 0, l; - int c; - int count = 0; - - GROW; - c = CUR_CHAR(l); - - while (xmlIsNameChar(ctxt, c)) { - if (count++ > 100) { - count = 0; - GROW; - } - COPY_BUF(l,buf,len,c); - NEXTL(l); - c = CUR_CHAR(l); - if (len >= XML_MAX_NAMELEN) { - /* - * Okay someone managed to make a huge token, so he's ready to pay - * for the processing speed. - */ - xmlChar *buffer; - int max = len * 2; - - buffer = (xmlChar *) xmlMallocAtomic(max * sizeof(xmlChar)); - if (buffer == NULL) { - xmlErrMemory(ctxt, NULL); - return(NULL); - } - memcpy(buffer, buf, len); - while (xmlIsNameChar(ctxt, c)) { - if (count++ > 100) { - count = 0; - GROW; - } - if (len + 10 > max) { - xmlChar *tmp; - - max *= 2; - tmp = (xmlChar *) xmlRealloc(buffer, - max * sizeof(xmlChar)); - if (tmp == NULL) { - xmlErrMemory(ctxt, NULL); - xmlFree(buffer); - return(NULL); - } - buffer = tmp; - } - COPY_BUF(l,buffer,len,c); - NEXTL(l); - c = CUR_CHAR(l); - } - buffer[len] = 0; - return(buffer); - } - } - if (len == 0) - return(NULL); - return(xmlStrndup(buf, len)); -} - -/** - * xmlParseEntityValue: - * @ctxt: an XML parser context - * @orig: if non-NULL store a copy of the original entity value - * - * parse a value for ENTITY declarations - * - * [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | - * "'" ([^%&'] | PEReference | Reference)* "'" - * - * Returns the EntityValue parsed with reference substituted or NULL - */ - -xmlChar * -xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) { - xmlChar *buf = NULL; - int len = 0; - int size = XML_PARSER_BUFFER_SIZE; - int c, l; - xmlChar stop; - xmlChar *ret = NULL; - const xmlChar *cur = NULL; - xmlParserInputPtr input; - - if (RAW == '"') stop = '"'; - else if (RAW == '\'') stop = '\''; - else { - xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_STARTED, NULL); - return(NULL); - } - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); - if (buf == NULL) { - xmlErrMemory(ctxt, NULL); - return(NULL); - } - - /* - * The content of the entity definition is copied in a buffer. - */ - - ctxt->instate = XML_PARSER_ENTITY_VALUE; - input = ctxt->input; - GROW; - NEXT; - c = CUR_CHAR(l); - /* - * NOTE: 4.4.5 Included in Literal - * When a parameter entity reference appears in a literal entity - * value, ... a single or double quote character in the replacement - * text is always treated as a normal data character and will not - * terminate the literal. - * In practice it means we stop the loop only when back at parsing - * the initial entity and the quote is found - */ - while ((IS_CHAR(c)) && ((c != stop) || /* checked */ - (ctxt->input != input))) { - if (len + 5 >= size) { - xmlChar *tmp; - - size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); - if (tmp == NULL) { - xmlErrMemory(ctxt, NULL); - xmlFree(buf); - return(NULL); - } - buf = tmp; - } - COPY_BUF(l,buf,len,c); - NEXTL(l); - /* - * Pop-up of finished entities. - */ - while ((RAW == 0) && (ctxt->inputNr > 1)) /* non input consuming */ - xmlPopInput(ctxt); - - GROW; - c = CUR_CHAR(l); - if (c == 0) { - GROW; - c = CUR_CHAR(l); - } - } - buf[len] = 0; - - /* - * Raise problem w.r.t. '&' and '%' being used in non-entities - * reference constructs. Note Charref will be handled in - * xmlStringDecodeEntities() - */ - cur = buf; - while (*cur != 0) { /* non input consuming */ - if ((*cur == '%') || ((*cur == '&') && (cur[1] != '#'))) { - xmlChar *name; - xmlChar tmp = *cur; - - cur++; - name = xmlParseStringName(ctxt, &cur); - if ((name == NULL) || (*cur != ';')) { - xmlFatalErrMsgInt(ctxt, XML_ERR_ENTITY_CHAR_ERROR, - "EntityValue: '%c' forbidden except for entities references\n", - tmp); - } - if ((tmp == '%') && (ctxt->inSubset == 1) && - (ctxt->inputNr == 1)) { - xmlFatalErr(ctxt, XML_ERR_ENTITY_PE_INTERNAL, NULL); - } - if (name != NULL) - xmlFree(name); - if (*cur == 0) - break; - } - cur++; - } - - /* - * Then PEReference entities are substituted. - */ - if (c != stop) { - xmlFatalErr(ctxt, XML_ERR_ENTITY_NOT_FINISHED, NULL); - xmlFree(buf); - } else { - NEXT; - /* - * NOTE: 4.4.7 Bypassed - * When a general entity reference appears in the EntityValue in - * an entity declaration, it is bypassed and left as is. - * so XML_SUBSTITUTE_REF is not set here. - */ - ret = xmlStringDecodeEntities(ctxt, buf, XML_SUBSTITUTE_PEREF, - 0, 0, 0); - if (orig != NULL) - *orig = buf; - else - xmlFree(buf); - } - - return(ret); -} - -/** - * xmlParseAttValueComplex: - * @ctxt: an XML parser context - * @len: the resulting attribute len - * @normalize: wether to apply the inner normalization - * - * parse a value for an attribute, this is the fallback function - * of xmlParseAttValue() when the attribute parsing requires handling - * of non-ASCII characters, or normalization compaction. - * - * Returns the AttValue parsed or NULL. The value has to be freed by the caller. - */ -static xmlChar * -xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { - xmlChar limit = 0; - xmlChar *buf = NULL; - xmlChar *rep = NULL; - int len = 0; - int buf_size = 0; - int c, l, in_space = 0; - xmlChar *current = NULL; - xmlEntityPtr ent; - - if (NXT(0) == '"') { - ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; - limit = '"'; - NEXT; - } else if (NXT(0) == '\'') { - limit = '\''; - ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; - NEXT; - } else { - xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL); - return(NULL); - } - - /* - * allocate a translation buffer. - */ - buf_size = XML_PARSER_BUFFER_SIZE; - buf = (xmlChar *) xmlMallocAtomic(buf_size * sizeof(xmlChar)); - if (buf == NULL) goto mem_error; - - /* - * OK loop until we reach one of the ending char or a size limit. - */ - c = CUR_CHAR(l); - while ((NXT(0) != limit) && /* checked */ - (IS_CHAR(c)) && (c != '<')) { - if (c == 0) break; - if (c == '&') { - in_space = 0; - if (NXT(1) == '#') { - int val = xmlParseCharRef(ctxt); - - if (val == '&') { - if (ctxt->replaceEntities) { - if (len > buf_size - 10) { - growBuffer(buf, 10); - } - buf[len++] = '&'; - } else { - /* - * The reparsing will be done in xmlStringGetNodeList() - * called by the attribute() function in SAX.c - */ - if (len > buf_size - 10) { - growBuffer(buf, 10); - } - buf[len++] = '&'; - buf[len++] = '#'; - buf[len++] = '3'; - buf[len++] = '8'; - buf[len++] = ';'; - } - } else if (val != 0) { - if (len > buf_size - 10) { - growBuffer(buf, 10); - } - len += xmlCopyChar(0, &buf[len], val); - } - } else { - ent = xmlParseEntityRef(ctxt); - ctxt->nbentities++; - if (ent != NULL) - ctxt->nbentities += ent->owner; - if ((ent != NULL) && - (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { - if (len > buf_size - 10) { - growBuffer(buf, 10); - } - if ((ctxt->replaceEntities == 0) && - (ent->content[0] == '&')) { - buf[len++] = '&'; - buf[len++] = '#'; - buf[len++] = '3'; - buf[len++] = '8'; - buf[len++] = ';'; - } else { - buf[len++] = ent->content[0]; - } - } else if ((ent != NULL) && - (ctxt->replaceEntities != 0)) { - if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) { - rep = xmlStringDecodeEntities(ctxt, ent->content, - XML_SUBSTITUTE_REF, - 0, 0, 0); - if (rep != NULL) { - current = rep; - while (*current != 0) { /* non input consuming */ - if ((*current == 0xD) || (*current == 0xA) || - (*current == 0x9)) { - buf[len++] = 0x20; - current++; - } else - buf[len++] = *current++; - if (len > buf_size - 10) { - growBuffer(buf, 10); - } - } - xmlFree(rep); - rep = NULL; - } - } else { - if (len > buf_size - 10) { - growBuffer(buf, 10); - } - if (ent->content != NULL) - buf[len++] = ent->content[0]; - } - } else if (ent != NULL) { - int i = xmlStrlen(ent->name); - const xmlChar *cur = ent->name; - - /* - * This may look absurd but is needed to detect - * entities problems - */ - if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && - (ent->content != NULL)) { - rep = xmlStringDecodeEntities(ctxt, ent->content, - XML_SUBSTITUTE_REF, 0, 0, 0); - if (rep != NULL) { - xmlFree(rep); - rep = NULL; - } - } - - /* - * Just output the reference - */ - buf[len++] = '&'; - while (len > buf_size - i - 10) { - growBuffer(buf, i + 10); - } - for (;i > 0;i--) - buf[len++] = *cur++; - buf[len++] = ';'; - } - } - } else { - if ((c == 0x20) || (c == 0xD) || (c == 0xA) || (c == 0x9)) { - if ((len != 0) || (!normalize)) { - if ((!normalize) || (!in_space)) { - COPY_BUF(l,buf,len,0x20); - while (len > buf_size - 10) { - growBuffer(buf, 10); - } - } - in_space = 1; - } - } else { - in_space = 0; - COPY_BUF(l,buf,len,c); - if (len > buf_size - 10) { - growBuffer(buf, 10); - } - } - NEXTL(l); - } - GROW; - c = CUR_CHAR(l); - } - if ((in_space) && (normalize)) { - while (buf[len - 1] == 0x20) len--; - } - buf[len] = 0; - if (RAW == '<') { - xmlFatalErr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, NULL); - } else if (RAW != limit) { - if ((c != 0) && (!IS_CHAR(c))) { - xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR, - "invalid character in attribute value\n"); - } else { - xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, - "AttValue: ' expected\n"); - } - } else - NEXT; - if (attlen != NULL) *attlen = len; - return(buf); - -mem_error: - xmlErrMemory(ctxt, NULL); - if (buf != NULL) - xmlFree(buf); - if (rep != NULL) - xmlFree(rep); - return(NULL); -} - -/** - * xmlParseAttValue: - * @ctxt: an XML parser context - * - * parse a value for an attribute - * Note: the parser won't do substitution of entities here, this - * will be handled later in xmlStringGetNodeList - * - * [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | - * "'" ([^<&'] | Reference)* "'" - * - * 3.3.3 Attribute-Value Normalization: - * Before the value of an attribute is passed to the application or - * checked for validity, the XML processor must normalize it as follows: - * - a character reference is processed by appending the referenced - * character to the attribute value - * - an entity reference is processed by recursively processing the - * replacement text of the entity - * - a whitespace character (#x20, #xD, #xA, #x9) is processed by - * appending #x20 to the normalized value, except that only a single - * #x20 is appended for a "#xD#xA" sequence that is part of an external - * parsed entity or the literal entity value of an internal parsed entity - * - other characters are processed by appending them to the normalized value - * If the declared value is not CDATA, then the XML processor must further - * process the normalized attribute value by discarding any leading and - * trailing space (#x20) characters, and by replacing sequences of space - * (#x20) characters by a single space (#x20) character. - * All attributes for which no declaration has been read should be treated - * by a non-validating parser as if declared CDATA. - * - * Returns the AttValue parsed or NULL. The value has to be freed by the caller. - */ - - -xmlChar * -xmlParseAttValue(xmlParserCtxtPtr ctxt) { - if ((ctxt == NULL) || (ctxt->input == NULL)) return(NULL); - return(xmlParseAttValueInternal(ctxt, NULL, NULL, 0)); -} - -/** - * xmlParseSystemLiteral: - * @ctxt: an XML parser context - * - * parse an XML Literal - * - * [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") - * - * Returns the SystemLiteral parsed or NULL - */ - -xmlChar * -xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { - xmlChar *buf = NULL; - int len = 0; - int size = XML_PARSER_BUFFER_SIZE; - int cur, l; - xmlChar stop; - int state = ctxt->instate; - int count = 0; - - SHRINK; - if (RAW == '"') { - NEXT; - stop = '"'; - } else if (RAW == '\'') { - NEXT; - stop = '\''; - } else { - xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); - return(NULL); - } - - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); - if (buf == NULL) { - xmlErrMemory(ctxt, NULL); - return(NULL); - } - ctxt->instate = XML_PARSER_SYSTEM_LITERAL; - cur = CUR_CHAR(l); - while ((IS_CHAR(cur)) && (cur != stop)) { /* checked */ - if (len + 5 >= size) { - xmlChar *tmp; - - size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); - if (tmp == NULL) { - xmlFree(buf); - xmlErrMemory(ctxt, NULL); - ctxt->instate = (xmlParserInputState) state; - return(NULL); - } - buf = tmp; - } - count++; - if (count > 50) { - GROW; - count = 0; - } - COPY_BUF(l,buf,len,cur); - NEXTL(l); - cur = CUR_CHAR(l); - if (cur == 0) { - GROW; - SHRINK; - cur = CUR_CHAR(l); - } - } - buf[len] = 0; - ctxt->instate = (xmlParserInputState) state; - if (!IS_CHAR(cur)) { - xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); - } else { - NEXT; - } - return(buf); -} - -/** - * xmlParsePubidLiteral: - * @ctxt: an XML parser context - * - * parse an XML public literal - * - * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" - * - * Returns the PubidLiteral parsed or NULL. - */ - -xmlChar * -xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { - xmlChar *buf = NULL; - int len = 0; - int size = XML_PARSER_BUFFER_SIZE; - xmlChar cur; - xmlChar stop; - int count = 0; - xmlParserInputState oldstate = ctxt->instate; - - SHRINK; - if (RAW == '"') { - NEXT; - stop = '"'; - } else if (RAW == '\'') { - NEXT; - stop = '\''; - } else { - xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); - return(NULL); - } - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); - if (buf == NULL) { - xmlErrMemory(ctxt, NULL); - return(NULL); - } - ctxt->instate = XML_PARSER_PUBLIC_LITERAL; - cur = CUR; - while ((IS_PUBIDCHAR_CH(cur)) && (cur != stop)) { /* checked */ - if (len + 1 >= size) { - xmlChar *tmp; - - size *= 2; - tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); - if (tmp == NULL) { - xmlErrMemory(ctxt, NULL); - xmlFree(buf); - return(NULL); - } - buf = tmp; - } - buf[len++] = cur; - count++; - if (count > 50) { - GROW; - count = 0; - } - NEXT; - cur = CUR; - if (cur == 0) { - GROW; - SHRINK; - cur = CUR; - } - } - buf[len] = 0; - if (cur != stop) { - xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); - } else { - NEXT; - } - ctxt->instate = oldstate; - return(buf); -} - -static void xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata); - -/* - * used for the test in the inner loop of the char data testing - */ -static const unsigned char test_char_data[256] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x9, CR/LF separated */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x00, 0x27, /* & */ - 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3A, 0x3B, 0x00, 0x3D, 0x3E, 0x3F, /* < */ - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x00, 0x5E, 0x5F, /* ] */ - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* non-ascii */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -/** - * xmlParseCharData: - * @ctxt: an XML parser context - * @cdata: int indicating whether we are within a CDATA section - * - * parse a CharData section. - * if we are within a CDATA section ']]>' marks an end of section. - * - * The right angle bracket (>) may be represented using the string ">", - * and must, for compatibility, be escaped using ">" or a character - * reference when it appears in the string "]]>" in content, when that - * string is not marking the end of a CDATA section. - * - * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) - */ - -void -xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) { - const xmlChar *in; - int nbchar = 0; - int line = ctxt->input->line; - int col = ctxt->input->col; - int ccol; - - SHRINK; - GROW; - /* - * Accelerated common case where input don't need to be - * modified before passing it to the handler. - */ - if (!cdata) { - in = ctxt->input->cur; - do { -get_more_space: - while (*in == 0x20) { in++; ctxt->input->col++; } - if (*in == 0xA) { - do { - ctxt->input->line++; ctxt->input->col = 1; - in++; - } while (*in == 0xA); - goto get_more_space; - } - if (*in == '<') { - nbchar = in - ctxt->input->cur; - if (nbchar > 0) { - const xmlChar *tmp = ctxt->input->cur; - ctxt->input->cur = in; - - if ((ctxt->sax != NULL) && - (ctxt->sax->ignorableWhitespace != - ctxt->sax->characters)) { - if (areBlanks(ctxt, tmp, nbchar, 1)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, - tmp, nbchar); - } else { - if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, - tmp, nbchar); - if (*ctxt->space == -1) - *ctxt->space = -2; - } - } else if ((ctxt->sax != NULL) && - (ctxt->sax->characters != NULL)) { - ctxt->sax->characters(ctxt->userData, - tmp, nbchar); - } - } - return; - } - -get_more: - ccol = ctxt->input->col; - while (test_char_data[*in]) { - in++; - ccol++; - } - ctxt->input->col = ccol; - if (*in == 0xA) { - do { - ctxt->input->line++; ctxt->input->col = 1; - in++; - } while (*in == 0xA); - goto get_more; - } - if (*in == ']') { - if ((in[1] == ']') && (in[2] == '>')) { - xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL); - ctxt->input->cur = in; - return; - } - in++; - ctxt->input->col++; - goto get_more; - } - nbchar = in - ctxt->input->cur; - if (nbchar > 0) { - if ((ctxt->sax != NULL) && - (ctxt->sax->ignorableWhitespace != - ctxt->sax->characters) && - (IS_BLANK_CH(*ctxt->input->cur))) { - const xmlChar *tmp = ctxt->input->cur; - ctxt->input->cur = in; - - if (areBlanks(ctxt, tmp, nbchar, 0)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, - tmp, nbchar); - } else { - if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, - tmp, nbchar); - if (*ctxt->space == -1) - *ctxt->space = -2; - } - line = ctxt->input->line; - col = ctxt->input->col; - } else if (ctxt->sax != NULL) { - if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, - ctxt->input->cur, nbchar); - line = ctxt->input->line; - col = ctxt->input->col; - } - /* something really bad happened in the SAX callback */ - if (ctxt->instate != XML_PARSER_CONTENT) - return; - } - ctxt->input->cur = in; - if (*in == 0xD) { - in++; - if (*in == 0xA) { - ctxt->input->cur = in; - in++; - ctxt->input->line++; ctxt->input->col = 1; - continue; /* while */ - } - in--; - } - if (*in == '<') { - return; - } - if (*in == '&') { - return; - } - SHRINK; - GROW; - in = ctxt->input->cur; - } while (((*in >= 0x20) && (*in <= 0x7F)) || (*in == 0x09)); - nbchar = 0; - } - ctxt->input->line = line; - ctxt->input->col = col; - xmlParseCharDataComplex(ctxt, cdata); -} - -/** - * xmlParseCharDataComplex: - * @ctxt: an XML parser context - * @cdata: int indicating whether we are within a CDATA section - * - * parse a CharData section.this is the fallback function - * of xmlParseCharData() when the parsing requires handling - * of non-ASCII characters. - */ -static void -xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) { - xmlChar buf[XML_PARSER_BIG_BUFFER_SIZE + 5]; - int nbchar = 0; - int cur, l; - int count = 0; - - SHRINK; - GROW; - cur = CUR_CHAR(l); - while ((cur != '<') && /* checked */ - (cur != '&') && - (IS_CHAR(cur))) /* test also done in xmlCurrentChar() */ { - if ((cur == ']') && (NXT(1) == ']') && - (NXT(2) == '>')) { - if (cdata) break; - else { - xmlFatalErr(ctxt, XML_ERR_MISPLACED_CDATA_END, NULL); - } - } - COPY_BUF(l,buf,nbchar,cur); - if (nbchar >= XML_PARSER_BIG_BUFFER_SIZE) { - buf[nbchar] = 0; - - /* - * OK the segment is to be consumed as chars. - */ - if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { - if (areBlanks(ctxt, buf, nbchar, 0)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, - buf, nbchar); - } else { - if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, buf, nbchar); - if ((ctxt->sax->characters != - ctxt->sax->ignorableWhitespace) && - (*ctxt->space == -1)) - *ctxt->space = -2; - } - } - nbchar = 0; - /* something really bad happened in the SAX callback */ - if (ctxt->instate != XML_PARSER_CONTENT) - return; - } - count++; - if (count > 50) { - GROW; - count = 0; - } - NEXTL(l); - cur = CUR_CHAR(l); - } - if (nbchar != 0) { - buf[nbchar] = 0; - /* - * OK the segment is to be consumed as chars. - */ - if ((ctxt->sax != NULL) && (!ctxt->disableSAX)) { - if (areBlanks(ctxt, buf, nbchar, 0)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); - } else { - if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, buf, nbchar); - if ((ctxt->sax->characters != ctxt->sax->ignorableWhitespace) && - (*ctxt->space == -1)) - *ctxt->space = -2; - } - } - } - if ((cur != 0) && (!IS_CHAR(cur))) { - /* Generate the error and skip the offending character */ - xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, - "PCDATA invalid Char value %d\n", - cur); - NEXTL(l); - } -} - -/** - * xmlParseExternalID: - * @ctxt: an XML parser context - * @publicID: a xmlChar** receiving PubidLiteral - * @strict: indicate whether we should restrict parsing to only - * production [75], see NOTE below - * - * Parse an External ID or a Public ID - * - * NOTE: Productions [75] and [83] interact badly since [75] can generate - * 'PUBLIC' S PubidLiteral S SystemLiteral - * - * [75] ExternalID ::= 'SYSTEM' S SystemLiteral - * | 'PUBLIC' S PubidLiteral S SystemLiteral - * - * [83] PublicID ::= 'PUBLIC' S PubidLiteral - * - * Returns the function returns SystemLiteral and in the second - * case publicID receives PubidLiteral, is strict is off - * it is possible to return NULL and have publicID set. - */ - -xmlChar * -xmlParseExternalID(xmlParserCtxtPtr ctxt, xmlChar **publicID, int strict) { - xmlChar *URI = NULL; - - SHRINK; - - *publicID = NULL; - if (CMP6(CUR_PTR, 'S', 'Y', 'S', 'T', 'E', 'M')) { - SKIP(6); - if (!IS_BLANK_CH(CUR)) { - xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, - "Space required after 'SYSTEM'\n"); - } - SKIP_BLANKS; - URI = xmlParseSystemLiteral(ctxt); - if (URI == NULL) { - xmlFatalErr(ctxt, XML_ERR_URI_REQUIRED, NULL); - } - } else if (CMP6(CUR_PTR, 'P', 'U', 'B', 'L', 'I', 'C')) { - SKIP(6); - if (!IS_BLANK_CH(CUR)) { - xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, - "Space required after 'PUBLIC'\n"); - } - SKIP_BLANKS; - *publicID = xmlParsePubidLiteral(ctxt); - if (*publicID == NULL) { - xmlFatalErr(ctxt, XML_ERR_PUBID_REQUIRED, NULL); - } - if (strict) { - /* - * We don't handle [83] so "S SystemLiteral" is required. - */ - if (!IS_BLANK_CH(CUR)) { - xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, - "Space required after the Public Identifier\n"); - } - } else { - /* - * We handle [83] so we return immediately, if - * "S SystemLiteral" is not detected. From a purely parsing - * point of view that's a nice mess. - */ - const xmlChar *ptr; - GROW; - - ptr = CUR_PTR; - if (!IS_BLANK_CH(*ptr)) return(NULL); - - while (IS_BLANK_CH(*ptr)) ptr++; /* TODO: dangerous, fix ! */ - if ((*ptr != '\'') && (*ptr != '"')) return(NULL); - } - SKIP_BLANKS; - URI = xmlParseSystemLiteral(ctxt); - if (URI == NULL) { - xmlFatalErr(ctxt, XML_ERR_URI_REQUIRED, NULL); - } - } - return(URI); -} - -/** - * xmlParseCommentComplex: - * @ctxt: an XML parser context - * @buf: the already parsed part of the buffer - * @len: number of bytes filles in the buffer - * @size: allocated size of the buffer - * - * Skip an XML (SGML) comment - * The spec says that "For compatibility, the string "--" (double-hyphen) - * must not occur within comments. " - * This is the slow routine in case the accelerator for ascii didn't work - * - * [15] Comment ::= '' - */ -static void -xmlParseCommentComplex(xmlParserCtxtPtr ctxt, xmlChar *buf, int len, int size) { - int q, ql; - int r, rl; - int cur, l; - int count = 0; - int inputid; - - inputid = ctxt->input->id; - - if (buf == NULL) { - len = 0; - size = XML_PARSER_BUFFER_SIZE; - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); - if (buf == NULL) { - xmlErrMemory(ctxt, NULL); - return; - } - } - GROW; /* Assure there's enough input data */ - q = CUR_CHAR(ql); - if (q == 0) - goto not_terminated; - if (!IS_CHAR(q)) { - xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, - "xmlParseComment: invalid xmlChar value %d\n", - q); - xmlFree (buf); - return; - } - NEXTL(ql); - r = CUR_CHAR(rl); - if (r == 0) - goto not_terminated; - if (!IS_CHAR(r)) { - xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR, - "xmlParseComment: invalid xmlChar value %d\n", - q); - xmlFree (buf); - return; - } - NEXTL(rl); - cur = CUR_CHAR(l); - if (cur == 0) - goto not_terminated; - while (IS_CHAR(cur) && /* checked */ - ((cur != '>') || - (r != '-') || (q != '-'))) { - if ((r == '-') && (q == '-')) { - xmlFatalErr(ctxt, XML_ERR_HYPHEN_IN_COMMENT, NULL); - } - if (len + 5 >= size) { - xmlChar *new_buf; - size *= 2; - new_buf = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); - if (new_buf == NULL) { - xmlFree (buf); - xmlErrMemory(ctxt, NULL); - return; - } - buf = new_buf; - } - COPY_BUF(ql,buf,len,q); - q = r; - ql = rl; - r = cur; - rl = l; - - count++; - if (count > 50) { - GROW; - count = 0; - } - NEXTL(l); - cur = CUR_CHAR(l); - if (cur == 0) { - SHRINK; - GROW; - cur = CUR_CHAR(l); - } - } - buf[len] = 0; - if (cur == 0) { - xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, - "Comment not terminated \n - * The spec says that "For compatibility, the string "--" (double-hyphen) - * must not occur within comments. " - * - * [15] Comment ::= '' - */ -void -xmlParseComment(xmlParserCtxtPtr ctxt) { - xmlChar *buf = NULL; - int size = XML_PARSER_BUFFER_SIZE; - int len = 0; - xmlParserInputState state; - const xmlChar *in; - int nbchar = 0, ccol; - int inputid; - - /* - * Check that there is a comment right here. - */ - if ((RAW != '<') || (NXT(1) != '!') || - (NXT(2) != '-') || (NXT(3) != '-')) return; - state = ctxt->instate; - ctxt->instate = XML_PARSER_COMMENT; - inputid = ctxt->input->id; - SKIP(4); - SHRINK; - GROW; - - /* - * Accelerated common case where input don't need to be - * modified before passing it to the handler. - */ - in = ctxt->input->cur; - do { - if (*in == 0xA) { - do { - ctxt->input->line++; ctxt->input->col = 1; - in++; - } while (*in == 0xA); - } -get_more: - ccol = ctxt->input->col; - while (((*in > '-') && (*in <= 0x7F)) || - ((*in >= 0x20) && (*in < '-')) || - (*in == 0x09)) { - in++; - ccol++; - } - ctxt->input->col = ccol; - if (*in == 0xA) { - do { - ctxt->input->line++; ctxt->input->col = 1; - in++; - } while (*in == 0xA); - goto get_more; - } - nbchar = in - ctxt->input->cur; - /* - * save current set of data - */ - if (nbchar > 0) { - if ((ctxt->sax != NULL) && - (ctxt->sax->comment != NULL)) { - if (buf == NULL) { - if ((*in == '-') && (in[1] == '-')) - size = nbchar + 1; - else - size = XML_PARSER_BUFFER_SIZE + nbchar; - buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); - if (buf == NULL) { - xmlErrMemory(ctxt, NULL); - ctxt->instate = state; - return; - } - len = 0; - } else if (len + nbchar + 1 >= size) { - xmlChar *new_buf; - size += len + nbchar + XML_PARSER_BUFFER_SIZE; - new_buf = (xmlChar *) xmlRealloc(buf, - size * sizeof(xmlChar)); - if (new_buf == NULL) { - xmlFree (buf); - xmlErrMemory(ctxt, NULL); - ctxt->instate = state; - return; - } - buf = new_buf; - } - memcpy(&buf[len], ctxt->input->cur, nbchar); - len += nbchar; - buf[len] = 0; - } - } - ctxt->input->cur = in; - if (*in == 0xA) { - in++; - ctxt->input->line++; ctxt->input->col = 1; - } - if (*in == 0xD) { - in++; - if (*in == 0xA) { - ctxt->input->cur = in; - in++; - ctxt->input->line++; ctxt->input->col = 1; - continue; /* while */ - } - in--; - } - SHRINK; - GROW; - in = ctxt->input->cur; - if (*in == '-') { - if (in[1] == '-') { - if (in[2] == '>') { - if (ctxt->input->id != inputid) { - xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, - "comment doesn't start and stop in the same entity\n"); - } - SKIP(3); - if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) && - (!ctxt->disableSAX)) { - if (buf != NULL) - ctxt->sax->comment(ctxt->userData, buf); - else - ctxt->sax->comment(ctxt->userData, BAD_CAST ""); - } - if (buf != NULL) - xmlFree(buf); - ctxt->instate = state; - return; - } - if (buf != NULL) - xmlFatalErrMsgStr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, - "Comment not terminated \n next; - */ - cur = cur->parent; - goto leave_node; - } else { - /* This is for attributes only. */ - clone = clone->parent; - parentClone = clone->parent; - /* - * Process parent-element --> children. - */ - cur = cur->parent; - goto into_content; - } - } - goto exit; - -internal_error: - ret = -1; - -exit: - /* - * Cleanup. - */ - if (nsMap != NULL) { - if ((ctxt) && (ctxt->namespaceMap == nsMap)) { - /* - * Just cleanup the map but don't free. - */ - if (nsMap->first) { - if (nsMap->pool) - nsMap->last->next = nsMap->pool; - nsMap->pool = nsMap->first; - nsMap->first = NULL; - } - } else - xmlDOMWrapNsMapFree(nsMap); - } - /* - * TODO: Should we try a cleanup of the cloned node in case of a - * fatal error? - */ - *resNode = resultClone; - return (ret); -} - -/* -* xmlDOMWrapAdoptAttr: -* @ctxt: the optional context for custom processing -* @sourceDoc: the optional source document of attr -* @attr: the attribute-node to be adopted -* @destDoc: the destination doc for adoption -* @destParent: the optional new parent of @attr in @destDoc -* @options: option flags -* -* @attr is adopted by @destDoc. -* Ensures that ns-references point to @destDoc: either to -* elements->nsDef entries if @destParent is given, or to -* @destDoc->oldNs otherwise. -* -* Returns 0 if succeeded, -1 otherwise and on API/internal errors. -*/ -static int -xmlDOMWrapAdoptAttr(xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr sourceDoc, - xmlAttrPtr attr, - xmlDocPtr destDoc, - xmlNodePtr destParent, - int options ATTRIBUTE_UNUSED) -{ - xmlNodePtr cur; - int adoptStr = 1; - - if ((attr == NULL) || (destDoc == NULL)) - return (-1); - - attr->doc = destDoc; - if (attr->ns != NULL) { - xmlNsPtr ns = NULL; - - if (ctxt != NULL) { - /* TODO: User defined. */ - } - /* XML Namespace. */ - if (IS_STR_XML(attr->ns->prefix)) { - ns = xmlTreeEnsureXMLDecl(destDoc); - } else if (destParent == NULL) { - /* - * Store in @destDoc->oldNs. - */ - ns = xmlDOMWrapStoreNs(destDoc, attr->ns->href, attr->ns->prefix); - } else { - /* - * Declare on @destParent. - */ - if (xmlSearchNsByNamespaceStrict(destDoc, destParent, attr->ns->href, - &ns, 1) == -1) - goto internal_error; - if (ns == NULL) { - ns = xmlDOMWrapNSNormDeclareNsForced(destDoc, destParent, - attr->ns->href, attr->ns->prefix, 1); - } - } - if (ns == NULL) - goto internal_error; - attr->ns = ns; - } - - XML_TREE_ADOPT_STR(attr->name); - attr->atype = 0; - attr->psvi = NULL; - /* - * Walk content. - */ - if (attr->children == NULL) - return (0); - cur = attr->children; - while (cur != NULL) { - cur->doc = destDoc; - switch (cur->type) { - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - XML_TREE_ADOPT_STR_2(cur->content) - break; - case XML_ENTITY_REF_NODE: - /* - * Remove reference to the entitity-node. - */ - cur->content = NULL; - cur->children = NULL; - cur->last = NULL; - if ((destDoc->intSubset) || (destDoc->extSubset)) { - xmlEntityPtr ent; - /* - * Assign new entity-node if available. - */ - ent = xmlGetDocEntity(destDoc, cur->name); - if (ent != NULL) { - cur->content = ent->content; - cur->children = (xmlNodePtr) ent; - cur->last = (xmlNodePtr) ent; - } - } - break; - default: - break; - } - if (cur->children != NULL) { - cur = cur->children; - continue; - } -next_sibling: - if (cur == (xmlNodePtr) attr) - break; - if (cur->next != NULL) - cur = cur->next; - else { - cur = cur->parent; - goto next_sibling; - } - } - return (0); -internal_error: - return (-1); -} - -/* -* xmlDOMWrapAdoptNode: -* @ctxt: the optional context for custom processing -* @sourceDoc: the optional sourceDoc -* @node: the node to start with -* @destDoc: the destination doc -* @destParent: the optional new parent of @node in @destDoc -* @options: option flags -* -* References of out-of scope ns-decls are remapped to point to @destDoc: -* 1) If @destParent is given, then nsDef entries on element-nodes are used -* 2) If *no* @destParent is given, then @destDoc->oldNs entries are used -* This is the case when you have an unliked node and just want to move it -* to the context of -* -* If @destParent is given, it ensures that the tree is namespace -* wellformed by creating additional ns-decls where needed. -* Note that, since prefixes of already existent ns-decls can be -* shadowed by this process, it could break QNames in attribute -* values or element content. -* NOTE: This function was not intensively tested. -* -* Returns 0 if the operation succeeded, -* 1 if a node of unsupported type was given, -* 2 if a node of not yet supported type was given and -* -1 on API/internal errors. -*/ -int -xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt, - xmlDocPtr sourceDoc, - xmlNodePtr node, - xmlDocPtr destDoc, - xmlNodePtr destParent, - int options) -{ - if ((node == NULL) || (destDoc == NULL) || - ((destParent != NULL) && (destParent->doc != destDoc))) - return(-1); - /* - * Check node->doc sanity. - */ - if ((node->doc != NULL) && (sourceDoc != NULL) && - (node->doc != sourceDoc)) { - /* - * Might be an XIncluded node. - */ - return (-1); - } - if (sourceDoc == NULL) - sourceDoc = node->doc; - if (sourceDoc == destDoc) - return (-1); - switch (node->type) { - case XML_ELEMENT_NODE: - case XML_ATTRIBUTE_NODE: - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - case XML_ENTITY_REF_NODE: - case XML_PI_NODE: - case XML_COMMENT_NODE: - break; - case XML_DOCUMENT_FRAG_NODE: - /* TODO: Support document-fragment-nodes. */ - return (2); - default: - return (1); - } - /* - * Unlink only if @node was not already added to @destParent. - */ - if ((node->parent != NULL) && (destParent != node->parent)) - xmlUnlinkNode(node); - - if (node->type == XML_ELEMENT_NODE) { - return (xmlDOMWrapAdoptBranch(ctxt, sourceDoc, node, - destDoc, destParent, options)); - } else if (node->type == XML_ATTRIBUTE_NODE) { - return (xmlDOMWrapAdoptAttr(ctxt, sourceDoc, - (xmlAttrPtr) node, destDoc, destParent, options)); - } else { - xmlNodePtr cur = node; - int adoptStr = 1; - - cur->doc = destDoc; - /* - * Optimize string adoption. - */ - if ((sourceDoc != NULL) && - (sourceDoc->dict == destDoc->dict)) - adoptStr = 0; - switch (node->type) { - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - XML_TREE_ADOPT_STR_2(node->content) - break; - case XML_ENTITY_REF_NODE: - /* - * Remove reference to the entitity-node. - */ - node->content = NULL; - node->children = NULL; - node->last = NULL; - if ((destDoc->intSubset) || (destDoc->extSubset)) { - xmlEntityPtr ent; - /* - * Assign new entity-node if available. - */ - ent = xmlGetDocEntity(destDoc, node->name); - if (ent != NULL) { - node->content = ent->content; - node->children = (xmlNodePtr) ent; - node->last = (xmlNodePtr) ent; - } - } - XML_TREE_ADOPT_STR(node->name) - break; - case XML_PI_NODE: { - XML_TREE_ADOPT_STR(node->name) - XML_TREE_ADOPT_STR_2(node->content) - break; - } - default: - break; - } - } - return (0); -} - -#define bottom_tree -#include "elfgcchack.h" diff --git a/deps/libxml2/uri.c b/deps/libxml2/uri.c deleted file mode 100644 index 1d5a4f6db8..0000000000 --- a/deps/libxml2/uri.c +++ /dev/null @@ -1,2392 +0,0 @@ -/** - * uri.c: set of generic URI related routines - * - * Reference: RFCs 3986, 2732 and 2373 - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#include - -#include -#include -#include -#include - -static void xmlCleanURI(xmlURIPtr uri); - -/* - * Old rule from 2396 used in legacy handling code - * alpha = lowalpha | upalpha - */ -#define IS_ALPHA(x) (IS_LOWALPHA(x) || IS_UPALPHA(x)) - - -/* - * lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | - * "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | - * "u" | "v" | "w" | "x" | "y" | "z" - */ - -#define IS_LOWALPHA(x) (((x) >= 'a') && ((x) <= 'z')) - -/* - * upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | - * "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | - * "U" | "V" | "W" | "X" | "Y" | "Z" - */ -#define IS_UPALPHA(x) (((x) >= 'A') && ((x) <= 'Z')) - -#ifdef IS_DIGIT -#undef IS_DIGIT -#endif -/* - * digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" - */ -#define IS_DIGIT(x) (((x) >= '0') && ((x) <= '9')) - -/* - * alphanum = alpha | digit - */ - -#define IS_ALPHANUM(x) (IS_ALPHA(x) || IS_DIGIT(x)) - -/* - * mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" - */ - -#define IS_MARK(x) (((x) == '-') || ((x) == '_') || ((x) == '.') || \ - ((x) == '!') || ((x) == '~') || ((x) == '*') || ((x) == '\'') || \ - ((x) == '(') || ((x) == ')')) - -/* - * unwise = "{" | "}" | "|" | "\" | "^" | "`" - */ - -#define IS_UNWISE(p) \ - (((*(p) == '{')) || ((*(p) == '}')) || ((*(p) == '|')) || \ - ((*(p) == '\\')) || ((*(p) == '^')) || ((*(p) == '[')) || \ - ((*(p) == ']')) || ((*(p) == '`'))) -/* - * reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," | - * "[" | "]" - */ - -#define IS_RESERVED(x) (((x) == ';') || ((x) == '/') || ((x) == '?') || \ - ((x) == ':') || ((x) == '@') || ((x) == '&') || ((x) == '=') || \ - ((x) == '+') || ((x) == '$') || ((x) == ',') || ((x) == '[') || \ - ((x) == ']')) - -/* - * unreserved = alphanum | mark - */ - -#define IS_UNRESERVED(x) (IS_ALPHANUM(x) || IS_MARK(x)) - -/* - * Skip to next pointer char, handle escaped sequences - */ - -#define URI_NEXT(p) ((*p == '%')? p += 3 : p++) - -/* - * Productions from the spec. - * - * authority = server | reg_name - * reg_name = 1*( unreserved | escaped | "$" | "," | - * ";" | ":" | "@" | "&" | "=" | "+" ) - * - * path = [ abs_path | opaque_part ] - */ - -#define STRNDUP(s, n) (char *) xmlStrndup((const xmlChar *)(s), (n)) - -/************************************************************************ - * * - * RFC 3986 parser * - * * - ************************************************************************/ - -#define ISA_DIGIT(p) ((*(p) >= '0') && (*(p) <= '9')) -#define ISA_ALPHA(p) (((*(p) >= 'a') && (*(p) <= 'z')) || \ - ((*(p) >= 'A') && (*(p) <= 'Z'))) -#define ISA_HEXDIG(p) \ - (ISA_DIGIT(p) || ((*(p) >= 'a') && (*(p) <= 'f')) || \ - ((*(p) >= 'A') && (*(p) <= 'F'))) - -/* - * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" - * / "*" / "+" / "," / ";" / "=" - */ -#define ISA_SUB_DELIM(p) \ - (((*(p) == '!')) || ((*(p) == '$')) || ((*(p) == '&')) || \ - ((*(p) == '(')) || ((*(p) == ')')) || ((*(p) == '*')) || \ - ((*(p) == '+')) || ((*(p) == ',')) || ((*(p) == ';')) || \ - ((*(p) == '=')) || ((*(p) == '\''))) - -/* - * gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" - */ -#define ISA_GEN_DELIM(p) \ - (((*(p) == ':')) || ((*(p) == '/')) || ((*(p) == '?')) || \ - ((*(p) == '#')) || ((*(p) == '[')) || ((*(p) == ']')) || \ - ((*(p) == '@'))) - -/* - * reserved = gen-delims / sub-delims - */ -#define ISA_RESERVED(p) (ISA_GEN_DELIM(p) || (ISA_SUB_DELIM(p))) - -/* - * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - */ -#define ISA_UNRESERVED(p) \ - ((ISA_ALPHA(p)) || (ISA_DIGIT(p)) || ((*(p) == '-')) || \ - ((*(p) == '.')) || ((*(p) == '_')) || ((*(p) == '~'))) - -/* - * pct-encoded = "%" HEXDIG HEXDIG - */ -#define ISA_PCT_ENCODED(p) \ - ((*(p) == '%') && (ISA_HEXDIG(p + 1)) && (ISA_HEXDIG(p + 2))) - -/* - * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - */ -#define ISA_PCHAR(p) \ - (ISA_UNRESERVED(p) || ISA_PCT_ENCODED(p) || ISA_SUB_DELIM(p) || \ - ((*(p) == ':')) || ((*(p) == '@'))) - -/** - * xmlParse3986Scheme: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse an URI scheme - * - * ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) - * - * Returns 0 or the error code - */ -static int -xmlParse3986Scheme(xmlURIPtr uri, const char **str) { - const char *cur; - - if (str == NULL) - return(-1); - - cur = *str; - if (!ISA_ALPHA(cur)) - return(2); - cur++; - while (ISA_ALPHA(cur) || ISA_DIGIT(cur) || - (*cur == '+') || (*cur == '-') || (*cur == '.')) cur++; - if (uri != NULL) { - if (uri->scheme != NULL) xmlFree(uri->scheme); - uri->scheme = STRNDUP(*str, cur - *str); - } - *str = cur; - return(0); -} - -/** - * xmlParse3986Fragment: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse the query part of an URI - * - * fragment = *( pchar / "/" / "?" ) - * NOTE: the strict syntax as defined by 3986 does not allow '[' and ']' - * in the fragment identifier but this is used very broadly for - * xpointer scheme selection, so we are allowing it here to not break - * for example all the DocBook processing chains. - * - * Returns 0 or the error code - */ -static int -xmlParse3986Fragment(xmlURIPtr uri, const char **str) -{ - const char *cur; - - if (str == NULL) - return (-1); - - cur = *str; - - while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') || - (*cur == '[') || (*cur == ']') || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - URI_NEXT(cur); - if (uri != NULL) { - if (uri->fragment != NULL) - xmlFree(uri->fragment); - if (uri->cleanup & 2) - uri->fragment = STRNDUP(*str, cur - *str); - else - uri->fragment = xmlURIUnescapeString(*str, cur - *str, NULL); - } - *str = cur; - return (0); -} - -/** - * xmlParse3986Query: - * @uri: pointer to an URI structure - * @str: pointer to the string to analyze - * - * Parse the query part of an URI - * - * query = *uric - * - * Returns 0 or the error code - */ -static int -xmlParse3986Query(xmlURIPtr uri, const char **str) -{ - const char *cur; - - if (str == NULL) - return (-1); - - cur = *str; - - while ((ISA_PCHAR(cur)) || (*cur == '/') || (*cur == '?') || - ((uri != NULL) && (uri->cleanup & 1) && (IS_UNWISE(cur)))) - URI_NEXT(cur); - if (uri != NULL) { - if (uri->query != NULL) - xmlFree(uri->query); - if (uri->cleanup & 2) - uri->query = STRNDUP(*str, cur - *str); - else - uri->query = xmlURIUnescapeString(*str, cur - *str, NULL); - - /* Save the raw bytes of the query as well. - * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00114 - */ - if (uri->query_raw != NULL) - xmlFree (uri->query_raw); - uri->query_raw = STRNDUP (*str, cur - *str); - } - *str = cur; - return (0); -} - -/** - * xmlParse3986Port: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse a port part and fills in the appropriate fields - * of the @uri structure - * - * port = *DIGIT - * - * Returns 0 or the error code - */ -static int -xmlParse3986Port(xmlURIPtr uri, const char **str) -{ - const char *cur = *str; - - if (ISA_DIGIT(cur)) { - if (uri != NULL) - uri->port = 0; - while (ISA_DIGIT(cur)) { - if (uri != NULL) - uri->port = uri->port * 10 + (*cur - '0'); - cur++; - } - *str = cur; - return(0); - } - return(1); -} - -/** - * xmlParse3986Userinfo: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an user informations part and fills in the appropriate fields - * of the @uri structure - * - * userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) - * - * Returns 0 or the error code - */ -static int -xmlParse3986Userinfo(xmlURIPtr uri, const char **str) -{ - const char *cur; - - cur = *str; - while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || - ISA_SUB_DELIM(cur) || (*cur == ':')) - URI_NEXT(cur); - if (*cur == '@') { - if (uri != NULL) { - if (uri->user != NULL) xmlFree(uri->user); - if (uri->cleanup & 2) - uri->user = STRNDUP(*str, cur - *str); - else - uri->user = xmlURIUnescapeString(*str, cur - *str, NULL); - } - *str = cur; - return(0); - } - return(1); -} - -/** - * xmlParse3986DecOctet: - * @str: the string to analyze - * - * dec-octet = DIGIT ; 0-9 - * / %x31-39 DIGIT ; 10-99 - * / "1" 2DIGIT ; 100-199 - * / "2" %x30-34 DIGIT ; 200-249 - * / "25" %x30-35 ; 250-255 - * - * Skip a dec-octet. - * - * Returns 0 if found and skipped, 1 otherwise - */ -static int -xmlParse3986DecOctet(const char **str) { - const char *cur = *str; - - if (!(ISA_DIGIT(cur))) - return(1); - if (!ISA_DIGIT(cur+1)) - cur++; - else if ((*cur != '0') && (ISA_DIGIT(cur + 1)) && (!ISA_DIGIT(cur+2))) - cur += 2; - else if ((*cur == '1') && (ISA_DIGIT(cur + 1)) && (ISA_DIGIT(cur + 2))) - cur += 3; - else if ((*cur == '2') && (*(cur + 1) >= '0') && - (*(cur + 1) <= '4') && (ISA_DIGIT(cur + 2))) - cur += 3; - else if ((*cur == '2') && (*(cur + 1) == '5') && - (*(cur + 2) >= '0') && (*(cur + 1) <= '5')) - cur += 3; - else - return(1); - *str = cur; - return(0); -} -/** - * xmlParse3986Host: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an host part and fills in the appropriate fields - * of the @uri structure - * - * host = IP-literal / IPv4address / reg-name - * IP-literal = "[" ( IPv6address / IPvFuture ) "]" - * IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet - * reg-name = *( unreserved / pct-encoded / sub-delims ) - * - * Returns 0 or the error code - */ -static int -xmlParse3986Host(xmlURIPtr uri, const char **str) -{ - const char *cur = *str; - const char *host; - - host = cur; - /* - * IPv6 and future adressing scheme are enclosed between brackets - */ - if (*cur == '[') { - cur++; - while ((*cur != ']') && (*cur != 0)) - cur++; - if (*cur != ']') - return(1); - cur++; - goto found; - } - /* - * try to parse an IPv4 - */ - if (ISA_DIGIT(cur)) { - if (xmlParse3986DecOctet(&cur) != 0) - goto not_ipv4; - if (*cur != '.') - goto not_ipv4; - cur++; - if (xmlParse3986DecOctet(&cur) != 0) - goto not_ipv4; - if (*cur != '.') - goto not_ipv4; - if (xmlParse3986DecOctet(&cur) != 0) - goto not_ipv4; - if (*cur != '.') - goto not_ipv4; - if (xmlParse3986DecOctet(&cur) != 0) - goto not_ipv4; - goto found; -not_ipv4: - cur = *str; - } - /* - * then this should be a hostname which can be empty - */ - while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || ISA_SUB_DELIM(cur)) - URI_NEXT(cur); -found: - if (uri != NULL) { - if (uri->authority != NULL) xmlFree(uri->authority); - uri->authority = NULL; - if (uri->server != NULL) xmlFree(uri->server); - if (cur != host) { - if (uri->cleanup & 2) - uri->server = STRNDUP(host, cur - host); - else - uri->server = xmlURIUnescapeString(host, cur - host, NULL); - } else - uri->server = NULL; - } - *str = cur; - return(0); -} - -/** - * xmlParse3986Authority: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an authority part and fills in the appropriate fields - * of the @uri structure - * - * authority = [ userinfo "@" ] host [ ":" port ] - * - * Returns 0 or the error code - */ -static int -xmlParse3986Authority(xmlURIPtr uri, const char **str) -{ - const char *cur; - int ret; - - cur = *str; - /* - * try to parse an userinfo and check for the trailing @ - */ - ret = xmlParse3986Userinfo(uri, &cur); - if ((ret != 0) || (*cur != '@')) - cur = *str; - else - cur++; - ret = xmlParse3986Host(uri, &cur); - if (ret != 0) return(ret); - if (*cur == ':') { - cur++; - ret = xmlParse3986Port(uri, &cur); - if (ret != 0) return(ret); - } - *str = cur; - return(0); -} - -/** - * xmlParse3986Segment: - * @str: the string to analyze - * @forbid: an optional forbidden character - * @empty: allow an empty segment - * - * Parse a segment and fills in the appropriate fields - * of the @uri structure - * - * segment = *pchar - * segment-nz = 1*pchar - * segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ) - * ; non-zero-length segment without any colon ":" - * - * Returns 0 or the error code - */ -static int -xmlParse3986Segment(const char **str, char forbid, int empty) -{ - const char *cur; - - cur = *str; - if (!ISA_PCHAR(cur)) { - if (empty) - return(0); - return(1); - } - while (ISA_PCHAR(cur) && (*cur != forbid)) - URI_NEXT(cur); - *str = cur; - return (0); -} - -/** - * xmlParse3986PathAbEmpty: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an path absolute or empty and fills in the appropriate fields - * of the @uri structure - * - * path-abempty = *( "/" segment ) - * - * Returns 0 or the error code - */ -static int -xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str) -{ - const char *cur; - int ret; - - cur = *str; - - while (*cur == '/') { - cur++; - ret = xmlParse3986Segment(&cur, 0, 1); - if (ret != 0) return(ret); - } - if (uri != NULL) { - if (uri->path != NULL) xmlFree(uri->path); - if (*str != cur) { - if (uri->cleanup & 2) - uri->path = STRNDUP(*str, cur - *str); - else - uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); - } else { - uri->path = NULL; - } - } - *str = cur; - return (0); -} - -/** - * xmlParse3986PathAbsolute: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an path absolute and fills in the appropriate fields - * of the @uri structure - * - * path-absolute = "/" [ segment-nz *( "/" segment ) ] - * - * Returns 0 or the error code - */ -static int -xmlParse3986PathAbsolute(xmlURIPtr uri, const char **str) -{ - const char *cur; - int ret; - - cur = *str; - - if (*cur != '/') - return(1); - cur++; - ret = xmlParse3986Segment(&cur, 0, 0); - if (ret == 0) { - while (*cur == '/') { - cur++; - ret = xmlParse3986Segment(&cur, 0, 1); - if (ret != 0) return(ret); - } - } - if (uri != NULL) { - if (uri->path != NULL) xmlFree(uri->path); - if (cur != *str) { - if (uri->cleanup & 2) - uri->path = STRNDUP(*str, cur - *str); - else - uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); - } else { - uri->path = NULL; - } - } - *str = cur; - return (0); -} - -/** - * xmlParse3986PathRootless: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an path without root and fills in the appropriate fields - * of the @uri structure - * - * path-rootless = segment-nz *( "/" segment ) - * - * Returns 0 or the error code - */ -static int -xmlParse3986PathRootless(xmlURIPtr uri, const char **str) -{ - const char *cur; - int ret; - - cur = *str; - - ret = xmlParse3986Segment(&cur, 0, 0); - if (ret != 0) return(ret); - while (*cur == '/') { - cur++; - ret = xmlParse3986Segment(&cur, 0, 1); - if (ret != 0) return(ret); - } - if (uri != NULL) { - if (uri->path != NULL) xmlFree(uri->path); - if (cur != *str) { - if (uri->cleanup & 2) - uri->path = STRNDUP(*str, cur - *str); - else - uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); - } else { - uri->path = NULL; - } - } - *str = cur; - return (0); -} - -/** - * xmlParse3986PathNoScheme: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an path which is not a scheme and fills in the appropriate fields - * of the @uri structure - * - * path-noscheme = segment-nz-nc *( "/" segment ) - * - * Returns 0 or the error code - */ -static int -xmlParse3986PathNoScheme(xmlURIPtr uri, const char **str) -{ - const char *cur; - int ret; - - cur = *str; - - ret = xmlParse3986Segment(&cur, ':', 0); - if (ret != 0) return(ret); - while (*cur == '/') { - cur++; - ret = xmlParse3986Segment(&cur, 0, 1); - if (ret != 0) return(ret); - } - if (uri != NULL) { - if (uri->path != NULL) xmlFree(uri->path); - if (cur != *str) { - if (uri->cleanup & 2) - uri->path = STRNDUP(*str, cur - *str); - else - uri->path = xmlURIUnescapeString(*str, cur - *str, NULL); - } else { - uri->path = NULL; - } - } - *str = cur; - return (0); -} - -/** - * xmlParse3986HierPart: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an hierarchical part and fills in the appropriate fields - * of the @uri structure - * - * hier-part = "//" authority path-abempty - * / path-absolute - * / path-rootless - * / path-empty - * - * Returns 0 or the error code - */ -static int -xmlParse3986HierPart(xmlURIPtr uri, const char **str) -{ - const char *cur; - int ret; - - cur = *str; - - if ((*cur == '/') && (*(cur + 1) == '/')) { - cur += 2; - ret = xmlParse3986Authority(uri, &cur); - if (ret != 0) return(ret); - ret = xmlParse3986PathAbEmpty(uri, &cur); - if (ret != 0) return(ret); - *str = cur; - return(0); - } else if (*cur == '/') { - ret = xmlParse3986PathAbsolute(uri, &cur); - if (ret != 0) return(ret); - } else if (ISA_PCHAR(cur)) { - ret = xmlParse3986PathRootless(uri, &cur); - if (ret != 0) return(ret); - } else { - /* path-empty is effectively empty */ - if (uri != NULL) { - if (uri->path != NULL) xmlFree(uri->path); - uri->path = NULL; - } - } - *str = cur; - return (0); -} - -/** - * xmlParse3986RelativeRef: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an URI string and fills in the appropriate fields - * of the @uri structure - * - * relative-ref = relative-part [ "?" query ] [ "#" fragment ] - * relative-part = "//" authority path-abempty - * / path-absolute - * / path-noscheme - * / path-empty - * - * Returns 0 or the error code - */ -static int -xmlParse3986RelativeRef(xmlURIPtr uri, const char *str) { - int ret; - - if ((*str == '/') && (*(str + 1) == '/')) { - str += 2; - ret = xmlParse3986Authority(uri, &str); - if (ret != 0) return(ret); - ret = xmlParse3986PathAbEmpty(uri, &str); - if (ret != 0) return(ret); - } else if (*str == '/') { - ret = xmlParse3986PathAbsolute(uri, &str); - if (ret != 0) return(ret); - } else if (ISA_PCHAR(str)) { - ret = xmlParse3986PathNoScheme(uri, &str); - if (ret != 0) return(ret); - } else { - /* path-empty is effectively empty */ - if (uri != NULL) { - if (uri->path != NULL) xmlFree(uri->path); - uri->path = NULL; - } - } - - if (*str == '?') { - str++; - ret = xmlParse3986Query(uri, &str); - if (ret != 0) return(ret); - } - if (*str == '#') { - str++; - ret = xmlParse3986Fragment(uri, &str); - if (ret != 0) return(ret); - } - if (*str != 0) { - xmlCleanURI(uri); - return(1); - } - return(0); -} - - -/** - * xmlParse3986URI: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an URI string and fills in the appropriate fields - * of the @uri structure - * - * scheme ":" hier-part [ "?" query ] [ "#" fragment ] - * - * Returns 0 or the error code - */ -static int -xmlParse3986URI(xmlURIPtr uri, const char *str) { - int ret; - - ret = xmlParse3986Scheme(uri, &str); - if (ret != 0) return(ret); - if (*str != ':') { - return(1); - } - str++; - ret = xmlParse3986HierPart(uri, &str); - if (ret != 0) return(ret); - if (*str == '?') { - str++; - ret = xmlParse3986Query(uri, &str); - if (ret != 0) return(ret); - } - if (*str == '#') { - str++; - ret = xmlParse3986Fragment(uri, &str); - if (ret != 0) return(ret); - } - if (*str != 0) { - xmlCleanURI(uri); - return(1); - } - return(0); -} - -/** - * xmlParse3986URIReference: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an URI reference string and fills in the appropriate fields - * of the @uri structure - * - * URI-reference = URI / relative-ref - * - * Returns 0 or the error code - */ -static int -xmlParse3986URIReference(xmlURIPtr uri, const char *str) { - int ret; - - if (str == NULL) - return(-1); - xmlCleanURI(uri); - - /* - * Try first to parse absolute refs, then fallback to relative if - * it fails. - */ - ret = xmlParse3986URI(uri, str); - if (ret != 0) { - xmlCleanURI(uri); - ret = xmlParse3986RelativeRef(uri, str); - if (ret != 0) { - xmlCleanURI(uri); - return(ret); - } - } - return(0); -} - -/** - * xmlParseURI: - * @str: the URI string to analyze - * - * Parse an URI based on RFC 3986 - * - * URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] - * - * Returns a newly built xmlURIPtr or NULL in case of error - */ -xmlURIPtr -xmlParseURI(const char *str) { - xmlURIPtr uri; - int ret; - - if (str == NULL) - return(NULL); - uri = xmlCreateURI(); - if (uri != NULL) { - ret = xmlParse3986URIReference(uri, str); - if (ret) { - xmlFreeURI(uri); - return(NULL); - } - } - return(uri); -} - -/** - * xmlParseURIReference: - * @uri: pointer to an URI structure - * @str: the string to analyze - * - * Parse an URI reference string based on RFC 3986 and fills in the - * appropriate fields of the @uri structure - * - * URI-reference = URI / relative-ref - * - * Returns 0 or the error code - */ -int -xmlParseURIReference(xmlURIPtr uri, const char *str) { - return(xmlParse3986URIReference(uri, str)); -} - -/** - * xmlParseURIRaw: - * @str: the URI string to analyze - * @raw: if 1 unescaping of URI pieces are disabled - * - * Parse an URI but allows to keep intact the original fragments. - * - * URI-reference = URI / relative-ref - * - * Returns a newly built xmlURIPtr or NULL in case of error - */ -xmlURIPtr -xmlParseURIRaw(const char *str, int raw) { - xmlURIPtr uri; - int ret; - - if (str == NULL) - return(NULL); - uri = xmlCreateURI(); - if (uri != NULL) { - if (raw) { - uri->cleanup |= 2; - } - ret = xmlParseURIReference(uri, str); - if (ret) { - xmlFreeURI(uri); - return(NULL); - } - } - return(uri); -} - -/************************************************************************ - * * - * Generic URI structure functions * - * * - ************************************************************************/ - -/** - * xmlCreateURI: - * - * Simply creates an empty xmlURI - * - * Returns the new structure or NULL in case of error - */ -xmlURIPtr -xmlCreateURI(void) { - xmlURIPtr ret; - - ret = (xmlURIPtr) xmlMalloc(sizeof(xmlURI)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlCreateURI: out of memory\n"); - return(NULL); - } - memset(ret, 0, sizeof(xmlURI)); - return(ret); -} - -/** - * xmlSaveUri: - * @uri: pointer to an xmlURI - * - * Save the URI as an escaped string - * - * Returns a new string (to be deallocated by caller) - */ -xmlChar * -xmlSaveUri(xmlURIPtr uri) { - xmlChar *ret = NULL; - xmlChar *temp; - const char *p; - int len; - int max; - - if (uri == NULL) return(NULL); - - - max = 80; - ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - len = 0; - - if (uri->scheme != NULL) { - p = uri->scheme; - while (*p != 0) { - if (len >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = *p++; - } - if (len >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = ':'; - } - if (uri->opaque != NULL) { - p = uri->opaque; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - if (IS_RESERVED(*(p)) || IS_UNRESERVED(*(p))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } else { - if (uri->server != NULL) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = '/'; - ret[len++] = '/'; - if (uri->user != NULL) { - p = uri->user; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - if ((IS_UNRESERVED(*(p))) || - ((*(p) == ';')) || ((*(p) == ':')) || - ((*(p) == '&')) || ((*(p) == '=')) || - ((*(p) == '+')) || ((*(p) == '$')) || - ((*(p) == ','))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = '@'; - } - p = uri->server; - while (*p != 0) { - if (len >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = *p++; - } - if (uri->port > 0) { - if (len + 10 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - len += snprintf((char *) &ret[len], max - len, ":%d", uri->port); - } - } else if (uri->authority != NULL) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = '/'; - ret[len++] = '/'; - p = uri->authority; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - if ((IS_UNRESERVED(*(p))) || - ((*(p) == '$')) || ((*(p) == ',')) || ((*(p) == ';')) || - ((*(p) == ':')) || ((*(p) == '@')) || ((*(p) == '&')) || - ((*(p) == '=')) || ((*(p) == '+'))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } else if (uri->scheme != NULL) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = '/'; - ret[len++] = '/'; - } - if (uri->path != NULL) { - p = uri->path; - /* - * the colon in file:///d: should not be escaped or - * Windows accesses fail later. - */ - if ((uri->scheme != NULL) && - (p[0] == '/') && - (((p[1] >= 'a') && (p[1] <= 'z')) || - ((p[1] >= 'A') && (p[1] <= 'Z'))) && - (p[2] == ':') && - (xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) { - if (len + 3 >= max) { - max *= 2; - ret = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - return(NULL); - } - } - ret[len++] = *p++; - ret[len++] = *p++; - ret[len++] = *p++; - } - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - if ((IS_UNRESERVED(*(p))) || ((*(p) == '/')) || - ((*(p) == ';')) || ((*(p) == '@')) || ((*(p) == '&')) || - ((*(p) == '=')) || ((*(p) == '+')) || ((*(p) == '$')) || - ((*(p) == ','))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } - if (uri->query_raw != NULL) { - if (len + 1 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = '?'; - p = uri->query_raw; - while (*p != 0) { - if (len + 1 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = *p++; - } - } else if (uri->query != NULL) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = '?'; - p = uri->query; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } - } - if (uri->fragment != NULL) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len++] = '#'; - p = uri->fragment; - while (*p != 0) { - if (len + 3 >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, - (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - if ((IS_UNRESERVED(*(p))) || (IS_RESERVED(*(p)))) - ret[len++] = *p++; - else { - int val = *(unsigned char *)p++; - int hi = val / 0x10, lo = val % 0x10; - ret[len++] = '%'; - ret[len++] = hi + (hi > 9? 'A'-10 : '0'); - ret[len++] = lo + (lo > 9? 'A'-10 : '0'); - } - } - } - if (len >= max) { - max *= 2; - temp = (xmlChar *) xmlRealloc(ret, (max + 1) * sizeof(xmlChar)); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlSaveUri: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - ret[len] = 0; - return(ret); -} - -/** - * xmlPrintURI: - * @stream: a FILE* for the output - * @uri: pointer to an xmlURI - * - * Prints the URI in the stream @stream. - */ -void -xmlPrintURI(FILE *stream, xmlURIPtr uri) { - xmlChar *out; - - out = xmlSaveUri(uri); - if (out != NULL) { - fprintf(stream, "%s", (char *) out); - xmlFree(out); - } -} - -/** - * xmlCleanURI: - * @uri: pointer to an xmlURI - * - * Make sure the xmlURI struct is free of content - */ -static void -xmlCleanURI(xmlURIPtr uri) { - if (uri == NULL) return; - - if (uri->scheme != NULL) xmlFree(uri->scheme); - uri->scheme = NULL; - if (uri->server != NULL) xmlFree(uri->server); - uri->server = NULL; - if (uri->user != NULL) xmlFree(uri->user); - uri->user = NULL; - if (uri->path != NULL) xmlFree(uri->path); - uri->path = NULL; - if (uri->fragment != NULL) xmlFree(uri->fragment); - uri->fragment = NULL; - if (uri->opaque != NULL) xmlFree(uri->opaque); - uri->opaque = NULL; - if (uri->authority != NULL) xmlFree(uri->authority); - uri->authority = NULL; - if (uri->query != NULL) xmlFree(uri->query); - uri->query = NULL; - if (uri->query_raw != NULL) xmlFree(uri->query_raw); - uri->query_raw = NULL; -} - -/** - * xmlFreeURI: - * @uri: pointer to an xmlURI - * - * Free up the xmlURI struct - */ -void -xmlFreeURI(xmlURIPtr uri) { - if (uri == NULL) return; - - if (uri->scheme != NULL) xmlFree(uri->scheme); - if (uri->server != NULL) xmlFree(uri->server); - if (uri->user != NULL) xmlFree(uri->user); - if (uri->path != NULL) xmlFree(uri->path); - if (uri->fragment != NULL) xmlFree(uri->fragment); - if (uri->opaque != NULL) xmlFree(uri->opaque); - if (uri->authority != NULL) xmlFree(uri->authority); - if (uri->query != NULL) xmlFree(uri->query); - if (uri->query_raw != NULL) xmlFree(uri->query_raw); - xmlFree(uri); -} - -/************************************************************************ - * * - * Helper functions * - * * - ************************************************************************/ - -/** - * xmlNormalizeURIPath: - * @path: pointer to the path string - * - * Applies the 5 normalization steps to a path string--that is, RFC 2396 - * Section 5.2, steps 6.c through 6.g. - * - * Normalization occurs directly on the string, no new allocation is done - * - * Returns 0 or an error code - */ -int -xmlNormalizeURIPath(char *path) { - char *cur, *out; - - if (path == NULL) - return(-1); - - /* Skip all initial "/" chars. We want to get to the beginning of the - * first non-empty segment. - */ - cur = path; - while (cur[0] == '/') - ++cur; - if (cur[0] == '\0') - return(0); - - /* Keep everything we've seen so far. */ - out = cur; - - /* - * Analyze each segment in sequence for cases (c) and (d). - */ - while (cur[0] != '\0') { - /* - * c) All occurrences of "./", where "." is a complete path segment, - * are removed from the buffer string. - */ - if ((cur[0] == '.') && (cur[1] == '/')) { - cur += 2; - /* '//' normalization should be done at this point too */ - while (cur[0] == '/') - cur++; - continue; - } - - /* - * d) If the buffer string ends with "." as a complete path segment, - * that "." is removed. - */ - if ((cur[0] == '.') && (cur[1] == '\0')) - break; - - /* Otherwise keep the segment. */ - while (cur[0] != '/') { - if (cur[0] == '\0') - goto done_cd; - (out++)[0] = (cur++)[0]; - } - /* nomalize // */ - while ((cur[0] == '/') && (cur[1] == '/')) - cur++; - - (out++)[0] = (cur++)[0]; - } - done_cd: - out[0] = '\0'; - - /* Reset to the beginning of the first segment for the next sequence. */ - cur = path; - while (cur[0] == '/') - ++cur; - if (cur[0] == '\0') - return(0); - - /* - * Analyze each segment in sequence for cases (e) and (f). - * - * e) All occurrences of "/../", where is a - * complete path segment not equal to "..", are removed from the - * buffer string. Removal of these path segments is performed - * iteratively, removing the leftmost matching pattern on each - * iteration, until no matching pattern remains. - * - * f) If the buffer string ends with "/..", where - * is a complete path segment not equal to "..", that - * "/.." is removed. - * - * To satisfy the "iterative" clause in (e), we need to collapse the - * string every time we find something that needs to be removed. Thus, - * we don't need to keep two pointers into the string: we only need a - * "current position" pointer. - */ - while (1) { - char *segp, *tmp; - - /* At the beginning of each iteration of this loop, "cur" points to - * the first character of the segment we want to examine. - */ - - /* Find the end of the current segment. */ - segp = cur; - while ((segp[0] != '/') && (segp[0] != '\0')) - ++segp; - - /* If this is the last segment, we're done (we need at least two - * segments to meet the criteria for the (e) and (f) cases). - */ - if (segp[0] == '\0') - break; - - /* If the first segment is "..", or if the next segment _isn't_ "..", - * keep this segment and try the next one. - */ - ++segp; - if (((cur[0] == '.') && (cur[1] == '.') && (segp == cur+3)) - || ((segp[0] != '.') || (segp[1] != '.') - || ((segp[2] != '/') && (segp[2] != '\0')))) { - cur = segp; - continue; - } - - /* If we get here, remove this segment and the next one and back up - * to the previous segment (if there is one), to implement the - * "iteratively" clause. It's pretty much impossible to back up - * while maintaining two pointers into the buffer, so just compact - * the whole buffer now. - */ - - /* If this is the end of the buffer, we're done. */ - if (segp[2] == '\0') { - cur[0] = '\0'; - break; - } - /* Valgrind complained, strcpy(cur, segp + 3); */ - /* string will overlap, do not use strcpy */ - tmp = cur; - segp += 3; - while ((*tmp++ = *segp++) != 0); - - /* If there are no previous segments, then keep going from here. */ - segp = cur; - while ((segp > path) && ((--segp)[0] == '/')) - ; - if (segp == path) - continue; - - /* "segp" is pointing to the end of a previous segment; find it's - * start. We need to back up to the previous segment and start - * over with that to handle things like "foo/bar/../..". If we - * don't do this, then on the first pass we'll remove the "bar/..", - * but be pointing at the second ".." so we won't realize we can also - * remove the "foo/..". - */ - cur = segp; - while ((cur > path) && (cur[-1] != '/')) - --cur; - } - out[0] = '\0'; - - /* - * g) If the resulting buffer string still begins with one or more - * complete path segments of "..", then the reference is - * considered to be in error. Implementations may handle this - * error by retaining these components in the resolved path (i.e., - * treating them as part of the final URI), by removing them from - * the resolved path (i.e., discarding relative levels above the - * root), or by avoiding traversal of the reference. - * - * We discard them from the final path. - */ - if (path[0] == '/') { - cur = path; - while ((cur[0] == '/') && (cur[1] == '.') && (cur[2] == '.') - && ((cur[3] == '/') || (cur[3] == '\0'))) - cur += 3; - - if (cur != path) { - out = path; - while (cur[0] != '\0') - (out++)[0] = (cur++)[0]; - out[0] = 0; - } - } - - return(0); -} - -static int is_hex(char c) { - if (((c >= '0') && (c <= '9')) || - ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F'))) - return(1); - return(0); -} - -/** - * xmlURIUnescapeString: - * @str: the string to unescape - * @len: the length in bytes to unescape (or <= 0 to indicate full string) - * @target: optional destination buffer - * - * Unescaping routine, but does not check that the string is an URI. The - * output is a direct unsigned char translation of %XX values (no encoding) - * Note that the length of the result can only be smaller or same size as - * the input string. - * - * Returns a copy of the string, but unescaped, will return NULL only in case - * of error - */ -char * -xmlURIUnescapeString(const char *str, int len, char *target) { - char *ret, *out; - const char *in; - - if (str == NULL) - return(NULL); - if (len <= 0) len = strlen(str); - if (len < 0) return(NULL); - - if (target == NULL) { - ret = (char *) xmlMallocAtomic(len + 1); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlURIUnescapeString: out of memory\n"); - return(NULL); - } - } else - ret = target; - in = str; - out = ret; - while(len > 0) { - if ((len > 2) && (*in == '%') && (is_hex(in[1])) && (is_hex(in[2]))) { - in++; - if ((*in >= '0') && (*in <= '9')) - *out = (*in - '0'); - else if ((*in >= 'a') && (*in <= 'f')) - *out = (*in - 'a') + 10; - else if ((*in >= 'A') && (*in <= 'F')) - *out = (*in - 'A') + 10; - in++; - if ((*in >= '0') && (*in <= '9')) - *out = *out * 16 + (*in - '0'); - else if ((*in >= 'a') && (*in <= 'f')) - *out = *out * 16 + (*in - 'a') + 10; - else if ((*in >= 'A') && (*in <= 'F')) - *out = *out * 16 + (*in - 'A') + 10; - in++; - len -= 3; - out++; - } else { - *out++ = *in++; - len--; - } - } - *out = 0; - return(ret); -} - -/** - * xmlURIEscapeStr: - * @str: string to escape - * @list: exception list string of chars not to escape - * - * This routine escapes a string to hex, ignoring reserved characters (a-z) - * and the characters in the exception list. - * - * Returns a new escaped string or NULL in case of error. - */ -xmlChar * -xmlURIEscapeStr(const xmlChar *str, const xmlChar *list) { - xmlChar *ret, ch; - xmlChar *temp; - const xmlChar *in; - - unsigned int len, out; - - if (str == NULL) - return(NULL); - if (str[0] == 0) - return(xmlStrdup(str)); - len = xmlStrlen(str); - if (!(len > 0)) return(NULL); - - len += 20; - ret = (xmlChar *) xmlMallocAtomic(len); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlURIEscapeStr: out of memory\n"); - return(NULL); - } - in = (const xmlChar *) str; - out = 0; - while(*in != 0) { - if (len - out <= 3) { - len += 20; - temp = (xmlChar *) xmlRealloc(ret, len); - if (temp == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlURIEscapeStr: out of memory\n"); - xmlFree(ret); - return(NULL); - } - ret = temp; - } - - ch = *in; - - if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!xmlStrchr(list, ch))) { - unsigned char val; - ret[out++] = '%'; - val = ch >> 4; - if (val <= 9) - ret[out++] = '0' + val; - else - ret[out++] = 'A' + val - 0xA; - val = ch & 0xF; - if (val <= 9) - ret[out++] = '0' + val; - else - ret[out++] = 'A' + val - 0xA; - in++; - } else { - ret[out++] = *in++; - } - - } - ret[out] = 0; - return(ret); -} - -/** - * xmlURIEscape: - * @str: the string of the URI to escape - * - * Escaping routine, does not do validity checks ! - * It will try to escape the chars needing this, but this is heuristic - * based it's impossible to be sure. - * - * Returns an copy of the string, but escaped - * - * 25 May 2001 - * Uses xmlParseURI and xmlURIEscapeStr to try to escape correctly - * according to RFC2396. - * - Carl Douglas - */ -xmlChar * -xmlURIEscape(const xmlChar * str) -{ - xmlChar *ret, *segment = NULL; - xmlURIPtr uri; - int ret2; - -#define NULLCHK(p) if(!p) { \ - xmlGenericError(xmlGenericErrorContext, \ - "xmlURIEscape: out of memory\n"); \ - xmlFreeURI(uri); \ - return NULL; } \ - - if (str == NULL) - return (NULL); - - uri = xmlCreateURI(); - if (uri != NULL) { - /* - * Allow escaping errors in the unescaped form - */ - uri->cleanup = 1; - ret2 = xmlParseURIReference(uri, (const char *)str); - if (ret2) { - xmlFreeURI(uri); - return (NULL); - } - } - - if (!uri) - return NULL; - - ret = NULL; - - if (uri->scheme) { - segment = xmlURIEscapeStr(BAD_CAST uri->scheme, BAD_CAST "+-."); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - ret = xmlStrcat(ret, BAD_CAST ":"); - xmlFree(segment); - } - - if (uri->authority) { - segment = - xmlURIEscapeStr(BAD_CAST uri->authority, BAD_CAST "/?;:@"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->user) { - segment = xmlURIEscapeStr(BAD_CAST uri->user, BAD_CAST ";:&=+$,"); - NULLCHK(segment) - ret = xmlStrcat(ret,BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - ret = xmlStrcat(ret, BAD_CAST "@"); - xmlFree(segment); - } - - if (uri->server) { - segment = xmlURIEscapeStr(BAD_CAST uri->server, BAD_CAST "/?;:@"); - NULLCHK(segment) - if (uri->user == NULL) - ret = xmlStrcat(ret, BAD_CAST "//"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->port) { - xmlChar port[10]; - - snprintf((char *) port, 10, "%d", uri->port); - ret = xmlStrcat(ret, BAD_CAST ":"); - ret = xmlStrcat(ret, port); - } - - if (uri->path) { - segment = - xmlURIEscapeStr(BAD_CAST uri->path, BAD_CAST ":@&=+$,/?;"); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->query_raw) { - ret = xmlStrcat(ret, BAD_CAST "?"); - ret = xmlStrcat(ret, BAD_CAST uri->query_raw); - } - else if (uri->query) { - segment = - xmlURIEscapeStr(BAD_CAST uri->query, BAD_CAST ";/?:@&=+,$"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "?"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->opaque) { - segment = xmlURIEscapeStr(BAD_CAST uri->opaque, BAD_CAST ""); - NULLCHK(segment) - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - if (uri->fragment) { - segment = xmlURIEscapeStr(BAD_CAST uri->fragment, BAD_CAST "#"); - NULLCHK(segment) - ret = xmlStrcat(ret, BAD_CAST "#"); - ret = xmlStrcat(ret, segment); - xmlFree(segment); - } - - xmlFreeURI(uri); -#undef NULLCHK - - return (ret); -} - -/************************************************************************ - * * - * Public functions * - * * - ************************************************************************/ - -/** - * xmlBuildURI: - * @URI: the URI instance found in the document - * @base: the base value - * - * Computes he final URI of the reference done by checking that - * the given URI is valid, and building the final URI using the - * base URI. This is processed according to section 5.2 of the - * RFC 2396 - * - * 5.2. Resolving Relative References to Absolute Form - * - * Returns a new URI string (to be freed by the caller) or NULL in case - * of error. - */ -xmlChar * -xmlBuildURI(const xmlChar *URI, const xmlChar *base) { - xmlChar *val = NULL; - int ret, len, indx, cur, out; - xmlURIPtr ref = NULL; - xmlURIPtr bas = NULL; - xmlURIPtr res = NULL; - - /* - * 1) The URI reference is parsed into the potential four components and - * fragment identifier, as described in Section 4.3. - * - * NOTE that a completely empty URI is treated by modern browsers - * as a reference to "." rather than as a synonym for the current - * URI. Should we do that here? - */ - if (URI == NULL) - ret = -1; - else { - if (*URI) { - ref = xmlCreateURI(); - if (ref == NULL) - goto done; - ret = xmlParseURIReference(ref, (const char *) URI); - } - else - ret = 0; - } - if (ret != 0) - goto done; - if ((ref != NULL) && (ref->scheme != NULL)) { - /* - * The URI is absolute don't modify. - */ - val = xmlStrdup(URI); - goto done; - } - if (base == NULL) - ret = -1; - else { - bas = xmlCreateURI(); - if (bas == NULL) - goto done; - ret = xmlParseURIReference(bas, (const char *) base); - } - if (ret != 0) { - if (ref) - val = xmlSaveUri(ref); - goto done; - } - if (ref == NULL) { - /* - * the base fragment must be ignored - */ - if (bas->fragment != NULL) { - xmlFree(bas->fragment); - bas->fragment = NULL; - } - val = xmlSaveUri(bas); - goto done; - } - - /* - * 2) If the path component is empty and the scheme, authority, and - * query components are undefined, then it is a reference to the - * current document and we are done. Otherwise, the reference URI's - * query and fragment components are defined as found (or not found) - * within the URI reference and not inherited from the base URI. - * - * NOTE that in modern browsers, the parsing differs from the above - * in the following aspect: the query component is allowed to be - * defined while still treating this as a reference to the current - * document. - */ - res = xmlCreateURI(); - if (res == NULL) - goto done; - if ((ref->scheme == NULL) && (ref->path == NULL) && - ((ref->authority == NULL) && (ref->server == NULL))) { - if (bas->scheme != NULL) - res->scheme = xmlMemStrdup(bas->scheme); - if (bas->authority != NULL) - res->authority = xmlMemStrdup(bas->authority); - else if (bas->server != NULL) { - res->server = xmlMemStrdup(bas->server); - if (bas->user != NULL) - res->user = xmlMemStrdup(bas->user); - res->port = bas->port; - } - if (bas->path != NULL) - res->path = xmlMemStrdup(bas->path); - if (ref->query_raw != NULL) - res->query_raw = xmlMemStrdup (ref->query_raw); - else if (ref->query != NULL) - res->query = xmlMemStrdup(ref->query); - else if (bas->query_raw != NULL) - res->query_raw = xmlMemStrdup(bas->query_raw); - else if (bas->query != NULL) - res->query = xmlMemStrdup(bas->query); - if (ref->fragment != NULL) - res->fragment = xmlMemStrdup(ref->fragment); - goto step_7; - } - - /* - * 3) If the scheme component is defined, indicating that the reference - * starts with a scheme name, then the reference is interpreted as an - * absolute URI and we are done. Otherwise, the reference URI's - * scheme is inherited from the base URI's scheme component. - */ - if (ref->scheme != NULL) { - val = xmlSaveUri(ref); - goto done; - } - if (bas->scheme != NULL) - res->scheme = xmlMemStrdup(bas->scheme); - - if (ref->query_raw != NULL) - res->query_raw = xmlMemStrdup(ref->query_raw); - else if (ref->query != NULL) - res->query = xmlMemStrdup(ref->query); - if (ref->fragment != NULL) - res->fragment = xmlMemStrdup(ref->fragment); - - /* - * 4) If the authority component is defined, then the reference is a - * network-path and we skip to step 7. Otherwise, the reference - * URI's authority is inherited from the base URI's authority - * component, which will also be undefined if the URI scheme does not - * use an authority component. - */ - if ((ref->authority != NULL) || (ref->server != NULL)) { - if (ref->authority != NULL) - res->authority = xmlMemStrdup(ref->authority); - else { - res->server = xmlMemStrdup(ref->server); - if (ref->user != NULL) - res->user = xmlMemStrdup(ref->user); - res->port = ref->port; - } - if (ref->path != NULL) - res->path = xmlMemStrdup(ref->path); - goto step_7; - } - if (bas->authority != NULL) - res->authority = xmlMemStrdup(bas->authority); - else if (bas->server != NULL) { - res->server = xmlMemStrdup(bas->server); - if (bas->user != NULL) - res->user = xmlMemStrdup(bas->user); - res->port = bas->port; - } - - /* - * 5) If the path component begins with a slash character ("/"), then - * the reference is an absolute-path and we skip to step 7. - */ - if ((ref->path != NULL) && (ref->path[0] == '/')) { - res->path = xmlMemStrdup(ref->path); - goto step_7; - } - - - /* - * 6) If this step is reached, then we are resolving a relative-path - * reference. The relative path needs to be merged with the base - * URI's path. Although there are many ways to do this, we will - * describe a simple method using a separate string buffer. - * - * Allocate a buffer large enough for the result string. - */ - len = 2; /* extra / and 0 */ - if (ref->path != NULL) - len += strlen(ref->path); - if (bas->path != NULL) - len += strlen(bas->path); - res->path = (char *) xmlMallocAtomic(len); - if (res->path == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlBuildURI: out of memory\n"); - goto done; - } - res->path[0] = 0; - - /* - * a) All but the last segment of the base URI's path component is - * copied to the buffer. In other words, any characters after the - * last (right-most) slash character, if any, are excluded. - */ - cur = 0; - out = 0; - if (bas->path != NULL) { - while (bas->path[cur] != 0) { - while ((bas->path[cur] != 0) && (bas->path[cur] != '/')) - cur++; - if (bas->path[cur] == 0) - break; - - cur++; - while (out < cur) { - res->path[out] = bas->path[out]; - out++; - } - } - } - res->path[out] = 0; - - /* - * b) The reference's path component is appended to the buffer - * string. - */ - if (ref->path != NULL && ref->path[0] != 0) { - indx = 0; - /* - * Ensure the path includes a '/' - */ - if ((out == 0) && (bas->server != NULL)) - res->path[out++] = '/'; - while (ref->path[indx] != 0) { - res->path[out++] = ref->path[indx++]; - } - } - res->path[out] = 0; - - /* - * Steps c) to h) are really path normalization steps - */ - xmlNormalizeURIPath(res->path); - -step_7: - - /* - * 7) The resulting URI components, including any inherited from the - * base URI, are recombined to give the absolute form of the URI - * reference. - */ - val = xmlSaveUri(res); - -done: - if (ref != NULL) - xmlFreeURI(ref); - if (bas != NULL) - xmlFreeURI(bas); - if (res != NULL) - xmlFreeURI(res); - return(val); -} - -/** - * xmlCanonicPath: - * @path: the resource locator in a filesystem notation - * - * Constructs a canonic path from the specified path. - * - * Returns a new canonic path, or a duplicate of the path parameter if the - * construction fails. The caller is responsible for freeing the memory occupied - * by the returned string. If there is insufficient memory available, or the - * argument is NULL, the function returns NULL. - */ -#define IS_WINDOWS_PATH(p) \ - ((p != NULL) && \ - (((p[0] >= 'a') && (p[0] <= 'z')) || \ - ((p[0] >= 'A') && (p[0] <= 'Z'))) && \ - (p[1] == ':') && ((p[2] == '/') || (p[2] == '\\'))) -xmlChar * -xmlCanonicPath(const xmlChar *path) -{ -/* - * For Windows implementations, additional work needs to be done to - * replace backslashes in pathnames with "forward slashes" - */ -#if defined(_WIN32) && !defined(__CYGWIN__) - int len = 0; - int i = 0; - xmlChar *p = NULL; -#endif - xmlURIPtr uri; - xmlChar *ret; - const xmlChar *absuri; - - if (path == NULL) - return(NULL); - - /* sanitize filename starting with // so it can be used as URI */ - if ((path[0] == '/') && (path[1] == '/') && (path[2] != '/')) - path++; - - if ((uri = xmlParseURI((const char *) path)) != NULL) { - xmlFreeURI(uri); - return xmlStrdup(path); - } - - /* Check if this is an "absolute uri" */ - absuri = xmlStrstr(path, BAD_CAST "://"); - if (absuri != NULL) { - int l, j; - unsigned char c; - xmlChar *escURI; - - /* - * this looks like an URI where some parts have not been - * escaped leading to a parsing problem. Check that the first - * part matches a protocol. - */ - l = absuri - path; - /* Bypass if first part (part before the '://') is > 20 chars */ - if ((l <= 0) || (l > 20)) - goto path_processing; - /* Bypass if any non-alpha characters are present in first part */ - for (j = 0;j < l;j++) { - c = path[j]; - if (!(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) - goto path_processing; - } - - /* Escape all except the characters specified in the supplied path */ - escURI = xmlURIEscapeStr(path, BAD_CAST ":/?_.#&;="); - if (escURI != NULL) { - /* Try parsing the escaped path */ - uri = xmlParseURI((const char *) escURI); - /* If successful, return the escaped string */ - if (uri != NULL) { - xmlFreeURI(uri); - return escURI; - } - } - } - -path_processing: -/* For Windows implementations, replace backslashes with 'forward slashes' */ -#if defined(_WIN32) && !defined(__CYGWIN__) - /* - * Create a URI structure - */ - uri = xmlCreateURI(); - if (uri == NULL) { /* Guard against 'out of memory' */ - return(NULL); - } - - len = xmlStrlen(path); - if ((len > 2) && IS_WINDOWS_PATH(path)) { - /* make the scheme 'file' */ - uri->scheme = xmlStrdup(BAD_CAST "file"); - /* allocate space for leading '/' + path + string terminator */ - uri->path = xmlMallocAtomic(len + 2); - if (uri->path == NULL) { - xmlFreeURI(uri); /* Guard agains 'out of memory' */ - return(NULL); - } - /* Put in leading '/' plus path */ - uri->path[0] = '/'; - p = uri->path + 1; - strncpy(p, path, len + 1); - } else { - uri->path = xmlStrdup(path); - if (uri->path == NULL) { - xmlFreeURI(uri); - return(NULL); - } - p = uri->path; - } - /* Now change all occurences of '\' to '/' */ - while (*p != '\0') { - if (*p == '\\') - *p = '/'; - p++; - } - - if (uri->scheme == NULL) { - ret = xmlStrdup((const xmlChar *) uri->path); - } else { - ret = xmlSaveUri(uri); - } - - xmlFreeURI(uri); -#else - ret = xmlStrdup((const xmlChar *) path); -#endif - return(ret); -} - -/** - * xmlPathToURI: - * @path: the resource locator in a filesystem notation - * - * Constructs an URI expressing the existing path - * - * Returns a new URI, or a duplicate of the path parameter if the - * construction fails. The caller is responsible for freeing the memory - * occupied by the returned string. If there is insufficient memory available, - * or the argument is NULL, the function returns NULL. - */ -xmlChar * -xmlPathToURI(const xmlChar *path) -{ - xmlURIPtr uri; - xmlURI temp; - xmlChar *ret, *cal; - - if (path == NULL) - return(NULL); - - if ((uri = xmlParseURI((const char *) path)) != NULL) { - xmlFreeURI(uri); - return xmlStrdup(path); - } - cal = xmlCanonicPath(path); - if (cal == NULL) - return(NULL); -#if defined(_WIN32) && !defined(__CYGWIN__) - /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?) - If 'cal' is a valid URI allready then we are done here, as continuing would make - it invalid. */ - if ((uri = xmlParseURI((const char *) cal)) != NULL) { - xmlFreeURI(uri); - return cal; - } - /* 'cal' can contain a relative path with backslashes. If that is processed - by xmlSaveURI, they will be escaped and the external entity loader machinery - will fail. So convert them to slashes. Misuse 'ret' for walking. */ - ret = cal; - while (*ret != '\0') { - if (*ret == '\\') - *ret = '/'; - ret++; - } -#endif - memset(&temp, 0, sizeof(temp)); - temp.path = (char *) cal; - ret = xmlSaveUri(&temp); - xmlFree(cal); - return(ret); -} -#define bottom_uri -#include "elfgcchack.h" diff --git a/deps/libxml2/valid.c b/deps/libxml2/valid.c deleted file mode 100644 index d3fb9ee679..0000000000 --- a/deps/libxml2/valid.c +++ /dev/null @@ -1,2090 +0,0 @@ -/* - * valid.c : part of the code use to do the DTD handling and the validity - * checking - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#include - -#ifdef HAVE_STDLIB_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, - int create); -#define TODO \ - xmlGenericError(xmlGenericErrorContext, \ - "Unimplemented block at %s:%d\n", \ - __FILE__, __LINE__); - -/************************************************************************ - * * - * Error handling routines * - * * - ************************************************************************/ - -/** - * xmlVErrMemory: - * @ctxt: an XML validation parser context - * @extra: extra informations - * - * Handle an out of memory error - */ -static void -xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra) -{ - xmlGenericErrorFunc channel = NULL; - xmlParserCtxtPtr pctxt = NULL; - void *data = NULL; - - if (ctxt != NULL) { - channel = ctxt->error; - data = ctxt->userData; - /* Use the special values to detect if it is part of a parsing - context */ - if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || - (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { - long delta = (char *) ctxt - (char *) ctxt->userData; - if ((delta > 0) && (delta < 250)) - pctxt = ctxt->userData; - } - } - if (extra) - __xmlRaiseError(NULL, channel, data, - pctxt, NULL, XML_FROM_VALID, XML_ERR_NO_MEMORY, - XML_ERR_FATAL, NULL, 0, extra, NULL, NULL, 0, 0, - "Memory allocation failed : %s\n", extra); - else - __xmlRaiseError(NULL, channel, data, - pctxt, NULL, XML_FROM_VALID, XML_ERR_NO_MEMORY, - XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, - "Memory allocation failed\n"); -} - -/** - * xmlErrValid: - * @ctxt: an XML validation parser context - * @error: the error number - * @extra: extra informations - * - * Handle a validation error - */ -static void -xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error, - const char *msg, const char *extra) -{ - xmlGenericErrorFunc channel = NULL; - xmlParserCtxtPtr pctxt = NULL; - void *data = NULL; - - if (ctxt != NULL) { - channel = ctxt->error; - data = ctxt->userData; - /* Use the special values to detect if it is part of a parsing - context */ - if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || - (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { - long delta = (char *) ctxt - (char *) ctxt->userData; - if ((delta > 0) && (delta < 250)) - pctxt = ctxt->userData; - } - } - if (extra) - __xmlRaiseError(NULL, channel, data, - pctxt, NULL, XML_FROM_VALID, error, - XML_ERR_ERROR, NULL, 0, extra, NULL, NULL, 0, 0, - msg, extra); - else - __xmlRaiseError(NULL, channel, data, - pctxt, NULL, XML_FROM_VALID, error, - XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, 0, 0, - "%s", msg); -} - -/** - * xmlNewDocElementContent: - * @doc: the document - * @name: the subelement name or NULL - * @type: the type of element content decl - * - * Allocate an element content structure for the document. - * - * Returns NULL if not, otherwise the new element content structure - */ -xmlElementContentPtr -xmlNewDocElementContent(xmlDocPtr doc, const xmlChar *name, - xmlElementContentType type) { - xmlElementContentPtr ret; - xmlDictPtr dict = NULL; - - if (doc != NULL) - dict = doc->dict; - - switch(type) { - case XML_ELEMENT_CONTENT_ELEMENT: - if (name == NULL) { - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, - "xmlNewElementContent : name == NULL !\n", - NULL); - } - break; - case XML_ELEMENT_CONTENT_PCDATA: - case XML_ELEMENT_CONTENT_SEQ: - case XML_ELEMENT_CONTENT_OR: - if (name != NULL) { - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, - "xmlNewElementContent : name != NULL !\n", - NULL); - } - break; - default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, - "Internal: ELEMENT content corrupted invalid type\n", - NULL); - return(NULL); - } - ret = (xmlElementContentPtr) xmlMalloc(sizeof(xmlElementContent)); - if (ret == NULL) { - xmlVErrMemory(NULL, "malloc failed"); - return(NULL); - } - memset(ret, 0, sizeof(xmlElementContent)); - ret->type = type; - ret->ocur = XML_ELEMENT_CONTENT_ONCE; - if (name != NULL) { - int l; - const xmlChar *tmp; - - tmp = xmlSplitQName3(name, &l); - if (tmp == NULL) { - if (dict == NULL) - ret->name = xmlStrdup(name); - else - ret->name = xmlDictLookup(dict, name, -1); - } else { - if (dict == NULL) { - ret->prefix = xmlStrndup(name, l); - ret->name = xmlStrdup(tmp); - } else { - ret->prefix = xmlDictLookup(dict, name, l); - ret->name = xmlDictLookup(dict, tmp, -1); - } - } - } - return(ret); -} - -/** - * xmlNewElementContent: - * @name: the subelement name or NULL - * @type: the type of element content decl - * - * Allocate an element content structure. - * Deprecated in favor of xmlNewDocElementContent - * - * Returns NULL if not, otherwise the new element content structure - */ -xmlElementContentPtr -xmlNewElementContent(const xmlChar *name, xmlElementContentType type) { - return(xmlNewDocElementContent(NULL, name, type)); -} - -/** - * xmlCopyDocElementContent: - * @doc: the document owning the element declaration - * @cur: An element content pointer. - * - * Build a copy of an element content description. - * - * Returns the new xmlElementContentPtr or NULL in case of error. - */ -xmlElementContentPtr -xmlCopyDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { - xmlElementContentPtr ret = NULL, prev = NULL, tmp; - xmlDictPtr dict = NULL; - - if (cur == NULL) return(NULL); - - if (doc != NULL) - dict = doc->dict; - - ret = (xmlElementContentPtr) xmlMalloc(sizeof(xmlElementContent)); - if (ret == NULL) { - xmlVErrMemory(NULL, "malloc failed"); - return(NULL); - } - memset(ret, 0, sizeof(xmlElementContent)); - ret->type = cur->type; - ret->ocur = cur->ocur; - if (cur->name != NULL) { - if (dict) - ret->name = xmlDictLookup(dict, cur->name, -1); - else - ret->name = xmlStrdup(cur->name); - } - - if (cur->prefix != NULL) { - if (dict) - ret->prefix = xmlDictLookup(dict, cur->prefix, -1); - else - ret->prefix = xmlStrdup(cur->prefix); - } - if (cur->c1 != NULL) - ret->c1 = xmlCopyDocElementContent(doc, cur->c1); - if (ret->c1 != NULL) - ret->c1->parent = ret; - if (cur->c2 != NULL) { - prev = ret; - cur = cur->c2; - while (cur != NULL) { - tmp = (xmlElementContentPtr) xmlMalloc(sizeof(xmlElementContent)); - if (tmp == NULL) { - xmlVErrMemory(NULL, "malloc failed"); - return(ret); - } - memset(tmp, 0, sizeof(xmlElementContent)); - tmp->type = cur->type; - tmp->ocur = cur->ocur; - prev->c2 = tmp; - if (cur->name != NULL) { - if (dict) - tmp->name = xmlDictLookup(dict, cur->name, -1); - else - tmp->name = xmlStrdup(cur->name); - } - - if (cur->prefix != NULL) { - if (dict) - tmp->prefix = xmlDictLookup(dict, cur->prefix, -1); - else - tmp->prefix = xmlStrdup(cur->prefix); - } - if (cur->c1 != NULL) - tmp->c1 = xmlCopyDocElementContent(doc,cur->c1); - if (tmp->c1 != NULL) - tmp->c1->parent = ret; - prev = tmp; - cur = cur->c2; - } - } - return(ret); -} - -/** - * xmlCopyElementContent: - * @cur: An element content pointer. - * - * Build a copy of an element content description. - * Deprecated, use xmlCopyDocElementContent instead - * - * Returns the new xmlElementContentPtr or NULL in case of error. - */ -xmlElementContentPtr -xmlCopyElementContent(xmlElementContentPtr cur) { - return(xmlCopyDocElementContent(NULL, cur)); -} - -/** - * xmlFreeDocElementContent: - * @doc: the document owning the element declaration - * @cur: the element content tree to free - * - * Free an element content structure. The whole subtree is removed. - */ -void -xmlFreeDocElementContent(xmlDocPtr doc, xmlElementContentPtr cur) { - xmlElementContentPtr next; - xmlDictPtr dict = NULL; - - if (doc != NULL) - dict = doc->dict; - - while (cur != NULL) { - next = cur->c2; - switch (cur->type) { - case XML_ELEMENT_CONTENT_PCDATA: - case XML_ELEMENT_CONTENT_ELEMENT: - case XML_ELEMENT_CONTENT_SEQ: - case XML_ELEMENT_CONTENT_OR: - break; - default: - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, - "Internal: ELEMENT content corrupted invalid type\n", - NULL); - return; - } - if (cur->c1 != NULL) xmlFreeDocElementContent(doc, cur->c1); - if (dict) { - if ((cur->name != NULL) && (!xmlDictOwns(dict, cur->name))) - xmlFree((xmlChar *) cur->name); - if ((cur->prefix != NULL) && (!xmlDictOwns(dict, cur->prefix))) - xmlFree((xmlChar *) cur->prefix); - } else { - if (cur->name != NULL) xmlFree((xmlChar *) cur->name); - if (cur->prefix != NULL) xmlFree((xmlChar *) cur->prefix); - } - xmlFree(cur); - cur = next; - } -} - -/** - * xmlFreeElementContent: - * @cur: the element content tree to free - * - * Free an element content structure. The whole subtree is removed. - * Deprecated, use xmlFreeDocElementContent instead - */ -void -xmlFreeElementContent(xmlElementContentPtr cur) { - xmlFreeDocElementContent(NULL, cur); -} - -/** - * xmlSnprintfElementContent: - * @buf: an output buffer - * @size: the buffer size - * @content: An element table - * @englob: 1 if one must print the englobing parenthesis, 0 otherwise - * - * This will dump the content of the element content definition - * Intended just for the debug routine - */ -void -xmlSnprintfElementContent(char *buf, int size, xmlElementContentPtr content, int englob) { - int len; - - if (content == NULL) return; - len = strlen(buf); - if (size - len < 50) { - if ((size - len > 4) && (buf[len - 1] != '.')) - strcat(buf, " ..."); - return; - } - if (englob) strcat(buf, "("); - switch (content->type) { - case XML_ELEMENT_CONTENT_PCDATA: - strcat(buf, "#PCDATA"); - break; - case XML_ELEMENT_CONTENT_ELEMENT: - if (content->prefix != NULL) { - if (size - len < xmlStrlen(content->prefix) + 10) { - strcat(buf, " ..."); - return; - } - strcat(buf, (char *) content->prefix); - strcat(buf, ":"); - } - if (size - len < xmlStrlen(content->name) + 10) { - strcat(buf, " ..."); - return; - } - if (content->name != NULL) - strcat(buf, (char *) content->name); - break; - case XML_ELEMENT_CONTENT_SEQ: - if ((content->c1->type == XML_ELEMENT_CONTENT_OR) || - (content->c1->type == XML_ELEMENT_CONTENT_SEQ)) - xmlSnprintfElementContent(buf, size, content->c1, 1); - else - xmlSnprintfElementContent(buf, size, content->c1, 0); - len = strlen(buf); - if (size - len < 50) { - if ((size - len > 4) && (buf[len - 1] != '.')) - strcat(buf, " ..."); - return; - } - strcat(buf, " , "); - if (((content->c2->type == XML_ELEMENT_CONTENT_OR) || - (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)) && - (content->c2->type != XML_ELEMENT_CONTENT_ELEMENT)) - xmlSnprintfElementContent(buf, size, content->c2, 1); - else - xmlSnprintfElementContent(buf, size, content->c2, 0); - break; - case XML_ELEMENT_CONTENT_OR: - if ((content->c1->type == XML_ELEMENT_CONTENT_OR) || - (content->c1->type == XML_ELEMENT_CONTENT_SEQ)) - xmlSnprintfElementContent(buf, size, content->c1, 1); - else - xmlSnprintfElementContent(buf, size, content->c1, 0); - len = strlen(buf); - if (size - len < 50) { - if ((size - len > 4) && (buf[len - 1] != '.')) - strcat(buf, " ..."); - return; - } - strcat(buf, " | "); - if (((content->c2->type == XML_ELEMENT_CONTENT_SEQ) || - (content->c2->ocur != XML_ELEMENT_CONTENT_ONCE)) && - (content->c2->type != XML_ELEMENT_CONTENT_ELEMENT)) - xmlSnprintfElementContent(buf, size, content->c2, 1); - else - xmlSnprintfElementContent(buf, size, content->c2, 0); - break; - } - if (englob) - strcat(buf, ")"); - switch (content->ocur) { - case XML_ELEMENT_CONTENT_ONCE: - break; - case XML_ELEMENT_CONTENT_OPT: - strcat(buf, "?"); - break; - case XML_ELEMENT_CONTENT_MULT: - strcat(buf, "*"); - break; - case XML_ELEMENT_CONTENT_PLUS: - strcat(buf, "+"); - break; - } -} - -/**************************************************************** - * * - * Registration of DTD declarations * - * * - ****************************************************************/ - -/** - * xmlFreeElement: - * @elem: An element - * - * Deallocate the memory used by an element definition - */ -static void -xmlFreeElement(xmlElementPtr elem) { - if (elem == NULL) return; - xmlUnlinkNode((xmlNodePtr) elem); - xmlFreeDocElementContent(elem->doc, elem->content); - if (elem->name != NULL) - xmlFree((xmlChar *) elem->name); - if (elem->prefix != NULL) - xmlFree((xmlChar *) elem->prefix); - xmlFree(elem); -} - - -/** - * xmlAddElementDecl: - * @ctxt: the validation context - * @dtd: pointer to the DTD - * @name: the entity name - * @type: the element type - * @content: the element content tree or NULL - * - * Register a new element declaration - * - * Returns NULL if not, otherwise the entity - */ -xmlElementPtr -xmlAddElementDecl(xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, const xmlChar *name, - xmlElementTypeVal type, - xmlElementContentPtr content) { - xmlElementPtr ret; - xmlElementTablePtr table; - xmlAttributePtr oldAttributes = NULL; - xmlChar *ns, *uqname; - - if (dtd == NULL) { - return(NULL); - } - if (name == NULL) { - return(NULL); - } - - switch (type) { - case XML_ELEMENT_TYPE_EMPTY: - if (content != NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, - "xmlAddElementDecl: content != NULL for EMPTY\n", - NULL); - return(NULL); - } - break; - case XML_ELEMENT_TYPE_ANY: - if (content != NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, - "xmlAddElementDecl: content != NULL for ANY\n", - NULL); - return(NULL); - } - break; - case XML_ELEMENT_TYPE_MIXED: - if (content == NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, - "xmlAddElementDecl: content == NULL for MIXED\n", - NULL); - return(NULL); - } - break; - case XML_ELEMENT_TYPE_ELEMENT: - if (content == NULL) { - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, - "xmlAddElementDecl: content == NULL for ELEMENT\n", - NULL); - return(NULL); - } - break; - default: - xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR, - "Internal: ELEMENT decl corrupted invalid type\n", - NULL); - return(NULL); - } - - /* - * check if name is a QName - */ - uqname = xmlSplitQName2(name, &ns); - if (uqname != NULL) - name = uqname; - - /* - * Create the Element table if needed. - */ - table = (xmlElementTablePtr) dtd->elements; - if (table == NULL) { - xmlDictPtr dict = NULL; - - if (dtd->doc != NULL) - dict = dtd->doc->dict; - table = xmlHashCreateDict(0, dict); - dtd->elements = (void *) table; - } - if (table == NULL) { - xmlVErrMemory(ctxt, - "xmlAddElementDecl: Table creation failed!\n"); - if (uqname != NULL) - xmlFree(uqname); - if (ns != NULL) - xmlFree(ns); - return(NULL); - } - - /* - * lookup old attributes inserted on an undefined element in the - * internal subset. - */ - if ((dtd->doc != NULL) && (dtd->doc->intSubset != NULL)) { - ret = xmlHashLookup2(dtd->doc->intSubset->elements, name, ns); - if ((ret != NULL) && (ret->etype == XML_ELEMENT_TYPE_UNDEFINED)) { - oldAttributes = ret->attributes; - ret->attributes = NULL; - xmlHashRemoveEntry2(dtd->doc->intSubset->elements, name, ns, NULL); - xmlFreeElement(ret); - } - } - - /* - * The element may already be present if one of its attribute - * was registered first - */ - ret = xmlHashLookup2(table, name, ns); - if (ret != NULL) { - if (ret->etype != XML_ELEMENT_TYPE_UNDEFINED) { - if (uqname != NULL) - xmlFree(uqname); - if (ns != NULL) - xmlFree(ns); - return(NULL); - } - if (ns != NULL) { - xmlFree(ns); - ns = NULL; - } - } else { - ret = (xmlElementPtr) xmlMalloc(sizeof(xmlElement)); - if (ret == NULL) { - xmlVErrMemory(ctxt, "malloc failed"); - if (uqname != NULL) - xmlFree(uqname); - if (ns != NULL) - xmlFree(ns); - return(NULL); - } - memset(ret, 0, sizeof(xmlElement)); - ret->type = XML_ELEMENT_DECL; - - /* - * fill the structure. - */ - ret->name = xmlStrdup(name); - if (ret->name == NULL) { - xmlVErrMemory(ctxt, "malloc failed"); - if (uqname != NULL) - xmlFree(uqname); - if (ns != NULL) - xmlFree(ns); - xmlFree(ret); - return(NULL); - } - ret->prefix = ns; - - /* - * Validity Check: - * Insertion must not fail - */ - if (xmlHashAddEntry2(table, name, ns, ret)) { - xmlFreeElement(ret); - if (uqname != NULL) - xmlFree(uqname); - return(NULL); - } - /* - * For new element, may have attributes from earlier - * definition in internal subset - */ - ret->attributes = oldAttributes; - } - - /* - * Finish to fill the structure. - */ - ret->etype = type; - /* - * Avoid a stupid copy when called by the parser - * and flag it by setting a special parent value - * so the parser doesn't unallocate it. - */ - if ((ctxt != NULL) && - ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || - (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1))) { - ret->content = content; - if (content != NULL) - content->parent = (xmlElementContentPtr) 1; - } else { - ret->content = xmlCopyDocElementContent(dtd->doc, content); - } - - /* - * Link it to the DTD - */ - ret->parent = dtd; - ret->doc = dtd->doc; - if (dtd->last == NULL) { - dtd->children = dtd->last = (xmlNodePtr) ret; - } else { - dtd->last->next = (xmlNodePtr) ret; - ret->prev = dtd->last; - dtd->last = (xmlNodePtr) ret; - } - if (uqname != NULL) - xmlFree(uqname); - return(ret); -} - -/** - * xmlFreeElementTable: - * @table: An element table - * - * Deallocate the memory used by an element hash table. - */ -void -xmlFreeElementTable(xmlElementTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeElement); -} - -#ifdef LIBXML_TREE_ENABLED -/** - * xmlCopyElement: - * @elem: An element - * - * Build a copy of an element. - * - * Returns the new xmlElementPtr or NULL in case of error. - */ -static xmlElementPtr -xmlCopyElement(xmlElementPtr elem) { - xmlElementPtr cur; - - cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement)); - if (cur == NULL) { - xmlVErrMemory(NULL, "malloc failed"); - return(NULL); - } - memset(cur, 0, sizeof(xmlElement)); - cur->type = XML_ELEMENT_DECL; - cur->etype = elem->etype; - if (elem->name != NULL) - cur->name = xmlStrdup(elem->name); - else - cur->name = NULL; - if (elem->prefix != NULL) - cur->prefix = xmlStrdup(elem->prefix); - else - cur->prefix = NULL; - cur->content = xmlCopyElementContent(elem->content); - /* TODO : rebuild the attribute list on the copy */ - cur->attributes = NULL; - return(cur); -} - -/** - * xmlCopyElementTable: - * @table: An element table - * - * Build a copy of an element table. - * - * Returns the new xmlElementTablePtr or NULL in case of error. - */ -xmlElementTablePtr -xmlCopyElementTable(xmlElementTablePtr table) { - return((xmlElementTablePtr) xmlHashCopy(table, - (xmlHashCopier) xmlCopyElement)); -} -#endif /* LIBXML_TREE_ENABLED */ - -/** - * xmlCreateEnumeration: - * @name: the enumeration name or NULL - * - * create and initialize an enumeration attribute node. - * - * Returns the xmlEnumerationPtr just created or NULL in case - * of error. - */ -xmlEnumerationPtr -xmlCreateEnumeration(const xmlChar *name) { - xmlEnumerationPtr ret; - - ret = (xmlEnumerationPtr) xmlMalloc(sizeof(xmlEnumeration)); - if (ret == NULL) { - xmlVErrMemory(NULL, "malloc failed"); - return(NULL); - } - memset(ret, 0, sizeof(xmlEnumeration)); - - if (name != NULL) - ret->name = xmlStrdup(name); - return(ret); -} - -/** - * xmlFreeEnumeration: - * @cur: the tree to free. - * - * free an enumeration attribute node (recursive). - */ -void -xmlFreeEnumeration(xmlEnumerationPtr cur) { - if (cur == NULL) return; - - if (cur->next != NULL) xmlFreeEnumeration(cur->next); - - if (cur->name != NULL) xmlFree((xmlChar *) cur->name); - xmlFree(cur); -} - -#ifdef LIBXML_TREE_ENABLED -/** - * xmlCopyEnumeration: - * @cur: the tree to copy. - * - * Copy an enumeration attribute node (recursive). - * - * Returns the xmlEnumerationPtr just created or NULL in case - * of error. - */ -xmlEnumerationPtr -xmlCopyEnumeration(xmlEnumerationPtr cur) { - xmlEnumerationPtr ret; - - if (cur == NULL) return(NULL); - ret = xmlCreateEnumeration((xmlChar *) cur->name); - - if (cur->next != NULL) ret->next = xmlCopyEnumeration(cur->next); - else ret->next = NULL; - - return(ret); -} -#endif /* LIBXML_TREE_ENABLED */ - -/** - * xmlFreeAttribute: - * @elem: An attribute - * - * Deallocate the memory used by an attribute definition - */ -static void -xmlFreeAttribute(xmlAttributePtr attr) { - xmlDictPtr dict; - - if (attr == NULL) return; - if (attr->doc != NULL) - dict = attr->doc->dict; - else - dict = NULL; - xmlUnlinkNode((xmlNodePtr) attr); - if (attr->tree != NULL) - xmlFreeEnumeration(attr->tree); - if (dict) { - if ((attr->elem != NULL) && (!xmlDictOwns(dict, attr->elem))) - xmlFree((xmlChar *) attr->elem); - if ((attr->name != NULL) && (!xmlDictOwns(dict, attr->name))) - xmlFree((xmlChar *) attr->name); - if ((attr->prefix != NULL) && (!xmlDictOwns(dict, attr->prefix))) - xmlFree((xmlChar *) attr->prefix); - if ((attr->defaultValue != NULL) && - (!xmlDictOwns(dict, attr->defaultValue))) - xmlFree((xmlChar *) attr->defaultValue); - } else { - if (attr->elem != NULL) - xmlFree((xmlChar *) attr->elem); - if (attr->name != NULL) - xmlFree((xmlChar *) attr->name); - if (attr->defaultValue != NULL) - xmlFree((xmlChar *) attr->defaultValue); - if (attr->prefix != NULL) - xmlFree((xmlChar *) attr->prefix); - } - xmlFree(attr); -} - - -/** - * xmlAddAttributeDecl: - * @ctxt: the validation context - * @dtd: pointer to the DTD - * @elem: the element name - * @name: the attribute name - * @ns: the attribute namespace prefix - * @type: the attribute type - * @def: the attribute default type - * @defaultValue: the attribute default value - * @tree: if it's an enumeration, the associated list - * - * Register a new attribute declaration - * Note that @tree becomes the ownership of the DTD - * - * Returns NULL if not new, otherwise the attribute decl - */ -xmlAttributePtr -xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, - xmlDtdPtr dtd, const xmlChar *elem, - const xmlChar *name, const xmlChar *ns, - xmlAttributeType type, xmlAttributeDefault def, - const xmlChar *defaultValue, xmlEnumerationPtr tree) { - xmlAttributePtr ret; - xmlAttributeTablePtr table; - xmlElementPtr elemDef; - xmlDictPtr dict = NULL; - - if (dtd == NULL) { - xmlFreeEnumeration(tree); - return(NULL); - } - if (name == NULL) { - xmlFreeEnumeration(tree); - return(NULL); - } - if (elem == NULL) { - xmlFreeEnumeration(tree); - return(NULL); - } - if (dtd->doc != NULL) - dict = dtd->doc->dict; - - /* - * Check first that an attribute defined in the external subset wasn't - * already defined in the internal subset - */ - if ((dtd->doc != NULL) && (dtd->doc->extSubset == dtd) && - (dtd->doc->intSubset != NULL) && - (dtd->doc->intSubset->attributes != NULL)) { - ret = xmlHashLookup3(dtd->doc->intSubset->attributes, name, ns, elem); - if (ret != NULL) { - xmlFreeEnumeration(tree); - return(NULL); - } - } - - /* - * Create the Attribute table if needed. - */ - table = (xmlAttributeTablePtr) dtd->attributes; - if (table == NULL) { - table = xmlHashCreateDict(0, dict); - dtd->attributes = (void *) table; - } - if (table == NULL) { - xmlVErrMemory(ctxt, - "xmlAddAttributeDecl: Table creation failed!\n"); - xmlFreeEnumeration(tree); - return(NULL); - } - - - ret = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute)); - if (ret == NULL) { - xmlVErrMemory(ctxt, "malloc failed"); - xmlFreeEnumeration(tree); - return(NULL); - } - memset(ret, 0, sizeof(xmlAttribute)); - ret->type = XML_ATTRIBUTE_DECL; - - /* - * fill the structure. - */ - ret->atype = type; - /* - * doc must be set before possible error causes call - * to xmlFreeAttribute (because it's used to check on - * dict use) - */ - ret->doc = dtd->doc; - if (dict) { - ret->name = xmlDictLookup(dict, name, -1); - ret->prefix = xmlDictLookup(dict, ns, -1); - ret->elem = xmlDictLookup(dict, elem, -1); - } else { - ret->name = xmlStrdup(name); - ret->prefix = xmlStrdup(ns); - ret->elem = xmlStrdup(elem); - } - ret->def = def; - ret->tree = tree; - if (defaultValue != NULL) { - if (dict) - ret->defaultValue = xmlDictLookup(dict, defaultValue, -1); - else - ret->defaultValue = xmlStrdup(defaultValue); - } - - /* - * Validity Check: - * Search the DTD for previous declarations of the ATTLIST - */ - if (xmlHashAddEntry3(table, ret->name, ret->prefix, ret->elem, ret) < 0) { - xmlFreeAttribute(ret); - return(NULL); - } - - /* - * Validity Check: - * Multiple ID per element - */ - elemDef = xmlGetDtdElementDesc2(dtd, elem, 1); - if (elemDef != NULL) { - - - /* - * Insert namespace default def first they need to be - * processed first. - */ - if ((xmlStrEqual(ret->name, BAD_CAST "xmlns")) || - ((ret->prefix != NULL && - (xmlStrEqual(ret->prefix, BAD_CAST "xmlns"))))) { - ret->nexth = elemDef->attributes; - elemDef->attributes = ret; - } else { - xmlAttributePtr tmp = elemDef->attributes; - - while ((tmp != NULL) && - ((xmlStrEqual(tmp->name, BAD_CAST "xmlns")) || - ((ret->prefix != NULL && - (xmlStrEqual(ret->prefix, BAD_CAST "xmlns")))))) { - if (tmp->nexth == NULL) - break; - tmp = tmp->nexth; - } - if (tmp != NULL) { - ret->nexth = tmp->nexth; - tmp->nexth = ret; - } else { - ret->nexth = elemDef->attributes; - elemDef->attributes = ret; - } - } - } - - /* - * Link it to the DTD - */ - ret->parent = dtd; - if (dtd->last == NULL) { - dtd->children = dtd->last = (xmlNodePtr) ret; - } else { - dtd->last->next = (xmlNodePtr) ret; - ret->prev = dtd->last; - dtd->last = (xmlNodePtr) ret; - } - return(ret); -} - -/** - * xmlFreeAttributeTable: - * @table: An attribute table - * - * Deallocate the memory used by an entities hash table. - */ -void -xmlFreeAttributeTable(xmlAttributeTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeAttribute); -} - -#ifdef LIBXML_TREE_ENABLED -/** - * xmlCopyAttribute: - * @attr: An attribute - * - * Build a copy of an attribute. - * - * Returns the new xmlAttributePtr or NULL in case of error. - */ -static xmlAttributePtr -xmlCopyAttribute(xmlAttributePtr attr) { - xmlAttributePtr cur; - - cur = (xmlAttributePtr) xmlMalloc(sizeof(xmlAttribute)); - if (cur == NULL) { - xmlVErrMemory(NULL, "malloc failed"); - return(NULL); - } - memset(cur, 0, sizeof(xmlAttribute)); - cur->type = XML_ATTRIBUTE_DECL; - cur->atype = attr->atype; - cur->def = attr->def; - cur->tree = xmlCopyEnumeration(attr->tree); - if (attr->elem != NULL) - cur->elem = xmlStrdup(attr->elem); - if (attr->name != NULL) - cur->name = xmlStrdup(attr->name); - if (attr->prefix != NULL) - cur->prefix = xmlStrdup(attr->prefix); - if (attr->defaultValue != NULL) - cur->defaultValue = xmlStrdup(attr->defaultValue); - return(cur); -} - -/** - * xmlCopyAttributeTable: - * @table: An attribute table - * - * Build a copy of an attribute table. - * - * Returns the new xmlAttributeTablePtr or NULL in case of error. - */ -xmlAttributeTablePtr -xmlCopyAttributeTable(xmlAttributeTablePtr table) { - return((xmlAttributeTablePtr) xmlHashCopy(table, - (xmlHashCopier) xmlCopyAttribute)); -} -#endif /* LIBXML_TREE_ENABLED */ - -/************************************************************************ - * * - * NOTATIONs * - * * - ************************************************************************/ -/** - * xmlFreeNotation: - * @not: A notation - * - * Deallocate the memory used by an notation definition - */ -static void -xmlFreeNotation(xmlNotationPtr nota) { - if (nota == NULL) return; - if (nota->name != NULL) - xmlFree((xmlChar *) nota->name); - if (nota->PublicID != NULL) - xmlFree((xmlChar *) nota->PublicID); - if (nota->SystemID != NULL) - xmlFree((xmlChar *) nota->SystemID); - xmlFree(nota); -} - - -/** - * xmlAddNotationDecl: - * @dtd: pointer to the DTD - * @ctxt: the validation context - * @name: the entity name - * @PublicID: the public identifier or NULL - * @SystemID: the system identifier or NULL - * - * Register a new notation declaration - * - * Returns NULL if not, otherwise the entity - */ -xmlNotationPtr -xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, - const xmlChar *name, - const xmlChar *PublicID, const xmlChar *SystemID) { - xmlNotationPtr ret; - xmlNotationTablePtr table; - - if (dtd == NULL) { - return(NULL); - } - if (name == NULL) { - return(NULL); - } - if ((PublicID == NULL) && (SystemID == NULL)) { - return(NULL); - } - - /* - * Create the Notation table if needed. - */ - table = (xmlNotationTablePtr) dtd->notations; - if (table == NULL) { - xmlDictPtr dict = NULL; - if (dtd->doc != NULL) - dict = dtd->doc->dict; - - dtd->notations = table = xmlHashCreateDict(0, dict); - } - if (table == NULL) { - xmlVErrMemory(ctxt, - "xmlAddNotationDecl: Table creation failed!\n"); - return(NULL); - } - - ret = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation)); - if (ret == NULL) { - xmlVErrMemory(ctxt, "malloc failed"); - return(NULL); - } - memset(ret, 0, sizeof(xmlNotation)); - - /* - * fill the structure. - */ - ret->name = xmlStrdup(name); - if (SystemID != NULL) - ret->SystemID = xmlStrdup(SystemID); - if (PublicID != NULL) - ret->PublicID = xmlStrdup(PublicID); - - /* - * Validity Check: - * Check the DTD for previous declarations of the ATTLIST - */ - if (xmlHashAddEntry(table, name, ret)) { - xmlFreeNotation(ret); - return(NULL); - } - return(ret); -} - -/** - * xmlFreeNotationTable: - * @table: An notation table - * - * Deallocate the memory used by an entities hash table. - */ -void -xmlFreeNotationTable(xmlNotationTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeNotation); -} - -#ifdef LIBXML_TREE_ENABLED -/** - * xmlCopyNotation: - * @nota: A notation - * - * Build a copy of a notation. - * - * Returns the new xmlNotationPtr or NULL in case of error. - */ -static xmlNotationPtr -xmlCopyNotation(xmlNotationPtr nota) { - xmlNotationPtr cur; - - cur = (xmlNotationPtr) xmlMalloc(sizeof(xmlNotation)); - if (cur == NULL) { - xmlVErrMemory(NULL, "malloc failed"); - return(NULL); - } - if (nota->name != NULL) - cur->name = xmlStrdup(nota->name); - else - cur->name = NULL; - if (nota->PublicID != NULL) - cur->PublicID = xmlStrdup(nota->PublicID); - else - cur->PublicID = NULL; - if (nota->SystemID != NULL) - cur->SystemID = xmlStrdup(nota->SystemID); - else - cur->SystemID = NULL; - return(cur); -} - -/** - * xmlCopyNotationTable: - * @table: A notation table - * - * Build a copy of a notation table. - * - * Returns the new xmlNotationTablePtr or NULL in case of error. - */ -xmlNotationTablePtr -xmlCopyNotationTable(xmlNotationTablePtr table) { - return((xmlNotationTablePtr) xmlHashCopy(table, - (xmlHashCopier) xmlCopyNotation)); -} -#endif /* LIBXML_TREE_ENABLED */ - -/************************************************************************ - * * - * IDs * - * * - ************************************************************************/ -/** - * DICT_FREE: - * @str: a string - * - * Free a string if it is not owned by the "dict" dictionnary in the - * current scope - */ -#define DICT_FREE(str) \ - if ((str) && ((!dict) || \ - (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ - xmlFree((char *)(str)); - -/** - * xmlFreeID: - * @not: A id - * - * Deallocate the memory used by an id definition - */ -static void -xmlFreeID(xmlIDPtr id) { - xmlDictPtr dict = NULL; - - if (id == NULL) return; - - if (id->doc != NULL) - dict = id->doc->dict; - - if (id->value != NULL) - DICT_FREE(id->value) - if (id->name != NULL) - DICT_FREE(id->name) - xmlFree(id); -} - - -/** - * xmlAddID: - * @ctxt: the validation context - * @doc: pointer to the document - * @value: the value name - * @attr: the attribute holding the ID - * - * Register a new id declaration - * - * Returns NULL if not, otherwise the new xmlIDPtr - */ -xmlIDPtr -xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, - xmlAttrPtr attr) { - xmlIDPtr ret; - xmlIDTablePtr table; - - if (doc == NULL) { - return(NULL); - } - if (value == NULL) { - return(NULL); - } - if (attr == NULL) { - return(NULL); - } - - /* - * Create the ID table if needed. - */ - table = (xmlIDTablePtr) doc->ids; - if (table == NULL) { - doc->ids = table = xmlHashCreateDict(0, doc->dict); - } - if (table == NULL) { - xmlVErrMemory(ctxt, - "xmlAddID: Table creation failed!\n"); - return(NULL); - } - - ret = (xmlIDPtr) xmlMalloc(sizeof(xmlID)); - if (ret == NULL) { - xmlVErrMemory(ctxt, "malloc failed"); - return(NULL); - } - - /* - * fill the structure. - */ - ret->value = xmlStrdup(value); - ret->doc = doc; - if ((ctxt != NULL) && (ctxt->vstateNr != 0)) { - /* - * Operating in streaming mode, attr is gonna disapear - */ - if (doc->dict != NULL) - ret->name = xmlDictLookup(doc->dict, attr->name, -1); - else - ret->name = xmlStrdup(attr->name); - ret->attr = NULL; - } else { - ret->attr = attr; - ret->name = NULL; - } - ret->lineno = xmlGetLineNo(attr->parent); - - if (xmlHashAddEntry(table, value, ret) < 0) { - xmlFreeID(ret); - return(NULL); - } - if (attr != NULL) - attr->atype = XML_ATTRIBUTE_ID; - return(ret); -} - -/** - * xmlFreeIDTable: - * @table: An id table - * - * Deallocate the memory used by an ID hash table. - */ -void -xmlFreeIDTable(xmlIDTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeID); -} - -/** - * xmlIsID: - * @doc: the document - * @elem: the element carrying the attribute - * @attr: the attribute - * - * Determine whether an attribute is of type ID. In case we have DTD(s) - * then this is done if DTD loading has been requested. In the case - * of HTML documents parsed with the HTML parser, then ID detection is - * done systematically. - * - * Returns 0 or 1 depending on the lookup result - */ -int -xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { - if ((attr == NULL) || (attr->name == NULL)) return(0); - if ((attr->ns != NULL) && (attr->ns->prefix != NULL) && - (!strcmp((char *) attr->name, "id")) && - (!strcmp((char *) attr->ns->prefix, "xml"))) - return(1); - if (doc == NULL) return(0); - if ((doc->intSubset == NULL) && (doc->extSubset == NULL) && - (doc->type != XML_HTML_DOCUMENT_NODE)) { - return(0); - } else if (doc->type == XML_HTML_DOCUMENT_NODE) { - if ((xmlStrEqual(BAD_CAST "id", attr->name)) || - ((xmlStrEqual(BAD_CAST "name", attr->name)) && - ((elem == NULL) || (xmlStrEqual(elem->name, BAD_CAST "a"))))) - return(1); - return(0); - } else if (elem == NULL) { - return(0); - } else { - xmlAttributePtr attrDecl = NULL; - - xmlChar felem[50], fattr[50]; - xmlChar *fullelemname, *fullattrname; - - fullelemname = (elem->ns != NULL && elem->ns->prefix != NULL) ? - xmlBuildQName(elem->name, elem->ns->prefix, felem, 50) : - (xmlChar *)elem->name; - - fullattrname = (attr->ns != NULL && attr->ns->prefix != NULL) ? - xmlBuildQName(attr->name, attr->ns->prefix, fattr, 50) : - (xmlChar *)attr->name; - - if (fullelemname != NULL && fullattrname != NULL) { - attrDecl = xmlGetDtdAttrDesc(doc->intSubset, fullelemname, - fullattrname); - if ((attrDecl == NULL) && (doc->extSubset != NULL)) - attrDecl = xmlGetDtdAttrDesc(doc->extSubset, fullelemname, - fullattrname); - } - - if ((fullattrname != fattr) && (fullattrname != attr->name)) - xmlFree(fullattrname); - if ((fullelemname != felem) && (fullelemname != elem->name)) - xmlFree(fullelemname); - - if ((attrDecl != NULL) && (attrDecl->atype == XML_ATTRIBUTE_ID)) - return(1); - } - return(0); -} - -/** - * xmlRemoveID: - * @doc: the document - * @attr: the attribute - * - * Remove the given attribute from the ID table maintained internally. - * - * Returns -1 if the lookup failed and 0 otherwise - */ -int -xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { - xmlIDTablePtr table; - xmlIDPtr id; - xmlChar *ID; - - if (doc == NULL) return(-1); - if (attr == NULL) return(-1); - table = (xmlIDTablePtr) doc->ids; - if (table == NULL) - return(-1); - - if (attr == NULL) - return(-1); - ID = xmlNodeListGetString(doc, attr->children, 1); - if (ID == NULL) - return(-1); - id = xmlHashLookup(table, ID); - if (id == NULL || id->attr != attr) { - xmlFree(ID); - return(-1); - } - xmlHashRemoveEntry(table, ID, (xmlHashDeallocator) xmlFreeID); - xmlFree(ID); - attr->atype = 0; - return(0); -} - -/** - * xmlGetID: - * @doc: pointer to the document - * @ID: the ID value - * - * Search the attribute declaring the given ID - * - * Returns NULL if not found, otherwise the xmlAttrPtr defining the ID - */ -xmlAttrPtr -xmlGetID(xmlDocPtr doc, const xmlChar *ID) { - xmlIDTablePtr table; - xmlIDPtr id; - - if (doc == NULL) { - return(NULL); - } - - if (ID == NULL) { - return(NULL); - } - - table = (xmlIDTablePtr) doc->ids; - if (table == NULL) - return(NULL); - - id = xmlHashLookup(table, ID); - if (id == NULL) - return(NULL); - if (id->attr == NULL) { - /* - * We are operating on a stream, return a well known reference - * since the attribute node doesn't exist anymore - */ - return((xmlAttrPtr) doc); - } - return(id->attr); -} - -/************************************************************************ - * * - * Refs * - * * - ************************************************************************/ -typedef struct xmlRemoveMemo_t -{ - xmlListPtr l; - xmlAttrPtr ap; -} xmlRemoveMemo; - -typedef xmlRemoveMemo *xmlRemoveMemoPtr; - -typedef struct xmlValidateMemo_t -{ - xmlValidCtxtPtr ctxt; - const xmlChar *name; -} xmlValidateMemo; - -typedef xmlValidateMemo *xmlValidateMemoPtr; - -/** - * xmlFreeRef: - * @lk: A list link - * - * Deallocate the memory used by a ref definition - */ -static void -xmlFreeRef(xmlLinkPtr lk) { - xmlRefPtr ref = (xmlRefPtr)xmlLinkGetData(lk); - if (ref == NULL) return; - if (ref->value != NULL) - xmlFree((xmlChar *)ref->value); - if (ref->name != NULL) - xmlFree((xmlChar *)ref->name); - xmlFree(ref); -} - -/** - * xmlFreeRefList: - * @list_ref: A list of references. - * - * Deallocate the memory used by a list of references - */ -static void -xmlFreeRefList(xmlListPtr list_ref) { - if (list_ref == NULL) return; - xmlListDelete(list_ref); -} - -/** - * xmlWalkRemoveRef: - * @data: Contents of current link - * @user: Value supplied by the user - * - * Returns 0 to abort the walk or 1 to continue - */ -static int -xmlWalkRemoveRef(const void *data, const void *user) -{ - xmlAttrPtr attr0 = ((xmlRefPtr)data)->attr; - xmlAttrPtr attr1 = ((xmlRemoveMemoPtr)user)->ap; - xmlListPtr ref_list = ((xmlRemoveMemoPtr)user)->l; - - if (attr0 == attr1) { /* Matched: remove and terminate walk */ - xmlListRemoveFirst(ref_list, (void *)data); - return 0; - } - return 1; -} - -/** - * xmlDummyCompare - * @data0: Value supplied by the user - * @data1: Value supplied by the user - * - * Do nothing, return 0. Used to create unordered lists. - */ -static int -xmlDummyCompare(const void *data0 ATTRIBUTE_UNUSED, - const void *data1 ATTRIBUTE_UNUSED) -{ - return (0); -} - -/** - * xmlAddRef: - * @ctxt: the validation context - * @doc: pointer to the document - * @value: the value name - * @attr: the attribute holding the Ref - * - * Register a new ref declaration - * - * Returns NULL if not, otherwise the new xmlRefPtr - */ -xmlRefPtr -xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, - xmlAttrPtr attr) { - xmlRefPtr ret; - xmlRefTablePtr table; - xmlListPtr ref_list; - - if (doc == NULL) { - return(NULL); - } - if (value == NULL) { - return(NULL); - } - if (attr == NULL) { - return(NULL); - } - - /* - * Create the Ref table if needed. - */ - table = (xmlRefTablePtr) doc->refs; - if (table == NULL) { - doc->refs = table = xmlHashCreateDict(0, doc->dict); - } - if (table == NULL) { - xmlVErrMemory(ctxt, - "xmlAddRef: Table creation failed!\n"); - return(NULL); - } - - ret = (xmlRefPtr) xmlMalloc(sizeof(xmlRef)); - if (ret == NULL) { - xmlVErrMemory(ctxt, "malloc failed"); - return(NULL); - } - - /* - * fill the structure. - */ - ret->value = xmlStrdup(value); - if ((ctxt != NULL) && (ctxt->vstateNr != 0)) { - /* - * Operating in streaming mode, attr is gonna disapear - */ - ret->name = xmlStrdup(attr->name); - ret->attr = NULL; - } else { - ret->name = NULL; - ret->attr = attr; - } - ret->lineno = xmlGetLineNo(attr->parent); - - /* To add a reference :- - * References are maintained as a list of references, - * Lookup the entry, if no entry create new nodelist - * Add the owning node to the NodeList - * Return the ref - */ - - if (NULL == (ref_list = xmlHashLookup(table, value))) { - if (NULL == (ref_list = xmlListCreate(xmlFreeRef, xmlDummyCompare))) { - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, - "xmlAddRef: Reference list creation failed!\n", - NULL); - goto failed; - } - if (xmlHashAddEntry(table, value, ref_list) < 0) { - xmlListDelete(ref_list); - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, - "xmlAddRef: Reference list insertion failed!\n", - NULL); - goto failed; - } - } - if (xmlListAppend(ref_list, ret) != 0) { - xmlErrValid(NULL, XML_ERR_INTERNAL_ERROR, - "xmlAddRef: Reference list insertion failed!\n", - NULL); - goto failed; - } - return(ret); -failed: - if (ret != NULL) { - if (ret->value != NULL) - xmlFree((char *)ret->value); - if (ret->name != NULL) - xmlFree((char *)ret->name); - xmlFree(ret); - } - return(NULL); -} - -/** - * xmlFreeRefTable: - * @table: An ref table - * - * Deallocate the memory used by an Ref hash table. - */ -void -xmlFreeRefTable(xmlRefTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) xmlFreeRefList); -} - -/** - * xmlIsRef: - * @doc: the document - * @elem: the element carrying the attribute - * @attr: the attribute - * - * Determine whether an attribute is of type Ref. In case we have DTD(s) - * then this is simple, otherwise we use an heuristic: name Ref (upper - * or lowercase). - * - * Returns 0 or 1 depending on the lookup result - */ -int -xmlIsRef(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { - if (attr == NULL) - return(0); - if (doc == NULL) { - doc = attr->doc; - if (doc == NULL) return(0); - } - - if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) { - return(0); - } else if (doc->type == XML_HTML_DOCUMENT_NODE) { - /* TODO @@@ */ - return(0); - } else { - xmlAttributePtr attrDecl; - - if (elem == NULL) return(0); - attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, attr->name); - if ((attrDecl == NULL) && (doc->extSubset != NULL)) - attrDecl = xmlGetDtdAttrDesc(doc->extSubset, - elem->name, attr->name); - - if ((attrDecl != NULL) && - (attrDecl->atype == XML_ATTRIBUTE_IDREF || - attrDecl->atype == XML_ATTRIBUTE_IDREFS)) - return(1); - } - return(0); -} - -/** - * xmlRemoveRef: - * @doc: the document - * @attr: the attribute - * - * Remove the given attribute from the Ref table maintained internally. - * - * Returns -1 if the lookup failed and 0 otherwise - */ -int -xmlRemoveRef(xmlDocPtr doc, xmlAttrPtr attr) { - xmlListPtr ref_list; - xmlRefTablePtr table; - xmlChar *ID; - xmlRemoveMemo target; - - if (doc == NULL) return(-1); - if (attr == NULL) return(-1); - table = (xmlRefTablePtr) doc->refs; - if (table == NULL) - return(-1); - - if (attr == NULL) - return(-1); - ID = xmlNodeListGetString(doc, attr->children, 1); - if (ID == NULL) - return(-1); - ref_list = xmlHashLookup(table, ID); - - if(ref_list == NULL) { - xmlFree(ID); - return (-1); - } - /* At this point, ref_list refers to a list of references which - * have the same key as the supplied attr. Our list of references - * is ordered by reference address and we don't have that information - * here to use when removing. We'll have to walk the list and - * check for a matching attribute, when we find one stop the walk - * and remove the entry. - * The list is ordered by reference, so that means we don't have the - * key. Passing the list and the reference to the walker means we - * will have enough data to be able to remove the entry. - */ - target.l = ref_list; - target.ap = attr; - - /* Remove the supplied attr from our list */ - xmlListWalk(ref_list, xmlWalkRemoveRef, &target); - - /*If the list is empty then remove the list entry in the hash */ - if (xmlListEmpty(ref_list)) - xmlHashUpdateEntry(table, ID, NULL, (xmlHashDeallocator) - xmlFreeRefList); - xmlFree(ID); - return(0); -} - -/** - * xmlGetRefs: - * @doc: pointer to the document - * @ID: the ID value - * - * Find the set of references for the supplied ID. - * - * Returns NULL if not found, otherwise node set for the ID. - */ -xmlListPtr -xmlGetRefs(xmlDocPtr doc, const xmlChar *ID) { - xmlRefTablePtr table; - - if (doc == NULL) { - return(NULL); - } - - if (ID == NULL) { - return(NULL); - } - - table = (xmlRefTablePtr) doc->refs; - if (table == NULL) - return(NULL); - - return (xmlHashLookup(table, ID)); -} - -/************************************************************************ - * * - * Routines for validity checking * - * * - ************************************************************************/ - -/** - * xmlGetDtdElementDesc: - * @dtd: a pointer to the DtD to search - * @name: the element name - * - * Search the DTD for the description of this element - * - * returns the xmlElementPtr if found or NULL - */ - -xmlElementPtr -xmlGetDtdElementDesc(xmlDtdPtr dtd, const xmlChar *name) { - xmlElementTablePtr table; - xmlElementPtr cur; - xmlChar *uqname = NULL, *prefix = NULL; - - if ((dtd == NULL) || (name == NULL)) return(NULL); - if (dtd->elements == NULL) - return(NULL); - table = (xmlElementTablePtr) dtd->elements; - - uqname = xmlSplitQName2(name, &prefix); - if (uqname != NULL) - name = uqname; - cur = xmlHashLookup2(table, name, prefix); - if (prefix != NULL) xmlFree(prefix); - if (uqname != NULL) xmlFree(uqname); - return(cur); -} -/** - * xmlGetDtdElementDesc2: - * @dtd: a pointer to the DtD to search - * @name: the element name - * @create: create an empty description if not found - * - * Search the DTD for the description of this element - * - * returns the xmlElementPtr if found or NULL - */ - -static xmlElementPtr -xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create) { - xmlElementTablePtr table; - xmlElementPtr cur; - xmlChar *uqname = NULL, *prefix = NULL; - - if (dtd == NULL) return(NULL); - if (dtd->elements == NULL) { - xmlDictPtr dict = NULL; - - if (dtd->doc != NULL) - dict = dtd->doc->dict; - - if (!create) - return(NULL); - /* - * Create the Element table if needed. - */ - table = (xmlElementTablePtr) dtd->elements; - if (table == NULL) { - table = xmlHashCreateDict(0, dict); - dtd->elements = (void *) table; - } - if (table == NULL) { - xmlVErrMemory(NULL, "element table allocation failed"); - return(NULL); - } - } - table = (xmlElementTablePtr) dtd->elements; - - uqname = xmlSplitQName2(name, &prefix); - if (uqname != NULL) - name = uqname; - cur = xmlHashLookup2(table, name, prefix); - if ((cur == NULL) && (create)) { - cur = (xmlElementPtr) xmlMalloc(sizeof(xmlElement)); - if (cur == NULL) { - xmlVErrMemory(NULL, "malloc failed"); - return(NULL); - } - memset(cur, 0, sizeof(xmlElement)); - cur->type = XML_ELEMENT_DECL; - - /* - * fill the structure. - */ - cur->name = xmlStrdup(name); - cur->prefix = xmlStrdup(prefix); - cur->etype = XML_ELEMENT_TYPE_UNDEFINED; - - xmlHashAddEntry2(table, name, prefix, cur); - } - if (prefix != NULL) xmlFree(prefix); - if (uqname != NULL) xmlFree(uqname); - return(cur); -} - -/** - * xmlGetDtdQElementDesc: - * @dtd: a pointer to the DtD to search - * @name: the element name - * @prefix: the element namespace prefix - * - * Search the DTD for the description of this element - * - * returns the xmlElementPtr if found or NULL - */ - -xmlElementPtr -xmlGetDtdQElementDesc(xmlDtdPtr dtd, const xmlChar *name, - const xmlChar *prefix) { - xmlElementTablePtr table; - - if (dtd == NULL) return(NULL); - if (dtd->elements == NULL) return(NULL); - table = (xmlElementTablePtr) dtd->elements; - - return(xmlHashLookup2(table, name, prefix)); -} - -/** - * xmlGetDtdAttrDesc: - * @dtd: a pointer to the DtD to search - * @elem: the element name - * @name: the attribute name - * - * Search the DTD for the description of this attribute on - * this element. - * - * returns the xmlAttributePtr if found or NULL - */ - -xmlAttributePtr -xmlGetDtdAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name) { - xmlAttributeTablePtr table; - xmlAttributePtr cur; - xmlChar *uqname = NULL, *prefix = NULL; - - if (dtd == NULL) return(NULL); - if (dtd->attributes == NULL) return(NULL); - - table = (xmlAttributeTablePtr) dtd->attributes; - if (table == NULL) - return(NULL); - - uqname = xmlSplitQName2(name, &prefix); - - if (uqname != NULL) { - cur = xmlHashLookup3(table, uqname, prefix, elem); - if (prefix != NULL) xmlFree(prefix); - if (uqname != NULL) xmlFree(uqname); - } else - cur = xmlHashLookup3(table, name, NULL, elem); - return(cur); -} - -/** - * xmlGetDtdQAttrDesc: - * @dtd: a pointer to the DtD to search - * @elem: the element name - * @name: the attribute name - * @prefix: the attribute namespace prefix - * - * Search the DTD for the description of this qualified attribute on - * this element. - * - * returns the xmlAttributePtr if found or NULL - */ - -xmlAttributePtr -xmlGetDtdQAttrDesc(xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name, - const xmlChar *prefix) { - xmlAttributeTablePtr table; - - if (dtd == NULL) return(NULL); - if (dtd->attributes == NULL) return(NULL); - table = (xmlAttributeTablePtr) dtd->attributes; - - return(xmlHashLookup3(table, name, prefix, elem)); -} - -/** - * xmlGetDtdNotationDesc: - * @dtd: a pointer to the DtD to search - * @name: the notation name - * - * Search the DTD for the description of this notation - * - * returns the xmlNotationPtr if found or NULL - */ - -xmlNotationPtr -xmlGetDtdNotationDesc(xmlDtdPtr dtd, const xmlChar *name) { - xmlNotationTablePtr table; - - if (dtd == NULL) return(NULL); - if (dtd->notations == NULL) return(NULL); - table = (xmlNotationTablePtr) dtd->notations; - - return(xmlHashLookup(table, name)); -} - -/** - * xmlIsMixedElement: - * @doc: the document - * @name: the element name - * - * Search in the DtDs whether an element accept Mixed content (or ANY) - * basically if it is supposed to accept text childs - * - * returns 0 if no, 1 if yes, and -1 if no element description is available - */ - -int -xmlIsMixedElement(xmlDocPtr doc, const xmlChar *name) { - xmlElementPtr elemDecl; - - if ((doc == NULL) || (doc->intSubset == NULL)) return(-1); - - elemDecl = xmlGetDtdElementDesc(doc->intSubset, name); - if ((elemDecl == NULL) && (doc->extSubset != NULL)) - elemDecl = xmlGetDtdElementDesc(doc->extSubset, name); - if (elemDecl == NULL) return(-1); - switch (elemDecl->etype) { - case XML_ELEMENT_TYPE_UNDEFINED: - return(-1); - case XML_ELEMENT_TYPE_ELEMENT: - return(0); - case XML_ELEMENT_TYPE_EMPTY: - /* - * return 1 for EMPTY since we want VC error to pop up - * on for example - */ - case XML_ELEMENT_TYPE_ANY: - case XML_ELEMENT_TYPE_MIXED: - return(1); - } - return(1); -} - -#define bottom_valid -#include "elfgcchack.h" diff --git a/deps/libxml2/xmlIO.c b/deps/libxml2/xmlIO.c deleted file mode 100644 index 5adb69bafb..0000000000 --- a/deps/libxml2/xmlIO.c +++ /dev/null @@ -1,2007 +0,0 @@ -/* - * xmlIO.c : implementation of the I/O interfaces used by the parser - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - * - * 14 Nov 2000 ht - for VMS, truncated name of long functions to under 32 char - */ - -#define IN_LIBXML -#include "libxml.h" - -#include -#ifdef HAVE_ERRNO_H -#include -#endif - - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_ZLIB_H -#include -#endif -#ifdef HAVE_LZMA_H -#include -#endif - -#if defined(WIN32) || defined(_WIN32) -#include -#endif - -#if defined(_WIN32_WCE) -#include /* for CP_UTF8 */ -#endif - -/* Figure a portable way to know if a file is a directory. */ -#ifndef HAVE_STAT -# ifdef HAVE__STAT - /* MS C library seems to define stat and _stat. The definition - is identical. Still, mapping them to each other causes a warning. */ -# ifndef _MSC_VER -# define stat(x,y) _stat(x,y) -# endif -# define HAVE_STAT -# endif -#else -# ifdef HAVE__STAT -# if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) -# define stat _stat -# endif -# endif -#endif -#ifdef HAVE_STAT -# ifndef S_ISDIR -# ifdef _S_ISDIR -# define S_ISDIR(x) _S_ISDIR(x) -# else -# ifdef S_IFDIR -# ifndef S_IFMT -# ifdef _S_IFMT -# define S_IFMT _S_IFMT -# endif -# endif -# ifdef S_IFMT -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -# endif -# endif -# endif -# endif -#endif - -#include -#include -#include -#include -#include -#include -#include - -#define MINLEN 4000 - -/* - * Input I/O callback sets - */ -typedef struct _xmlInputCallback { - xmlInputMatchCallback matchcallback; - xmlInputOpenCallback opencallback; - xmlInputReadCallback readcallback; - xmlInputCloseCallback closecallback; -} xmlInputCallback; - -#define MAX_INPUT_CALLBACK 15 - -static xmlInputCallback xmlInputCallbackTable[MAX_INPUT_CALLBACK]; -static int xmlInputCallbackNr = 0; -static int xmlInputCallbackInitialized = 0; - -/************************************************************************ - * * - * Tree memory error handler * - * * - ************************************************************************/ - -static const char *IOerr[] = { - "Unknown IO error", /* UNKNOWN */ - "Permission denied", /* EACCES */ - "Resource temporarily unavailable",/* EAGAIN */ - "Bad file descriptor", /* EBADF */ - "Bad message", /* EBADMSG */ - "Resource busy", /* EBUSY */ - "Operation canceled", /* ECANCELED */ - "No child processes", /* ECHILD */ - "Resource deadlock avoided",/* EDEADLK */ - "Domain error", /* EDOM */ - "File exists", /* EEXIST */ - "Bad address", /* EFAULT */ - "File too large", /* EFBIG */ - "Operation in progress", /* EINPROGRESS */ - "Interrupted function call",/* EINTR */ - "Invalid argument", /* EINVAL */ - "Input/output error", /* EIO */ - "Is a directory", /* EISDIR */ - "Too many open files", /* EMFILE */ - "Too many links", /* EMLINK */ - "Inappropriate message buffer length",/* EMSGSIZE */ - "Filename too long", /* ENAMETOOLONG */ - "Too many open files in system",/* ENFILE */ - "No such device", /* ENODEV */ - "No such file or directory",/* ENOENT */ - "Exec format error", /* ENOEXEC */ - "No locks available", /* ENOLCK */ - "Not enough space", /* ENOMEM */ - "No space left on device", /* ENOSPC */ - "Function not implemented", /* ENOSYS */ - "Not a directory", /* ENOTDIR */ - "Directory not empty", /* ENOTEMPTY */ - "Not supported", /* ENOTSUP */ - "Inappropriate I/O control operation",/* ENOTTY */ - "No such device or address",/* ENXIO */ - "Operation not permitted", /* EPERM */ - "Broken pipe", /* EPIPE */ - "Result too large", /* ERANGE */ - "Read-only file system", /* EROFS */ - "Invalid seek", /* ESPIPE */ - "No such process", /* ESRCH */ - "Operation timed out", /* ETIMEDOUT */ - "Improper link", /* EXDEV */ - "Attempt to load network entity %s", /* XML_IO_NETWORK_ATTEMPT */ - "encoder error", /* XML_IO_ENCODER */ - "flush error", - "write error", - "no input", - "buffer full", - "loading error", - "not a socket", /* ENOTSOCK */ - "already connected", /* EISCONN */ - "connection refused", /* ECONNREFUSED */ - "unreachable network", /* ENETUNREACH */ - "adddress in use", /* EADDRINUSE */ - "already in use", /* EALREADY */ - "unknown address familly", /* EAFNOSUPPORT */ -}; - -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) -/** - * __xmlIOWin32UTF8ToWChar: - * @u8String: uft-8 string - * - * Convert a string from utf-8 to wchar (WINDOWS ONLY!) - */ -static wchar_t * -__xmlIOWin32UTF8ToWChar(const char *u8String) -{ - wchar_t *wString = NULL; - - if (u8String) { - int wLen = - MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, u8String, - -1, NULL, 0); - if (wLen) { - wString = xmlMalloc(wLen * sizeof(wchar_t)); - if (wString) { - if (MultiByteToWideChar - (CP_UTF8, 0, u8String, -1, wString, wLen) == 0) { - xmlFree(wString); - wString = NULL; - } - } - } - } - - return wString; -} -#endif - -/** - * xmlIOErrMemory: - * @extra: extra informations - * - * Handle an out of memory condition - */ -static void -xmlIOErrMemory(const char *extra) -{ - __xmlSimpleError(XML_FROM_IO, XML_ERR_NO_MEMORY, NULL, NULL, extra); -} - -/** - * __xmlIOErr: - * @code: the error number - * @ - * @extra: extra informations - * - * Handle an I/O error - */ -void -__xmlIOErr(int domain, int code, const char *extra) -{ - unsigned int idx; - - if (code == 0) { -#ifdef HAVE_ERRNO_H - if (errno == 0) code = 0; -#ifdef EACCES - else if (errno == EACCES) code = XML_IO_EACCES; -#endif -#ifdef EAGAIN - else if (errno == EAGAIN) code = XML_IO_EAGAIN; -#endif -#ifdef EBADF - else if (errno == EBADF) code = XML_IO_EBADF; -#endif -#ifdef EBADMSG - else if (errno == EBADMSG) code = XML_IO_EBADMSG; -#endif -#ifdef EBUSY - else if (errno == EBUSY) code = XML_IO_EBUSY; -#endif -#ifdef ECANCELED - else if (errno == ECANCELED) code = XML_IO_ECANCELED; -#endif -#ifdef ECHILD - else if (errno == ECHILD) code = XML_IO_ECHILD; -#endif -#ifdef EDEADLK - else if (errno == EDEADLK) code = XML_IO_EDEADLK; -#endif -#ifdef EDOM - else if (errno == EDOM) code = XML_IO_EDOM; -#endif -#ifdef EEXIST - else if (errno == EEXIST) code = XML_IO_EEXIST; -#endif -#ifdef EFAULT - else if (errno == EFAULT) code = XML_IO_EFAULT; -#endif -#ifdef EFBIG - else if (errno == EFBIG) code = XML_IO_EFBIG; -#endif -#ifdef EINPROGRESS - else if (errno == EINPROGRESS) code = XML_IO_EINPROGRESS; -#endif -#ifdef EINTR - else if (errno == EINTR) code = XML_IO_EINTR; -#endif -#ifdef EINVAL - else if (errno == EINVAL) code = XML_IO_EINVAL; -#endif -#ifdef EIO - else if (errno == EIO) code = XML_IO_EIO; -#endif -#ifdef EISDIR - else if (errno == EISDIR) code = XML_IO_EISDIR; -#endif -#ifdef EMFILE - else if (errno == EMFILE) code = XML_IO_EMFILE; -#endif -#ifdef EMLINK - else if (errno == EMLINK) code = XML_IO_EMLINK; -#endif -#ifdef EMSGSIZE - else if (errno == EMSGSIZE) code = XML_IO_EMSGSIZE; -#endif -#ifdef ENAMETOOLONG - else if (errno == ENAMETOOLONG) code = XML_IO_ENAMETOOLONG; -#endif -#ifdef ENFILE - else if (errno == ENFILE) code = XML_IO_ENFILE; -#endif -#ifdef ENODEV - else if (errno == ENODEV) code = XML_IO_ENODEV; -#endif -#ifdef ENOENT - else if (errno == ENOENT) code = XML_IO_ENOENT; -#endif -#ifdef ENOEXEC - else if (errno == ENOEXEC) code = XML_IO_ENOEXEC; -#endif -#ifdef ENOLCK - else if (errno == ENOLCK) code = XML_IO_ENOLCK; -#endif -#ifdef ENOMEM - else if (errno == ENOMEM) code = XML_IO_ENOMEM; -#endif -#ifdef ENOSPC - else if (errno == ENOSPC) code = XML_IO_ENOSPC; -#endif -#ifdef ENOSYS - else if (errno == ENOSYS) code = XML_IO_ENOSYS; -#endif -#ifdef ENOTDIR - else if (errno == ENOTDIR) code = XML_IO_ENOTDIR; -#endif -#ifdef ENOTEMPTY - else if (errno == ENOTEMPTY) code = XML_IO_ENOTEMPTY; -#endif -#ifdef ENOTSUP - else if (errno == ENOTSUP) code = XML_IO_ENOTSUP; -#endif -#ifdef ENOTTY - else if (errno == ENOTTY) code = XML_IO_ENOTTY; -#endif -#ifdef ENXIO - else if (errno == ENXIO) code = XML_IO_ENXIO; -#endif -#ifdef EPERM - else if (errno == EPERM) code = XML_IO_EPERM; -#endif -#ifdef EPIPE - else if (errno == EPIPE) code = XML_IO_EPIPE; -#endif -#ifdef ERANGE - else if (errno == ERANGE) code = XML_IO_ERANGE; -#endif -#ifdef EROFS - else if (errno == EROFS) code = XML_IO_EROFS; -#endif -#ifdef ESPIPE - else if (errno == ESPIPE) code = XML_IO_ESPIPE; -#endif -#ifdef ESRCH - else if (errno == ESRCH) code = XML_IO_ESRCH; -#endif -#ifdef ETIMEDOUT - else if (errno == ETIMEDOUT) code = XML_IO_ETIMEDOUT; -#endif -#ifdef EXDEV - else if (errno == EXDEV) code = XML_IO_EXDEV; -#endif -#ifdef ENOTSOCK - else if (errno == ENOTSOCK) code = XML_IO_ENOTSOCK; -#endif -#ifdef EISCONN - else if (errno == EISCONN) code = XML_IO_EISCONN; -#endif -#ifdef ECONNREFUSED - else if (errno == ECONNREFUSED) code = XML_IO_ECONNREFUSED; -#endif -#ifdef ETIMEDOUT - else if (errno == ETIMEDOUT) code = XML_IO_ETIMEDOUT; -#endif -#ifdef ENETUNREACH - else if (errno == ENETUNREACH) code = XML_IO_ENETUNREACH; -#endif -#ifdef EADDRINUSE - else if (errno == EADDRINUSE) code = XML_IO_EADDRINUSE; -#endif -#ifdef EINPROGRESS - else if (errno == EINPROGRESS) code = XML_IO_EINPROGRESS; -#endif -#ifdef EALREADY - else if (errno == EALREADY) code = XML_IO_EALREADY; -#endif -#ifdef EAFNOSUPPORT - else if (errno == EAFNOSUPPORT) code = XML_IO_EAFNOSUPPORT; -#endif - else code = XML_IO_UNKNOWN; -#endif /* HAVE_ERRNO_H */ - } - idx = 0; - if (code >= XML_IO_UNKNOWN) idx = code - XML_IO_UNKNOWN; - if (idx >= (sizeof(IOerr) / sizeof(IOerr[0]))) idx = 0; - - __xmlSimpleError(domain, code, NULL, IOerr[idx], extra); -} - -/** - * xmlIOErr: - * @code: the error number - * @extra: extra informations - * - * Handle an I/O error - */ -static void -xmlIOErr(int code, const char *extra) -{ - __xmlIOErr(XML_FROM_IO, code, extra); -} - -/** - * __xmlLoaderErr: - * @ctx: the parser context - * @extra: extra informations - * - * Handle a resource access error - */ -void -__xmlLoaderErr(void *ctx, const char *msg, const char *filename) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlStructuredErrorFunc schannel = NULL; - xmlGenericErrorFunc channel = NULL; - void *data = NULL; - xmlErrorLevel level = XML_ERR_ERROR; - - if ((ctxt != NULL) && (ctxt->disableSAX != 0) && - (ctxt->instate == XML_PARSER_EOF)) - return; - if ((ctxt != NULL) && (ctxt->sax != NULL)) { - if (ctxt->validate) { - channel = ctxt->sax->error; - level = XML_ERR_ERROR; - } else { - channel = ctxt->sax->warning; - level = XML_ERR_WARNING; - } - if (ctxt->sax->initialized == XML_SAX2_MAGIC) - schannel = ctxt->sax->serror; - data = ctxt->userData; - } - __xmlRaiseError(schannel, channel, data, ctxt, NULL, XML_FROM_IO, - XML_IO_LOAD_ERROR, level, NULL, 0, - filename, NULL, NULL, 0, 0, - msg, filename); - -} - -/************************************************************************ - * * - * Tree memory error handler * - * * - ************************************************************************/ -/** - * xmlNormalizeWindowsPath: - * @path: the input file path - * - * This function is obsolete. Please see xmlURIFromPath in uri.c for - * a better solution. - * - * Returns a canonicalized version of the path - */ -xmlChar * -xmlNormalizeWindowsPath(const xmlChar *path) -{ - return xmlCanonicPath(path); -} - -/** - * xmlCleanupInputCallbacks: - * - * clears the entire input callback table. this includes the - * compiled-in I/O. - */ -void -xmlCleanupInputCallbacks(void) -{ - int i; - - if (!xmlInputCallbackInitialized) - return; - - for (i = xmlInputCallbackNr - 1; i >= 0; i--) { - xmlInputCallbackTable[i].matchcallback = NULL; - xmlInputCallbackTable[i].opencallback = NULL; - xmlInputCallbackTable[i].readcallback = NULL; - xmlInputCallbackTable[i].closecallback = NULL; - } - - xmlInputCallbackNr = 0; - xmlInputCallbackInitialized = 0; -} - -/** - * xmlPopInputCallbacks: - * - * Clear the top input callback from the input stack. this includes the - * compiled-in I/O. - * - * Returns the number of input callback registered or -1 in case of error. - */ -int -xmlPopInputCallbacks(void) -{ - if (!xmlInputCallbackInitialized) - return(-1); - - if (xmlInputCallbackNr <= 0) - return(-1); - - xmlInputCallbackNr--; - xmlInputCallbackTable[xmlInputCallbackNr].matchcallback = NULL; - xmlInputCallbackTable[xmlInputCallbackNr].opencallback = NULL; - xmlInputCallbackTable[xmlInputCallbackNr].readcallback = NULL; - xmlInputCallbackTable[xmlInputCallbackNr].closecallback = NULL; - - return(xmlInputCallbackNr); -} - -/************************************************************************ - * * - * Standard I/O for file accesses * - * * - ************************************************************************/ - -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - -/** - * xmlWrapOpenUtf8: - * @path: the path in utf-8 encoding - * @mode: type of access (0 - read, 1 - write) - * - * function opens the file specified by @path - * - */ -static FILE* -xmlWrapOpenUtf8(const char *path,int mode) -{ - FILE *fd = NULL; - wchar_t *wPath; - - wPath = __xmlIOWin32UTF8ToWChar(path); - if(wPath) - { - fd = _wfopen(wPath, mode ? L"wb" : L"rb"); - xmlFree(wPath); - } - /* maybe path in native encoding */ - if(fd == NULL) - fd = fopen(path, mode ? "wb" : "rb"); - - return fd; -} - -#ifdef HAVE_ZLIB_H -static gzFile -xmlWrapGzOpenUtf8(const char *path, const char *mode) -{ - gzFile fd; - wchar_t *wPath; - - fd = gzopen (path, mode); - if (fd) - return fd; - - wPath = __xmlIOWin32UTF8ToWChar(path); - if(wPath) - { - int d, m = (strstr(mode, "r") ? O_RDONLY : O_RDWR); -#ifdef _O_BINARY - m |= (strstr(mode, "b") ? _O_BINARY : 0); -#endif - d = _wopen(wPath, m); - if (d >= 0) - fd = gzdopen(d, mode); - xmlFree(wPath); - } - - return fd; -} -#endif - -/** - * xmlWrapStatUtf8: - * @path: the path in utf-8 encoding - * @info: structure that stores results - * - * function obtains information about the file or directory - * - */ -static int -xmlWrapStatUtf8(const char *path,struct stat *info) -{ -#ifdef HAVE_STAT - int retval = -1; - wchar_t *wPath; - - wPath = __xmlIOWin32UTF8ToWChar(path); - if (wPath) - { - retval = _wstat(wPath,info); - xmlFree(wPath); - } - /* maybe path in native encoding */ - if(retval < 0) - retval = stat(path,info); - return retval; -#else - return -1; -#endif -} - -/** - * xmlWrapOpenNative: - * @path: the path - * @mode: type of access (0 - read, 1 - write) - * - * function opens the file specified by @path - * - */ -static FILE* -xmlWrapOpenNative(const char *path,int mode) -{ - return fopen(path,mode ? "wb" : "rb"); -} - -/** - * xmlWrapStatNative: - * @path: the path - * @info: structure that stores results - * - * function obtains information about the file or directory - * - */ -static int -xmlWrapStatNative(const char *path,struct stat *info) -{ -#ifdef HAVE_STAT - return stat(path,info); -#else - return -1; -#endif -} - -typedef int (* xmlWrapStatFunc) (const char *f, struct stat *s); -static xmlWrapStatFunc xmlWrapStat = xmlWrapStatNative; -typedef FILE* (* xmlWrapOpenFunc)(const char *f,int mode); -static xmlWrapOpenFunc xmlWrapOpen = xmlWrapOpenNative; -#ifdef HAVE_ZLIB_H -typedef gzFile (* xmlWrapGzOpenFunc) (const char *f, const char *mode); -static xmlWrapGzOpenFunc xmlWrapGzOpen = gzopen; -#endif -/** - * xmlInitPlatformSpecificIo: - * - * Initialize platform specific features. - */ -static void -xmlInitPlatformSpecificIo(void) -{ - static int xmlPlatformIoInitialized = 0; - OSVERSIONINFO osvi; - - if(xmlPlatformIoInitialized) - return; - - osvi.dwOSVersionInfoSize = sizeof(osvi); - - if(GetVersionEx(&osvi) && (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) { - xmlWrapStat = xmlWrapStatUtf8; - xmlWrapOpen = xmlWrapOpenUtf8; -#ifdef HAVE_ZLIB_H - xmlWrapGzOpen = xmlWrapGzOpenUtf8; -#endif - } else { - xmlWrapStat = xmlWrapStatNative; - xmlWrapOpen = xmlWrapOpenNative; -#ifdef HAVE_ZLIB_H - xmlWrapGzOpen = gzopen; -#endif - } - - xmlPlatformIoInitialized = 1; - return; -} - -#endif - -/** - * xmlCheckFilename: - * @path: the path to check - * - * function checks to see if @path is a valid source - * (file, socket...) for XML. - * - * if stat is not available on the target machine, - * returns 1. if stat fails, returns 0 (if calling - * stat on the filename fails, it can't be right). - * if stat succeeds and the file is a directory, - * returns 2. otherwise returns 1. - */ - -int -xmlCheckFilename (const char *path) -{ -#ifdef HAVE_STAT - struct stat stat_buffer; -#endif - if (path == NULL) - return(0); - -#ifdef HAVE_STAT -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - if (xmlWrapStat(path, &stat_buffer) == -1) - return 0; -#else - if (stat(path, &stat_buffer) == -1) - return 0; -#endif -#ifdef S_ISDIR - if (S_ISDIR(stat_buffer.st_mode)) - return 2; -#endif -#endif /* HAVE_STAT */ - return 1; -} - -static int -xmlNop(void) { - return(0); -} - -/** - * xmlFdRead: - * @context: the I/O context - * @buffer: where to drop data - * @len: number of bytes to read - * - * Read @len bytes to @buffer from the I/O channel. - * - * Returns the number of bytes written - */ -static int -xmlFdRead (void * context, char * buffer, int len) { - int ret; - - ret = read((int) (long) context, &buffer[0], len); - if (ret < 0) xmlIOErr(0, "read()"); - return(ret); -} - -/** - * xmlFdClose: - * @context: the I/O context - * - * Close an I/O channel - * - * Returns 0 in case of success and error code otherwise - */ -static int -xmlFdClose (void * context) { - int ret; - ret = close((int) (long) context); - if (ret < 0) xmlIOErr(0, "close()"); - return(ret); -} - -/** - * xmlFileMatch: - * @filename: the URI for matching - * - * input from FILE * - * - * Returns 1 if matches, 0 otherwise - */ -int -xmlFileMatch (const char *filename ATTRIBUTE_UNUSED) { - return(1); -} - -/** - * xmlFileOpen_real: - * @filename: the URI for matching - * - * input from FILE *, supports compressed input - * if @filename is " " then the standard input is used - * - * Returns an I/O context or NULL in case of error - */ -static void * -xmlFileOpen_real (const char *filename) { - const char *path = NULL; - FILE *fd; - - if (filename == NULL) - return(NULL); - - if (!strcmp(filename, "-")) { - fd = stdin; - return((void *) fd); - } - - if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) { -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &filename[17]; -#else - path = &filename[16]; -#endif - } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) { -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &filename[8]; -#else - path = &filename[7]; -#endif - } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:/", 6)) { - /* lots of generators seems to lazy to read RFC 1738 */ -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &filename[6]; -#else - path = &filename[5]; -#endif - } else - path = filename; - - if (path == NULL) - return(NULL); - if (!xmlCheckFilename(path)) - return(NULL); - -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapOpen(path, 0); -#else - fd = fopen(path, "r"); -#endif /* WIN32 */ - if (fd == NULL) xmlIOErr(0, path); - return((void *) fd); -} - -/** - * xmlFileOpen: - * @filename: the URI for matching - * - * Wrapper around xmlFileOpen_real that try it with an unescaped - * version of @filename, if this fails fallback to @filename - * - * Returns a handler or NULL in case or failure - */ -void * -xmlFileOpen (const char *filename) { - char *unescaped; - void *retval; - - retval = xmlFileOpen_real(filename); - if (retval == NULL) { - unescaped = xmlURIUnescapeString(filename, 0, NULL); - if (unescaped != NULL) { - retval = xmlFileOpen_real(unescaped); - xmlFree(unescaped); - } - } - - return retval; -} - -/** - * xmlFileRead: - * @context: the I/O context - * @buffer: where to drop data - * @len: number of bytes to write - * - * Read @len bytes to @buffer from the I/O channel. - * - * Returns the number of bytes written or < 0 in case of failure - */ -int -xmlFileRead (void * context, char * buffer, int len) { - int ret; - if ((context == NULL) || (buffer == NULL)) - return(-1); - ret = fread(&buffer[0], 1, len, (FILE *) context); - if (ret < 0) xmlIOErr(0, "fread()"); - return(ret); -} - -/** - * xmlFileClose: - * @context: the I/O context - * - * Close an I/O channel - * - * Returns 0 or -1 in case of error - */ -int -xmlFileClose (void * context) { - FILE *fil; - int ret; - - if (context == NULL) - return(-1); - fil = (FILE *) context; - if ((fil == stdout) || (fil == stderr)) { - ret = fflush(fil); - if (ret < 0) - xmlIOErr(0, "fflush()"); - return(0); - } - if (fil == stdin) - return(0); - ret = ( fclose((FILE *) context) == EOF ) ? -1 : 0; - if (ret < 0) - xmlIOErr(0, "fclose()"); - return(ret); -} - -/** - * xmlFileFlush: - * @context: the I/O context - * - * Flush an I/O channel - */ -static int -xmlFileFlush (void * context) { - int ret; - - if (context == NULL) - return(-1); - ret = ( fflush((FILE *) context) == EOF ) ? -1 : 0; - if (ret < 0) - xmlIOErr(0, "fflush()"); - return(ret); -} - -#ifdef HAVE_ZLIB_H -/************************************************************************ - * * - * I/O for compressed file accesses * - * * - ************************************************************************/ -/** - * xmlGzfileMatch: - * @filename: the URI for matching - * - * input from compressed file test - * - * Returns 1 if matches, 0 otherwise - */ -static int -xmlGzfileMatch (const char *filename ATTRIBUTE_UNUSED) { - return(1); -} - -/** - * xmlGzfileOpen_real: - * @filename: the URI for matching - * - * input from compressed file open - * if @filename is " " then the standard input is used - * - * Returns an I/O context or NULL in case of error - */ -static void * -xmlGzfileOpen_real (const char *filename) { - const char *path = NULL; - gzFile fd; - - if (!strcmp(filename, "-")) { - fd = gzdopen(dup(0), "rb"); - return((void *) fd); - } - - if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &filename[17]; -#else - path = &filename[16]; -#endif - else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) { -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &filename[8]; -#else - path = &filename[7]; -#endif - } else - path = filename; - - if (path == NULL) - return(NULL); - if (!xmlCheckFilename(path)) - return(NULL); - -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - fd = xmlWrapGzOpen(path, "rb"); -#else - fd = gzopen(path, "rb"); -#endif - return((void *) fd); -} - -/** - * xmlGzfileOpen: - * @filename: the URI for matching - * - * Wrapper around xmlGzfileOpen if the open fais, it will - * try to unescape @filename - */ -static void * -xmlGzfileOpen (const char *filename) { - char *unescaped; - void *retval; - - retval = xmlGzfileOpen_real(filename); - if (retval == NULL) { - unescaped = xmlURIUnescapeString(filename, 0, NULL); - if (unescaped != NULL) { - retval = xmlGzfileOpen_real(unescaped); - } - xmlFree(unescaped); - } - return retval; -} - -/** - * xmlGzfileRead: - * @context: the I/O context - * @buffer: where to drop data - * @len: number of bytes to write - * - * Read @len bytes to @buffer from the compressed I/O channel. - * - * Returns the number of bytes written - */ -static int -xmlGzfileRead (void * context, char * buffer, int len) { - int ret; - - ret = gzread((gzFile) context, &buffer[0], len); - if (ret < 0) xmlIOErr(0, "gzread()"); - return(ret); -} - -/** - * xmlGzfileClose: - * @context: the I/O context - * - * Close a compressed I/O channel - */ -static int -xmlGzfileClose (void * context) { - int ret; - - ret = (gzclose((gzFile) context) == Z_OK ) ? 0 : -1; - if (ret < 0) xmlIOErr(0, "gzclose()"); - return(ret); -} -#endif /* HAVE_ZLIB_H */ - -#ifdef HAVE_LZMA_H -/************************************************************************ - * * - * I/O for compressed file accesses * - * * - ************************************************************************/ -#include "xzlib.h" -/** - * xmlXzfileMatch: - * @filename: the URI for matching - * - * input from compressed file test - * - * Returns 1 if matches, 0 otherwise - */ -static int -xmlXzfileMatch (const char *filename ATTRIBUTE_UNUSED) { - return(1); -} - -/** - * xmlXzFileOpen_real: - * @filename: the URI for matching - * - * input from compressed file open - * if @filename is " " then the standard input is used - * - * Returns an I/O context or NULL in case of error - */ -static void * -xmlXzfileOpen_real (const char *filename) { - const char *path = NULL; - xzFile fd; - - if (!strcmp(filename, "-")) { - fd = __libxml2_xzdopen(dup(0), "rb"); - return((void *) fd); - } - - if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) { - path = &filename[16]; - } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) { - path = &filename[7]; - } else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:/", 6)) { - /* lots of generators seems to lazy to read RFC 1738 */ - path = &filename[5]; - } else - path = filename; - - if (path == NULL) - return(NULL); - if (!xmlCheckFilename(path)) - return(NULL); - - fd = __libxml2_xzopen(path, "rb"); - return((void *) fd); -} - -/** - * xmlXzfileOpen: - * @filename: the URI for matching - * - * Wrapper around xmlXzfileOpen_real that try it with an unescaped - * version of @filename, if this fails fallback to @filename - * - * Returns a handler or NULL in case or failure - */ -static void * -xmlXzfileOpen (const char *filename) { - char *unescaped; - void *retval; - - retval = xmlXzfileOpen_real(filename); - if (retval == NULL) { - unescaped = xmlURIUnescapeString(filename, 0, NULL); - if (unescaped != NULL) { - retval = xmlXzfileOpen_real(unescaped); - } - xmlFree(unescaped); - } - - return retval; -} - -/** - * xmlXzfileRead: - * @context: the I/O context - * @buffer: where to drop data - * @len: number of bytes to write - * - * Read @len bytes to @buffer from the compressed I/O channel. - * - * Returns the number of bytes written - */ -static int -xmlXzfileRead (void * context, char * buffer, int len) { - int ret; - - ret = __libxml2_xzread((xzFile) context, &buffer[0], len); - if (ret < 0) xmlIOErr(0, "xzread()"); - return(ret); -} - -/** - * xmlXzfileClose: - * @context: the I/O context - * - * Close a compressed I/O channel - */ -static int -xmlXzfileClose (void * context) { - int ret; - - ret = (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1; - if (ret < 0) xmlIOErr(0, "xzclose()"); - return(ret); -} -#endif /* HAVE_LZMA_H */ - -/** - * xmlRegisterInputCallbacks: - * @matchFunc: the xmlInputMatchCallback - * @openFunc: the xmlInputOpenCallback - * @readFunc: the xmlInputReadCallback - * @closeFunc: the xmlInputCloseCallback - * - * Register a new set of I/O callback for handling parser input. - * - * Returns the registered handler number or -1 in case of error - */ -int -xmlRegisterInputCallbacks(xmlInputMatchCallback matchFunc, - xmlInputOpenCallback openFunc, xmlInputReadCallback readFunc, - xmlInputCloseCallback closeFunc) { - if (xmlInputCallbackNr >= MAX_INPUT_CALLBACK) { - return(-1); - } - xmlInputCallbackTable[xmlInputCallbackNr].matchcallback = matchFunc; - xmlInputCallbackTable[xmlInputCallbackNr].opencallback = openFunc; - xmlInputCallbackTable[xmlInputCallbackNr].readcallback = readFunc; - xmlInputCallbackTable[xmlInputCallbackNr].closecallback = closeFunc; - xmlInputCallbackInitialized = 1; - return(xmlInputCallbackNr++); -} - -/** - * xmlRegisterDefaultInputCallbacks: - * - * Registers the default compiled-in I/O handlers. - */ -void -xmlRegisterDefaultInputCallbacks(void) { - if (xmlInputCallbackInitialized) - return; - -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - xmlInitPlatformSpecificIo(); -#endif - - xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen, - xmlFileRead, xmlFileClose); -#ifdef HAVE_ZLIB_H - xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen, - xmlGzfileRead, xmlGzfileClose); -#endif /* HAVE_ZLIB_H */ -#ifdef HAVE_LZMA_H - xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen, - xmlXzfileRead, xmlXzfileClose); -#endif /* HAVE_ZLIB_H */ - - xmlInputCallbackInitialized = 1; -} - - -/** - * xmlAllocParserInputBuffer: - * @enc: the charset encoding if known - * - * Create a buffered parser input for progressive parsing - * - * Returns the new parser input or NULL - */ -xmlParserInputBufferPtr -xmlAllocParserInputBuffer(xmlCharEncoding enc) { - xmlParserInputBufferPtr ret; - - ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer)); - if (ret == NULL) { - xmlIOErrMemory("creating input buffer"); - return(NULL); - } - memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer)); - ret->buffer = xmlBufferCreateSize(2 * xmlDefaultBufferSize); - if (ret->buffer == NULL) { - xmlFree(ret); - return(NULL); - } - ret->buffer->alloc = XML_BUFFER_ALLOC_DOUBLEIT; - ret->encoder = xmlGetCharEncodingHandler(enc); - if (ret->encoder != NULL) - ret->raw = xmlBufferCreateSize(2 * xmlDefaultBufferSize); - else - ret->raw = NULL; - ret->readcallback = NULL; - ret->closecallback = NULL; - ret->context = NULL; - ret->compressed = -1; - ret->rawconsumed = 0; - - return(ret); -} - -/** - * xmlFreeParserInputBuffer: - * @in: a buffered parser input - * - * Free up the memory used by a buffered parser input - */ -void -xmlFreeParserInputBuffer(xmlParserInputBufferPtr in) { - if (in == NULL) return; - - if (in->raw) { - xmlBufferFree(in->raw); - in->raw = NULL; - } - if (in->encoder != NULL) { - xmlCharEncCloseFunc(in->encoder); - } - if (in->closecallback != NULL) { - in->closecallback(in->context); - } - if (in->buffer != NULL) { - xmlBufferFree(in->buffer); - in->buffer = NULL; - } - - xmlFree(in); -} - - -xmlParserInputBufferPtr -__xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) { - xmlParserInputBufferPtr ret; - int i = 0; - void *context = NULL; - - if (xmlInputCallbackInitialized == 0) - xmlRegisterDefaultInputCallbacks(); - - if (URI == NULL) return(NULL); - - /* - * Try to find one of the input accept method accepting that scheme - * Go in reverse to give precedence to user defined handlers. - */ - if (context == NULL) { - for (i = xmlInputCallbackNr - 1;i >= 0;i--) { - if ((xmlInputCallbackTable[i].matchcallback != NULL) && - (xmlInputCallbackTable[i].matchcallback(URI) != 0)) { - context = xmlInputCallbackTable[i].opencallback(URI); - if (context != NULL) { - break; - } - } - } - } - if (context == NULL) { - return(NULL); - } - - /* - * Allocate the Input buffer front-end. - */ - ret = xmlAllocParserInputBuffer(enc); - if (ret != NULL) { - ret->context = context; - ret->readcallback = xmlInputCallbackTable[i].readcallback; - ret->closecallback = xmlInputCallbackTable[i].closecallback; -#ifdef HAVE_ZLIB_H - if ((xmlInputCallbackTable[i].opencallback == xmlGzfileOpen) && - (strcmp(URI, "-") != 0)) { -#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1230 - ret->compressed = !gzdirect(context); -#else - if (((z_stream *)context)->avail_in > 4) { - char *cptr, buff4[4]; - cptr = (char *) ((z_stream *)context)->next_in; - if (gzread(context, buff4, 4) == 4) { - if (strncmp(buff4, cptr, 4) == 0) - ret->compressed = 0; - else - ret->compressed = 1; - gzrewind(context); - } - } -#endif - } -#endif - } - else - xmlInputCallbackTable[i].closecallback (context); - - return(ret); -} - -/** - * xmlParserInputBufferCreateFilename: - * @URI: a C string containing the URI or filename - * @enc: the charset encoding if known - * - * Create a buffered parser input for the progressive parsing of a file - * If filename is "-' then we use stdin as the input. - * Automatic support for ZLIB/Compress compressed document is provided - * by default if found at compile-time. - * Do an encoding check if enc == XML_CHAR_ENCODING_NONE - * - * Returns the new parser input or NULL - */ -xmlParserInputBufferPtr -xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) { - if ((xmlParserInputBufferCreateFilenameValue)) { - return xmlParserInputBufferCreateFilenameValue(URI, enc); - } - return __xmlParserInputBufferCreateFilename(URI, enc); -} - -/** - * xmlParserInputBufferCreateFile: - * @file: a FILE* - * @enc: the charset encoding if known - * - * Create a buffered parser input for the progressive parsing of a FILE * - * buffered C I/O - * - * Returns the new parser input or NULL - */ -xmlParserInputBufferPtr -xmlParserInputBufferCreateFile(FILE *file, xmlCharEncoding enc) { - xmlParserInputBufferPtr ret; - - if (xmlInputCallbackInitialized == 0) - xmlRegisterDefaultInputCallbacks(); - - if (file == NULL) return(NULL); - - ret = xmlAllocParserInputBuffer(enc); - if (ret != NULL) { - ret->context = file; - ret->readcallback = xmlFileRead; - ret->closecallback = xmlFileFlush; - } - - return(ret); -} - -/** - * xmlParserInputBufferCreateFd: - * @fd: a file descriptor number - * @enc: the charset encoding if known - * - * Create a buffered parser input for the progressive parsing for the input - * from a file descriptor - * - * Returns the new parser input or NULL - */ -xmlParserInputBufferPtr -xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc) { - xmlParserInputBufferPtr ret; - - if (fd < 0) return(NULL); - - ret = xmlAllocParserInputBuffer(enc); - if (ret != NULL) { - ret->context = (void *) (long) fd; - ret->readcallback = xmlFdRead; - ret->closecallback = xmlFdClose; - } - - return(ret); -} - -/** - * xmlParserInputBufferCreateMem: - * @mem: the memory input - * @size: the length of the memory block - * @enc: the charset encoding if known - * - * Create a buffered parser input for the progressive parsing for the input - * from a memory area. - * - * Returns the new parser input or NULL - */ -xmlParserInputBufferPtr -xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) { - xmlParserInputBufferPtr ret; - int errcode; - - if (size <= 0) return(NULL); - if (mem == NULL) return(NULL); - - ret = xmlAllocParserInputBuffer(enc); - if (ret != NULL) { - ret->context = (void *) mem; - ret->readcallback = (xmlInputReadCallback) xmlNop; - ret->closecallback = NULL; - errcode = xmlBufferAdd(ret->buffer, (const xmlChar *) mem, size); - if (errcode != 0) { - xmlFree(ret); - return(NULL); - } - } - - return(ret); -} - -/** - * xmlParserInputBufferCreateStatic: - * @mem: the memory input - * @size: the length of the memory block - * @enc: the charset encoding if known - * - * Create a buffered parser input for the progressive parsing for the input - * from an immutable memory area. This will not copy the memory area to - * the buffer, but the memory is expected to be available until the end of - * the parsing, this is useful for example when using mmap'ed file. - * - * Returns the new parser input or NULL - */ -xmlParserInputBufferPtr -xmlParserInputBufferCreateStatic(const char *mem, int size, - xmlCharEncoding enc) { - xmlParserInputBufferPtr ret; - - if (size <= 0) return(NULL); - if (mem == NULL) return(NULL); - - ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer)); - if (ret == NULL) { - xmlIOErrMemory("creating input buffer"); - return(NULL); - } - memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer)); - ret->buffer = xmlBufferCreateStatic((void *)mem, (size_t) size); - if (ret->buffer == NULL) { - xmlFree(ret); - return(NULL); - } - ret->encoder = xmlGetCharEncodingHandler(enc); - if (ret->encoder != NULL) - ret->raw = xmlBufferCreateSize(2 * xmlDefaultBufferSize); - else - ret->raw = NULL; - ret->compressed = -1; - ret->context = (void *) mem; - ret->readcallback = NULL; - ret->closecallback = NULL; - - return(ret); -} - - -/** - * xmlParserInputBufferCreateIO: - * @ioread: an I/O read function - * @ioclose: an I/O close function - * @ioctx: an I/O handler - * @enc: the charset encoding if known - * - * Create a buffered parser input for the progressive parsing for the input - * from an I/O handler - * - * Returns the new parser input or NULL - */ -xmlParserInputBufferPtr -xmlParserInputBufferCreateIO(xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, void *ioctx, xmlCharEncoding enc) { - xmlParserInputBufferPtr ret; - - if (ioread == NULL) return(NULL); - - ret = xmlAllocParserInputBuffer(enc); - if (ret != NULL) { - ret->context = (void *) ioctx; - ret->readcallback = ioread; - ret->closecallback = ioclose; - } - - return(ret); -} - -/** - * xmlParserInputBufferCreateFilenameDefault: - * @func: function pointer to the new ParserInputBufferCreateFilenameFunc - * - * Registers a callback for URI input file handling - * - * Returns the old value of the registration function - */ -xmlParserInputBufferCreateFilenameFunc -xmlParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func) -{ - xmlParserInputBufferCreateFilenameFunc old = xmlParserInputBufferCreateFilenameValue; - if (old == NULL) { - old = __xmlParserInputBufferCreateFilename; - } - - xmlParserInputBufferCreateFilenameValue = func; - return(old); -} - -/** - * xmlOutputBufferCreateFilenameDefault: - * @func: function pointer to the new OutputBufferCreateFilenameFunc - * - * Registers a callback for URI output file handling - * - * Returns the old value of the registration function - */ -xmlOutputBufferCreateFilenameFunc -xmlOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func) -{ - xmlOutputBufferCreateFilenameFunc old = xmlOutputBufferCreateFilenameValue; - xmlOutputBufferCreateFilenameValue = func; - return(old); -} - -/** - * xmlParserInputBufferPush: - * @in: a buffered parser input - * @len: the size in bytes of the array. - * @buf: an char array - * - * Push the content of the arry in the input buffer - * This routine handle the I18N transcoding to internal UTF-8 - * This is used when operating the parser in progressive (push) mode. - * - * Returns the number of chars read and stored in the buffer, or -1 - * in case of error. - */ -int -xmlParserInputBufferPush(xmlParserInputBufferPtr in, - int len, const char *buf) { - int nbchars = 0; - int ret; - - if (len < 0) return(0); - if ((in == NULL) || (in->error)) return(-1); - if (in->encoder != NULL) { - unsigned int use; - - /* - * Store the data in the incoming raw buffer - */ - if (in->raw == NULL) { - in->raw = xmlBufferCreate(); - } - ret = xmlBufferAdd(in->raw, (const xmlChar *) buf, len); - if (ret != 0) - return(-1); - - /* - * convert as much as possible to the parser reading buffer. - */ - use = in->raw->use; - nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw); - if (nbchars < 0) { - xmlIOErr(XML_IO_ENCODER, NULL); - in->error = XML_IO_ENCODER; - return(-1); - } - in->rawconsumed += (use - in->raw->use); - } else { - nbchars = len; - ret = xmlBufferAdd(in->buffer, (xmlChar *) buf, nbchars); - if (ret != 0) - return(-1); - } - return(nbchars); -} - -/** - * endOfInput: - * - * When reading from an Input channel indicated end of file or error - * don't reread from it again. - */ -static int -endOfInput (void * context ATTRIBUTE_UNUSED, - char * buffer ATTRIBUTE_UNUSED, - int len ATTRIBUTE_UNUSED) { - return(0); -} - -/** - * xmlParserInputBufferGrow: - * @in: a buffered parser input - * @len: indicative value of the amount of chars to read - * - * Grow up the content of the input buffer, the old data are preserved - * This routine handle the I18N transcoding to internal UTF-8 - * This routine is used when operating the parser in normal (pull) mode - * - * TODO: one should be able to remove one extra copy by copying directly - * onto in->buffer or in->raw - * - * Returns the number of chars read and stored in the buffer, or -1 - * in case of error. - */ -int -xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) { - char *buffer = NULL; - int res = 0; - int nbchars = 0; - int buffree; - unsigned int needSize; - - if ((in == NULL) || (in->error)) return(-1); - if ((len <= MINLEN) && (len != 4)) - len = MINLEN; - - buffree = in->buffer->size - in->buffer->use; - if (buffree <= 0) { - xmlIOErr(XML_IO_BUFFER_FULL, NULL); - in->error = XML_IO_BUFFER_FULL; - return(-1); - } - - needSize = in->buffer->use + len + 1; - if (needSize > in->buffer->size){ - if (!xmlBufferResize(in->buffer, needSize)){ - xmlIOErrMemory("growing input buffer"); - in->error = XML_ERR_NO_MEMORY; - return(-1); - } - } - buffer = (char *)&in->buffer->content[in->buffer->use]; - - /* - * Call the read method for this I/O type. - */ - if (in->readcallback != NULL) { - res = in->readcallback(in->context, &buffer[0], len); - if (res <= 0) - in->readcallback = endOfInput; - } else { - xmlIOErr(XML_IO_NO_INPUT, NULL); - in->error = XML_IO_NO_INPUT; - return(-1); - } - if (res < 0) { - return(-1); - } - len = res; - if (in->encoder != NULL) { - unsigned int use; - - /* - * Store the data in the incoming raw buffer - */ - if (in->raw == NULL) { - in->raw = xmlBufferCreate(); - } - res = xmlBufferAdd(in->raw, (const xmlChar *) buffer, len); - if (res != 0) - return(-1); - - /* - * convert as much as possible to the parser reading buffer. - */ - use = in->raw->use; - nbchars = xmlCharEncInFunc(in->encoder, in->buffer, in->raw); - if (nbchars < 0) { - xmlIOErr(XML_IO_ENCODER, NULL); - in->error = XML_IO_ENCODER; - return(-1); - } - in->rawconsumed += (use - in->raw->use); - } else { - nbchars = len; - in->buffer->use += nbchars; - buffer[nbchars] = 0; - } - return(nbchars); -} - -/** - * xmlParserInputBufferRead: - * @in: a buffered parser input - * @len: indicative value of the amount of chars to read - * - * Refresh the content of the input buffer, the old data are considered - * consumed - * This routine handle the I18N transcoding to internal UTF-8 - * - * Returns the number of chars read and stored in the buffer, or -1 - * in case of error. - */ -int -xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) { - if ((in == NULL) || (in->error)) return(-1); - if (in->readcallback != NULL) - return(xmlParserInputBufferGrow(in, len)); - else if ((in->buffer != NULL) && - (in->buffer->alloc == XML_BUFFER_ALLOC_IMMUTABLE)) - return(0); - else - return(-1); -} - -/** - * xmlParserGetDirectory: - * @filename: the path to a file - * - * lookup the directory for that file - * - * Returns a new allocated string containing the directory, or NULL. - */ -char * -xmlParserGetDirectory(const char *filename) { - char *ret = NULL; - char dir[1024]; - char *cur; - -#ifdef _WIN32_WCE /* easy way by now ... wince does not have dirs! */ - return NULL; -#endif - - if (xmlInputCallbackInitialized == 0) - xmlRegisterDefaultInputCallbacks(); - - if (filename == NULL) return(NULL); - -#if defined(WIN32) && !defined(__CYGWIN__) -# define IS_XMLPGD_SEP(ch) ((ch=='/')||(ch=='\\')) -#else -# define IS_XMLPGD_SEP(ch) (ch=='/') -#endif - - strncpy(dir, filename, 1023); - dir[1023] = 0; - cur = &dir[strlen(dir)]; - while (cur > dir) { - if (IS_XMLPGD_SEP(*cur)) break; - cur --; - } - if (IS_XMLPGD_SEP(*cur)) { - if (cur == dir) dir[1] = 0; - else *cur = 0; - ret = xmlMemStrdup(dir); - } else { - if (getcwd(dir, 1024) != NULL) { - dir[1023] = 0; - ret = xmlMemStrdup(dir); - } - } - return(ret); -#undef IS_XMLPGD_SEP -} - -/**************************************************************** - * * - * External entities loading * - * * - ****************************************************************/ - -/** - * xmlCheckHTTPInput: - * @ctxt: an XML parser context - * @ret: an XML parser input - * - * Check an input in case it was created from an HTTP stream, in that - * case it will handle encoding and update of the base URL in case of - * redirection. It also checks for HTTP errors in which case the input - * is cleanly freed up and an appropriate error is raised in context - * - * Returns the input or NULL in case of HTTP error. - */ -xmlParserInputPtr -xmlCheckHTTPInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr ret) { - return(ret); -} - -static int xmlNoNetExists(const char *URL) { - const char *path; - - if (URL == NULL) - return(0); - - if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file://localhost/", 17)) -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &URL[17]; -#else - path = &URL[16]; -#endif - else if (!xmlStrncasecmp(BAD_CAST URL, BAD_CAST "file:///", 8)) { -#if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) - path = &URL[8]; -#else - path = &URL[7]; -#endif - } else - path = URL; - - return xmlCheckFilename(path); -} - -/** - * xmlDefaultExternalEntityLoader: - * @URL: the URL for the entity to load - * @ID: the System ID for the entity to load - * @ctxt: the context in which the entity is called or NULL - * - * By default we don't load external entitites, yet. - * - * Returns a new allocated xmlParserInputPtr, or NULL. - */ -static xmlParserInputPtr -xmlDefaultExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) -{ - xmlParserInputPtr ret = NULL; - xmlChar *resource = NULL; - - if ((ctxt != NULL) && (ctxt->options & XML_PARSE_NONET)) { - int options = ctxt->options; - - ctxt->options -= XML_PARSE_NONET; - ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); - ctxt->options = options; - return(ret); - } - - if (resource == NULL) - resource = (xmlChar *) URL; - - if (resource == NULL) { - if (ID == NULL) - ID = "NULL"; - __xmlLoaderErr(ctxt, "failed to load external entity \"%s\"\n", ID); - return (NULL); - } - ret = xmlNewInputFromFile(ctxt, (const char *) resource); - if ((resource != NULL) && (resource != (xmlChar *) URL)) - xmlFree(resource); - return (ret); -} - -static xmlExternalEntityLoader xmlCurrentExternalEntityLoader = - xmlDefaultExternalEntityLoader; - -/** - * xmlSetExternalEntityLoader: - * @f: the new entity resolver function - * - * Changes the defaultexternal entity resolver function for the application - */ -void -xmlSetExternalEntityLoader(xmlExternalEntityLoader f) { - xmlCurrentExternalEntityLoader = f; -} - -/** - * xmlGetExternalEntityLoader: - * - * Get the default external entity resolver function for the application - * - * Returns the xmlExternalEntityLoader function pointer - */ -xmlExternalEntityLoader -xmlGetExternalEntityLoader(void) { - return(xmlCurrentExternalEntityLoader); -} - -/** - * xmlLoadExternalEntity: - * @URL: the URL for the entity to load - * @ID: the Public ID for the entity to load - * @ctxt: the context in which the entity is called or NULL - * - * Load an external entity, note that the use of this function for - * unparsed entities may generate problems - * - * Returns the xmlParserInputPtr or NULL - */ -xmlParserInputPtr -xmlLoadExternalEntity(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) { - if ((URL != NULL) && (xmlNoNetExists(URL) == 0)) { - char *canonicFilename; - xmlParserInputPtr ret; - - canonicFilename = (char *) xmlCanonicPath((const xmlChar *) URL); - if (canonicFilename == NULL) { - xmlIOErrMemory("building canonical path\n"); - return(NULL); - } - - ret = xmlCurrentExternalEntityLoader(canonicFilename, ID, ctxt); - xmlFree(canonicFilename); - return(ret); - } - return(xmlCurrentExternalEntityLoader(URL, ID, ctxt)); -} - -/************************************************************************ - * * - * Disabling Network access * - * * - ************************************************************************/ - -/** - * xmlNoNetExternalEntityLoader: - * @URL: the URL for the entity to load - * @ID: the System ID for the entity to load - * @ctxt: the context in which the entity is called or NULL - * - * A specific entity loader disabling network accesses, though still - * allowing local catalog accesses for resolution. - * - * Returns a new allocated xmlParserInputPtr, or NULL. - */ -xmlParserInputPtr -xmlNoNetExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) { - xmlParserInputPtr input = NULL; - xmlChar *resource = NULL; - - if (resource == NULL) - resource = (xmlChar *) URL; - - if (resource != NULL) { - if ((!xmlStrncasecmp(BAD_CAST resource, BAD_CAST "ftp://", 6)) || - (!xmlStrncasecmp(BAD_CAST resource, BAD_CAST "http://", 7))) { - xmlIOErr(XML_IO_NETWORK_ATTEMPT, (const char *) resource); - if (resource != (xmlChar *) URL) - xmlFree(resource); - return(NULL); - } - } - input = xmlDefaultExternalEntityLoader((const char *) resource, ID, ctxt); - if (resource != (xmlChar *) URL) - xmlFree(resource); - return(input); -} - -#define bottom_xmlIO -#include "elfgcchack.h" diff --git a/deps/libxml2/xmllint.c b/deps/libxml2/xmllint.c deleted file mode 100644 index 6d6bfaa0a7..0000000000 --- a/deps/libxml2/xmllint.c +++ /dev/null @@ -1,2367 +0,0 @@ -/* - * xmllint.c : a small tester program for XML input. - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -#include "libxml.h" - -#include -#include -#include - -#if defined (_WIN32) && !defined(__CYGWIN__) -#if defined (_MSC_VER) || defined(__BORLANDC__) -#include -#pragma comment(lib, "ws2_32.lib") -#define gettimeofday(p1,p2) -#endif /* _MSC_VER */ -#endif /* _WIN32 */ - -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif - -#ifdef __MINGW32__ -#define _WINSOCKAPI_ -#include -#include -#undef XML_SOCKLEN_T -#define XML_SOCKLEN_T unsigned int -#endif - -#ifdef HAVE_SYS_TIMEB_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_MMAN_H -#include -/* seems needed for Solaris */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *) -1) -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_LIBREADLINE -#include -#ifdef HAVE_LIBHISTORY -#include -#endif -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef XML_XML_DEFAULT_CATALOG -#define XML_XML_DEFAULT_CATALOG "file:///etc/xml/catalog" -#endif - -typedef enum { - XMLLINT_RETURN_OK = 0, /* No error */ - XMLLINT_ERR_UNCLASS = 1, /* Unclassified */ - XMLLINT_ERR_DTD = 2, /* Error in DTD */ - XMLLINT_ERR_VALID = 3, /* Validation error */ - XMLLINT_ERR_RDFILE = 4, /* CtxtReadFile error */ - XMLLINT_ERR_SCHEMACOMP = 5, /* Schema compilation */ - XMLLINT_ERR_OUT = 6, /* Error writing output */ - XMLLINT_ERR_SCHEMAPAT = 7, /* Error in schema pattern */ - XMLLINT_ERR_RDREGIS = 8, /* Error in Reader registration */ - XMLLINT_ERR_MEM = 9, /* Out of memory error */ - XMLLINT_ERR_XPATH = 10 /* XPath evaluation error */ -} xmllintReturnCode; -static int debug = 0; -static int maxmem = 0; -#ifdef LIBXML_TREE_ENABLED -static int copy = 0; -#endif /* LIBXML_TREE_ENABLED */ -static int recovery = 0; -static int noent = 0; -static int noenc = 0; -static int noblanks = 0; -static int noout = 0; -static int nowrap = 0; -static int repeat = 0; -static int insert = 0; -static int htmlout = 0; -#ifdef LIBXML_PUSH_ENABLED -static int push = 0; -#endif /* LIBXML_PUSH_ENABLED */ -#ifdef HAVE_SYS_MMAN_H -static int memory = 0; -#endif -static int testIO = 0; -static char *encoding = NULL; -static int dtdattrs = 0; -static int loaddtd = 0; -static xmllintReturnCode progresult = XMLLINT_RETURN_OK; -static int timing = 0; -static int generate = 0; -static int dropdtd = 0; -#ifdef LIBXML_READER_ENABLED -static int stream = 0; -static int walker = 0; -#endif /* LIBXML_READER_ENABLED */ -static int chkregister = 0; -static int nbregister = 0; -static int options = XML_PARSE_COMPACT; -static int sax = 0; -static int oldxml10 = 0; - -/************************************************************************ - * * - * Entity loading control and customization. * - * * - ************************************************************************/ -#define MAX_PATHS 64 -#ifdef _WIN32 -# define PATH_SEPARATOR ';' -#else -# define PATH_SEPARATOR ':' -#endif -static xmlChar *paths[MAX_PATHS + 1]; -static int nbpaths = 0; -static int load_trace = 0; - -static -void parsePath(const xmlChar *path) { - const xmlChar *cur; - - if (path == NULL) - return; - while (*path != 0) { - if (nbpaths >= MAX_PATHS) { - fprintf(stderr, "MAX_PATHS reached: too many paths\n"); - return; - } - cur = path; - while ((*cur == ' ') || (*cur == PATH_SEPARATOR)) - cur++; - path = cur; - while ((*cur != 0) && (*cur != ' ') && (*cur != PATH_SEPARATOR)) - cur++; - if (cur != path) { - paths[nbpaths] = xmlStrndup(path, cur - path); - if (paths[nbpaths] != NULL) - nbpaths++; - path = cur; - } - } -} - -static xmlExternalEntityLoader defaultEntityLoader = NULL; - -static xmlParserInputPtr -xmllintExternalEntityLoader(const char *URL, const char *ID, - xmlParserCtxtPtr ctxt) { - xmlParserInputPtr ret; - warningSAXFunc warning = NULL; - errorSAXFunc err = NULL; - - int i; - const char *lastsegment = URL; - const char *iter = URL; - - if ((nbpaths > 0) && (iter != NULL)) { - while (*iter != 0) { - if (*iter == '/') - lastsegment = iter + 1; - iter++; - } - } - - if ((ctxt != NULL) && (ctxt->sax != NULL)) { - warning = ctxt->sax->warning; - err = ctxt->sax->error; - ctxt->sax->warning = NULL; - ctxt->sax->error = NULL; - } - - if (defaultEntityLoader != NULL) { - ret = defaultEntityLoader(URL, ID, ctxt); - if (ret != NULL) { - if (warning != NULL) - ctxt->sax->warning = warning; - if (err != NULL) - ctxt->sax->error = err; - if (load_trace) { - fprintf \ - (stderr, - "Loaded URL=\"%s\" ID=\"%s\"\n", - URL ? URL : "(null)", - ID ? ID : "(null)"); - } - return(ret); - } - } - for (i = 0;i < nbpaths;i++) { - xmlChar *newURL; - - newURL = xmlStrdup((const xmlChar *) paths[i]); - newURL = xmlStrcat(newURL, (const xmlChar *) "/"); - newURL = xmlStrcat(newURL, (const xmlChar *) lastsegment); - if (newURL != NULL) { - ret = defaultEntityLoader((const char *)newURL, ID, ctxt); - if (ret != NULL) { - if (warning != NULL) - ctxt->sax->warning = warning; - if (err != NULL) - ctxt->sax->error = err; - if (load_trace) { - fprintf \ - (stderr, - "Loaded URL=\"%s\" ID=\"%s\"\n", - newURL, - ID ? ID : "(null)"); - } - xmlFree(newURL); - return(ret); - } - xmlFree(newURL); - } - } - if (err != NULL) - ctxt->sax->error = err; - if (warning != NULL) { - ctxt->sax->warning = warning; - if (URL != NULL) - warning(ctxt, "failed to load external entity \"%s\"\n", URL); - else if (ID != NULL) - warning(ctxt, "failed to load external entity \"%s\"\n", ID); - } - return(NULL); -} -/************************************************************************ - * * - * Memory allocation consumption debugging * - * * - ************************************************************************/ - -static void -OOM(void) -{ - fprintf(stderr, "Ran out of memory needs > %d bytes\n", maxmem); - progresult = XMLLINT_ERR_MEM; -} - -static void -myFreeFunc(void *mem) -{ - xmlMemFree(mem); -} -static void * -myMallocFunc(size_t size) -{ - void *ret; - - ret = xmlMemMalloc(size); - if (ret != NULL) { - if (xmlMemUsed() > maxmem) { - OOM(); - xmlMemFree(ret); - return (NULL); - } - } - return (ret); -} -static void * -myReallocFunc(void *mem, size_t size) -{ - void *ret; - - ret = xmlMemRealloc(mem, size); - if (ret != NULL) { - if (xmlMemUsed() > maxmem) { - OOM(); - xmlMemFree(ret); - return (NULL); - } - } - return (ret); -} -static char * -myStrdupFunc(const char *str) -{ - char *ret; - - ret = xmlMemoryStrdup(str); - if (ret != NULL) { - if (xmlMemUsed() > maxmem) { - OOM(); - xmlFree(ret); - return (NULL); - } - } - return (ret); -} -/************************************************************************ - * * - * Internal timing routines to remove the necessity to have * - * unix-specific function calls. * - * * - ************************************************************************/ - -#ifndef HAVE_GETTIMEOFDAY -#ifdef HAVE_SYS_TIMEB_H -#ifdef HAVE_SYS_TIME_H -#ifdef HAVE_FTIME - -static int -my_gettimeofday(struct timeval *tvp, void *tzp) -{ - struct timeb timebuffer; - - ftime(&timebuffer); - if (tvp) { - tvp->tv_sec = timebuffer.time; - tvp->tv_usec = timebuffer.millitm * 1000L; - } - return (0); -} -#define HAVE_GETTIMEOFDAY 1 -#define gettimeofday my_gettimeofday - -#endif /* HAVE_FTIME */ -#endif /* HAVE_SYS_TIME_H */ -#endif /* HAVE_SYS_TIMEB_H */ -#endif /* !HAVE_GETTIMEOFDAY */ - -#if defined(HAVE_GETTIMEOFDAY) -static struct timeval begin, end; - -/* - * startTimer: call where you want to start timing - */ -static void -startTimer(void) -{ - gettimeofday(&begin, NULL); -} - -/* - * endTimer: call where you want to stop timing and to print out a - * message about the timing performed; format is a printf - * type argument - */ -static void XMLCDECL -endTimer(const char *fmt, ...) -{ - long msec; - va_list ap; - - gettimeofday(&end, NULL); - msec = end.tv_sec - begin.tv_sec; - msec *= 1000; - msec += (end.tv_usec - begin.tv_usec) / 1000; - -#ifndef HAVE_STDARG_H -#error "endTimer required stdarg functions" -#endif - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - - fprintf(stderr, " took %ld ms\n", msec); -} -#elif defined(HAVE_TIME_H) -/* - * No gettimeofday function, so we have to make do with calling clock. - * This is obviously less accurate, but there's little we can do about - * that. - */ -#ifndef CLOCKS_PER_SEC -#define CLOCKS_PER_SEC 100 -#endif - -static clock_t begin, end; -static void -startTimer(void) -{ - begin = clock(); -} -static void XMLCDECL -endTimer(const char *fmt, ...) -{ - long msec; - va_list ap; - - end = clock(); - msec = ((end - begin) * 1000) / CLOCKS_PER_SEC; - -#ifndef HAVE_STDARG_H -#error "endTimer required stdarg functions" -#endif - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, " took %ld ms\n", msec); -} -#else - -/* - * We don't have a gettimeofday or time.h, so we just don't do timing - */ -static void -startTimer(void) -{ - /* - * Do nothing - */ -} -static void XMLCDECL -endTimer(char *format, ...) -{ - /* - * We cannot do anything because we don't have a timing function - */ -#ifdef HAVE_STDARG_H - va_start(ap, format); - vfprintf(stderr, format, ap); - va_end(ap); - fprintf(stderr, " was not timed\n", msec); -#else - /* We don't have gettimeofday, time or stdarg.h, what crazy world is - * this ?! - */ -#endif -} -#endif -/************************************************************************ - * * - * HTML ouput * - * * - ************************************************************************/ -static char buffer[50000]; - -static void -xmlHTMLEncodeSend(void) { - char *result; - - result = (char *) xmlEncodeEntitiesReentrant(NULL, BAD_CAST buffer); - if (result) { - xmlGenericError(xmlGenericErrorContext, "%s", result); - xmlFree(result); - } - buffer[0] = 0; -} - -/** - * xmlHTMLPrintFileInfo: - * @input: an xmlParserInputPtr input - * - * Displays the associated file and line informations for the current input - */ - -static void -xmlHTMLPrintFileInfo(xmlParserInputPtr input) { - int len; - xmlGenericError(xmlGenericErrorContext, "

"); - - len = strlen(buffer); - if (input != NULL) { - if (input->filename) { - snprintf(&buffer[len], sizeof(buffer) - len, "%s:%d: ", input->filename, - input->line); - } else { - snprintf(&buffer[len], sizeof(buffer) - len, "Entity: line %d: ", input->line); - } - } - xmlHTMLEncodeSend(); -} - -/** - * xmlHTMLPrintFileContext: - * @input: an xmlParserInputPtr input - * - * Displays current context within the input content for error tracking - */ - -static void -xmlHTMLPrintFileContext(xmlParserInputPtr input) { - const xmlChar *cur, *base; - int len; - int n; - - if (input == NULL) return; - xmlGenericError(xmlGenericErrorContext, "

\n");
-    cur = input->cur;
-    base = input->base;
-    while ((cur > base) && ((*cur == '\n') || (*cur == '\r'))) {
-	cur--;
-    }
-    n = 0;
-    while ((n++ < 80) && (cur > base) && (*cur != '\n') && (*cur != '\r'))
-        cur--;
-    if ((*cur == '\n') || (*cur == '\r')) cur++;
-    base = cur;
-    n = 0;
-    while ((*cur != 0) && (*cur != '\n') && (*cur != '\r') && (n < 79)) {
-	len = strlen(buffer);
-        snprintf(&buffer[len], sizeof(buffer) - len, "%c",
-		    (unsigned char) *cur++);
-	n++;
-    }
-    len = strlen(buffer);
-    snprintf(&buffer[len], sizeof(buffer) - len, "\n");
-    cur = input->cur;
-    while ((*cur == '\n') || (*cur == '\r'))
-	cur--;
-    n = 0;
-    while ((cur != base) && (n++ < 80)) {
-	len = strlen(buffer);
-        snprintf(&buffer[len], sizeof(buffer) - len, " ");
-        base++;
-    }
-    len = strlen(buffer);
-    snprintf(&buffer[len], sizeof(buffer) - len, "^\n");
-    xmlHTMLEncodeSend();
-    xmlGenericError(xmlGenericErrorContext, "
"); -} - -/** - * xmlHTMLError: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format an error messages, gives file, line, position and - * extra parameters. - */ -static void XMLCDECL -xmlHTMLError(void *ctx, const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr input; - va_list args; - int len; - - buffer[0] = 0; - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) { - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - - xmlHTMLPrintFileInfo(input); - - xmlGenericError(xmlGenericErrorContext, "error: "); - va_start(args, msg); - len = strlen(buffer); - vsnprintf(&buffer[len], sizeof(buffer) - len, msg, args); - va_end(args); - xmlHTMLEncodeSend(); - xmlGenericError(xmlGenericErrorContext, "

\n"); - - xmlHTMLPrintFileContext(input); - xmlHTMLEncodeSend(); -} - -/** - * xmlHTMLWarning: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a warning messages, gives file, line, position and - * extra parameters. - */ -static void XMLCDECL -xmlHTMLWarning(void *ctx, const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr input; - va_list args; - int len; - - buffer[0] = 0; - input = ctxt->input; - if ((input != NULL) && (input->filename == NULL) && (ctxt->inputNr > 1)) { - input = ctxt->inputTab[ctxt->inputNr - 2]; - } - - - xmlHTMLPrintFileInfo(input); - - xmlGenericError(xmlGenericErrorContext, "warning: "); - va_start(args, msg); - len = strlen(buffer); - vsnprintf(&buffer[len], sizeof(buffer) - len, msg, args); - va_end(args); - xmlHTMLEncodeSend(); - xmlGenericError(xmlGenericErrorContext, "

\n"); - - xmlHTMLPrintFileContext(input); - xmlHTMLEncodeSend(); -} - -/** - * xmlHTMLValidityError: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format an validity error messages, gives file, - * line, position and extra parameters. - */ -static void XMLCDECL -xmlHTMLValidityError(void *ctx, const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr input; - va_list args; - int len; - - buffer[0] = 0; - input = ctxt->input; - if ((input->filename == NULL) && (ctxt->inputNr > 1)) - input = ctxt->inputTab[ctxt->inputNr - 2]; - - xmlHTMLPrintFileInfo(input); - - xmlGenericError(xmlGenericErrorContext, "validity error: "); - len = strlen(buffer); - va_start(args, msg); - vsnprintf(&buffer[len], sizeof(buffer) - len, msg, args); - va_end(args); - xmlHTMLEncodeSend(); - xmlGenericError(xmlGenericErrorContext, "

\n"); - - xmlHTMLPrintFileContext(input); - xmlHTMLEncodeSend(); - progresult = XMLLINT_ERR_VALID; -} - -/** - * xmlHTMLValidityWarning: - * @ctx: an XML parser context - * @msg: the message to display/transmit - * @...: extra parameters for the message display - * - * Display and format a validity warning messages, gives file, line, - * position and extra parameters. - */ -static void XMLCDECL -xmlHTMLValidityWarning(void *ctx, const char *msg, ...) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlParserInputPtr input; - va_list args; - int len; - - buffer[0] = 0; - input = ctxt->input; - if ((input->filename == NULL) && (ctxt->inputNr > 1)) - input = ctxt->inputTab[ctxt->inputNr - 2]; - - xmlHTMLPrintFileInfo(input); - - xmlGenericError(xmlGenericErrorContext, "validity warning: "); - va_start(args, msg); - len = strlen(buffer); - vsnprintf(&buffer[len], sizeof(buffer) - len, msg, args); - va_end(args); - xmlHTMLEncodeSend(); - xmlGenericError(xmlGenericErrorContext, "

\n"); - - xmlHTMLPrintFileContext(input); - xmlHTMLEncodeSend(); -} - -/************************************************************************ - * * - * Shell Interface * - * * - ************************************************************************/ - -/************************************************************************ - * * - * I/O Interfaces * - * * - ************************************************************************/ - -static int myRead(FILE *f, char * buf, int len) { - return(fread(buf, 1, len, f)); -} -static void myClose(FILE *f) { - if (f != stdin) { - fclose(f); - } -} - -/************************************************************************ - * * - * SAX based tests * - * * - ************************************************************************/ - -/* - * empty SAX block - */ -static xmlSAXHandler emptySAXHandlerStruct = { - NULL, /* internalSubset */ - NULL, /* isStandalone */ - NULL, /* hasInternalSubset */ - NULL, /* hasExternalSubset */ - NULL, /* resolveEntity */ - NULL, /* getEntity */ - NULL, /* entityDecl */ - NULL, /* notationDecl */ - NULL, /* attributeDecl */ - NULL, /* elementDecl */ - NULL, /* unparsedEntityDecl */ - NULL, /* setDocumentLocator */ - NULL, /* startDocument */ - NULL, /* endDocument */ - NULL, /* startElement */ - NULL, /* endElement */ - NULL, /* reference */ - NULL, /* characters */ - NULL, /* ignorableWhitespace */ - NULL, /* processingInstruction */ - NULL, /* comment */ - NULL, /* xmlParserWarning */ - NULL, /* xmlParserError */ - NULL, /* xmlParserError */ - NULL, /* getParameterEntity */ - NULL, /* cdataBlock; */ - NULL, /* externalSubset; */ - XML_SAX2_MAGIC, - NULL, - NULL, /* startElementNs */ - NULL, /* endElementNs */ - NULL /* xmlStructuredErrorFunc */ -}; - -static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct; -extern xmlSAXHandlerPtr debugSAXHandler; -static int callbacks; - -/** - * isStandaloneDebug: - * @ctxt: An XML parser context - * - * Is this document tagged standalone ? - * - * Returns 1 if true - */ -static int -isStandaloneDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (noout) - return(0); - fprintf(stdout, "SAX.isStandalone()\n"); - return(0); -} - -/** - * hasInternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - * - * Returns 1 if true - */ -static int -hasInternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (noout) - return(0); - fprintf(stdout, "SAX.hasInternalSubset()\n"); - return(0); -} - -/** - * hasExternalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an external subset - * - * Returns 1 if true - */ -static int -hasExternalSubsetDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (noout) - return(0); - fprintf(stdout, "SAX.hasExternalSubset()\n"); - return(0); -} - -/** - * internalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an internal subset - */ -static void -internalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.internalSubset(%s,", name); - if (ExternalID == NULL) - fprintf(stdout, " ,"); - else - fprintf(stdout, " %s,", ExternalID); - if (SystemID == NULL) - fprintf(stdout, " )\n"); - else - fprintf(stdout, " %s)\n", SystemID); -} - -/** - * externalSubsetDebug: - * @ctxt: An XML parser context - * - * Does this document has an external subset - */ -static void -externalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *ExternalID, const xmlChar *SystemID) -{ - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.externalSubset(%s,", name); - if (ExternalID == NULL) - fprintf(stdout, " ,"); - else - fprintf(stdout, " %s,", ExternalID); - if (SystemID == NULL) - fprintf(stdout, " )\n"); - else - fprintf(stdout, " %s)\n", SystemID); -} - -/** - * resolveEntityDebug: - * @ctxt: An XML parser context - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * Special entity resolver, better left to the parser, it has - * more context than the application layer. - * The default behaviour is to NOT resolve the entities, in that case - * the ENTITY_REF nodes are built in the structure (and the parameter - * values). - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlParserInputPtr -resolveEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *publicId, const xmlChar *systemId) -{ - callbacks++; - if (noout) - return(NULL); - /* xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; */ - - - fprintf(stdout, "SAX.resolveEntity("); - if (publicId != NULL) - fprintf(stdout, "%s", (char *)publicId); - else - fprintf(stdout, " "); - if (systemId != NULL) - fprintf(stdout, ", %s)\n", (char *)systemId); - else - fprintf(stdout, ", )\n"); - return(NULL); -} - -/** - * getEntityDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get an entity by name - * - * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. - */ -static xmlEntityPtr -getEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (noout) - return(NULL); - fprintf(stdout, "SAX.getEntity(%s)\n", name); - return(NULL); -} - -/** - * getParameterEntityDebug: - * @ctxt: An XML parser context - * @name: The entity name - * - * Get a parameter entity by name - * - * Returns the xmlParserInputPtr - */ -static xmlEntityPtr -getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (noout) - return(NULL); - fprintf(stdout, "SAX.getParameterEntity(%s)\n", name); - return(NULL); -} - - -/** - * entityDeclDebug: - * @ctxt: An XML parser context - * @name: the entity name - * @type: the entity type - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @content: the entity value (without processing). - * - * An entity definition has been parsed - */ -static void -entityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, - const xmlChar *publicId, const xmlChar *systemId, xmlChar *content) -{ -const xmlChar *nullstr = BAD_CAST "(null)"; - /* not all libraries handle printing null pointers nicely */ - if (publicId == NULL) - publicId = nullstr; - if (systemId == NULL) - systemId = nullstr; - if (content == NULL) - content = (xmlChar *)nullstr; - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.entityDecl(%s, %d, %s, %s, %s)\n", - name, type, publicId, systemId, content); -} - -/** - * attributeDeclDebug: - * @ctxt: An XML parser context - * @name: the attribute name - * @type: the attribute type - * - * An attribute definition has been parsed - */ -static void -attributeDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar * elem, - const xmlChar * name, int type, int def, - const xmlChar * defaultValue, xmlEnumerationPtr tree) -{ - callbacks++; - if (noout) - return; - if (defaultValue == NULL) - fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, NULL, ...)\n", - elem, name, type, def); - else - fprintf(stdout, "SAX.attributeDecl(%s, %s, %d, %d, %s, ...)\n", - elem, name, type, def, defaultValue); - xmlFreeEnumeration(tree); -} - -/** - * elementDeclDebug: - * @ctxt: An XML parser context - * @name: the element name - * @type: the element type - * @content: the element value (without processing). - * - * An element definition has been parsed - */ -static void -elementDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, int type, - xmlElementContentPtr content ATTRIBUTE_UNUSED) -{ - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.elementDecl(%s, %d, ...)\n", - name, type); -} - -/** - * notationDeclDebug: - * @ctxt: An XML parser context - * @name: The name of the notation - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * - * What to do when a notation declaration has been parsed. - */ -static void -notationDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId) -{ - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.notationDecl(%s, %s, %s)\n", - (char *) name, (char *) publicId, (char *) systemId); -} - -/** - * unparsedEntityDeclDebug: - * @ctxt: An XML parser context - * @name: The name of the entity - * @publicId: The public ID of the entity - * @systemId: The system ID of the entity - * @notationName: the name of the notation - * - * What to do when an unparsed entity declaration is parsed - */ -static void -unparsedEntityDeclDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, - const xmlChar *publicId, const xmlChar *systemId, - const xmlChar *notationName) -{ -const xmlChar *nullstr = BAD_CAST "(null)"; - - if (publicId == NULL) - publicId = nullstr; - if (systemId == NULL) - systemId = nullstr; - if (notationName == NULL) - notationName = nullstr; - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.unparsedEntityDecl(%s, %s, %s, %s)\n", - (char *) name, (char *) publicId, (char *) systemId, - (char *) notationName); -} - -/** - * setDocumentLocatorDebug: - * @ctxt: An XML parser context - * @loc: A SAX Locator - * - * Receive the document locator at startup, actually xmlDefaultSAXLocator - * Everything is available on the context, so this is useless in our case. - */ -static void -setDocumentLocatorDebug(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED) -{ - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.setDocumentLocator()\n"); -} - -/** - * startDocumentDebug: - * @ctxt: An XML parser context - * - * called when the document start being processed. - */ -static void -startDocumentDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.startDocument()\n"); -} - -/** - * endDocumentDebug: - * @ctxt: An XML parser context - * - * called when the document end has been detected. - */ -static void -endDocumentDebug(void *ctx ATTRIBUTE_UNUSED) -{ - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.endDocument()\n"); -} - -/** - * startElementDebug: - * @ctxt: An XML parser context - * @name: The element name - * - * called when an opening tag has been processed. - */ -static void -startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts) -{ - int i; - - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.startElement(%s", (char *) name); - if (atts != NULL) { - for (i = 0;(atts[i] != NULL);i++) { - fprintf(stdout, ", %s='", atts[i++]); - if (atts[i] != NULL) - fprintf(stdout, "%s'", atts[i]); - } - } - fprintf(stdout, ")\n"); -} - -/** - * endElementDebug: - * @ctxt: An XML parser context - * @name: The element name - * - * called when the end of an element has been detected. - */ -static void -endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) -{ - callbacks++; - if (noout) - return; - fprintf(stdout, "SAX.endElement(%s)\n", (char *) name); -} - -/** - * charactersDebug: - * @ctxt: An XML parser context - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some chars from the parser. - * Question: how much at a time ??? - */ -static void -charactersDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *ch, int len) -{ - char out[40]; - int i; - - callbacks++; - if (noout) - return; - for (i = 0;(isax; - ctxt->sax = handler; - ctxt->userData = (void *) user_data; - inputStream = xmlNewIOInputStream(ctxt, buf, XML_CHAR_ENCODING_NONE); - if (inputStream == NULL) { - xmlFreeParserInputBuffer(buf); - goto error; - } - inputPush(ctxt, inputStream); - - /* do the parsing */ - xmlParseDocument(ctxt); - - if (ctxt->myDoc != NULL) { - fprintf(stderr, "SAX generated a doc !\n"); - xmlFreeDoc(ctxt->myDoc); - ctxt->myDoc = NULL; - } - } - -error: - if (ctxt != NULL) { - ctxt->sax = old_sax; - xmlFreeParserCtxt(ctxt); - } -} - -/************************************************************************ - * * - * Stream Test processing * - * * - ************************************************************************/ -#ifdef LIBXML_READER_ENABLED -static void processNode(xmlTextReaderPtr reader) { - const xmlChar *name, *value; - int type, empty; - - type = xmlTextReaderNodeType(reader); - empty = xmlTextReaderIsEmptyElement(reader); - - if (debug) { - name = xmlTextReaderConstName(reader); - if (name == NULL) - name = BAD_CAST "--"; - - value = xmlTextReaderConstValue(reader); - - - printf("%d %d %s %d %d", - xmlTextReaderDepth(reader), - type, - name, - empty, - xmlTextReaderHasValue(reader)); - if (value == NULL) - printf("\n"); - else { - printf(" %s\n", value); - } - } -} - -static void streamFile(char *filename) { - xmlTextReaderPtr reader; - int ret; -#ifdef HAVE_SYS_MMAN_H - int fd = -1; - struct stat info; - const char *base = NULL; - xmlParserInputBufferPtr input = NULL; - - if (memory) { - if (stat(filename, &info) < 0) - return; - if ((fd = open(filename, O_RDONLY)) < 0) - return; - base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ; - if (base == (void *) MAP_FAILED) - return; - - reader = xmlReaderForMemory(base, info.st_size, filename, - NULL, options); - } else -#endif - reader = xmlReaderForFile(filename, NULL, options); - - - if (reader != NULL) { - xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1); - - /* - * Process all nodes in sequence - */ - if ((timing) && (!repeat)) { - startTimer(); - } - ret = xmlTextReaderRead(reader); - while (ret == 1) { - if ((debug) - ) - processNode(reader); - ret = xmlTextReaderRead(reader); - } - if ((timing) && (!repeat)) { - endTimer("Parsing"); - } - - /* - * Done, cleanup and status - */ - xmlFreeTextReader(reader); - if (ret != 0) { - fprintf(stderr, "%s : failed to parse\n", filename); - progresult = XMLLINT_ERR_UNCLASS; - } - } else { - fprintf(stderr, "Unable to open %s\n", filename); - progresult = XMLLINT_ERR_UNCLASS; - } -#ifdef HAVE_SYS_MMAN_H - if (memory) { - xmlFreeParserInputBuffer(input); - munmap((char *) base, info.st_size); - close(fd); - } -#endif -} - -static void walkDoc(xmlDocPtr doc) { - xmlTextReaderPtr reader; - int ret; - - reader = xmlReaderWalker(doc); - if (reader != NULL) { - if ((timing) && (!repeat)) { - startTimer(); - } - ret = xmlTextReaderRead(reader); - while (ret == 1) { - if ((debug) - ) - processNode(reader); - ret = xmlTextReaderRead(reader); - } - if ((timing) && (!repeat)) { - endTimer("walking through the doc"); - } - xmlFreeTextReader(reader); - if (ret != 0) { - fprintf(stderr, "failed to walk through the doc\n"); - progresult = XMLLINT_ERR_UNCLASS; - } - } else { - fprintf(stderr, "Failed to crate a reader from the document\n"); - progresult = XMLLINT_ERR_UNCLASS; - } -} -#endif /* LIBXML_READER_ENABLED */ - -/************************************************************************ - * * - * Tree Test processing * - * * - ************************************************************************/ -static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { - xmlDocPtr doc = NULL; -#ifdef LIBXML_TREE_ENABLED - xmlDocPtr tmp; -#endif /* LIBXML_TREE_ENABLED */ - - if ((timing) && (!repeat)) - startTimer(); - - -#ifdef LIBXML_TREE_ENABLED - if (filename == NULL) { - if (generate) { - xmlNodePtr n; - - doc = xmlNewDoc(BAD_CAST "1.0"); - n = xmlNewDocNode(doc, NULL, BAD_CAST "info", NULL); - xmlNodeSetContent(n, BAD_CAST "abc"); - xmlDocSetRootElement(doc, n); - } - } -#endif /* LIBXML_TREE_ENABLED */ - else { -#ifdef LIBXML_PUSH_ENABLED - /* - * build an XML tree from a string; - */ - if (push) { - FILE *f; - - /* '-' Usually means stdin - */ - if ((filename[0] == '-') && (filename[1] == 0)) { - f = stdin; - } else { -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - f = fopen(filename, "rb"); -#else - f = fopen(filename, "r"); -#endif - } - if (f != NULL) { - int ret; - int res, size = 1024; - char chars[1024]; - xmlParserCtxtPtr ctxt; - - /* if (repeat) size = 1024; */ - res = fread(chars, 1, 4, f); - if (res > 0) { - ctxt = xmlCreatePushParserCtxt(NULL, NULL, - chars, res, filename); - xmlCtxtUseOptions(ctxt, options); - while ((res = fread(chars, 1, size, f)) > 0) { - xmlParseChunk(ctxt, chars, res, 0); - } - xmlParseChunk(ctxt, chars, 0, 1); - doc = ctxt->myDoc; - ret = ctxt->wellFormed; - xmlFreeParserCtxt(ctxt); - if (!ret) { - xmlFreeDoc(doc); - doc = NULL; - } - } - if (f != stdin) - fclose(f); - } - } else -#endif /* LIBXML_PUSH_ENABLED */ - if (testIO) { - if ((filename[0] == '-') && (filename[1] == 0)) { - doc = xmlReadFd(0, NULL, NULL, options); - } else { - FILE *f; - -#if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) - f = fopen(filename, "rb"); -#else - f = fopen(filename, "r"); -#endif - if (f != NULL) { - if (rectxt == NULL) - doc = xmlReadIO((xmlInputReadCallback) myRead, - (xmlInputCloseCallback) myClose, f, - filename, NULL, options); - else - doc = xmlCtxtReadIO(rectxt, - (xmlInputReadCallback) myRead, - (xmlInputCloseCallback) myClose, f, - filename, NULL, options); - } else - doc = NULL; - } - } else if (htmlout) { - xmlParserCtxtPtr ctxt; - - if (rectxt == NULL) - ctxt = xmlNewParserCtxt(); - else - ctxt = rectxt; - if (ctxt == NULL) { - doc = NULL; - } else { - ctxt->sax->error = xmlHTMLError; - ctxt->sax->warning = xmlHTMLWarning; - ctxt->vctxt.error = xmlHTMLValidityError; - ctxt->vctxt.warning = xmlHTMLValidityWarning; - - doc = xmlCtxtReadFile(ctxt, filename, NULL, options); - - if (rectxt == NULL) - xmlFreeParserCtxt(ctxt); - } -#ifdef HAVE_SYS_MMAN_H - } else if (memory) { - int fd; - struct stat info; - const char *base; - if (stat(filename, &info) < 0) - return; - if ((fd = open(filename, O_RDONLY)) < 0) - return; - base = mmap(NULL, info.st_size, PROT_READ, MAP_SHARED, fd, 0) ; - if (base == (void *) MAP_FAILED) - return; - - if (rectxt == NULL) - doc = xmlReadMemory((char *) base, info.st_size, - filename, NULL, options); - else - doc = xmlCtxtReadMemory(rectxt, (char *) base, info.st_size, - filename, NULL, options); - - munmap((char *) base, info.st_size); - close(fd); -#endif - } else { - if (rectxt != NULL) - doc = xmlCtxtReadFile(rectxt, filename, NULL, options); - else { - doc = xmlReadFile(filename, NULL, options); - } - } - } - - /* - * If we don't have a document we might as well give up. Do we - * want an error message here? */ - if (doc == NULL) { - progresult = XMLLINT_ERR_UNCLASS; - return; - } - - if ((timing) && (!repeat)) { - endTimer("Parsing"); - } - - /* - * Remove DOCTYPE nodes - */ - if (dropdtd) { - xmlDtdPtr dtd; - - dtd = xmlGetIntSubset(doc); - if (dtd != NULL) { - xmlUnlinkNode((xmlNodePtr)dtd); - xmlFreeDtd(dtd); - } - } - - -#ifdef LIBXML_TREE_ENABLED - /* - * test intermediate copy if needed. - */ - if (copy) { - tmp = doc; - if (timing) { - startTimer(); - } - doc = xmlCopyDoc(doc, 1); - if (timing) { - endTimer("Copying"); - } - if (timing) { - startTimer(); - } - xmlFreeDoc(tmp); - if (timing) { - endTimer("Freeing original"); - } - } -#endif /* LIBXML_TREE_ENABLED */ - -#ifdef LIBXML_READER_ENABLED - if (walker) { - walkDoc(doc); - } -#endif /* LIBXML_READER_ENABLED */ - - - /* - * free it. - */ - if ((timing) && (!repeat)) { - startTimer(); - } - xmlFreeDoc(doc); - if ((timing) && (!repeat)) { - endTimer("Freeing"); - } -} - -/************************************************************************ - * * - * Usage and Main * - * * - ************************************************************************/ - -static void showVersion(const char *name) { - fprintf(stderr, "%s: using libxml version %s\n", name, xmlParserVersion); - fprintf(stderr, " compiled with: "); - if (xmlHasFeature(XML_WITH_TREE)) fprintf(stderr, "Tree "); - if (xmlHasFeature(XML_WITH_OUTPUT)) fprintf(stderr, "Output "); - if (xmlHasFeature(XML_WITH_PUSH)) fprintf(stderr, "Push "); - if (xmlHasFeature(XML_WITH_READER)) fprintf(stderr, "Reader "); - if (xmlHasFeature(XML_WITH_PATTERN)) fprintf(stderr, "Patterns "); - if (xmlHasFeature(XML_WITH_WRITER)) fprintf(stderr, "Writer "); - if (xmlHasFeature(XML_WITH_SAX1)) fprintf(stderr, "SAXv1 "); - if (xmlHasFeature(XML_WITH_FTP)) fprintf(stderr, "FTP "); - if (xmlHasFeature(XML_WITH_HTTP)) fprintf(stderr, "HTTP "); - if (xmlHasFeature(XML_WITH_VALID)) fprintf(stderr, "DTDValid "); - if (xmlHasFeature(XML_WITH_HTML)) fprintf(stderr, "HTML "); - if (xmlHasFeature(XML_WITH_LEGACY)) fprintf(stderr, "Legacy "); - if (xmlHasFeature(XML_WITH_C14N)) fprintf(stderr, "C14N "); - if (xmlHasFeature(XML_WITH_CATALOG)) fprintf(stderr, "Catalog "); - if (xmlHasFeature(XML_WITH_XPATH)) fprintf(stderr, "XPath "); - if (xmlHasFeature(XML_WITH_XPTR)) fprintf(stderr, "XPointer "); - if (xmlHasFeature(XML_WITH_XINCLUDE)) fprintf(stderr, "XInclude "); - if (xmlHasFeature(XML_WITH_ICONV)) fprintf(stderr, "Iconv "); - if (xmlHasFeature(XML_WITH_ISO8859X)) fprintf(stderr, "ISO8859X "); - if (xmlHasFeature(XML_WITH_UNICODE)) fprintf(stderr, "Unicode "); - if (xmlHasFeature(XML_WITH_REGEXP)) fprintf(stderr, "Regexps "); - if (xmlHasFeature(XML_WITH_AUTOMATA)) fprintf(stderr, "Automata "); - if (xmlHasFeature(XML_WITH_EXPR)) fprintf(stderr, "Expr "); - if (xmlHasFeature(XML_WITH_SCHEMAS)) fprintf(stderr, "Schemas "); - if (xmlHasFeature(XML_WITH_SCHEMATRON)) fprintf(stderr, "Schematron "); - if (xmlHasFeature(XML_WITH_MODULES)) fprintf(stderr, "Modules "); - if (xmlHasFeature(XML_WITH_DEBUG)) fprintf(stderr, "Debug "); - if (xmlHasFeature(XML_WITH_DEBUG_MEM)) fprintf(stderr, "MemDebug "); - if (xmlHasFeature(XML_WITH_DEBUG_RUN)) fprintf(stderr, "RunDebug "); - if (xmlHasFeature(XML_WITH_ZLIB)) fprintf(stderr, "Zlib "); - if (xmlHasFeature(XML_WITH_LZMA)) fprintf(stderr, "Lzma "); - fprintf(stderr, "\n"); -} - -static void usage(const char *name) { - printf("Usage : %s [options] XMLfiles ...\n", name); - printf("\tParse the XML files\n"); - printf("\t--version : display the version of the XML library used\n"); -#ifdef LIBXML_READER_ENABLED - printf("\t--debug : dump the nodes content when using --stream\n"); -#endif /* LIBXML_READER_ENABLED */ -#endif -#ifdef LIBXML_TREE_ENABLED - printf("\t--copy : used to test the internal copy implementation\n"); -#endif /* LIBXML_TREE_ENABLED */ - printf("\t--recover : output what was parsable on broken XML documents\n"); - printf("\t--huge : remove any internal arbitrary parser limits\n"); - printf("\t--noent : substitute entity references by their value\n"); - printf("\t--noenc : ignore any encoding specified inside the document\n"); - printf("\t--noout : don't output the result tree\n"); - printf("\t--path 'paths': provide a set of paths for resources\n"); - printf("\t--load-trace : print trace of all external entites loaded\n"); - printf("\t--nonet : refuse to fetch DTDs or entities over network\n"); - printf("\t--nocompact : do not generate compact text nodes\n"); - printf("\t--htmlout : output results as HTML\n"); - printf("\t--nowrap : do not put HTML doc wrapper\n"); - printf("\t--timing : print some timings\n"); - printf("\t--output file or -o file: save to a given file\n"); - printf("\t--repeat : repeat 100 times, for timing or profiling\n"); - printf("\t--insert : ad-hoc test for valid insertions\n"); -#ifdef LIBXML_PUSH_ENABLED - printf("\t--push : use the push mode of the parser\n"); -#endif /* LIBXML_PUSH_ENABLED */ -#ifdef HAVE_SYS_MMAN_H - printf("\t--memory : parse from memory\n"); -#endif - printf("\t--maxmem nbbytes : limits memory allocation to nbbytes bytes\n"); - printf("\t--nowarning : do not emit warnings from parser/validator\n"); - printf("\t--noblanks : drop (ignorable?) blanks spaces\n"); - printf("\t--nocdata : replace cdata section with text nodes\n"); - printf("\t--c14n : save in W3C canonical format v1.0 (with comments)\n"); - printf("\t--c14n11 : save in W3C canonical format v1.1 (with comments)\n"); - printf("\t--exc-c14n : save in W3C exclusive canonical format (with comments)\n"); - printf("\t--nsclean : remove redundant namespace declarations\n"); - printf("\t--testIO : test user I/O support\n"); - printf("\t--auto : generate a small doc on the fly\n"); - printf("\t--loaddtd : fetch external DTD\n"); - printf("\t--dtdattr : loaddtd + populate the tree with inherited attributes \n"); -#ifdef LIBXML_READER_ENABLED - printf("\t--stream : use the streaming interface to process very large files\n"); - printf("\t--walker : create a reader and walk though the resulting doc\n"); -#endif /* LIBXML_READER_ENABLED */ - printf("\t--chkregister : verify the node registration code\n"); - printf("\t--sax: do not build a tree but work just at the SAX level\n"); - printf("\t--oldxml10: use XML-1.0 parsing rules before the 5th edition\n"); - - printf("\nLibxml project home page: http://xmlsoft.org/\n"); - printf("To report bugs or get some help check: http://xmlsoft.org/bugs.html\n"); -} - -static void registerNode(xmlNodePtr node) -{ - node->_private = malloc(sizeof(long)); - *(long*)node->_private = (long) 0x81726354; - nbregister++; -} - -static void deregisterNode(xmlNodePtr node) -{ - assert(node->_private != NULL); - assert(*(long*)node->_private == (long) 0x81726354); - free(node->_private); - nbregister--; -} - -int -main(int argc, char **argv) { - int i, acount; - int files = 0; - int version = 0; - const char* indent; - - if (argc <= 1) { - usage(argv[0]); - return(1); - } - LIBXML_TEST_VERSION - for (i = 1; i < argc ; i++) { - if (!strcmp(argv[i], "-")) - break; - - if (argv[i][0] != '-') - continue; - if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) - debug++; - else -#ifdef LIBXML_TREE_ENABLED - if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy"))) - copy++; - else -#endif /* LIBXML_TREE_ENABLED */ - if ((!strcmp(argv[i], "-recover")) || - (!strcmp(argv[i], "--recover"))) { - recovery++; - options |= XML_PARSE_RECOVER; - } else if ((!strcmp(argv[i], "-huge")) || - (!strcmp(argv[i], "--huge"))) { - options |= XML_PARSE_HUGE; - } else if ((!strcmp(argv[i], "-noent")) || - (!strcmp(argv[i], "--noent"))) { - noent++; - options |= XML_PARSE_NOENT; - } else if ((!strcmp(argv[i], "-noenc")) || - (!strcmp(argv[i], "--noenc"))) { - noenc++; - options |= XML_PARSE_IGNORE_ENC; - } else if ((!strcmp(argv[i], "-nsclean")) || - (!strcmp(argv[i], "--nsclean"))) { - options |= XML_PARSE_NSCLEAN; - } else if ((!strcmp(argv[i], "-nocdata")) || - (!strcmp(argv[i], "--nocdata"))) { - options |= XML_PARSE_NOCDATA; - } else if ((!strcmp(argv[i], "-nodict")) || - (!strcmp(argv[i], "--nodict"))) { - options |= XML_PARSE_NODICT; - } else if ((!strcmp(argv[i], "-version")) || - (!strcmp(argv[i], "--version"))) { - showVersion(argv[0]); - version = 1; - } else if ((!strcmp(argv[i], "-noout")) || - (!strcmp(argv[i], "--noout"))) - noout++; - else if ((!strcmp(argv[i], "-htmlout")) || - (!strcmp(argv[i], "--htmlout"))) - htmlout++; - else if ((!strcmp(argv[i], "-nowrap")) || - (!strcmp(argv[i], "--nowrap"))) - nowrap++; - else if ((!strcmp(argv[i], "-loaddtd")) || - (!strcmp(argv[i], "--loaddtd"))) { - loaddtd++; - options |= XML_PARSE_DTDLOAD; - } else if ((!strcmp(argv[i], "-dtdattr")) || - (!strcmp(argv[i], "--dtdattr"))) { - loaddtd++; - dtdattrs++; - options |= XML_PARSE_DTDATTR; - } - else if ((!strcmp(argv[i], "-dropdtd")) || - (!strcmp(argv[i], "--dropdtd"))) - dropdtd++; - else if ((!strcmp(argv[i], "-insert")) || - (!strcmp(argv[i], "--insert"))) - insert++; - else if ((!strcmp(argv[i], "-timing")) || - (!strcmp(argv[i], "--timing"))) - timing++; - else if ((!strcmp(argv[i], "-auto")) || - (!strcmp(argv[i], "--auto"))) - generate++; - else if ((!strcmp(argv[i], "-repeat")) || - (!strcmp(argv[i], "--repeat"))) { - if (repeat) - repeat *= 10; - else - repeat = 100; - } -#ifdef LIBXML_PUSH_ENABLED - else if ((!strcmp(argv[i], "-push")) || - (!strcmp(argv[i], "--push"))) - push++; -#endif /* LIBXML_PUSH_ENABLED */ -#ifdef HAVE_SYS_MMAN_H - else if ((!strcmp(argv[i], "-memory")) || - (!strcmp(argv[i], "--memory"))) - memory++; -#endif - else if ((!strcmp(argv[i], "-testIO")) || - (!strcmp(argv[i], "--testIO"))) - testIO++; - else if ((!strcmp(argv[i], "-nowarning")) || - (!strcmp(argv[i], "--nowarning"))) { - xmlGetWarningsDefaultValue = 0; - xmlPedanticParserDefault(0); - options |= XML_PARSE_NOWARNING; - } - else if ((!strcmp(argv[i], "-pedantic")) || - (!strcmp(argv[i], "--pedantic"))) { - xmlGetWarningsDefaultValue = 1; - xmlPedanticParserDefault(1); - options |= XML_PARSE_PEDANTIC; - } - else if ((!strcmp(argv[i], "-encode")) || - (!strcmp(argv[i], "--encode"))) { - i++; - encoding = argv[i]; - /* - * OK it's for testing purposes - */ - xmlAddEncodingAlias("UTF-8", "DVEnc"); - } - else if ((!strcmp(argv[i], "-noblanks")) || - (!strcmp(argv[i], "--noblanks"))) { - noblanks++; - xmlKeepBlanksDefault(0); - } - else if ((!strcmp(argv[i], "-maxmem")) || - (!strcmp(argv[i], "--maxmem"))) { - i++; - if (sscanf(argv[i], "%d", &maxmem) == 1) { - xmlMemSetup(myFreeFunc, myMallocFunc, myReallocFunc, - myStrdupFunc); - } else { - maxmem = 0; - } - } - else if ((!strcmp(argv[i], "-format")) || - (!strcmp(argv[i], "--format"))) { - noblanks++; - xmlKeepBlanksDefault(0); - } - else if ((!strcmp(argv[i], "-pretty")) || - (!strcmp(argv[i], "--pretty"))) { - i++; - if (format == 1) { - noblanks++; - xmlKeepBlanksDefault(0); - } - } -#ifdef LIBXML_READER_ENABLED - else if ((!strcmp(argv[i], "-stream")) || - (!strcmp(argv[i], "--stream"))) { - stream++; - } - else if ((!strcmp(argv[i], "-walker")) || - (!strcmp(argv[i], "--walker"))) { - walker++; - noout++; - } -#endif /* LIBXML_READER_ENABLED */ - else if ((!strcmp(argv[i], "-sax")) || - (!strcmp(argv[i], "--sax"))) { - sax++; - } - else if ((!strcmp(argv[i], "-chkregister")) || - (!strcmp(argv[i], "--chkregister"))) { - chkregister++; - } else if ((!strcmp(argv[i], "-nonet")) || - (!strcmp(argv[i], "--nonet"))) { - options |= XML_PARSE_NONET; - xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader); - } else if ((!strcmp(argv[i], "-nocompact")) || - (!strcmp(argv[i], "--nocompact"))) { - options &= ~XML_PARSE_COMPACT; - } else if ((!strcmp(argv[i], "-load-trace")) || - (!strcmp(argv[i], "--load-trace"))) { - load_trace++; - } else if ((!strcmp(argv[i], "-path")) || - (!strcmp(argv[i], "--path"))) { - i++; - parsePath(BAD_CAST argv[i]); - } else if ((!strcmp(argv[i], "-oldxml10")) || - (!strcmp(argv[i], "--oldxml10"))) { - oldxml10++; - options |= XML_PARSE_OLD10; - } else { - fprintf(stderr, "Unknown option %s\n", argv[i]); - usage(argv[0]); - return(1); - } - } - - - - if (chkregister) { - xmlRegisterNodeDefault(registerNode); - xmlDeregisterNodeDefault(deregisterNode); - } - - indent = getenv("XMLLINT_INDENT"); - if(indent != NULL) { - xmlTreeIndentString = indent; - } - - - defaultEntityLoader = xmlGetExternalEntityLoader(); - xmlSetExternalEntityLoader(xmllintExternalEntityLoader); - - xmlLineNumbersDefault(1); - if (loaddtd != 0) - xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS; - if (dtdattrs) - xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS; - if (noent != 0) xmlSubstituteEntitiesDefault(1); - if ((htmlout) && (!nowrap)) { - xmlGenericError(xmlGenericErrorContext, - "\n"); - xmlGenericError(xmlGenericErrorContext, - "%s output\n", - argv[0]); - xmlGenericError(xmlGenericErrorContext, - "

%s output

\n", - argv[0]); - } - - for (i = 1; i < argc ; i++) { - if ((!strcmp(argv[i], "-encode")) || - (!strcmp(argv[i], "--encode"))) { - i++; - continue; - } else if ((!strcmp(argv[i], "-o")) || - (!strcmp(argv[i], "-output")) || - (!strcmp(argv[i], "--output"))) { - i++; - continue; - } - if ((!strcmp(argv[i], "-relaxng")) || - (!strcmp(argv[i], "--relaxng"))) { - i++; - continue; - } - if ((!strcmp(argv[i], "-maxmem")) || - (!strcmp(argv[i], "--maxmem"))) { - i++; - continue; - } - if ((!strcmp(argv[i], "-pretty")) || - (!strcmp(argv[i], "--pretty"))) { - i++; - continue; - } - if ((!strcmp(argv[i], "-schema")) || - (!strcmp(argv[i], "--schema"))) { - i++; - continue; - } - if ((!strcmp(argv[i], "-schematron")) || - (!strcmp(argv[i], "--schematron"))) { - i++; - continue; - } - if ((timing) && (repeat)) - startTimer(); - /* Remember file names. "-" means stdin. */ - if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) { - if (repeat) { - xmlParserCtxtPtr ctxt = NULL; - - for (acount = 0;acount < repeat;acount++) { -#ifdef LIBXML_READER_ENABLED - if (stream != 0) { - streamFile(argv[i]); - } else { -#endif /* LIBXML_READER_ENABLED */ - if (sax) { - testSAX(argv[i]); - } else { - if (ctxt == NULL) - ctxt = xmlNewParserCtxt(); - parseAndPrintFile(argv[i], ctxt); - } -#ifdef LIBXML_READER_ENABLED - } -#endif /* LIBXML_READER_ENABLED */ - } - if (ctxt != NULL) - xmlFreeParserCtxt(ctxt); - } else { - nbregister = 0; - -#ifdef LIBXML_READER_ENABLED - if (stream != 0) - streamFile(argv[i]); - else -#endif /* LIBXML_READER_ENABLED */ - if (sax) { - testSAX(argv[i]); - } else { - parseAndPrintFile(argv[i], NULL); - } - - if ((chkregister) && (nbregister != 0)) { - fprintf(stderr, "Registration count off: %d\n", nbregister); - progresult = XMLLINT_ERR_RDREGIS; - } - } - files ++; - if ((timing) && (repeat)) { - endTimer("%d iterations", repeat); - } - } - } - if (generate) - parseAndPrintFile(NULL, NULL); - if ((htmlout) && (!nowrap)) { - xmlGenericError(xmlGenericErrorContext, "\n"); - } - if ((files == 0) && (!generate) && (version == 0)) { - usage(argv[0]); - } - xmlCleanupParser(); - xmlMemoryDump(); - - return(progresult); -} - diff --git a/deps/libxml2/xmlmemory.c b/deps/libxml2/xmlmemory.c deleted file mode 100644 index 6d158dc0ab..0000000000 --- a/deps/libxml2/xmlmemory.c +++ /dev/null @@ -1,754 +0,0 @@ -/* - * xmlmemory.c: libxml memory allocator wrapper. - * - * daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#ifdef HAVE_TIME_H -#include -#endif - -#ifdef HAVE_STDLIB_H -#include -#else -#ifdef HAVE_MALLOC_H -#include -#endif -#endif - -#ifdef HAVE_CTYPE_H -#include -#endif - -#include /* must come before xmlmemory.h */ -#include -#include -#include - -static int xmlMemInitialized = 0; -static unsigned long debugMemSize = 0; -static unsigned long debugMemBlocks = 0; -static unsigned long debugMaxMemSize = 0; - -void xmlMallocBreakpoint(void); - -/************************************************************************ - * * - * Macros, variables and associated types * - * * - ************************************************************************/ - -#ifdef xmlMalloc -#undef xmlMalloc -#endif -#ifdef xmlRealloc -#undef xmlRealloc -#endif -#ifdef xmlMemStrdup -#undef xmlMemStrdup -#endif - -/* - * Each of the blocks allocated begin with a header containing informations - */ - -#define MEMTAG 0x5aa5 - -#define MALLOC_TYPE 1 -#define REALLOC_TYPE 2 -#define STRDUP_TYPE 3 -#define MALLOC_ATOMIC_TYPE 4 -#define REALLOC_ATOMIC_TYPE 5 - -typedef struct memnod { - unsigned int mh_tag; - unsigned int mh_type; - unsigned long mh_number; - size_t mh_size; - const char *mh_file; - unsigned int mh_line; -} MEMHDR; - - -#ifdef SUN4 -#define ALIGN_SIZE 16 -#else -#define ALIGN_SIZE sizeof(double) -#endif -#define HDR_SIZE sizeof(MEMHDR) -#define RESERVE_SIZE (((HDR_SIZE + (ALIGN_SIZE-1)) \ - / ALIGN_SIZE ) * ALIGN_SIZE) - - -#define CLIENT_2_HDR(a) ((MEMHDR *) (((char *) (a)) - RESERVE_SIZE)) -#define HDR_2_CLIENT(a) ((void *) (((char *) (a)) + RESERVE_SIZE)) - - -static unsigned int block=0; -static unsigned int xmlMemStopAtBlock = 0; -static void *xmlMemTraceBlockAt = NULL; - -static void debugmem_tag_error(void *addr); -#define Mem_Tag_Err(a) debugmem_tag_error(a); - -#ifndef TEST_POINT -#define TEST_POINT -#endif - -/** - * xmlMallocBreakpoint: - * - * Breakpoint to use in conjunction with xmlMemStopAtBlock. When the block - * number reaches the specified value this function is called. One need to add a breakpoint - * to it to get the context in which the given block is allocated. - */ - -void -xmlMallocBreakpoint(void) { - xmlGenericError(xmlGenericErrorContext, - "xmlMallocBreakpoint reached on block %d\n", xmlMemStopAtBlock); -} - -/** - * xmlMallocLoc: - * @size: an int specifying the size in byte to allocate. - * @file: the file name or NULL - * @line: the line number - * - * a malloc() equivalent, with logging of the allocation info. - * - * Returns a pointer to the allocated area or NULL in case of lack of memory. - */ - -void * -xmlMallocLoc(size_t size, const char * file, int line) -{ - MEMHDR *p; - void *ret; - - if (!xmlMemInitialized) xmlInitMemory(); - - TEST_POINT - - p = (MEMHDR *) malloc(RESERVE_SIZE+size); - - if (!p) { - xmlGenericError(xmlGenericErrorContext, - "xmlMallocLoc : Out of free space\n"); - xmlMemoryDump(); - return(NULL); - } - p->mh_tag = MEMTAG; - p->mh_size = size; - p->mh_type = MALLOC_TYPE; - p->mh_file = file; - p->mh_line = line; - p->mh_number = ++block; - debugMemSize += size; - debugMemBlocks++; - if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; - - - if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); - - ret = HDR_2_CLIENT(p); - - if (xmlMemTraceBlockAt == ret) { - xmlGenericError(xmlGenericErrorContext, - "%p : Malloc(%lu) Ok\n", xmlMemTraceBlockAt, - (long unsigned)size); - xmlMallocBreakpoint(); - } - - TEST_POINT - - return(ret); -} - -/** - * xmlMallocAtomicLoc: - * @size: an int specifying the size in byte to allocate. - * @file: the file name or NULL - * @line: the line number - * - * a malloc() equivalent, with logging of the allocation info. - * - * Returns a pointer to the allocated area or NULL in case of lack of memory. - */ - -void * -xmlMallocAtomicLoc(size_t size, const char * file, int line) -{ - MEMHDR *p; - void *ret; - - if (!xmlMemInitialized) xmlInitMemory(); - - TEST_POINT - - p = (MEMHDR *) malloc(RESERVE_SIZE+size); - - if (!p) { - xmlGenericError(xmlGenericErrorContext, - "xmlMallocLoc : Out of free space\n"); - xmlMemoryDump(); - return(NULL); - } - p->mh_tag = MEMTAG; - p->mh_size = size; - p->mh_type = MALLOC_ATOMIC_TYPE; - p->mh_file = file; - p->mh_line = line; - p->mh_number = ++block; - debugMemSize += size; - debugMemBlocks++; - if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; - - - if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); - - ret = HDR_2_CLIENT(p); - - if (xmlMemTraceBlockAt == ret) { - xmlGenericError(xmlGenericErrorContext, - "%p : Malloc(%lu) Ok\n", xmlMemTraceBlockAt, - (long unsigned)size); - xmlMallocBreakpoint(); - } - - TEST_POINT - - return(ret); -} -/** - * xmlMemMalloc: - * @size: an int specifying the size in byte to allocate. - * - * a malloc() equivalent, with logging of the allocation info. - * - * Returns a pointer to the allocated area or NULL in case of lack of memory. - */ - -void * -xmlMemMalloc(size_t size) -{ - return(xmlMallocLoc(size, "none", 0)); -} - -/** - * xmlReallocLoc: - * @ptr: the initial memory block pointer - * @size: an int specifying the size in byte to allocate. - * @file: the file name or NULL - * @line: the line number - * - * a realloc() equivalent, with logging of the allocation info. - * - * Returns a pointer to the allocated area or NULL in case of lack of memory. - */ - -void * -xmlReallocLoc(void *ptr,size_t size, const char * file, int line) -{ - MEMHDR *p; - unsigned long number; - - if (ptr == NULL) - return(xmlMallocLoc(size, file, line)); - - if (!xmlMemInitialized) xmlInitMemory(); - TEST_POINT - - p = CLIENT_2_HDR(ptr); - number = p->mh_number; - if (xmlMemStopAtBlock == number) xmlMallocBreakpoint(); - if (p->mh_tag != MEMTAG) { - Mem_Tag_Err(p); - goto error; - } - p->mh_tag = ~MEMTAG; - debugMemSize -= p->mh_size; - debugMemBlocks--; - - p = (MEMHDR *) realloc(p,RESERVE_SIZE+size); - if (!p) { - goto error; - } - if (xmlMemTraceBlockAt == ptr) { - xmlGenericError(xmlGenericErrorContext, - "%p : Realloced(%lu -> %lu) Ok\n", - xmlMemTraceBlockAt, (long unsigned)p->mh_size, - (long unsigned)size); - xmlMallocBreakpoint(); - } - p->mh_tag = MEMTAG; - p->mh_number = number; - p->mh_type = REALLOC_TYPE; - p->mh_size = size; - p->mh_file = file; - p->mh_line = line; - debugMemSize += size; - debugMemBlocks++; - if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; - - TEST_POINT - - return(HDR_2_CLIENT(p)); - -error: - return(NULL); -} - -/** - * xmlMemRealloc: - * @ptr: the initial memory block pointer - * @size: an int specifying the size in byte to allocate. - * - * a realloc() equivalent, with logging of the allocation info. - * - * Returns a pointer to the allocated area or NULL in case of lack of memory. - */ - -void * -xmlMemRealloc(void *ptr,size_t size) { - return(xmlReallocLoc(ptr, size, "none", 0)); -} - -/** - * xmlMemFree: - * @ptr: the memory block pointer - * - * a free() equivalent, with error checking. - */ -void -xmlMemFree(void *ptr) -{ - MEMHDR *p; - char *target; - - if (ptr == NULL) - return; - - if (ptr == (void *) -1) { - xmlGenericError(xmlGenericErrorContext, - "trying to free pointer from freed area\n"); - goto error; - } - - if (xmlMemTraceBlockAt == ptr) { - xmlGenericError(xmlGenericErrorContext, - "%p : Freed()\n", xmlMemTraceBlockAt); - xmlMallocBreakpoint(); - } - - TEST_POINT - - target = (char *) ptr; - - p = CLIENT_2_HDR(ptr); - if (p->mh_tag != MEMTAG) { - Mem_Tag_Err(p); - goto error; - } - if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); - p->mh_tag = ~MEMTAG; - memset(target, -1, p->mh_size); - debugMemSize -= p->mh_size; - debugMemBlocks--; - - free(p); - - TEST_POINT - - - return; - -error: - xmlGenericError(xmlGenericErrorContext, - "xmlMemFree(%lX) error\n", (unsigned long) ptr); - xmlMallocBreakpoint(); - return; -} - -/** - * xmlMemStrdupLoc: - * @str: the initial string pointer - * @file: the file name or NULL - * @line: the line number - * - * a strdup() equivalent, with logging of the allocation info. - * - * Returns a pointer to the new string or NULL if allocation error occurred. - */ - -char * -xmlMemStrdupLoc(const char *str, const char *file, int line) -{ - char *s; - size_t size = strlen(str) + 1; - MEMHDR *p; - - if (!xmlMemInitialized) xmlInitMemory(); - TEST_POINT - - p = (MEMHDR *) malloc(RESERVE_SIZE+size); - if (!p) { - goto error; - } - p->mh_tag = MEMTAG; - p->mh_size = size; - p->mh_type = STRDUP_TYPE; - p->mh_file = file; - p->mh_line = line; - p->mh_number = ++block; - debugMemSize += size; - debugMemBlocks++; - if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; - - s = (char *) HDR_2_CLIENT(p); - - if (xmlMemStopAtBlock == p->mh_number) xmlMallocBreakpoint(); - - if (s != NULL) - strcpy(s,str); - else - goto error; - - TEST_POINT - - if (xmlMemTraceBlockAt == s) { - xmlGenericError(xmlGenericErrorContext, - "%p : Strdup() Ok\n", xmlMemTraceBlockAt); - xmlMallocBreakpoint(); - } - - return(s); - -error: - return(NULL); -} - -/** - * xmlMemoryStrdup: - * @str: the initial string pointer - * - * a strdup() equivalent, with logging of the allocation info. - * - * Returns a pointer to the new string or NULL if allocation error occurred. - */ - -char * -xmlMemoryStrdup(const char *str) { - return(xmlMemStrdupLoc(str, "none", 0)); -} - -/** - * xmlMemUsed: - * - * Provides the amount of memory currently allocated - * - * Returns an int representing the amount of memory allocated. - */ - -int -xmlMemUsed(void) { - return(debugMemSize); -} - -/** - * xmlMemBlocks: - * - * Provides the number of memory areas currently allocated - * - * Returns an int representing the number of blocks - */ - -int -xmlMemBlocks(void) { - return(debugMemBlocks); -} - -/** - * xmlMemDisplayLast: - * @fp: a FILE descriptor used as the output file, if NULL, the result is - * written to the file .memorylist - * @nbBytes: the amount of memory to dump - * - * the last nbBytes of memory allocated and not freed, useful for dumping - * the memory left allocated between two places at runtime. - */ - -void -xmlMemDisplayLast(FILE *fp, long nbBytes) -{ - FILE *old_fp = fp; - - if (nbBytes <= 0) - return; - - if (fp == NULL) { - fp = fopen(".memorylist", "w"); - if (fp == NULL) - return; - } - - fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n"); - if (old_fp == NULL) - fclose(fp); -} - -/** - * xmlMemDisplay: - * @fp: a FILE descriptor used as the output file, if NULL, the result is - * written to the file .memorylist - * - * show in-extenso the memory blocks allocated - */ - -void -xmlMemDisplay(FILE *fp) -{ - FILE *old_fp = fp; - - if (fp == NULL) { - fp = fopen(".memorylist", "w"); - if (fp == NULL) - return; - } - - fprintf(fp,"Memory list not compiled (MEM_LIST not defined !)\n"); - if (old_fp == NULL) - fclose(fp); -} - -/* - * debugmem_tag_error: - * - * internal error function. - */ - -static void debugmem_tag_error(void *p) -{ - xmlGenericError(xmlGenericErrorContext, - "Memory tag error occurs :%p \n\t bye\n", p); -} - - -/** - * xmlMemShow: - * @fp: a FILE descriptor used as the output file - * @nr: number of entries to dump - * - * show a show display of the memory allocated, and dump - * the @nr last allocated areas which were not freed - */ - -void -xmlMemShow(FILE *fp, int nr ATTRIBUTE_UNUSED) -{ - - if (fp != NULL) - fprintf(fp," MEMORY ALLOCATED : %lu, MAX was %lu\n", - debugMemSize, debugMaxMemSize); -} - -/** - * xmlMemoryDump: - * - * Dump in-extenso the memory blocks allocated to the file .memorylist - */ - -void -xmlMemoryDump(void) -{ -} - - -/**************************************************************** - * * - * Initialization Routines * - * * - ****************************************************************/ - -/** - * xmlInitMemory: - * - * Initialize the memory layer. - * - * Returns 0 on success - */ -int -xmlInitMemory(void) -{ -#ifdef HAVE_STDLIB_H - char *breakpoint; -#endif - /* - This is really not good code (see Bug 130419). Suggestions for - improvement will be welcome! - */ - if (xmlMemInitialized) return(-1); - xmlMemInitialized = 1; - -#ifdef HAVE_STDLIB_H - breakpoint = getenv("XML_MEM_BREAKPOINT"); - if (breakpoint != NULL) { - sscanf(breakpoint, "%ud", &xmlMemStopAtBlock); - } -#endif -#ifdef HAVE_STDLIB_H - breakpoint = getenv("XML_MEM_TRACE"); - if (breakpoint != NULL) { - sscanf(breakpoint, "%p", &xmlMemTraceBlockAt); - } -#endif - - return(0); -} - -/** - * xmlCleanupMemory: - * - * Free up all the memory allocated by the library for its own - * use. This should not be called by user level code. - */ -void -xmlCleanupMemory(void) { - if (xmlMemInitialized == 0) - return; - - xmlMemInitialized = 0; -} - -/** - * xmlMemSetup: - * @freeFunc: the free() function to use - * @mallocFunc: the malloc() function to use - * @reallocFunc: the realloc() function to use - * @strdupFunc: the strdup() function to use - * - * Override the default memory access functions with a new set - * This has to be called before any other libxml routines ! - * - * Should this be blocked if there was already some allocations - * done ? - * - * Returns 0 on success - */ -int -xmlMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, - xmlReallocFunc reallocFunc, xmlStrdupFunc strdupFunc) { - if (freeFunc == NULL) - return(-1); - if (mallocFunc == NULL) - return(-1); - if (reallocFunc == NULL) - return(-1); - if (strdupFunc == NULL) - return(-1); - xmlFree = freeFunc; - xmlMalloc = mallocFunc; - xmlMallocAtomic = mallocFunc; - xmlRealloc = reallocFunc; - xmlMemStrdup = strdupFunc; - return(0); -} - -/** - * xmlMemGet: - * @freeFunc: place to save the free() function in use - * @mallocFunc: place to save the malloc() function in use - * @reallocFunc: place to save the realloc() function in use - * @strdupFunc: place to save the strdup() function in use - * - * Provides the memory access functions set currently in use - * - * Returns 0 on success - */ -int -xmlMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, - xmlReallocFunc *reallocFunc, xmlStrdupFunc *strdupFunc) { - if (freeFunc != NULL) *freeFunc = xmlFree; - if (mallocFunc != NULL) *mallocFunc = xmlMalloc; - if (reallocFunc != NULL) *reallocFunc = xmlRealloc; - if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup; - return(0); -} - -/** - * xmlGcMemSetup: - * @freeFunc: the free() function to use - * @mallocFunc: the malloc() function to use - * @mallocAtomicFunc: the malloc() function to use for atomic allocations - * @reallocFunc: the realloc() function to use - * @strdupFunc: the strdup() function to use - * - * Override the default memory access functions with a new set - * This has to be called before any other libxml routines ! - * The mallocAtomicFunc is specialized for atomic block - * allocations (i.e. of areas useful for garbage collected memory allocators - * - * Should this be blocked if there was already some allocations - * done ? - * - * Returns 0 on success - */ -int -xmlGcMemSetup(xmlFreeFunc freeFunc, xmlMallocFunc mallocFunc, - xmlMallocFunc mallocAtomicFunc, xmlReallocFunc reallocFunc, - xmlStrdupFunc strdupFunc) { - if (freeFunc == NULL) - return(-1); - if (mallocFunc == NULL) - return(-1); - if (mallocAtomicFunc == NULL) - return(-1); - if (reallocFunc == NULL) - return(-1); - if (strdupFunc == NULL) - return(-1); - xmlFree = freeFunc; - xmlMalloc = mallocFunc; - xmlMallocAtomic = mallocAtomicFunc; - xmlRealloc = reallocFunc; - xmlMemStrdup = strdupFunc; - return(0); -} - -/** - * xmlGcMemGet: - * @freeFunc: place to save the free() function in use - * @mallocFunc: place to save the malloc() function in use - * @mallocAtomicFunc: place to save the atomic malloc() function in use - * @reallocFunc: place to save the realloc() function in use - * @strdupFunc: place to save the strdup() function in use - * - * Provides the memory access functions set currently in use - * The mallocAtomicFunc is specialized for atomic block - * allocations (i.e. of areas useful for garbage collected memory allocators - * - * Returns 0 on success - */ -int -xmlGcMemGet(xmlFreeFunc *freeFunc, xmlMallocFunc *mallocFunc, - xmlMallocFunc *mallocAtomicFunc, xmlReallocFunc *reallocFunc, - xmlStrdupFunc *strdupFunc) { - if (freeFunc != NULL) *freeFunc = xmlFree; - if (mallocFunc != NULL) *mallocFunc = xmlMalloc; - if (mallocAtomicFunc != NULL) *mallocAtomicFunc = xmlMallocAtomic; - if (reallocFunc != NULL) *reallocFunc = xmlRealloc; - if (strdupFunc != NULL) *strdupFunc = xmlMemStrdup; - return(0); -} - -#define bottom_xmlmemory -#include "elfgcchack.h" diff --git a/deps/libxml2/xmlreader.c b/deps/libxml2/xmlreader.c deleted file mode 100644 index 1f8f843fc4..0000000000 --- a/deps/libxml2/xmlreader.c +++ /dev/null @@ -1,4440 +0,0 @@ -/* - * xmlreader.c: implements the xmlTextReader streaming node API - * - * NOTE: - * XmlTextReader.Normalization Property won't be supported, since - * it makes the parser non compliant to the XML recommendation - * - * See Copyright for the status of this software. - * - * daniel@veillard.com - */ - -/* - * TODOs: - * - XML Schemas validation - */ -#define IN_LIBXML -#include "libxml.h" - -#ifdef LIBXML_READER_ENABLED -#include /* for memset() only ! */ -#include - -#ifdef HAVE_CTYPE_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif - -#include -#include -#include -#include -#include - -#define MAX_ERR_MSG_SIZE 64000 - -/* - * The following VA_COPY was coded following an example in - * the Samba project. It may not be sufficient for some - * esoteric implementations of va_list (i.e. it may need - * something involving a memcpy) but (hopefully) will be - * sufficient for libxml2. - */ -#ifndef VA_COPY - #ifdef HAVE_VA_COPY - #define VA_COPY(dest, src) va_copy(dest, src) - #else - #ifdef HAVE___VA_COPY - #define VA_COPY(dest,src) __va_copy(dest, src) - #else - #define VA_COPY(dest,src) (dest) = (src) - #endif - #endif -#endif - -/** - * TODO: - * - * macro to flag unimplemented blocks - */ -#define TODO \ - xmlGenericError(xmlGenericErrorContext, \ - "Unimplemented block at %s:%d\n", \ - __FILE__, __LINE__); - -#define CHUNK_SIZE 512 -/************************************************************************ - * * - * The parser: maps the Text Reader API on top of the existing * - * parsing routines building a tree * - * * - ************************************************************************/ - -#define XML_TEXTREADER_INPUT 1 -#define XML_TEXTREADER_CTXT 2 - -typedef enum { - XML_TEXTREADER_NONE = -1, - XML_TEXTREADER_START= 0, - XML_TEXTREADER_ELEMENT= 1, - XML_TEXTREADER_END= 2, - XML_TEXTREADER_EMPTY= 3, - XML_TEXTREADER_BACKTRACK= 4, - XML_TEXTREADER_DONE= 5, - XML_TEXTREADER_ERROR= 6 -} xmlTextReaderState; - -typedef enum { - XML_TEXTREADER_NOT_VALIDATE = 0, - XML_TEXTREADER_VALIDATE_DTD = 1, - XML_TEXTREADER_VALIDATE_RNG = 2, - XML_TEXTREADER_VALIDATE_XSD = 4 -} xmlTextReaderValidate; - -struct _xmlTextReader { - int mode; /* the parsing mode */ - xmlDocPtr doc; /* when walking an existing doc */ - xmlTextReaderValidate validate;/* is there any validation */ - int allocs; /* what structure were deallocated */ - xmlTextReaderState state; - xmlParserCtxtPtr ctxt; /* the parser context */ - xmlSAXHandlerPtr sax; /* the parser SAX callbacks */ - xmlParserInputBufferPtr input; /* the input */ - startElementSAXFunc startElement;/* initial SAX callbacks */ - endElementSAXFunc endElement; /* idem */ - startElementNsSAX2Func startElementNs;/* idem */ - endElementNsSAX2Func endElementNs; /* idem */ - charactersSAXFunc characters; - cdataBlockSAXFunc cdataBlock; - unsigned int base; /* base of the segment in the input */ - unsigned int cur; /* current position in the input */ - xmlNodePtr node; /* current node */ - xmlNodePtr curnode;/* current attribute node */ - int depth; /* depth of the current node */ - xmlNodePtr faketext;/* fake xmlNs chld */ - int preserve;/* preserve the resulting document */ - xmlBufferPtr buffer; /* used to return const xmlChar * */ - xmlDictPtr dict; /* the context dictionnary */ - - /* entity stack when traversing entities content */ - xmlNodePtr ent; /* Current Entity Ref Node */ - int entNr; /* Depth of the entities stack */ - int entMax; /* Max depth of the entities stack */ - xmlNodePtr *entTab; /* array of entities */ - - /* error handling */ - xmlTextReaderErrorFunc errorFunc; /* callback function */ - void *errorFuncArg; /* callback function user argument */ - - int preserves; /* level of preserves */ - int parserFlags; /* the set of options set */ - /* Structured error handling */ - xmlStructuredErrorFunc sErrorFunc; /* callback function */ -}; - -#define NODE_IS_EMPTY 0x1 -#define NODE_IS_PRESERVED 0x2 -#define NODE_IS_SPRESERVED 0x4 - -/** - * CONSTSTR: - * - * Macro used to return an interned string - */ -#define CONSTSTR(str) xmlDictLookup(reader->dict, (str), -1) -#define CONSTQSTR(p, str) xmlDictQLookup(reader->dict, (p), (str)) - -static int xmlTextReaderReadTree(xmlTextReaderPtr reader); -static int xmlTextReaderNextTree(xmlTextReaderPtr reader); - -/************************************************************************ - * * - * Our own version of the freeing routines as we recycle nodes * - * * - ************************************************************************/ -/** - * DICT_FREE: - * @str: a string - * - * Free a string if it is not owned by the "dict" dictionnary in the - * current scope - */ -#define DICT_FREE(str) \ - if ((str) && ((!dict) || \ - (xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \ - xmlFree((char *)(str)); - -static void xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur); -static void xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur); - -/** - * ReaderxmlFreeID: - * @not: A id - * - * Deallocate the memory used by an id definition - */ -static void -ReaderxmlFreeID(xmlIDPtr id) { - xmlDictPtr dict = NULL; - - if (id == NULL) return; - - if (id->doc != NULL) - dict = id->doc->dict; - - if (id->value != NULL) - DICT_FREE(id->value) - xmlFree(id); -} - -/** - * xmlTextReaderRemoveID: - * @doc: the document - * @attr: the attribute - * - * Remove the given attribute from the ID table maintained internally. - * - * Returns -1 if the lookup failed and 0 otherwise - */ -static int -xmlTextReaderRemoveID(xmlDocPtr doc, xmlAttrPtr attr) { - xmlIDTablePtr table; - xmlIDPtr id; - xmlChar *ID; - - if (doc == NULL) return(-1); - if (attr == NULL) return(-1); - table = (xmlIDTablePtr) doc->ids; - if (table == NULL) - return(-1); - - ID = xmlNodeListGetString(doc, attr->children, 1); - if (ID == NULL) - return(-1); - id = xmlHashLookup(table, ID); - xmlFree(ID); - if (id == NULL || id->attr != attr) { - return(-1); - } - id->name = attr->name; - id->attr = NULL; - return(0); -} - -/** - * xmlTextReaderFreeProp: - * @reader: the xmlTextReaderPtr used - * @cur: the node - * - * Free a node. - */ -static void -xmlTextReaderFreeProp(xmlTextReaderPtr reader, xmlAttrPtr cur) { - xmlDictPtr dict; - - dict = reader->ctxt->dict; - if (cur == NULL) return; - - if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) - xmlDeregisterNodeDefaultValue((xmlNodePtr) cur); - - /* Check for ID removal -> leading to invalid references ! */ - if ((cur->parent != NULL) && (cur->parent->doc != NULL) && - ((cur->parent->doc->intSubset != NULL) || - (cur->parent->doc->extSubset != NULL))) { - if (xmlIsID(cur->parent->doc, cur->parent, cur)) - xmlTextReaderRemoveID(cur->parent->doc, cur); - } - if (cur->children != NULL) - xmlTextReaderFreeNodeList(reader, cur->children); - - DICT_FREE(cur->name); - if ((reader != NULL) && (reader->ctxt != NULL) && - (reader->ctxt->freeAttrsNr < 100)) { - cur->next = reader->ctxt->freeAttrs; - reader->ctxt->freeAttrs = cur; - reader->ctxt->freeAttrsNr++; - } else { - xmlFree(cur); - } -} - -/** - * xmlTextReaderFreePropList: - * @reader: the xmlTextReaderPtr used - * @cur: the first property in the list - * - * Free a property and all its siblings, all the children are freed too. - */ -static void -xmlTextReaderFreePropList(xmlTextReaderPtr reader, xmlAttrPtr cur) { - xmlAttrPtr next; - if (cur == NULL) return; - while (cur != NULL) { - next = cur->next; - xmlTextReaderFreeProp(reader, cur); - cur = next; - } -} - -/** - * xmlTextReaderFreeNodeList: - * @reader: the xmlTextReaderPtr used - * @cur: the first node in the list - * - * Free a node and all its siblings, this is a recursive behaviour, all - * the children are freed too. - */ -static void -xmlTextReaderFreeNodeList(xmlTextReaderPtr reader, xmlNodePtr cur) { - xmlNodePtr next; - xmlDictPtr dict; - - dict = reader->ctxt->dict; - if (cur == NULL) return; - if (cur->type == XML_NAMESPACE_DECL) { - xmlFreeNsList((xmlNsPtr) cur); - return; - } - if ((cur->type == XML_DOCUMENT_NODE) || - (cur->type == XML_HTML_DOCUMENT_NODE)) { - xmlFreeDoc((xmlDocPtr) cur); - return; - } - while (cur != NULL) { - next = cur->next; - /* unroll to speed up freeing the document */ - if (cur->type != XML_DTD_NODE) { - - if ((cur->children != NULL) && - (cur->type != XML_ENTITY_REF_NODE)) { - if (cur->children->parent == cur) - xmlTextReaderFreeNodeList(reader, cur->children); - cur->children = NULL; - } - - if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) - xmlDeregisterNodeDefaultValue(cur); - - if (((cur->type == XML_ELEMENT_NODE) || - (cur->type == XML_XINCLUDE_START) || - (cur->type == XML_XINCLUDE_END)) && - (cur->properties != NULL)) - xmlTextReaderFreePropList(reader, cur->properties); - if ((cur->content != (xmlChar *) &(cur->properties)) && - (cur->type != XML_ELEMENT_NODE) && - (cur->type != XML_XINCLUDE_START) && - (cur->type != XML_XINCLUDE_END) && - (cur->type != XML_ENTITY_REF_NODE)) { - DICT_FREE(cur->content); - } - if (((cur->type == XML_ELEMENT_NODE) || - (cur->type == XML_XINCLUDE_START) || - (cur->type == XML_XINCLUDE_END)) && - (cur->nsDef != NULL)) - xmlFreeNsList(cur->nsDef); - - /* - * we don't free element names here they are interned now - */ - if ((cur->type != XML_TEXT_NODE) && - (cur->type != XML_COMMENT_NODE)) - DICT_FREE(cur->name); - if (((cur->type == XML_ELEMENT_NODE) || - (cur->type == XML_TEXT_NODE)) && - (reader != NULL) && (reader->ctxt != NULL) && - (reader->ctxt->freeElemsNr < 100)) { - cur->next = reader->ctxt->freeElems; - reader->ctxt->freeElems = cur; - reader->ctxt->freeElemsNr++; - } else { - xmlFree(cur); - } - } - cur = next; - } -} - -/** - * xmlTextReaderFreeNode: - * @reader: the xmlTextReaderPtr used - * @cur: the node - * - * Free a node, this is a recursive behaviour, all the children are freed too. - * This doesn't unlink the child from the list, use xmlUnlinkNode() first. - */ -static void -xmlTextReaderFreeNode(xmlTextReaderPtr reader, xmlNodePtr cur) { - xmlDictPtr dict; - - dict = reader->ctxt->dict; - if (cur->type == XML_DTD_NODE) { - xmlFreeDtd((xmlDtdPtr) cur); - return; - } - if (cur->type == XML_NAMESPACE_DECL) { - xmlFreeNs((xmlNsPtr) cur); - return; - } - if (cur->type == XML_ATTRIBUTE_NODE) { - xmlTextReaderFreeProp(reader, (xmlAttrPtr) cur); - return; - } - - if ((cur->children != NULL) && - (cur->type != XML_ENTITY_REF_NODE)) { - if (cur->children->parent == cur) - xmlTextReaderFreeNodeList(reader, cur->children); - cur->children = NULL; - } - - if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) - xmlDeregisterNodeDefaultValue(cur); - - if (((cur->type == XML_ELEMENT_NODE) || - (cur->type == XML_XINCLUDE_START) || - (cur->type == XML_XINCLUDE_END)) && - (cur->properties != NULL)) - xmlTextReaderFreePropList(reader, cur->properties); - if ((cur->content != (xmlChar *) &(cur->properties)) && - (cur->type != XML_ELEMENT_NODE) && - (cur->type != XML_XINCLUDE_START) && - (cur->type != XML_XINCLUDE_END) && - (cur->type != XML_ENTITY_REF_NODE)) { - DICT_FREE(cur->content); - } - if (((cur->type == XML_ELEMENT_NODE) || - (cur->type == XML_XINCLUDE_START) || - (cur->type == XML_XINCLUDE_END)) && - (cur->nsDef != NULL)) - xmlFreeNsList(cur->nsDef); - - /* - * we don't free names here they are interned now - */ - if ((cur->type != XML_TEXT_NODE) && - (cur->type != XML_COMMENT_NODE)) - DICT_FREE(cur->name); - - if (((cur->type == XML_ELEMENT_NODE) || - (cur->type == XML_TEXT_NODE)) && - (reader != NULL) && (reader->ctxt != NULL) && - (reader->ctxt->freeElemsNr < 100)) { - cur->next = reader->ctxt->freeElems; - reader->ctxt->freeElems = cur; - reader->ctxt->freeElemsNr++; - } else { - xmlFree(cur); - } -} - -/** - * xmlTextReaderFreeIDTable: - * @table: An id table - * - * Deallocate the memory used by an ID hash table. - */ -static void -xmlTextReaderFreeIDTable(xmlIDTablePtr table) { - xmlHashFree(table, (xmlHashDeallocator) ReaderxmlFreeID); -} - -/** - * xmlTextReaderFreeDoc: - * @reader: the xmlTextReaderPtr used - * @cur: pointer to the document - * - * Free up all the structures used by a document, tree included. - */ -static void -xmlTextReaderFreeDoc(xmlTextReaderPtr reader, xmlDocPtr cur) { - xmlDtdPtr extSubset, intSubset; - - if (cur == NULL) return; - - if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) - xmlDeregisterNodeDefaultValue((xmlNodePtr) cur); - - /* - * Do this before freeing the children list to avoid ID lookups - */ - if (cur->ids != NULL) xmlTextReaderFreeIDTable((xmlIDTablePtr) cur->ids); - cur->ids = NULL; - if (cur->refs != NULL) xmlFreeRefTable((xmlRefTablePtr) cur->refs); - cur->refs = NULL; - extSubset = cur->extSubset; - intSubset = cur->intSubset; - if (intSubset == extSubset) - extSubset = NULL; - if (extSubset != NULL) { - xmlUnlinkNode((xmlNodePtr) cur->extSubset); - cur->extSubset = NULL; - xmlFreeDtd(extSubset); - } - if (intSubset != NULL) { - xmlUnlinkNode((xmlNodePtr) cur->intSubset); - cur->intSubset = NULL; - xmlFreeDtd(intSubset); - } - - if (cur->children != NULL) xmlTextReaderFreeNodeList(reader, cur->children); - - if (cur->version != NULL) xmlFree((char *) cur->version); - if (cur->name != NULL) xmlFree((char *) cur->name); - if (cur->encoding != NULL) xmlFree((char *) cur->encoding); - if (cur->oldNs != NULL) xmlFreeNsList(cur->oldNs); - if (cur->URL != NULL) xmlFree((char *) cur->URL); - if (cur->dict != NULL) xmlDictFree(cur->dict); - - xmlFree(cur); -} - -/************************************************************************ - * * - * The reader core parser * - * * - ************************************************************************/ - -/** - * xmlTextReaderEntPush: - * @reader: the xmlTextReaderPtr used - * @value: the entity reference node - * - * Pushes a new entity reference node on top of the entities stack - * - * Returns 0 in case of error, the index in the stack otherwise - */ -static int -xmlTextReaderEntPush(xmlTextReaderPtr reader, xmlNodePtr value) -{ - if (reader->entMax <= 0) { - reader->entMax = 10; - reader->entTab = (xmlNodePtr *) xmlMalloc(reader->entMax * - sizeof(reader->entTab[0])); - if (reader->entTab == NULL) { - xmlGenericError(xmlGenericErrorContext, "xmlMalloc failed !\n"); - return (0); - } - } - if (reader->entNr >= reader->entMax) { - reader->entMax *= 2; - reader->entTab = - (xmlNodePtr *) xmlRealloc(reader->entTab, - reader->entMax * - sizeof(reader->entTab[0])); - if (reader->entTab == NULL) { - xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n"); - return (0); - } - } - reader->entTab[reader->entNr] = value; - reader->ent = value; - return (reader->entNr++); -} - -/** - * xmlTextReaderEntPop: - * @reader: the xmlTextReaderPtr used - * - * Pops the top element entity from the entities stack - * - * Returns the entity just removed - */ -static xmlNodePtr -xmlTextReaderEntPop(xmlTextReaderPtr reader) -{ - xmlNodePtr ret; - - if (reader->entNr <= 0) - return (NULL); - reader->entNr--; - if (reader->entNr > 0) - reader->ent = reader->entTab[reader->entNr - 1]; - else - reader->ent = NULL; - ret = reader->entTab[reader->entNr]; - reader->entTab[reader->entNr] = NULL; - return (ret); -} - -/** - * xmlTextReaderStartElement: - * @ctx: the user data (XML parser context) - * @fullname: The element name, including namespace prefix - * @atts: An array of name/value attributes pairs, NULL terminated - * - * called when an opening tag has been processed. - */ -static void -xmlTextReaderStartElement(void *ctx, const xmlChar *fullname, - const xmlChar **atts) { - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlTextReaderPtr reader = ctxt->_private; - - if ((reader != NULL) && (reader->startElement != NULL)) { - reader->startElement(ctx, fullname, atts); - if ((ctxt->node != NULL) && (ctxt->input != NULL) && - (ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') && - (ctxt->input->cur[1] == '>')) - ctxt->node->extra = NODE_IS_EMPTY; - } - if (reader != NULL) - reader->state = XML_TEXTREADER_ELEMENT; -} - -/** - * xmlTextReaderEndElement: - * @ctx: the user data (XML parser context) - * @fullname: The element name, including namespace prefix - * - * called when an ending tag has been processed. - */ -static void -xmlTextReaderEndElement(void *ctx, const xmlChar *fullname) { - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlTextReaderPtr reader = ctxt->_private; - - if ((reader != NULL) && (reader->endElement != NULL)) { - reader->endElement(ctx, fullname); - } -} - -/** - * xmlTextReaderStartElementNs: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * @nb_namespaces: number of namespace definitions on that node - * @namespaces: pointer to the array of prefix/URI pairs namespace definitions - * @nb_attributes: the number of attributes on that node - * nb_defaulted: the number of defaulted attributes. - * @attributes: pointer to the array of (localname/prefix/URI/value/end) - * attribute values. - * - * called when an opening tag has been processed. - */ -static void -xmlTextReaderStartElementNs(void *ctx, - const xmlChar *localname, - const xmlChar *prefix, - const xmlChar *URI, - int nb_namespaces, - const xmlChar **namespaces, - int nb_attributes, - int nb_defaulted, - const xmlChar **attributes) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlTextReaderPtr reader = ctxt->_private; - - if ((reader != NULL) && (reader->startElementNs != NULL)) { - reader->startElementNs(ctx, localname, prefix, URI, nb_namespaces, - namespaces, nb_attributes, nb_defaulted, - attributes); - if ((ctxt->node != NULL) && (ctxt->input != NULL) && - (ctxt->input->cur != NULL) && (ctxt->input->cur[0] == '/') && - (ctxt->input->cur[1] == '>')) - ctxt->node->extra = NODE_IS_EMPTY; - } - if (reader != NULL) - reader->state = XML_TEXTREADER_ELEMENT; -} - -/** - * xmlTextReaderEndElementNs: - * @ctx: the user data (XML parser context) - * @localname: the local name of the element - * @prefix: the element namespace prefix if available - * @URI: the element namespace name if available - * - * called when an ending tag has been processed. - */ -static void -xmlTextReaderEndElementNs(void *ctx, - const xmlChar * localname, - const xmlChar * prefix, - const xmlChar * URI) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlTextReaderPtr reader = ctxt->_private; - - if ((reader != NULL) && (reader->endElementNs != NULL)) { - reader->endElementNs(ctx, localname, prefix, URI); - } -} - - -/** - * xmlTextReaderCharacters: - * @ctx: the user data (XML parser context) - * @ch: a xmlChar string - * @len: the number of xmlChar - * - * receiving some chars from the parser. - */ -static void -xmlTextReaderCharacters(void *ctx, const xmlChar *ch, int len) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlTextReaderPtr reader = ctxt->_private; - - if ((reader != NULL) && (reader->characters != NULL)) { - reader->characters(ctx, ch, len); - } -} - -/** - * xmlTextReaderCDataBlock: - * @ctx: the user data (XML parser context) - * @value: The pcdata content - * @len: the block length - * - * called when a pcdata block has been parsed - */ -static void -xmlTextReaderCDataBlock(void *ctx, const xmlChar *ch, int len) -{ - xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; - xmlTextReaderPtr reader = ctxt->_private; - - if ((reader != NULL) && (reader->cdataBlock != NULL)) { - reader->cdataBlock(ctx, ch, len); - } -} - -/** - * xmlTextReaderPushData: - * @reader: the xmlTextReaderPtr used - * - * Push data down the progressive parser until a significant callback - * got raised. - * - * Returns -1 in case of failure, 0 otherwise - */ -static int -xmlTextReaderPushData(xmlTextReaderPtr reader) { - xmlBufferPtr inbuf; - int val, s; - xmlTextReaderState oldstate; - - if ((reader->input == NULL) || (reader->input->buffer == NULL)) - return(-1); - - oldstate = reader->state; - reader->state = XML_TEXTREADER_NONE; - inbuf = reader->input->buffer; - - while (reader->state == XML_TEXTREADER_NONE) { - if (inbuf->use < reader->cur + CHUNK_SIZE) { - /* - * Refill the buffer unless we are at the end of the stream - */ - if (reader->mode != XML_TEXTREADER_MODE_EOF) { - val = xmlParserInputBufferRead(reader->input, 4096); - if ((val == 0) && - (inbuf->alloc == XML_BUFFER_ALLOC_IMMUTABLE)) { - if (inbuf->use == reader->cur) { - reader->mode = XML_TEXTREADER_MODE_EOF; - reader->state = oldstate; - } - } else if (val < 0) { - reader->mode = XML_TEXTREADER_MODE_EOF; - reader->state = oldstate; - if ((oldstate != XML_TEXTREADER_START) || - (reader->ctxt->myDoc != NULL)) - return(val); - } else if (val == 0) { - /* mark the end of the stream and process the remains */ - reader->mode = XML_TEXTREADER_MODE_EOF; - break; - } - - } else - break; - } - /* - * parse by block of CHUNK_SIZE bytes, various tests show that - * it's the best tradeoff at least on a 1.2GH Duron - */ - if (inbuf->use >= reader->cur + CHUNK_SIZE) { - val = xmlParseChunk(reader->ctxt, - (const char *) &inbuf->content[reader->cur], - CHUNK_SIZE, 0); - reader->cur += CHUNK_SIZE; - if ((val != 0) || (reader->ctxt->wellFormed == 0)) - return(-1); - } else { - s = inbuf->use - reader->cur; - val = xmlParseChunk(reader->ctxt, - (const char *) &inbuf->content[reader->cur], - s, 0); - reader->cur += s; - if ((val != 0) || (reader->ctxt->wellFormed == 0)) - return(-1); - break; - } - } - - /* - * Discard the consumed input when needed and possible - */ - if (reader->mode == XML_TEXTREADER_MODE_INTERACTIVE) { - if (inbuf->alloc != XML_BUFFER_ALLOC_IMMUTABLE) { - if ((reader->cur >= 4096) && - (inbuf->use - reader->cur <= CHUNK_SIZE)) { - val = xmlBufferShrink(inbuf, reader->cur); - if (val >= 0) { - reader->cur -= val; - } - } - } - } - - /* - * At the end of the stream signal that the work is done to the Push - * parser. - */ - else if (reader->mode == XML_TEXTREADER_MODE_EOF) { - if (reader->state != XML_TEXTREADER_DONE) { - s = inbuf->use - reader->cur; - val = xmlParseChunk(reader->ctxt, - (const char *) &inbuf->content[reader->cur], - s, 1); - reader->cur = inbuf->use; - reader->state = XML_TEXTREADER_DONE; - if ((val != 0) || (reader->ctxt->wellFormed == 0)) - return(-1); - } - } - reader->state = oldstate; - return(0); -} - -/** - * xmlTextReaderGetSuccessor: - * @cur: the current node - * - * Get the successor of a node if available. - * - * Returns the successor node or NULL - */ -static xmlNodePtr -xmlTextReaderGetSuccessor(xmlNodePtr cur) { - if (cur == NULL) return(NULL) ; /* ERROR */ - if (cur->next != NULL) return(cur->next) ; - do { - cur = cur->parent; - if (cur == NULL) break; - if (cur->next != NULL) return(cur->next); - } while (cur != NULL); - return(cur); -} - -/** - * xmlTextReaderDoExpand: - * @reader: the xmlTextReaderPtr used - * - * Makes sure that the current node is fully read as well as all its - * descendant. It means the full DOM subtree must be available at the - * end of the call. - * - * Returns 1 if the node was expanded successfully, 0 if there is no more - * nodes to read, or -1 in case of error - */ -static int -xmlTextReaderDoExpand(xmlTextReaderPtr reader) { - int val; - - if ((reader == NULL) || (reader->node == NULL) || (reader->ctxt == NULL)) - return(-1); - do { - if (reader->ctxt->instate == XML_PARSER_EOF) return(1); - - if (xmlTextReaderGetSuccessor(reader->node) != NULL) - return(1); - if (reader->ctxt->nodeNr < reader->depth) - return(1); - if (reader->mode == XML_TEXTREADER_MODE_EOF) - return(1); - val = xmlTextReaderPushData(reader); - if (val < 0){ - reader->mode = XML_TEXTREADER_MODE_ERROR; - return(-1); - } - } while(reader->mode != XML_TEXTREADER_MODE_EOF); - return(1); -} - -/** - * xmlTextReaderCollectSiblings: - * @node: the first child - * - * Traverse depth-first through all sibling nodes and their children - * nodes and concatenate their content. This is an auxiliary function - * to xmlTextReaderReadString. - * - * Returns a string containing the content, or NULL in case of error. - */ -static xmlChar * -xmlTextReaderCollectSiblings(xmlNodePtr node) -{ - xmlBufferPtr buffer; - xmlChar *ret; - - buffer = xmlBufferCreate(); - if (buffer == NULL) - return NULL; - - for ( ; node != NULL; node = node->next) { - switch (node->type) { - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - xmlBufferCat(buffer, node->content); - break; - case XML_ELEMENT_NODE: { - xmlChar *tmp; - - tmp = xmlTextReaderCollectSiblings(node->children); - xmlBufferCat(buffer, tmp); - xmlFree(tmp); - break; - } - default: - break; - } - } - ret = buffer->content; - buffer->content = NULL; - xmlBufferFree(buffer); - return(ret); -} - -/** - * xmlTextReaderRead: - * @reader: the xmlTextReaderPtr used - * - * Moves the position of the current instance to the next node in - * the stream, exposing its properties. - * - * Returns 1 if the node was read successfully, 0 if there is no more - * nodes to read, or -1 in case of error - */ -int -xmlTextReaderRead(xmlTextReaderPtr reader) { - int val, olddepth = 0; - xmlTextReaderState oldstate = XML_TEXTREADER_START; - xmlNodePtr oldnode = NULL; - - - if (reader == NULL) - return(-1); - reader->curnode = NULL; - if (reader->doc != NULL) - return(xmlTextReaderReadTree(reader)); - if (reader->ctxt == NULL) - return(-1); - if (reader->ctxt->wellFormed != 1) - return(-1); - - if (reader->mode == XML_TEXTREADER_MODE_INITIAL) { - reader->mode = XML_TEXTREADER_MODE_INTERACTIVE; - /* - * Initial state - */ - do { - val = xmlTextReaderPushData(reader); - if (val < 0){ - reader->mode = XML_TEXTREADER_MODE_ERROR; - reader->state = XML_TEXTREADER_ERROR; - return(-1); - } - } while ((reader->ctxt->node == NULL) && - ((reader->mode != XML_TEXTREADER_MODE_EOF) && - (reader->state != XML_TEXTREADER_DONE))); - if (reader->ctxt->node == NULL) { - if (reader->ctxt->myDoc != NULL) { - reader->node = reader->ctxt->myDoc->children; - } - if (reader->node == NULL){ - reader->mode = XML_TEXTREADER_MODE_ERROR; - reader->state = XML_TEXTREADER_ERROR; - return(-1); - } - reader->state = XML_TEXTREADER_ELEMENT; - } else { - if (reader->ctxt->myDoc != NULL) { - reader->node = reader->ctxt->myDoc->children; - } - if (reader->node == NULL) - reader->node = reader->ctxt->nodeTab[0]; - reader->state = XML_TEXTREADER_ELEMENT; - } - reader->depth = 0; - reader->ctxt->parseMode = XML_PARSE_READER; - goto node_found; - } - oldstate = reader->state; - olddepth = reader->ctxt->nodeNr; - oldnode = reader->node; - -get_next_node: - if (reader->node == NULL) { - if (reader->mode == XML_TEXTREADER_MODE_EOF) - return(0); - else - return(-1); - } - - /* - * If we are not backtracking on ancestors or examined nodes, - * that the parser didn't finished or that we arent at the end - * of stream, continue processing. - */ - while ((reader->node != NULL) && (reader->node->next == NULL) && - (reader->ctxt->nodeNr == olddepth) && - ((oldstate == XML_TEXTREADER_BACKTRACK) || - (reader->node->children == NULL) || - (reader->node->type == XML_ENTITY_REF_NODE) || - ((reader->node->children != NULL) && - (reader->node->children->type == XML_TEXT_NODE) && - (reader->node->children->next == NULL)) || - (reader->node->type == XML_DTD_NODE) || - (reader->node->type == XML_DOCUMENT_NODE) || - (reader->node->type == XML_HTML_DOCUMENT_NODE)) && - ((reader->ctxt->node == NULL) || - (reader->ctxt->node == reader->node) || - (reader->ctxt->node == reader->node->parent)) && - (reader->ctxt->instate != XML_PARSER_EOF)) { - val = xmlTextReaderPushData(reader); - if (val < 0){ - reader->mode = XML_TEXTREADER_MODE_ERROR; - reader->state = XML_TEXTREADER_ERROR; - return(-1); - } - if (reader->node == NULL) - goto node_end; - } - if (oldstate != XML_TEXTREADER_BACKTRACK) { - if ((reader->node->children != NULL) && - (reader->node->type != XML_ENTITY_REF_NODE) && - (reader->node->type != XML_XINCLUDE_START) && - (reader->node->type != XML_DTD_NODE)) { - reader->node = reader->node->children; - reader->depth++; - reader->state = XML_TEXTREADER_ELEMENT; - goto node_found; - } - } - if (reader->node->next != NULL) { - if ((oldstate == XML_TEXTREADER_ELEMENT) && - (reader->node->type == XML_ELEMENT_NODE) && - (reader->node->children == NULL) && - ((reader->node->extra & NODE_IS_EMPTY) == 0) - ) { - reader->state = XML_TEXTREADER_END; - goto node_found; - } - if ((reader->preserves > 0) && - (reader->node->extra & NODE_IS_SPRESERVED)) - reader->preserves--; - reader->node = reader->node->next; - reader->state = XML_TEXTREADER_ELEMENT; - - /* - * Cleanup of the old node - */ - if ((reader->preserves == 0) && - (reader->entNr == 0) && - (reader->node->prev != NULL) && - (reader->node->prev->type != XML_DTD_NODE) && - (reader->entNr == 0)) { - xmlNodePtr tmp = reader->node->prev; - if ((tmp->extra & NODE_IS_PRESERVED) == 0) { - xmlUnlinkNode(tmp); - xmlTextReaderFreeNode(reader, tmp); - } - } - - goto node_found; - } - if ((oldstate == XML_TEXTREADER_ELEMENT) && - (reader->node->type == XML_ELEMENT_NODE) && - (reader->node->children == NULL) && - ((reader->node->extra & NODE_IS_EMPTY) == 0)) {; - reader->state = XML_TEXTREADER_END; - goto node_found; - } - if ((reader->preserves > 0) && - (reader->node->extra & NODE_IS_SPRESERVED)) - reader->preserves--; - reader->node = reader->node->parent; - if ((reader->node == NULL) || - (reader->node->type == XML_DOCUMENT_NODE) || - (reader->node->type == XML_HTML_DOCUMENT_NODE)) { - if (reader->mode != XML_TEXTREADER_MODE_EOF) { - val = xmlParseChunk(reader->ctxt, "", 0, 1); - reader->state = XML_TEXTREADER_DONE; - if (val != 0) - return(-1); - } - reader->node = NULL; - reader->depth = -1; - - /* - * Cleanup of the old node - */ - if ((oldnode != NULL) && (reader->preserves == 0) && - (reader->entNr == 0) && - (oldnode->type != XML_DTD_NODE) && - ((oldnode->extra & NODE_IS_PRESERVED) == 0) && - (reader->entNr == 0)) { - xmlUnlinkNode(oldnode); - xmlTextReaderFreeNode(reader, oldnode); - } - - goto node_end; - } - if ((reader->preserves == 0) && - (reader->entNr == 0) && - (reader->node->last != NULL) && - ((reader->node->last->extra & NODE_IS_PRESERVED) == 0)) { - xmlNodePtr tmp = reader->node->last; - xmlUnlinkNode(tmp); - xmlTextReaderFreeNode(reader, tmp); - } - reader->depth--; - reader->state = XML_TEXTREADER_BACKTRACK; - -node_found: - /* - * If we are in the middle of a piece of CDATA make sure it's finished - */ - if ((reader->node != NULL) && - (reader->node->next == NULL) && - ((reader->node->type == XML_TEXT_NODE) || - (reader->node->type == XML_CDATA_SECTION_NODE))) { - if (xmlTextReaderExpand(reader) == NULL) - return -1; - } - - /* - * Handle entities enter and exit when in entity replacement mode - */ - if ((reader->node != NULL) && - (reader->node->type == XML_ENTITY_REF_NODE) && - (reader->ctxt != NULL) && (reader->ctxt->replaceEntities == 1)) { - /* - * Case where the underlying tree is not availble, lookup the entity - * and walk it. - */ - if ((reader->node->children == NULL) && (reader->ctxt->sax != NULL) && - (reader->ctxt->sax->getEntity != NULL)) { - reader->node->children = (xmlNodePtr) - reader->ctxt->sax->getEntity(reader->ctxt, reader->node->name); - } - - if ((reader->node->children != NULL) && - (reader->node->children->type == XML_ENTITY_DECL) && - (reader->node->children->children != NULL)) { - xmlTextReaderEntPush(reader, reader->node); - reader->node = reader->node->children->children; - } - } - if ((reader->node != NULL) && - (reader->node->type == XML_ENTITY_DECL) && - (reader->ent != NULL) && (reader->ent->children == reader->node)) { - reader->node = xmlTextReaderEntPop(reader); - reader->depth++; - goto get_next_node; - } - return(1); -node_end: - reader->state = XML_TEXTREADER_DONE; - return(0); -} - -/** - * xmlTextReaderReadState: - * @reader: the xmlTextReaderPtr used - * - * Gets the read state of the reader. - * - * Returns the state value, or -1 in case of error - */ -int -xmlTextReaderReadState(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - return(reader->mode); -} - -/** - * xmlTextReaderExpand: - * @reader: the xmlTextReaderPtr used - * - * Reads the contents of the current node and the full subtree. It then makes - * the subtree available until the next xmlTextReaderRead() call - * - * Returns a node pointer valid until the next xmlTextReaderRead() call - * or NULL in case of error. - */ -xmlNodePtr -xmlTextReaderExpand(xmlTextReaderPtr reader) { - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->doc != NULL) - return(reader->node); - if (reader->ctxt == NULL) - return(NULL); - if (xmlTextReaderDoExpand(reader) < 0) - return(NULL); - return(reader->node); -} - -/** - * xmlTextReaderNext: - * @reader: the xmlTextReaderPtr used - * - * Skip to the node following the current one in document order while - * avoiding the subtree if any. - * - * Returns 1 if the node was read successfully, 0 if there is no more - * nodes to read, or -1 in case of error - */ -int -xmlTextReaderNext(xmlTextReaderPtr reader) { - int ret; - xmlNodePtr cur; - - if (reader == NULL) - return(-1); - if (reader->doc != NULL) - return(xmlTextReaderNextTree(reader)); - cur = reader->node; - if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE)) - return(xmlTextReaderRead(reader)); - if (reader->state == XML_TEXTREADER_END || reader->state == XML_TEXTREADER_BACKTRACK) - return(xmlTextReaderRead(reader)); - if (cur->extra & NODE_IS_EMPTY) - return(xmlTextReaderRead(reader)); - do { - ret = xmlTextReaderRead(reader); - if (ret != 1) - return(ret); - } while (reader->node != cur); - return(xmlTextReaderRead(reader)); -} - -/** - * xmlTextReaderReadString: - * @reader: the xmlTextReaderPtr used - * - * Reads the contents of an element or a text node as a string. - * - * Returns a string containing the contents of the Element or Text node, - * or NULL if the reader is positioned on any other type of node. - * The string must be deallocated by the caller. - */ -xmlChar * -xmlTextReaderReadString(xmlTextReaderPtr reader) -{ - xmlNodePtr node; - - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - - node = (reader->curnode != NULL) ? reader->curnode : reader->node; - switch (node->type) { - case XML_TEXT_NODE: - if (node->content != NULL) - return(xmlStrdup(node->content)); - break; - case XML_ELEMENT_NODE: - if (xmlTextReaderDoExpand(reader) != -1) { - return xmlTextReaderCollectSiblings(node->children); - } - case XML_ATTRIBUTE_NODE: - TODO - break; - default: - break; - } - return(NULL); -} - -/************************************************************************ - * * - * Operating on a preparsed tree * - * * - ************************************************************************/ -static int -xmlTextReaderNextTree(xmlTextReaderPtr reader) -{ - if (reader == NULL) - return(-1); - - if (reader->state == XML_TEXTREADER_END) - return(0); - - if (reader->node == NULL) { - if (reader->doc->children == NULL) { - reader->state = XML_TEXTREADER_END; - return(0); - } - - reader->node = reader->doc->children; - reader->state = XML_TEXTREADER_START; - return(1); - } - - if (reader->state != XML_TEXTREADER_BACKTRACK) { - /* Here removed traversal to child, because we want to skip the subtree, - replace with traversal to sibling to skip subtree */ - if (reader->node->next != 0) { - /* Move to sibling if present,skipping sub-tree */ - reader->node = reader->node->next; - reader->state = XML_TEXTREADER_START; - return(1); - } - - /* if reader->node->next is NULL mean no subtree for current node, - so need to move to sibling of parent node if present */ - if ((reader->node->type == XML_ELEMENT_NODE) || - (reader->node->type == XML_ATTRIBUTE_NODE)) { - reader->state = XML_TEXTREADER_BACKTRACK; - /* This will move to parent if present */ - xmlTextReaderRead(reader); - } - } - - if (reader->node->next != 0) { - reader->node = reader->node->next; - reader->state = XML_TEXTREADER_START; - return(1); - } - - if (reader->node->parent != 0) { - if (reader->node->parent->type == XML_DOCUMENT_NODE) { - reader->state = XML_TEXTREADER_END; - return(0); - } - - reader->node = reader->node->parent; - reader->depth--; - reader->state = XML_TEXTREADER_BACKTRACK; - /* Repeat process to move to sibling of parent node if present */ - xmlTextReaderNextTree(reader); - } - - reader->state = XML_TEXTREADER_END; - - return(1); -} - -/** - * xmlTextReaderReadTree: - * @reader: the xmlTextReaderPtr used - * - * Moves the position of the current instance to the next node in - * the stream, exposing its properties. - * - * Returns 1 if the node was read successfully, 0 if there is no more - * nodes to read, or -1 in case of error - */ -static int -xmlTextReaderReadTree(xmlTextReaderPtr reader) { - if (reader->state == XML_TEXTREADER_END) - return(0); - -next_node: - if (reader->node == NULL) { - if (reader->doc->children == NULL) { - reader->state = XML_TEXTREADER_END; - return(0); - } - - reader->node = reader->doc->children; - reader->state = XML_TEXTREADER_START; - goto found_node; - } - - if ((reader->state != XML_TEXTREADER_BACKTRACK) && - (reader->node->type != XML_DTD_NODE) && - (reader->node->type != XML_XINCLUDE_START) && - (reader->node->type != XML_ENTITY_REF_NODE)) { - if (reader->node->children != NULL) { - reader->node = reader->node->children; - reader->depth++; - reader->state = XML_TEXTREADER_START; - goto found_node; - } - - if (reader->node->type == XML_ATTRIBUTE_NODE) { - reader->state = XML_TEXTREADER_BACKTRACK; - goto found_node; - } - } - - if (reader->node->next != NULL) { - reader->node = reader->node->next; - reader->state = XML_TEXTREADER_START; - goto found_node; - } - - if (reader->node->parent != NULL) { - if ((reader->node->parent->type == XML_DOCUMENT_NODE) || - (reader->node->parent->type == XML_HTML_DOCUMENT_NODE)) { - reader->state = XML_TEXTREADER_END; - return(0); - } - - reader->node = reader->node->parent; - reader->depth--; - reader->state = XML_TEXTREADER_BACKTRACK; - goto found_node; - } - - reader->state = XML_TEXTREADER_END; - -found_node: - if ((reader->node->type == XML_XINCLUDE_START) || - (reader->node->type == XML_XINCLUDE_END)) - goto next_node; - - return(1); -} - -/** - * xmlTextReaderNextSibling: - * @reader: the xmlTextReaderPtr used - * - * Skip to the node following the current one in document order while - * avoiding the subtree if any. - * Currently implemented only for Readers built on a document - * - * Returns 1 if the node was read successfully, 0 if there is no more - * nodes to read, or -1 in case of error - */ -int -xmlTextReaderNextSibling(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - if (reader->doc == NULL) { - /* TODO */ - return(-1); - } - - if (reader->state == XML_TEXTREADER_END) - return(0); - - if (reader->node == NULL) - return(xmlTextReaderNextTree(reader)); - - if (reader->node->next != NULL) { - reader->node = reader->node->next; - reader->state = XML_TEXTREADER_START; - return(1); - } - - return(0); -} - -/************************************************************************ - * * - * Constructor and destructors * - * * - ************************************************************************/ -/** - * xmlNewTextReader: - * @input: the xmlParserInputBufferPtr used to read data - * @URI: the URI information for the source if available - * - * Create an xmlTextReader structure fed with @input - * - * Returns the new xmlTextReaderPtr or NULL in case of error - */ -xmlTextReaderPtr -xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) { - xmlTextReaderPtr ret; - - if (input == NULL) - return(NULL); - ret = xmlMalloc(sizeof(xmlTextReader)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlNewTextReader : malloc failed\n"); - return(NULL); - } - memset(ret, 0, sizeof(xmlTextReader)); - ret->doc = NULL; - ret->entTab = NULL; - ret->entMax = 0; - ret->entNr = 0; - ret->input = input; - ret->buffer = xmlBufferCreateSize(100); - if (ret->buffer == NULL) { - xmlFree(ret); - xmlGenericError(xmlGenericErrorContext, - "xmlNewTextReader : malloc failed\n"); - return(NULL); - } - ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); - if (ret->sax == NULL) { - xmlBufferFree(ret->buffer); - xmlFree(ret); - xmlGenericError(xmlGenericErrorContext, - "xmlNewTextReader : malloc failed\n"); - return(NULL); - } - xmlSAXVersion(ret->sax, 2); - ret->startElement = ret->sax->startElement; - ret->sax->startElement = xmlTextReaderStartElement; - ret->endElement = ret->sax->endElement; - ret->sax->endElement = xmlTextReaderEndElement; - ret->startElementNs = ret->sax->startElementNs; - ret->sax->startElementNs = xmlTextReaderStartElementNs; - ret->endElementNs = ret->sax->endElementNs; - ret->sax->endElementNs = xmlTextReaderEndElementNs; - ret->characters = ret->sax->characters; - ret->sax->characters = xmlTextReaderCharacters; - ret->sax->ignorableWhitespace = xmlTextReaderCharacters; - ret->cdataBlock = ret->sax->cdataBlock; - ret->sax->cdataBlock = xmlTextReaderCDataBlock; - - ret->mode = XML_TEXTREADER_MODE_INITIAL; - ret->node = NULL; - ret->curnode = NULL; - if (ret->input->buffer->use < 4) { - xmlParserInputBufferRead(input, 4); - } - if (ret->input->buffer->use >= 4) { - ret->ctxt = xmlCreatePushParserCtxt(ret->sax, NULL, - (const char *) ret->input->buffer->content, 4, URI); - ret->base = 0; - ret->cur = 4; - } else { - ret->ctxt = xmlCreatePushParserCtxt(ret->sax, NULL, NULL, 0, URI); - ret->base = 0; - ret->cur = 0; - } - - if (ret->ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlNewTextReader : malloc failed\n"); - xmlBufferFree(ret->buffer); - xmlFree(ret->sax); - xmlFree(ret); - return(NULL); - } - ret->ctxt->parseMode = XML_PARSE_READER; - ret->ctxt->_private = ret; - ret->ctxt->linenumbers = 1; - ret->ctxt->dictNames = 1; - ret->allocs = XML_TEXTREADER_CTXT; - /* - * use the parser dictionnary to allocate all elements and attributes names - */ - ret->ctxt->docdict = 1; - ret->dict = ret->ctxt->dict; - return(ret); -} - -/** - * xmlNewTextReaderFilename: - * @URI: the URI of the resource to process - * - * Create an xmlTextReader structure fed with the resource at @URI - * - * Returns the new xmlTextReaderPtr or NULL in case of error - */ -xmlTextReaderPtr -xmlNewTextReaderFilename(const char *URI) { - xmlParserInputBufferPtr input; - xmlTextReaderPtr ret; - char *directory = NULL; - - input = xmlParserInputBufferCreateFilename(URI, XML_CHAR_ENCODING_NONE); - if (input == NULL) - return(NULL); - ret = xmlNewTextReader(input, URI); - if (ret == NULL) { - xmlFreeParserInputBuffer(input); - return(NULL); - } - ret->allocs |= XML_TEXTREADER_INPUT; - if (ret->ctxt->directory == NULL) - directory = xmlParserGetDirectory(URI); - if ((ret->ctxt->directory == NULL) && (directory != NULL)) - ret->ctxt->directory = (char *) xmlStrdup((xmlChar *) directory); - if (directory != NULL) - xmlFree(directory); - return(ret); -} - -/** - * xmlFreeTextReader: - * @reader: the xmlTextReaderPtr - * - * Deallocate all the resources associated to the reader - */ -void -xmlFreeTextReader(xmlTextReaderPtr reader) { - if (reader == NULL) - return; - if (reader->faketext != NULL) { - xmlFreeNode(reader->faketext); - } - if (reader->ctxt != NULL) { - if (reader->dict == reader->ctxt->dict) - reader->dict = NULL; - if (reader->ctxt->myDoc != NULL) { - if (reader->preserve == 0) - xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc); - reader->ctxt->myDoc = NULL; - } - if ((reader->ctxt->vctxt.vstateTab != NULL) && - (reader->ctxt->vctxt.vstateMax > 0)){ - xmlFree(reader->ctxt->vctxt.vstateTab); - reader->ctxt->vctxt.vstateTab = NULL; - reader->ctxt->vctxt.vstateMax = 0; - } - if (reader->allocs & XML_TEXTREADER_CTXT) - xmlFreeParserCtxt(reader->ctxt); - } - if (reader->sax != NULL) - xmlFree(reader->sax); - if ((reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT)) - xmlFreeParserInputBuffer(reader->input); - if (reader->buffer != NULL) - xmlBufferFree(reader->buffer); - if (reader->entTab != NULL) - xmlFree(reader->entTab); - if (reader->dict != NULL) - xmlDictFree(reader->dict); - xmlFree(reader); -} - -/************************************************************************ - * * - * Methods for XmlTextReader * - * * - ************************************************************************/ -/** - * xmlTextReaderClose: - * @reader: the xmlTextReaderPtr used - * - * This method releases any resources allocated by the current instance - * changes the state to Closed and close any underlying input. - * - * Returns 0 or -1 in case of error - */ -int -xmlTextReaderClose(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - reader->node = NULL; - reader->curnode = NULL; - reader->mode = XML_TEXTREADER_MODE_CLOSED; - if (reader->ctxt != NULL) { - xmlStopParser(reader->ctxt); - if (reader->ctxt->myDoc != NULL) { - if (reader->preserve == 0) - xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc); - reader->ctxt->myDoc = NULL; - } - } - if ((reader->input != NULL) && (reader->allocs & XML_TEXTREADER_INPUT)) { - xmlFreeParserInputBuffer(reader->input); - reader->allocs -= XML_TEXTREADER_INPUT; - } - return(0); -} - -/** - * xmlTextReaderGetAttributeNo: - * @reader: the xmlTextReaderPtr used - * @no: the zero-based index of the attribute relative to the containing element - * - * Provides the value of the attribute with the specified index relative - * to the containing element. - * - * Returns a string containing the value of the specified attribute, or NULL - * in case of error. The string must be deallocated by the caller. - */ -xmlChar * -xmlTextReaderGetAttributeNo(xmlTextReaderPtr reader, int no) { - xmlChar *ret; - int i; - xmlAttrPtr cur; - xmlNsPtr ns; - - if (reader == NULL) - return(NULL); - if (reader->node == NULL) - return(NULL); - if (reader->curnode != NULL) - return(NULL); - /* TODO: handle the xmlDecl */ - if (reader->node->type != XML_ELEMENT_NODE) - return(NULL); - - ns = reader->node->nsDef; - for (i = 0;(i < no) && (ns != NULL);i++) { - ns = ns->next; - } - if (ns != NULL) - return(xmlStrdup(ns->href)); - - cur = reader->node->properties; - if (cur == NULL) - return(NULL); - for (;i < no;i++) { - cur = cur->next; - if (cur == NULL) - return(NULL); - } - /* TODO walk the DTD if present */ - - ret = xmlNodeListGetString(reader->node->doc, cur->children, 1); - if (ret == NULL) return(xmlStrdup((xmlChar *)"")); - return(ret); -} - -/** - * xmlTextReaderGetAttribute: - * @reader: the xmlTextReaderPtr used - * @name: the qualified name of the attribute. - * - * Provides the value of the attribute with the specified qualified name. - * - * Returns a string containing the value of the specified attribute, or NULL - * in case of error. The string must be deallocated by the caller. - */ -xmlChar * -xmlTextReaderGetAttribute(xmlTextReaderPtr reader, const xmlChar *name) { - xmlChar *prefix = NULL; - xmlChar *localname; - xmlNsPtr ns; - xmlChar *ret = NULL; - - if ((reader == NULL) || (name == NULL)) - return(NULL); - if (reader->node == NULL) - return(NULL); - if (reader->curnode != NULL) - return(NULL); - - /* TODO: handle the xmlDecl */ - if (reader->node->type != XML_ELEMENT_NODE) - return(NULL); - - localname = xmlSplitQName2(name, &prefix); - if (localname == NULL) { - /* - * Namespace default decl - */ - if (xmlStrEqual(name, BAD_CAST "xmlns")) { - ns = reader->node->nsDef; - while (ns != NULL) { - if (ns->prefix == NULL) { - return(xmlStrdup(ns->href)); - } - ns = ns->next; - } - return NULL; - } - return(xmlGetNoNsProp(reader->node, name)); - } - - /* - * Namespace default decl - */ - if (xmlStrEqual(prefix, BAD_CAST "xmlns")) { - ns = reader->node->nsDef; - while (ns != NULL) { - if ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localname))) { - ret = xmlStrdup(ns->href); - break; - } - ns = ns->next; - } - } else { - ns = xmlSearchNs(reader->node->doc, reader->node, prefix); - if (ns != NULL) - ret = xmlGetNsProp(reader->node, localname, ns->href); - } - - xmlFree(localname); - if (prefix != NULL) - xmlFree(prefix); - return(ret); -} - - -/** - * xmlTextReaderGetAttributeNs: - * @reader: the xmlTextReaderPtr used - * @localName: the local name of the attribute. - * @namespaceURI: the namespace URI of the attribute. - * - * Provides the value of the specified attribute - * - * Returns a string containing the value of the specified attribute, or NULL - * in case of error. The string must be deallocated by the caller. - */ -xmlChar * -xmlTextReaderGetAttributeNs(xmlTextReaderPtr reader, const xmlChar *localName, - const xmlChar *namespaceURI) { - xmlChar *prefix = NULL; - xmlNsPtr ns; - - if ((reader == NULL) || (localName == NULL)) - return(NULL); - if (reader->node == NULL) - return(NULL); - if (reader->curnode != NULL) - return(NULL); - - /* TODO: handle the xmlDecl */ - if (reader->node->type != XML_ELEMENT_NODE) - return(NULL); - - if (xmlStrEqual(namespaceURI, BAD_CAST "http://www.w3.org/2000/xmlns/")) { - if (! xmlStrEqual(localName, BAD_CAST "xmlns")) { - prefix = BAD_CAST localName; - } - ns = reader->node->nsDef; - while (ns != NULL) { - if ((prefix == NULL && ns->prefix == NULL) || - ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localName)))) { - return xmlStrdup(ns->href); - } - ns = ns->next; - } - return NULL; - } - - return(xmlGetNsProp(reader->node, localName, namespaceURI)); -} - -/** - * xmlTextReaderGetRemainder: - * @reader: the xmlTextReaderPtr used - * - * Method to get the remainder of the buffered XML. this method stops the - * parser, set its state to End Of File and return the input stream with - * what is left that the parser did not use. - * - * The implementation is not good, the parser certainly procgressed past - * what's left in reader->input, and there is an allocation problem. Best - * would be to rewrite it differently. - * - * Returns the xmlParserInputBufferPtr attached to the XML or NULL - * in case of error. - */ -xmlParserInputBufferPtr -xmlTextReaderGetRemainder(xmlTextReaderPtr reader) { - xmlParserInputBufferPtr ret = NULL; - - if (reader == NULL) - return(NULL); - if (reader->node == NULL) - return(NULL); - - reader->node = NULL; - reader->curnode = NULL; - reader->mode = XML_TEXTREADER_MODE_EOF; - if (reader->ctxt != NULL) { - xmlStopParser(reader->ctxt); - if (reader->ctxt->myDoc != NULL) { - if (reader->preserve == 0) - xmlTextReaderFreeDoc(reader, reader->ctxt->myDoc); - reader->ctxt->myDoc = NULL; - } - } - if (reader->allocs & XML_TEXTREADER_INPUT) { - ret = reader->input; - reader->input = NULL; - reader->allocs -= XML_TEXTREADER_INPUT; - } else { - /* - * Hum, one may need to duplicate the data structure because - * without reference counting the input may be freed twice: - * - by the layer which allocated it. - * - by the layer to which would have been returned to. - */ - TODO - return(NULL); - } - return(ret); -} - -/** - * xmlTextReaderLookupNamespace: - * @reader: the xmlTextReaderPtr used - * @prefix: the prefix whose namespace URI is to be resolved. To return - * the default namespace, specify NULL - * - * Resolves a namespace prefix in the scope of the current element. - * - * Returns a string containing the namespace URI to which the prefix maps - * or NULL in case of error. The string must be deallocated by the caller. - */ -xmlChar * -xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, const xmlChar *prefix) { - xmlNsPtr ns; - - if (reader == NULL) - return(NULL); - if (reader->node == NULL) - return(NULL); - - ns = xmlSearchNs(reader->node->doc, reader->node, prefix); - if (ns == NULL) - return(NULL); - return(xmlStrdup(ns->href)); -} - -/** - * xmlTextReaderMoveToAttributeNo: - * @reader: the xmlTextReaderPtr used - * @no: the zero-based index of the attribute relative to the containing - * element. - * - * Moves the position of the current instance to the attribute with - * the specified index relative to the containing element. - * - * Returns 1 in case of success, -1 in case of error, 0 if not found - */ -int -xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, int no) { - int i; - xmlAttrPtr cur; - xmlNsPtr ns; - - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(-1); - /* TODO: handle the xmlDecl */ - if (reader->node->type != XML_ELEMENT_NODE) - return(-1); - - reader->curnode = NULL; - - ns = reader->node->nsDef; - for (i = 0;(i < no) && (ns != NULL);i++) { - ns = ns->next; - } - if (ns != NULL) { - reader->curnode = (xmlNodePtr) ns; - return(1); - } - - cur = reader->node->properties; - if (cur == NULL) - return(0); - for (;i < no;i++) { - cur = cur->next; - if (cur == NULL) - return(0); - } - /* TODO walk the DTD if present */ - - reader->curnode = (xmlNodePtr) cur; - return(1); -} - -/** - * xmlTextReaderMoveToAttribute: - * @reader: the xmlTextReaderPtr used - * @name: the qualified name of the attribute. - * - * Moves the position of the current instance to the attribute with - * the specified qualified name. - * - * Returns 1 in case of success, -1 in case of error, 0 if not found - */ -int -xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, const xmlChar *name) { - xmlChar *prefix = NULL; - xmlChar *localname; - xmlNsPtr ns; - xmlAttrPtr prop; - - if ((reader == NULL) || (name == NULL)) - return(-1); - if (reader->node == NULL) - return(-1); - - /* TODO: handle the xmlDecl */ - if (reader->node->type != XML_ELEMENT_NODE) - return(0); - - localname = xmlSplitQName2(name, &prefix); - if (localname == NULL) { - /* - * Namespace default decl - */ - if (xmlStrEqual(name, BAD_CAST "xmlns")) { - ns = reader->node->nsDef; - while (ns != NULL) { - if (ns->prefix == NULL) { - reader->curnode = (xmlNodePtr) ns; - return(1); - } - ns = ns->next; - } - return(0); - } - - prop = reader->node->properties; - while (prop != NULL) { - /* - * One need to have - * - same attribute names - * - and the attribute carrying that namespace - */ - if ((xmlStrEqual(prop->name, name)) && - ((prop->ns == NULL) || (prop->ns->prefix == NULL))) { - reader->curnode = (xmlNodePtr) prop; - return(1); - } - prop = prop->next; - } - return(0); - } - - /* - * Namespace default decl - */ - if (xmlStrEqual(prefix, BAD_CAST "xmlns")) { - ns = reader->node->nsDef; - while (ns != NULL) { - if ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localname))) { - reader->curnode = (xmlNodePtr) ns; - goto found; - } - ns = ns->next; - } - goto not_found; - } - prop = reader->node->properties; - while (prop != NULL) { - /* - * One need to have - * - same attribute names - * - and the attribute carrying that namespace - */ - if ((xmlStrEqual(prop->name, localname)) && - (prop->ns != NULL) && (xmlStrEqual(prop->ns->prefix, prefix))) { - reader->curnode = (xmlNodePtr) prop; - goto found; - } - prop = prop->next; - } -not_found: - if (localname != NULL) - xmlFree(localname); - if (prefix != NULL) - xmlFree(prefix); - return(0); - -found: - if (localname != NULL) - xmlFree(localname); - if (prefix != NULL) - xmlFree(prefix); - return(1); -} - -/** - * xmlTextReaderMoveToAttributeNs: - * @reader: the xmlTextReaderPtr used - * @localName: the local name of the attribute. - * @namespaceURI: the namespace URI of the attribute. - * - * Moves the position of the current instance to the attribute with the - * specified local name and namespace URI. - * - * Returns 1 in case of success, -1 in case of error, 0 if not found - */ -int -xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, - const xmlChar *localName, const xmlChar *namespaceURI) { - xmlAttrPtr prop; - xmlNodePtr node; - xmlNsPtr ns; - xmlChar *prefix = NULL; - - if ((reader == NULL) || (localName == NULL) || (namespaceURI == NULL)) - return(-1); - if (reader->node == NULL) - return(-1); - if (reader->node->type != XML_ELEMENT_NODE) - return(0); - node = reader->node; - - if (xmlStrEqual(namespaceURI, BAD_CAST "http://www.w3.org/2000/xmlns/")) { - if (! xmlStrEqual(localName, BAD_CAST "xmlns")) { - prefix = BAD_CAST localName; - } - ns = reader->node->nsDef; - while (ns != NULL) { - if ((prefix == NULL && ns->prefix == NULL) || - ((ns->prefix != NULL) && (xmlStrEqual(ns->prefix, localName)))) { - reader->curnode = (xmlNodePtr) ns; - return(1); - } - ns = ns->next; - } - return(0); - } - - prop = node->properties; - while (prop != NULL) { - /* - * One need to have - * - same attribute names - * - and the attribute carrying that namespace - */ - if (xmlStrEqual(prop->name, localName) && - ((prop->ns != NULL) && - (xmlStrEqual(prop->ns->href, namespaceURI)))) { - reader->curnode = (xmlNodePtr) prop; - return(1); - } - prop = prop->next; - } - return(0); -} - -/** - * xmlTextReaderMoveToFirstAttribute: - * @reader: the xmlTextReaderPtr used - * - * Moves the position of the current instance to the first attribute - * associated with the current node. - * - * Returns 1 in case of success, -1 in case of error, 0 if not found - */ -int -xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(-1); - if (reader->node->type != XML_ELEMENT_NODE) - return(0); - - if (reader->node->nsDef != NULL) { - reader->curnode = (xmlNodePtr) reader->node->nsDef; - return(1); - } - if (reader->node->properties != NULL) { - reader->curnode = (xmlNodePtr) reader->node->properties; - return(1); - } - return(0); -} - -/** - * xmlTextReaderMoveToNextAttribute: - * @reader: the xmlTextReaderPtr used - * - * Moves the position of the current instance to the next attribute - * associated with the current node. - * - * Returns 1 in case of success, -1 in case of error, 0 if not found - */ -int -xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(-1); - if (reader->node->type != XML_ELEMENT_NODE) - return(0); - if (reader->curnode == NULL) - return(xmlTextReaderMoveToFirstAttribute(reader)); - - if (reader->curnode->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns = (xmlNsPtr) reader->curnode; - if (ns->next != NULL) { - reader->curnode = (xmlNodePtr) ns->next; - return(1); - } - if (reader->node->properties != NULL) { - reader->curnode = (xmlNodePtr) reader->node->properties; - return(1); - } - return(0); - } else if ((reader->curnode->type == XML_ATTRIBUTE_NODE) && - (reader->curnode->next != NULL)) { - reader->curnode = reader->curnode->next; - return(1); - } - return(0); -} - -/** - * xmlTextReaderMoveToElement: - * @reader: the xmlTextReaderPtr used - * - * Moves the position of the current instance to the node that - * contains the current Attribute node. - * - * Returns 1 in case of success, -1 in case of error, 0 if not moved - */ -int -xmlTextReaderMoveToElement(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(-1); - if (reader->node->type != XML_ELEMENT_NODE) - return(0); - if (reader->curnode != NULL) { - reader->curnode = NULL; - return(1); - } - return(0); -} - -/** - * xmlTextReaderReadAttributeValue: - * @reader: the xmlTextReaderPtr used - * - * Parses an attribute value into one or more Text and EntityReference nodes. - * - * Returns 1 in case of success, 0 if the reader was not positionned on an - * ttribute node or all the attribute values have been read, or -1 - * in case of error. - */ -int -xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(-1); - if (reader->curnode == NULL) - return(0); - if (reader->curnode->type == XML_ATTRIBUTE_NODE) { - if (reader->curnode->children == NULL) - return(0); - reader->curnode = reader->curnode->children; - } else if (reader->curnode->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns = (xmlNsPtr) reader->curnode; - - if (reader->faketext == NULL) { - reader->faketext = xmlNewDocText(reader->node->doc, - ns->href); - } else { - if ((reader->faketext->content != NULL) && - (reader->faketext->content != - (xmlChar *) &(reader->faketext->properties))) - xmlFree(reader->faketext->content); - reader->faketext->content = xmlStrdup(ns->href); - } - reader->curnode = reader->faketext; - } else { - if (reader->curnode->next == NULL) - return(0); - reader->curnode = reader->curnode->next; - } - return(1); -} - -/** - * xmlTextReaderConstEncoding: - * @reader: the xmlTextReaderPtr used - * - * Determine the encoding of the document being read. - * - * Returns a string containing the encoding of the document or NULL in - * case of error. The string is deallocated with the reader. - */ -const xmlChar * -xmlTextReaderConstEncoding(xmlTextReaderPtr reader) { - xmlDocPtr doc = NULL; - if (reader == NULL) - return(NULL); - if (reader->doc != NULL) - doc = reader->doc; - else if (reader->ctxt != NULL) - doc = reader->ctxt->myDoc; - if (doc == NULL) - return(NULL); - - if (doc->encoding == NULL) - return(NULL); - else - return(CONSTSTR(doc->encoding)); -} - - -/************************************************************************ - * * - * Acces API to the current node * - * * - ************************************************************************/ -/** - * xmlTextReaderAttributeCount: - * @reader: the xmlTextReaderPtr used - * - * Provides the number of attributes of the current node - * - * Returns 0 i no attributes, -1 in case of error or the attribute count - */ -int -xmlTextReaderAttributeCount(xmlTextReaderPtr reader) { - int ret; - xmlAttrPtr attr; - xmlNsPtr ns; - xmlNodePtr node; - - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(0); - - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - - if (node->type != XML_ELEMENT_NODE) - return(0); - if ((reader->state == XML_TEXTREADER_END) || - (reader->state == XML_TEXTREADER_BACKTRACK)) - return(0); - ret = 0; - attr = node->properties; - while (attr != NULL) { - ret++; - attr = attr->next; - } - ns = node->nsDef; - while (ns != NULL) { - ret++; - ns = ns->next; - } - return(ret); -} - -/** - * xmlTextReaderNodeType: - * @reader: the xmlTextReaderPtr used - * - * Get the node type of the current node - * Reference: - * http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/XmlNodeType.html - * - * Returns the xmlNodeType of the current node or -1 in case of error - */ -int -xmlTextReaderNodeType(xmlTextReaderPtr reader) { - xmlNodePtr node; - - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(XML_READER_TYPE_NONE); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - switch (node->type) { - case XML_ELEMENT_NODE: - if ((reader->state == XML_TEXTREADER_END) || - (reader->state == XML_TEXTREADER_BACKTRACK)) - return(XML_READER_TYPE_END_ELEMENT); - return(XML_READER_TYPE_ELEMENT); - case XML_NAMESPACE_DECL: - case XML_ATTRIBUTE_NODE: - return(XML_READER_TYPE_ATTRIBUTE); - case XML_TEXT_NODE: - if (xmlIsBlankNode(reader->node)) { - if (xmlNodeGetSpacePreserve(reader->node)) - return(XML_READER_TYPE_SIGNIFICANT_WHITESPACE); - else - return(XML_READER_TYPE_WHITESPACE); - } else { - return(XML_READER_TYPE_TEXT); - } - case XML_CDATA_SECTION_NODE: - return(XML_READER_TYPE_CDATA); - case XML_ENTITY_REF_NODE: - return(XML_READER_TYPE_ENTITY_REFERENCE); - case XML_ENTITY_NODE: - return(XML_READER_TYPE_ENTITY); - case XML_PI_NODE: - return(XML_READER_TYPE_PROCESSING_INSTRUCTION); - case XML_COMMENT_NODE: - return(XML_READER_TYPE_COMMENT); - case XML_DOCUMENT_NODE: - case XML_HTML_DOCUMENT_NODE: - return(XML_READER_TYPE_DOCUMENT); - case XML_DOCUMENT_FRAG_NODE: - return(XML_READER_TYPE_DOCUMENT_FRAGMENT); - case XML_NOTATION_NODE: - return(XML_READER_TYPE_NOTATION); - case XML_DOCUMENT_TYPE_NODE: - case XML_DTD_NODE: - return(XML_READER_TYPE_DOCUMENT_TYPE); - - case XML_ELEMENT_DECL: - case XML_ATTRIBUTE_DECL: - case XML_ENTITY_DECL: - case XML_XINCLUDE_START: - case XML_XINCLUDE_END: - return(XML_READER_TYPE_NONE); - } - return(-1); -} - -/** - * xmlTextReaderIsEmptyElement: - * @reader: the xmlTextReaderPtr used - * - * Check if the current node is empty - * - * Returns 1 if empty, 0 if not and -1 in case of error - */ -int -xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader) { - if ((reader == NULL) || (reader->node == NULL)) - return(-1); - if (reader->node->type != XML_ELEMENT_NODE) - return(0); - if (reader->curnode != NULL) - return(0); - if (reader->node->children != NULL) - return(0); - if (reader->state == XML_TEXTREADER_END) - return(0); - if (reader->doc != NULL) - return(1); - return((reader->node->extra & NODE_IS_EMPTY) != 0); -} - -/** - * xmlTextReaderLocalName: - * @reader: the xmlTextReaderPtr used - * - * The local name of the node. - * - * Returns the local name or NULL if not available, - * if non NULL it need to be freed by the caller. - */ -xmlChar * -xmlTextReaderLocalName(xmlTextReaderPtr reader) { - xmlNodePtr node; - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - if (node->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns = (xmlNsPtr) node; - if (ns->prefix == NULL) - return(xmlStrdup(BAD_CAST "xmlns")); - else - return(xmlStrdup(ns->prefix)); - } - if ((node->type != XML_ELEMENT_NODE) && - (node->type != XML_ATTRIBUTE_NODE)) - return(xmlTextReaderName(reader)); - return(xmlStrdup(node->name)); -} - -/** - * xmlTextReaderConstLocalName: - * @reader: the xmlTextReaderPtr used - * - * The local name of the node. - * - * Returns the local name or NULL if not available, the - * string will be deallocated with the reader. - */ -const xmlChar * -xmlTextReaderConstLocalName(xmlTextReaderPtr reader) { - xmlNodePtr node; - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - if (node->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns = (xmlNsPtr) node; - if (ns->prefix == NULL) - return(CONSTSTR(BAD_CAST "xmlns")); - else - return(ns->prefix); - } - if ((node->type != XML_ELEMENT_NODE) && - (node->type != XML_ATTRIBUTE_NODE)) - return(xmlTextReaderConstName(reader)); - return(node->name); -} - -/** - * xmlTextReaderName: - * @reader: the xmlTextReaderPtr used - * - * The qualified name of the node, equal to Prefix :LocalName. - * - * Returns the local name or NULL if not available, - * if non NULL it need to be freed by the caller. - */ -xmlChar * -xmlTextReaderName(xmlTextReaderPtr reader) { - xmlNodePtr node; - xmlChar *ret; - - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - switch (node->type) { - case XML_ELEMENT_NODE: - case XML_ATTRIBUTE_NODE: - if ((node->ns == NULL) || - (node->ns->prefix == NULL)) - return(xmlStrdup(node->name)); - - ret = xmlStrdup(node->ns->prefix); - ret = xmlStrcat(ret, BAD_CAST ":"); - ret = xmlStrcat(ret, node->name); - return(ret); - case XML_TEXT_NODE: - return(xmlStrdup(BAD_CAST "#text")); - case XML_CDATA_SECTION_NODE: - return(xmlStrdup(BAD_CAST "#cdata-section")); - case XML_ENTITY_NODE: - case XML_ENTITY_REF_NODE: - return(xmlStrdup(node->name)); - case XML_PI_NODE: - return(xmlStrdup(node->name)); - case XML_COMMENT_NODE: - return(xmlStrdup(BAD_CAST "#comment")); - case XML_DOCUMENT_NODE: - case XML_HTML_DOCUMENT_NODE: - return(xmlStrdup(BAD_CAST "#document")); - case XML_DOCUMENT_FRAG_NODE: - return(xmlStrdup(BAD_CAST "#document-fragment")); - case XML_NOTATION_NODE: - return(xmlStrdup(node->name)); - case XML_DOCUMENT_TYPE_NODE: - case XML_DTD_NODE: - return(xmlStrdup(node->name)); - case XML_NAMESPACE_DECL: { - xmlNsPtr ns = (xmlNsPtr) node; - - ret = xmlStrdup(BAD_CAST "xmlns"); - if (ns->prefix == NULL) - return(ret); - ret = xmlStrcat(ret, BAD_CAST ":"); - ret = xmlStrcat(ret, ns->prefix); - return(ret); - } - - case XML_ELEMENT_DECL: - case XML_ATTRIBUTE_DECL: - case XML_ENTITY_DECL: - case XML_XINCLUDE_START: - case XML_XINCLUDE_END: - return(NULL); - } - return(NULL); -} - -/** - * xmlTextReaderConstName: - * @reader: the xmlTextReaderPtr used - * - * The qualified name of the node, equal to Prefix :LocalName. - * - * Returns the local name or NULL if not available, the string is - * deallocated with the reader. - */ -const xmlChar * -xmlTextReaderConstName(xmlTextReaderPtr reader) { - xmlNodePtr node; - - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - switch (node->type) { - case XML_ELEMENT_NODE: - case XML_ATTRIBUTE_NODE: - if ((node->ns == NULL) || - (node->ns->prefix == NULL)) - return(node->name); - return(CONSTQSTR(node->ns->prefix, node->name)); - case XML_TEXT_NODE: - return(CONSTSTR(BAD_CAST "#text")); - case XML_CDATA_SECTION_NODE: - return(CONSTSTR(BAD_CAST "#cdata-section")); - case XML_ENTITY_NODE: - case XML_ENTITY_REF_NODE: - return(CONSTSTR(node->name)); - case XML_PI_NODE: - return(CONSTSTR(node->name)); - case XML_COMMENT_NODE: - return(CONSTSTR(BAD_CAST "#comment")); - case XML_DOCUMENT_NODE: - case XML_HTML_DOCUMENT_NODE: - return(CONSTSTR(BAD_CAST "#document")); - case XML_DOCUMENT_FRAG_NODE: - return(CONSTSTR(BAD_CAST "#document-fragment")); - case XML_NOTATION_NODE: - return(CONSTSTR(node->name)); - case XML_DOCUMENT_TYPE_NODE: - case XML_DTD_NODE: - return(CONSTSTR(node->name)); - case XML_NAMESPACE_DECL: { - xmlNsPtr ns = (xmlNsPtr) node; - - if (ns->prefix == NULL) - return(CONSTSTR(BAD_CAST "xmlns")); - return(CONSTQSTR(BAD_CAST "xmlns", ns->prefix)); - } - - case XML_ELEMENT_DECL: - case XML_ATTRIBUTE_DECL: - case XML_ENTITY_DECL: - case XML_XINCLUDE_START: - case XML_XINCLUDE_END: - return(NULL); - } - return(NULL); -} - -/** - * xmlTextReaderPrefix: - * @reader: the xmlTextReaderPtr used - * - * A shorthand reference to the namespace associated with the node. - * - * Returns the prefix or NULL if not available, - * if non NULL it need to be freed by the caller. - */ -xmlChar * -xmlTextReaderPrefix(xmlTextReaderPtr reader) { - xmlNodePtr node; - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - if (node->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns = (xmlNsPtr) node; - if (ns->prefix == NULL) - return(NULL); - return(xmlStrdup(BAD_CAST "xmlns")); - } - if ((node->type != XML_ELEMENT_NODE) && - (node->type != XML_ATTRIBUTE_NODE)) - return(NULL); - if ((node->ns != NULL) && (node->ns->prefix != NULL)) - return(xmlStrdup(node->ns->prefix)); - return(NULL); -} - -/** - * xmlTextReaderConstPrefix: - * @reader: the xmlTextReaderPtr used - * - * A shorthand reference to the namespace associated with the node. - * - * Returns the prefix or NULL if not available, the string is deallocated - * with the reader. - */ -const xmlChar * -xmlTextReaderConstPrefix(xmlTextReaderPtr reader) { - xmlNodePtr node; - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - if (node->type == XML_NAMESPACE_DECL) { - xmlNsPtr ns = (xmlNsPtr) node; - if (ns->prefix == NULL) - return(NULL); - return(CONSTSTR(BAD_CAST "xmlns")); - } - if ((node->type != XML_ELEMENT_NODE) && - (node->type != XML_ATTRIBUTE_NODE)) - return(NULL); - if ((node->ns != NULL) && (node->ns->prefix != NULL)) - return(CONSTSTR(node->ns->prefix)); - return(NULL); -} - -/** - * xmlTextReaderNamespaceUri: - * @reader: the xmlTextReaderPtr used - * - * The URI defining the namespace associated with the node. - * - * Returns the namespace URI or NULL if not available, - * if non NULL it need to be freed by the caller. - */ -xmlChar * -xmlTextReaderNamespaceUri(xmlTextReaderPtr reader) { - xmlNodePtr node; - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - if (node->type == XML_NAMESPACE_DECL) - return(xmlStrdup(BAD_CAST "http://www.w3.org/2000/xmlns/")); - if ((node->type != XML_ELEMENT_NODE) && - (node->type != XML_ATTRIBUTE_NODE)) - return(NULL); - if (node->ns != NULL) - return(xmlStrdup(node->ns->href)); - return(NULL); -} - -/** - * xmlTextReaderConstNamespaceUri: - * @reader: the xmlTextReaderPtr used - * - * The URI defining the namespace associated with the node. - * - * Returns the namespace URI or NULL if not available, the string - * will be deallocated with the reader - */ -const xmlChar * -xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader) { - xmlNodePtr node; - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - if (node->type == XML_NAMESPACE_DECL) - return(CONSTSTR(BAD_CAST "http://www.w3.org/2000/xmlns/")); - if ((node->type != XML_ELEMENT_NODE) && - (node->type != XML_ATTRIBUTE_NODE)) - return(NULL); - if (node->ns != NULL) - return(CONSTSTR(node->ns->href)); - return(NULL); -} - -/** - * xmlTextReaderBaseUri: - * @reader: the xmlTextReaderPtr used - * - * The base URI of the node. - * - * Returns the base URI or NULL if not available, - * if non NULL it need to be freed by the caller. - */ -xmlChar * -xmlTextReaderBaseUri(xmlTextReaderPtr reader) { - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - return(xmlNodeGetBase(NULL, reader->node)); -} - -/** - * xmlTextReaderConstBaseUri: - * @reader: the xmlTextReaderPtr used - * - * The base URI of the node. - * - * Returns the base URI or NULL if not available, the string - * will be deallocated with the reader - */ -const xmlChar * -xmlTextReaderConstBaseUri(xmlTextReaderPtr reader) { - xmlChar *tmp; - const xmlChar *ret; - - if ((reader == NULL) || (reader->node == NULL)) - return(NULL); - tmp = xmlNodeGetBase(NULL, reader->node); - if (tmp == NULL) - return(NULL); - ret = CONSTSTR(tmp); - xmlFree(tmp); - return(ret); -} - -/** - * xmlTextReaderDepth: - * @reader: the xmlTextReaderPtr used - * - * The depth of the node in the tree. - * - * Returns the depth or -1 in case of error - */ -int -xmlTextReaderDepth(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(0); - - if (reader->curnode != NULL) { - if ((reader->curnode->type == XML_ATTRIBUTE_NODE) || - (reader->curnode->type == XML_NAMESPACE_DECL)) - return(reader->depth + 1); - return(reader->depth + 2); - } - return(reader->depth); -} - -/** - * xmlTextReaderHasAttributes: - * @reader: the xmlTextReaderPtr used - * - * Whether the node has attributes. - * - * Returns 1 if true, 0 if false, and -1 in case or error - */ -int -xmlTextReaderHasAttributes(xmlTextReaderPtr reader) { - xmlNodePtr node; - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(0); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - - if ((node->type == XML_ELEMENT_NODE) && - ((node->properties != NULL) || (node->nsDef != NULL))) - return(1); - /* TODO: handle the xmlDecl */ - return(0); -} - -/** - * xmlTextReaderHasValue: - * @reader: the xmlTextReaderPtr used - * - * Whether the node can have a text value. - * - * Returns 1 if true, 0 if false, and -1 in case or error - */ -int -xmlTextReaderHasValue(xmlTextReaderPtr reader) { - xmlNodePtr node; - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(0); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - - switch (node->type) { - case XML_ATTRIBUTE_NODE: - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - case XML_PI_NODE: - case XML_COMMENT_NODE: - case XML_NAMESPACE_DECL: - return(1); - default: - break; - } - return(0); -} - -/** - * xmlTextReaderValue: - * @reader: the xmlTextReaderPtr used - * - * Provides the text value of the node if present - * - * Returns the string or NULL if not available. The result must be deallocated - * with xmlFree() - */ -xmlChar * -xmlTextReaderValue(xmlTextReaderPtr reader) { - xmlNodePtr node; - if (reader == NULL) - return(NULL); - if (reader->node == NULL) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - - switch (node->type) { - case XML_NAMESPACE_DECL: - return(xmlStrdup(((xmlNsPtr) node)->href)); - case XML_ATTRIBUTE_NODE:{ - xmlAttrPtr attr = (xmlAttrPtr) node; - - if (attr->parent != NULL) - return (xmlNodeListGetString - (attr->parent->doc, attr->children, 1)); - else - return (xmlNodeListGetString(NULL, attr->children, 1)); - break; - } - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - case XML_PI_NODE: - case XML_COMMENT_NODE: - if (node->content != NULL) - return (xmlStrdup(node->content)); - default: - break; - } - return(NULL); -} - -/** - * xmlTextReaderConstValue: - * @reader: the xmlTextReaderPtr used - * - * Provides the text value of the node if present - * - * Returns the string or NULL if not available. The result will be - * deallocated on the next Read() operation. - */ -const xmlChar * -xmlTextReaderConstValue(xmlTextReaderPtr reader) { - xmlNodePtr node; - if (reader == NULL) - return(NULL); - if (reader->node == NULL) - return(NULL); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - - switch (node->type) { - case XML_NAMESPACE_DECL: - return(((xmlNsPtr) node)->href); - case XML_ATTRIBUTE_NODE:{ - xmlAttrPtr attr = (xmlAttrPtr) node; - - if ((attr->children != NULL) && - (attr->children->type == XML_TEXT_NODE) && - (attr->children->next == NULL)) - return(attr->children->content); - else { - if (reader->buffer == NULL) - reader->buffer = xmlBufferCreateSize(100); - if (reader->buffer == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlTextReaderSetup : malloc failed\n"); - return (NULL); - } - reader->buffer->use = 0; - xmlNodeBufGetContent(reader->buffer, node); - return(reader->buffer->content); - } - break; - } - case XML_TEXT_NODE: - case XML_CDATA_SECTION_NODE: - case XML_PI_NODE: - case XML_COMMENT_NODE: - return(node->content); - default: - break; - } - return(NULL); -} - -/** - * xmlTextReaderIsDefault: - * @reader: the xmlTextReaderPtr used - * - * Whether an Attribute node was generated from the default value - * defined in the DTD or schema. - * - * Returns 0 if not defaulted, 1 if defaulted, and -1 in case of error - */ -int -xmlTextReaderIsDefault(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - return(0); -} - -/** - * xmlTextReaderQuoteChar: - * @reader: the xmlTextReaderPtr used - * - * The quotation mark character used to enclose the value of an attribute. - * - * Returns " or ' and -1 in case of error - */ -int -xmlTextReaderQuoteChar(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - /* TODO maybe lookup the attribute value for " first */ - return((int) '"'); -} - -/** - * xmlTextReaderXmlLang: - * @reader: the xmlTextReaderPtr used - * - * The xml:lang scope within which the node resides. - * - * Returns the xml:lang value or NULL if none exists., - * if non NULL it need to be freed by the caller. - */ -xmlChar * -xmlTextReaderXmlLang(xmlTextReaderPtr reader) { - if (reader == NULL) - return(NULL); - if (reader->node == NULL) - return(NULL); - return(xmlNodeGetLang(reader->node)); -} - -/** - * xmlTextReaderConstXmlLang: - * @reader: the xmlTextReaderPtr used - * - * The xml:lang scope within which the node resides. - * - * Returns the xml:lang value or NULL if none exists. - */ -const xmlChar * -xmlTextReaderConstXmlLang(xmlTextReaderPtr reader) { - xmlChar *tmp; - const xmlChar *ret; - - if (reader == NULL) - return(NULL); - if (reader->node == NULL) - return(NULL); - tmp = xmlNodeGetLang(reader->node); - if (tmp == NULL) - return(NULL); - ret = CONSTSTR(tmp); - xmlFree(tmp); - return(ret); -} - -/** - * xmlTextReaderConstString: - * @reader: the xmlTextReaderPtr used - * @str: the string to intern. - * - * Get an interned string from the reader, allows for example to - * speedup string name comparisons - * - * Returns an interned copy of the string or NULL in case of error. The - * string will be deallocated with the reader. - */ -const xmlChar * -xmlTextReaderConstString(xmlTextReaderPtr reader, const xmlChar *str) { - if (reader == NULL) - return(NULL); - return(CONSTSTR(str)); -} - -/** - * xmlTextReaderNormalization: - * @reader: the xmlTextReaderPtr used - * - * The value indicating whether to normalize white space and attribute values. - * Since attribute value and end of line normalizations are a MUST in the XML - * specification only the value true is accepted. The broken bahaviour of - * accepting out of range character entities like � is of course not - * supported either. - * - * Returns 1 or -1 in case of error. - */ -int -xmlTextReaderNormalization(xmlTextReaderPtr reader) { - if (reader == NULL) - return(-1); - return(1); -} - -/************************************************************************ - * * - * Extensions to the base APIs * - * * - ************************************************************************/ - -/** - * xmlTextReaderSetParserProp: - * @reader: the xmlTextReaderPtr used - * @prop: the xmlParserProperties to set - * @value: usually 0 or 1 to (de)activate it - * - * Change the parser processing behaviour by changing some of its internal - * properties. Note that some properties can only be changed before any - * read has been done. - * - * Returns 0 if the call was successful, or -1 in case of error - */ -int -xmlTextReaderSetParserProp(xmlTextReaderPtr reader, int prop, int value) { - xmlParserProperties p = (xmlParserProperties) prop; - xmlParserCtxtPtr ctxt; - - if ((reader == NULL) || (reader->ctxt == NULL)) - return(-1); - ctxt = reader->ctxt; - - switch (p) { - case XML_PARSER_LOADDTD: - if (value != 0) { - if (ctxt->loadsubset == 0) { - if (reader->mode != XML_TEXTREADER_MODE_INITIAL) - return(-1); - ctxt->loadsubset = XML_DETECT_IDS; - } - } else { - ctxt->loadsubset = 0; - } - return(0); - case XML_PARSER_DEFAULTATTRS: - if (value != 0) { - ctxt->loadsubset |= XML_COMPLETE_ATTRS; - } else { - if (ctxt->loadsubset & XML_COMPLETE_ATTRS) - ctxt->loadsubset -= XML_COMPLETE_ATTRS; - } - return(0); - case XML_PARSER_VALIDATE: - if (value != 0) { - ctxt->validate = 1; - reader->validate = XML_TEXTREADER_VALIDATE_DTD; - } else { - ctxt->validate = 0; - } - return(0); - case XML_PARSER_SUBST_ENTITIES: - if (value != 0) { - ctxt->replaceEntities = 1; - } else { - ctxt->replaceEntities = 0; - } - return(0); - } - return(-1); -} - -/** - * xmlTextReaderGetParserProp: - * @reader: the xmlTextReaderPtr used - * @prop: the xmlParserProperties to get - * - * Read the parser internal property. - * - * Returns the value, usually 0 or 1, or -1 in case of error. - */ -int -xmlTextReaderGetParserProp(xmlTextReaderPtr reader, int prop) { - xmlParserProperties p = (xmlParserProperties) prop; - xmlParserCtxtPtr ctxt; - - if ((reader == NULL) || (reader->ctxt == NULL)) - return(-1); - ctxt = reader->ctxt; - - switch (p) { - case XML_PARSER_LOADDTD: - if ((ctxt->loadsubset != 0) || (ctxt->validate != 0)) - return(1); - return(0); - case XML_PARSER_DEFAULTATTRS: - if (ctxt->loadsubset & XML_COMPLETE_ATTRS) - return(1); - return(0); - case XML_PARSER_VALIDATE: - return(reader->validate); - case XML_PARSER_SUBST_ENTITIES: - return(ctxt->replaceEntities); - } - return(-1); -} - - -/** - * xmlTextReaderGetParserLineNumber: - * @reader: the user data (XML reader context) - * - * Provide the line number of the current parsing point. - * - * Returns an int or 0 if not available - */ -int -xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader) -{ - if ((reader == NULL) || (reader->ctxt == NULL) || - (reader->ctxt->input == NULL)) { - return (0); - } - return (reader->ctxt->input->line); -} - -/** - * xmlTextReaderGetParserColumnNumber: - * @reader: the user data (XML reader context) - * - * Provide the column number of the current parsing point. - * - * Returns an int or 0 if not available - */ -int -xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader) -{ - if ((reader == NULL) || (reader->ctxt == NULL) || - (reader->ctxt->input == NULL)) { - return (0); - } - return (reader->ctxt->input->col); -} - -/** - * xmlTextReaderCurrentNode: - * @reader: the xmlTextReaderPtr used - * - * Hacking interface allowing to get the xmlNodePtr correponding to the - * current node being accessed by the xmlTextReader. This is dangerous - * because the underlying node may be destroyed on the next Reads. - * - * Returns the xmlNodePtr or NULL in case of error. - */ -xmlNodePtr -xmlTextReaderCurrentNode(xmlTextReaderPtr reader) { - if (reader == NULL) - return(NULL); - - if (reader->curnode != NULL) - return(reader->curnode); - return(reader->node); -} - -/** - * xmlTextReaderPreserve: - * @reader: the xmlTextReaderPtr used - * - * This tells the XML Reader to preserve the current node. - * The caller must also use xmlTextReaderCurrentDoc() to - * keep an handle on the resulting document once parsing has finished - * - * Returns the xmlNodePtr or NULL in case of error. - */ -xmlNodePtr -xmlTextReaderPreserve(xmlTextReaderPtr reader) { - xmlNodePtr cur, parent; - - if (reader == NULL) - return(NULL); - - if (reader->curnode != NULL) - cur = reader->curnode; - else - cur = reader->node; - if (cur == NULL) - return(NULL); - - if ((cur->type != XML_DOCUMENT_NODE) && (cur->type != XML_DTD_NODE)) { - cur->extra |= NODE_IS_PRESERVED; - cur->extra |= NODE_IS_SPRESERVED; - } - reader->preserves++; - - parent = cur->parent;; - while (parent != NULL) { - if (parent->type == XML_ELEMENT_NODE) - parent->extra |= NODE_IS_PRESERVED; - parent = parent->parent; - } - return(cur); -} - -/** - * xmlTextReaderCurrentDoc: - * @reader: the xmlTextReaderPtr used - * - * Hacking interface allowing to get the xmlDocPtr correponding to the - * current document being accessed by the xmlTextReader. - * NOTE: as a result of this call, the reader will not destroy the - * associated XML document and calling xmlFreeDoc() on the result - * is needed once the reader parsing has finished. - * - * Returns the xmlDocPtr or NULL in case of error. - */ -xmlDocPtr -xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) { - if (reader == NULL) - return(NULL); - if (reader->doc != NULL) - return(reader->doc); - if ((reader->ctxt == NULL) || (reader->ctxt->myDoc == NULL)) - return(NULL); - - reader->preserve = 1; - return(reader->ctxt->myDoc); -} - -/** - * xmlTextReaderIsNamespaceDecl: - * @reader: the xmlTextReaderPtr used - * - * Determine whether the current node is a namespace declaration - * rather than a regular attribute. - * - * Returns 1 if the current node is a namespace declaration, 0 if it - * is a regular attribute or other type of node, or -1 in case of - * error. - */ -int -xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader) { - xmlNodePtr node; - if (reader == NULL) - return(-1); - if (reader->node == NULL) - return(-1); - if (reader->curnode != NULL) - node = reader->curnode; - else - node = reader->node; - - if (XML_NAMESPACE_DECL == node->type) - return(1); - else - return(0); -} - -/** - * xmlTextReaderConstXmlVersion: - * @reader: the xmlTextReaderPtr used - * - * Determine the XML version of the document being read. - * - * Returns a string containing the XML version of the document or NULL - * in case of error. The string is deallocated with the reader. - */ -const xmlChar * -xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader) { - xmlDocPtr doc = NULL; - if (reader == NULL) - return(NULL); - if (reader->doc != NULL) - doc = reader->doc; - else if (reader->ctxt != NULL) - doc = reader->ctxt->myDoc; - if (doc == NULL) - return(NULL); - - if (doc->version == NULL) - return(NULL); - else - return(CONSTSTR(doc->version)); -} - -/** - * xmlTextReaderStandalone: - * @reader: the xmlTextReaderPtr used - * - * Determine the standalone status of the document being read. - * - * Returns 1 if the document was declared to be standalone, 0 if it - * was declared to be not standalone, or -1 if the document did not - * specify its standalone status or in case of error. - */ -int -xmlTextReaderStandalone(xmlTextReaderPtr reader) { - xmlDocPtr doc = NULL; - if (reader == NULL) - return(-1); - if (reader->doc != NULL) - doc = reader->doc; - else if (reader->ctxt != NULL) - doc = reader->ctxt->myDoc; - if (doc == NULL) - return(-1); - - return(doc->standalone); -} - -/************************************************************************ - * * - * Error Handling Extensions * - * * - ************************************************************************/ - -/* helper to build a xmlMalloc'ed string from a format and va_list */ -static char * -xmlTextReaderBuildMessage(const char *msg, va_list ap) { - int size = 0; - int chars; - char *larger; - char *str = NULL; - va_list aq; - - while (1) { - VA_COPY(aq, ap); - chars = vsnprintf(str, size, msg, aq); - va_end(aq); - if (chars < 0) { - xmlGenericError(xmlGenericErrorContext, "vsnprintf failed !\n"); - if (str) - xmlFree(str); - return NULL; - } - if ((chars < size) || (size == MAX_ERR_MSG_SIZE)) - break; - if (chars < MAX_ERR_MSG_SIZE) - size = chars + 1; - else - size = MAX_ERR_MSG_SIZE; - if ((larger = (char *) xmlRealloc(str, size)) == NULL) { - xmlGenericError(xmlGenericErrorContext, "xmlRealloc failed !\n"); - if (str) - xmlFree(str); - return NULL; - } - str = larger; - } - - return str; -} - -/** - * xmlTextReaderLocatorLineNumber: - * @locator: the xmlTextReaderLocatorPtr used - * - * Obtain the line number for the given locator. - * - * Returns the line number or -1 in case of error. - */ -int -xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator) { - /* we know that locator is a xmlParserCtxtPtr */ - xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)locator; - int ret = -1; - - if (locator == NULL) - return(-1); - if (ctx->node != NULL) { - ret = xmlGetLineNo(ctx->node); - } - else { - /* inspired from error.c */ - xmlParserInputPtr input; - input = ctx->input; - if ((input->filename == NULL) && (ctx->inputNr > 1)) - input = ctx->inputTab[ctx->inputNr - 2]; - if (input != NULL) { - ret = input->line; - } - else { - ret = -1; - } - } - - return ret; -} - -/** - * xmlTextReaderLocatorBaseURI: - * @locator: the xmlTextReaderLocatorPtr used - * - * Obtain the base URI for the given locator. - * - * Returns the base URI or NULL in case of error, - * if non NULL it need to be freed by the caller. - */ -xmlChar * -xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) { - /* we know that locator is a xmlParserCtxtPtr */ - xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)locator; - xmlChar *ret = NULL; - - if (locator == NULL) - return(NULL); - if (ctx->node != NULL) { - ret = xmlNodeGetBase(NULL,ctx->node); - } - else { - /* inspired from error.c */ - xmlParserInputPtr input; - input = ctx->input; - if ((input->filename == NULL) && (ctx->inputNr > 1)) - input = ctx->inputTab[ctx->inputNr - 2]; - if (input != NULL) { - ret = xmlStrdup(BAD_CAST input->filename); - } - else { - ret = NULL; - } - } - - return ret; -} - -static void -xmlTextReaderGenericError(void *ctxt, xmlParserSeverities severity, - char *str) -{ - xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt; - - xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private; - - if (str != NULL) { - if (reader->errorFunc) - reader->errorFunc(reader->errorFuncArg, str, severity, - (xmlTextReaderLocatorPtr) ctx); - xmlFree(str); - } -} - -static void -xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error) -{ - xmlParserCtxtPtr ctx = (xmlParserCtxtPtr) ctxt; - - xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx->_private; - - if (error && reader->sErrorFunc) { - reader->sErrorFunc(reader->errorFuncArg, (xmlErrorPtr) error); - } -} - -static void XMLCDECL -xmlTextReaderError(void *ctxt, const char *msg, ...) -{ - va_list ap; - - va_start(ap, msg); - xmlTextReaderGenericError(ctxt, - XML_PARSER_SEVERITY_ERROR, - xmlTextReaderBuildMessage(msg, ap)); - va_end(ap); - -} - -static void XMLCDECL -xmlTextReaderWarning(void *ctxt, const char *msg, ...) -{ - va_list ap; - - va_start(ap, msg); - xmlTextReaderGenericError(ctxt, - XML_PARSER_SEVERITY_WARNING, - xmlTextReaderBuildMessage(msg, ap)); - va_end(ap); -} - -static void XMLCDECL -xmlTextReaderValidityError(void *ctxt, const char *msg, ...) -{ - va_list ap; - - int len = xmlStrlen((const xmlChar *) msg); - - if ((len > 1) && (msg[len - 2] != ':')) { - /* - * some callbacks only report locator information: - * skip them (mimicking behaviour in error.c) - */ - va_start(ap, msg); - xmlTextReaderGenericError(ctxt, - XML_PARSER_SEVERITY_VALIDITY_ERROR, - xmlTextReaderBuildMessage(msg, ap)); - va_end(ap); - } -} - -static void XMLCDECL -xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...) -{ - va_list ap; - - int len = xmlStrlen((const xmlChar *) msg); - - if ((len != 0) && (msg[len - 1] != ':')) { - /* - * some callbacks only report locator information: - * skip them (mimicking behaviour in error.c) - */ - va_start(ap, msg); - xmlTextReaderGenericError(ctxt, - XML_PARSER_SEVERITY_VALIDITY_WARNING, - xmlTextReaderBuildMessage(msg, ap)); - va_end(ap); - } -} - -/** - * xmlTextReaderSetErrorHandler: - * @reader: the xmlTextReaderPtr used - * @f: the callback function to call on error and warnings - * @arg: a user argument to pass to the callback function - * - * Register a callback function that will be called on error and warnings. - * - * If @f is NULL, the default error and warning handlers are restored. - */ -void -xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc f, void *arg) -{ - if (f != NULL) { - reader->ctxt->sax->error = xmlTextReaderError; - reader->ctxt->sax->serror = NULL; - reader->ctxt->vctxt.error = xmlTextReaderValidityError; - reader->ctxt->sax->warning = xmlTextReaderWarning; - reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning; - reader->errorFunc = f; - reader->sErrorFunc = NULL; - reader->errorFuncArg = arg; - } else { - /* restore defaults */ - reader->ctxt->sax->error = xmlParserError; - reader->ctxt->vctxt.error = xmlParserValidityError; - reader->ctxt->sax->warning = xmlParserWarning; - reader->ctxt->vctxt.warning = xmlParserValidityWarning; - reader->errorFunc = NULL; - reader->sErrorFunc = NULL; - reader->errorFuncArg = NULL; - } -} - -/** -* xmlTextReaderSetStructuredErrorHandler: - * @reader: the xmlTextReaderPtr used - * @f: the callback function to call on error and warnings - * @arg: a user argument to pass to the callback function - * - * Register a callback function that will be called on error and warnings. - * - * If @f is NULL, the default error and warning handlers are restored. - */ -void -xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, - xmlStructuredErrorFunc f, void *arg) -{ - if (f != NULL) { - reader->ctxt->sax->error = NULL; - reader->ctxt->sax->serror = xmlTextReaderStructuredError; - reader->ctxt->vctxt.error = xmlTextReaderValidityError; - reader->ctxt->sax->warning = xmlTextReaderWarning; - reader->ctxt->vctxt.warning = xmlTextReaderValidityWarning; - reader->sErrorFunc = f; - reader->errorFunc = NULL; - reader->errorFuncArg = arg; - } else { - /* restore defaults */ - reader->ctxt->sax->error = xmlParserError; - reader->ctxt->sax->serror = NULL; - reader->ctxt->vctxt.error = xmlParserValidityError; - reader->ctxt->sax->warning = xmlParserWarning; - reader->ctxt->vctxt.warning = xmlParserValidityWarning; - reader->errorFunc = NULL; - reader->sErrorFunc = NULL; - reader->errorFuncArg = NULL; - } -} - -/** - * xmlTextReaderIsValid: - * @reader: the xmlTextReaderPtr used - * - * Retrieve the validity status from the parser context - * - * Returns the flag value 1 if valid, 0 if no, and -1 in case of error - */ -int -xmlTextReaderIsValid(xmlTextReaderPtr reader) -{ - if (reader == NULL) - return (-1); - if ((reader->ctxt != NULL) && (reader->ctxt->validate == 1)) - return (reader->ctxt->valid); - return (0); -} - -/** - * xmlTextReaderGetErrorHandler: - * @reader: the xmlTextReaderPtr used - * @f: the callback function or NULL is no callback has been registered - * @arg: a user argument - * - * Retrieve the error callback function and user argument. - */ -void -xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, - xmlTextReaderErrorFunc * f, void **arg) -{ - if (f != NULL) - *f = reader->errorFunc; - if (arg != NULL) - *arg = reader->errorFuncArg; -} -/************************************************************************ - * * - * New set (2.6.0) of simpler and more flexible APIs * - * * - ************************************************************************/ - -/** - * xmlTextReaderSetup: - * @reader: an XML reader - * @input: xmlParserInputBufferPtr used to feed the reader, will - * be destroyed with it. - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Setup an XML reader with new options - * - * Returns 0 in case of success and -1 in case of error. - */ -int -xmlTextReaderSetup(xmlTextReaderPtr reader, - xmlParserInputBufferPtr input, const char *URL, - const char *encoding, int options) -{ - if (reader == NULL) { - if (input != NULL) - xmlFreeParserInputBuffer(input); - return (-1); - } - - /* - * we force the generation of compact text nodes on the reader - * since usr applications should never modify the tree - */ - options |= XML_PARSE_COMPACT; - - reader->doc = NULL; - reader->entNr = 0; - reader->parserFlags = options; - reader->validate = XML_TEXTREADER_NOT_VALIDATE; - if ((input != NULL) && (reader->input != NULL) && - (reader->allocs & XML_TEXTREADER_INPUT)) { - xmlFreeParserInputBuffer(reader->input); - reader->input = NULL; - reader->allocs -= XML_TEXTREADER_INPUT; - } - if (input != NULL) { - reader->input = input; - reader->allocs |= XML_TEXTREADER_INPUT; - } - if (reader->buffer == NULL) - reader->buffer = xmlBufferCreateSize(100); - if (reader->buffer == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlTextReaderSetup : malloc failed\n"); - return (-1); - } - if (reader->sax == NULL) - reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); - if (reader->sax == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlTextReaderSetup : malloc failed\n"); - return (-1); - } - xmlSAXVersion(reader->sax, 2); - reader->startElement = reader->sax->startElement; - reader->sax->startElement = xmlTextReaderStartElement; - reader->endElement = reader->sax->endElement; - reader->sax->endElement = xmlTextReaderEndElement; - reader->startElementNs = reader->sax->startElementNs; - reader->sax->startElementNs = xmlTextReaderStartElementNs; - reader->endElementNs = reader->sax->endElementNs; - reader->sax->endElementNs = xmlTextReaderEndElementNs; - reader->characters = reader->sax->characters; - reader->sax->characters = xmlTextReaderCharacters; - reader->sax->ignorableWhitespace = xmlTextReaderCharacters; - reader->cdataBlock = reader->sax->cdataBlock; - reader->sax->cdataBlock = xmlTextReaderCDataBlock; - - reader->mode = XML_TEXTREADER_MODE_INITIAL; - reader->node = NULL; - reader->curnode = NULL; - if (input != NULL) { - if (reader->input->buffer->use < 4) { - xmlParserInputBufferRead(input, 4); - } - if (reader->ctxt == NULL) { - if (reader->input->buffer->use >= 4) { - reader->ctxt = xmlCreatePushParserCtxt(reader->sax, NULL, - (const char *) reader->input->buffer->content, 4, URL); - reader->base = 0; - reader->cur = 4; - } else { - reader->ctxt = - xmlCreatePushParserCtxt(reader->sax, NULL, NULL, 0, URL); - reader->base = 0; - reader->cur = 0; - } - } else { - xmlParserInputPtr inputStream; - xmlParserInputBufferPtr buf; - xmlCharEncoding enc = XML_CHAR_ENCODING_NONE; - - xmlCtxtReset(reader->ctxt); - buf = xmlAllocParserInputBuffer(enc); - if (buf == NULL) return(-1); - inputStream = xmlNewInputStream(reader->ctxt); - if (inputStream == NULL) { - xmlFreeParserInputBuffer(buf); - return(-1); - } - - if (URL == NULL) - inputStream->filename = NULL; - else - inputStream->filename = (char *) - xmlCanonicPath((const xmlChar *) URL); - inputStream->buf = buf; - inputStream->base = inputStream->buf->buffer->content; - inputStream->cur = inputStream->buf->buffer->content; - inputStream->end = - &inputStream->buf->buffer->content[inputStream->buf->buffer->use]; - - inputPush(reader->ctxt, inputStream); - reader->cur = 0; - } - if (reader->ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlTextReaderSetup : malloc failed\n"); - return (-1); - } - } - if (reader->dict != NULL) { - if (reader->ctxt->dict != NULL) { - if (reader->dict != reader->ctxt->dict) { - xmlDictFree(reader->dict); - reader->dict = reader->ctxt->dict; - } - } else { - reader->ctxt->dict = reader->dict; - } - } else { - if (reader->ctxt->dict == NULL) - reader->ctxt->dict = xmlDictCreate(); - reader->dict = reader->ctxt->dict; - } - reader->ctxt->_private = reader; - reader->ctxt->linenumbers = 1; - reader->ctxt->dictNames = 1; - /* - * use the parser dictionnary to allocate all elements and attributes names - */ - reader->ctxt->docdict = 1; - reader->ctxt->parseMode = XML_PARSE_READER; - - if (options & XML_PARSE_DTDVALID) - reader->validate = XML_TEXTREADER_VALIDATE_DTD; - - xmlCtxtUseOptions(reader->ctxt, options); - if (encoding != NULL) { - xmlCharEncodingHandlerPtr hdlr; - - hdlr = xmlFindCharEncodingHandler(encoding); - if (hdlr != NULL) - xmlSwitchToEncoding(reader->ctxt, hdlr); - } - if ((URL != NULL) && (reader->ctxt->input != NULL) && - (reader->ctxt->input->filename == NULL)) - reader->ctxt->input->filename = (char *) - xmlStrdup((const xmlChar *) URL); - - reader->doc = NULL; - - return (0); -} - -/** - * xmlTextReaderByteConsumed: - * @reader: an XML reader - * - * This function provides the current index of the parser used - * by the reader, relative to the start of the current entity. - * This function actually just wraps a call to xmlBytesConsumed() - * for the parser context associated with the reader. - * See xmlBytesConsumed() for more information. - * - * Returns the index in bytes from the beginning of the entity or -1 - * in case the index could not be computed. - */ -long -xmlTextReaderByteConsumed(xmlTextReaderPtr reader) { - if ((reader == NULL) || (reader->ctxt == NULL)) - return(-1); - return(xmlByteConsumed(reader->ctxt)); -} - - -/** - * xmlReaderWalker: - * @doc: a preparsed document - * - * Create an xmltextReader for a preparsed document. - * - * Returns the new reader or NULL in case of error. - */ -xmlTextReaderPtr -xmlReaderWalker(xmlDocPtr doc) -{ - xmlTextReaderPtr ret; - - if (doc == NULL) - return(NULL); - - ret = xmlMalloc(sizeof(xmlTextReader)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlNewTextReader : malloc failed\n"); - return(NULL); - } - memset(ret, 0, sizeof(xmlTextReader)); - ret->entNr = 0; - ret->input = NULL; - ret->mode = XML_TEXTREADER_MODE_INITIAL; - ret->node = NULL; - ret->curnode = NULL; - ret->base = 0; - ret->cur = 0; - ret->allocs = XML_TEXTREADER_CTXT; - ret->doc = doc; - ret->state = XML_TEXTREADER_START; - ret->dict = xmlDictCreate(); - return(ret); -} - -/** - * xmlReaderForDoc: - * @cur: a pointer to a zero terminated string - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Create an xmltextReader for an XML in-memory document. - * The parsing flags @options are a combination of xmlParserOption. - * - * Returns the new reader or NULL in case of error. - */ -xmlTextReaderPtr -xmlReaderForDoc(const xmlChar * cur, const char *URL, const char *encoding, - int options) -{ - int len; - - if (cur == NULL) - return (NULL); - len = xmlStrlen(cur); - - return (xmlReaderForMemory - ((const char *) cur, len, URL, encoding, options)); -} - -/** - * xmlReaderForFile: - * @filename: a file or URL - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * parse an XML file from the filesystem or the network. - * The parsing flags @options are a combination of xmlParserOption. - * - * Returns the new reader or NULL in case of error. - */ -xmlTextReaderPtr -xmlReaderForFile(const char *filename, const char *encoding, int options) -{ - xmlTextReaderPtr reader; - - reader = xmlNewTextReaderFilename(filename); - if (reader == NULL) - return (NULL); - xmlTextReaderSetup(reader, NULL, NULL, encoding, options); - return (reader); -} - -/** - * xmlReaderForMemory: - * @buffer: a pointer to a char array - * @size: the size of the array - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Create an xmltextReader for an XML in-memory document. - * The parsing flags @options are a combination of xmlParserOption. - * - * Returns the new reader or NULL in case of error. - */ -xmlTextReaderPtr -xmlReaderForMemory(const char *buffer, int size, const char *URL, - const char *encoding, int options) -{ - xmlTextReaderPtr reader; - xmlParserInputBufferPtr buf; - - buf = xmlParserInputBufferCreateStatic(buffer, size, - XML_CHAR_ENCODING_NONE); - if (buf == NULL) { - return (NULL); - } - reader = xmlNewTextReader(buf, URL); - if (reader == NULL) { - xmlFreeParserInputBuffer(buf); - return (NULL); - } - reader->allocs |= XML_TEXTREADER_INPUT; - xmlTextReaderSetup(reader, NULL, URL, encoding, options); - return (reader); -} - -/** - * xmlReaderForFd: - * @fd: an open file descriptor - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Create an xmltextReader for an XML from a file descriptor. - * The parsing flags @options are a combination of xmlParserOption. - * NOTE that the file descriptor will not be closed when the - * reader is closed or reset. - * - * Returns the new reader or NULL in case of error. - */ -xmlTextReaderPtr -xmlReaderForFd(int fd, const char *URL, const char *encoding, int options) -{ - xmlTextReaderPtr reader; - xmlParserInputBufferPtr input; - - if (fd < 0) - return (NULL); - - input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); - if (input == NULL) - return (NULL); - input->closecallback = NULL; - reader = xmlNewTextReader(input, URL); - if (reader == NULL) { - xmlFreeParserInputBuffer(input); - return (NULL); - } - reader->allocs |= XML_TEXTREADER_INPUT; - xmlTextReaderSetup(reader, NULL, URL, encoding, options); - return (reader); -} - -/** - * xmlReaderForIO: - * @ioread: an I/O read function - * @ioclose: an I/O close function - * @ioctx: an I/O handler - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Create an xmltextReader for an XML document from I/O functions and source. - * The parsing flags @options are a combination of xmlParserOption. - * - * Returns the new reader or NULL in case of error. - */ -xmlTextReaderPtr -xmlReaderForIO(xmlInputReadCallback ioread, xmlInputCloseCallback ioclose, - void *ioctx, const char *URL, const char *encoding, - int options) -{ - xmlTextReaderPtr reader; - xmlParserInputBufferPtr input; - - if (ioread == NULL) - return (NULL); - - input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, - XML_CHAR_ENCODING_NONE); - if (input == NULL) - return (NULL); - reader = xmlNewTextReader(input, URL); - if (reader == NULL) { - xmlFreeParserInputBuffer(input); - return (NULL); - } - reader->allocs |= XML_TEXTREADER_INPUT; - xmlTextReaderSetup(reader, NULL, URL, encoding, options); - return (reader); -} - -/** - * xmlReaderNewWalker: - * @reader: an XML reader - * @doc: a preparsed document - * - * Setup an xmltextReader to parse a preparsed XML document. - * This reuses the existing @reader xmlTextReader. - * - * Returns 0 in case of success and -1 in case of error - */ -int -xmlReaderNewWalker(xmlTextReaderPtr reader, xmlDocPtr doc) -{ - if (doc == NULL) - return (-1); - if (reader == NULL) - return (-1); - - if (reader->input != NULL) { - xmlFreeParserInputBuffer(reader->input); - } - if (reader->ctxt != NULL) { - xmlCtxtReset(reader->ctxt); - } - - reader->entNr = 0; - reader->input = NULL; - reader->mode = XML_TEXTREADER_MODE_INITIAL; - reader->node = NULL; - reader->curnode = NULL; - reader->base = 0; - reader->cur = 0; - reader->allocs = XML_TEXTREADER_CTXT; - reader->doc = doc; - reader->state = XML_TEXTREADER_START; - if (reader->dict == NULL) { - if ((reader->ctxt != NULL) && (reader->ctxt->dict != NULL)) - reader->dict = reader->ctxt->dict; - else - reader->dict = xmlDictCreate(); - } - return(0); -} - -/** - * xmlReaderNewDoc: - * @reader: an XML reader - * @cur: a pointer to a zero terminated string - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Setup an xmltextReader to parse an XML in-memory document. - * The parsing flags @options are a combination of xmlParserOption. - * This reuses the existing @reader xmlTextReader. - * - * Returns 0 in case of success and -1 in case of error - */ -int -xmlReaderNewDoc(xmlTextReaderPtr reader, const xmlChar * cur, - const char *URL, const char *encoding, int options) -{ - - int len; - - if (cur == NULL) - return (-1); - if (reader == NULL) - return (-1); - - len = xmlStrlen(cur); - return (xmlReaderNewMemory(reader, (const char *)cur, len, - URL, encoding, options)); -} - -/** - * xmlReaderNewFile: - * @reader: an XML reader - * @filename: a file or URL - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * parse an XML file from the filesystem or the network. - * The parsing flags @options are a combination of xmlParserOption. - * This reuses the existing @reader xmlTextReader. - * - * Returns 0 in case of success and -1 in case of error - */ -int -xmlReaderNewFile(xmlTextReaderPtr reader, const char *filename, - const char *encoding, int options) -{ - xmlParserInputBufferPtr input; - - if (filename == NULL) - return (-1); - if (reader == NULL) - return (-1); - - input = - xmlParserInputBufferCreateFilename(filename, - XML_CHAR_ENCODING_NONE); - if (input == NULL) - return (-1); - return (xmlTextReaderSetup(reader, input, filename, encoding, options)); -} - -/** - * xmlReaderNewMemory: - * @reader: an XML reader - * @buffer: a pointer to a char array - * @size: the size of the array - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Setup an xmltextReader to parse an XML in-memory document. - * The parsing flags @options are a combination of xmlParserOption. - * This reuses the existing @reader xmlTextReader. - * - * Returns 0 in case of success and -1 in case of error - */ -int -xmlReaderNewMemory(xmlTextReaderPtr reader, const char *buffer, int size, - const char *URL, const char *encoding, int options) -{ - xmlParserInputBufferPtr input; - - if (reader == NULL) - return (-1); - if (buffer == NULL) - return (-1); - - input = xmlParserInputBufferCreateStatic(buffer, size, - XML_CHAR_ENCODING_NONE); - if (input == NULL) { - return (-1); - } - return (xmlTextReaderSetup(reader, input, URL, encoding, options)); -} - -/** - * xmlReaderNewFd: - * @reader: an XML reader - * @fd: an open file descriptor - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Setup an xmltextReader to parse an XML from a file descriptor. - * NOTE that the file descriptor will not be closed when the - * reader is closed or reset. - * The parsing flags @options are a combination of xmlParserOption. - * This reuses the existing @reader xmlTextReader. - * - * Returns 0 in case of success and -1 in case of error - */ -int -xmlReaderNewFd(xmlTextReaderPtr reader, int fd, - const char *URL, const char *encoding, int options) -{ - xmlParserInputBufferPtr input; - - if (fd < 0) - return (-1); - if (reader == NULL) - return (-1); - - input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); - if (input == NULL) - return (-1); - input->closecallback = NULL; - return (xmlTextReaderSetup(reader, input, URL, encoding, options)); -} - -/** - * xmlReaderNewIO: - * @reader: an XML reader - * @ioread: an I/O read function - * @ioclose: an I/O close function - * @ioctx: an I/O handler - * @URL: the base URL to use for the document - * @encoding: the document encoding, or NULL - * @options: a combination of xmlParserOption - * - * Setup an xmltextReader to parse an XML document from I/O functions - * and source. - * The parsing flags @options are a combination of xmlParserOption. - * This reuses the existing @reader xmlTextReader. - * - * Returns 0 in case of success and -1 in case of error - */ -int -xmlReaderNewIO(xmlTextReaderPtr reader, xmlInputReadCallback ioread, - xmlInputCloseCallback ioclose, void *ioctx, - const char *URL, const char *encoding, int options) -{ - xmlParserInputBufferPtr input; - - if (ioread == NULL) - return (-1); - if (reader == NULL) - return (-1); - - input = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, - XML_CHAR_ENCODING_NONE); - if (input == NULL) - return (-1); - return (xmlTextReaderSetup(reader, input, URL, encoding, options)); -} -/************************************************************************ - * * - * Utilities * - * * - ************************************************************************/ -#ifdef NOT_USED_YET - -/** - * xmlBase64Decode: - * @in: the input buffer - * @inlen: the size of the input (in), the size read from it (out) - * @to: the output buffer - * @tolen: the size of the output (in), the size written to (out) - * - * Base64 decoder, reads from @in and save in @to - * TODO: tell jody when this is actually exported - * - * Returns 0 if all the input was consumer, 1 if the Base64 end was reached, - * 2 if there wasn't enough space on the output or -1 in case of error. - */ -static int -xmlBase64Decode(const unsigned char *in, unsigned long *inlen, - unsigned char *to, unsigned long *tolen) -{ - unsigned long incur; /* current index in in[] */ - - unsigned long inblk; /* last block index in in[] */ - - unsigned long outcur; /* current index in out[] */ - - unsigned long inmax; /* size of in[] */ - - unsigned long outmax; /* size of out[] */ - - unsigned char cur; /* the current value read from in[] */ - - unsigned char intmp[4], outtmp[4]; /* temporary buffers for the convert */ - - int nbintmp; /* number of byte in intmp[] */ - - int is_ignore; /* cur should be ignored */ - - int is_end = 0; /* the end of the base64 was found */ - - int retval = 1; - - int i; - - if ((in == NULL) || (inlen == NULL) || (to == NULL) || (tolen == NULL)) - return (-1); - - incur = 0; - inblk = 0; - outcur = 0; - inmax = *inlen; - outmax = *tolen; - nbintmp = 0; - - while (1) { - if (incur >= inmax) - break; - cur = in[incur++]; - is_ignore = 0; - if ((cur >= 'A') && (cur <= 'Z')) - cur = cur - 'A'; - else if ((cur >= 'a') && (cur <= 'z')) - cur = cur - 'a' + 26; - else if ((cur >= '0') && (cur <= '9')) - cur = cur - '0' + 52; - else if (cur == '+') - cur = 62; - else if (cur == '/') - cur = 63; - else if (cur == '.') - cur = 0; - else if (cur == '=') /*no op , end of the base64 stream */ - is_end = 1; - else { - is_ignore = 1; - if (nbintmp == 0) - inblk = incur; - } - - if (!is_ignore) { - int nbouttmp = 3; - - int is_break = 0; - - if (is_end) { - if (nbintmp == 0) - break; - if ((nbintmp == 1) || (nbintmp == 2)) - nbouttmp = 1; - else - nbouttmp = 2; - nbintmp = 3; - is_break = 1; - } - intmp[nbintmp++] = cur; - /* - * if intmp is full, push the 4byte sequence as a 3 byte - * sequence out - */ - if (nbintmp == 4) { - nbintmp = 0; - outtmp[0] = (intmp[0] << 2) | ((intmp[1] & 0x30) >> 4); - outtmp[1] = - ((intmp[1] & 0x0F) << 4) | ((intmp[2] & 0x3C) >> 2); - outtmp[2] = ((intmp[2] & 0x03) << 6) | (intmp[3] & 0x3F); - if (outcur + 3 >= outmax) { - retval = 2; - break; - } - - for (i = 0; i < nbouttmp; i++) - to[outcur++] = outtmp[i]; - inblk = incur; - } - - if (is_break) { - retval = 0; - break; - } - } - } - - *tolen = outcur; - *inlen = inblk; - return (retval); -} - -#endif /* NOT_USED_YET */ -#define bottom_xmlreader -#include "elfgcchack.h" -#endif /* LIBXML_READER_ENABLED */ diff --git a/deps/libxml2/xmlstring.c b/deps/libxml2/xmlstring.c deleted file mode 100644 index 910f244485..0000000000 --- a/deps/libxml2/xmlstring.c +++ /dev/null @@ -1,984 +0,0 @@ -/* - * string.c : an XML string utilities module - * - * This module provides various utility functions for manipulating - * the xmlChar* type. All functions named xmlStr* have been moved here - * from the parser.c file (their original home). - * - * See Copyright for the status of this software. - * - * UTF8 string routines from: - * William Brack - * - * daniel@veillard.com - */ - -#define IN_LIBXML -#include "libxml.h" - -#include -#include -#include -#include -#include - -/************************************************************************ - * * - * Commodity functions to handle xmlChars * - * * - ************************************************************************/ - -/** - * xmlStrndup: - * @cur: the input xmlChar * - * @len: the len of @cur - * - * a strndup for array of xmlChar's - * - * Returns a new xmlChar * or NULL - */ -xmlChar * -xmlStrndup(const xmlChar *cur, int len) { - xmlChar *ret; - - if ((cur == NULL) || (len < 0)) return(NULL); - ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlErrMemory(NULL, NULL); - return(NULL); - } - memcpy(ret, cur, len * sizeof(xmlChar)); - ret[len] = 0; - return(ret); -} - -/** - * xmlStrdup: - * @cur: the input xmlChar * - * - * a strdup for array of xmlChar's. Since they are supposed to be - * encoded in UTF-8 or an encoding with 8bit based chars, we assume - * a termination mark of '0'. - * - * Returns a new xmlChar * or NULL - */ -xmlChar * -xmlStrdup(const xmlChar *cur) { - const xmlChar *p = cur; - - if (cur == NULL) return(NULL); - while (*p != 0) p++; /* non input consuming */ - return(xmlStrndup(cur, p - cur)); -} - -/** - * xmlCharStrndup: - * @cur: the input char * - * @len: the len of @cur - * - * a strndup for char's to xmlChar's - * - * Returns a new xmlChar * or NULL - */ - -xmlChar * -xmlCharStrndup(const char *cur, int len) { - int i; - xmlChar *ret; - - if ((cur == NULL) || (len < 0)) return(NULL); - ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlErrMemory(NULL, NULL); - return(NULL); - } - for (i = 0;i < len;i++) { - ret[i] = (xmlChar) cur[i]; - if (ret[i] == 0) return(ret); - } - ret[len] = 0; - return(ret); -} - -/** - * xmlCharStrdup: - * @cur: the input char * - * - * a strdup for char's to xmlChar's - * - * Returns a new xmlChar * or NULL - */ - -xmlChar * -xmlCharStrdup(const char *cur) { - const char *p = cur; - - if (cur == NULL) return(NULL); - while (*p != '\0') p++; /* non input consuming */ - return(xmlCharStrndup(cur, p - cur)); -} - -/** - * xmlStrcmp: - * @str1: the first xmlChar * - * @str2: the second xmlChar * - * - * a strcmp for xmlChar's - * - * Returns the integer result of the comparison - */ - -int -xmlStrcmp(const xmlChar *str1, const xmlChar *str2) { - register int tmp; - - if (str1 == str2) return(0); - if (str1 == NULL) return(-1); - if (str2 == NULL) return(1); - do { - tmp = *str1++ - *str2; - if (tmp != 0) return(tmp); - } while (*str2++ != 0); - return 0; -} - -/** - * xmlStrEqual: - * @str1: the first xmlChar * - * @str2: the second xmlChar * - * - * Check if both strings are equal of have same content. - * Should be a bit more readable and faster than xmlStrcmp() - * - * Returns 1 if they are equal, 0 if they are different - */ - -int -xmlStrEqual(const xmlChar *str1, const xmlChar *str2) { - if (str1 == str2) return(1); - if (str1 == NULL) return(0); - if (str2 == NULL) return(0); - do { - if (*str1++ != *str2) return(0); - } while (*str2++); - return(1); -} - -/** - * xmlStrQEqual: - * @pref: the prefix of the QName - * @name: the localname of the QName - * @str: the second xmlChar * - * - * Check if a QName is Equal to a given string - * - * Returns 1 if they are equal, 0 if they are different - */ - -int -xmlStrQEqual(const xmlChar *pref, const xmlChar *name, const xmlChar *str) { - if (pref == NULL) return(xmlStrEqual(name, str)); - if (name == NULL) return(0); - if (str == NULL) return(0); - - do { - if (*pref++ != *str) return(0); - } while ((*str++) && (*pref)); - if (*str++ != ':') return(0); - do { - if (*name++ != *str) return(0); - } while (*str++); - return(1); -} - -/** - * xmlStrncmp: - * @str1: the first xmlChar * - * @str2: the second xmlChar * - * @len: the max comparison length - * - * a strncmp for xmlChar's - * - * Returns the integer result of the comparison - */ - -int -xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len) { - register int tmp; - - if (len <= 0) return(0); - if (str1 == str2) return(0); - if (str1 == NULL) return(-1); - if (str2 == NULL) return(1); -#ifdef __GNUC__ - tmp = strncmp((const char *)str1, (const char *)str2, len); - return tmp; -#else - do { - tmp = *str1++ - *str2; - if (tmp != 0 || --len == 0) return(tmp); - } while (*str2++ != 0); - return 0; -#endif -} - -static const xmlChar casemap[256] = { - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, - 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, - 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, - 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, - 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, - 0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67, - 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, - 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, - 0x78,0x79,0x7A,0x7B,0x5C,0x5D,0x5E,0x5F, - 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, - 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, - 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, - 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, - 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, - 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, - 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97, - 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, - 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7, - 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, - 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, - 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, - 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, - 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, - 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, - 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, - 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7, - 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, - 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, - 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF -}; - -/** - * xmlStrcasecmp: - * @str1: the first xmlChar * - * @str2: the second xmlChar * - * - * a strcasecmp for xmlChar's - * - * Returns the integer result of the comparison - */ - -int -xmlStrcasecmp(const xmlChar *str1, const xmlChar *str2) { - register int tmp; - - if (str1 == str2) return(0); - if (str1 == NULL) return(-1); - if (str2 == NULL) return(1); - do { - tmp = casemap[*str1++] - casemap[*str2]; - if (tmp != 0) return(tmp); - } while (*str2++ != 0); - return 0; -} - -/** - * xmlStrncasecmp: - * @str1: the first xmlChar * - * @str2: the second xmlChar * - * @len: the max comparison length - * - * a strncasecmp for xmlChar's - * - * Returns the integer result of the comparison - */ - -int -xmlStrncasecmp(const xmlChar *str1, const xmlChar *str2, int len) { - register int tmp; - - if (len <= 0) return(0); - if (str1 == str2) return(0); - if (str1 == NULL) return(-1); - if (str2 == NULL) return(1); - do { - tmp = casemap[*str1++] - casemap[*str2]; - if (tmp != 0 || --len == 0) return(tmp); - } while (*str2++ != 0); - return 0; -} - -/** - * xmlStrchr: - * @str: the xmlChar * array - * @val: the xmlChar to search - * - * a strchr for xmlChar's - * - * Returns the xmlChar * for the first occurrence or NULL. - */ - -const xmlChar * -xmlStrchr(const xmlChar *str, xmlChar val) { - if (str == NULL) return(NULL); - while (*str != 0) { /* non input consuming */ - if (*str == val) return((xmlChar *) str); - str++; - } - return(NULL); -} - -/** - * xmlStrstr: - * @str: the xmlChar * array (haystack) - * @val: the xmlChar to search (needle) - * - * a strstr for xmlChar's - * - * Returns the xmlChar * for the first occurrence or NULL. - */ - -const xmlChar * -xmlStrstr(const xmlChar *str, const xmlChar *val) { - int n; - - if (str == NULL) return(NULL); - if (val == NULL) return(NULL); - n = xmlStrlen(val); - - if (n == 0) return(str); - while (*str != 0) { /* non input consuming */ - if (*str == *val) { - if (!xmlStrncmp(str, val, n)) return((const xmlChar *) str); - } - str++; - } - return(NULL); -} - -/** - * xmlStrcasestr: - * @str: the xmlChar * array (haystack) - * @val: the xmlChar to search (needle) - * - * a case-ignoring strstr for xmlChar's - * - * Returns the xmlChar * for the first occurrence or NULL. - */ - -const xmlChar * -xmlStrcasestr(const xmlChar *str, const xmlChar *val) { - int n; - - if (str == NULL) return(NULL); - if (val == NULL) return(NULL); - n = xmlStrlen(val); - - if (n == 0) return(str); - while (*str != 0) { /* non input consuming */ - if (casemap[*str] == casemap[*val]) - if (!xmlStrncasecmp(str, val, n)) return(str); - str++; - } - return(NULL); -} - -/** - * xmlStrsub: - * @str: the xmlChar * array (haystack) - * @start: the index of the first char (zero based) - * @len: the length of the substring - * - * Extract a substring of a given string - * - * Returns the xmlChar * for the first occurrence or NULL. - */ - -xmlChar * -xmlStrsub(const xmlChar *str, int start, int len) { - int i; - - if (str == NULL) return(NULL); - if (start < 0) return(NULL); - if (len < 0) return(NULL); - - for (i = 0;i < start;i++) { - if (*str == 0) return(NULL); - str++; - } - if (*str == 0) return(NULL); - return(xmlStrndup(str, len)); -} - -/** - * xmlStrlen: - * @str: the xmlChar * array - * - * length of a xmlChar's string - * - * Returns the number of xmlChar contained in the ARRAY. - */ - -int -xmlStrlen(const xmlChar *str) { - int len = 0; - - if (str == NULL) return(0); - while (*str != 0) { /* non input consuming */ - str++; - len++; - } - return(len); -} - -/** - * xmlStrncat: - * @cur: the original xmlChar * array - * @add: the xmlChar * array added - * @len: the length of @add - * - * a strncat for array of xmlChar's, it will extend @cur with the len - * first bytes of @add. Note that if @len < 0 then this is an API error - * and NULL will be returned. - * - * Returns a new xmlChar *, the original @cur is reallocated if needed - * and should not be freed - */ - -xmlChar * -xmlStrncat(xmlChar *cur, const xmlChar *add, int len) { - int size; - xmlChar *ret; - - if ((add == NULL) || (len == 0)) - return(cur); - if (len < 0) - return(NULL); - if (cur == NULL) - return(xmlStrndup(add, len)); - - size = xmlStrlen(cur); - ret = (xmlChar *) xmlRealloc(cur, (size + len + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlErrMemory(NULL, NULL); - return(cur); - } - memcpy(&ret[size], add, len * sizeof(xmlChar)); - ret[size + len] = 0; - return(ret); -} - -/** - * xmlStrncatNew: - * @str1: first xmlChar string - * @str2: second xmlChar string - * @len: the len of @str2 or < 0 - * - * same as xmlStrncat, but creates a new string. The original - * two strings are not freed. If @len is < 0 then the length - * will be calculated automatically. - * - * Returns a new xmlChar * or NULL - */ -xmlChar * -xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) { - int size; - xmlChar *ret; - - if (len < 0) - len = xmlStrlen(str2); - if ((str2 == NULL) || (len == 0)) - return(xmlStrdup(str1)); - if (str1 == NULL) - return(xmlStrndup(str2, len)); - - size = xmlStrlen(str1); - ret = (xmlChar *) xmlMalloc((size + len + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlErrMemory(NULL, NULL); - return(xmlStrndup(str1, size)); - } - memcpy(ret, str1, size * sizeof(xmlChar)); - memcpy(&ret[size], str2, len * sizeof(xmlChar)); - ret[size + len] = 0; - return(ret); -} - -/** - * xmlStrcat: - * @cur: the original xmlChar * array - * @add: the xmlChar * array added - * - * a strcat for array of xmlChar's. Since they are supposed to be - * encoded in UTF-8 or an encoding with 8bit based chars, we assume - * a termination mark of '0'. - * - * Returns a new xmlChar * containing the concatenated string. - */ -xmlChar * -xmlStrcat(xmlChar *cur, const xmlChar *add) { - const xmlChar *p = add; - - if (add == NULL) return(cur); - if (cur == NULL) - return(xmlStrdup(add)); - - while (*p != 0) p++; /* non input consuming */ - return(xmlStrncat(cur, add, p - add)); -} - -/** - * xmlStrPrintf: - * @buf: the result buffer. - * @len: the result buffer length. - * @msg: the message with printf formatting. - * @...: extra parameters for the message. - * - * Formats @msg and places result into @buf. - * - * Returns the number of characters written to @buf or -1 if an error occurs. - */ -int XMLCDECL -xmlStrPrintf(xmlChar *buf, int len, const xmlChar *msg, ...) { - va_list args; - int ret; - - if((buf == NULL) || (msg == NULL)) { - return(-1); - } - - va_start(args, msg); - ret = vsnprintf((char *) buf, len, (const char *) msg, args); - va_end(args); - buf[len - 1] = 0; /* be safe ! */ - - return(ret); -} - -/** - * xmlStrVPrintf: - * @buf: the result buffer. - * @len: the result buffer length. - * @msg: the message with printf formatting. - * @ap: extra parameters for the message. - * - * Formats @msg and places result into @buf. - * - * Returns the number of characters written to @buf or -1 if an error occurs. - */ -int -xmlStrVPrintf(xmlChar *buf, int len, const xmlChar *msg, va_list ap) { - int ret; - - if((buf == NULL) || (msg == NULL)) { - return(-1); - } - - ret = vsnprintf((char *) buf, len, (const char *) msg, ap); - buf[len - 1] = 0; /* be safe ! */ - - return(ret); -} - -/************************************************************************ - * * - * Generic UTF8 handling routines * - * * - * From rfc2044: encoding of the Unicode values on UTF-8: * - * * - * UCS-4 range (hex.) UTF-8 octet sequence (binary) * - * 0000 0000-0000 007F 0xxxxxxx * - * 0000 0080-0000 07FF 110xxxxx 10xxxxxx * - * 0000 0800-0000 FFFF 1110xxxx 10xxxxxx 10xxxxxx * - * * - * I hope we won't use values > 0xFFFF anytime soon ! * - * * - ************************************************************************/ - - -/** - * xmlUTF8Size: - * @utf: pointer to the UTF8 character - * - * calculates the internal size of a UTF8 character - * - * returns the numbers of bytes in the character, -1 on format error - */ -int -xmlUTF8Size(const xmlChar *utf) { - xmlChar mask; - int len; - - if (utf == NULL) - return -1; - if (*utf < 0x80) - return 1; - /* check valid UTF8 character */ - if (!(*utf & 0x40)) - return -1; - /* determine number of bytes in char */ - len = 2; - for (mask=0x20; mask != 0; mask>>=1) { - if (!(*utf & mask)) - return len; - len++; - } - return -1; -} - -/** - * xmlUTF8Charcmp: - * @utf1: pointer to first UTF8 char - * @utf2: pointer to second UTF8 char - * - * compares the two UCS4 values - * - * returns result of the compare as with xmlStrncmp - */ -int -xmlUTF8Charcmp(const xmlChar *utf1, const xmlChar *utf2) { - - if (utf1 == NULL ) { - if (utf2 == NULL) - return 0; - return -1; - } - return xmlStrncmp(utf1, utf2, xmlUTF8Size(utf1)); -} - -/** - * xmlUTF8Strlen: - * @utf: a sequence of UTF-8 encoded bytes - * - * compute the length of an UTF8 string, it doesn't do a full UTF8 - * checking of the content of the string. - * - * Returns the number of characters in the string or -1 in case of error - */ -int -xmlUTF8Strlen(const xmlChar *utf) { - int ret = 0; - - if (utf == NULL) - return(-1); - - while (*utf != 0) { - if (utf[0] & 0x80) { - if ((utf[1] & 0xc0) != 0x80) - return(-1); - if ((utf[0] & 0xe0) == 0xe0) { - if ((utf[2] & 0xc0) != 0x80) - return(-1); - if ((utf[0] & 0xf0) == 0xf0) { - if ((utf[0] & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80) - return(-1); - utf += 4; - } else { - utf += 3; - } - } else { - utf += 2; - } - } else { - utf++; - } - ret++; - } - return(ret); -} - -/** - * xmlGetUTF8Char: - * @utf: a sequence of UTF-8 encoded bytes - * @len: a pointer to the minimum number of bytes present in - * the sequence. This is used to assure the next character - * is completely contained within the sequence. - * - * Read the first UTF8 character from @utf - * - * Returns the char value or -1 in case of error, and sets *len to - * the actual number of bytes consumed (0 in case of error) - */ -int -xmlGetUTF8Char(const unsigned char *utf, int *len) { - unsigned int c; - - if (utf == NULL) - goto error; - if (len == NULL) - goto error; - if (*len < 1) - goto error; - - c = utf[0]; - if (c & 0x80) { - if (*len < 2) - goto error; - if ((utf[1] & 0xc0) != 0x80) - goto error; - if ((c & 0xe0) == 0xe0) { - if (*len < 3) - goto error; - if ((utf[2] & 0xc0) != 0x80) - goto error; - if ((c & 0xf0) == 0xf0) { - if (*len < 4) - goto error; - if ((c & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80) - goto error; - *len = 4; - /* 4-byte code */ - c = (utf[0] & 0x7) << 18; - c |= (utf[1] & 0x3f) << 12; - c |= (utf[2] & 0x3f) << 6; - c |= utf[3] & 0x3f; - } else { - /* 3-byte code */ - *len = 3; - c = (utf[0] & 0xf) << 12; - c |= (utf[1] & 0x3f) << 6; - c |= utf[2] & 0x3f; - } - } else { - /* 2-byte code */ - *len = 2; - c = (utf[0] & 0x1f) << 6; - c |= utf[1] & 0x3f; - } - } else { - /* 1-byte code */ - *len = 1; - } - return(c); - -error: - if (len != NULL) - *len = 0; - return(-1); -} - -/** - * xmlCheckUTF8: - * @utf: Pointer to putative UTF-8 encoded string. - * - * Checks @utf for being valid UTF-8. @utf is assumed to be - * null-terminated. This function is not super-strict, as it will - * allow longer UTF-8 sequences than necessary. Note that Java is - * capable of producing these sequences if provoked. Also note, this - * routine checks for the 4-byte maximum size, but does not check for - * 0x10ffff maximum value. - * - * Return value: true if @utf is valid. - **/ -int -xmlCheckUTF8(const unsigned char *utf) -{ - int ix; - unsigned char c; - - if (utf == NULL) - return(0); - /* - * utf is a string of 1, 2, 3 or 4 bytes. The valid strings - * are as follows (in "bit format"): - * 0xxxxxxx valid 1-byte - * 110xxxxx 10xxxxxx valid 2-byte - * 1110xxxx 10xxxxxx 10xxxxxx valid 3-byte - * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx valid 4-byte - */ - for (ix = 0; (c = utf[ix]);) { /* string is 0-terminated */ - if ((c & 0x80) == 0x00) { /* 1-byte code, starts with 10 */ - ix++; - } else if ((c & 0xe0) == 0xc0) {/* 2-byte code, starts with 110 */ - if ((utf[ix+1] & 0xc0 ) != 0x80) - return 0; - ix += 2; - } else if ((c & 0xf0) == 0xe0) {/* 3-byte code, starts with 1110 */ - if (((utf[ix+1] & 0xc0) != 0x80) || - ((utf[ix+2] & 0xc0) != 0x80)) - return 0; - ix += 3; - } else if ((c & 0xf8) == 0xf0) {/* 4-byte code, starts with 11110 */ - if (((utf[ix+1] & 0xc0) != 0x80) || - ((utf[ix+2] & 0xc0) != 0x80) || - ((utf[ix+3] & 0xc0) != 0x80)) - return 0; - ix += 4; - } else /* unknown encoding */ - return 0; - } - return(1); -} - -/** - * xmlUTF8Strsize: - * @utf: a sequence of UTF-8 encoded bytes - * @len: the number of characters in the array - * - * storage size of an UTF8 string - * the behaviour is not garanteed if the input string is not UTF-8 - * - * Returns the storage size of - * the first 'len' characters of ARRAY - */ - -int -xmlUTF8Strsize(const xmlChar *utf, int len) { - const xmlChar *ptr=utf; - xmlChar ch; - - if (utf == NULL) - return(0); - - if (len <= 0) - return(0); - - while ( len-- > 0) { - if ( !*ptr ) - break; - if ( (ch = *ptr++) & 0x80) - while ((ch<<=1) & 0x80 ) { - ptr++; - if (*ptr == 0) break; - } - } - return (ptr - utf); -} - - -/** - * xmlUTF8Strndup: - * @utf: the input UTF8 * - * @len: the len of @utf (in chars) - * - * a strndup for array of UTF8's - * - * Returns a new UTF8 * or NULL - */ -xmlChar * -xmlUTF8Strndup(const xmlChar *utf, int len) { - xmlChar *ret; - int i; - - if ((utf == NULL) || (len < 0)) return(NULL); - i = xmlUTF8Strsize(utf, len); - ret = (xmlChar *) xmlMallocAtomic((i + 1) * sizeof(xmlChar)); - if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "malloc of %ld byte failed\n", - (len + 1) * (long)sizeof(xmlChar)); - return(NULL); - } - memcpy(ret, utf, i * sizeof(xmlChar)); - ret[i] = 0; - return(ret); -} - -/** - * xmlUTF8Strpos: - * @utf: the input UTF8 * - * @pos: the position of the desired UTF8 char (in chars) - * - * a function to provide the equivalent of fetching a - * character from a string array - * - * Returns a pointer to the UTF8 character or NULL - */ -const xmlChar * -xmlUTF8Strpos(const xmlChar *utf, int pos) { - xmlChar ch; - - if (utf == NULL) return(NULL); - if (pos < 0) - return(NULL); - while (pos--) { - if ((ch=*utf++) == 0) return(NULL); - if ( ch & 0x80 ) { - /* if not simple ascii, verify proper format */ - if ( (ch & 0xc0) != 0xc0 ) - return(NULL); - /* then skip over remaining bytes for this char */ - while ( (ch <<= 1) & 0x80 ) - if ( (*utf++ & 0xc0) != 0x80 ) - return(NULL); - } - } - return((xmlChar *)utf); -} - -/** - * xmlUTF8Strloc: - * @utf: the input UTF8 * - * @utfchar: the UTF8 character to be found - * - * a function to provide the relative location of a UTF8 char - * - * Returns the relative character position of the desired char - * or -1 if not found - */ -int -xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) { - int i, size; - xmlChar ch; - - if (utf==NULL || utfchar==NULL) return -1; - size = xmlUTF8Strsize(utfchar, 1); - for(i=0; (ch=*utf) != 0; i++) { - if (xmlStrncmp(utf, utfchar, size)==0) - return(i); - utf++; - if ( ch & 0x80 ) { - /* if not simple ascii, verify proper format */ - if ( (ch & 0xc0) != 0xc0 ) - return(-1); - /* then skip over remaining bytes for this char */ - while ( (ch <<= 1) & 0x80 ) - if ( (*utf++ & 0xc0) != 0x80 ) - return(-1); - } - } - - return(-1); -} -/** - * xmlUTF8Strsub: - * @utf: a sequence of UTF-8 encoded bytes - * @start: relative pos of first char - * @len: total number to copy - * - * Create a substring from a given UTF-8 string - * Note: positions are given in units of UTF-8 chars - * - * Returns a pointer to a newly created string - * or NULL if any problem - */ - -xmlChar * -xmlUTF8Strsub(const xmlChar *utf, int start, int len) { - int i; - xmlChar ch; - - if (utf == NULL) return(NULL); - if (start < 0) return(NULL); - if (len < 0) return(NULL); - - /* - * Skip over any leading chars - */ - for (i = 0;i < start;i++) { - if ((ch=*utf++) == 0) return(NULL); - if ( ch & 0x80 ) { - /* if not simple ascii, verify proper format */ - if ( (ch & 0xc0) != 0xc0 ) - return(NULL); - /* then skip over remaining bytes for this char */ - while ( (ch <<= 1) & 0x80 ) - if ( (*utf++ & 0xc0) != 0x80 ) - return(NULL); - } - } - - return(xmlUTF8Strndup(utf, len)); -} - -#define bottom_xmlstring -#include "elfgcchack.h" From a882177f33dbd34dcf893e4ccd71e895795f3c05 Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 2 Jan 2013 15:50:54 +0100 Subject: [PATCH 3/4] Fix memory leaks in rxml. --- compat/rxml/Makefile | 2 +- compat/rxml/rxml.c | 7 +++++++ compat/rxml/rxml_test.c | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/compat/rxml/Makefile b/compat/rxml/Makefile index 30a4818eba..f3d54f17e1 100644 --- a/compat/rxml/Makefile +++ b/compat/rxml/Makefile @@ -3,7 +3,7 @@ TARGET := rxml SOURCES := $(wildcard *.c) OBJS := $(SOURCES:.c=.o) -CFLAGS += -Wall -pedantic -std=gnu99 -O3 -g +CFLAGS += -DRXML_TEST -Wall -pedantic -std=gnu99 -O0 -g all: $(TARGET) diff --git a/compat/rxml/rxml.c b/compat/rxml/rxml.c index 95dbb6bab2..1eccb8bf59 100644 --- a/compat/rxml/rxml.c +++ b/compat/rxml/rxml.c @@ -21,7 +21,10 @@ #include #include #include "../../boolean.h" + +#ifndef RXML_TEST #include "../../general.h" +#endif struct rxml_document { @@ -53,6 +56,8 @@ static void rxml_free_node(struct rxml_node *node) head = next_attrib; } + free(node->name); + free(node->data); free(node); } @@ -345,7 +350,9 @@ static char *purge_xml_comments(const char *str) rxml_document_t *rxml_load_document(const char *path) { +#ifndef RXML_TEST RARCH_WARN("Using RXML as drop in for libxml2. Behavior might be very buggy.\n"); +#endif char *memory_buffer = NULL; char *new_memory_buffer = NULL; diff --git a/compat/rxml/rxml_test.c b/compat/rxml/rxml_test.c index 047dd34656..0e18c99f1e 100644 --- a/compat/rxml/rxml_test.c +++ b/compat/rxml/rxml_test.c @@ -25,8 +25,8 @@ static void print_siblings(struct rxml_node *node, unsigned level) for (const struct rxml_attrib_node *attrib = node->attrib; attrib; attrib = attrib->next) fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "", attrib->attrib, attrib->value); - if (node->childs) - print_siblings(node->childs, level + 1); + if (node->children) + print_siblings(node->children, level + 1); if (node->next) print_siblings(node->next, level); From ec58657b10fd58e7634c80c72fff59d86b0318c6 Mon Sep 17 00:00:00 2001 From: Themaister Date: Wed, 2 Jan 2013 16:43:53 +0100 Subject: [PATCH 4/4] Fix warnings. --- cheats.c | 2 +- hash.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cheats.c b/cheats.c index e69c82eb87..2feb89668a 100644 --- a/cheats.c +++ b/cheats.c @@ -161,7 +161,7 @@ static void cheat_manager_load_config(cheat_manager_t *handle, const char *path, if (!conf) return; - char *str; + char *str = NULL; if (!config_get_string(conf, sha256, &str)) { config_file_free(conf); diff --git a/hash.c b/hash.c index 216e53e4df..7690e99969 100644 --- a/hash.c +++ b/hash.c @@ -163,8 +163,8 @@ static void sha256_final(struct sha256_ctx *p) memset(p->in.u8 + p->inlen, 0, 56 - p->inlen); len = p->len << 3; - store32be(p->in.u32 + 14, len >> 32); - store32be(p->in.u32 + 15, len); + store32be(p->in.u32 + 14, (uint32_t)(len >> 32)); + store32be(p->in.u32 + 15, (uint32_t)len); sha256_block(p); }